aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCong Wang <xiyou.wangcong@gmail.com>2017-11-29 19:07:51 -0500
committerDavid S. Miller <davem@davemloft.net>2017-11-30 10:19:17 -0500
commit90a6ec85351b31449c2c6b5406b5396ac96f191d (patch)
treec6a01f160b5ca6939d4c2c701273a3b46e859971
parent6c9257a708883bbafa0971eb985cd266d46db0eb (diff)
act_sample: get rid of tcf_sample_cleanup_rcu()
Similar to commit d7fb60b9cafb ("net_sched: get rid of tcfa_rcu"), TC actions don't need to respect RCU grace period, because it is either just detached from tc filter (standalone case) or it is removed together with tc filter (bound case) in which case RCU grace period is already respected at filter layer. Fixes: 5c5670fae430 ("net/sched: Introduce sample tc action") Reported-by: Eric Dumazet <eric.dumazet@gmail.com> Cc: Jamal Hadi Salim <jhs@mojatatu.com> Cc: Jiri Pirko <jiri@resnulli.us> Cc: Yotam Gigi <yotamg@mellanox.com> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Reviewed-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/net/tc_act/tc_sample.h1
-rw-r--r--net/sched/act_sample.c14
2 files changed, 3 insertions, 12 deletions
diff --git a/include/net/tc_act/tc_sample.h b/include/net/tc_act/tc_sample.h
index 524cee4f4c81..01dbfea32672 100644
--- a/include/net/tc_act/tc_sample.h
+++ b/include/net/tc_act/tc_sample.h
@@ -14,7 +14,6 @@ struct tcf_sample {
14 struct psample_group __rcu *psample_group; 14 struct psample_group __rcu *psample_group;
15 u32 psample_group_num; 15 u32 psample_group_num;
16 struct list_head tcfm_list; 16 struct list_head tcfm_list;
17 struct rcu_head rcu;
18}; 17};
19#define to_sample(a) ((struct tcf_sample *)a) 18#define to_sample(a) ((struct tcf_sample *)a)
20 19
diff --git a/net/sched/act_sample.c b/net/sched/act_sample.c
index 8b5abcd2f32f..9438969290a6 100644
--- a/net/sched/act_sample.c
+++ b/net/sched/act_sample.c
@@ -96,23 +96,16 @@ static int tcf_sample_init(struct net *net, struct nlattr *nla,
96 return ret; 96 return ret;
97} 97}
98 98
99static void tcf_sample_cleanup_rcu(struct rcu_head *rcu) 99static void tcf_sample_cleanup(struct tc_action *a, int bind)
100{ 100{
101 struct tcf_sample *s = container_of(rcu, struct tcf_sample, rcu); 101 struct tcf_sample *s = to_sample(a);
102 struct psample_group *psample_group; 102 struct psample_group *psample_group;
103 103
104 psample_group = rcu_dereference_protected(s->psample_group, 1); 104 psample_group = rtnl_dereference(s->psample_group);
105 RCU_INIT_POINTER(s->psample_group, NULL); 105 RCU_INIT_POINTER(s->psample_group, NULL);
106 psample_group_put(psample_group); 106 psample_group_put(psample_group);
107} 107}
108 108
109static void tcf_sample_cleanup(struct tc_action *a, int bind)
110{
111 struct tcf_sample *s = to_sample(a);
112
113 call_rcu(&s->rcu, tcf_sample_cleanup_rcu);
114}
115
116static bool tcf_sample_dev_ok_push(struct net_device *dev) 109static bool tcf_sample_dev_ok_push(struct net_device *dev)
117{ 110{
118 switch (dev->type) { 111 switch (dev->type) {
@@ -264,7 +257,6 @@ static int __init sample_init_module(void)
264 257
265static void __exit sample_cleanup_module(void) 258static void __exit sample_cleanup_module(void)
266{ 259{
267 rcu_barrier();
268 tcf_unregister_action(&act_sample_ops, &sample_net_ops); 260 tcf_unregister_action(&act_sample_ops, &sample_net_ops);
269} 261}
270 262