Lines Matching refs:mlxsw_sp
59 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_attr_get() local
63 attr->u.ppid.id_len = sizeof(mlxsw_sp->base_mac); in mlxsw_sp_port_attr_get()
64 memcpy(&attr->u.ppid.id, &mlxsw_sp->base_mac, in mlxsw_sp_port_attr_get()
83 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_stp_state_set() local
112 err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(spms), spms_pl); in mlxsw_sp_port_stp_state_set()
132 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in __mlxsw_sp_port_flood_set() local
144 err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sftr), sftr_pl); in __mlxsw_sp_port_flood_set()
157 err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sftr), sftr_pl); in __mlxsw_sp_port_flood_set()
214 static int mlxsw_sp_ageing_set(struct mlxsw_sp *mlxsw_sp, u32 ageing_time) in mlxsw_sp_ageing_set() argument
220 err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sfdat), sfdat_pl); in mlxsw_sp_ageing_set()
223 mlxsw_sp->ageing_time = ageing_time; in mlxsw_sp_ageing_set()
231 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_attr_br_ageing_set() local
243 return mlxsw_sp_ageing_set(mlxsw_sp, ageing_time); in mlxsw_sp_port_attr_br_ageing_set()
276 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_pvid_set() local
280 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(spvid), spvid_pl); in mlxsw_sp_port_pvid_set()
283 static int mlxsw_sp_fid_create(struct mlxsw_sp *mlxsw_sp, u16 fid) in mlxsw_sp_fid_create() argument
289 err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sfmr), sfmr_pl); in mlxsw_sp_fid_create()
294 set_bit(fid, mlxsw_sp->active_fids); in mlxsw_sp_fid_create()
298 static void mlxsw_sp_fid_destroy(struct mlxsw_sp *mlxsw_sp, u16 fid) in mlxsw_sp_fid_destroy() argument
302 clear_bit(fid, mlxsw_sp->active_fids); in mlxsw_sp_fid_destroy()
306 mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sfmr), sfmr_pl); in mlxsw_sp_fid_destroy()
355 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in __mlxsw_sp_port_vlans_add() local
369 if (!test_bit(vid, mlxsw_sp->active_fids)) { in __mlxsw_sp_port_vlans_add()
370 err = mlxsw_sp_fid_create(mlxsw_sp, vid); in __mlxsw_sp_port_vlans_add()
477 err = mlxsw_reg_write(mlxsw_sp_port->mlxsw_sp->core, MLXSW_REG(sfd), in mlxsw_sp_port_fdb_op()
662 err = mlxsw_reg_query(mlxsw_sp_port->mlxsw_sp->core, in mlxsw_sp_port_fdb_dump()
749 static void mlxsw_sp_fdb_notify_mac_process(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_fdb_notify_mac_process() argument
760 mlxsw_sp_port = mlxsw_sp->ports[local_port]; in mlxsw_sp_fdb_notify_mac_process()
762 dev_err_ratelimited(mlxsw_sp->bus_info->dev, "Incorrect local port in FDB notification\n"); in mlxsw_sp_fdb_notify_mac_process()
786 static void mlxsw_sp_fdb_notify_rec_process(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_fdb_notify_rec_process() argument
791 mlxsw_sp_fdb_notify_mac_process(mlxsw_sp, sfn_pl, in mlxsw_sp_fdb_notify_rec_process()
795 mlxsw_sp_fdb_notify_mac_process(mlxsw_sp, sfn_pl, in mlxsw_sp_fdb_notify_rec_process()
801 static void mlxsw_sp_fdb_notify_work_schedule(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_fdb_notify_work_schedule() argument
803 schedule_delayed_work(&mlxsw_sp->fdb_notify.dw, in mlxsw_sp_fdb_notify_work_schedule()
804 msecs_to_jiffies(mlxsw_sp->fdb_notify.interval)); in mlxsw_sp_fdb_notify_work_schedule()
809 struct mlxsw_sp *mlxsw_sp; in mlxsw_sp_fdb_notify_work() local
819 mlxsw_sp = container_of(work, struct mlxsw_sp, fdb_notify.dw.work); in mlxsw_sp_fdb_notify_work()
824 err = mlxsw_reg_query(mlxsw_sp->core, MLXSW_REG(sfn), sfn_pl); in mlxsw_sp_fdb_notify_work()
826 dev_err_ratelimited(mlxsw_sp->bus_info->dev, "Failed to get FDB notifications\n"); in mlxsw_sp_fdb_notify_work()
831 mlxsw_sp_fdb_notify_rec_process(mlxsw_sp, sfn_pl, i); in mlxsw_sp_fdb_notify_work()
837 mlxsw_sp_fdb_notify_work_schedule(mlxsw_sp); in mlxsw_sp_fdb_notify_work()
840 static int mlxsw_sp_fdb_init(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_fdb_init() argument
844 err = mlxsw_sp_ageing_set(mlxsw_sp, MLXSW_SP_DEFAULT_AGEING_TIME); in mlxsw_sp_fdb_init()
846 dev_err(mlxsw_sp->bus_info->dev, "Failed to set default ageing time\n"); in mlxsw_sp_fdb_init()
849 INIT_DELAYED_WORK(&mlxsw_sp->fdb_notify.dw, mlxsw_sp_fdb_notify_work); in mlxsw_sp_fdb_init()
850 mlxsw_sp->fdb_notify.interval = MLXSW_SP_DEFAULT_LEARNING_INTERVAL; in mlxsw_sp_fdb_init()
851 mlxsw_sp_fdb_notify_work_schedule(mlxsw_sp); in mlxsw_sp_fdb_init()
855 static void mlxsw_sp_fdb_fini(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_fdb_fini() argument
857 cancel_delayed_work_sync(&mlxsw_sp->fdb_notify.dw); in mlxsw_sp_fdb_fini()
860 static void mlxsw_sp_fids_fini(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_fids_fini() argument
864 for_each_set_bit(fid, mlxsw_sp->active_fids, VLAN_N_VID) in mlxsw_sp_fids_fini()
865 mlxsw_sp_fid_destroy(mlxsw_sp, fid); in mlxsw_sp_fids_fini()
868 int mlxsw_sp_switchdev_init(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_switchdev_init() argument
870 return mlxsw_sp_fdb_init(mlxsw_sp); in mlxsw_sp_switchdev_init()
873 void mlxsw_sp_switchdev_fini(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_switchdev_fini() argument
875 mlxsw_sp_fdb_fini(mlxsw_sp); in mlxsw_sp_switchdev_fini()
876 mlxsw_sp_fids_fini(mlxsw_sp); in mlxsw_sp_switchdev_fini()