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

Commit 95a753d7 authored by Vamsi Krishna's avatar Vamsi Krishna Committed by Sivasri Kumar Vanka
Browse files

usb: gadget: ether: Add counters for tx packets



This counter represents number of packets recevied from n/w stack
and will help debug packet drop issues. Also count actual
data transferred instead of length.

Change-Id: I6bbd3b4759cde075d48228d40052de00e20796c4
Signed-off-by: default avatarVamsi Krishna <vskrishn@codeaurora.org>
Signed-off-by: default avatarSivasri Kumar Vanka <sivasri@codeaurora.org>
parent 5cad37fb
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -103,6 +103,7 @@ struct eth_dev {
	u8			dev_mac[ETH_ALEN];
	unsigned long		tx_throttle;
	unsigned long		rx_throttle;
	unsigned int		tx_pkts_rcvd;
	struct dentry		*uether_dent;
	struct dentry		*uether_dfile;
};
@@ -599,9 +600,9 @@ static void tx_complete(struct usb_ep *ep, struct usb_request *req)
		break;
	case 0:
		if (!req->zero)
			dev->net->stats.tx_bytes += req->length-1;
			dev->net->stats.tx_bytes += req->actual-1;
		else
			dev->net->stats.tx_bytes += req->length;
			dev->net->stats.tx_bytes += req->actual;


	}
@@ -782,6 +783,7 @@ static netdev_tx_t eth_start_xmit(struct sk_buff *skb,
		/* ignores USB_CDC_PACKET_TYPE_DIRECTED */
	}

	dev->tx_pkts_rcvd++;
	/*
	 * no buffer copies needed, unless the network stack did it
	 * or the hardware can't use skb buffers.
@@ -1715,6 +1717,7 @@ static int uether_stat_show(struct seq_file *s, void *unused)

	if (dev) {
		seq_printf(s, "tx_throttle = %lu\n", dev->tx_throttle);
		seq_printf(s, "tx_pkts_rcvd=%u\n", dev->tx_pkts_rcvd);
		seq_printf(s, "rx_throttle = %lu\n", dev->rx_throttle);
	}
	return ret;