Lines Matching refs:a
30 void tcf_hash_destroy(struct tc_action *a) in tcf_hash_destroy() argument
32 struct tcf_common *p = a->priv; in tcf_hash_destroy()
33 struct tcf_hashinfo *hinfo = a->ops->hinfo; in tcf_hash_destroy()
48 int __tcf_hash_release(struct tc_action *a, bool bind, bool strict) in __tcf_hash_release() argument
50 struct tcf_common *p = a->priv; in __tcf_hash_release()
61 if (a->ops->cleanup) in __tcf_hash_release()
62 a->ops->cleanup(a, bind); in __tcf_hash_release()
63 tcf_hash_destroy(a); in __tcf_hash_release()
73 struct tc_action *a) in tcf_dump_walker() argument
75 struct tcf_hashinfo *hinfo = a->ops->hinfo; in tcf_dump_walker()
92 a->priv = p; in tcf_dump_walker()
93 a->order = n_i; in tcf_dump_walker()
95 nest = nla_nest_start(skb, a->order); in tcf_dump_walker()
98 err = tcf_action_dump_1(skb, a, 0, 0); in tcf_dump_walker()
121 static int tcf_del_walker(struct sk_buff *skb, struct tc_action *a) in tcf_del_walker() argument
123 struct tcf_hashinfo *hinfo = a->ops->hinfo; in tcf_del_walker()
131 nest = nla_nest_start(skb, a->order); in tcf_del_walker()
134 if (nla_put_string(skb, TCA_KIND, a->ops->kind)) in tcf_del_walker()
139 a->priv = p; in tcf_del_walker()
140 ret = __tcf_hash_release(a, false, true); in tcf_del_walker()
142 module_put(a->ops->owner); in tcf_del_walker()
159 int type, struct tc_action *a) in tcf_generic_walker() argument
162 return tcf_del_walker(skb, a); in tcf_generic_walker()
164 return tcf_dump_walker(skb, cb, a); in tcf_generic_walker()
200 int tcf_hash_search(struct tc_action *a, u32 index) in tcf_hash_search() argument
202 struct tcf_hashinfo *hinfo = a->ops->hinfo; in tcf_hash_search()
206 a->priv = p; in tcf_hash_search()
213 int tcf_hash_check(u32 index, struct tc_action *a, int bind) in tcf_hash_check() argument
215 struct tcf_hashinfo *hinfo = a->ops->hinfo; in tcf_hash_check()
221 a->priv = p; in tcf_hash_check()
228 void tcf_hash_cleanup(struct tc_action *a, struct nlattr *est) in tcf_hash_cleanup() argument
230 struct tcf_common *pc = a->priv; in tcf_hash_cleanup()
238 int tcf_hash_create(u32 index, struct nlattr *est, struct tc_action *a, in tcf_hash_create() argument
241 struct tcf_hashinfo *hinfo = a->ops->hinfo; in tcf_hash_create()
265 a->priv = (void *) p; in tcf_hash_create()
270 void tcf_hash_insert(struct tc_action *a) in tcf_hash_insert() argument
272 struct tcf_common *p = a->priv; in tcf_hash_insert()
273 struct tcf_hashinfo *hinfo = a->ops->hinfo; in tcf_hash_insert()
287 struct tc_action_ops *a; in tcf_register_action() local
310 list_for_each_entry(a, &act_base, head) { in tcf_register_action()
311 if (act->type == a->type || (strcmp(act->kind, a->kind) == 0)) { in tcf_register_action()
326 struct tc_action_ops *a; in tcf_unregister_action() local
330 list_for_each_entry(a, &act_base, head) { in tcf_unregister_action()
331 if (a == act) { in tcf_unregister_action()
347 struct tc_action_ops *a, *res = NULL; in tc_lookup_action_n() local
351 list_for_each_entry(a, &act_base, head) { in tc_lookup_action_n()
352 if (strcmp(kind, a->kind) == 0) { in tc_lookup_action_n()
353 if (try_module_get(a->owner)) in tc_lookup_action_n()
354 res = a; in tc_lookup_action_n()
366 struct tc_action_ops *a, *res = NULL; in tc_lookup_action() local
370 list_for_each_entry(a, &act_base, head) { in tc_lookup_action()
371 if (nla_strcmp(kind, a->kind) == 0) { in tc_lookup_action()
372 if (try_module_get(a->owner)) in tc_lookup_action()
373 res = a; in tc_lookup_action()
385 const struct tc_action *a; in tcf_action_exec() local
393 list_for_each_entry(a, actions, list) { in tcf_action_exec()
395 ret = a->ops->act(skb, a, res); in tcf_action_exec()
413 struct tc_action *a, *tmp; in tcf_action_destroy() local
416 list_for_each_entry_safe(a, tmp, actions, list) { in tcf_action_destroy()
417 ret = __tcf_hash_release(a, bind, true); in tcf_action_destroy()
419 module_put(a->ops->owner); in tcf_action_destroy()
422 list_del(&a->list); in tcf_action_destroy()
423 kfree(a); in tcf_action_destroy()
429 tcf_action_dump_old(struct sk_buff *skb, struct tc_action *a, int bind, int ref) in tcf_action_dump_old() argument
431 return a->ops->dump(skb, a, bind, ref); in tcf_action_dump_old()
435 tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, int bind, int ref) in tcf_action_dump_1() argument
441 if (nla_put_string(skb, TCA_KIND, a->ops->kind)) in tcf_action_dump_1()
443 if (tcf_action_copy_stats(skb, a, 0)) in tcf_action_dump_1()
448 err = tcf_action_dump_old(skb, a, bind, ref); in tcf_action_dump_1()
463 struct tc_action *a; in tcf_action_dump() local
467 list_for_each_entry(a, actions, list) { in tcf_action_dump()
468 nest = nla_nest_start(skb, a->order); in tcf_action_dump()
471 err = tcf_action_dump_1(skb, a, bind, ref); in tcf_action_dump()
490 struct tc_action *a; in tcf_action_init_1() local
538 a = kzalloc(sizeof(*a), GFP_KERNEL); in tcf_action_init_1()
539 if (a == NULL) in tcf_action_init_1()
542 a->ops = a_o; in tcf_action_init_1()
543 INIT_LIST_HEAD(&a->list); in tcf_action_init_1()
546 err = a_o->init(net, tb[TCA_ACT_OPTIONS], est, a, ovr, bind); in tcf_action_init_1()
548 err = a_o->init(net, nla, est, a, ovr, bind); in tcf_action_init_1()
559 return a; in tcf_action_init_1()
562 kfree(a); in tcf_action_init_1()
598 int tcf_action_copy_stats(struct sk_buff *skb, struct tc_action *a, in tcf_action_copy_stats() argument
603 struct tcf_common *p = a->priv; in tcf_action_copy_stats()
612 if (a->type == TCA_OLD_COMPAT) in tcf_action_copy_stats()
710 struct tc_action *a; in tcf_action_get_1() local
725 a = create_a(0); in tcf_action_get_1()
726 if (a == NULL) in tcf_action_get_1()
730 a->ops = tc_lookup_action(tb[TCA_ACT_KIND]); in tcf_action_get_1()
731 if (a->ops == NULL) /* could happen in batch of actions */ in tcf_action_get_1()
734 if (a->ops->lookup(a, index) == 0) in tcf_action_get_1()
737 module_put(a->ops->owner); in tcf_action_get_1()
738 return a; in tcf_action_get_1()
741 module_put(a->ops->owner); in tcf_action_get_1()
743 kfree(a); in tcf_action_get_1()
750 struct tc_action *a, *tmp; in cleanup_a() local
752 list_for_each_entry_safe(a, tmp, actions, list) { in cleanup_a()
753 list_del(&a->list); in cleanup_a()
754 kfree(a); in cleanup_a()
769 struct tc_action a; in tca_action_flush() local
786 memset(&a, 0, sizeof(struct tc_action)); in tca_action_flush()
787 INIT_LIST_HEAD(&a.list); in tca_action_flush()
788 a.ops = tc_lookup_action(kind); in tca_action_flush()
789 if (a.ops == NULL) /*some idjot trying to flush unknown action */ in tca_action_flush()
804 err = a.ops->walk(skb, &dcb, RTM_DELACTION, &a); in tca_action_flush()
814 module_put(a.ops->owner); in tca_action_flush()
823 module_put(a.ops->owner); in tca_action_flush()
1033 struct tc_action a; in tc_dump_action() local
1047 memset(&a, 0, sizeof(struct tc_action)); in tc_dump_action()
1048 a.ops = a_o; in tc_dump_action()
1063 ret = a_o->walk(skb, cb, RTM_GETACTION, &a); in tc_dump_action()