Commit 1c64f147d3cc9bbafe091a7b335ea3ec700186f0

Authored by Alexander Aring
Committed by Marcel Holtmann
1 parent 4bc8fbc95e

ieee802154: 6lowpan: add tx/rx stats

This patch adds support for increment transmit and receive stats. The
meaning of these stats are IPv6 based, which shows the stats after
running the 6lowpan adaptation layer (uncompression/compression,
fragmentation handling) on receive and before the adaptation layer
when transmit.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>

Showing 2 changed files with 6 additions and 0 deletions Side-by-side Diff

net/ieee802154/6lowpan/rx.c
... ... @@ -29,6 +29,8 @@
29 29 static int lowpan_give_skb_to_device(struct sk_buff *skb)
30 30 {
31 31 skb->protocol = htons(ETH_P_IPV6);
  32 + skb->dev->stats.rx_packets++;
  33 + skb->dev->stats.rx_bytes += skb->len;
32 34  
33 35 return netif_rx(skb);
34 36 }
net/ieee802154/6lowpan/tx.c
... ... @@ -192,6 +192,8 @@
192 192 }
193 193 } while (skb_unprocessed > frag_cap);
194 194  
  195 + ldev->stats.tx_packets++;
  196 + ldev->stats.tx_bytes += dgram_size;
195 197 consume_skb(skb);
196 198 return NET_XMIT_SUCCESS;
197 199  
... ... @@ -277,6 +279,8 @@
277 279  
278 280 if (skb_tail_pointer(skb) - skb_network_header(skb) <= max_single) {
279 281 skb->dev = lowpan_dev_info(ldev)->wdev;
  282 + ldev->stats.tx_packets++;
  283 + ldev->stats.tx_bytes += dgram_size;
280 284 return dev_queue_xmit(skb);
281 285 } else {
282 286 netdev_tx_t rc;