From mboxrd@z Thu Jan 1 00:00:00 1970 From: Miroslav Lichvar Subject: Re: [RFC PATCH 3/7] net: add option to get information about timestamped packets Date: Thu, 13 Apr 2017 17:18:06 +0200 Message-ID: <20170413151806.GA26613@localhost> References: <20170412141737.5881-1-mlichvar@redhat.com> <20170412141737.5881-4-mlichvar@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Network Development , Richard Cochran , Willem de Bruijn , Soheil Hassas Yeganeh , "Keller, Jacob E" , Denny Page , Jiri Benc To: Willem de Bruijn Return-path: Received: from mx1.redhat.com ([209.132.183.28]:35068 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751666AbdDMPSJ (ORCPT ); Thu, 13 Apr 2017 11:18:09 -0400 Content-Disposition: inline In-Reply-To: Sender: netdev-owner@vger.kernel.org List-ID: On Thu, Apr 13, 2017 at 10:37:07AM -0400, Willem de Bruijn wrote: > On Wed, Apr 12, 2017 at 10:17 AM, Miroslav Lichvar wrote: > > Extend the skb_shared_hwtstamps structure with the index of the > > real interface which received or transmitted the packet and the length > > of the packet at layer 2. > > The original packet is received along with the timestamp. But only outgoing packets, right? > Why is this L2 length needed? It's needed for incoming packets to allow converting of preamble timestamps to trailer timestamps. > > Add a SOF_TIMESTAMPING_OPT_PKTINFO flag to > > the SO_TIMESTAMPING option to allow applications to get this information > > as struct scm_ts_pktinfo in SCM_TIMESTAMPING_PKTINFO control message. > > This patch saves skb->dev->ifindex, which is the same as existing > SOF_TIMESTAMPING_OPT_CMSG. See also the bug fix for that > feature I sent yesterday: http://patchwork.ozlabs.org/patch/750197/ The main point is that it provides the index of the device which received the packet. It does duplicate the functionality of OPT_CMSG + IP_PKTINFO for outgoing packets, but I thought it might be useful with the TSONLY option. BTW, the original ifindex used to be in skb->skb_iif, but that changed in b6858177. > If the intent is to return a different ifindex, I would still suggest using > the existing pktinfo infrastructure, but changing the ifindex that is > recorded. How would the application get the l2 length? If this (l2 length, if_index) tuple is specific to timestamping, I think it would make sense to keep it out of the IP layer. -- Miroslav Lichvar