Commit 1c64f147 authored by Alexander Aring's avatar Alexander Aring Committed by Marcel Holtmann

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: default avatarAlexander Aring <alex.aring@gmail.com>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent 4bc8fbc9
...@@ -29,6 +29,8 @@ ...@@ -29,6 +29,8 @@
static int lowpan_give_skb_to_device(struct sk_buff *skb) static int lowpan_give_skb_to_device(struct sk_buff *skb)
{ {
skb->protocol = htons(ETH_P_IPV6); skb->protocol = htons(ETH_P_IPV6);
skb->dev->stats.rx_packets++;
skb->dev->stats.rx_bytes += skb->len;
return netif_rx(skb); return netif_rx(skb);
} }
......
...@@ -192,6 +192,8 @@ lowpan_xmit_fragmented(struct sk_buff *skb, struct net_device *ldev, ...@@ -192,6 +192,8 @@ lowpan_xmit_fragmented(struct sk_buff *skb, struct net_device *ldev,
} }
} while (skb_unprocessed > frag_cap); } while (skb_unprocessed > frag_cap);
ldev->stats.tx_packets++;
ldev->stats.tx_bytes += dgram_size;
consume_skb(skb); consume_skb(skb);
return NET_XMIT_SUCCESS; return NET_XMIT_SUCCESS;
...@@ -277,6 +279,8 @@ netdev_tx_t lowpan_xmit(struct sk_buff *skb, struct net_device *ldev) ...@@ -277,6 +279,8 @@ netdev_tx_t lowpan_xmit(struct sk_buff *skb, struct net_device *ldev)
if (skb_tail_pointer(skb) - skb_network_header(skb) <= max_single) { if (skb_tail_pointer(skb) - skb_network_header(skb) <= max_single) {
skb->dev = lowpan_dev_info(ldev)->wdev; skb->dev = lowpan_dev_info(ldev)->wdev;
ldev->stats.tx_packets++;
ldev->stats.tx_bytes += dgram_size;
return dev_queue_xmit(skb); return dev_queue_xmit(skb);
} else { } else {
netdev_tx_t rc; netdev_tx_t rc;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment