diff options
author | David S. Miller <davem@davemloft.net> | 2010-04-07 02:53:30 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-04-07 02:53:30 -0400 |
commit | 4a35ecf8bf1c4b039503fa554100fe85c761de76 (patch) | |
tree | 9b75f5d5636004d9a9aa496924377379be09aa1f /net/sched | |
parent | b4d562e3c3553ac58c7120555c4e4aefbb090a2a (diff) | |
parent | fb9e2d887243499b8d28efcf80821c4f6a092395 (diff) |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts:
drivers/net/bonding/bond_main.c
drivers/net/via-velocity.c
drivers/net/wireless/iwlwifi/iwl-agn.c
Diffstat (limited to 'net/sched')
-rw-r--r-- | net/sched/Kconfig | 5 | ||||
-rw-r--r-- | net/sched/cls_cgroup.c | 36 |
2 files changed, 31 insertions, 10 deletions
diff --git a/net/sched/Kconfig b/net/sched/Kconfig index 21f9c7678aa3..2f691fb180d1 100644 --- a/net/sched/Kconfig +++ b/net/sched/Kconfig | |||
@@ -328,13 +328,16 @@ config NET_CLS_FLOW | |||
328 | module will be called cls_flow. | 328 | module will be called cls_flow. |
329 | 329 | ||
330 | config NET_CLS_CGROUP | 330 | config NET_CLS_CGROUP |
331 | bool "Control Group Classifier" | 331 | tristate "Control Group Classifier" |
332 | select NET_CLS | 332 | select NET_CLS |
333 | depends on CGROUPS | 333 | depends on CGROUPS |
334 | ---help--- | 334 | ---help--- |
335 | Say Y here if you want to classify packets based on the control | 335 | Say Y here if you want to classify packets based on the control |
336 | cgroup of their process. | 336 | cgroup of their process. |
337 | 337 | ||
338 | To compile this code as a module, choose M here: the | ||
339 | module will be called cls_cgroup. | ||
340 | |||
338 | config NET_EMATCH | 341 | config NET_EMATCH |
339 | bool "Extended Matches" | 342 | bool "Extended Matches" |
340 | select NET_CLS | 343 | select NET_CLS |
diff --git a/net/sched/cls_cgroup.c b/net/sched/cls_cgroup.c index e4877ca6727c..7f27d2c15e08 100644 --- a/net/sched/cls_cgroup.c +++ b/net/sched/cls_cgroup.c | |||
@@ -24,6 +24,25 @@ struct cgroup_cls_state | |||
24 | u32 classid; | 24 | u32 classid; |
25 | }; | 25 | }; |
26 | 26 | ||
27 | static struct cgroup_subsys_state *cgrp_create(struct cgroup_subsys *ss, | ||
28 | struct cgroup *cgrp); | ||
29 | static void cgrp_destroy(struct cgroup_subsys *ss, struct cgroup *cgrp); | ||
30 | static int cgrp_populate(struct cgroup_subsys *ss, struct cgroup *cgrp); | ||
31 | |||
32 | struct cgroup_subsys net_cls_subsys = { | ||
33 | .name = "net_cls", | ||
34 | .create = cgrp_create, | ||
35 | .destroy = cgrp_destroy, | ||
36 | .populate = cgrp_populate, | ||
37 | #ifdef CONFIG_NET_CLS_CGROUP | ||
38 | .subsys_id = net_cls_subsys_id, | ||
39 | #else | ||
40 | #define net_cls_subsys_id net_cls_subsys.subsys_id | ||
41 | #endif | ||
42 | .module = THIS_MODULE, | ||
43 | }; | ||
44 | |||
45 | |||
27 | static inline struct cgroup_cls_state *cgrp_cls_state(struct cgroup *cgrp) | 46 | static inline struct cgroup_cls_state *cgrp_cls_state(struct cgroup *cgrp) |
28 | { | 47 | { |
29 | return container_of(cgroup_subsys_state(cgrp, net_cls_subsys_id), | 48 | return container_of(cgroup_subsys_state(cgrp, net_cls_subsys_id), |
@@ -79,14 +98,6 @@ static int cgrp_populate(struct cgroup_subsys *ss, struct cgroup *cgrp) | |||
79 | return cgroup_add_files(cgrp, ss, ss_files, ARRAY_SIZE(ss_files)); | 98 | return cgroup_add_files(cgrp, ss, ss_files, ARRAY_SIZE(ss_files)); |
80 | } | 99 | } |
81 | 100 | ||
82 | struct cgroup_subsys net_cls_subsys = { | ||
83 | .name = "net_cls", | ||
84 | .create = cgrp_create, | ||
85 | .destroy = cgrp_destroy, | ||
86 | .populate = cgrp_populate, | ||
87 | .subsys_id = net_cls_subsys_id, | ||
88 | }; | ||
89 | |||
90 | struct cls_cgroup_head | 101 | struct cls_cgroup_head |
91 | { | 102 | { |
92 | u32 handle; | 103 | u32 handle; |
@@ -277,12 +288,19 @@ static struct tcf_proto_ops cls_cgroup_ops __read_mostly = { | |||
277 | 288 | ||
278 | static int __init init_cgroup_cls(void) | 289 | static int __init init_cgroup_cls(void) |
279 | { | 290 | { |
280 | return register_tcf_proto_ops(&cls_cgroup_ops); | 291 | int ret = register_tcf_proto_ops(&cls_cgroup_ops); |
292 | if (ret) | ||
293 | return ret; | ||
294 | ret = cgroup_load_subsys(&net_cls_subsys); | ||
295 | if (ret) | ||
296 | unregister_tcf_proto_ops(&cls_cgroup_ops); | ||
297 | return ret; | ||
281 | } | 298 | } |
282 | 299 | ||
283 | static void __exit exit_cgroup_cls(void) | 300 | static void __exit exit_cgroup_cls(void) |
284 | { | 301 | { |
285 | unregister_tcf_proto_ops(&cls_cgroup_ops); | 302 | unregister_tcf_proto_ops(&cls_cgroup_ops); |
303 | cgroup_unload_subsys(&net_cls_subsys); | ||
286 | } | 304 | } |
287 | 305 | ||
288 | module_init(init_cgroup_cls); | 306 | module_init(init_cgroup_cls); |