On Sat, Jan 25, 2025 at 8:41 AM Martin KaFai Lau <martin.lau@xxxxxxxxx> wrote: > > On 1/20/25 5:28 PM, Jason Xing wrote: > > Support SCM_TSTAMP_SND case. Then we will get the software > > timestamp when the driver is about to send the skb. Later, I > > will support the hardware timestamp. > > > > Signed-off-by: Jason Xing <kerneljasonxing@xxxxxxxxx> > > --- > > include/linux/skbuff.h | 2 +- > > include/uapi/linux/bpf.h | 5 +++++ > > net/core/skbuff.c | 10 ++++++++-- > > tools/include/uapi/linux/bpf.h | 5 +++++ > > 4 files changed, 19 insertions(+), 3 deletions(-) > > > > diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h > > index 35c2e864dd4b..de8d3bd311f5 100644 > > --- a/include/linux/skbuff.h > > +++ b/include/linux/skbuff.h > > @@ -4569,7 +4569,7 @@ void skb_tstamp_tx(struct sk_buff *orig_skb, > > static inline void skb_tx_timestamp(struct sk_buff *skb) > > { > > skb_clone_tx_timestamp(skb); > > - if (skb_shinfo(skb)->tx_flags & SKBTX_SW_TSTAMP) > > + if (skb_shinfo(skb)->tx_flags & (SKBTX_SW_TSTAMP | SKBTX_BPF)) > > __skb_tstamp_tx(skb, NULL, NULL, skb->sk, true, SCM_TSTAMP_SND); > > } > > > > diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h > > index 72f93c6e45c1..a6d761f07f67 100644 > > --- a/include/uapi/linux/bpf.h > > +++ b/include/uapi/linux/bpf.h > > @@ -7027,6 +7027,11 @@ enum { > > * feature is on. It indicates the > > * recorded timestamp. > > */ > > + BPF_SOCK_OPS_TS_SW_OPT_CB, /* Called when skb is about to send > > + * to the nic when SO_TIMESTAMPING > > Same comment on the "SO_TIMESTAMPING". Got it. Thanks. Thanks, Jason