Re: [RFC PATCH 04/13] net: implement generic SOF_TIMESTAMPING_TX_* support

Octavian Purdila
2008-11-11T23:19:18Z

From: Patrick Ohly <patrick.ohly@intel.com>
Date: Fri, 24 Oct 2008 15:41:34 +0200

> + if (dev) {
> + skb_hwtstamp_set(skb,
> + dev->hwtstamp_raw2sys ?
> + dev->hwtstamp_raw2sys(dev, stamp) :
> + stamp);
> + } else {
> + skb->tstamp = stamp;
> +#if BITS_PER_LONG != 64 && !defined(CONFIG_KTIME_SCALAR)
> + skb->tstamp.tv.sec = skb->tstamp.tv.sec / 2 * 2;
> +#else
> + skb->tstamp.tv64 = skb->tstamp.tv64 / 2 * 2;
> +#endif
> + }
> +

I think the addition of the following bits will be of use to applications:

serr = SKB_EXT_ERR(skb);
serr->ee.ee_origin = SO_EE_ORIGIN_TXTSTAMP;
serr->ee.ee_mac = skb->mac.raw - skb->data;
serr->ee.ee_network = skb->nh.raw - skb->data;
serr->ee.ee_transport = skb->h.raw - skb->data;

For example, for UDP PTP we don't have to manually skip the ethernet (and take
into account VLANs) and IP headers.

Thanks,
tavi