summaryrefslogtreecommitdiffstats
path: root/net/dsa/dsa.c
diff options
context:
space:
mode:
authorFlorian Fainelli <f.fainelli@gmail.com>2017-08-04 00:33:27 -0400
committerDavid S. Miller <davem@davemloft.net>2017-08-07 00:26:47 -0400
commit5f6b4e14cada6ddc662b80cbd670d9cd2922aea1 (patch)
tree8694ce445c626e020d81a460916a71169f383c6f /net/dsa/dsa.c
parenteaf6dc03388d5ea7b4151cf55cfc3370c2f9884c (diff)
net: dsa: User per-cpu 64-bit statistics
During testing with a background iperf pushing 1Gbit/sec worth of traffic and having both ifconfig and ethtool collect statistics, we could see quite frequent deadlocks. Convert the often accessed DSA slave network devices statistics to per-cpu 64-bit statistics to remove these deadlocks and provide fast efficient statistics updates. Fixes: f613ed665bb3 ("net: dsa: Add support for 64-bit statistics") Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dsa/dsa.c')
-rw-r--r--net/dsa/dsa.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index 0ba842c08dd3..a91e520e735f 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -190,6 +190,7 @@ static int dsa_switch_rcv(struct sk_buff *skb, struct net_device *dev,
190{ 190{
191 struct dsa_switch_tree *dst = dev->dsa_ptr; 191 struct dsa_switch_tree *dst = dev->dsa_ptr;
192 struct sk_buff *nskb = NULL; 192 struct sk_buff *nskb = NULL;
193 struct pcpu_sw_netstats *s;
193 struct dsa_slave_priv *p; 194 struct dsa_slave_priv *p;
194 195
195 if (unlikely(dst == NULL)) { 196 if (unlikely(dst == NULL)) {
@@ -213,10 +214,11 @@ static int dsa_switch_rcv(struct sk_buff *skb, struct net_device *dev,
213 skb->pkt_type = PACKET_HOST; 214 skb->pkt_type = PACKET_HOST;
214 skb->protocol = eth_type_trans(skb, skb->dev); 215 skb->protocol = eth_type_trans(skb, skb->dev);
215 216
216 u64_stats_update_begin(&p->stats64.syncp); 217 s = this_cpu_ptr(p->stats64);
217 p->stats64.rx_packets++; 218 u64_stats_update_begin(&s->syncp);
218 p->stats64.rx_bytes += skb->len; 219 s->rx_packets++;
219 u64_stats_update_end(&p->stats64.syncp); 220 s->rx_bytes += skb->len;
221 u64_stats_update_end(&s->syncp);
220 222
221 netif_receive_skb(skb); 223 netif_receive_skb(skb);
222 224