Lines Matching refs:tcam

27 			   struct mlxsw_sp_acl_tcam *tcam)  in mlxsw_sp_acl_tcam_init()  argument
44 alloc_size = sizeof(tcam->used_regions[0]) * BITS_TO_LONGS(max_regions); in mlxsw_sp_acl_tcam_init()
45 tcam->used_regions = kzalloc(alloc_size, GFP_KERNEL); in mlxsw_sp_acl_tcam_init()
46 if (!tcam->used_regions) in mlxsw_sp_acl_tcam_init()
48 tcam->max_regions = max_regions; in mlxsw_sp_acl_tcam_init()
51 alloc_size = sizeof(tcam->used_groups[0]) * BITS_TO_LONGS(max_groups); in mlxsw_sp_acl_tcam_init()
52 tcam->used_groups = kzalloc(alloc_size, GFP_KERNEL); in mlxsw_sp_acl_tcam_init()
53 if (!tcam->used_groups) { in mlxsw_sp_acl_tcam_init()
57 tcam->max_groups = max_groups; in mlxsw_sp_acl_tcam_init()
58 tcam->max_group_size = MLXSW_CORE_RES_GET(mlxsw_sp->core, in mlxsw_sp_acl_tcam_init()
61 err = ops->init(mlxsw_sp, tcam->priv, tcam); in mlxsw_sp_acl_tcam_init()
68 kfree(tcam->used_groups); in mlxsw_sp_acl_tcam_init()
70 kfree(tcam->used_regions); in mlxsw_sp_acl_tcam_init()
75 struct mlxsw_sp_acl_tcam *tcam) in mlxsw_sp_acl_tcam_fini() argument
79 ops->fini(mlxsw_sp, tcam->priv); in mlxsw_sp_acl_tcam_fini()
80 kfree(tcam->used_groups); in mlxsw_sp_acl_tcam_fini()
81 kfree(tcam->used_regions); in mlxsw_sp_acl_tcam_fini()
107 static int mlxsw_sp_acl_tcam_region_id_get(struct mlxsw_sp_acl_tcam *tcam, in mlxsw_sp_acl_tcam_region_id_get() argument
112 id = find_first_zero_bit(tcam->used_regions, tcam->max_regions); in mlxsw_sp_acl_tcam_region_id_get()
113 if (id < tcam->max_regions) { in mlxsw_sp_acl_tcam_region_id_get()
114 __set_bit(id, tcam->used_regions); in mlxsw_sp_acl_tcam_region_id_get()
121 static void mlxsw_sp_acl_tcam_region_id_put(struct mlxsw_sp_acl_tcam *tcam, in mlxsw_sp_acl_tcam_region_id_put() argument
124 __clear_bit(id, tcam->used_regions); in mlxsw_sp_acl_tcam_region_id_put()
127 static int mlxsw_sp_acl_tcam_group_id_get(struct mlxsw_sp_acl_tcam *tcam, in mlxsw_sp_acl_tcam_group_id_get() argument
132 id = find_first_zero_bit(tcam->used_groups, tcam->max_groups); in mlxsw_sp_acl_tcam_group_id_get()
133 if (id < tcam->max_groups) { in mlxsw_sp_acl_tcam_group_id_get()
134 __set_bit(id, tcam->used_groups); in mlxsw_sp_acl_tcam_group_id_get()
141 static void mlxsw_sp_acl_tcam_group_id_put(struct mlxsw_sp_acl_tcam *tcam, in mlxsw_sp_acl_tcam_group_id_put() argument
144 __clear_bit(id, tcam->used_groups); in mlxsw_sp_acl_tcam_group_id_put()
153 struct mlxsw_sp_acl_tcam *tcam; member
205 struct mlxsw_sp_acl_tcam *tcam, in mlxsw_sp_acl_tcam_group_add() argument
213 group->tcam = tcam; in mlxsw_sp_acl_tcam_group_add()
222 err = mlxsw_sp_acl_tcam_group_id_get(tcam, &group->id); in mlxsw_sp_acl_tcam_group_add()
234 mlxsw_sp_acl_tcam_group_id_put(tcam, group->id); in mlxsw_sp_acl_tcam_group_add()
241 struct mlxsw_sp_acl_tcam *tcam = group->tcam; in mlxsw_sp_acl_tcam_group_del() local
244 mlxsw_sp_acl_tcam_group_id_put(tcam, group->id); in mlxsw_sp_acl_tcam_group_del()
340 if (group->region_count == group->tcam->max_group_size) in mlxsw_sp_acl_tcam_group_region_attach()
512 struct mlxsw_sp_acl_tcam *tcam, in mlxsw_sp_acl_tcam_region_create() argument
532 err = mlxsw_sp_acl_tcam_region_id_get(tcam, &region->id); in mlxsw_sp_acl_tcam_region_create()
549 err = ops->region_init(mlxsw_sp, region->priv, tcam->priv, region); in mlxsw_sp_acl_tcam_region_create()
561 mlxsw_sp_acl_tcam_region_id_put(tcam, region->id); in mlxsw_sp_acl_tcam_region_create()
578 mlxsw_sp_acl_tcam_region_id_put(region->group->tcam, region->id); in mlxsw_sp_acl_tcam_region_destroy()
611 region = mlxsw_sp_acl_tcam_region_create(mlxsw_sp, group->tcam, in mlxsw_sp_acl_tcam_chunk_assoc()
853 struct mlxsw_sp_acl_tcam *tcam, in mlxsw_sp_acl_tcam_flower_ruleset_add() argument
859 return mlxsw_sp_acl_tcam_group_add(mlxsw_sp, tcam, &ruleset->group, in mlxsw_sp_acl_tcam_flower_ruleset_add()