Lines Matching refs:mlxsw_sp
29 struct mlxsw_sp *mlxsw_sp; member
93 mlxsw_sp_bridge_port_fdb_flush(struct mlxsw_sp *mlxsw_sp,
124 bool mlxsw_sp_bridge_device_is_offloaded(const struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_bridge_device_is_offloaded() argument
127 return !!mlxsw_sp_bridge_device_find(mlxsw_sp->bridge, br_dev); in mlxsw_sp_bridge_device_is_offloaded()
133 struct mlxsw_sp *mlxsw_sp = data; in mlxsw_sp_bridge_device_upper_rif_destroy() local
135 mlxsw_sp_rif_destroy_by_dev(mlxsw_sp, dev); in mlxsw_sp_bridge_device_upper_rif_destroy()
139 static void mlxsw_sp_bridge_device_rifs_destroy(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_bridge_device_rifs_destroy() argument
142 mlxsw_sp_rif_destroy_by_dev(mlxsw_sp, dev); in mlxsw_sp_bridge_device_rifs_destroy()
145 mlxsw_sp); in mlxsw_sp_bridge_device_rifs_destroy()
152 struct device *dev = bridge->mlxsw_sp->bus_info->dev; in mlxsw_sp_bridge_device_create()
186 mlxsw_sp_bridge_device_rifs_destroy(bridge->mlxsw_sp, in mlxsw_sp_bridge_device_destroy()
289 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_lower_get(bridge_port->dev); in mlxsw_sp_bridge_port_should_destroy() local
295 if (!mlxsw_sp && list_empty(&bridge_port->vlans_list)) in mlxsw_sp_bridge_port_should_destroy()
462 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_attr_get() local
466 attr->u.ppid.id_len = sizeof(mlxsw_sp->base_mac); in mlxsw_sp_port_attr_get()
467 memcpy(&attr->u.ppid.id, &mlxsw_sp->base_mac, in mlxsw_sp_port_attr_get()
471 mlxsw_sp_port_bridge_flags_get(mlxsw_sp->bridge, attr->orig_dev, in mlxsw_sp_port_attr_get()
518 bridge_port = mlxsw_sp_bridge_port_find(mlxsw_sp_port->mlxsw_sp->bridge, in mlxsw_sp_port_attr_stp_state_set()
645 bridge_port = mlxsw_sp_bridge_port_find(mlxsw_sp_port->mlxsw_sp->bridge, in mlxsw_sp_port_attr_br_flags_set()
676 static int mlxsw_sp_ageing_set(struct mlxsw_sp *mlxsw_sp, u32 ageing_time) in mlxsw_sp_ageing_set() argument
682 err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sfdat), sfdat_pl); in mlxsw_sp_ageing_set()
685 mlxsw_sp->bridge->ageing_time = ageing_time; in mlxsw_sp_ageing_set()
693 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_attr_br_ageing_set() local
705 return mlxsw_sp_ageing_set(mlxsw_sp, ageing_time); in mlxsw_sp_port_attr_br_ageing_set()
713 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_attr_br_vlan_set() local
719 bridge_device = mlxsw_sp_bridge_device_find(mlxsw_sp->bridge, orig_dev); in mlxsw_sp_port_attr_br_vlan_set()
741 bridge_port = mlxsw_sp_bridge_port_find(mlxsw_sp_port->mlxsw_sp->bridge, in mlxsw_sp_port_attr_mrouter_set()
776 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_mc_disabled_set() local
787 bridge_device = mlxsw_sp_bridge_device_find(mlxsw_sp->bridge, orig_dev); in mlxsw_sp_port_mc_disabled_set()
813 static int mlxsw_sp_smid_router_port_set(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_smid_router_port_set() argument
824 mlxsw_sp_router_port(mlxsw_sp), add); in mlxsw_sp_smid_router_port_set()
825 err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(smid), smid_pl); in mlxsw_sp_smid_router_port_set()
831 mlxsw_sp_bridge_mrouter_update_mdb(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_bridge_mrouter_update_mdb() argument
838 mlxsw_sp_smid_router_port_set(mlxsw_sp, mid->mid, add); in mlxsw_sp_bridge_mrouter_update_mdb()
847 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_attr_br_mrouter_set() local
856 bridge_device = mlxsw_sp_bridge_device_find(mlxsw_sp->bridge, orig_dev); in mlxsw_sp_port_attr_br_mrouter_set()
861 mlxsw_sp_bridge_mrouter_update_mdb(mlxsw_sp, bridge_device, in mlxsw_sp_port_attr_br_mrouter_set()
915 mlxsw_sp_span_respin(mlxsw_sp_port->mlxsw_sp); in mlxsw_sp_port_attr_set()
1036 mlxsw_sp_bridge_port_get(mlxsw_sp_port->mlxsw_sp->bridge, in mlxsw_sp_port_vlan_bridge_join()
1075 mlxsw_sp_bridge_port_fdb_flush(mlxsw_sp_port->mlxsw_sp, in mlxsw_sp_port_vlan_bridge_leave()
1083 mlxsw_sp_bridge_port_put(mlxsw_sp_port->mlxsw_sp->bridge, bridge_port); in mlxsw_sp_port_vlan_bridge_leave()
1126 mlxsw_sp_br_ban_rif_pvid_change(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_br_ban_rif_pvid_change() argument
1135 rif = mlxsw_sp_rif_find_by_dev(mlxsw_sp, br_dev); in mlxsw_sp_br_ban_rif_pvid_change()
1164 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_vlans_add() local
1175 err = mlxsw_sp_br_ban_rif_pvid_change(mlxsw_sp, in mlxsw_sp_port_vlans_add()
1185 bridge_port = mlxsw_sp_bridge_port_find(mlxsw_sp->bridge, orig_dev); in mlxsw_sp_port_vlans_add()
1212 mlxsw_sp_bridge_port_fdb_flush(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_bridge_port_fdb_flush() argument
1225 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sfdf), sfdf_pl); in mlxsw_sp_bridge_port_fdb_flush()
1240 static int __mlxsw_sp_port_fdb_uc_op(struct mlxsw_sp *mlxsw_sp, u8 local_port, in __mlxsw_sp_port_fdb_uc_op() argument
1257 err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sfd), sfd_pl); in __mlxsw_sp_port_fdb_uc_op()
1269 static int mlxsw_sp_port_fdb_uc_op(struct mlxsw_sp *mlxsw_sp, u8 local_port, in mlxsw_sp_port_fdb_uc_op() argument
1273 return __mlxsw_sp_port_fdb_uc_op(mlxsw_sp, local_port, mac, fid, adding, in mlxsw_sp_port_fdb_uc_op()
1277 int mlxsw_sp_rif_fdb_op(struct mlxsw_sp *mlxsw_sp, const char *mac, u16 fid, in mlxsw_sp_rif_fdb_op() argument
1280 return __mlxsw_sp_port_fdb_uc_op(mlxsw_sp, 0, mac, fid, adding, in mlxsw_sp_rif_fdb_op()
1285 static int mlxsw_sp_port_fdb_uc_lag_op(struct mlxsw_sp *mlxsw_sp, u16 lag_id, in mlxsw_sp_port_fdb_uc_lag_op() argument
1302 err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sfd), sfd_pl); in mlxsw_sp_port_fdb_uc_lag_op()
1318 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_fdb_set() local
1325 bridge_port = mlxsw_sp_bridge_port_find(mlxsw_sp->bridge, orig_dev); in mlxsw_sp_port_fdb_set()
1340 return mlxsw_sp_port_fdb_uc_op(mlxsw_sp, in mlxsw_sp_port_fdb_set()
1345 return mlxsw_sp_port_fdb_uc_lag_op(mlxsw_sp, in mlxsw_sp_port_fdb_set()
1351 static int mlxsw_sp_port_mdb_op(struct mlxsw_sp *mlxsw_sp, const char *addr, in mlxsw_sp_port_mdb_op() argument
1366 err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sfd), sfd_pl); in mlxsw_sp_port_mdb_op()
1378 static int mlxsw_sp_port_smid_full_entry(struct mlxsw_sp *mlxsw_sp, u16 mid_idx, in mlxsw_sp_port_smid_full_entry() argument
1390 for (i = 1; i < mlxsw_core_max_ports(mlxsw_sp->core); i++) { in mlxsw_sp_port_smid_full_entry()
1391 if (mlxsw_sp->ports[i]) in mlxsw_sp_port_smid_full_entry()
1396 mlxsw_sp_router_port(mlxsw_sp), 1); in mlxsw_sp_port_smid_full_entry()
1398 for_each_set_bit(i, ports_bitmap, mlxsw_core_max_ports(mlxsw_sp->core)) in mlxsw_sp_port_smid_full_entry()
1401 mlxsw_reg_smid_port_set(smid_pl, mlxsw_sp_router_port(mlxsw_sp), in mlxsw_sp_port_smid_full_entry()
1404 err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(smid), smid_pl); in mlxsw_sp_port_smid_full_entry()
1412 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_smid_set() local
1421 err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(smid), smid_pl); in mlxsw_sp_port_smid_set()
1441 mlxsw_sp_bridge_port_get_ports_bitmap(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_bridge_port_get_ports_bitmap() argument
1452 max_lag_members = MLXSW_CORE_RES_GET(mlxsw_sp->core, in mlxsw_sp_bridge_port_get_ports_bitmap()
1456 mlxsw_sp_port = mlxsw_sp_port_lagged_get(mlxsw_sp, in mlxsw_sp_bridge_port_get_ports_bitmap()
1468 struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_mc_get_mrouters_bitmap() argument
1474 mlxsw_sp_bridge_port_get_ports_bitmap(mlxsw_sp, in mlxsw_sp_mc_get_mrouters_bitmap()
1482 mlxsw_sp_mc_write_mdb_entry(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_mc_write_mdb_entry() argument
1492 mid_idx = find_first_zero_bit(mlxsw_sp->bridge->mids_bitmap, in mlxsw_sp_mc_write_mdb_entry()
1497 num_of_ports = mlxsw_core_max_ports(mlxsw_sp->core); in mlxsw_sp_mc_write_mdb_entry()
1504 mlxsw_sp_mc_get_mrouters_bitmap(flood_bitmap, bridge_device, mlxsw_sp); in mlxsw_sp_mc_write_mdb_entry()
1507 err = mlxsw_sp_port_smid_full_entry(mlxsw_sp, mid_idx, flood_bitmap, in mlxsw_sp_mc_write_mdb_entry()
1513 err = mlxsw_sp_port_mdb_op(mlxsw_sp, mid->addr, mid->fid, mid_idx, in mlxsw_sp_mc_write_mdb_entry()
1518 set_bit(mid_idx, mlxsw_sp->bridge->mids_bitmap); in mlxsw_sp_mc_write_mdb_entry()
1523 static int mlxsw_sp_mc_remove_mdb_entry(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_mc_remove_mdb_entry() argument
1529 clear_bit(mid->mid, mlxsw_sp->bridge->mids_bitmap); in mlxsw_sp_mc_remove_mdb_entry()
1531 return mlxsw_sp_port_mdb_op(mlxsw_sp, mid->addr, mid->fid, mid->mid, in mlxsw_sp_mc_remove_mdb_entry()
1536 mlxsw_sp_mid *__mlxsw_sp_mc_alloc(struct mlxsw_sp *mlxsw_sp, in __mlxsw_sp_mc_alloc() argument
1549 BITS_TO_LONGS(mlxsw_core_max_ports(mlxsw_sp->core)); in __mlxsw_sp_mc_alloc()
1562 if (!mlxsw_sp_mc_write_mdb_entry(mlxsw_sp, mid, bridge_device)) in __mlxsw_sp_mc_alloc()
1579 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_remove_from_mid() local
1584 mlxsw_core_max_ports(mlxsw_sp->core))) { in mlxsw_sp_port_remove_from_mid()
1585 err = mlxsw_sp_mc_remove_mdb_entry(mlxsw_sp, mid); in mlxsw_sp_port_remove_from_mid()
1597 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_mdb_add() local
1610 bridge_port = mlxsw_sp_bridge_port_find(mlxsw_sp->bridge, orig_dev); in mlxsw_sp_port_mdb_add()
1625 mid = __mlxsw_sp_mc_alloc(mlxsw_sp, bridge_device, mdb->addr, in mlxsw_sp_port_mdb_add()
1658 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_bridge_mdb_mc_enable_sync() local
1666 mlxsw_sp_mc_write_mdb_entry(mlxsw_sp, mid, in mlxsw_sp_bridge_mdb_mc_enable_sync()
1669 mlxsw_sp_mc_remove_mdb_entry(mlxsw_sp, mid); in mlxsw_sp_bridge_mdb_mc_enable_sync()
1691 struct mlxsw_sp *mlxsw_sp; member
1700 mlxsw_sp_span_respin(respin_work->mlxsw_sp); in mlxsw_sp_span_respin_work()
1705 static void mlxsw_sp_span_respin_schedule(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_span_respin_schedule() argument
1714 respin_work->mlxsw_sp = mlxsw_sp; in mlxsw_sp_span_respin_schedule()
1738 mlxsw_sp_span_respin_schedule(mlxsw_sp_port->mlxsw_sp); in mlxsw_sp_port_obj_add()
1774 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_vlans_del() local
1782 bridge_port = mlxsw_sp_bridge_port_find(mlxsw_sp->bridge, orig_dev); in mlxsw_sp_port_vlans_del()
1820 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_mdb_del() local
1829 bridge_port = mlxsw_sp_bridge_port_find(mlxsw_sp->bridge, orig_dev); in mlxsw_sp_port_mdb_del()
1891 mlxsw_sp_span_respin_schedule(mlxsw_sp_port->mlxsw_sp); in mlxsw_sp_port_obj_del()
1896 static struct mlxsw_sp_port *mlxsw_sp_lag_rep_port(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_lag_rep_port() argument
1903 max_lag_members = MLXSW_CORE_RES_GET(mlxsw_sp->core, in mlxsw_sp_lag_rep_port()
1906 mlxsw_sp_port = mlxsw_sp_port_lagged_get(mlxsw_sp, lag_id, i); in mlxsw_sp_lag_rep_port()
1957 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_lower_get(bridge_device->dev); in mlxsw_sp_bridge_8021q_fid_get() local
1959 return mlxsw_sp_fid_8021q_get(mlxsw_sp, vid); in mlxsw_sp_bridge_8021q_fid_get()
2033 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_lower_get(bridge_device->dev); in mlxsw_sp_bridge_8021d_fid_get() local
2035 return mlxsw_sp_fid_8021d_get(mlxsw_sp, bridge_device->dev->ifindex); in mlxsw_sp_bridge_8021d_fid_get()
2049 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_bridge_join() local
2054 bridge_port = mlxsw_sp_bridge_port_get(mlxsw_sp->bridge, brport_dev); in mlxsw_sp_port_bridge_join()
2067 mlxsw_sp_bridge_port_put(mlxsw_sp->bridge, bridge_port); in mlxsw_sp_port_bridge_join()
2075 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_bridge_leave() local
2079 bridge_device = mlxsw_sp_bridge_device_find(mlxsw_sp->bridge, br_dev); in mlxsw_sp_port_bridge_leave()
2088 mlxsw_sp_bridge_port_put(mlxsw_sp->bridge, bridge_port); in mlxsw_sp_port_bridge_leave()
2103 static void mlxsw_sp_fdb_notify_mac_process(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_fdb_notify_mac_process() argument
2119 mlxsw_sp_port = mlxsw_sp->ports[local_port]; in mlxsw_sp_fdb_notify_mac_process()
2121 dev_err_ratelimited(mlxsw_sp->bus_info->dev, "Incorrect local port in FDB notification\n"); in mlxsw_sp_fdb_notify_mac_process()
2141 err = mlxsw_sp_port_fdb_uc_op(mlxsw_sp, local_port, mac, fid, in mlxsw_sp_fdb_notify_mac_process()
2144 dev_err_ratelimited(mlxsw_sp->bus_info->dev, "Failed to set FDB entry\n"); in mlxsw_sp_fdb_notify_mac_process()
2161 static void mlxsw_sp_fdb_notify_mac_lag_process(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_fdb_notify_mac_lag_process() argument
2178 mlxsw_sp_port = mlxsw_sp_lag_rep_port(mlxsw_sp, lag_id); in mlxsw_sp_fdb_notify_mac_lag_process()
2180 dev_err_ratelimited(mlxsw_sp->bus_info->dev, "Cannot find port representor for LAG\n"); in mlxsw_sp_fdb_notify_mac_lag_process()
2201 err = mlxsw_sp_port_fdb_uc_lag_op(mlxsw_sp, lag_id, mac, fid, lag_vid, in mlxsw_sp_fdb_notify_mac_lag_process()
2204 dev_err_ratelimited(mlxsw_sp->bus_info->dev, "Failed to set FDB entry\n"); in mlxsw_sp_fdb_notify_mac_lag_process()
2221 static void mlxsw_sp_fdb_notify_rec_process(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_fdb_notify_rec_process() argument
2226 mlxsw_sp_fdb_notify_mac_process(mlxsw_sp, sfn_pl, in mlxsw_sp_fdb_notify_rec_process()
2230 mlxsw_sp_fdb_notify_mac_process(mlxsw_sp, sfn_pl, in mlxsw_sp_fdb_notify_rec_process()
2234 mlxsw_sp_fdb_notify_mac_lag_process(mlxsw_sp, sfn_pl, in mlxsw_sp_fdb_notify_rec_process()
2238 mlxsw_sp_fdb_notify_mac_lag_process(mlxsw_sp, sfn_pl, in mlxsw_sp_fdb_notify_rec_process()
2244 static void mlxsw_sp_fdb_notify_work_schedule(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_fdb_notify_work_schedule() argument
2246 struct mlxsw_sp_bridge *bridge = mlxsw_sp->bridge; in mlxsw_sp_fdb_notify_work_schedule()
2255 struct mlxsw_sp *mlxsw_sp; in mlxsw_sp_fdb_notify_work() local
2266 mlxsw_sp = bridge->mlxsw_sp; in mlxsw_sp_fdb_notify_work()
2270 err = mlxsw_reg_query(mlxsw_sp->core, MLXSW_REG(sfn), sfn_pl); in mlxsw_sp_fdb_notify_work()
2272 dev_err_ratelimited(mlxsw_sp->bus_info->dev, "Failed to get FDB notifications\n"); in mlxsw_sp_fdb_notify_work()
2277 mlxsw_sp_fdb_notify_rec_process(mlxsw_sp, sfn_pl, i); in mlxsw_sp_fdb_notify_work()
2282 mlxsw_sp_fdb_notify_work_schedule(mlxsw_sp); in mlxsw_sp_fdb_notify_work()
2332 mlxsw_sp_span_respin(mlxsw_sp_port->mlxsw_sp); in mlxsw_sp_switchdev_event_work()
2402 static int mlxsw_sp_fdb_init(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_fdb_init() argument
2404 struct mlxsw_sp_bridge *bridge = mlxsw_sp->bridge; in mlxsw_sp_fdb_init()
2407 err = mlxsw_sp_ageing_set(mlxsw_sp, MLXSW_SP_DEFAULT_AGEING_TIME); in mlxsw_sp_fdb_init()
2409 dev_err(mlxsw_sp->bus_info->dev, "Failed to set default ageing time\n"); in mlxsw_sp_fdb_init()
2415 dev_err(mlxsw_sp->bus_info->dev, "Failed to register switchdev notifier\n"); in mlxsw_sp_fdb_init()
2421 mlxsw_sp_fdb_notify_work_schedule(mlxsw_sp); in mlxsw_sp_fdb_init()
2425 static void mlxsw_sp_fdb_fini(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_fdb_fini() argument
2427 cancel_delayed_work_sync(&mlxsw_sp->bridge->fdb_notify.dw); in mlxsw_sp_fdb_fini()
2432 int mlxsw_sp_switchdev_init(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_switchdev_init() argument
2436 bridge = kzalloc(sizeof(*mlxsw_sp->bridge), GFP_KERNEL); in mlxsw_sp_switchdev_init()
2439 mlxsw_sp->bridge = bridge; in mlxsw_sp_switchdev_init()
2440 bridge->mlxsw_sp = mlxsw_sp; in mlxsw_sp_switchdev_init()
2442 INIT_LIST_HEAD(&mlxsw_sp->bridge->bridges_list); in mlxsw_sp_switchdev_init()
2447 return mlxsw_sp_fdb_init(mlxsw_sp); in mlxsw_sp_switchdev_init()
2450 void mlxsw_sp_switchdev_fini(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_switchdev_fini() argument
2452 mlxsw_sp_fdb_fini(mlxsw_sp); in mlxsw_sp_switchdev_fini()
2453 WARN_ON(!list_empty(&mlxsw_sp->bridge->bridges_list)); in mlxsw_sp_switchdev_fini()
2454 kfree(mlxsw_sp->bridge); in mlxsw_sp_switchdev_fini()