From mboxrd@z Thu Jan 1 00:00:00 1970 From: Willem de Bruijn Subject: Re: [PATCH v1 net-next 03/14] net: ipv4: Hook into time based transmission Date: Thu, 28 Jun 2018 10:26:24 -0400 Message-ID: References: <20180627215950.6719-1-jesus.sanchez-palencia@intel.com> <20180627215950.6719-4-jesus.sanchez-palencia@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Cc: Network Development , Thomas Gleixner , jan.altenberg@linutronix.de, Vinicius Gomes , kurt.kanzenbach@linutronix.de, Henrik Austad , Richard Cochran , Levi Pearson , ilias.apalodimas@linaro.org, ivan.khoronzhuk@linaro.org, Miroslav Lichvar , Willem de Bruijn , Jamal Hadi Salim , Cong Wang , =?UTF-8?B?SmnFmcOtIFDDrXJrbw==?= , Richard Cochran To: Jesus Sanchez-Palencia Return-path: Received: from mail-it0-f67.google.com ([209.85.214.67]:35867 "EHLO mail-it0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965966AbeF1O1A (ORCPT ); Thu, 28 Jun 2018 10:27:00 -0400 Received: by mail-it0-f67.google.com with SMTP id j135-v6so12827408itj.1 for ; Thu, 28 Jun 2018 07:27:00 -0700 (PDT) In-Reply-To: <20180627215950.6719-4-jesus.sanchez-palencia@intel.com> Sender: netdev-owner@vger.kernel.org List-ID: On Wed, Jun 27, 2018 at 6:07 PM Jesus Sanchez-Palencia wrote: > > Add a transmit_time field to struct inet_cork, then copy the > timestamp from the CMSG cookie at ip_setup_cork() so we can > safely copy it into the skb later during __ip_make_skb(). > > For the raw fast path, just perform the copy at raw_send_hdrinc(). > > Signed-off-by: Richard Cochran > Signed-off-by: Jesus Sanchez-Palencia > --- > include/net/inet_sock.h | 1 + > net/ipv4/ip_output.c | 3 +++ > net/ipv4/raw.c | 2 ++ > net/ipv4/udp.c | 1 + Also support the feature for ipv6 > 4 files changed, 7 insertions(+) > > diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h > index 83d5b3c2ac42..314be484c696 100644 > --- a/include/net/inet_sock.h > +++ b/include/net/inet_sock.h > @@ -148,6 +148,7 @@ struct inet_cork { > __s16 tos; > char priority; > __u16 gso_size; > + u64 transmit_time; > }; > > struct inet_cork_full { > diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c > index b3308e9d9762..904a54a090e9 100644 > --- a/net/ipv4/ip_output.c > +++ b/net/ipv4/ip_output.c > @@ -1153,6 +1153,7 @@ static int ip_setup_cork(struct sock *sk, struct inet_cork *cork, > cork->tos = ipc->tos; > cork->priority = ipc->priority; > cork->tx_flags = ipc->tx_flags; > + cork->transmit_time = ipc->sockc.transmit_time; Initialize ipc->sockc.transmit_time in all possible paths to avoid bugs like the one fixed in commit 9887cba19978 ("ip: limit use of gso_size to udp"). > return 0; > } > @@ -1413,6 +1414,7 @@ struct sk_buff *__ip_make_skb(struct sock *sk, > > skb->priority = (cork->tos != -1) ? cork->priority: sk->sk_priority; > skb->mark = sk->sk_mark; > + skb->tstamp = cork->transmit_time; > /* > * Steal rt from cork.dst to avoid a pair of atomic_inc/atomic_dec > * on dst refcount > @@ -1495,6 +1497,7 @@ struct sk_buff *ip_make_skb(struct sock *sk, > cork->flags = 0; > cork->addr = 0; > cork->opt = NULL; > + cork->transmit_time = 0; Not needed when unconditionally overwriting the field in ip_setup_cork. > err = ip_setup_cork(sk, cork, ipc, rtp); > if (err) > return ERR_PTR(err);