On Mon, Jul 13, 2020 at 05:12:17PM +0300, Vladimir Oltean wrote:
> On Mon, Jul 13, 2020 at 07:01:12AM -0700, Richard Cochran wrote:
> > I don't think it makes sense for DSA drivers to set this bit, as it
> > serves no purpose in the DSA context.
> > 
> 
> For whom does this bit serve a purpose, though, and how do you tell?

It had a historical purpose.  Originally, the stack delivered either a
hardware or a software time stamp, but not both.  This restriction was
eventually lifted via the SOF_TIMESTAMPING_OPT_TX_SWHW option, but
still the original behavior is preserved as the default.

You can see how SKBTX_IN_PROGRESS is used by the skb_tstamp_tx() path
here:

void __skb_tstamp_tx(struct sk_buff *orig_skb,
                     struct skb_shared_hwtstamps *hwtstamps,
                     struct sock *sk, int tstype)
{
        ...

        if (!hwtstamps && !(sk->sk_tsflags & SOF_TIMESTAMPING_OPT_TX_SWHW) &&
            skb_shinfo(orig_skb)->tx_flags & SKBTX_IN_PROGRESS)
                return;
}

It prevents SW time stamp when the flag is set.

Note that DSA drivers deliver TX time stamps via a different path,
namely skb_complete_tx_timestamp().  Also, DSA drivers don't provide
SW time stamping at all.

Q: When should drivers set SKBTX_IN_PROGRESS?

A: When the interface they represent offers both
   SOF_TIMESTAMPING_TX_HARDWARE and SOF_TIMESTAMPING_TX_SOFTWARE.

HTH,
Richard



Reply via email to