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 <mlich...@redhat.com> 
> 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

Reply via email to