netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: loopback: clear skb->tstamp before netif_rx()
@ 2018-10-20  2:11 Eric Dumazet
  2018-10-20  2:29 ` Soheil Hassas Yeganeh
  2018-10-20  8:01 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Dumazet @ 2018-10-20  2:11 UTC (permalink / raw)
  To: David S . Miller
  Cc: netdev, Eric Dumazet, Eric Dumazet, Willem de Bruijn,
	Soheil Hassas Yeganeh

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")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Willem de Bruijn <willemb@google.com>
Cc: Soheil Hassas Yeganeh <soheil@google.com>
---
 drivers/net/loopback.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c
index a7207fa7e451311aed13cdeb100e0ea7922931bf..2df7f60fe05220c19896a251b6b15239f4b95112 100644
--- a/drivers/net/loopback.c
+++ b/drivers/net/loopback.c
@@ -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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: loopback: clear skb->tstamp before netif_rx()
  2018-10-20  2:11 [PATCH net-next] net: loopback: clear skb->tstamp before netif_rx() Eric Dumazet
@ 2018-10-20  2:29 ` Soheil Hassas Yeganeh
  2018-10-20  8:01 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Soheil Hassas Yeganeh @ 2018-10-20  2:29 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David Miller, netdev, Eric Dumazet, Willem de Bruijn

On Fri, Oct 19, 2018 at 10:11 PM Eric Dumazet <edumazet@google.com> wrote:
>
> 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")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Willem de Bruijn <willemb@google.com>
> Cc: Soheil Hassas Yeganeh <soheil@google.com>

Acked-by: Soheil Hassas Yeganeh <soheil@google.com>

Thank you, Eric!

> ---
>  drivers/net/loopback.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c
> index a7207fa7e451311aed13cdeb100e0ea7922931bf..2df7f60fe05220c19896a251b6b15239f4b95112 100644
> --- a/drivers/net/loopback.c
> +++ b/drivers/net/loopback.c
> @@ -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
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: loopback: clear skb->tstamp before netif_rx()
  2018-10-20  2:11 [PATCH net-next] net: loopback: clear skb->tstamp before netif_rx() Eric Dumazet
  2018-10-20  2:29 ` Soheil Hassas Yeganeh
@ 2018-10-20  8:01 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2018-10-20  8:01 UTC (permalink / raw)
  To: edumazet; +Cc: netdev, eric.dumazet, willemb, soheil

From: Eric Dumazet <edumazet@google.com>
Date: Fri, 19 Oct 2018 19:11:26 -0700

> 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")
> Signed-off-by: Eric Dumazet <edumazet@google.com>

Applied, thanks Eric.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-10-20 16:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-20  2:11 [PATCH net-next] net: loopback: clear skb->tstamp before netif_rx() Eric Dumazet
2018-10-20  2:29 ` Soheil Hassas Yeganeh
2018-10-20  8:01 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).