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

Commit e9b3eb61 authored by Sai Krishna Juturi's avatar Sai Krishna Juturi Committed by Sriharsha Allenki
Browse files

usb: gadget: u_ether: Changes to enable skb timestamping



Timestamp is recorded for the exit of a packet,
and just after the driver delivers the packet to
network stack. This feature is disabled by default.

To enable timestamping use this command:
echo 1 > /sys/module/g_android/parameters/skb_timestamp_enable

Change-Id: I1022fd3021699d07460054984bf95f2bbef9f29d
Signed-off-by: default avatarSriharsha Allenki <sallenki@codeaurora.org>
Signed-off-by: default avatarSai Krishna Juturi <jsaikrishna@codeaurora.org>
parent 1a7276f0
Loading
Loading
Loading
Loading
+19 −1
Original line number Diff line number Diff line
@@ -71,6 +71,11 @@ module_param(min_cpu_freq, uint, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(min_cpu_freq,
	"to set minimum cpu frquency to when ethernet ifc is active");

static unsigned int skb_timestamp_enable;
module_param(skb_timestamp_enable, uint, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(skb_timestamp_enable,
	"to enable timestamping for TX and RX packets");

/* this refers to max number sgs per transfer
 * which includes headers/data packets
 */
@@ -677,6 +682,8 @@ static void process_rx_w(struct work_struct *work)
		dev->net->stats.rx_packets++;
		dev->net->stats.rx_bytes += skb->len;

		if (skb_timestamp_enable)
			skb->tstamp = ktime_get();
		status = netif_rx_ni(skb);
	}
	set_wake_up_idle(false);
@@ -1064,13 +1071,14 @@ static netdev_tx_t eth_start_xmit(struct sk_buff *skb,
	int			extra_alloc = 0;
	int			retval;
	struct usb_request	*req = NULL;
	struct sk_buff		*new_skb;
	struct sk_buff		*new_skb, *clone = NULL;
	unsigned long		flags;
	struct usb_ep		*in = NULL;
	u16			cdc_filter = 0;
	bool			multi_pkt_xfer = false;
	u32			fixed_in_len;
	bool			is_fixed;
	struct skb_shared_hwtstamps hwtstamps;

	spin_lock_irqsave(&dev->lock, flags);
	if (dev->port_usb) {
@@ -1284,6 +1292,16 @@ static netdev_tx_t eth_start_xmit(struct sk_buff *skb,
		req->no_interrupt = 0;
	}

	if (skb_timestamp_enable) {
		skb->tstamp = ktime_get();
		clone = skb_clone_sk(skb);
		if (clone) {
			memset(&hwtstamps, 0,
					sizeof(struct skb_shared_hwtstamps));
			skb_complete_tx_timestamp(clone, &hwtstamps);
		}
	}

	retval = usb_ep_queue(in, req, GFP_ATOMIC);
	switch (retval) {
	default: