• Home
  • Raw
  • Download

Lines Matching +full:array +full:- +full:nest

1 // SPDX-License-Identifier: GPL-2.0-or-later
47 const struct tcf_chain *chain = rcu_dereference_bh(a->goto_chain); in tcf_action_goto_chain_exec()
49 res->goto_tp = rcu_dereference_bh(chain->filter_chain); in tcf_action_goto_chain_exec()
56 kfree(cookie->data); in tcf_free_cookie_rcu()
67 call_rcu(&old->rcu, tcf_free_cookie_rcu); in tcf_set_action_cookie()
74 int opcode = TC_ACT_EXT_OPCODE(action), ret = -EINVAL; in tcf_action_check_ctrlact()
78 ret = action > TC_ACT_VALUE_MAX ? -EINVAL : 0; in tcf_action_check_ctrlact()
89 ret = -EINVAL; in tcf_action_check_ctrlact()
94 *newchain = tcf_chain_get_by_act(tp->chain->block, chain_index); in tcf_action_check_ctrlact()
96 ret = -ENOMEM; in tcf_action_check_ctrlact()
109 a->tcfa_action = action; in tcf_action_set_ctrlact()
110 goto_chain = rcu_replace_pointer(a->goto_chain, goto_chain, 1); in tcf_action_set_ctrlact()
122 struct tcf_chain *chain = rcu_dereference_protected(p->goto_chain, 1); in free_tcf()
124 free_percpu(p->cpu_bstats); in free_tcf()
125 free_percpu(p->cpu_bstats_hw); in free_tcf()
126 free_percpu(p->cpu_qstats); in free_tcf()
128 tcf_set_action_cookie(&p->user_cookie, NULL); in free_tcf()
138 act->in_hw_count = hw_count; in offload_action_hw_count_set()
144 act->in_hw_count += hw_count; in offload_action_hw_count_inc()
150 act->in_hw_count = act->in_hw_count > hw_count ? in offload_action_hw_count_dec()
151 act->in_hw_count - hw_count : 0; in offload_action_hw_count_dec()
187 fl_action->extack = extack; in offload_action_init()
188 fl_action->command = cmd; in offload_action_init()
189 fl_action->index = act->tcfa_index; in offload_action_init()
190 fl_action->cookie = (unsigned long)act; in offload_action_init()
192 if (act->ops->offload_act_setup) { in offload_action_init()
193 spin_lock_bh(&act->tcfa_lock); in offload_action_init()
194 err = act->ops->offload_act_setup(act, fl_action, NULL, in offload_action_init()
196 spin_unlock_bh(&act->tcfa_lock); in offload_action_init()
200 return -EOPNOTSUPP; in offload_action_init()
251 bool skip_sw = tc_act_skip_sw(action->tcfa_flags); in tcf_action_offload_add_ex()
259 if (tc_act_skip_hw(action->tcfa_flags)) in tcf_action_offload_add_ex()
265 return -ENOMEM; in tcf_action_offload_add_ex()
271 err = tc_setup_action(&fl_action->action, actions, 0, extack); in tcf_action_offload_add_ex()
284 err = -EINVAL; in tcf_action_offload_add_ex()
286 tc_cleanup_offload_action(&fl_action->action); in tcf_action_offload_add_ex()
319 action->used_hw_stats = fl_act.stats.used_hw_stats; in tcf_action_update_hw_stats()
320 action->used_hw_stats_valid = true; in tcf_action_update_hw_stats()
322 return -EOPNOTSUPP; in tcf_action_update_hw_stats()
348 if (!cb && action->in_hw_count != in_hw_count) in tcf_action_offload_del_ex()
349 return -EINVAL; in tcf_action_offload_del_ex()
366 if (p->ops->cleanup) in tcf_action_cleanup()
367 p->ops->cleanup(p); in tcf_action_cleanup()
369 gen_kill_estimator(&p->tcfa_rate_est); in tcf_action_cleanup()
375 struct tcf_idrinfo *idrinfo = p->idrinfo; in __tcf_action_put()
377 if (refcount_dec_and_mutex_lock(&p->tcfa_refcnt, &idrinfo->lock)) { in __tcf_action_put()
379 atomic_dec(&p->tcfa_bindcnt); in __tcf_action_put()
380 idr_remove(&idrinfo->action_idr, p->tcfa_index); in __tcf_action_put()
381 mutex_unlock(&idrinfo->lock); in __tcf_action_put()
388 atomic_dec(&p->tcfa_bindcnt); in __tcf_action_put()
410 if (!bind && strict && atomic_read(&p->tcfa_bindcnt) > 0) in __tcf_idr_release()
411 return -EPERM; in __tcf_idr_release()
422 const struct tc_action_ops *ops = a->ops; in tcf_idr_release()
427 module_put(ops->owner); in tcf_idr_release()
438 user_cookie = rcu_dereference(act->user_cookie); in tcf_action_shared_attrs_size()
441 cookie_len = nla_total_size(user_cookie->len); in tcf_action_shared_attrs_size()
472 if (act->ops->get_fill_size) in tcf_action_fill_size()
473 return act->ops->get_fill_size(act) + sz; in tcf_action_fill_size()
483 if (nla_put_string(skb, TCA_ACT_KIND, a->ops->kind)) in tcf_action_dump_terse()
487 if (from_act && nla_put_u32(skb, TCA_ACT_INDEX, a->tcfa_index)) in tcf_action_dump_terse()
491 cookie = rcu_dereference(a->user_cookie); in tcf_action_dump_terse()
493 if (nla_put(skb, TCA_ACT_COOKIE, cookie->len, cookie->data)) { in tcf_action_dump_terse()
504 return -1; in tcf_action_dump_terse()
510 int err = 0, index = -1, s_i = 0, n_i = 0; in tcf_dump_walker()
511 u32 act_flags = cb->args[2]; in tcf_dump_walker()
512 unsigned long jiffy_since = cb->args[3]; in tcf_dump_walker()
513 struct nlattr *nest; in tcf_dump_walker() local
514 struct idr *idr = &idrinfo->action_idr; in tcf_dump_walker()
519 mutex_lock(&idrinfo->lock); in tcf_dump_walker()
521 s_i = cb->args[0]; in tcf_dump_walker()
532 (unsigned long)p->tcfa_tm.lastuse)) in tcf_dump_walker()
537 nest = nla_nest_start_noflag(skb, n_i); in tcf_dump_walker()
538 if (!nest) { in tcf_dump_walker()
539 index--; in tcf_dump_walker()
546 index--; in tcf_dump_walker()
547 nlmsg_trim(skb, nest); in tcf_dump_walker()
550 nla_nest_end(skb, nest); in tcf_dump_walker()
558 cb->args[0] = index + 1; in tcf_dump_walker()
560 mutex_unlock(&idrinfo->lock); in tcf_dump_walker()
563 cb->args[1] = n_i; in tcf_dump_walker()
568 nla_nest_cancel(skb, nest); in tcf_dump_walker()
574 if (atomic_read(&p->tcfa_bindcnt) > 0) in tcf_idr_release_unsafe()
575 return -EPERM; in tcf_idr_release_unsafe()
577 if (refcount_dec_and_test(&p->tcfa_refcnt)) { in tcf_idr_release_unsafe()
578 idr_remove(&p->idrinfo->action_idr, p->tcfa_index); in tcf_idr_release_unsafe()
590 struct nlattr *nest; in tcf_del_walker() local
592 int ret = -EINVAL; in tcf_del_walker()
593 struct idr *idr = &idrinfo->action_idr; in tcf_del_walker()
598 nest = nla_nest_start_noflag(skb, 0); in tcf_del_walker()
599 if (nest == NULL) in tcf_del_walker()
601 if (nla_put_string(skb, TCA_ACT_KIND, ops->kind)) in tcf_del_walker()
605 mutex_lock(&idrinfo->lock); in tcf_del_walker()
611 module_put(ops->owner); in tcf_del_walker()
616 mutex_unlock(&idrinfo->lock); in tcf_del_walker()
627 nla_nest_end(skb, nest); in tcf_del_walker()
631 nla_nest_cancel(skb, nest); in tcf_del_walker()
640 struct tcf_idrinfo *idrinfo = tn->idrinfo; in tcf_generic_walker()
649 return -EINVAL; in tcf_generic_walker()
656 struct tcf_idrinfo *idrinfo = tn->idrinfo; in tcf_idr_search()
659 mutex_lock(&idrinfo->lock); in tcf_idr_search()
660 p = idr_find(&idrinfo->action_idr, index); in tcf_idr_search()
664 refcount_inc(&p->tcfa_refcnt); in tcf_idr_search()
665 mutex_unlock(&idrinfo->lock); in tcf_idr_search()
680 struct tc_action_net *tn = net_generic(net, ops->net_id); in __tcf_generic_walker()
682 if (unlikely(ops->walk)) in __tcf_generic_walker()
683 return ops->walk(net, skb, cb, type, ops, extack); in __tcf_generic_walker()
692 struct tc_action_net *tn = net_generic(net, ops->net_id); in __tcf_idr_search()
694 if (unlikely(ops->lookup)) in __tcf_idr_search()
695 return ops->lookup(net, a, index); in __tcf_idr_search()
705 mutex_lock(&idrinfo->lock); in tcf_idr_delete_index()
706 p = idr_find(&idrinfo->action_idr, index); in tcf_idr_delete_index()
708 mutex_unlock(&idrinfo->lock); in tcf_idr_delete_index()
709 return -ENOENT; in tcf_idr_delete_index()
712 if (!atomic_read(&p->tcfa_bindcnt)) { in tcf_idr_delete_index()
713 if (refcount_dec_and_test(&p->tcfa_refcnt)) { in tcf_idr_delete_index()
714 struct module *owner = p->ops->owner; in tcf_idr_delete_index()
716 WARN_ON(p != idr_remove(&idrinfo->action_idr, in tcf_idr_delete_index()
717 p->tcfa_index)); in tcf_idr_delete_index()
718 mutex_unlock(&idrinfo->lock); in tcf_idr_delete_index()
726 ret = -EPERM; in tcf_idr_delete_index()
729 mutex_unlock(&idrinfo->lock); in tcf_idr_delete_index()
737 struct tc_action *p = kzalloc(ops->size, GFP_KERNEL); in tcf_idr_create()
738 struct tcf_idrinfo *idrinfo = tn->idrinfo; in tcf_idr_create()
739 int err = -ENOMEM; in tcf_idr_create()
742 return -ENOMEM; in tcf_idr_create()
743 refcount_set(&p->tcfa_refcnt, 1); in tcf_idr_create()
745 atomic_set(&p->tcfa_bindcnt, 1); in tcf_idr_create()
748 p->cpu_bstats = netdev_alloc_pcpu_stats(struct gnet_stats_basic_sync); in tcf_idr_create()
749 if (!p->cpu_bstats) in tcf_idr_create()
751 p->cpu_bstats_hw = netdev_alloc_pcpu_stats(struct gnet_stats_basic_sync); in tcf_idr_create()
752 if (!p->cpu_bstats_hw) in tcf_idr_create()
754 p->cpu_qstats = alloc_percpu(struct gnet_stats_queue); in tcf_idr_create()
755 if (!p->cpu_qstats) in tcf_idr_create()
758 gnet_stats_basic_sync_init(&p->tcfa_bstats); in tcf_idr_create()
759 gnet_stats_basic_sync_init(&p->tcfa_bstats_hw); in tcf_idr_create()
760 spin_lock_init(&p->tcfa_lock); in tcf_idr_create()
761 p->tcfa_index = index; in tcf_idr_create()
762 p->tcfa_tm.install = jiffies; in tcf_idr_create()
763 p->tcfa_tm.lastuse = jiffies; in tcf_idr_create()
764 p->tcfa_tm.firstuse = 0; in tcf_idr_create()
765 p->tcfa_flags = flags; in tcf_idr_create()
767 err = gen_new_estimator(&p->tcfa_bstats, p->cpu_bstats, in tcf_idr_create()
768 &p->tcfa_rate_est, in tcf_idr_create()
769 &p->tcfa_lock, false, est); in tcf_idr_create()
774 p->idrinfo = idrinfo; in tcf_idr_create()
775 __module_get(ops->owner); in tcf_idr_create()
776 p->ops = ops; in tcf_idr_create()
780 free_percpu(p->cpu_qstats); in tcf_idr_create()
782 free_percpu(p->cpu_bstats_hw); in tcf_idr_create()
784 free_percpu(p->cpu_bstats); in tcf_idr_create()
806 struct tcf_idrinfo *idrinfo = tn->idrinfo; in tcf_idr_cleanup()
808 mutex_lock(&idrinfo->lock); in tcf_idr_cleanup()
809 /* Remove ERR_PTR(-EBUSY) allocated by tcf_idr_check_alloc */ in tcf_idr_cleanup()
810 WARN_ON(!IS_ERR(idr_remove(&idrinfo->action_idr, index))); in tcf_idr_cleanup()
811 mutex_unlock(&idrinfo->lock); in tcf_idr_cleanup()
824 struct tcf_idrinfo *idrinfo = tn->idrinfo; in tcf_idr_check_alloc()
829 mutex_lock(&idrinfo->lock); in tcf_idr_check_alloc()
831 p = idr_find(&idrinfo->action_idr, *index); in tcf_idr_check_alloc()
836 mutex_unlock(&idrinfo->lock); in tcf_idr_check_alloc()
841 refcount_inc(&p->tcfa_refcnt); in tcf_idr_check_alloc()
843 atomic_inc(&p->tcfa_bindcnt); in tcf_idr_check_alloc()
848 ret = idr_alloc_u32(&idrinfo->action_idr, NULL, index, in tcf_idr_check_alloc()
851 idr_replace(&idrinfo->action_idr, in tcf_idr_check_alloc()
852 ERR_PTR(-EBUSY), *index); in tcf_idr_check_alloc()
857 ret = idr_alloc_u32(&idrinfo->action_idr, NULL, index, in tcf_idr_check_alloc()
860 idr_replace(&idrinfo->action_idr, ERR_PTR(-EBUSY), in tcf_idr_check_alloc()
863 mutex_unlock(&idrinfo->lock); in tcf_idr_check_alloc()
871 struct idr *idr = &idrinfo->action_idr; in tcf_idrinfo_destroy()
880 module_put(ops->owner); in tcf_idrinfo_destroy()
884 idr_destroy(&idrinfo->action_idr); in tcf_idrinfo_destroy()
909 if (id_ptr->id == id) { in tcf_pernet_add_id_list()
910 ret = -EEXIST; in tcf_pernet_add_id_list()
917 ret = -ENOMEM; in tcf_pernet_add_id_list()
920 id_ptr->id = id; in tcf_pernet_add_id_list()
922 list_add_tail(&id_ptr->list, &act_pernet_id_list); in tcf_pernet_add_id_list()
935 if (id_ptr->id == id) { in tcf_pernet_del_id_list()
936 list_del(&id_ptr->list); in tcf_pernet_del_id_list()
950 if (!act->act || !act->dump || !act->init) in tcf_register_action()
951 return -EINVAL; in tcf_register_action()
961 if (ops->id) { in tcf_register_action()
962 ret = tcf_pernet_add_id_list(*ops->id); in tcf_register_action()
969 if (act->id == a->id || (strcmp(act->kind, a->kind) == 0)) { in tcf_register_action()
970 ret = -EEXIST; in tcf_register_action()
974 list_add_tail(&act->head, &act_base); in tcf_register_action()
981 if (ops->id) in tcf_register_action()
982 tcf_pernet_del_id_list(*ops->id); in tcf_register_action()
993 int err = -ENOENT; in tcf_unregister_action()
998 list_del(&act->head); in tcf_unregister_action()
1006 if (ops->id) in tcf_unregister_action()
1007 tcf_pernet_del_id_list(*ops->id); in tcf_unregister_action()
1021 if (strcmp(kind, a->kind) == 0) { in tc_lookup_action_n()
1022 if (try_module_get(a->owner)) in tc_lookup_action_n()
1040 if (nla_strcmp(kind, a->kind) == 0) { in tc_lookup_action()
1041 if (try_module_get(a->owner)) in tc_lookup_action()
1070 jmp_prgcnt -= 1; in tcf_action_exec()
1074 if (tc_act_skip_sw(a->tcfa_flags)) in tcf_action_exec()
1081 if (--repeat_ttl != 0) in tcf_action_exec()
1093 jmp_ttl -= 1; in tcf_action_exec()
1100 if (unlikely(!rcu_access_pointer(a->goto_chain))) { in tcf_action_exec()
1124 ops = a->ops; in tcf_action_destroy()
1127 module_put(ops->owner); in tcf_action_destroy()
1139 /* Put all actions in this array, skip those NULL's. */
1150 ops = a->ops; in tcf_action_put_many()
1152 module_put(ops->owner); in tcf_action_put_many()
1159 return a->ops->dump(skb, a, bind, ref); in tcf_action_dump_old()
1165 int err = -EINVAL; in tcf_action_dump_1()
1167 struct nlattr *nest; in tcf_action_dump_1() local
1173 if (a->hw_stats != TCA_ACT_HW_STATS_ANY && in tcf_action_dump_1()
1175 a->hw_stats, TCA_ACT_HW_STATS_ANY)) in tcf_action_dump_1()
1178 if (a->used_hw_stats_valid && in tcf_action_dump_1()
1180 a->used_hw_stats, TCA_ACT_HW_STATS_ANY)) in tcf_action_dump_1()
1183 flags = a->tcfa_flags & TCA_ACT_FLAGS_USER_MASK; in tcf_action_dump_1()
1189 if (nla_put_u32(skb, TCA_ACT_IN_HW_COUNT, a->in_hw_count)) in tcf_action_dump_1()
1192 nest = nla_nest_start_noflag(skb, TCA_ACT_OPTIONS); in tcf_action_dump_1()
1193 if (nest == NULL) in tcf_action_dump_1()
1197 nla_nest_end(skb, nest); in tcf_action_dump_1()
1203 return -1; in tcf_action_dump_1()
1211 int err = -EINVAL, i; in tcf_action_dump()
1212 struct nlattr *nest; in tcf_action_dump() local
1216 nest = nla_nest_start_noflag(skb, i + 1); in tcf_action_dump()
1217 if (nest == NULL) in tcf_action_dump()
1223 nla_nest_end(skb, nest); in tcf_action_dump()
1229 err = -EINVAL; in tcf_action_dump()
1231 nla_nest_cancel(skb, nest); in tcf_action_dump()
1241 c->data = nla_memdup(tb[TCA_ACT_COOKIE], GFP_KERNEL); in nla_memdup_cookie()
1242 if (!c->data) { in nla_memdup_cookie()
1246 c->len = nla_len(tb[TCA_ACT_COOKIE]); in nla_memdup_cookie()
1287 idrinfo = a->idrinfo; in tcf_idr_insert_many()
1288 mutex_lock(&idrinfo->lock); in tcf_idr_insert_many()
1289 /* Replace ERR_PTR(-EBUSY) allocated by tcf_idr_check_alloc if in tcf_idr_insert_many()
1292 idr_replace(&idrinfo->action_idr, a, a->tcfa_index); in tcf_idr_insert_many()
1293 mutex_unlock(&idrinfo->lock); in tcf_idr_insert_many()
1312 err = -EINVAL; in tc_action_load_ops()
1325 return ERR_PTR(-EINVAL); in tc_action_load_ops()
1344 * indicate this using -EAGAIN. in tc_action_load_ops()
1347 module_put(a_o->owner); in tc_action_load_ops()
1348 return ERR_PTR(-EAGAIN); in tc_action_load_ops()
1352 return ERR_PTR(-ENOENT); in tc_action_load_ops()
1381 err = -ENOMEM; in tcf_action_init_1()
1389 err = -EINVAL; in tcf_action_init_1()
1394 err = a_o->init(net, tb[TCA_ACT_OPTIONS], est, &a, tp, in tcf_action_init_1()
1397 err = a_o->init(net, nla, est, &a, tp, userflags.value | flags, in tcf_action_init_1()
1405 tcf_set_action_cookie(&a->user_cookie, user_cookie); in tcf_action_init_1()
1408 a->hw_stats = hw_stats; in tcf_action_init_1()
1414 kfree(user_cookie->data); in tcf_action_init_1()
1455 ops[i - 1] = a_o; in tcf_action_init()
1459 act = tcf_action_init_1(net, tp, tb[i], est, ops[i - 1], in tcf_action_init()
1460 &init_res[i - 1], flags, extack); in tcf_action_init()
1467 actions[i - 1] = act; in tcf_action_init()
1472 if (tc_act_bind(act->tcfa_flags)) in tcf_action_init()
1474 if (skip_sw != tc_act_skip_sw(act->tcfa_flags) || in tcf_action_init()
1475 skip_hw != tc_act_skip_hw(act->tcfa_flags)) { in tcf_action_init()
1478 err = -EINVAL; in tcf_action_init()
1483 if (tc_act_skip_sw(act->tcfa_flags) && err) in tcf_action_init()
1494 err = i - 1; in tcf_action_init()
1502 module_put(ops[i]->owner); in tcf_action_init()
1510 if (a->cpu_bstats) { in tcf_action_update_stats()
1511 _bstats_update(this_cpu_ptr(a->cpu_bstats), bytes, packets); in tcf_action_update_stats()
1513 this_cpu_ptr(a->cpu_qstats)->drops += drops; in tcf_action_update_stats()
1516 _bstats_update(this_cpu_ptr(a->cpu_bstats_hw), in tcf_action_update_stats()
1521 _bstats_update(&a->tcfa_bstats, bytes, packets); in tcf_action_update_stats()
1522 a->tcfa_qstats.drops += drops; in tcf_action_update_stats()
1524 _bstats_update(&a->tcfa_bstats_hw, bytes, packets); in tcf_action_update_stats()
1541 if (p->type == TCA_OLD_COMPAT) in tcf_action_copy_stats()
1545 &p->tcfa_lock, &d, in tcf_action_copy_stats()
1551 &p->tcfa_lock, &d, TCA_ACT_PAD); in tcf_action_copy_stats()
1556 if (gnet_stats_copy_basic(&d, p->cpu_bstats, in tcf_action_copy_stats()
1557 &p->tcfa_bstats, false) < 0 || in tcf_action_copy_stats()
1558 gnet_stats_copy_basic_hw(&d, p->cpu_bstats_hw, in tcf_action_copy_stats()
1559 &p->tcfa_bstats_hw, false) < 0 || in tcf_action_copy_stats()
1560 gnet_stats_copy_rate_est(&d, &p->tcfa_rate_est) < 0 || in tcf_action_copy_stats()
1561 gnet_stats_copy_queue(&d, p->cpu_qstats, in tcf_action_copy_stats()
1562 &p->tcfa_qstats, in tcf_action_copy_stats()
1563 p->tcfa_qstats.qlen) < 0) in tcf_action_copy_stats()
1572 return -1; in tcf_action_copy_stats()
1582 struct nlattr *nest; in tca_get_fill() local
1588 t->tca_family = AF_UNSPEC; in tca_get_fill()
1589 t->tca__pad1 = 0; in tca_get_fill()
1590 t->tca__pad2 = 0; in tca_get_fill()
1592 if (extack && extack->_msg && in tca_get_fill()
1593 nla_put_string(skb, TCA_ROOT_EXT_WARN_MSG, extack->_msg)) in tca_get_fill()
1596 nest = nla_nest_start_noflag(skb, TCA_ACT_TAB); in tca_get_fill()
1597 if (!nest) in tca_get_fill()
1603 nla_nest_end(skb, nest); in tca_get_fill()
1605 nlh->nlmsg_len = skb_tail_pointer(skb) - b; in tca_get_fill()
1607 return skb->len; in tca_get_fill()
1611 return -1; in tca_get_fill()
1623 return -ENOBUFS; in tcf_get_notify()
1624 if (tca_get_fill(skb, actions, portid, n->nlmsg_seq, 0, event, in tcf_get_notify()
1628 return -EINVAL; in tcf_get_notify()
1649 err = -EINVAL; in tcf_action_get_1()
1657 err = -EINVAL; in tcf_action_get_1()
1663 err = -ENOENT; in tcf_action_get_1()
1669 module_put(ops->owner); in tcf_action_get_1()
1673 module_put(ops->owner); in tcf_action_get_1()
1687 struct nlattr *nest; in tca_action_flush() local
1691 int err = -ENOMEM; in tca_action_flush()
1704 err = -EINVAL; in tca_action_flush()
1712 nlh = nlmsg_put(skb, portid, n->nlmsg_seq, RTM_DELACTION, in tca_action_flush()
1719 t->tca_family = AF_UNSPEC; in tca_action_flush()
1720 t->tca__pad1 = 0; in tca_action_flush()
1721 t->tca__pad2 = 0; in tca_action_flush()
1723 nest = nla_nest_start_noflag(skb, TCA_ACT_TAB); in tca_action_flush()
1724 if (!nest) { in tca_action_flush()
1731 nla_nest_cancel(skb, nest); in tca_action_flush()
1735 nla_nest_end(skb, nest); in tca_action_flush()
1737 nlh->nlmsg_len = skb_tail_pointer(skb) - b; in tca_action_flush()
1738 nlh->nlmsg_flags |= NLM_F_ROOT; in tca_action_flush()
1739 module_put(ops->owner); in tca_action_flush()
1741 n->nlmsg_flags & NLM_F_ECHO); in tca_action_flush()
1748 module_put(ops->owner); in tca_action_flush()
1760 const struct tc_action_ops *ops = a->ops; in tcf_action_delete()
1764 struct tcf_idrinfo *idrinfo = a->idrinfo; in tcf_action_delete()
1765 u32 act_index = a->tcfa_index; in tcf_action_delete()
1770 module_put(ops->owner); in tcf_action_delete()
1790 const struct tc_action_ops *ops = action->ops; in tcf_reoffload_del_notify()
1797 return -ENOBUFS; in tcf_reoffload_del_notify()
1801 return -EINVAL; in tcf_reoffload_del_notify()
1806 module_put(ops->owner); in tcf_reoffload_del_notify()
1830 return -EINVAL; in tcf_action_reoffload_cb()
1837 act_id = id_ptr->id; in tcf_action_reoffload_cb()
1841 idrinfo = tn->idrinfo; in tcf_action_reoffload_cb()
1845 mutex_lock(&idrinfo->lock); in tcf_action_reoffload_cb()
1846 idr = &idrinfo->action_idr; in tcf_action_reoffload_cb()
1848 if (IS_ERR(p) || tc_act_bind(p->tcfa_flags)) in tcf_action_reoffload_cb()
1860 if (tc_act_skip_sw(p->tcfa_flags) && in tcf_action_reoffload_cb()
1864 mutex_unlock(&idrinfo->lock); in tcf_action_reoffload_cb()
1883 return -ENOBUFS; in tcf_del_notify()
1885 if (tca_get_fill(skb, actions, portid, n->nlmsg_seq, 0, RTM_DELACTION, in tcf_del_notify()
1889 return -EINVAL; in tcf_del_notify()
1901 n->nlmsg_flags & NLM_F_ECHO); in tcf_del_notify()
1920 if (event == RTM_DELACTION && n->nlmsg_flags & NLM_F_ROOT) { in tca_action_gd()
1925 return -EINVAL; in tca_action_gd()
1935 actions[i - 1] = act; in tca_action_gd()
1962 return -ENOBUFS; in tcf_add_notify()
1964 if (tca_get_fill(skb, actions, portid, n->nlmsg_seq, n->nlmsg_flags, in tcf_add_notify()
1968 return -EINVAL; in tcf_add_notify()
1972 n->nlmsg_flags & NLM_F_ECHO); in tcf_add_notify()
1987 if (ret != -EAGAIN) in tcf_action_add()
2013 struct net *net = sock_net(skb->sk); in tc_ctl_action()
2019 if ((n->nlmsg_type != RTM_GETACTION) && in tc_ctl_action()
2021 return -EPERM; in tc_ctl_action()
2030 return -EINVAL; in tc_ctl_action()
2033 /* n->nlmsg_flags & NLM_F_CREATE */ in tc_ctl_action()
2034 switch (n->nlmsg_type) { in tc_ctl_action()
2042 if (n->nlmsg_flags & NLM_F_REPLACE) in tc_ctl_action()
2086 struct net *net = sock_net(skb->sk); in tc_dump_action()
2089 struct nlattr *nest; in tc_dump_action() local
2092 struct tcamsg *t = (struct tcamsg *) nlmsg_data(cb->nlh); in tc_dump_action()
2101 ret = nlmsg_parse_deprecated(cb->nlh, sizeof(struct tcamsg), tb, in tc_dump_action()
2102 TCA_ROOT_MAX, tcaa_policy, cb->extack); in tc_dump_action()
2116 cb->args[2] = 0; in tc_dump_action()
2119 cb->args[2] = bf.value; in tc_dump_action()
2126 nlh = nlmsg_put(skb, NETLINK_CB(cb->skb).portid, cb->nlh->nlmsg_seq, in tc_dump_action()
2127 cb->nlh->nlmsg_type, sizeof(*t), 0); in tc_dump_action()
2132 jiffy_since = jiffies - msecs_to_jiffies(msecs_since); in tc_dump_action()
2135 t->tca_family = AF_UNSPEC; in tc_dump_action()
2136 t->tca__pad1 = 0; in tc_dump_action()
2137 t->tca__pad2 = 0; in tc_dump_action()
2138 cb->args[3] = jiffy_since; in tc_dump_action()
2143 nest = nla_nest_start_noflag(skb, TCA_ACT_TAB); in tc_dump_action()
2144 if (nest == NULL) in tc_dump_action()
2152 nla_nest_end(skb, nest); in tc_dump_action()
2153 ret = skb->len; in tc_dump_action()
2154 act_count = cb->args[1]; in tc_dump_action()
2156 cb->args[1] = 0; in tc_dump_action()
2160 nlh->nlmsg_len = skb_tail_pointer(skb) - b; in tc_dump_action()
2161 if (NETLINK_CB(cb->skb).portid && ret) in tc_dump_action()
2162 nlh->nlmsg_flags |= NLM_F_MULTI; in tc_dump_action()
2163 module_put(a_o->owner); in tc_dump_action()
2164 return skb->len; in tc_dump_action()
2167 module_put(a_o->owner); in tc_dump_action()
2169 return skb->len; in tc_dump_action()