Lines Matching refs:rule

383 	struct prestera_acl_rule *rule;  in prestera_acl_ruleset_prio_refresh()  local
388 list_for_each_entry(rule, &acl->rules, list) { in prestera_acl_ruleset_prio_refresh()
389 if (ruleset->ingress != rule->ruleset->ingress) in prestera_acl_ruleset_prio_refresh()
391 if (ruleset->ht_key.chain_index != rule->chain_index) in prestera_acl_ruleset_prio_refresh()
394 ruleset->prio.min = min(ruleset->prio.min, rule->priority); in prestera_acl_ruleset_prio_refresh()
395 ruleset->prio.max = max(ruleset->prio.max, rule->priority); in prestera_acl_ruleset_prio_refresh()
400 prestera_acl_rule_keymask_pcl_id_set(struct prestera_acl_rule *rule, u16 pcl_id) in prestera_acl_rule_keymask_pcl_id_set() argument
402 struct prestera_acl_match *r_match = &rule->re_key.match; in prestera_acl_rule_keymask_pcl_id_set()
439 struct prestera_acl_rule *rule; in prestera_acl_rule_create() local
441 rule = kzalloc(sizeof(*rule), GFP_KERNEL); in prestera_acl_rule_create()
442 if (!rule) in prestera_acl_rule_create()
445 rule->ruleset = ruleset; in prestera_acl_rule_create()
446 rule->cookie = cookie; in prestera_acl_rule_create()
447 rule->chain_index = chain_index; in prestera_acl_rule_create()
451 return rule; in prestera_acl_rule_create()
454 void prestera_acl_rule_priority_set(struct prestera_acl_rule *rule, in prestera_acl_rule_priority_set() argument
457 rule->priority = priority; in prestera_acl_rule_priority_set()
460 void prestera_acl_rule_destroy(struct prestera_acl_rule *rule) in prestera_acl_rule_destroy() argument
462 if (rule->jump_ruleset) in prestera_acl_rule_destroy()
464 prestera_acl_ruleset_put(rule->jump_ruleset); in prestera_acl_rule_destroy()
466 prestera_acl_ruleset_put(rule->ruleset); in prestera_acl_rule_destroy()
467 kfree(rule); in prestera_acl_rule_destroy()
478 struct prestera_acl_rule *rule) in prestera_acl_rule_add() argument
481 struct prestera_acl_ruleset *ruleset = rule->ruleset; in prestera_acl_rule_add()
485 err = rhashtable_insert_fast(&ruleset->rule_ht, &rule->ht_node, in prestera_acl_rule_add()
490 prestera_acl_rule_keymask_pcl_id_set(rule, ruleset->pcl_id); in prestera_acl_rule_add()
491 rule->re_arg.vtcam_id = ruleset->vtcam_id; in prestera_acl_rule_add()
492 rule->re_key.prio = rule->priority; in prestera_acl_rule_add()
494 rule->re = prestera_acl_rule_entry_find(sw->acl, &rule->re_key); in prestera_acl_rule_add()
495 err = WARN_ON(rule->re) ? -EEXIST : 0; in prestera_acl_rule_add()
499 rule->re = prestera_acl_rule_entry_create(sw->acl, &rule->re_key, in prestera_acl_rule_add()
500 &rule->re_arg); in prestera_acl_rule_add()
501 err = !rule->re ? -EINVAL : 0; in prestera_acl_rule_add()
514 list_add_tail(&rule->list, &sw->acl->rules); in prestera_acl_rule_add()
516 prestera_acl_ruleset_prio_update(ruleset, rule->priority); in prestera_acl_rule_add()
520 prestera_acl_rule_entry_destroy(sw->acl, rule->re); in prestera_acl_rule_add()
522 rule->re = NULL; in prestera_acl_rule_add()
523 rhashtable_remove_fast(&ruleset->rule_ht, &rule->ht_node, in prestera_acl_rule_add()
530 struct prestera_acl_rule *rule) in prestera_acl_rule_del() argument
532 struct prestera_acl_ruleset *ruleset = rule->ruleset; in prestera_acl_rule_del()
535 rhashtable_remove_fast(&ruleset->rule_ht, &rule->ht_node, in prestera_acl_rule_del()
538 list_del(&rule->list); in prestera_acl_rule_del()
540 prestera_acl_rule_entry_destroy(sw->acl, rule->re); in prestera_acl_rule_del()
549 struct prestera_acl_rule *rule, in prestera_acl_rule_get_stats() argument
557 rule->re->counter.block, in prestera_acl_rule_get_stats()
558 rule->re->counter.id, in prestera_acl_rule_get_stats()