act_sample: get rid of tcf_sample_cleanup_rcu()

Similar to commit d7fb60b9ca ("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: 5c5670fae4 ("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>
This commit is contained in:
Cong Wang 2017-11-29 16:07:51 -08:00 committed by David S. Miller
parent 6c9257a708
commit 90a6ec8535
2 changed files with 4 additions and 13 deletions

View File

@ -14,7 +14,6 @@ struct tcf_sample {
struct psample_group __rcu *psample_group; struct psample_group __rcu *psample_group;
u32 psample_group_num; u32 psample_group_num;
struct list_head tcfm_list; struct list_head tcfm_list;
struct rcu_head rcu;
}; };
#define to_sample(a) ((struct tcf_sample *)a) #define to_sample(a) ((struct tcf_sample *)a)

View File

@ -96,21 +96,14 @@ static int tcf_sample_init(struct net *net, struct nlattr *nla,
return ret; return ret;
} }
static void tcf_sample_cleanup_rcu(struct rcu_head *rcu)
{
struct tcf_sample *s = container_of(rcu, struct tcf_sample, rcu);
struct psample_group *psample_group;
psample_group = rcu_dereference_protected(s->psample_group, 1);
RCU_INIT_POINTER(s->psample_group, NULL);
psample_group_put(psample_group);
}
static void tcf_sample_cleanup(struct tc_action *a, int bind) static void tcf_sample_cleanup(struct tc_action *a, int bind)
{ {
struct tcf_sample *s = to_sample(a); struct tcf_sample *s = to_sample(a);
struct psample_group *psample_group;
call_rcu(&s->rcu, tcf_sample_cleanup_rcu); psample_group = rtnl_dereference(s->psample_group);
RCU_INIT_POINTER(s->psample_group, NULL);
psample_group_put(psample_group);
} }
static bool tcf_sample_dev_ok_push(struct net_device *dev) static bool tcf_sample_dev_ok_push(struct net_device *dev)
@ -264,7 +257,6 @@ static int __init sample_init_module(void)
static void __exit sample_cleanup_module(void) static void __exit sample_cleanup_module(void)
{ {
rcu_barrier();
tcf_unregister_action(&act_sample_ops, &sample_net_ops); tcf_unregister_action(&act_sample_ops, &sample_net_ops);
} }