Lines Matching refs:fid_family
26 struct mlxsw_sp_fid_family *fid_family; member
101 struct mlxsw_sp_fid_family *fid_family = fid->fid_family; in mlxsw_sp_fid_flood_table_lookup() local
104 for (i = 0; i < fid_family->nr_flood_tables; i++) { in mlxsw_sp_fid_flood_table_lookup()
105 if (fid_family->flood_tables[i].packet_type != packet_type) in mlxsw_sp_fid_flood_table_lookup()
107 return &fid_family->flood_tables[i]; in mlxsw_sp_fid_flood_table_lookup()
117 struct mlxsw_sp_fid_family *fid_family = fid->fid_family; in mlxsw_sp_fid_flood_set() local
118 const struct mlxsw_sp_fid_ops *ops = fid_family->ops; in mlxsw_sp_fid_flood_set()
123 if (WARN_ON(!fid_family->flood_tables || !ops->flood_index)) in mlxsw_sp_fid_flood_set()
137 err = mlxsw_reg_write(fid_family->mlxsw_sp->core, MLXSW_REG(sftr), in mlxsw_sp_fid_flood_set()
146 if (WARN_ON(!fid->fid_family->ops->port_vid_map)) in mlxsw_sp_fid_port_vid_map()
148 return fid->fid_family->ops->port_vid_map(fid, mlxsw_sp_port, vid); in mlxsw_sp_fid_port_vid_map()
154 fid->fid_family->ops->port_vid_unmap(fid, mlxsw_sp_port, vid); in mlxsw_sp_fid_port_vid_unmap()
159 return fid->fid_family->rif_type; in mlxsw_sp_fid_rif_type()
169 return fid->fid_family->type; in mlxsw_sp_fid_type()
242 struct mlxsw_sp *mlxsw_sp = fid->fid_family->mlxsw_sp; in mlxsw_sp_fid_8021q_configure()
265 struct mlxsw_sp *mlxsw_sp = fid->fid_family->mlxsw_sp; in mlxsw_sp_fid_8021q_deconfigure()
276 struct mlxsw_sp_fid_family *fid_family = fid->fid_family; in mlxsw_sp_fid_8021q_index_alloc() local
280 if (vid < fid_family->start_index || vid > fid_family->end_index) in mlxsw_sp_fid_8021q_index_alloc()
389 struct mlxsw_sp_fid_family *fid_family = fid->fid_family; in mlxsw_sp_fid_8021d_configure() local
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()
402 struct mlxsw_sp_fid_family *fid_family = fid->fid_family; in mlxsw_sp_fid_8021d_index_alloc() local
405 nr_fids = fid_family->end_index - fid_family->start_index + 1; in mlxsw_sp_fid_8021d_index_alloc()
406 fid_index = find_first_zero_bit(fid_family->fids_bitmap, nr_fids); in mlxsw_sp_fid_8021d_index_alloc()
409 *p_fid_index = fid_family->start_index + fid_index; in mlxsw_sp_fid_8021d_index_alloc()
424 return fid->fid_index - fid->fid_family->start_index; in mlxsw_sp_fid_8021d_flood_index()
593 *p_fid_index = fid->fid_family->start_index + rif_index; in mlxsw_sp_fid_rfid_index_alloc()
603 return fid->fid_index == rif_index + fid->fid_family->start_index; in mlxsw_sp_fid_rfid_compare()
665 struct mlxsw_sp *mlxsw_sp = fid->fid_family->mlxsw_sp; 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()
678 *p_fid_index = fid->fid_family->start_index; in mlxsw_sp_fid_dummy_index_alloc()
715 struct mlxsw_sp_fid_family *fid_family; in mlxsw_sp_fid_get() local
720 fid_family = mlxsw_sp->fid_core->fid_family_arr[type]; in mlxsw_sp_fid_get()
721 list_for_each_entry(fid, &fid_family->fids_list, list) { in mlxsw_sp_fid_get()
722 if (!fid->fid_family->ops->compare(fid, arg)) in mlxsw_sp_fid_get()
728 fid = kzalloc(fid_family->fid_size, GFP_KERNEL); in mlxsw_sp_fid_get()
731 fid->fid_family = fid_family; in mlxsw_sp_fid_get()
733 err = fid->fid_family->ops->index_alloc(fid, arg, &fid_index); in mlxsw_sp_fid_get()
737 __set_bit(fid_index - fid_family->start_index, fid_family->fids_bitmap); in mlxsw_sp_fid_get()
739 if (fid->fid_family->ops->setup) in mlxsw_sp_fid_get()
740 fid->fid_family->ops->setup(fid, arg); in mlxsw_sp_fid_get()
742 err = fid->fid_family->ops->configure(fid); in mlxsw_sp_fid_get()
746 list_add(&fid->list, &fid_family->fids_list); in mlxsw_sp_fid_get()
751 __clear_bit(fid_index - fid_family->start_index, in mlxsw_sp_fid_get()
752 fid_family->fids_bitmap); in mlxsw_sp_fid_get()
760 struct mlxsw_sp_fid_family *fid_family = fid->fid_family; in mlxsw_sp_fid_put() local
769 fid->fid_family->ops->deconfigure(fid); in mlxsw_sp_fid_put()
770 __clear_bit(fid->fid_index - fid_family->start_index, in mlxsw_sp_fid_put()
771 fid_family->fids_bitmap); in mlxsw_sp_fid_put()
799 mlxsw_sp_fid_flood_table_init(struct mlxsw_sp_fid_family *fid_family, in mlxsw_sp_fid_flood_table_init() argument
808 struct mlxsw_sp *mlxsw_sp = fid_family->mlxsw_sp; in mlxsw_sp_fid_flood_table_init()
826 mlxsw_sp_fid_flood_tables_init(struct mlxsw_sp_fid_family *fid_family) in mlxsw_sp_fid_flood_tables_init() argument
830 for (i = 0; i < fid_family->nr_flood_tables; i++) { in mlxsw_sp_fid_flood_tables_init()
834 flood_table = &fid_family->flood_tables[i]; in mlxsw_sp_fid_flood_tables_init()
835 err = mlxsw_sp_fid_flood_table_init(fid_family, flood_table); in mlxsw_sp_fid_flood_tables_init()
847 struct mlxsw_sp_fid_family *fid_family; in mlxsw_sp_fid_family_register() local
850 fid_family = kmemdup(tmpl, sizeof(*fid_family), GFP_KERNEL); in mlxsw_sp_fid_family_register()
851 if (!fid_family) in mlxsw_sp_fid_family_register()
854 fid_family->mlxsw_sp = mlxsw_sp; in mlxsw_sp_fid_family_register()
855 INIT_LIST_HEAD(&fid_family->fids_list); in mlxsw_sp_fid_family_register()
856 fid_family->fids_bitmap = kcalloc(BITS_TO_LONGS(nr_fids), in mlxsw_sp_fid_family_register()
858 if (!fid_family->fids_bitmap) { in mlxsw_sp_fid_family_register()
863 if (fid_family->flood_tables) { in mlxsw_sp_fid_family_register()
864 err = mlxsw_sp_fid_flood_tables_init(fid_family); in mlxsw_sp_fid_family_register()
869 mlxsw_sp->fid_core->fid_family_arr[tmpl->type] = fid_family; in mlxsw_sp_fid_family_register()
874 kfree(fid_family->fids_bitmap); in mlxsw_sp_fid_family_register()
876 kfree(fid_family); in mlxsw_sp_fid_family_register()
882 struct mlxsw_sp_fid_family *fid_family) 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()
885 kfree(fid_family->fids_bitmap); in mlxsw_sp_fid_family_unregister()
886 WARN_ON_ONCE(!list_empty(&fid_family->fids_list)); in mlxsw_sp_fid_family_unregister()
887 kfree(fid_family); in mlxsw_sp_fid_family_unregister()
940 struct mlxsw_sp_fid_family *fid_family; in mlxsw_sp_fids_init() local
942 fid_family = fid_core->fid_family_arr[i]; in mlxsw_sp_fids_init()
943 mlxsw_sp_fid_family_unregister(mlxsw_sp, fid_family); in mlxsw_sp_fids_init()