net: hsr: add tx stats for master interface
authorMurali Karicheri <m-karicheri2@ti.com>
Mon, 15 Apr 2019 15:36:03 +0000 (11:36 -0400)
committerDavid S. Miller <davem@davemloft.net>
Tue, 16 Apr 2019 00:22:02 +0000 (17:22 -0700)
Add tx stats to hsr interface. Without this
ifconfig for hsr interface doesn't show tx packet stats.

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/hsr/hsr_forward.c

index 0cac992..ddd9605 100644 (file)
@@ -359,6 +359,13 @@ void hsr_forward_skb(struct sk_buff *skb, struct hsr_port *port)
                goto out_drop;
        hsr_register_frame_in(frame.node_src, port, frame.sequence_nr);
        hsr_forward_do(&frame);
+       /* Gets called for ingress frames as well as egress from master port.
+        * So check and increment stats for master port only here.
+        */
+       if (port->type == HSR_PT_MASTER) {
+               port->dev->stats.tx_packets++;
+               port->dev->stats.tx_bytes += skb->len;
+       }
 
        if (frame.skb_hsr)
                kfree_skb(frame.skb_hsr);