Lines Matching full:acl

53 	struct rhash_head ht_node; /* Member of acl HT */
56 struct prestera_acl *acl; member
136 prestera_acl_ruleset_create(struct prestera_acl *acl, in prestera_acl_ruleset_create() argument
151 ruleset->acl = acl; in prestera_acl_ruleset_create()
161 err = idr_alloc_u32(&acl->uid, NULL, &uid, U8_MAX, GFP_KERNEL); in prestera_acl_ruleset_create()
172 err = rhashtable_insert_fast(&acl->ruleset_ht, &ruleset->ht_node, in prestera_acl_ruleset_create()
180 idr_remove(&acl->uid, uid); in prestera_acl_ruleset_create()
211 err = prestera_acl_vtcam_id_get(ruleset->acl, in prestera_acl_ruleset_offload()
224 err = prestera_hw_vtcam_iface_bind(ruleset->acl->sw, &iface, in prestera_acl_ruleset_offload()
235 prestera_acl_vtcam_id_put(ruleset->acl, ruleset->vtcam_id); in prestera_acl_ruleset_offload()
242 struct prestera_acl *acl = ruleset->acl; in prestera_acl_ruleset_destroy() local
246 rhashtable_remove_fast(&acl->ruleset_ht, &ruleset->ht_node, in prestera_acl_ruleset_destroy()
255 err = prestera_hw_vtcam_iface_unbind(acl->sw, &iface, in prestera_acl_ruleset_destroy()
259 WARN_ON(prestera_acl_vtcam_id_put(acl, ruleset->vtcam_id)); in prestera_acl_ruleset_destroy()
262 idr_remove(&acl->uid, uid); in prestera_acl_ruleset_destroy()
269 __prestera_acl_ruleset_lookup(struct prestera_acl *acl, in __prestera_acl_ruleset_lookup() argument
278 return rhashtable_lookup_fast(&acl->ruleset_ht, &ht_key, in __prestera_acl_ruleset_lookup()
283 prestera_acl_ruleset_lookup(struct prestera_acl *acl, in prestera_acl_ruleset_lookup() argument
289 ruleset = __prestera_acl_ruleset_lookup(acl, block, chain_index); in prestera_acl_ruleset_lookup()
298 prestera_acl_ruleset_get(struct prestera_acl *acl, in prestera_acl_ruleset_get() argument
304 ruleset = __prestera_acl_ruleset_lookup(acl, block, chain_index); in prestera_acl_ruleset_get()
310 return prestera_acl_ruleset_create(acl, block, chain_index); in prestera_acl_ruleset_get()
380 prestera_acl_ruleset_prio_refresh(struct prestera_acl *acl, in prestera_acl_ruleset_prio_refresh() argument
388 list_for_each_entry(rule, &acl->rules, list) { in prestera_acl_ruleset_prio_refresh()
494 rule->re = prestera_acl_rule_entry_find(sw->acl, &rule->re_key); in prestera_acl_rule_add()
499 rule->re = prestera_acl_rule_entry_create(sw->acl, &rule->re_key, in prestera_acl_rule_add()
514 list_add_tail(&rule->list, &sw->acl->rules); in prestera_acl_rule_add()
520 prestera_acl_rule_entry_destroy(sw->acl, rule->re); in prestera_acl_rule_add()
540 prestera_acl_rule_entry_destroy(sw->acl, rule->re); in prestera_acl_rule_del()
541 prestera_acl_ruleset_prio_refresh(sw->acl, ruleset); in prestera_acl_rule_del()
548 int prestera_acl_rule_get_stats(struct prestera_acl *acl, in prestera_acl_rule_get_stats() argument
556 err = prestera_counter_stats_get(acl->sw->counter, in prestera_acl_rule_get_stats()
571 prestera_acl_rule_entry_find(struct prestera_acl *acl, in prestera_acl_rule_entry_find() argument
574 return rhashtable_lookup_fast(&acl->acl_rule_entry_ht, key, in prestera_acl_rule_entry_find()
643 void prestera_acl_rule_entry_destroy(struct prestera_acl *acl, in prestera_acl_rule_entry_destroy() argument
648 rhashtable_remove_fast(&acl->acl_rule_entry_ht, &e->ht_node, in prestera_acl_rule_entry_destroy()
651 ret = __prestera_acl_rule_entry2hw_del(acl->sw, e); in prestera_acl_rule_entry_destroy()
654 __prestera_acl_rule_entry_act_destruct(acl->sw, e); in prestera_acl_rule_entry_destroy()
709 prestera_acl_rule_entry_create(struct prestera_acl *acl, in prestera_acl_rule_entry_create() argument
722 err = __prestera_acl_rule_entry_act_construct(acl->sw, e, arg); in prestera_acl_rule_entry_create()
726 err = __prestera_acl_rule_entry2hw_add(acl->sw, e); in prestera_acl_rule_entry_create()
730 err = rhashtable_insert_fast(&acl->acl_rule_entry_ht, &e->ht_node, in prestera_acl_rule_entry_create()
738 WARN_ON(__prestera_acl_rule_entry2hw_del(acl->sw, e)); in prestera_acl_rule_entry_create()
740 __prestera_acl_rule_entry_act_destruct(acl->sw, e); in prestera_acl_rule_entry_create()
747 static int __prestera_acl_vtcam_id_try_fit(struct prestera_acl *acl, u8 lookup, in __prestera_acl_vtcam_id_try_fit() argument
753 list_for_each_entry(vtcam, &acl->vtcam_list, list) { in __prestera_acl_vtcam_id_try_fit()
790 int prestera_acl_vtcam_id_get(struct prestera_acl *acl, u8 lookup, u8 dir, in prestera_acl_vtcam_id_get() argument
801 list_for_each_entry(vtcam, &acl->vtcam_list, list) { in prestera_acl_vtcam_id_get()
823 err = prestera_hw_vtcam_create(acl->sw, lookup, keymask, &new_vtcam_id, in prestera_acl_vtcam_id_get()
829 if (__prestera_acl_vtcam_id_try_fit(acl, lookup, in prestera_acl_vtcam_id_get()
845 list_add_rcu(&vtcam->list, &acl->vtcam_list); in prestera_acl_vtcam_id_get()
852 int prestera_acl_vtcam_id_put(struct prestera_acl *acl, u32 vtcam_id) in prestera_acl_vtcam_id_put() argument
857 list_for_each_entry(vtcam, &acl->vtcam_list, list) { in prestera_acl_vtcam_id_put()
864 err = prestera_hw_vtcam_destroy(acl->sw, vtcam->id); in prestera_acl_vtcam_id_put()
880 struct prestera_acl *acl; in prestera_acl_init() local
883 acl = kzalloc(sizeof(*acl), GFP_KERNEL); in prestera_acl_init()
884 if (!acl) in prestera_acl_init()
887 acl->sw = sw; in prestera_acl_init()
888 INIT_LIST_HEAD(&acl->rules); in prestera_acl_init()
889 INIT_LIST_HEAD(&acl->vtcam_list); in prestera_acl_init()
890 idr_init(&acl->uid); in prestera_acl_init()
892 err = rhashtable_init(&acl->acl_rule_entry_ht, in prestera_acl_init()
897 err = rhashtable_init(&acl->ruleset_ht, in prestera_acl_init()
902 sw->acl = acl; in prestera_acl_init()
907 rhashtable_destroy(&acl->acl_rule_entry_ht); in prestera_acl_init()
909 kfree(acl); in prestera_acl_init()
915 struct prestera_acl *acl = sw->acl; in prestera_acl_fini() local
917 WARN_ON(!idr_is_empty(&acl->uid)); in prestera_acl_fini()
918 idr_destroy(&acl->uid); in prestera_acl_fini()
920 WARN_ON(!list_empty(&acl->vtcam_list)); in prestera_acl_fini()
921 WARN_ON(!list_empty(&acl->rules)); in prestera_acl_fini()
923 rhashtable_destroy(&acl->ruleset_ht); in prestera_acl_fini()
924 rhashtable_destroy(&acl->acl_rule_entry_ht); in prestera_acl_fini()
926 kfree(acl); in prestera_acl_fini()