mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-27 00:51:35 +00:00
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>
This commit is contained in:
parent
b2f9d432de
commit
f613ed665b
3 changed files with 38 additions and 8 deletions
|
@ -190,6 +190,7 @@ static int dsa_switch_rcv(struct sk_buff *skb, struct net_device *dev,
|
|||
{
|
||||
struct dsa_switch_tree *dst = dev->dsa_ptr;
|
||||
struct sk_buff *nskb = NULL;
|
||||
struct dsa_slave_priv *p;
|
||||
|
||||
if (unlikely(dst == NULL)) {
|
||||
kfree_skb(skb);
|
||||
|
@ -207,12 +208,15 @@ static int dsa_switch_rcv(struct sk_buff *skb, struct net_device *dev,
|
|||
}
|
||||
|
||||
skb = nskb;
|
||||
p = netdev_priv(skb->dev);
|
||||
skb_push(skb, ETH_HLEN);
|
||||
skb->pkt_type = PACKET_HOST;
|
||||
skb->protocol = eth_type_trans(skb, skb->dev);
|
||||
|
||||
skb->dev->stats.rx_packets++;
|
||||
skb->dev->stats.rx_bytes += skb->len;
|
||||
u64_stats_update_begin(&p->stats64.syncp);
|
||||
p->stats64.rx_packets++;
|
||||
p->stats64.rx_bytes += skb->len;
|
||||
u64_stats_update_end(&p->stats64.syncp);
|
||||
|
||||
netif_receive_skb(skb);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue