Lines Matching defs:ruleset

70 	struct mlxsw_sp_acl_ruleset *ruleset;
100 mlxsw_sp_acl_ruleset_is_singular(const struct mlxsw_sp_acl_ruleset *ruleset)
102 /* We hold a reference on ruleset ourselves */
103 return refcount_read(&ruleset->ref_count) == 2;
110 struct mlxsw_sp_acl_ruleset *ruleset = block->ruleset_zero;
111 const struct mlxsw_sp_acl_profile_ops *ops = ruleset->ht_key.ops;
113 return ops->ruleset_bind(mlxsw_sp, ruleset->priv,
121 struct mlxsw_sp_acl_ruleset *ruleset = block->ruleset_zero;
122 const struct mlxsw_sp_acl_profile_ops *ops = ruleset->ht_key.ops;
124 ops->ruleset_unbind(mlxsw_sp, ruleset->priv,
130 struct mlxsw_sp_acl_ruleset *ruleset,
136 block->ruleset_zero = ruleset;
155 struct mlxsw_sp_acl_ruleset *ruleset,
172 struct mlxsw_sp_acl_ruleset *ruleset;
176 alloc_size = sizeof(*ruleset) + ops->ruleset_priv_size;
177 ruleset = kzalloc(alloc_size, GFP_KERNEL);
178 if (!ruleset)
180 refcount_set(&ruleset->ref_count, 1);
181 ruleset->ht_key.block = block;
182 ruleset->ht_key.chain_index = chain_index;
183 ruleset->ht_key.ops = ops;
185 err = rhashtable_init(&ruleset->rule_ht, &mlxsw_sp_acl_rule_ht_params);
189 err = ops->ruleset_add(mlxsw_sp, &acl->tcam, ruleset->priv,
190 tmplt_elusage, &ruleset->min_prio,
191 &ruleset->max_prio);
195 err = rhashtable_insert_fast(&acl->ruleset_ht, &ruleset->ht_node,
200 return ruleset;
203 ops->ruleset_del(mlxsw_sp, ruleset->priv);
205 rhashtable_destroy(&ruleset->rule_ht);
207 kfree(ruleset);
212 struct mlxsw_sp_acl_ruleset *ruleset)
214 const struct mlxsw_sp_acl_profile_ops *ops = ruleset->ht_key.ops;
217 rhashtable_remove_fast(&acl->ruleset_ht, &ruleset->ht_node,
219 ops->ruleset_del(mlxsw_sp, ruleset->priv);
220 rhashtable_destroy(&ruleset->rule_ht);
221 kfree(ruleset);
224 static void mlxsw_sp_acl_ruleset_ref_inc(struct mlxsw_sp_acl_ruleset *ruleset)
226 refcount_inc(&ruleset->ref_count);
230 struct mlxsw_sp_acl_ruleset *ruleset)
232 if (!refcount_dec_and_test(&ruleset->ref_count))
234 mlxsw_sp_acl_ruleset_destroy(mlxsw_sp, ruleset);
259 struct mlxsw_sp_acl_ruleset *ruleset;
264 ruleset = __mlxsw_sp_acl_ruleset_lookup(acl, block, chain_index, ops);
265 if (!ruleset)
267 return ruleset;
278 struct mlxsw_sp_acl_ruleset *ruleset;
284 ruleset = __mlxsw_sp_acl_ruleset_lookup(acl, block, chain_index, ops);
285 if (ruleset) {
286 mlxsw_sp_acl_ruleset_ref_inc(ruleset);
287 return ruleset;
294 struct mlxsw_sp_acl_ruleset *ruleset)
296 mlxsw_sp_acl_ruleset_ref_dec(mlxsw_sp, ruleset);
299 u16 mlxsw_sp_acl_ruleset_group_id(struct mlxsw_sp_acl_ruleset *ruleset)
301 const struct mlxsw_sp_acl_profile_ops *ops = ruleset->ht_key.ops;
303 return ops->ruleset_group_id(ruleset->priv);
306 void mlxsw_sp_acl_ruleset_prio_get(struct mlxsw_sp_acl_ruleset *ruleset,
310 *p_min_prio = ruleset->min_prio;
311 *p_max_prio = ruleset->max_prio;
815 struct mlxsw_sp_acl_ruleset *ruleset,
820 const struct mlxsw_sp_acl_profile_ops *ops = ruleset->ht_key.ops;
824 mlxsw_sp_acl_ruleset_ref_inc(ruleset);
832 rule->ruleset = ruleset;
845 mlxsw_sp_acl_ruleset_ref_dec(mlxsw_sp, ruleset);
852 struct mlxsw_sp_acl_ruleset *ruleset = rule->ruleset;
856 mlxsw_sp_acl_ruleset_ref_dec(mlxsw_sp, ruleset);
862 struct mlxsw_sp_acl_ruleset *ruleset = rule->ruleset;
863 const struct mlxsw_sp_acl_profile_ops *ops = ruleset->ht_key.ops;
864 struct mlxsw_sp_flow_block *block = ruleset->ht_key.block;
867 err = ops->rule_add(mlxsw_sp, ruleset->priv, rule->priv, rule->rulei);
871 err = rhashtable_insert_fast(&ruleset->rule_ht, &rule->ht_node,
876 if (!ruleset->ht_key.chain_index &&
877 mlxsw_sp_acl_ruleset_is_singular(ruleset)) {
878 /* We only need ruleset with chain index 0, the implicit
882 err = mlxsw_sp_acl_ruleset_block_bind(mlxsw_sp, ruleset, block);
896 rhashtable_remove_fast(&ruleset->rule_ht, &rule->ht_node,
906 struct mlxsw_sp_acl_ruleset *ruleset = rule->ruleset;
907 const struct mlxsw_sp_acl_profile_ops *ops = ruleset->ht_key.ops;
908 struct mlxsw_sp_flow_block *block = ruleset->ht_key.block;
916 if (!ruleset->ht_key.chain_index &&
917 mlxsw_sp_acl_ruleset_is_singular(ruleset))
918 mlxsw_sp_acl_ruleset_block_unbind(mlxsw_sp, ruleset, block);
919 rhashtable_remove_fast(&ruleset->rule_ht, &rule->ht_node,
928 struct mlxsw_sp_acl_ruleset *ruleset = rule->ruleset;
929 const struct mlxsw_sp_acl_profile_ops *ops = ruleset->ht_key.ops;
940 struct mlxsw_sp_acl_ruleset *ruleset,
943 return rhashtable_lookup_fast(&ruleset->rule_ht, &cookie,
956 struct mlxsw_sp_acl_ruleset *ruleset = rule->ruleset;
957 const struct mlxsw_sp_acl_profile_ops *ops = ruleset->ht_key.ops;