cls_cgroup.c (ace1fe1231bdfffd60b5e703aa5b7283fbf98dbd) cls_cgroup.c (8a8e04df4747661daaee77e98e102d99c9e09b98)
1/*
2 * net/sched/cls_cgroup.c Control Group Classifier
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 *

--- 63 unchanged lines hidden (view full) ---

72 },
73 { } /* terminate */
74};
75
76struct cgroup_subsys net_cls_subsys = {
77 .name = "net_cls",
78 .create = cgrp_create,
79 .destroy = cgrp_destroy,
1/*
2 * net/sched/cls_cgroup.c Control Group Classifier
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 *

--- 63 unchanged lines hidden (view full) ---

72 },
73 { } /* terminate */
74};
75
76struct cgroup_subsys net_cls_subsys = {
77 .name = "net_cls",
78 .create = cgrp_create,
79 .destroy = cgrp_destroy,
80#ifdef CONFIG_NET_CLS_CGROUP
81 .subsys_id = net_cls_subsys_id,
80 .subsys_id = net_cls_subsys_id,
82#endif
83 .base_cftypes = ss_files,
84 .module = THIS_MODULE,
85};
86
87struct cls_cgroup_head {
88 u32 handle;
89 struct tcf_exts exts;
90 struct tcf_ematch_tree ematches;

--- 55 unchanged lines hidden (view full) ---

146 .action = TCA_CGROUP_ACT,
147 .police = TCA_CGROUP_POLICE,
148};
149
150static const struct nla_policy cgroup_policy[TCA_CGROUP_MAX + 1] = {
151 [TCA_CGROUP_EMATCHES] = { .type = NLA_NESTED },
152};
153
81 .base_cftypes = ss_files,
82 .module = THIS_MODULE,
83};
84
85struct cls_cgroup_head {
86 u32 handle;
87 struct tcf_exts exts;
88 struct tcf_ematch_tree ematches;

--- 55 unchanged lines hidden (view full) ---

144 .action = TCA_CGROUP_ACT,
145 .police = TCA_CGROUP_POLICE,
146};
147
148static const struct nla_policy cgroup_policy[TCA_CGROUP_MAX + 1] = {
149 [TCA_CGROUP_EMATCHES] = { .type = NLA_NESTED },
150};
151
154static int cls_cgroup_change(struct sk_buff *in_skb,
155 struct tcf_proto *tp, unsigned long base,
152static int cls_cgroup_change(struct tcf_proto *tp, unsigned long base,
156 u32 handle, struct nlattr **tca,
157 unsigned long *arg)
158{
159 struct nlattr *tb[TCA_CGROUP_MAX + 1];
160 struct cls_cgroup_head *head = tp->root;
161 struct tcf_ematch_tree t;
162 struct tcf_exts e;
163 int err;

--- 115 unchanged lines hidden (view full) ---

279static int __init init_cgroup_cls(void)
280{
281 int ret;
282
283 ret = cgroup_load_subsys(&net_cls_subsys);
284 if (ret)
285 goto out;
286
153 u32 handle, struct nlattr **tca,
154 unsigned long *arg)
155{
156 struct nlattr *tb[TCA_CGROUP_MAX + 1];
157 struct cls_cgroup_head *head = tp->root;
158 struct tcf_ematch_tree t;
159 struct tcf_exts e;
160 int err;

--- 115 unchanged lines hidden (view full) ---

276static int __init init_cgroup_cls(void)
277{
278 int ret;
279
280 ret = cgroup_load_subsys(&net_cls_subsys);
281 if (ret)
282 goto out;
283
287#ifndef CONFIG_NET_CLS_CGROUP
288 /* We can't use rcu_assign_pointer because this is an int. */
289 smp_wmb();
290 net_cls_subsys_id = net_cls_subsys.subsys_id;
291#endif
292
293 ret = register_tcf_proto_ops(&cls_cgroup_ops);
294 if (ret)
295 cgroup_unload_subsys(&net_cls_subsys);
296
297out:
298 return ret;
299}
300
301static void __exit exit_cgroup_cls(void)
302{
303 unregister_tcf_proto_ops(&cls_cgroup_ops);
304
284 ret = register_tcf_proto_ops(&cls_cgroup_ops);
285 if (ret)
286 cgroup_unload_subsys(&net_cls_subsys);
287
288out:
289 return ret;
290}
291
292static void __exit exit_cgroup_cls(void)
293{
294 unregister_tcf_proto_ops(&cls_cgroup_ops);
295
305#ifndef CONFIG_NET_CLS_CGROUP
306 net_cls_subsys_id = -1;
307 synchronize_rcu();
308#endif
309
310 cgroup_unload_subsys(&net_cls_subsys);
311}
312
313module_init(init_cgroup_cls);
314module_exit(exit_cgroup_cls);
315MODULE_LICENSE("GPL");
296 cgroup_unload_subsys(&net_cls_subsys);
297}
298
299module_init(init_cgroup_cls);
300module_exit(exit_cgroup_cls);
301MODULE_LICENSE("GPL");