Lines Matching refs:a
39 static void tcf_hash_destroy(struct tc_action *a) in tcf_hash_destroy() argument
41 struct tcf_common *p = a->priv; in tcf_hash_destroy()
42 struct tcf_hashinfo *hinfo = a->ops->hinfo; in tcf_hash_destroy()
56 int __tcf_hash_release(struct tc_action *a, bool bind, bool strict) in __tcf_hash_release() argument
58 struct tcf_common *p = a->priv; in __tcf_hash_release()
69 if (a->ops->cleanup) in __tcf_hash_release()
70 a->ops->cleanup(a, bind); in __tcf_hash_release()
71 tcf_hash_destroy(a); in __tcf_hash_release()
81 struct tc_action *a) in tcf_dump_walker() argument
83 struct tcf_hashinfo *hinfo = a->ops->hinfo; in tcf_dump_walker()
100 a->priv = p; in tcf_dump_walker()
101 a->order = n_i; in tcf_dump_walker()
103 nest = nla_nest_start(skb, a->order); in tcf_dump_walker()
106 err = tcf_action_dump_1(skb, a, 0, 0); in tcf_dump_walker()
129 static int tcf_del_walker(struct sk_buff *skb, struct tc_action *a) in tcf_del_walker() argument
131 struct tcf_hashinfo *hinfo = a->ops->hinfo; in tcf_del_walker()
139 nest = nla_nest_start(skb, a->order); in tcf_del_walker()
142 if (nla_put_string(skb, TCA_KIND, a->ops->kind)) in tcf_del_walker()
147 a->priv = p; in tcf_del_walker()
148 ret = __tcf_hash_release(a, false, true); in tcf_del_walker()
150 module_put(a->ops->owner); in tcf_del_walker()
167 int type, struct tc_action *a) in tcf_generic_walker() argument
170 return tcf_del_walker(skb, a); in tcf_generic_walker()
172 return tcf_dump_walker(skb, cb, a); in tcf_generic_walker()
208 int tcf_hash_search(struct tc_action *a, u32 index) in tcf_hash_search() argument
210 struct tcf_hashinfo *hinfo = a->ops->hinfo; in tcf_hash_search()
214 a->priv = p; in tcf_hash_search()
221 int tcf_hash_check(u32 index, struct tc_action *a, int bind) in tcf_hash_check() argument
223 struct tcf_hashinfo *hinfo = a->ops->hinfo; in tcf_hash_check()
229 a->priv = p; in tcf_hash_check()
236 void tcf_hash_cleanup(struct tc_action *a, struct nlattr *est) in tcf_hash_cleanup() argument
238 struct tcf_common *pc = a->priv; in tcf_hash_cleanup()
246 int tcf_hash_create(u32 index, struct nlattr *est, struct tc_action *a, in tcf_hash_create() argument
249 struct tcf_hashinfo *hinfo = a->ops->hinfo; in tcf_hash_create()
288 a->priv = (void *) p; in tcf_hash_create()
293 void tcf_hash_insert(struct tc_action *a) in tcf_hash_insert() argument
295 struct tcf_common *p = a->priv; in tcf_hash_insert()
296 struct tcf_hashinfo *hinfo = a->ops->hinfo; in tcf_hash_insert()
310 struct tc_action_ops *a; in tcf_register_action() local
333 list_for_each_entry(a, &act_base, head) { in tcf_register_action()
334 if (act->type == a->type || (strcmp(act->kind, a->kind) == 0)) { in tcf_register_action()
349 struct tc_action_ops *a; in tcf_unregister_action() local
353 list_for_each_entry(a, &act_base, head) { in tcf_unregister_action()
354 if (a == act) { in tcf_unregister_action()
370 struct tc_action_ops *a, *res = NULL; in tc_lookup_action_n() local
374 list_for_each_entry(a, &act_base, head) { in tc_lookup_action_n()
375 if (strcmp(kind, a->kind) == 0) { in tc_lookup_action_n()
376 if (try_module_get(a->owner)) in tc_lookup_action_n()
377 res = a; in tc_lookup_action_n()
389 struct tc_action_ops *a, *res = NULL; in tc_lookup_action() local
393 list_for_each_entry(a, &act_base, head) { in tc_lookup_action()
394 if (nla_strcmp(kind, a->kind) == 0) { in tc_lookup_action()
395 if (try_module_get(a->owner)) in tc_lookup_action()
396 res = a; in tc_lookup_action()
408 const struct tc_action *a; in tcf_action_exec() local
416 list_for_each_entry(a, actions, list) { in tcf_action_exec()
418 ret = a->ops->act(skb, a, res); in tcf_action_exec()
431 struct tc_action *a, *tmp; in tcf_action_destroy() local
434 list_for_each_entry_safe(a, tmp, actions, list) { in tcf_action_destroy()
435 ret = __tcf_hash_release(a, bind, true); in tcf_action_destroy()
437 module_put(a->ops->owner); in tcf_action_destroy()
440 list_del(&a->list); in tcf_action_destroy()
441 kfree(a); in tcf_action_destroy()
447 tcf_action_dump_old(struct sk_buff *skb, struct tc_action *a, int bind, int ref) in tcf_action_dump_old() argument
449 return a->ops->dump(skb, a, bind, ref); in tcf_action_dump_old()
453 tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, int bind, int ref) in tcf_action_dump_1() argument
459 if (nla_put_string(skb, TCA_KIND, a->ops->kind)) in tcf_action_dump_1()
461 if (tcf_action_copy_stats(skb, a, 0)) in tcf_action_dump_1()
466 err = tcf_action_dump_old(skb, a, bind, ref); in tcf_action_dump_1()
481 struct tc_action *a; in tcf_action_dump() local
485 list_for_each_entry(a, actions, list) { in tcf_action_dump()
486 nest = nla_nest_start(skb, a->order); in tcf_action_dump()
489 err = tcf_action_dump_1(skb, a, bind, ref); in tcf_action_dump()
508 struct tc_action *a; in tcf_action_init_1() local
556 a = kzalloc(sizeof(*a), GFP_KERNEL); in tcf_action_init_1()
557 if (a == NULL) in tcf_action_init_1()
560 a->ops = a_o; in tcf_action_init_1()
561 INIT_LIST_HEAD(&a->list); in tcf_action_init_1()
564 err = a_o->init(net, tb[TCA_ACT_OPTIONS], est, a, ovr, bind); in tcf_action_init_1()
566 err = a_o->init(net, nla, est, a, ovr, bind); in tcf_action_init_1()
577 return a; in tcf_action_init_1()
580 kfree(a); in tcf_action_init_1()
616 int tcf_action_copy_stats(struct sk_buff *skb, struct tc_action *a, in tcf_action_copy_stats() argument
621 struct tcf_common *p = a->priv; in tcf_action_copy_stats()
630 if (a->type == TCA_OLD_COMPAT) in tcf_action_copy_stats()
728 struct tc_action *a; in tcf_action_get_1() local
743 a = create_a(0); in tcf_action_get_1()
744 if (a == NULL) in tcf_action_get_1()
748 a->ops = tc_lookup_action(tb[TCA_ACT_KIND]); in tcf_action_get_1()
749 if (a->ops == NULL) /* could happen in batch of actions */ in tcf_action_get_1()
752 if (a->ops->lookup(a, index) == 0) in tcf_action_get_1()
755 module_put(a->ops->owner); in tcf_action_get_1()
756 return a; in tcf_action_get_1()
759 module_put(a->ops->owner); in tcf_action_get_1()
761 kfree(a); in tcf_action_get_1()
768 struct tc_action *a, *tmp; in cleanup_a() local
770 list_for_each_entry_safe(a, tmp, actions, list) { in cleanup_a()
771 list_del(&a->list); in cleanup_a()
772 kfree(a); in cleanup_a()
787 struct tc_action a; in tca_action_flush() local
804 memset(&a, 0, sizeof(struct tc_action)); in tca_action_flush()
805 INIT_LIST_HEAD(&a.list); in tca_action_flush()
806 a.ops = tc_lookup_action(kind); in tca_action_flush()
807 if (a.ops == NULL) /*some idjot trying to flush unknown action */ in tca_action_flush()
822 err = a.ops->walk(skb, &dcb, RTM_DELACTION, &a); in tca_action_flush()
832 module_put(a.ops->owner); in tca_action_flush()
841 module_put(a.ops->owner); in tca_action_flush()
1051 struct tc_action a; in tc_dump_action() local
1065 memset(&a, 0, sizeof(struct tc_action)); in tc_dump_action()
1066 a.ops = a_o; in tc_dump_action()
1081 ret = a_o->walk(skb, cb, RTM_GETACTION, &a); in tc_dump_action()