[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAL+tcoD4Y2XEZfSk2KNu_MXo-T4gRxBwveLqFc=mNV7utyDQaQ@mail.gmail.com>
Date: Fri, 21 Feb 2025 14:12:23 +0800
From: Jason Xing <kerneljasonxing@...il.com>
To: Willem de Bruijn <willemdebruijn.kernel@...il.com>
Cc: netdev@...r.kernel.org, davem@...emloft.net, kuba@...nel.org,
edumazet@...gle.com, pabeni@...hat.com, pav@....fi,
gerhard@...leder-embedded.com, vinicius.gomes@...el.com,
anthony.l.nguyen@...el.com, Willem de Bruijn <willemb@...gle.com>
Subject: Re: [PATCH net-next] net: skb: free up one bit in tx_flags
On Fri, Feb 21, 2025 at 11:59 AM Willem de Bruijn
<willemdebruijn.kernel@...il.com> wrote:
>
> From: Willem de Bruijn <willemb@...gle.com>
>
> The linked series wants to add skb tx completion timestamps.
> That needs a bit in skb_shared_info.tx_flags, but all are in use.
>
> A per-skb bit is only needed for features that are configured on a
> per packet basis. Per socket features can be read from sk->sk_tsflags.
>
> Per packet tsflags can be set in sendmsg using cmsg, but only those in
> SOF_TIMESTAMPING_TX_RECORD_MASK.
>
> Per packet tsflags can also be set without cmsg by sandwiching a
> send inbetween two setsockopts:
>
> val |= SOF_TIMESTAMPING_$FEATURE;
> setsockopt(fd, SOL_SOCKET, SO_TIMESTAMPING, &val, sizeof(val));
> write(fd, buf, sz);
> val &= ~SOF_TIMESTAMPING_$FEATURE;
> setsockopt(fd, SOL_SOCKET, SO_TIMESTAMPING, &val, sizeof(val));
>
> Changing a datapath test from skb_shinfo(skb)->tx_flags to
> skb->sk->sk_tsflags can change behavior in that case, as the tx_flags
> is written before the second setsockopt updates sk_tsflags.
>
> Therefore, only bits can be reclaimed that cannot be set by cmsg and
> are also highly unlikely to be used to target individual packets
> otherwise.
Agreed.
>
> Free up the bit currently used for SKBTX_HW_TSTAMP_USE_CYCLES. This
> selects between clock and free running counter source for HW TX
> timestamps. It is probable that all packets of the same socket will
> always use the same source.
>
> Link: https://lore.kernel.org/netdev/cover.1739988644.git.pav@iki.fi/
> Signed-off-by: Willem de Bruijn <willemb@...gle.com>
Reviewed-by: Jason Xing <kerneljasonxing@...il.com>
Thanks, Willem!
Powered by blists - more mailing lists