Lines Matching +full:t +full:- +full:head
1 // SPDX-License-Identifier: GPL-2.0-or-later
30 struct cls_cgroup_head *head = rcu_dereference_bh(tp->root); in cls_cgroup_classify() local
33 if (unlikely(!head)) in cls_cgroup_classify()
34 return -1; in cls_cgroup_classify()
36 return -1; in cls_cgroup_classify()
37 if (!tcf_em_tree_match(skb, &head->ematches, NULL)) in cls_cgroup_classify()
38 return -1; in cls_cgroup_classify()
40 res->classid = classid; in cls_cgroup_classify()
41 res->class = 0; in cls_cgroup_classify()
43 return tcf_exts_exec(skb, &head->exts, res); in cls_cgroup_classify()
60 static void __cls_cgroup_destroy(struct cls_cgroup_head *head) in __cls_cgroup_destroy() argument
62 tcf_exts_destroy(&head->exts); in __cls_cgroup_destroy()
63 tcf_em_tree_destroy(&head->ematches); in __cls_cgroup_destroy()
64 tcf_exts_put_net(&head->exts); in __cls_cgroup_destroy()
65 kfree(head); in __cls_cgroup_destroy()
70 struct cls_cgroup_head *head = container_of(to_rcu_work(work), in cls_cgroup_destroy_work() local
74 __cls_cgroup_destroy(head); in cls_cgroup_destroy_work()
85 struct cls_cgroup_head *head = rtnl_dereference(tp->root); in cls_cgroup_change() local
90 return -EINVAL; in cls_cgroup_change()
92 if (!head && !handle) in cls_cgroup_change()
93 return -EINVAL; in cls_cgroup_change()
95 if (head && handle != head->handle) in cls_cgroup_change()
96 return -ENOENT; in cls_cgroup_change()
98 new = kzalloc(sizeof(*head), GFP_KERNEL); in cls_cgroup_change()
100 return -ENOBUFS; in cls_cgroup_change()
102 err = tcf_exts_init(&new->exts, net, TCA_CGROUP_ACT, TCA_CGROUP_POLICE); in cls_cgroup_change()
105 new->handle = handle; in cls_cgroup_change()
106 new->tp = tp; in cls_cgroup_change()
113 err = tcf_exts_validate(net, tp, tb, tca[TCA_RATE], &new->exts, flags, in cls_cgroup_change()
118 err = tcf_em_tree_validate(tp, tb[TCA_CGROUP_EMATCHES], &new->ematches); in cls_cgroup_change()
122 rcu_assign_pointer(tp->root, new); in cls_cgroup_change()
123 if (head) { in cls_cgroup_change()
124 tcf_exts_get_net(&head->exts); in cls_cgroup_change()
125 tcf_queue_work(&head->rwork, cls_cgroup_destroy_work); in cls_cgroup_change()
129 tcf_exts_destroy(&new->exts); in cls_cgroup_change()
137 struct cls_cgroup_head *head = rtnl_dereference(tp->root); in cls_cgroup_destroy() local
139 /* Head can still be NULL due to cls_cgroup_init(). */ in cls_cgroup_destroy()
140 if (head) { in cls_cgroup_destroy()
141 if (tcf_exts_get_net(&head->exts)) in cls_cgroup_destroy()
142 tcf_queue_work(&head->rwork, cls_cgroup_destroy_work); in cls_cgroup_destroy()
144 __cls_cgroup_destroy(head); in cls_cgroup_destroy()
151 return -EOPNOTSUPP; in cls_cgroup_delete()
157 struct cls_cgroup_head *head = rtnl_dereference(tp->root); in cls_cgroup_walk() local
159 if (arg->count < arg->skip) in cls_cgroup_walk()
162 if (!head) in cls_cgroup_walk()
164 if (arg->fn(tp, head, arg) < 0) { in cls_cgroup_walk()
165 arg->stop = 1; in cls_cgroup_walk()
169 arg->count++; in cls_cgroup_walk()
173 struct sk_buff *skb, struct tcmsg *t, bool rtnl_held) in cls_cgroup_dump() argument
175 struct cls_cgroup_head *head = rtnl_dereference(tp->root); in cls_cgroup_dump() local
178 t->tcm_handle = head->handle; in cls_cgroup_dump()
184 if (tcf_exts_dump(skb, &head->exts) < 0 || in cls_cgroup_dump()
185 tcf_em_tree_dump(skb, &head->ematches, TCA_CGROUP_EMATCHES) < 0) in cls_cgroup_dump()
190 if (tcf_exts_dump_stats(skb, &head->exts) < 0) in cls_cgroup_dump()
193 return skb->len; in cls_cgroup_dump()
197 return -1; in cls_cgroup_dump()