Lines Matching refs:erp_table
45 struct mlxsw_sp_acl_erp_table *erp_table; member
72 (*erp_create)(struct mlxsw_sp_acl_erp_table *erp_table,
74 void (*erp_destroy)(struct mlxsw_sp_acl_erp_table *erp_table,
79 mlxsw_sp_acl_erp_mask_create(struct mlxsw_sp_acl_erp_table *erp_table,
82 mlxsw_sp_acl_erp_mask_destroy(struct mlxsw_sp_acl_erp_table *erp_table,
85 mlxsw_sp_acl_erp_second_mask_create(struct mlxsw_sp_acl_erp_table *erp_table,
88 mlxsw_sp_acl_erp_second_mask_destroy(struct mlxsw_sp_acl_erp_table *erp_table,
91 mlxsw_sp_acl_erp_first_mask_create(struct mlxsw_sp_acl_erp_table *erp_table,
94 mlxsw_sp_acl_erp_first_mask_destroy(struct mlxsw_sp_acl_erp_table *erp_table,
97 mlxsw_sp_acl_erp_no_mask_destroy(struct mlxsw_sp_acl_erp_table *erp_table,
121 mlxsw_sp_acl_erp_table_is_used(const struct mlxsw_sp_acl_erp_table *erp_table) in mlxsw_sp_acl_erp_table_is_used() argument
123 return erp_table->ops != &erp_single_mask_ops && in mlxsw_sp_acl_erp_table_is_used()
124 erp_table->ops != &erp_no_mask_ops; in mlxsw_sp_acl_erp_table_is_used()
130 return erp->index % erp->erp_table->erp_core->num_erp_banks; in mlxsw_sp_acl_erp_bank_get()
134 mlxsw_sp_acl_erp_table_entry_size(const struct mlxsw_sp_acl_erp_table *erp_table) in mlxsw_sp_acl_erp_table_entry_size() argument
136 struct mlxsw_sp_acl_atcam_region *aregion = erp_table->aregion; in mlxsw_sp_acl_erp_table_entry_size()
137 struct mlxsw_sp_acl_erp_core *erp_core = erp_table->erp_core; in mlxsw_sp_acl_erp_table_entry_size()
142 static int mlxsw_sp_acl_erp_id_get(struct mlxsw_sp_acl_erp_table *erp_table, in mlxsw_sp_acl_erp_id_get() argument
147 id = find_first_zero_bit(erp_table->erp_id_bitmap, in mlxsw_sp_acl_erp_id_get()
150 __set_bit(id, erp_table->erp_id_bitmap); in mlxsw_sp_acl_erp_id_get()
158 static void mlxsw_sp_acl_erp_id_put(struct mlxsw_sp_acl_erp_table *erp_table, in mlxsw_sp_acl_erp_id_put() argument
161 __clear_bit(id, erp_table->erp_id_bitmap); in mlxsw_sp_acl_erp_id_put()
181 mlxsw_sp_acl_erp_master_mask_update(struct mlxsw_sp_acl_erp_table *erp_table) in mlxsw_sp_acl_erp_master_mask_update() argument
183 struct mlxsw_sp_acl_tcam_region *region = erp_table->aregion->region; in mlxsw_sp_acl_erp_master_mask_update()
190 bitmap_to_arr32((u32 *) master_mask, erp_table->master_mask.bitmap, in mlxsw_sp_acl_erp_master_mask_update()
197 mlxsw_sp_acl_erp_master_mask_set(struct mlxsw_sp_acl_erp_table *erp_table, in mlxsw_sp_acl_erp_master_mask_set() argument
208 &erp_table->master_mask); in mlxsw_sp_acl_erp_master_mask_set()
210 err = mlxsw_sp_acl_erp_master_mask_update(erp_table); in mlxsw_sp_acl_erp_master_mask_set()
219 &erp_table->master_mask); in mlxsw_sp_acl_erp_master_mask_set()
224 mlxsw_sp_acl_erp_master_mask_clear(struct mlxsw_sp_acl_erp_table *erp_table, in mlxsw_sp_acl_erp_master_mask_clear() argument
235 &erp_table->master_mask); in mlxsw_sp_acl_erp_master_mask_clear()
237 err = mlxsw_sp_acl_erp_master_mask_update(erp_table); in mlxsw_sp_acl_erp_master_mask_clear()
246 &erp_table->master_mask); in mlxsw_sp_acl_erp_master_mask_clear()
251 mlxsw_sp_acl_erp_generic_create(struct mlxsw_sp_acl_erp_table *erp_table, in mlxsw_sp_acl_erp_generic_create() argument
261 err = mlxsw_sp_acl_erp_id_get(erp_table, &erp->id); in mlxsw_sp_acl_erp_generic_create()
266 list_add(&erp->list, &erp_table->atcam_erps_list); in mlxsw_sp_acl_erp_generic_create()
267 erp_table->num_atcam_erps++; in mlxsw_sp_acl_erp_generic_create()
268 erp->erp_table = erp_table; in mlxsw_sp_acl_erp_generic_create()
270 err = mlxsw_sp_acl_erp_master_mask_set(erp_table, &erp->key); in mlxsw_sp_acl_erp_generic_create()
277 erp_table->num_atcam_erps--; in mlxsw_sp_acl_erp_generic_create()
279 mlxsw_sp_acl_erp_id_put(erp_table, erp->id); in mlxsw_sp_acl_erp_generic_create()
288 struct mlxsw_sp_acl_erp_table *erp_table = erp->erp_table; in mlxsw_sp_acl_erp_generic_destroy() local
290 mlxsw_sp_acl_erp_master_mask_clear(erp_table, &erp->key); in mlxsw_sp_acl_erp_generic_destroy()
291 erp_table->num_atcam_erps--; in mlxsw_sp_acl_erp_generic_destroy()
293 mlxsw_sp_acl_erp_id_put(erp_table, erp->id); in mlxsw_sp_acl_erp_generic_destroy()
339 mlxsw_sp_acl_erp_table_master_rp(struct mlxsw_sp_acl_erp_table *erp_table) in mlxsw_sp_acl_erp_table_master_rp() argument
341 if (!list_is_singular(&erp_table->atcam_erps_list)) in mlxsw_sp_acl_erp_table_master_rp()
344 return list_first_entry(&erp_table->atcam_erps_list, in mlxsw_sp_acl_erp_table_master_rp()
348 static int mlxsw_sp_acl_erp_index_get(struct mlxsw_sp_acl_erp_table *erp_table, in mlxsw_sp_acl_erp_index_get() argument
353 index = find_first_zero_bit(erp_table->erp_index_bitmap, in mlxsw_sp_acl_erp_index_get()
354 erp_table->num_max_atcam_erps); in mlxsw_sp_acl_erp_index_get()
355 if (index < erp_table->num_max_atcam_erps) { in mlxsw_sp_acl_erp_index_get()
356 __set_bit(index, erp_table->erp_index_bitmap); in mlxsw_sp_acl_erp_index_get()
364 static void mlxsw_sp_acl_erp_index_put(struct mlxsw_sp_acl_erp_table *erp_table, in mlxsw_sp_acl_erp_index_put() argument
367 __clear_bit(index, erp_table->erp_index_bitmap); in mlxsw_sp_acl_erp_index_put()
371 mlxsw_sp_acl_erp_table_locate(const struct mlxsw_sp_acl_erp_table *erp_table, in mlxsw_sp_acl_erp_table_locate() argument
375 unsigned int entry_size = mlxsw_sp_acl_erp_table_entry_size(erp_table); in mlxsw_sp_acl_erp_table_locate()
376 struct mlxsw_sp_acl_erp_core *erp_core = erp_table->erp_core; in mlxsw_sp_acl_erp_table_locate()
381 *p_erpt_index = erp_table->base_index + row * entry_size; in mlxsw_sp_acl_erp_table_locate()
385 mlxsw_sp_acl_erp_table_erp_add(struct mlxsw_sp_acl_erp_table *erp_table, in mlxsw_sp_acl_erp_table_erp_add() argument
388 struct mlxsw_sp *mlxsw_sp = erp_table->erp_core->mlxsw_sp; in mlxsw_sp_acl_erp_table_erp_add()
393 mlxsw_sp_acl_erp_table_locate(erp_table, erp, &erpt_bank, &erpt_index); in mlxsw_sp_acl_erp_table_erp_add()
394 key_size = (enum mlxsw_reg_perpt_key_size) erp_table->aregion->type; in mlxsw_sp_acl_erp_table_erp_add()
396 0, erp_table->base_index, erp->index, in mlxsw_sp_acl_erp_table_erp_add()
398 mlxsw_reg_perpt_erp_vector_pack(perpt_pl, erp_table->erp_index_bitmap, in mlxsw_sp_acl_erp_table_erp_add()
407 struct mlxsw_sp_acl_erp_table *erp_table = erp->erp_table; in mlxsw_sp_acl_erp_table_erp_del() local
408 struct mlxsw_sp *mlxsw_sp = erp_table->erp_core->mlxsw_sp; in mlxsw_sp_acl_erp_table_erp_del()
413 mlxsw_sp_acl_erp_table_locate(erp_table, erp, &erpt_bank, &erpt_index); in mlxsw_sp_acl_erp_table_erp_del()
414 key_size = (enum mlxsw_reg_perpt_key_size) erp_table->aregion->type; in mlxsw_sp_acl_erp_table_erp_del()
416 0, erp_table->base_index, erp->index, empty_mask); in mlxsw_sp_acl_erp_table_erp_del()
417 mlxsw_reg_perpt_erp_vector_pack(perpt_pl, erp_table->erp_index_bitmap, in mlxsw_sp_acl_erp_table_erp_del()
424 mlxsw_sp_acl_erp_table_enable(struct mlxsw_sp_acl_erp_table *erp_table, in mlxsw_sp_acl_erp_table_enable() argument
427 struct mlxsw_sp_acl_tcam_region *region = erp_table->aregion->region; in mlxsw_sp_acl_erp_table_enable()
428 struct mlxsw_sp *mlxsw_sp = erp_table->erp_core->mlxsw_sp; in mlxsw_sp_acl_erp_table_enable()
432 erp_table->base_index, 0); in mlxsw_sp_acl_erp_table_enable()
433 mlxsw_reg_pererp_erp_vector_pack(pererp_pl, erp_table->erp_index_bitmap, in mlxsw_sp_acl_erp_table_enable()
440 mlxsw_sp_acl_erp_table_disable(struct mlxsw_sp_acl_erp_table *erp_table) in mlxsw_sp_acl_erp_table_disable() argument
442 struct mlxsw_sp_acl_tcam_region *region = erp_table->aregion->region; in mlxsw_sp_acl_erp_table_disable()
443 struct mlxsw_sp *mlxsw_sp = erp_table->erp_core->mlxsw_sp; in mlxsw_sp_acl_erp_table_disable()
447 master_rp = mlxsw_sp_acl_erp_table_master_rp(erp_table); in mlxsw_sp_acl_erp_table_disable()
458 mlxsw_sp_acl_erp_table_relocate(struct mlxsw_sp_acl_erp_table *erp_table) in mlxsw_sp_acl_erp_table_relocate() argument
463 list_for_each_entry(erp, &erp_table->atcam_erps_list, list) { in mlxsw_sp_acl_erp_table_relocate()
464 err = mlxsw_sp_acl_erp_table_erp_add(erp_table, erp); in mlxsw_sp_acl_erp_table_relocate()
472 list_for_each_entry_continue_reverse(erp, &erp_table->atcam_erps_list, in mlxsw_sp_acl_erp_table_relocate()
479 mlxsw_sp_acl_erp_table_expand(struct mlxsw_sp_acl_erp_table *erp_table) in mlxsw_sp_acl_erp_table_expand() argument
481 unsigned int num_erps, old_num_erps = erp_table->num_max_atcam_erps; in mlxsw_sp_acl_erp_table_expand()
482 struct mlxsw_sp_acl_erp_core *erp_core = erp_table->erp_core; in mlxsw_sp_acl_erp_table_expand()
483 unsigned long old_base_index = erp_table->base_index; in mlxsw_sp_acl_erp_table_expand()
484 bool ctcam_le = erp_table->num_ctcam_erps > 0; in mlxsw_sp_acl_erp_table_expand()
487 if (erp_table->num_atcam_erps < erp_table->num_max_atcam_erps) in mlxsw_sp_acl_erp_table_expand()
490 if (erp_table->num_max_atcam_erps == MLXSW_SP_ACL_ERP_MAX_PER_REGION) in mlxsw_sp_acl_erp_table_expand()
495 erp_table->aregion->type, in mlxsw_sp_acl_erp_table_expand()
496 &erp_table->base_index); in mlxsw_sp_acl_erp_table_expand()
499 erp_table->num_max_atcam_erps = num_erps; in mlxsw_sp_acl_erp_table_expand()
501 err = mlxsw_sp_acl_erp_table_relocate(erp_table); in mlxsw_sp_acl_erp_table_expand()
505 err = mlxsw_sp_acl_erp_table_enable(erp_table, ctcam_le); in mlxsw_sp_acl_erp_table_expand()
510 erp_table->aregion->type, old_base_index); in mlxsw_sp_acl_erp_table_expand()
516 erp_table->num_max_atcam_erps = old_num_erps; in mlxsw_sp_acl_erp_table_expand()
518 erp_table->aregion->type, in mlxsw_sp_acl_erp_table_expand()
519 erp_table->base_index); in mlxsw_sp_acl_erp_table_expand()
520 erp_table->base_index = old_base_index; in mlxsw_sp_acl_erp_table_expand()
525 mlxsw_acl_erp_table_bf_add(struct mlxsw_sp_acl_erp_table *erp_table, in mlxsw_acl_erp_table_bf_add() argument
528 struct mlxsw_sp_acl_atcam_region *aregion = erp_table->aregion; in mlxsw_acl_erp_table_bf_add()
535 erp_table->erp_core->bf, in mlxsw_acl_erp_table_bf_add()
547 erp_table->erp_core->bf, in mlxsw_acl_erp_table_bf_add()
553 mlxsw_acl_erp_table_bf_del(struct mlxsw_sp_acl_erp_table *erp_table, in mlxsw_acl_erp_table_bf_del() argument
556 struct mlxsw_sp_acl_atcam_region *aregion = erp_table->aregion; in mlxsw_acl_erp_table_bf_del()
562 erp_table->erp_core->bf, in mlxsw_acl_erp_table_bf_del()
567 mlxsw_sp_acl_erp_region_table_trans(struct mlxsw_sp_acl_erp_table *erp_table) in mlxsw_sp_acl_erp_region_table_trans() argument
569 struct mlxsw_sp_acl_erp_core *erp_core = erp_table->erp_core; in mlxsw_sp_acl_erp_region_table_trans()
575 erp_table->aregion->type, in mlxsw_sp_acl_erp_region_table_trans()
576 &erp_table->base_index); in mlxsw_sp_acl_erp_region_table_trans()
579 erp_table->num_max_atcam_erps = erp_core->num_erp_banks; in mlxsw_sp_acl_erp_region_table_trans()
584 master_rp = mlxsw_sp_acl_erp_table_master_rp(erp_table); in mlxsw_sp_acl_erp_region_table_trans()
594 __set_bit(master_rp->index, erp_table->erp_index_bitmap); in mlxsw_sp_acl_erp_region_table_trans()
596 err = mlxsw_sp_acl_erp_table_erp_add(erp_table, master_rp); in mlxsw_sp_acl_erp_region_table_trans()
604 err = mlxsw_acl_erp_table_bf_add(erp_table, master_rp); in mlxsw_sp_acl_erp_region_table_trans()
608 err = mlxsw_sp_acl_erp_table_enable(erp_table, false); in mlxsw_sp_acl_erp_region_table_trans()
615 mlxsw_acl_erp_table_bf_del(erp_table, master_rp); in mlxsw_sp_acl_erp_region_table_trans()
619 __clear_bit(master_rp->index, erp_table->erp_index_bitmap); in mlxsw_sp_acl_erp_region_table_trans()
621 mlxsw_sp_acl_erp_table_free(erp_core, erp_table->num_max_atcam_erps, in mlxsw_sp_acl_erp_region_table_trans()
622 erp_table->aregion->type, in mlxsw_sp_acl_erp_region_table_trans()
623 erp_table->base_index); in mlxsw_sp_acl_erp_region_table_trans()
628 mlxsw_sp_acl_erp_region_master_mask_trans(struct mlxsw_sp_acl_erp_table *erp_table) in mlxsw_sp_acl_erp_region_master_mask_trans() argument
630 struct mlxsw_sp_acl_erp_core *erp_core = erp_table->erp_core; in mlxsw_sp_acl_erp_region_master_mask_trans()
633 mlxsw_sp_acl_erp_table_disable(erp_table); in mlxsw_sp_acl_erp_region_master_mask_trans()
634 master_rp = mlxsw_sp_acl_erp_table_master_rp(erp_table); in mlxsw_sp_acl_erp_region_master_mask_trans()
637 mlxsw_acl_erp_table_bf_del(erp_table, master_rp); in mlxsw_sp_acl_erp_region_master_mask_trans()
639 __clear_bit(master_rp->index, erp_table->erp_index_bitmap); in mlxsw_sp_acl_erp_region_master_mask_trans()
640 mlxsw_sp_acl_erp_table_free(erp_core, erp_table->num_max_atcam_erps, in mlxsw_sp_acl_erp_region_master_mask_trans()
641 erp_table->aregion->type, in mlxsw_sp_acl_erp_region_master_mask_trans()
642 erp_table->base_index); in mlxsw_sp_acl_erp_region_master_mask_trans()
646 mlxsw_sp_acl_erp_region_erp_add(struct mlxsw_sp_acl_erp_table *erp_table, in mlxsw_sp_acl_erp_region_erp_add() argument
649 struct mlxsw_sp_acl_tcam_region *region = erp_table->aregion->region; in mlxsw_sp_acl_erp_region_erp_add()
650 struct mlxsw_sp *mlxsw_sp = erp_table->erp_core->mlxsw_sp; in mlxsw_sp_acl_erp_region_erp_add()
651 bool ctcam_le = erp_table->num_ctcam_erps > 0; in mlxsw_sp_acl_erp_region_erp_add()
655 erp_table->base_index, 0); in mlxsw_sp_acl_erp_region_erp_add()
656 mlxsw_reg_pererp_erp_vector_pack(pererp_pl, erp_table->erp_index_bitmap, in mlxsw_sp_acl_erp_region_erp_add()
665 struct mlxsw_sp_acl_erp_table *erp_table = erp->erp_table; in mlxsw_sp_acl_erp_region_erp_del() local
666 struct mlxsw_sp_acl_tcam_region *region = erp_table->aregion->region; in mlxsw_sp_acl_erp_region_erp_del()
667 struct mlxsw_sp *mlxsw_sp = erp_table->erp_core->mlxsw_sp; in mlxsw_sp_acl_erp_region_erp_del()
668 bool ctcam_le = erp_table->num_ctcam_erps > 0; in mlxsw_sp_acl_erp_region_erp_del()
672 erp_table->base_index, 0); in mlxsw_sp_acl_erp_region_erp_del()
673 mlxsw_reg_pererp_erp_vector_pack(pererp_pl, erp_table->erp_index_bitmap, in mlxsw_sp_acl_erp_region_erp_del()
681 mlxsw_sp_acl_erp_region_ctcam_enable(struct mlxsw_sp_acl_erp_table *erp_table) in mlxsw_sp_acl_erp_region_ctcam_enable() argument
684 if (erp_table->num_ctcam_erps > 1) in mlxsw_sp_acl_erp_region_ctcam_enable()
687 return mlxsw_sp_acl_erp_table_enable(erp_table, true); in mlxsw_sp_acl_erp_region_ctcam_enable()
691 mlxsw_sp_acl_erp_region_ctcam_disable(struct mlxsw_sp_acl_erp_table *erp_table) in mlxsw_sp_acl_erp_region_ctcam_disable() argument
694 if (erp_table->num_ctcam_erps > 1) in mlxsw_sp_acl_erp_region_ctcam_disable()
697 mlxsw_sp_acl_erp_table_enable(erp_table, false); in mlxsw_sp_acl_erp_region_ctcam_disable()
701 __mlxsw_sp_acl_erp_table_other_inc(struct mlxsw_sp_acl_erp_table *erp_table, in __mlxsw_sp_acl_erp_table_other_inc() argument
709 if (!mlxsw_sp_acl_erp_table_is_used(erp_table)) { in __mlxsw_sp_acl_erp_table_other_inc()
710 err = mlxsw_sp_acl_erp_region_table_trans(erp_table); in __mlxsw_sp_acl_erp_table_other_inc()
716 if (erp_table->ops != &erp_multiple_masks_ops) in __mlxsw_sp_acl_erp_table_other_inc()
717 erp_table->ops = &erp_multiple_masks_ops; in __mlxsw_sp_acl_erp_table_other_inc()
724 static int mlxsw_sp_acl_erp_ctcam_inc(struct mlxsw_sp_acl_erp_table *erp_table) in mlxsw_sp_acl_erp_ctcam_inc() argument
726 return __mlxsw_sp_acl_erp_table_other_inc(erp_table, in mlxsw_sp_acl_erp_ctcam_inc()
727 &erp_table->num_ctcam_erps); in mlxsw_sp_acl_erp_ctcam_inc()
730 static int mlxsw_sp_acl_erp_delta_inc(struct mlxsw_sp_acl_erp_table *erp_table) in mlxsw_sp_acl_erp_delta_inc() argument
732 return __mlxsw_sp_acl_erp_table_other_inc(erp_table, in mlxsw_sp_acl_erp_delta_inc()
733 &erp_table->num_deltas); in mlxsw_sp_acl_erp_delta_inc()
737 __mlxsw_sp_acl_erp_table_other_dec(struct mlxsw_sp_acl_erp_table *erp_table, in __mlxsw_sp_acl_erp_table_other_dec() argument
746 if (erp_table->num_ctcam_erps > 0 || erp_table->num_deltas > 0) in __mlxsw_sp_acl_erp_table_other_dec()
749 switch (erp_table->num_atcam_erps) { in __mlxsw_sp_acl_erp_table_other_dec()
755 erp_table->ops = &erp_two_masks_ops; in __mlxsw_sp_acl_erp_table_other_dec()
763 mlxsw_sp_acl_erp_region_master_mask_trans(erp_table); in __mlxsw_sp_acl_erp_table_other_dec()
764 erp_table->ops = &erp_single_mask_ops; in __mlxsw_sp_acl_erp_table_other_dec()
770 mlxsw_sp_acl_erp_table_disable(erp_table); in __mlxsw_sp_acl_erp_table_other_dec()
771 mlxsw_sp_acl_erp_table_free(erp_table->erp_core, in __mlxsw_sp_acl_erp_table_other_dec()
772 erp_table->num_max_atcam_erps, in __mlxsw_sp_acl_erp_table_other_dec()
773 erp_table->aregion->type, in __mlxsw_sp_acl_erp_table_other_dec()
774 erp_table->base_index); in __mlxsw_sp_acl_erp_table_other_dec()
775 erp_table->ops = &erp_no_mask_ops; in __mlxsw_sp_acl_erp_table_other_dec()
782 static void mlxsw_sp_acl_erp_ctcam_dec(struct mlxsw_sp_acl_erp_table *erp_table) in mlxsw_sp_acl_erp_ctcam_dec() argument
784 __mlxsw_sp_acl_erp_table_other_dec(erp_table, in mlxsw_sp_acl_erp_ctcam_dec()
785 &erp_table->num_ctcam_erps); in mlxsw_sp_acl_erp_ctcam_dec()
788 static void mlxsw_sp_acl_erp_delta_dec(struct mlxsw_sp_acl_erp_table *erp_table) in mlxsw_sp_acl_erp_delta_dec() argument
790 __mlxsw_sp_acl_erp_table_other_dec(erp_table, in mlxsw_sp_acl_erp_delta_dec()
791 &erp_table->num_deltas); in mlxsw_sp_acl_erp_delta_dec()
795 mlxsw_sp_acl_erp_ctcam_mask_create(struct mlxsw_sp_acl_erp_table *erp_table, in mlxsw_sp_acl_erp_ctcam_mask_create() argument
809 err = mlxsw_sp_acl_erp_ctcam_inc(erp_table); in mlxsw_sp_acl_erp_ctcam_mask_create()
813 erp->erp_table = erp_table; in mlxsw_sp_acl_erp_ctcam_mask_create()
815 err = mlxsw_sp_acl_erp_master_mask_set(erp_table, &erp->key); in mlxsw_sp_acl_erp_ctcam_mask_create()
819 err = mlxsw_sp_acl_erp_region_ctcam_enable(erp_table); in mlxsw_sp_acl_erp_ctcam_mask_create()
826 mlxsw_sp_acl_erp_master_mask_clear(erp_table, &erp->key); in mlxsw_sp_acl_erp_ctcam_mask_create()
828 mlxsw_sp_acl_erp_ctcam_dec(erp_table); in mlxsw_sp_acl_erp_ctcam_mask_create()
837 struct mlxsw_sp_acl_erp_table *erp_table = erp->erp_table; in mlxsw_sp_acl_erp_ctcam_mask_destroy() local
839 mlxsw_sp_acl_erp_region_ctcam_disable(erp_table); in mlxsw_sp_acl_erp_ctcam_mask_destroy()
840 mlxsw_sp_acl_erp_master_mask_clear(erp_table, &erp->key); in mlxsw_sp_acl_erp_ctcam_mask_destroy()
841 mlxsw_sp_acl_erp_ctcam_dec(erp_table); in mlxsw_sp_acl_erp_ctcam_mask_destroy()
846 mlxsw_sp_acl_erp_mask_create(struct mlxsw_sp_acl_erp_table *erp_table, in mlxsw_sp_acl_erp_mask_create() argument
853 return mlxsw_sp_acl_erp_ctcam_mask_create(erp_table, key); in mlxsw_sp_acl_erp_mask_create()
856 err = mlxsw_sp_acl_erp_table_expand(erp_table); in mlxsw_sp_acl_erp_mask_create()
860 erp = mlxsw_sp_acl_erp_generic_create(erp_table, key); in mlxsw_sp_acl_erp_mask_create()
864 err = mlxsw_sp_acl_erp_index_get(erp_table, &erp->index); in mlxsw_sp_acl_erp_mask_create()
868 err = mlxsw_sp_acl_erp_table_erp_add(erp_table, erp); in mlxsw_sp_acl_erp_mask_create()
872 err = mlxsw_sp_acl_erp_region_erp_add(erp_table, erp); in mlxsw_sp_acl_erp_mask_create()
876 erp_table->ops = &erp_multiple_masks_ops; in mlxsw_sp_acl_erp_mask_create()
883 mlxsw_sp_acl_erp_index_put(erp_table, erp->index); in mlxsw_sp_acl_erp_mask_create()
890 mlxsw_sp_acl_erp_mask_destroy(struct mlxsw_sp_acl_erp_table *erp_table, in mlxsw_sp_acl_erp_mask_destroy() argument
898 mlxsw_sp_acl_erp_index_put(erp_table, erp->index); in mlxsw_sp_acl_erp_mask_destroy()
901 if (erp_table->num_atcam_erps == 2 && erp_table->num_ctcam_erps == 0 && in mlxsw_sp_acl_erp_mask_destroy()
902 erp_table->num_deltas == 0) in mlxsw_sp_acl_erp_mask_destroy()
903 erp_table->ops = &erp_two_masks_ops; in mlxsw_sp_acl_erp_mask_destroy()
907 mlxsw_sp_acl_erp_second_mask_create(struct mlxsw_sp_acl_erp_table *erp_table, in mlxsw_sp_acl_erp_second_mask_create() argument
914 return mlxsw_sp_acl_erp_ctcam_mask_create(erp_table, key); in mlxsw_sp_acl_erp_second_mask_create()
917 err = mlxsw_sp_acl_erp_region_table_trans(erp_table); in mlxsw_sp_acl_erp_second_mask_create()
921 erp = mlxsw_sp_acl_erp_generic_create(erp_table, key); in mlxsw_sp_acl_erp_second_mask_create()
927 err = mlxsw_sp_acl_erp_index_get(erp_table, &erp->index); in mlxsw_sp_acl_erp_second_mask_create()
931 err = mlxsw_sp_acl_erp_table_erp_add(erp_table, erp); in mlxsw_sp_acl_erp_second_mask_create()
935 err = mlxsw_sp_acl_erp_region_erp_add(erp_table, erp); in mlxsw_sp_acl_erp_second_mask_create()
939 erp_table->ops = &erp_two_masks_ops; in mlxsw_sp_acl_erp_second_mask_create()
946 mlxsw_sp_acl_erp_index_put(erp_table, erp->index); in mlxsw_sp_acl_erp_second_mask_create()
950 mlxsw_sp_acl_erp_region_master_mask_trans(erp_table); in mlxsw_sp_acl_erp_second_mask_create()
955 mlxsw_sp_acl_erp_second_mask_destroy(struct mlxsw_sp_acl_erp_table *erp_table, in mlxsw_sp_acl_erp_second_mask_destroy() argument
963 mlxsw_sp_acl_erp_index_put(erp_table, erp->index); in mlxsw_sp_acl_erp_second_mask_destroy()
966 mlxsw_sp_acl_erp_region_master_mask_trans(erp_table); in mlxsw_sp_acl_erp_second_mask_destroy()
968 erp_table->ops = &erp_single_mask_ops; in mlxsw_sp_acl_erp_second_mask_destroy()
972 mlxsw_sp_acl_erp_first_mask_create(struct mlxsw_sp_acl_erp_table *erp_table, in mlxsw_sp_acl_erp_first_mask_create() argument
980 erp = mlxsw_sp_acl_erp_generic_create(erp_table, key); in mlxsw_sp_acl_erp_first_mask_create()
984 erp_table->ops = &erp_single_mask_ops; in mlxsw_sp_acl_erp_first_mask_create()
990 mlxsw_sp_acl_erp_first_mask_destroy(struct mlxsw_sp_acl_erp_table *erp_table, in mlxsw_sp_acl_erp_first_mask_destroy() argument
994 erp_table->ops = &erp_no_mask_ops; in mlxsw_sp_acl_erp_first_mask_destroy()
998 mlxsw_sp_acl_erp_no_mask_destroy(struct mlxsw_sp_acl_erp_table *erp_table, in mlxsw_sp_acl_erp_no_mask_destroy() argument
1008 struct mlxsw_sp_acl_erp_table *erp_table = aregion->erp_table; in mlxsw_sp_acl_erp_mask_get() local
1014 mutex_lock(&erp_table->objagg_lock); in mlxsw_sp_acl_erp_mask_get()
1015 objagg_obj = objagg_obj_get(erp_table->objagg, &key); in mlxsw_sp_acl_erp_mask_get()
1016 mutex_unlock(&erp_table->objagg_lock); in mlxsw_sp_acl_erp_mask_get()
1026 struct mlxsw_sp_acl_erp_table *erp_table = aregion->erp_table; in mlxsw_sp_acl_erp_mask_put() local
1028 mutex_lock(&erp_table->objagg_lock); in mlxsw_sp_acl_erp_mask_put()
1029 objagg_obj_put(erp_table->objagg, objagg_obj); in mlxsw_sp_acl_erp_mask_put()
1030 mutex_unlock(&erp_table->objagg_lock); in mlxsw_sp_acl_erp_mask_put()
1042 if (!mlxsw_sp_acl_erp_table_is_used(erp->erp_table)) in mlxsw_sp_acl_erp_bf_insert()
1047 erp->erp_table->erp_core->bf, in mlxsw_sp_acl_erp_bf_insert()
1060 if (!mlxsw_sp_acl_erp_table_is_used(erp->erp_table)) in mlxsw_sp_acl_erp_bf_remove()
1065 erp->erp_table->erp_core->bf, in mlxsw_sp_acl_erp_bf_remove()
1225 struct mlxsw_sp_acl_erp_table *erp_table = aregion->erp_table; in mlxsw_sp_acl_erp_delta_create() local
1245 err = mlxsw_sp_acl_erp_delta_inc(erp_table); in mlxsw_sp_acl_erp_delta_create()
1250 err = mlxsw_sp_acl_erp_master_mask_set(erp_table, &delta->key); in mlxsw_sp_acl_erp_delta_create()
1257 mlxsw_sp_acl_erp_delta_dec(erp_table); in mlxsw_sp_acl_erp_delta_create()
1267 struct mlxsw_sp_acl_erp_table *erp_table = aregion->erp_table; in mlxsw_sp_acl_erp_delta_destroy() local
1269 mlxsw_sp_acl_erp_master_mask_clear(erp_table, &delta->key); in mlxsw_sp_acl_erp_delta_destroy()
1270 mlxsw_sp_acl_erp_delta_dec(erp_table); in mlxsw_sp_acl_erp_delta_destroy()
1278 struct mlxsw_sp_acl_erp_table *erp_table = aregion->erp_table; in mlxsw_sp_acl_erp_root_create() local
1285 return erp_table->ops->erp_create(erp_table, key); in mlxsw_sp_acl_erp_root_create()
1291 struct mlxsw_sp_acl_erp_table *erp_table = aregion->erp_table; in mlxsw_sp_acl_erp_root_destroy() local
1293 erp_table->ops->erp_destroy(erp_table, root_priv); in mlxsw_sp_acl_erp_root_destroy()
1309 struct mlxsw_sp_acl_erp_table *erp_table; in mlxsw_sp_acl_erp_table_create() local
1312 erp_table = kzalloc(sizeof(*erp_table), GFP_KERNEL); in mlxsw_sp_acl_erp_table_create()
1313 if (!erp_table) in mlxsw_sp_acl_erp_table_create()
1316 erp_table->objagg = objagg_create(&mlxsw_sp_acl_erp_objagg_ops, in mlxsw_sp_acl_erp_table_create()
1318 if (IS_ERR(erp_table->objagg)) { in mlxsw_sp_acl_erp_table_create()
1319 err = PTR_ERR(erp_table->objagg); in mlxsw_sp_acl_erp_table_create()
1323 erp_table->erp_core = aregion->atcam->erp_core; in mlxsw_sp_acl_erp_table_create()
1324 erp_table->ops = &erp_no_mask_ops; in mlxsw_sp_acl_erp_table_create()
1325 INIT_LIST_HEAD(&erp_table->atcam_erps_list); in mlxsw_sp_acl_erp_table_create()
1326 erp_table->aregion = aregion; in mlxsw_sp_acl_erp_table_create()
1327 mutex_init(&erp_table->objagg_lock); in mlxsw_sp_acl_erp_table_create()
1329 return erp_table; in mlxsw_sp_acl_erp_table_create()
1332 kfree(erp_table); in mlxsw_sp_acl_erp_table_create()
1337 mlxsw_sp_acl_erp_table_destroy(struct mlxsw_sp_acl_erp_table *erp_table) in mlxsw_sp_acl_erp_table_destroy() argument
1339 WARN_ON(!list_empty(&erp_table->atcam_erps_list)); in mlxsw_sp_acl_erp_table_destroy()
1340 mutex_destroy(&erp_table->objagg_lock); in mlxsw_sp_acl_erp_table_destroy()
1341 objagg_destroy(erp_table->objagg); in mlxsw_sp_acl_erp_table_destroy()
1342 kfree(erp_table); in mlxsw_sp_acl_erp_table_destroy()
1371 struct mlxsw_sp_acl_erp_table *erp_table = aregion->erp_table; in mlxsw_sp_acl_erp_hints_check() local
1378 mutex_lock(&erp_table->objagg_lock); in mlxsw_sp_acl_erp_hints_check()
1379 ostats = objagg_stats_get(erp_table->objagg); in mlxsw_sp_acl_erp_hints_check()
1380 mutex_unlock(&erp_table->objagg_lock); in mlxsw_sp_acl_erp_hints_check()
1408 struct mlxsw_sp_acl_erp_table *erp_table = aregion->erp_table; in mlxsw_sp_acl_erp_rehash_hints_get() local
1414 mutex_lock(&erp_table->objagg_lock); in mlxsw_sp_acl_erp_rehash_hints_get()
1415 hints = objagg_hints_get(erp_table->objagg, in mlxsw_sp_acl_erp_rehash_hints_get()
1417 mutex_unlock(&erp_table->objagg_lock); in mlxsw_sp_acl_erp_rehash_hints_get()
1448 struct mlxsw_sp_acl_erp_table *erp_table; in mlxsw_sp_acl_erp_region_init() local
1452 erp_table = mlxsw_sp_acl_erp_table_create(aregion, hints); in mlxsw_sp_acl_erp_region_init()
1453 if (IS_ERR(erp_table)) in mlxsw_sp_acl_erp_region_init()
1454 return PTR_ERR(erp_table); in mlxsw_sp_acl_erp_region_init()
1455 aregion->erp_table = erp_table; in mlxsw_sp_acl_erp_region_init()
1471 mlxsw_sp_acl_erp_table_destroy(erp_table); in mlxsw_sp_acl_erp_region_init()
1477 mlxsw_sp_acl_erp_table_destroy(aregion->erp_table); in mlxsw_sp_acl_erp_region_fini()