1f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf/*
2f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf * net/sched/cls_cgroup.c	Control Group Classifier
3f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf *
4f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf *		This program is free software; you can redistribute it and/or
5f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf *		modify it under the terms of the GNU General Public License
6f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf *		as published by the Free Software Foundation; either version
7f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf *		2 of the License, or (at your option) any later version.
8f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf *
9f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf * Authors:	Thomas Graf <tgraf@suug.ch>
10f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf */
11f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf
12f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf#include <linux/module.h>
135a0e3ad6af8660be21ca98a971cd00f331318c05Tejun Heo#include <linux/slab.h>
14f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf#include <linux/skbuff.h>
15f845172531fb7410c7fb7780b1a6e51ee6df7d52Herbert Xu#include <linux/rcupdate.h>
16f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf#include <net/rtnetlink.h>
17f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf#include <net/pkt_cls.h>
18f845172531fb7410c7fb7780b1a6e51ee6df7d52Herbert Xu#include <net/sock.h>
19f845172531fb7410c7fb7780b1a6e51ee6df7d52Herbert Xu#include <net/cls_cgroup.h>
20f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf
21cc7ec456f82da7f89a5b376e613b3ac4311b3e9aEric Dumazetstruct cls_cgroup_head {
22f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf	u32			handle;
23f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf	struct tcf_exts		exts;
24f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf	struct tcf_ematch_tree	ematches;
25952313bd62589cae216a579bb7ebc76f8e290817John Fastabend	struct tcf_proto	*tp;
26952313bd62589cae216a579bb7ebc76f8e290817John Fastabend	struct rcu_head		rcu;
27f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf};
28f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf
29dc7f9f6e8838556f226c2ebd1da7bb305cb25654Eric Dumazetstatic int cls_cgroup_classify(struct sk_buff *skb, const struct tcf_proto *tp,
30f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf			       struct tcf_result *res)
31f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf{
32952313bd62589cae216a579bb7ebc76f8e290817John Fastabend	struct cls_cgroup_head *head = rcu_dereference_bh(tp->root);
33e65fcfd63a9a62baa5708484ff8edbe56eb3e7ecPaul Menage	u32 classid;
34f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf
35f845172531fb7410c7fb7780b1a6e51ee6df7d52Herbert Xu	classid = task_cls_state(current)->classid;
36f845172531fb7410c7fb7780b1a6e51ee6df7d52Herbert Xu
37f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf	/*
38f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf	 * Due to the nature of the classifier it is required to ignore all
39f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf	 * packets originating from softirq context as accessing `current'
40f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf	 * would lead to false results.
41f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf	 *
42f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf	 * This test assumes that all callers of dev_queue_xmit() explicitely
43f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf	 * disable bh. Knowing this, it is possible to detect softirq based
44f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf	 * calls by looking at the number of nested bh disable calls because
45f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf	 * softirqs always disables bh.
46f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf	 */
4775e1056f5c57050415b64cb761a3acc35d91f013Venkatesh Pallipadi	if (in_serving_softirq()) {
48f845172531fb7410c7fb7780b1a6e51ee6df7d52Herbert Xu		/* If there is an sk_classid we'll use that. */
49f845172531fb7410c7fb7780b1a6e51ee6df7d52Herbert Xu		if (!skb->sk)
50f845172531fb7410c7fb7780b1a6e51ee6df7d52Herbert Xu			return -1;
51f845172531fb7410c7fb7780b1a6e51ee6df7d52Herbert Xu		classid = skb->sk->sk_classid;
52f845172531fb7410c7fb7780b1a6e51ee6df7d52Herbert Xu	}
53f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf
54e65fcfd63a9a62baa5708484ff8edbe56eb3e7ecPaul Menage	if (!classid)
55e65fcfd63a9a62baa5708484ff8edbe56eb3e7ecPaul Menage		return -1;
56e65fcfd63a9a62baa5708484ff8edbe56eb3e7ecPaul Menage
57e65fcfd63a9a62baa5708484ff8edbe56eb3e7ecPaul Menage	if (!tcf_em_tree_match(skb, &head->ematches, NULL))
58e65fcfd63a9a62baa5708484ff8edbe56eb3e7ecPaul Menage		return -1;
59e65fcfd63a9a62baa5708484ff8edbe56eb3e7ecPaul Menage
60e65fcfd63a9a62baa5708484ff8edbe56eb3e7ecPaul Menage	res->classid = classid;
61e65fcfd63a9a62baa5708484ff8edbe56eb3e7ecPaul Menage	res->class = 0;
62e65fcfd63a9a62baa5708484ff8edbe56eb3e7ecPaul Menage	return tcf_exts_exec(skb, &head->exts, res);
63f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf}
64f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf
65f400923735ecbb67cbe4a3606c9479f694754f51Thomas Grafstatic unsigned long cls_cgroup_get(struct tcf_proto *tp, u32 handle)
66f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf{
67f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf	return 0UL;
68f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf}
69f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf
70f400923735ecbb67cbe4a3606c9479f694754f51Thomas Grafstatic void cls_cgroup_put(struct tcf_proto *tp, unsigned long f)
71f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf{
72f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf}
73f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf
74f400923735ecbb67cbe4a3606c9479f694754f51Thomas Grafstatic int cls_cgroup_init(struct tcf_proto *tp)
75f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf{
76f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf	return 0;
77f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf}
78f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf
79f400923735ecbb67cbe4a3606c9479f694754f51Thomas Grafstatic const struct nla_policy cgroup_policy[TCA_CGROUP_MAX + 1] = {
80f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf	[TCA_CGROUP_EMATCHES]	= { .type = NLA_NESTED },
81f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf};
82f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf
83952313bd62589cae216a579bb7ebc76f8e290817John Fastabendstatic void cls_cgroup_destroy_rcu(struct rcu_head *root)
84952313bd62589cae216a579bb7ebc76f8e290817John Fastabend{
85952313bd62589cae216a579bb7ebc76f8e290817John Fastabend	struct cls_cgroup_head *head = container_of(root,
86952313bd62589cae216a579bb7ebc76f8e290817John Fastabend						    struct cls_cgroup_head,
87952313bd62589cae216a579bb7ebc76f8e290817John Fastabend						    rcu);
88952313bd62589cae216a579bb7ebc76f8e290817John Fastabend
8918d0264f630e200772bf236ac5747c47e908501eWANG Cong	tcf_exts_destroy(&head->exts);
9082a470f1119eb7d2e4941b915bf9cd6fd8d54494John Fastabend	tcf_em_tree_destroy(&head->ematches);
91952313bd62589cae216a579bb7ebc76f8e290817John Fastabend	kfree(head);
92952313bd62589cae216a579bb7ebc76f8e290817John Fastabend}
93952313bd62589cae216a579bb7ebc76f8e290817John Fastabend
94c1b52739e45f5969b208ebc377f52468280af11eBenjamin LaHaisestatic int cls_cgroup_change(struct net *net, struct sk_buff *in_skb,
95af4c6641f5ad445fe6d0832da42406dbd9a37ce4Eric W. Biederman			     struct tcf_proto *tp, unsigned long base,
96f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf			     u32 handle, struct nlattr **tca,
972f7ef2f8790f5bf53db4fc6b2310943139285827Cong Wang			     unsigned long *arg, bool ovr)
98f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf{
99cc7ec456f82da7f89a5b376e613b3ac4311b3e9aEric Dumazet	struct nlattr *tb[TCA_CGROUP_MAX + 1];
100952313bd62589cae216a579bb7ebc76f8e290817John Fastabend	struct cls_cgroup_head *head = rtnl_dereference(tp->root);
101952313bd62589cae216a579bb7ebc76f8e290817John Fastabend	struct cls_cgroup_head *new;
102f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf	struct tcf_ematch_tree t;
103f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf	struct tcf_exts e;
104f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf	int err;
105f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf
10652ea3a56a3268bc2a5a7c75e98c81463004e38efMinoru Usui	if (!tca[TCA_OPTIONS])
10752ea3a56a3268bc2a5a7c75e98c81463004e38efMinoru Usui		return -EINVAL;
10852ea3a56a3268bc2a5a7c75e98c81463004e38efMinoru Usui
109952313bd62589cae216a579bb7ebc76f8e290817John Fastabend	if (!head && !handle)
110952313bd62589cae216a579bb7ebc76f8e290817John Fastabend		return -EINVAL;
111f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf
112952313bd62589cae216a579bb7ebc76f8e290817John Fastabend	if (head && handle != head->handle)
113952313bd62589cae216a579bb7ebc76f8e290817John Fastabend		return -ENOENT;
114f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf
115952313bd62589cae216a579bb7ebc76f8e290817John Fastabend	new = kzalloc(sizeof(*head), GFP_KERNEL);
116952313bd62589cae216a579bb7ebc76f8e290817John Fastabend	if (!new)
117952313bd62589cae216a579bb7ebc76f8e290817John Fastabend		return -ENOBUFS;
118f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf
1199f6c38e70b6c7ea379394a755fe76e09996f5370John Fastabend	tcf_exts_init(&new->exts, TCA_CGROUP_ACT, TCA_CGROUP_POLICE);
1209f6c38e70b6c7ea379394a755fe76e09996f5370John Fastabend	if (head)
121952313bd62589cae216a579bb7ebc76f8e290817John Fastabend		new->handle = head->handle;
1229f6c38e70b6c7ea379394a755fe76e09996f5370John Fastabend	else
123952313bd62589cae216a579bb7ebc76f8e290817John Fastabend		new->handle = handle;
124f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf
125952313bd62589cae216a579bb7ebc76f8e290817John Fastabend	new->tp = tp;
126f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf	err = nla_parse_nested(tb, TCA_CGROUP_MAX, tca[TCA_OPTIONS],
127f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf			       cgroup_policy);
128f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf	if (err < 0)
129d14cbfc88ff87e5054d67fde3ba5f4c20b773dabJohn Fastabend		goto errout;
130f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf
1315da57f422d89c504a1d72dadd4e19d3dca8e974eWANG Cong	tcf_exts_init(&e, TCA_CGROUP_ACT, TCA_CGROUP_POLICE);
1322f7ef2f8790f5bf53db4fc6b2310943139285827Cong Wang	err = tcf_exts_validate(net, tp, tb, tca[TCA_RATE], &e, ovr);
133f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf	if (err < 0)
134d14cbfc88ff87e5054d67fde3ba5f4c20b773dabJohn Fastabend		goto errout;
135f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf
136f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf	err = tcf_em_tree_validate(tp, tb[TCA_CGROUP_EMATCHES], &t);
137d14cbfc88ff87e5054d67fde3ba5f4c20b773dabJohn Fastabend	if (err < 0) {
13818d0264f630e200772bf236ac5747c47e908501eWANG Cong		tcf_exts_destroy(&e);
139d14cbfc88ff87e5054d67fde3ba5f4c20b773dabJohn Fastabend		goto errout;
140d14cbfc88ff87e5054d67fde3ba5f4c20b773dabJohn Fastabend	}
141f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf
142952313bd62589cae216a579bb7ebc76f8e290817John Fastabend	tcf_exts_change(tp, &new->exts, &e);
143952313bd62589cae216a579bb7ebc76f8e290817John Fastabend	tcf_em_tree_change(tp, &new->ematches, &t);
144f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf
145952313bd62589cae216a579bb7ebc76f8e290817John Fastabend	rcu_assign_pointer(tp->root, new);
146952313bd62589cae216a579bb7ebc76f8e290817John Fastabend	if (head)
147952313bd62589cae216a579bb7ebc76f8e290817John Fastabend		call_rcu(&head->rcu, cls_cgroup_destroy_rcu);
148f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf	return 0;
149d14cbfc88ff87e5054d67fde3ba5f4c20b773dabJohn Fastabenderrout:
150d14cbfc88ff87e5054d67fde3ba5f4c20b773dabJohn Fastabend	kfree(new);
151d14cbfc88ff87e5054d67fde3ba5f4c20b773dabJohn Fastabend	return err;
152f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf}
153f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf
154f400923735ecbb67cbe4a3606c9479f694754f51Thomas Grafstatic void cls_cgroup_destroy(struct tcf_proto *tp)
155f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf{
156952313bd62589cae216a579bb7ebc76f8e290817John Fastabend	struct cls_cgroup_head *head = rtnl_dereference(tp->root);
157f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf
158f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf	if (head) {
159952313bd62589cae216a579bb7ebc76f8e290817John Fastabend		RCU_INIT_POINTER(tp->root, NULL);
16013990f8156862fe945a1a226850a6550c8988a33John Fastabend		call_rcu(&head->rcu, cls_cgroup_destroy_rcu);
161f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf	}
162f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf}
163f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf
164f400923735ecbb67cbe4a3606c9479f694754f51Thomas Grafstatic int cls_cgroup_delete(struct tcf_proto *tp, unsigned long arg)
165f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf{
166f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf	return -EOPNOTSUPP;
167f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf}
168f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf
169f400923735ecbb67cbe4a3606c9479f694754f51Thomas Grafstatic void cls_cgroup_walk(struct tcf_proto *tp, struct tcf_walker *arg)
170f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf{
171952313bd62589cae216a579bb7ebc76f8e290817John Fastabend	struct cls_cgroup_head *head = rtnl_dereference(tp->root);
172f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf
173f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf	if (arg->count < arg->skip)
174f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf		goto skip;
175f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf
176f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf	if (arg->fn(tp, (unsigned long) head, arg) < 0) {
177f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf		arg->stop = 1;
178f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf		return;
179f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf	}
180f400923735ecbb67cbe4a3606c9479f694754f51Thomas Grafskip:
181f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf	arg->count++;
182f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf}
183f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf
184832d1d5bfaefafa5aa40282f6765c6d996fe384eWANG Congstatic int cls_cgroup_dump(struct net *net, struct tcf_proto *tp, unsigned long fh,
185f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf			   struct sk_buff *skb, struct tcmsg *t)
186f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf{
187952313bd62589cae216a579bb7ebc76f8e290817John Fastabend	struct cls_cgroup_head *head = rtnl_dereference(tp->root);
188f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf	unsigned char *b = skb_tail_pointer(skb);
189f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf	struct nlattr *nest;
190f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf
191f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf	t->tcm_handle = head->handle;
192f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf
193f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf	nest = nla_nest_start(skb, TCA_OPTIONS);
194f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf	if (nest == NULL)
195f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf		goto nla_put_failure;
196f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf
1975da57f422d89c504a1d72dadd4e19d3dca8e974eWANG Cong	if (tcf_exts_dump(skb, &head->exts) < 0 ||
198f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf	    tcf_em_tree_dump(skb, &head->ematches, TCA_CGROUP_EMATCHES) < 0)
199f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf		goto nla_put_failure;
200f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf
201f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf	nla_nest_end(skb, nest);
202f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf
2035da57f422d89c504a1d72dadd4e19d3dca8e974eWANG Cong	if (tcf_exts_dump_stats(skb, &head->exts) < 0)
204f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf		goto nla_put_failure;
205f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf
206f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf	return skb->len;
207f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf
208f400923735ecbb67cbe4a3606c9479f694754f51Thomas Grafnla_put_failure:
209f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf	nlmsg_trim(skb, b);
210f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf	return -1;
211f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf}
212f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf
213f400923735ecbb67cbe4a3606c9479f694754f51Thomas Grafstatic struct tcf_proto_ops cls_cgroup_ops __read_mostly = {
214f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf	.kind		=	"cgroup",
215f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf	.init		=	cls_cgroup_init,
216f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf	.change		=	cls_cgroup_change,
217f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf	.classify	=	cls_cgroup_classify,
218f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf	.destroy	=	cls_cgroup_destroy,
219f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf	.get		=	cls_cgroup_get,
220f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf	.put		=	cls_cgroup_put,
221f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf	.delete		=	cls_cgroup_delete,
222f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf	.walk		=	cls_cgroup_walk,
223f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf	.dump		=	cls_cgroup_dump,
224f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf	.owner		=	THIS_MODULE,
225f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf};
226f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf
227f400923735ecbb67cbe4a3606c9479f694754f51Thomas Grafstatic int __init init_cgroup_cls(void)
228f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf{
229fe1217c4f3f7d7cbf8efdd8dd5fdc7204a1d65a8Daniel Borkmann	return register_tcf_proto_ops(&cls_cgroup_ops);
230f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf}
231f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf
232f400923735ecbb67cbe4a3606c9479f694754f51Thomas Grafstatic void __exit exit_cgroup_cls(void)
233f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf{
234f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf	unregister_tcf_proto_ops(&cls_cgroup_ops);
235f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf}
236f400923735ecbb67cbe4a3606c9479f694754f51Thomas Graf
237f400923735ecbb67cbe4a3606c9479f694754f51Thomas Grafmodule_init(init_cgroup_cls);
238f400923735ecbb67cbe4a3606c9479f694754f51Thomas Grafmodule_exit(exit_cgroup_cls);
239f400923735ecbb67cbe4a3606c9479f694754f51Thomas GrafMODULE_LICENSE("GPL");
240