Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 69ea2c2b authored by Ajay Agarwal's avatar Ajay Agarwal
Browse files

net: usbnet: Update net_device stats on tx and rx success



Currently the driver does not update usbnet->net_device->stats
tx and rx success case statistics in tx_complete and
usbnet_skb_return. As a result, the net drivers having their own
definiton for ndo_get_stats are not able to update success case
stats leading to incomplete info in ifconfig command output.
Fix this by also updating usbnet->net_device->stats on tx and rx
success.

Change-Id: I881343644c92d5031300edfa7340a503ab4cbf55
Signed-off-by: default avatarAjay Agarwal <ajaya@codeaurora.org>
parent cf276499
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -329,7 +329,9 @@ void usbnet_skb_return (struct usbnet *dev, struct sk_buff *skb)

	flags = u64_stats_update_begin_irqsave(&stats64->syncp);
	stats64->rx_packets++;
	dev->net->stats.rx_packets++;
	stats64->rx_bytes += skb->len;
	dev->net->stats.rx_bytes += skb->len;
	u64_stats_update_end_irqrestore(&stats64->syncp, flags);

	netif_dbg(dev, rx_status, dev->net, "< rx, len %zu, type 0x%x\n",
@@ -1255,7 +1257,9 @@ static void tx_complete (struct urb *urb)

		flags = u64_stats_update_begin_irqsave(&stats64->syncp);
		stats64->tx_packets += entry->packets;
		dev->net->stats.tx_packets += entry->packets;
		stats64->tx_bytes += entry->length;
		dev->net->stats.tx_bytes += entry->length;
		u64_stats_update_end_irqrestore(&stats64->syncp, flags);
	} else {
		dev->net->stats.tx_errors++;