public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
To: Willem de Bruijn <willemdebruijn.kernel@gmail.com>,
	 Pavel Begunkov <asml.silence@gmail.com>,
	 io-uring@vger.kernel.org,
	 Vadim Fedorenko <vadim.fedorenko@linux.dev>
Cc: asml.silence@gmail.com,  netdev@vger.kernel.org,
	 Eric Dumazet <edumazet@google.com>,
	 Kuniyuki Iwashima <kuniyu@amazon.com>,
	 Paolo Abeni <pabeni@redhat.com>,
	 Willem de Bruijn <willemb@google.com>,
	 "David S . Miller" <davem@davemloft.net>,
	 Jakub Kicinski <kuba@kernel.org>,
	 Richard Cochran <richardcochran@gmail.com>,
	 Stanislav Fomichev <sdf@fomichev.me>,
	 Jason Xing <kerneljasonxing@gmail.com>
Subject: Re: [PATCH v5 1/5] net: timestamp: add helper returning skb's tx tstamp
Date: Tue, 17 Jun 2025 12:30:53 -0400	[thread overview]
Message-ID: <6851983d94a2d_2e8c1b294bf@willemb.c.googlers.com.notmuch> (raw)
In-Reply-To: <685031d760515_20ce862942c@willemb.c.googlers.com.notmuch>

Willem de Bruijn wrote:
> Pavel Begunkov wrote:
> > Add a helper function skb_get_tx_timestamp() that returns a tx timestamp
> > associated with an error queue skb.
> > 
> > Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
> > ---
> >  include/net/sock.h |  4 ++++
> >  net/socket.c       | 46 ++++++++++++++++++++++++++++++++++++++++++++++
> >  2 files changed, 50 insertions(+)
> > 
> > diff --git a/include/net/sock.h b/include/net/sock.h
> > index 92e7c1aae3cc..f5f5a9ad290b 100644
> > --- a/include/net/sock.h
> > +++ b/include/net/sock.h
> > @@ -2677,6 +2677,10 @@ void __sock_recv_timestamp(struct msghdr *msg, struct sock *sk,
> >  void __sock_recv_wifi_status(struct msghdr *msg, struct sock *sk,
> >  			     struct sk_buff *skb);
> >  
> > +bool skb_has_tx_timestamp(struct sk_buff *skb, const struct sock *sk);
> > +int skb_get_tx_timestamp(struct sk_buff *skb, struct sock *sk,
> > +			 struct timespec64 *ts);
> > +
> >  static inline void
> >  sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb)
> >  {
> > diff --git a/net/socket.c b/net/socket.c
> > index 9a0e720f0859..2cab805943c0 100644
> > --- a/net/socket.c
> > +++ b/net/socket.c
> > @@ -843,6 +843,52 @@ static void put_ts_pktinfo(struct msghdr *msg, struct sk_buff *skb,
> >  		 sizeof(ts_pktinfo), &ts_pktinfo);
> >  }
> >  
> > +bool skb_has_tx_timestamp(struct sk_buff *skb, const struct sock *sk)
> > +{
> 
> I forgot to ask earlier, and not a reason for a respin.
> 
> Is the only reason that skb is not const here skb_hwtstamps?
> 
> I can send a patch to make that container_of_const

Just to follow up.

The container_of_const is not applicable here. As skb_shared_info is
a (cast) pointer, into skb linear.

So even simpler, the skb can be const even if what its member points
to is not. This works fine.

-static inline struct skb_shared_hwtstamps *skb_hwtstamps(struct sk_buff *skb)
+static inline struct skb_shared_hwtstamps *skb_hwtstamps(const struct sk_buff *skb)
 {
        return &skb_shinfo(skb)->hwtstamps;
 }

And same for skb_zcopy, skb_zcopy_init, skb_zcopy_set,
skb_zcopy_set_nouarg, skb_zcopy_is_nouarg, skb_zcopy_get_nouarg,
skb_zcopy_clear, __skb_zcopy_downgrade_managed,
skb_zcopy_downgrade_managed, skb_frag_ref and the ubuf_info_ops
complete and link callbacks.

But that's a lot of churn, especially if including ubuf_info
implementations like io_uring.

Not sure it's worth that.

  parent reply	other threads:[~2025-06-17 16:30 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-16  9:46 [PATCH v5 0/5] io_uring cmd for tx timestamps Pavel Begunkov
2025-06-16  9:46 ` [PATCH v5 1/5] net: timestamp: add helper returning skb's tx tstamp Pavel Begunkov
2025-06-16 14:53   ` Willem de Bruijn
2025-06-16 15:01   ` Willem de Bruijn
2025-06-16 16:37     ` Pavel Begunkov
2025-06-16 16:43       ` Willem de Bruijn
2025-06-17 16:30     ` Willem de Bruijn [this message]
2025-06-18  7:01   ` Jason Xing
2025-06-16  9:46 ` [PATCH v5 2/5] io_uring/poll: introduce io_arm_apoll() Pavel Begunkov
2025-06-16  9:46 ` [PATCH v5 3/5] io_uring/cmd: allow multishot polled commands Pavel Begunkov
2025-06-16  9:46 ` [PATCH v5 4/5] io_uring: add mshot helper for posting CQE32 Pavel Begunkov
2025-06-16  9:46 ` [PATCH v5 5/5] io_uring/netcmd: add tx timestamping cmd support Pavel Begunkov
2025-06-17 14:52 ` [PATCH v5 0/5] io_uring cmd for tx timestamps Jens Axboe
2025-06-17 22:29   ` Jakub Kicinski
2025-06-17 22:33     ` Jens Axboe
2025-06-17 22:41       ` Jakub Kicinski
2025-06-17 22:41         ` Jens Axboe
2025-06-20 14:31         ` Jens Axboe
2025-06-20 16:30           ` Pavel Begunkov
2025-06-20 19:46           ` Jakub Kicinski
2025-06-21  0:45             ` Jens Axboe
2025-06-23 15:00             ` Jens Axboe
2025-06-23 15:01 ` (subset) " Jens Axboe
2025-06-27 17:07   ` Jens Axboe
2025-06-28  6:10     ` Pavel Begunkov
2025-07-08 17:55       ` Jens Axboe
2025-07-08 18:00         ` Pavel Begunkov
2025-07-08 18:00           ` Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6851983d94a2d_2e8c1b294bf@willemb.c.googlers.com.notmuch \
    --to=willemdebruijn.kernel@gmail.com \
    --cc=asml.silence@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=io-uring@vger.kernel.org \
    --cc=kerneljasonxing@gmail.com \
    --cc=kuba@kernel.org \
    --cc=kuniyu@amazon.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=richardcochran@gmail.com \
    --cc=sdf@fomichev.me \
    --cc=vadim.fedorenko@linux.dev \
    --cc=willemb@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox