Skip to contentSkip to conversation

net: loopback: clear skb->tstamp before netif_rx()

PATCH Applied Eric Dumazet 3 participants 3 messages Oct 20, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: loopback: clear skb->tstamp before netif_rx()

At least UDP / TCP stacks can now cook skbs with a tstamp using MONOTONIC base (or arbitrary values with SCM_TXTIME)

Since loopback driver does not call (directly or indirectly) skb_scrub_packet(), we need to clear skb->tstamp so that net_timestamp_check() can eventually resample the time, using ktime_get_real().

Fixes 80b14dee2bea ("net: Add a new socket option for a future transmit time.")
Fixes fb420d5d91c1 ("tcp/fq: move back to CLOCK_MONOTONIC")
Cc Willem de Bruijn <[email protected]>
Cc Soheil Hassas Yeganeh <[email protected]>
---
 drivers/net/loopback.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/net/loopback.c +4 -0
index a7207fa7e451311aed13cdeb100e0ea7922931bf..2df7f60fe05220c19896a251b6b15239f4b95112 100644
@@ -69,6 +69,10 @@ static netdev_tx_t loopback_xmit(struct sk_buff *skb,
 	int len;
 
 	skb_tx_timestamp(skb);
+
+	/* do not fool net_timestamp_check() with various clock bases */
+	skb->tstamp = 0;
+
 	skb_orphan(skb);
 
 	/* Before queueing this packet to netif_rx(),
Signature · 1 line
2.19.1.568.g152ad8e336-goog
Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · Eric Dumazet

At least UDP / TCP stacks can now cook skbs with a tstamp using MONOTONIC base (or arbitrary values with SCM_TXTIME)

Since loopback driver does not call (directly or indirectly) skb_scrub_packet(), we need to clear skb->tstamp so that net_timestamp_check() can eventually resample the time, using ktime_get_real().

Quoted 5 lines
Fixes 80b14dee2bea ("net: Add a new socket option for a future transmit time.")
Fixes fb420d5d91c1 ("tcp/fq: move back to CLOCK_MONOTONIC")
Cc Willem de Bruijn <[email protected]>
Cc Soheil Hassas Yeganeh <[email protected]>

Thank you, Eric!

Quoted 22 lines
---
 drivers/net/loopback.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/net/loopback.c +4 -1
index a7207fa7e451311aed13cdeb100e0ea7922931bf..2df7f60fe05220c19896a251b6b15239f4b95112 100644
@@ -69,6 +69,10 @@ static netdev_tx_t loopback_xmit(struct sk_buff *skb,
        int len;
 
        skb_tx_timestamp(skb);
+
+       /* do not fool net_timestamp_check() with various clock bases */
+       skb->tstamp = 0;
+
        skb_orphan(skb);
 
        /* Before queueing this packet to netif_rx(),
--

2.19.1.568.g152ad8e336-goog

maintainer Applied
#2 lore raw
In reply to Eric Dumazet

From: Eric Dumazet <[email protected]>
Date: Fri, 19 Oct 2018 19:11:26 -0700

Quoted 11 lines

At least UDP / TCP stacks can now cook skbs with a tstamp using MONOTONIC base (or arbitrary values with SCM_TXTIME)

Since loopback driver does not call (directly or indirectly) skb_scrub_packet(), we need to clear skb->tstamp so that net_timestamp_check() can eventually resample the time, using ktime_get_real().

Fixes 80b14dee2bea ("net: Add a new socket option for a future transmit time.")
Fixes fb420d5d91c1 ("tcp/fq: move back to CLOCK_MONOTONIC")

Applied, thanks Eric.