From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Dumazet Subject: Re: [PATCH v2 net-next 01/14] net: Clear skb->tstamp only on the forwarding path Date: Fri, 13 Jul 2018 10:35:15 -0700 Message-ID: <1e52c128-59f4-43ae-3487-059a84ae61c3@gmail.com> References: <20180703224300.25300-1-jesus.sanchez-palencia@intel.com> <20180703224300.25300-2-jesus.sanchez-palencia@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: tglx@linutronix.de, jan.altenberg@linutronix.de, vinicius.gomes@intel.com, kurt.kanzenbach@linutronix.de, henrik@austad.us, richardcochran@gmail.com, ilias.apalodimas@linaro.org, ivan.khoronzhuk@linaro.org, mlichvar@redhat.com, willemb@google.com, jhs@mojatatu.com, xiyou.wangcong@gmail.com, jiri@resnulli.us, eric.dumazet@gmail.com, jeffrey.t.kirsher@intel.com To: Jesus Sanchez-Palencia , netdev@vger.kernel.org Return-path: Received: from mail-pf0-f195.google.com ([209.85.192.195]:46483 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729963AbeGMRuw (ORCPT ); Fri, 13 Jul 2018 13:50:52 -0400 Received: by mail-pf0-f195.google.com with SMTP id l123-v6so23002518pfl.13 for ; Fri, 13 Jul 2018 10:35:17 -0700 (PDT) In-Reply-To: <20180703224300.25300-2-jesus.sanchez-palencia@intel.com> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 07/03/2018 03:42 PM, Jesus Sanchez-Palencia wrote: > This is done in preparation for the upcoming time based transmission > patchset. Now that skb->tstamp will be used to hold packet's txtime, > we must ensure that it is being cleared when traversing namespaces. > Also, doing that from skb_scrub_packet() before the early return would > break our feature when tunnels are used. > > Signed-off-by: Jesus Sanchez-Palencia > --- > net/core/skbuff.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/net/core/skbuff.c b/net/core/skbuff.c > index 1357f36c8a5e..c4e24ac27464 100644 > --- a/net/core/skbuff.c > +++ b/net/core/skbuff.c > @@ -4898,7 +4898,6 @@ EXPORT_SYMBOL(skb_try_coalesce); > */ > void skb_scrub_packet(struct sk_buff *skb, bool xnet) > { > - skb->tstamp = 0; > skb->pkt_type = PACKET_HOST; > skb->skb_iif = 0; > skb->ignore_df = 0; > @@ -4912,6 +4911,7 @@ void skb_scrub_packet(struct sk_buff *skb, bool xnet) > > ipvs_reset(skb); > skb->mark = 0; > + skb->tstamp = 0; > } > EXPORT_SYMBOL_GPL(skb_scrub_packet); > > I believe we had some misunderstanding here. What I meant by forwarding is the following case : - We receive a packet. - netstamp_wanted is >0 (because at least one packet capture is active) - __net_timestamp() is called and does : skb->tstamp = ktime_get_real(); Then this skb is forwarded into an interface where EDT is taken into consideration by either a qdisc or a device. Since CLOCK_TAI is a different base than CLOCK_REALTIME, we might have a problem. Solutions for this problem : 1) Convert all our skb->tstamp usages to CLOCK_TAI base. or 2) clear skb->tstamp in forwarding paths, including the ones not scrubbing the packet. My preference is 1), even if it is a bit more work.