Lines Matching full:sw

811 static int __prestera_cmd_ret(struct prestera_switch *sw,  in __prestera_cmd_ret()  argument
817 struct prestera_device *dev = sw->dev; in __prestera_cmd_ret()
834 static int prestera_cmd_ret(struct prestera_switch *sw, in prestera_cmd_ret() argument
839 return __prestera_cmd_ret(sw, type, cmd, clen, ret, rlen, 0); in prestera_cmd_ret()
842 static int prestera_cmd_ret_wait(struct prestera_switch *sw, in prestera_cmd_ret_wait() argument
848 return __prestera_cmd_ret(sw, type, cmd, clen, ret, rlen, waitms); in prestera_cmd_ret_wait()
851 static int prestera_cmd(struct prestera_switch *sw, in prestera_cmd() argument
857 return prestera_cmd_ret(sw, type, cmd, clen, &resp.ret, sizeof(resp)); in prestera_cmd()
916 __find_event_handler(const struct prestera_switch *sw, in __find_event_handler() argument
921 list_for_each_entry_rcu(eh, &sw->event_handlers, list) { in __find_event_handler()
929 static int prestera_find_event_handler(const struct prestera_switch *sw, in prestera_find_event_handler() argument
937 tmp = __find_event_handler(sw, type); in prestera_find_event_handler()
949 struct prestera_switch *sw = dev->priv; in prestera_evt_recv() local
962 err = prestera_find_event_handler(sw, msg_type, &eh); in prestera_evt_recv()
972 eh.func(sw, &evt, eh.arg); in prestera_evt_recv()
979 struct prestera_switch *sw = dev->priv; in prestera_pkt_recv() local
986 err = prestera_find_event_handler(sw, PRESTERA_EVENT_TYPE_RXTX, &eh); in prestera_pkt_recv()
990 eh.func(sw, &ev, eh.arg); in prestera_pkt_recv()
1030 err = prestera_cmd_ret(port->sw, PRESTERA_CMD_TYPE_PORT_INFO_GET, in prestera_hw_port_info_get()
1042 int prestera_hw_switch_mac_set(struct prestera_switch *sw, const char *mac) in prestera_hw_switch_mac_set() argument
1050 return prestera_cmd(sw, PRESTERA_CMD_TYPE_SWITCH_ATTR_SET, in prestera_hw_switch_mac_set()
1054 int prestera_hw_switch_init(struct prestera_switch *sw) in prestera_hw_switch_init() argument
1060 INIT_LIST_HEAD(&sw->event_handlers); in prestera_hw_switch_init()
1064 err = prestera_cmd_ret_wait(sw, PRESTERA_CMD_TYPE_SWITCH_INIT, in prestera_hw_switch_init()
1071 sw->dev->recv_msg = prestera_evt_recv; in prestera_hw_switch_init()
1072 sw->dev->recv_pkt = prestera_pkt_recv; in prestera_hw_switch_init()
1073 sw->port_count = __le32_to_cpu(resp.port_count); in prestera_hw_switch_init()
1074 sw->mtu_min = PRESTERA_MIN_MTU; in prestera_hw_switch_init()
1075 sw->mtu_max = __le32_to_cpu(resp.mtu_max); in prestera_hw_switch_init()
1076 sw->id = resp.switch_id; in prestera_hw_switch_init()
1077 sw->lag_member_max = resp.lag_member_max; in prestera_hw_switch_init()
1078 sw->lag_max = resp.lag_max; in prestera_hw_switch_init()
1079 sw->size_tbl_router_nexthop = in prestera_hw_switch_init()
1085 void prestera_hw_switch_fini(struct prestera_switch *sw) in prestera_hw_switch_fini() argument
1087 WARN_ON(!list_empty(&sw->event_handlers)); in prestera_hw_switch_fini()
1090 int prestera_hw_switch_ageing_set(struct prestera_switch *sw, u32 ageing_ms) in prestera_hw_switch_ageing_set() argument
1099 return prestera_cmd(sw, PRESTERA_CMD_TYPE_SWITCH_ATTR_SET, in prestera_hw_switch_ageing_set()
1114 err = prestera_cmd_ret(port->sw, PRESTERA_CMD_TYPE_PORT_ATTR_GET, in prestera_hw_port_mac_mode_get()
1156 return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_PORT_ATTR_SET, in prestera_hw_port_mac_mode_set()
1172 err = prestera_cmd_ret(port->sw, PRESTERA_CMD_TYPE_PORT_ATTR_GET, in prestera_hw_port_phy_mode_get()
1212 return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_PORT_ATTR_SET, in prestera_hw_port_phy_mode_set()
1227 return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_PORT_ATTR_SET, in prestera_hw_port_mtu_set()
1241 return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_PORT_ATTR_SET, in prestera_hw_port_mac_set()
1257 return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_PORT_ATTR_SET, in prestera_hw_port_accept_frm_type()
1272 err = prestera_cmd_ret(port->sw, PRESTERA_CMD_TYPE_PORT_ATTR_GET, in prestera_hw_port_cap_get()
1306 int prestera_hw_vtcam_create(struct prestera_switch *sw, in prestera_hw_vtcam_create() argument
1322 err = prestera_cmd_ret(sw, PRESTERA_CMD_TYPE_VTCAM_CREATE, in prestera_hw_vtcam_create()
1331 int prestera_hw_vtcam_destroy(struct prestera_switch *sw, u32 vtcam_id) in prestera_hw_vtcam_destroy() argument
1337 return prestera_cmd(sw, PRESTERA_CMD_TYPE_VTCAM_DESTROY, in prestera_hw_vtcam_destroy()
1369 int prestera_hw_vtcam_rule_add(struct prestera_switch *sw, in prestera_hw_vtcam_rule_add() argument
1407 err = prestera_cmd_ret(sw, PRESTERA_CMD_TYPE_VTCAM_RULE_ADD, in prestera_hw_vtcam_rule_add()
1418 int prestera_hw_vtcam_rule_del(struct prestera_switch *sw, in prestera_hw_vtcam_rule_del() argument
1426 return prestera_cmd(sw, PRESTERA_CMD_TYPE_VTCAM_RULE_DELETE, in prestera_hw_vtcam_rule_del()
1430 int prestera_hw_vtcam_iface_bind(struct prestera_switch *sw, in prestera_hw_vtcam_iface_bind() argument
1447 return prestera_cmd(sw, PRESTERA_CMD_TYPE_VTCAM_IFACE_BIND, in prestera_hw_vtcam_iface_bind()
1451 int prestera_hw_vtcam_iface_unbind(struct prestera_switch *sw, in prestera_hw_vtcam_iface_unbind() argument
1467 return prestera_cmd(sw, PRESTERA_CMD_TYPE_VTCAM_IFACE_UNBIND, in prestera_hw_vtcam_iface_unbind()
1480 err = prestera_cmd_ret(port->sw, PRESTERA_CMD_TYPE_SPAN_GET, in prestera_hw_span_get()
1505 return prestera_cmd(port->sw, cmd_type, &req.cmd, sizeof(req)); in prestera_hw_span_bind()
1522 return prestera_cmd(port->sw, cmd_type, &req.cmd, sizeof(req)); in prestera_hw_span_unbind()
1525 int prestera_hw_span_release(struct prestera_switch *sw, u8 span_id) in prestera_hw_span_release() argument
1531 return prestera_cmd(sw, PRESTERA_CMD_TYPE_SPAN_RELEASE, in prestera_hw_span_release()
1545 err = prestera_cmd_ret(port->sw, PRESTERA_CMD_TYPE_PORT_ATTR_GET, in prestera_hw_port_type_get()
1565 err = prestera_cmd_ret(port->sw, PRESTERA_CMD_TYPE_PORT_ATTR_GET, in prestera_hw_port_speed_get()
1584 return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_PORT_ATTR_SET, in prestera_hw_port_autoneg_restart()
1600 err = prestera_cmd_ret(port->sw, PRESTERA_CMD_TYPE_PORT_ATTR_GET, in prestera_hw_port_stats_get()
1670 return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_PORT_ATTR_SET, in prestera_hw_port_learning_set()
1688 return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_PORT_ATTR_SET, in prestera_hw_port_uc_flood_set()
1706 return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_PORT_ATTR_SET, in prestera_hw_port_mc_flood_set()
1722 return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_PORT_ATTR_SET, in prestera_hw_port_br_locked_set()
1726 int prestera_hw_vlan_create(struct prestera_switch *sw, u16 vid) in prestera_hw_vlan_create() argument
1732 return prestera_cmd(sw, PRESTERA_CMD_TYPE_VLAN_CREATE, in prestera_hw_vlan_create()
1736 int prestera_hw_vlan_delete(struct prestera_switch *sw, u16 vid) in prestera_hw_vlan_delete() argument
1742 return prestera_cmd(sw, PRESTERA_CMD_TYPE_VLAN_DELETE, in prestera_hw_vlan_delete()
1757 return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_VLAN_PORT_SET, in prestera_hw_vlan_port_set()
1769 return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_VLAN_PVID_SET, in prestera_hw_vlan_port_vid_set()
1782 return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_STP_PORT_SET, in prestera_hw_vlan_port_stp_set()
1800 return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_FDB_ADD, in prestera_hw_fdb_add()
1817 return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_FDB_DELETE, in prestera_hw_fdb_del()
1821 int prestera_hw_lag_fdb_add(struct prestera_switch *sw, u16 lag_id, in prestera_hw_lag_fdb_add() argument
1835 return prestera_cmd(sw, PRESTERA_CMD_TYPE_FDB_ADD, in prestera_hw_lag_fdb_add()
1839 int prestera_hw_lag_fdb_del(struct prestera_switch *sw, u16 lag_id, in prestera_hw_lag_fdb_del() argument
1852 return prestera_cmd(sw, PRESTERA_CMD_TYPE_FDB_DELETE, in prestera_hw_lag_fdb_del()
1866 return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_FDB_FLUSH_PORT, in prestera_hw_fdb_flush_port()
1870 int prestera_hw_fdb_flush_vlan(struct prestera_switch *sw, u16 vid, u32 mode) in prestera_hw_fdb_flush_vlan() argument
1877 return prestera_cmd(sw, PRESTERA_CMD_TYPE_FDB_FLUSH_VLAN, in prestera_hw_fdb_flush_vlan()
1893 return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_FDB_FLUSH_PORT_VLAN, in prestera_hw_fdb_flush_port_vlan()
1897 int prestera_hw_fdb_flush_lag(struct prestera_switch *sw, u16 lag_id, in prestera_hw_fdb_flush_lag() argument
1908 return prestera_cmd(sw, PRESTERA_CMD_TYPE_FDB_FLUSH_PORT, in prestera_hw_fdb_flush_lag()
1912 int prestera_hw_fdb_flush_lag_vlan(struct prestera_switch *sw, in prestera_hw_fdb_flush_lag_vlan() argument
1924 return prestera_cmd(sw, PRESTERA_CMD_TYPE_FDB_FLUSH_PORT_VLAN, in prestera_hw_fdb_flush_lag_vlan()
1928 int prestera_hw_bridge_create(struct prestera_switch *sw, u16 *bridge_id) in prestera_hw_bridge_create() argument
1934 err = prestera_cmd_ret(sw, PRESTERA_CMD_TYPE_BRIDGE_CREATE, in prestera_hw_bridge_create()
1945 int prestera_hw_bridge_delete(struct prestera_switch *sw, u16 bridge_id) in prestera_hw_bridge_delete() argument
1951 return prestera_cmd(sw, PRESTERA_CMD_TYPE_BRIDGE_DELETE, in prestera_hw_bridge_delete()
1963 return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_BRIDGE_PORT_ADD, in prestera_hw_bridge_port_add()
1975 return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_BRIDGE_PORT_DELETE, in prestera_hw_bridge_port_delete()
2001 int prestera_hw_rif_create(struct prestera_switch *sw, in prestera_hw_rif_create() argument
2014 err = prestera_cmd_ret(sw, PRESTERA_CMD_TYPE_ROUTER_RIF_CREATE, in prestera_hw_rif_create()
2023 int prestera_hw_rif_delete(struct prestera_switch *sw, u16 rif_id, in prestera_hw_rif_delete() argument
2035 return prestera_cmd(sw, PRESTERA_CMD_TYPE_ROUTER_RIF_DELETE, &req.cmd, in prestera_hw_rif_delete()
2039 int prestera_hw_vr_create(struct prestera_switch *sw, u16 *vr_id) in prestera_hw_vr_create() argument
2045 err = prestera_cmd_ret(sw, PRESTERA_CMD_TYPE_ROUTER_VR_CREATE, in prestera_hw_vr_create()
2054 int prestera_hw_vr_delete(struct prestera_switch *sw, u16 vr_id) in prestera_hw_vr_delete() argument
2060 return prestera_cmd(sw, PRESTERA_CMD_TYPE_ROUTER_VR_DELETE, &req.cmd, in prestera_hw_vr_delete()
2064 int prestera_hw_lpm_add(struct prestera_switch *sw, u16 vr_id, in prestera_hw_lpm_add() argument
2074 return prestera_cmd(sw, PRESTERA_CMD_TYPE_ROUTER_LPM_ADD, &req.cmd, in prestera_hw_lpm_add()
2078 int prestera_hw_lpm_del(struct prestera_switch *sw, u16 vr_id, in prestera_hw_lpm_del() argument
2087 return prestera_cmd(sw, PRESTERA_CMD_TYPE_ROUTER_LPM_DELETE, &req.cmd, in prestera_hw_lpm_del()
2091 int prestera_hw_nh_entries_set(struct prestera_switch *sw, int count, in prestera_hw_nh_entries_set() argument
2106 return prestera_cmd(sw, PRESTERA_CMD_TYPE_ROUTER_NH_GRP_SET, &req.cmd, in prestera_hw_nh_entries_set()
2110 int prestera_hw_nhgrp_blk_get(struct prestera_switch *sw, in prestera_hw_nhgrp_blk_get() argument
2126 err = prestera_cmd_ret(sw, in prestera_hw_nhgrp_blk_get()
2142 int prestera_hw_nh_group_create(struct prestera_switch *sw, u16 nh_count, in prestera_hw_nh_group_create() argument
2149 err = prestera_cmd_ret(sw, PRESTERA_CMD_TYPE_ROUTER_NH_GRP_ADD, in prestera_hw_nh_group_create()
2158 int prestera_hw_nh_group_delete(struct prestera_switch *sw, u16 nh_count, in prestera_hw_nh_group_delete() argument
2166 return prestera_cmd(sw, PRESTERA_CMD_TYPE_ROUTER_NH_GRP_DELETE, in prestera_hw_nh_group_delete()
2170 int prestera_hw_rxtx_init(struct prestera_switch *sw, in prestera_hw_rxtx_init() argument
2179 err = prestera_cmd_ret(sw, PRESTERA_CMD_TYPE_RXTX_INIT, in prestera_hw_rxtx_init()
2197 return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_LAG_MEMBER_ADD, in prestera_hw_lag_member_add()
2209 return prestera_cmd(port->sw, PRESTERA_CMD_TYPE_LAG_MEMBER_DELETE, in prestera_hw_lag_member_del()
2226 return prestera_cmd(port->sw, cmd, &req.cmd, sizeof(req)); in prestera_hw_lag_member_enable()
2230 prestera_hw_cpu_code_counters_get(struct prestera_switch *sw, u8 code, in prestera_hw_cpu_code_counters_get() argument
2241 err = prestera_cmd_ret(sw, PRESTERA_CMD_TYPE_CPU_CODE_COUNTERS_GET, in prestera_hw_cpu_code_counters_get()
2251 int prestera_hw_event_handler_register(struct prestera_switch *sw, in prestera_hw_event_handler_register() argument
2258 eh = __find_event_handler(sw, type); in prestera_hw_event_handler_register()
2272 list_add_rcu(&eh->list, &sw->event_handlers); in prestera_hw_event_handler_register()
2277 void prestera_hw_event_handler_unregister(struct prestera_switch *sw, in prestera_hw_event_handler_unregister() argument
2283 eh = __find_event_handler(sw, type); in prestera_hw_event_handler_unregister()
2291 int prestera_hw_counter_trigger(struct prestera_switch *sw, u32 block_id) in prestera_hw_counter_trigger() argument
2297 return prestera_cmd(sw, PRESTERA_CMD_TYPE_COUNTER_TRIGGER, in prestera_hw_counter_trigger()
2301 int prestera_hw_counter_abort(struct prestera_switch *sw) in prestera_hw_counter_abort() argument
2305 return prestera_cmd(sw, PRESTERA_CMD_TYPE_COUNTER_ABORT, in prestera_hw_counter_abort()
2309 int prestera_hw_counters_get(struct prestera_switch *sw, u32 idx, in prestera_hw_counters_get() argument
2325 err = prestera_cmd_ret(sw, PRESTERA_CMD_TYPE_COUNTER_GET, in prestera_hw_counters_get()
2343 int prestera_hw_counter_block_get(struct prestera_switch *sw, in prestera_hw_counter_block_get() argument
2353 err = prestera_cmd_ret(sw, PRESTERA_CMD_TYPE_COUNTER_BLOCK_GET, in prestera_hw_counter_block_get()
2365 int prestera_hw_counter_block_release(struct prestera_switch *sw, in prestera_hw_counter_block_release() argument
2372 return prestera_cmd(sw, PRESTERA_CMD_TYPE_COUNTER_BLOCK_RELEASE, in prestera_hw_counter_block_release()
2376 int prestera_hw_counter_clear(struct prestera_switch *sw, u32 block_id, in prestera_hw_counter_clear() argument
2384 return prestera_cmd(sw, PRESTERA_CMD_TYPE_COUNTER_CLEAR, in prestera_hw_counter_clear()
2388 int prestera_hw_policer_create(struct prestera_switch *sw, u8 type, in prestera_hw_policer_create() argument
2397 err = prestera_cmd_ret(sw, PRESTERA_CMD_TYPE_POLICER_CREATE, in prestera_hw_policer_create()
2406 int prestera_hw_policer_release(struct prestera_switch *sw, in prestera_hw_policer_release() argument
2413 return prestera_cmd(sw, PRESTERA_CMD_TYPE_POLICER_RELEASE, in prestera_hw_policer_release()
2417 int prestera_hw_policer_sr_tcm_set(struct prestera_switch *sw, in prestera_hw_policer_sr_tcm_set() argument
2429 return prestera_cmd(sw, PRESTERA_CMD_TYPE_POLICER_SET, in prestera_hw_policer_sr_tcm_set()
2439 err = prestera_cmd_ret(domain->sw, in prestera_hw_flood_domain_create()
2456 return prestera_cmd(domain->sw, PRESTERA_CMD_TYPE_FLOOD_DOMAIN_DESTROY, in prestera_hw_flood_domain_destroy()
2465 struct prestera_switch *sw = domain->sw; in prestera_hw_flood_domain_ports_set() local
2495 if (prestera_lag_id(sw, flood_domain_port->dev, in prestera_hw_flood_domain_ports_set()
2518 err = prestera_cmd(sw, PRESTERA_CMD_TYPE_FLOOD_DOMAIN_PORTS_SET, in prestera_hw_flood_domain_ports_set()
2532 return prestera_cmd(domain->sw, in prestera_hw_flood_domain_ports_reset()
2546 return prestera_cmd(mdb->sw, PRESTERA_CMD_TYPE_MDB_CREATE, &req.cmd, in prestera_hw_mdb_create()
2559 return prestera_cmd(mdb->sw, PRESTERA_CMD_TYPE_MDB_DESTROY, &req.cmd, in prestera_hw_mdb_destroy()