Commit e0496cbb authored by Manish Kurup's avatar Manish Kurup Committed by David S. Miller

act_vlan: Change stats update to use per-core stats

The VLAN action maintains one set of stats across all cores, and uses a
spinlock to synchronize updates to it from the same. Changed this to use a
per-CPU stats context instead.
This change will result in better performance.
Acked-by: default avatarJamal Hadi Salim <jhs@mojatatu.com>
Acked-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarManish Kurup <manish.kurup@verizon.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent cbad52e9
...@@ -30,9 +30,10 @@ static int tcf_vlan(struct sk_buff *skb, const struct tc_action *a, ...@@ -30,9 +30,10 @@ static int tcf_vlan(struct sk_buff *skb, const struct tc_action *a,
int err; int err;
u16 tci; u16 tci;
spin_lock(&v->tcf_lock);
tcf_lastuse_update(&v->tcf_tm); tcf_lastuse_update(&v->tcf_tm);
bstats_update(&v->tcf_bstats, skb); bstats_cpu_update(this_cpu_ptr(v->common.cpu_bstats), skb);
spin_lock(&v->tcf_lock);
action = v->tcf_action; action = v->tcf_action;
/* Ensure 'data' points at mac_header prior calling vlan manipulating /* Ensure 'data' points at mac_header prior calling vlan manipulating
...@@ -85,7 +86,8 @@ static int tcf_vlan(struct sk_buff *skb, const struct tc_action *a, ...@@ -85,7 +86,8 @@ static int tcf_vlan(struct sk_buff *skb, const struct tc_action *a,
drop: drop:
action = TC_ACT_SHOT; action = TC_ACT_SHOT;
v->tcf_qstats.drops++; qstats_drop_inc(this_cpu_ptr(v->common.cpu_qstats));
unlock: unlock:
if (skb_at_tc_ingress(skb)) if (skb_at_tc_ingress(skb))
skb_pull_rcsum(skb, skb->mac_len); skb_pull_rcsum(skb, skb->mac_len);
...@@ -172,7 +174,7 @@ static int tcf_vlan_init(struct net *net, struct nlattr *nla, ...@@ -172,7 +174,7 @@ static int tcf_vlan_init(struct net *net, struct nlattr *nla,
if (!exists) { if (!exists) {
ret = tcf_idr_create(tn, parm->index, est, a, ret = tcf_idr_create(tn, parm->index, est, a,
&act_vlan_ops, bind, false); &act_vlan_ops, bind, true);
if (ret) if (ret)
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment