Lines Matching refs:mlxsw_sp
72 struct mlxsw_sp *mlxsw_sp; member
137 err = mlxsw_reg_write(fid_family->mlxsw_sp->core, MLXSW_REG(sftr), in mlxsw_sp_fid_flood_set()
178 mlxsw_sp_fid_type_rif_type(const struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_fid_type_rif_type() argument
181 struct mlxsw_sp_fid_core *fid_core = mlxsw_sp->fid_core; in mlxsw_sp_fid_type_rif_type()
210 static int mlxsw_sp_fid_op(struct mlxsw_sp *mlxsw_sp, u16 fid_index, in mlxsw_sp_fid_op() argument
217 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sfmr), sfmr_pl); in mlxsw_sp_fid_op()
220 static int mlxsw_sp_fid_vid_map(struct mlxsw_sp *mlxsw_sp, u16 fid_index, in mlxsw_sp_fid_vid_map() argument
227 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(svfa), svfa_pl); in mlxsw_sp_fid_vid_map()
230 static int __mlxsw_sp_fid_port_vid_map(struct mlxsw_sp *mlxsw_sp, u16 fid_index, in __mlxsw_sp_fid_port_vid_map() argument
237 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(svfa), svfa_pl); in __mlxsw_sp_fid_port_vid_map()
242 struct mlxsw_sp *mlxsw_sp = fid->fid_family->mlxsw_sp; in mlxsw_sp_fid_8021q_configure() local
246 err = mlxsw_sp_fid_op(mlxsw_sp, fid->fid_index, fid->fid_index, true); in mlxsw_sp_fid_8021q_configure()
251 err = mlxsw_sp_fid_vid_map(mlxsw_sp, fid->fid_index, fid_8021q->vid, in mlxsw_sp_fid_8021q_configure()
259 mlxsw_sp_fid_op(mlxsw_sp, fid->fid_index, 0, false); in mlxsw_sp_fid_8021q_configure()
265 struct mlxsw_sp *mlxsw_sp = fid->fid_family->mlxsw_sp; in mlxsw_sp_fid_8021q_deconfigure() local
269 mlxsw_sp_fid_vid_map(mlxsw_sp, fid->fid_index, fid_8021q->vid, false); in mlxsw_sp_fid_8021q_deconfigure()
270 mlxsw_sp_fid_op(mlxsw_sp, fid->fid_index, 0, false); in mlxsw_sp_fid_8021q_deconfigure()
304 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_fid_8021q_port_vid_map() local
311 if (mlxsw_sp->fid_core->port_fid_mappings[local_port] == 0) in mlxsw_sp_fid_8021q_port_vid_map()
313 return __mlxsw_sp_fid_port_vid_map(mlxsw_sp, fid->fid_index, local_port, in mlxsw_sp_fid_8021q_port_vid_map()
321 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_fid_8021q_port_vid_unmap() local
324 if (mlxsw_sp->fid_core->port_fid_mappings[local_port] == 0) in mlxsw_sp_fid_8021q_port_vid_unmap()
326 __mlxsw_sp_fid_port_vid_map(mlxsw_sp, fid->fid_index, local_port, vid, in mlxsw_sp_fid_8021q_port_vid_unmap()
391 return mlxsw_sp_fid_op(fid_family->mlxsw_sp, fid->fid_index, 0, true); in mlxsw_sp_fid_8021d_configure()
396 mlxsw_sp_fid_op(fid->fid_family->mlxsw_sp, fid->fid_index, 0, false); in mlxsw_sp_fid_8021d_deconfigure()
429 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_vp_mode_trans() local
441 err = __mlxsw_sp_fid_port_vid_map(mlxsw_sp, fid->fid_index, in mlxsw_sp_port_vp_mode_trans()
464 __mlxsw_sp_fid_port_vid_map(mlxsw_sp, fid->fid_index, in mlxsw_sp_port_vp_mode_trans()
473 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_vlan_mode_trans() local
486 __mlxsw_sp_fid_port_vid_map(mlxsw_sp, fid->fid_index, in mlxsw_sp_port_vlan_mode_trans()
496 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_fid_8021d_port_vid_map() local
500 err = __mlxsw_sp_fid_port_vid_map(mlxsw_sp, fid->fid_index, in mlxsw_sp_fid_8021d_port_vid_map()
505 if (mlxsw_sp->fid_core->port_fid_mappings[local_port]++ == 0) { in mlxsw_sp_fid_8021d_port_vid_map()
514 mlxsw_sp->fid_core->port_fid_mappings[local_port]--; in mlxsw_sp_fid_8021d_port_vid_map()
515 __mlxsw_sp_fid_port_vid_map(mlxsw_sp, fid->fid_index, in mlxsw_sp_fid_8021d_port_vid_map()
524 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_fid_8021d_port_vid_unmap() local
527 if (mlxsw_sp->fid_core->port_fid_mappings[local_port] == 1) in mlxsw_sp_fid_8021d_port_vid_unmap()
529 mlxsw_sp->fid_core->port_fid_mappings[local_port]--; in mlxsw_sp_fid_8021d_port_vid_unmap()
530 __mlxsw_sp_fid_port_vid_map(mlxsw_sp, fid->fid_index, in mlxsw_sp_fid_8021d_port_vid_unmap()
610 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_fid_rfid_port_vid_map() local
617 if (mlxsw_sp->fid_core->port_fid_mappings[local_port]++ == 0) { in mlxsw_sp_fid_rfid_port_vid_map()
626 mlxsw_sp->fid_core->port_fid_mappings[local_port]--; in mlxsw_sp_fid_rfid_port_vid_map()
634 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_fid_rfid_port_vid_unmap() local
637 if (mlxsw_sp->fid_core->port_fid_mappings[local_port] == 1) in mlxsw_sp_fid_rfid_port_vid_unmap()
639 mlxsw_sp->fid_core->port_fid_mappings[local_port]--; in mlxsw_sp_fid_rfid_port_vid_unmap()
665 struct mlxsw_sp *mlxsw_sp = fid->fid_family->mlxsw_sp; in mlxsw_sp_fid_dummy_configure() local
667 return mlxsw_sp_fid_op(mlxsw_sp, fid->fid_index, 0, true); in mlxsw_sp_fid_dummy_configure()
672 mlxsw_sp_fid_op(fid->fid_family->mlxsw_sp, fid->fid_index, 0, false); in mlxsw_sp_fid_dummy_deconfigure()
711 static struct mlxsw_sp_fid *mlxsw_sp_fid_get(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_fid_get() argument
720 fid_family = mlxsw_sp->fid_core->fid_family_arr[type]; in mlxsw_sp_fid_get()
776 struct mlxsw_sp_fid *mlxsw_sp_fid_8021q_get(struct mlxsw_sp *mlxsw_sp, u16 vid) in mlxsw_sp_fid_8021q_get() argument
778 return mlxsw_sp_fid_get(mlxsw_sp, MLXSW_SP_FID_TYPE_8021Q, &vid); in mlxsw_sp_fid_8021q_get()
781 struct mlxsw_sp_fid *mlxsw_sp_fid_8021d_get(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_fid_8021d_get() argument
784 return mlxsw_sp_fid_get(mlxsw_sp, MLXSW_SP_FID_TYPE_8021D, &br_ifindex); in mlxsw_sp_fid_8021d_get()
787 struct mlxsw_sp_fid *mlxsw_sp_fid_rfid_get(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_fid_rfid_get() argument
790 return mlxsw_sp_fid_get(mlxsw_sp, MLXSW_SP_FID_TYPE_RFID, &rif_index); in mlxsw_sp_fid_rfid_get()
793 struct mlxsw_sp_fid *mlxsw_sp_fid_dummy_get(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_fid_dummy_get() argument
795 return mlxsw_sp_fid_get(mlxsw_sp, MLXSW_SP_FID_TYPE_DUMMY, NULL); in mlxsw_sp_fid_dummy_get()
808 struct mlxsw_sp *mlxsw_sp = fid_family->mlxsw_sp; in mlxsw_sp_fid_flood_table_init() local
817 err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sfgc), sfgc_pl); in mlxsw_sp_fid_flood_table_init()
843 static int mlxsw_sp_fid_family_register(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_fid_family_register() argument
854 fid_family->mlxsw_sp = mlxsw_sp; in mlxsw_sp_fid_family_register()
869 mlxsw_sp->fid_core->fid_family_arr[tmpl->type] = fid_family; in mlxsw_sp_fid_family_register()
881 mlxsw_sp_fid_family_unregister(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_fid_family_unregister() argument
884 mlxsw_sp->fid_core->fid_family_arr[fid_family->type] = NULL; in mlxsw_sp_fid_family_unregister()
892 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_fids_init() local
898 mlxsw_sp->fid_core->port_fid_mappings[mlxsw_sp_port->local_port] = 0; in mlxsw_sp_port_fids_init()
905 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_fids_fini() local
907 mlxsw_sp->fid_core->port_fid_mappings[mlxsw_sp_port->local_port] = 0; in mlxsw_sp_port_fids_fini()
910 int mlxsw_sp_fids_init(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_fids_init() argument
912 unsigned int max_ports = mlxsw_core_max_ports(mlxsw_sp->core); in mlxsw_sp_fids_init()
916 fid_core = kzalloc(sizeof(*mlxsw_sp->fid_core), GFP_KERNEL); in mlxsw_sp_fids_init()
919 mlxsw_sp->fid_core = fid_core; in mlxsw_sp_fids_init()
929 err = mlxsw_sp_fid_family_register(mlxsw_sp, in mlxsw_sp_fids_init()
943 mlxsw_sp_fid_family_unregister(mlxsw_sp, fid_family); in mlxsw_sp_fids_init()
951 void mlxsw_sp_fids_fini(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_fids_fini() argument
953 struct mlxsw_sp_fid_core *fid_core = mlxsw_sp->fid_core; in mlxsw_sp_fids_fini()
957 mlxsw_sp_fid_family_unregister(mlxsw_sp, in mlxsw_sp_fids_fini()