diff options
author | Florian Fainelli <f.fainelli@gmail.com> | 2017-08-01 18:00:36 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-08-02 19:49:09 -0400 |
commit | f613ed665bb3ec49edc4907bd8799e3a2de47df5 (patch) | |
tree | e73ee81053bc0ffcb2880ff901d1bf38febca9e1 /net/dsa/dsa.c | |
parent | b2f9d432deebab5096aad5942c2f2b1ec2865f5a (diff) |
net: dsa: Add support for 64-bit statistics
DSA slave network devices maintain a pair of bytes and packets counters
for each directions, but these are not 64-bit capable. Re-use
pcpu_sw_netstats which contains exactly what we need for that purpose
and update the code path to report 64-bit capable 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.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c index a55e2e4087a4..0ba842c08dd3 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 dsa_slave_priv *p; | ||
193 | 194 | ||
194 | if (unlikely(dst == NULL)) { | 195 | if (unlikely(dst == NULL)) { |
195 | kfree_skb(skb); | 196 | kfree_skb(skb); |
@@ -207,12 +208,15 @@ static int dsa_switch_rcv(struct sk_buff *skb, struct net_device *dev, | |||
207 | } | 208 | } |
208 | 209 | ||
209 | skb = nskb; | 210 | skb = nskb; |
211 | p = netdev_priv(skb->dev); | ||
210 | skb_push(skb, ETH_HLEN); | 212 | skb_push(skb, ETH_HLEN); |
211 | skb->pkt_type = PACKET_HOST; | 213 | skb->pkt_type = PACKET_HOST; |
212 | skb->protocol = eth_type_trans(skb, skb->dev); | 214 | skb->protocol = eth_type_trans(skb, skb->dev); |
213 | 215 | ||
214 | skb->dev->stats.rx_packets++; | 216 | u64_stats_update_begin(&p->stats64.syncp); |
215 | skb->dev->stats.rx_bytes += skb->len; | 217 | p->stats64.rx_packets++; |
218 | p->stats64.rx_bytes += skb->len; | ||
219 | u64_stats_update_end(&p->stats64.syncp); | ||
216 | 220 | ||
217 | netif_receive_skb(skb); | 221 | netif_receive_skb(skb); |
218 | 222 | ||