Lines Matching refs:ruleset

69 	struct mlxsw_sp_acl_ruleset *ruleset;  member
99 mlxsw_sp_acl_ruleset_is_singular(const struct mlxsw_sp_acl_ruleset *ruleset) in mlxsw_sp_acl_ruleset_is_singular() argument
102 return ruleset->ref_count == 2; in mlxsw_sp_acl_ruleset_is_singular()
109 struct mlxsw_sp_acl_ruleset *ruleset = block->ruleset_zero; in mlxsw_sp_acl_ruleset_bind() local
110 const struct mlxsw_sp_acl_profile_ops *ops = ruleset->ht_key.ops; in mlxsw_sp_acl_ruleset_bind()
112 return ops->ruleset_bind(mlxsw_sp, ruleset->priv, in mlxsw_sp_acl_ruleset_bind()
120 struct mlxsw_sp_acl_ruleset *ruleset = block->ruleset_zero; in mlxsw_sp_acl_ruleset_unbind() local
121 const struct mlxsw_sp_acl_profile_ops *ops = ruleset->ht_key.ops; in mlxsw_sp_acl_ruleset_unbind()
123 ops->ruleset_unbind(mlxsw_sp, ruleset->priv, in mlxsw_sp_acl_ruleset_unbind()
129 struct mlxsw_sp_acl_ruleset *ruleset, in mlxsw_sp_acl_ruleset_block_bind() argument
135 block->ruleset_zero = ruleset; in mlxsw_sp_acl_ruleset_block_bind()
154 struct mlxsw_sp_acl_ruleset *ruleset, in mlxsw_sp_acl_ruleset_block_unbind() argument
171 struct mlxsw_sp_acl_ruleset *ruleset; in mlxsw_sp_acl_ruleset_create() local
175 alloc_size = sizeof(*ruleset) + ops->ruleset_priv_size; in mlxsw_sp_acl_ruleset_create()
176 ruleset = kzalloc(alloc_size, GFP_KERNEL); in mlxsw_sp_acl_ruleset_create()
177 if (!ruleset) in mlxsw_sp_acl_ruleset_create()
179 ruleset->ref_count = 1; in mlxsw_sp_acl_ruleset_create()
180 ruleset->ht_key.block = block; in mlxsw_sp_acl_ruleset_create()
181 ruleset->ht_key.chain_index = chain_index; in mlxsw_sp_acl_ruleset_create()
182 ruleset->ht_key.ops = ops; in mlxsw_sp_acl_ruleset_create()
184 err = rhashtable_init(&ruleset->rule_ht, &mlxsw_sp_acl_rule_ht_params); in mlxsw_sp_acl_ruleset_create()
188 err = ops->ruleset_add(mlxsw_sp, &acl->tcam, ruleset->priv, in mlxsw_sp_acl_ruleset_create()
189 tmplt_elusage, &ruleset->min_prio, in mlxsw_sp_acl_ruleset_create()
190 &ruleset->max_prio); in mlxsw_sp_acl_ruleset_create()
194 err = rhashtable_insert_fast(&acl->ruleset_ht, &ruleset->ht_node, in mlxsw_sp_acl_ruleset_create()
199 return ruleset; in mlxsw_sp_acl_ruleset_create()
202 ops->ruleset_del(mlxsw_sp, ruleset->priv); in mlxsw_sp_acl_ruleset_create()
204 rhashtable_destroy(&ruleset->rule_ht); in mlxsw_sp_acl_ruleset_create()
206 kfree(ruleset); in mlxsw_sp_acl_ruleset_create()
211 struct mlxsw_sp_acl_ruleset *ruleset) in mlxsw_sp_acl_ruleset_destroy() argument
213 const struct mlxsw_sp_acl_profile_ops *ops = ruleset->ht_key.ops; in mlxsw_sp_acl_ruleset_destroy()
216 rhashtable_remove_fast(&acl->ruleset_ht, &ruleset->ht_node, in mlxsw_sp_acl_ruleset_destroy()
218 ops->ruleset_del(mlxsw_sp, ruleset->priv); in mlxsw_sp_acl_ruleset_destroy()
219 rhashtable_destroy(&ruleset->rule_ht); in mlxsw_sp_acl_ruleset_destroy()
220 kfree(ruleset); in mlxsw_sp_acl_ruleset_destroy()
223 static void mlxsw_sp_acl_ruleset_ref_inc(struct mlxsw_sp_acl_ruleset *ruleset) in mlxsw_sp_acl_ruleset_ref_inc() argument
225 ruleset->ref_count++; in mlxsw_sp_acl_ruleset_ref_inc()
229 struct mlxsw_sp_acl_ruleset *ruleset) in mlxsw_sp_acl_ruleset_ref_dec() argument
231 if (--ruleset->ref_count) in mlxsw_sp_acl_ruleset_ref_dec()
233 mlxsw_sp_acl_ruleset_destroy(mlxsw_sp, ruleset); in mlxsw_sp_acl_ruleset_ref_dec()
258 struct mlxsw_sp_acl_ruleset *ruleset; in mlxsw_sp_acl_ruleset_lookup() local
263 ruleset = __mlxsw_sp_acl_ruleset_lookup(acl, block, chain_index, ops); in mlxsw_sp_acl_ruleset_lookup()
264 if (!ruleset) in mlxsw_sp_acl_ruleset_lookup()
266 return ruleset; in mlxsw_sp_acl_ruleset_lookup()
277 struct mlxsw_sp_acl_ruleset *ruleset; in mlxsw_sp_acl_ruleset_get() local
283 ruleset = __mlxsw_sp_acl_ruleset_lookup(acl, block, chain_index, ops); in mlxsw_sp_acl_ruleset_get()
284 if (ruleset) { in mlxsw_sp_acl_ruleset_get()
285 mlxsw_sp_acl_ruleset_ref_inc(ruleset); in mlxsw_sp_acl_ruleset_get()
286 return ruleset; in mlxsw_sp_acl_ruleset_get()
293 struct mlxsw_sp_acl_ruleset *ruleset) in mlxsw_sp_acl_ruleset_put() argument
295 mlxsw_sp_acl_ruleset_ref_dec(mlxsw_sp, ruleset); in mlxsw_sp_acl_ruleset_put()
298 u16 mlxsw_sp_acl_ruleset_group_id(struct mlxsw_sp_acl_ruleset *ruleset) in mlxsw_sp_acl_ruleset_group_id() argument
300 const struct mlxsw_sp_acl_profile_ops *ops = ruleset->ht_key.ops; in mlxsw_sp_acl_ruleset_group_id()
302 return ops->ruleset_group_id(ruleset->priv); in mlxsw_sp_acl_ruleset_group_id()
305 void mlxsw_sp_acl_ruleset_prio_get(struct mlxsw_sp_acl_ruleset *ruleset, in mlxsw_sp_acl_ruleset_prio_get() argument
309 *p_min_prio = ruleset->min_prio; in mlxsw_sp_acl_ruleset_prio_get()
310 *p_max_prio = ruleset->max_prio; in mlxsw_sp_acl_ruleset_prio_get()
814 struct mlxsw_sp_acl_ruleset *ruleset, in mlxsw_sp_acl_rule_create() argument
819 const struct mlxsw_sp_acl_profile_ops *ops = ruleset->ht_key.ops; in mlxsw_sp_acl_rule_create()
823 mlxsw_sp_acl_ruleset_ref_inc(ruleset); in mlxsw_sp_acl_rule_create()
831 rule->ruleset = ruleset; in mlxsw_sp_acl_rule_create()
844 mlxsw_sp_acl_ruleset_ref_dec(mlxsw_sp, ruleset); in mlxsw_sp_acl_rule_create()
851 struct mlxsw_sp_acl_ruleset *ruleset = rule->ruleset; in mlxsw_sp_acl_rule_destroy() local
855 mlxsw_sp_acl_ruleset_ref_dec(mlxsw_sp, ruleset); in mlxsw_sp_acl_rule_destroy()
861 struct mlxsw_sp_acl_ruleset *ruleset = rule->ruleset; in mlxsw_sp_acl_rule_add() local
862 const struct mlxsw_sp_acl_profile_ops *ops = ruleset->ht_key.ops; in mlxsw_sp_acl_rule_add()
863 struct mlxsw_sp_flow_block *block = ruleset->ht_key.block; in mlxsw_sp_acl_rule_add()
866 err = ops->rule_add(mlxsw_sp, ruleset->priv, rule->priv, rule->rulei); in mlxsw_sp_acl_rule_add()
870 err = rhashtable_insert_fast(&ruleset->rule_ht, &rule->ht_node, in mlxsw_sp_acl_rule_add()
875 if (!ruleset->ht_key.chain_index && in mlxsw_sp_acl_rule_add()
876 mlxsw_sp_acl_ruleset_is_singular(ruleset)) { in mlxsw_sp_acl_rule_add()
881 err = mlxsw_sp_acl_ruleset_block_bind(mlxsw_sp, ruleset, block); in mlxsw_sp_acl_rule_add()
895 rhashtable_remove_fast(&ruleset->rule_ht, &rule->ht_node, in mlxsw_sp_acl_rule_add()
905 struct mlxsw_sp_acl_ruleset *ruleset = rule->ruleset; in mlxsw_sp_acl_rule_del() local
906 const struct mlxsw_sp_acl_profile_ops *ops = ruleset->ht_key.ops; in mlxsw_sp_acl_rule_del()
907 struct mlxsw_sp_flow_block *block = ruleset->ht_key.block; in mlxsw_sp_acl_rule_del()
915 if (!ruleset->ht_key.chain_index && in mlxsw_sp_acl_rule_del()
916 mlxsw_sp_acl_ruleset_is_singular(ruleset)) in mlxsw_sp_acl_rule_del()
917 mlxsw_sp_acl_ruleset_block_unbind(mlxsw_sp, ruleset, block); in mlxsw_sp_acl_rule_del()
918 rhashtable_remove_fast(&ruleset->rule_ht, &rule->ht_node, in mlxsw_sp_acl_rule_del()
927 struct mlxsw_sp_acl_ruleset *ruleset = rule->ruleset; in mlxsw_sp_acl_rule_action_replace() local
928 const struct mlxsw_sp_acl_profile_ops *ops = ruleset->ht_key.ops; in mlxsw_sp_acl_rule_action_replace()
939 struct mlxsw_sp_acl_ruleset *ruleset, in mlxsw_sp_acl_rule_lookup() argument
942 return rhashtable_lookup_fast(&ruleset->rule_ht, &cookie, in mlxsw_sp_acl_rule_lookup()
955 struct mlxsw_sp_acl_ruleset *ruleset = rule->ruleset; in mlxsw_sp_acl_rule_activity_update() local
956 const struct mlxsw_sp_acl_profile_ops *ops = ruleset->ht_key.ops; in mlxsw_sp_acl_rule_activity_update()