Lines Matching refs:mlxsw_sp
104 struct mlxsw_sp *mlxsw_sp; member
130 bool mlxsw_sp_fid_is_dummy(struct mlxsw_sp *mlxsw_sp, u16 fid_index) in mlxsw_sp_fid_is_dummy() argument
135 fid_family = mlxsw_sp->fid_core->fid_family_arr[fid_type]; in mlxsw_sp_fid_is_dummy()
145 struct mlxsw_sp_fid *mlxsw_sp_fid_lookup_by_index(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_fid_lookup_by_index() argument
150 fid = rhashtable_lookup_fast(&mlxsw_sp->fid_core->fid_ht, &fid_index, in mlxsw_sp_fid_lookup_by_index()
179 struct mlxsw_sp_fid *mlxsw_sp_fid_lookup_by_vni(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_fid_lookup_by_vni() argument
184 fid = rhashtable_lookup_fast(&mlxsw_sp->fid_core->vni_ht, &vni, in mlxsw_sp_fid_lookup_by_vni()
244 struct mlxsw_sp *mlxsw_sp = fid_family->mlxsw_sp; in mlxsw_sp_fid_vni_set() local
253 err = rhashtable_lookup_insert_fast(&mlxsw_sp->fid_core->vni_ht, in mlxsw_sp_fid_vni_set()
268 rhashtable_remove_fast(&mlxsw_sp->fid_core->vni_ht, &fid->vni_ht_node, in mlxsw_sp_fid_vni_set()
277 struct mlxsw_sp *mlxsw_sp = fid_family->mlxsw_sp; in mlxsw_sp_fid_vni_clear() local
284 rhashtable_remove_fast(&mlxsw_sp->fid_core->vni_ht, &fid->vni_ht_node, in mlxsw_sp_fid_vni_clear()
343 err = mlxsw_reg_write(fid_family->mlxsw_sp->core, MLXSW_REG(sftr), in mlxsw_sp_fid_flood_set()
384 mlxsw_sp_fid_type_rif_type(const struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_fid_type_rif_type() argument
387 struct mlxsw_sp_fid_core *fid_core = mlxsw_sp->fid_core; in mlxsw_sp_fid_type_rif_type()
416 static int mlxsw_sp_fid_op(struct mlxsw_sp *mlxsw_sp, u16 fid_index, in mlxsw_sp_fid_op() argument
423 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sfmr), sfmr_pl); in mlxsw_sp_fid_op()
426 static int mlxsw_sp_fid_vni_op(struct mlxsw_sp *mlxsw_sp, u16 fid_index, in mlxsw_sp_fid_vni_op() argument
438 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sfmr), sfmr_pl); in mlxsw_sp_fid_vni_op()
441 static int __mlxsw_sp_fid_port_vid_map(struct mlxsw_sp *mlxsw_sp, u16 fid_index, in __mlxsw_sp_fid_port_vid_map() argument
448 return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(svfa), svfa_pl); in __mlxsw_sp_fid_port_vid_map()
468 return mlxsw_sp_fid_op(fid_family->mlxsw_sp, fid->fid_index, 0, true); in mlxsw_sp_fid_8021d_configure()
474 mlxsw_sp_nve_fid_disable(fid->fid_family->mlxsw_sp, fid); in mlxsw_sp_fid_8021d_deconfigure()
475 mlxsw_sp_fid_op(fid->fid_family->mlxsw_sp, fid->fid_index, 0, false); in mlxsw_sp_fid_8021d_deconfigure()
508 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_vp_mode_trans() local
520 err = __mlxsw_sp_fid_port_vid_map(mlxsw_sp, fid->fid_index, in mlxsw_sp_port_vp_mode_trans()
543 __mlxsw_sp_fid_port_vid_map(mlxsw_sp, fid->fid_index, in mlxsw_sp_port_vp_mode_trans()
552 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_vlan_mode_trans() local
565 __mlxsw_sp_fid_port_vid_map(mlxsw_sp, fid->fid_index, in mlxsw_sp_port_vlan_mode_trans()
575 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_fid_8021d_port_vid_map() local
579 err = __mlxsw_sp_fid_port_vid_map(mlxsw_sp, fid->fid_index, in mlxsw_sp_fid_8021d_port_vid_map()
584 if (mlxsw_sp->fid_core->port_fid_mappings[local_port]++ == 0) { in mlxsw_sp_fid_8021d_port_vid_map()
593 mlxsw_sp->fid_core->port_fid_mappings[local_port]--; in mlxsw_sp_fid_8021d_port_vid_map()
594 __mlxsw_sp_fid_port_vid_map(mlxsw_sp, fid->fid_index, in mlxsw_sp_fid_8021d_port_vid_map()
603 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_fid_8021d_port_vid_unmap() local
606 if (mlxsw_sp->fid_core->port_fid_mappings[local_port] == 1) in mlxsw_sp_fid_8021d_port_vid_unmap()
608 mlxsw_sp->fid_core->port_fid_mappings[local_port]--; in mlxsw_sp_fid_8021d_port_vid_unmap()
609 __mlxsw_sp_fid_port_vid_map(mlxsw_sp, fid->fid_index, in mlxsw_sp_fid_8021d_port_vid_unmap()
617 return mlxsw_sp_fid_vni_op(fid_family->mlxsw_sp, fid->fid_index, vni, in mlxsw_sp_fid_8021d_vni_set()
626 mlxsw_sp_fid_vni_op(fid_family->mlxsw_sp, fid->fid_index, 0, false, in mlxsw_sp_fid_8021d_vni_clear()
635 return mlxsw_sp_fid_vni_op(fid_family->mlxsw_sp, fid->fid_index, in mlxsw_sp_fid_8021d_nve_flood_index_set()
644 mlxsw_sp_fid_vni_op(fid_family->mlxsw_sp, fid->fid_index, fid->vni, in mlxsw_sp_fid_8021d_nve_flood_index_clear()
786 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_fid_rfid_port_vid_map() local
793 if (mlxsw_sp->fid_core->port_fid_mappings[local_port]++ == 0) { in mlxsw_sp_fid_rfid_port_vid_map()
802 mlxsw_sp->fid_core->port_fid_mappings[local_port]--; in mlxsw_sp_fid_rfid_port_vid_map()
810 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_fid_rfid_port_vid_unmap() local
813 if (mlxsw_sp->fid_core->port_fid_mappings[local_port] == 1) in mlxsw_sp_fid_rfid_port_vid_unmap()
815 mlxsw_sp->fid_core->port_fid_mappings[local_port]--; in mlxsw_sp_fid_rfid_port_vid_unmap()
841 struct mlxsw_sp *mlxsw_sp = fid->fid_family->mlxsw_sp; in mlxsw_sp_fid_dummy_configure() local
843 return mlxsw_sp_fid_op(mlxsw_sp, fid->fid_index, 0, true); in mlxsw_sp_fid_dummy_configure()
848 mlxsw_sp_fid_op(fid->fid_family->mlxsw_sp, fid->fid_index, 0, false); in mlxsw_sp_fid_dummy_deconfigure()
887 static struct mlxsw_sp_fid *mlxsw_sp_fid_lookup(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_fid_lookup() argument
894 fid_family = mlxsw_sp->fid_core->fid_family_arr[type]; in mlxsw_sp_fid_lookup()
905 static struct mlxsw_sp_fid *mlxsw_sp_fid_get(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_fid_get() argument
914 fid = mlxsw_sp_fid_lookup(mlxsw_sp, type, arg); in mlxsw_sp_fid_get()
918 fid_family = mlxsw_sp->fid_core->fid_family_arr[type]; in mlxsw_sp_fid_get()
937 err = rhashtable_insert_fast(&mlxsw_sp->fid_core->fid_ht, &fid->ht_node, in mlxsw_sp_fid_get()
959 struct mlxsw_sp *mlxsw_sp = fid_family->mlxsw_sp; in mlxsw_sp_fid_put() local
965 rhashtable_remove_fast(&mlxsw_sp->fid_core->fid_ht, in mlxsw_sp_fid_put()
973 struct mlxsw_sp_fid *mlxsw_sp_fid_8021q_get(struct mlxsw_sp *mlxsw_sp, u16 vid) in mlxsw_sp_fid_8021q_get() argument
975 return mlxsw_sp_fid_get(mlxsw_sp, MLXSW_SP_FID_TYPE_8021Q, &vid); in mlxsw_sp_fid_8021q_get()
978 struct mlxsw_sp_fid *mlxsw_sp_fid_8021d_get(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_fid_8021d_get() argument
981 return mlxsw_sp_fid_get(mlxsw_sp, MLXSW_SP_FID_TYPE_8021D, &br_ifindex); in mlxsw_sp_fid_8021d_get()
984 struct mlxsw_sp_fid *mlxsw_sp_fid_8021q_lookup(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_fid_8021q_lookup() argument
987 return mlxsw_sp_fid_lookup(mlxsw_sp, MLXSW_SP_FID_TYPE_8021Q, &vid); in mlxsw_sp_fid_8021q_lookup()
990 struct mlxsw_sp_fid *mlxsw_sp_fid_8021d_lookup(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_fid_8021d_lookup() argument
993 return mlxsw_sp_fid_lookup(mlxsw_sp, MLXSW_SP_FID_TYPE_8021D, in mlxsw_sp_fid_8021d_lookup()
997 struct mlxsw_sp_fid *mlxsw_sp_fid_rfid_get(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_fid_rfid_get() argument
1000 return mlxsw_sp_fid_get(mlxsw_sp, MLXSW_SP_FID_TYPE_RFID, &rif_index); in mlxsw_sp_fid_rfid_get()
1003 struct mlxsw_sp_fid *mlxsw_sp_fid_dummy_get(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_fid_dummy_get() argument
1005 return mlxsw_sp_fid_get(mlxsw_sp, MLXSW_SP_FID_TYPE_DUMMY, NULL); in mlxsw_sp_fid_dummy_get()
1018 struct mlxsw_sp *mlxsw_sp = fid_family->mlxsw_sp; in mlxsw_sp_fid_flood_table_init() local
1027 err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(sfgc), sfgc_pl); in mlxsw_sp_fid_flood_table_init()
1053 static int mlxsw_sp_fid_family_register(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_fid_family_register() argument
1064 fid_family->mlxsw_sp = mlxsw_sp; in mlxsw_sp_fid_family_register()
1078 mlxsw_sp->fid_core->fid_family_arr[tmpl->type] = fid_family; in mlxsw_sp_fid_family_register()
1090 mlxsw_sp_fid_family_unregister(struct mlxsw_sp *mlxsw_sp, in mlxsw_sp_fid_family_unregister() argument
1093 mlxsw_sp->fid_core->fid_family_arr[fid_family->type] = NULL; in mlxsw_sp_fid_family_unregister()
1101 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_fids_init() local
1107 mlxsw_sp->fid_core->port_fid_mappings[mlxsw_sp_port->local_port] = 0; in mlxsw_sp_port_fids_init()
1114 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp; in mlxsw_sp_port_fids_fini() local
1116 mlxsw_sp->fid_core->port_fid_mappings[mlxsw_sp_port->local_port] = 0; in mlxsw_sp_port_fids_fini()
1119 int mlxsw_sp_fids_init(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_fids_init() argument
1121 unsigned int max_ports = mlxsw_core_max_ports(mlxsw_sp->core); in mlxsw_sp_fids_init()
1125 fid_core = kzalloc(sizeof(*mlxsw_sp->fid_core), GFP_KERNEL); in mlxsw_sp_fids_init()
1128 mlxsw_sp->fid_core = fid_core; in mlxsw_sp_fids_init()
1146 err = mlxsw_sp_fid_family_register(mlxsw_sp, in mlxsw_sp_fids_init()
1160 mlxsw_sp_fid_family_unregister(mlxsw_sp, fid_family); in mlxsw_sp_fids_init()
1172 void mlxsw_sp_fids_fini(struct mlxsw_sp *mlxsw_sp) in mlxsw_sp_fids_fini() argument
1174 struct mlxsw_sp_fid_core *fid_core = mlxsw_sp->fid_core; in mlxsw_sp_fids_fini()
1178 mlxsw_sp_fid_family_unregister(mlxsw_sp, in mlxsw_sp_fids_fini()