From: Jakub Kicinski <kuba@kernel.org>
To: Jesper Dangaard Brouer <hawk@kernel.org>
Cc: Alexander Lobakin <aleksander.lobakin@intel.com>,
netdev@vger.kernel.org, bpf@vger.kernel.org, ast@kernel.org,
daniel@iogearbox.net, lorenzo@kernel.org, toke@redhat.com,
john.fastabend@gmail.com, sdf@fomichev.me,
michael.chan@broadcom.com, anthony.l.nguyen@intel.com,
przemyslaw.kitszel@intel.com, marcin.s.wojtas@gmail.com,
tariqt@nvidia.com, mbloch@nvidia.com, eperezma@redhat.com
Subject: Re: [RFC] xdp: pass flags to xdp_update_skb_shared_info() directly
Date: Wed, 13 Aug 2025 14:44:39 -0700 [thread overview]
Message-ID: <20250813144439.71a09e9a@kernel.org> (raw)
In-Reply-To: <2ba29c9f-a44f-4be6-bd3a-eb9cdb34ac8a@kernel.org>
On Wed, 13 Aug 2025 10:43:21 +0200 Jesper Dangaard Brouer wrote:
> >> Does anyone prefer the current form of the API, or can we change
> >> as prosposed?
>
> I like the proposed change.
> The only thing that confuses me was that the u32 flags is named
> "skb_flags" and not "xdp_flags".
>
> @@ -314,7 +313,7 @@
> static inline void
> xdp_update_skb_shared_info(struct sk_buff *skb, u8 nr_frags,
> unsigned int size, unsigned int truesize,
> - bool pfmemalloc)
> + u32 skb_flags)
It was matching the helper names: xdp_buff_get_skb_flags()
If we rename it to xdp_flags here do you want me to keep
the helpers (xdp_buff_get_flags()?) or access buf->flags
directly in the caller?
The idea was that the helper could filter / transform
the flags to whatever the update function takes. And the skb_
in the helper name was matching the skb_ of the arg.
> >> Bonus question: while Im messing with this API could I rename
> >> xdp_update_skb_shared_info()? Maybe to xdp_update_skb_state() ?
> >> Not sure why the function name has "shared_info" when most of
> >> what it updates is skb fields.
> >
> > I can only suspect that the author decided to name it this way due to
> > that it's only used when xdp_buff has frags (and frags are in shinfo).
> > But I agree it's not the best choice. xdp_update_skb_state() sounds fine
> > to me, but given that it's all about frags, maybe something like
> > xdp_update_skb_frags_info/state() or so?
>
> Yes, function is only used when skb_shared_info have already been touched.
>
> Performance wise it can be expensive to touch the cache-line for
> skb_shared_info, so the code carefully checks xdp_buff_has_frags() (flag
> XDP_FLAGS_HAS_FRAGS) before deref of skb_shared_info memory area.
>
> Calling it xdp_update_skb_state() seems misleading. As Olek says, this
> is about updating the "skb_frags". The original intent is that
> xdp_buff/xdp_frame is using same skb_shared_info area as SKB, and when
> transitioning to a "full" SKB then we need to do some adjustments.
> (Looking at function code, it is of-cause confusing that it doesn't
> touch sinfo->frags[] array, but that is because we don't need to, as
> non-linear XDP and SKB have same layout.).
Let's go with xdp_update_skb_frags_info(), then.
next prev parent reply other threads:[~2025-08-13 21:44 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-12 16:15 [RFC] xdp: pass flags to xdp_update_skb_shared_info() directly Jakub Kicinski
2025-08-12 16:17 ` Jakub Kicinski
2025-08-12 16:48 ` Alexander Lobakin
2025-08-13 8:43 ` Jesper Dangaard Brouer
2025-08-13 21:44 ` Jakub Kicinski [this message]
2025-08-14 8:11 ` Jesper Dangaard Brouer
2025-08-13 7:25 ` Lorenzo Bianconi
2025-08-13 11:06 ` Toke Høiland-Jørgensen
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=20250813144439.71a09e9a@kernel.org \
--to=kuba@kernel.org \
--cc=aleksander.lobakin@intel.com \
--cc=anthony.l.nguyen@intel.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eperezma@redhat.com \
--cc=hawk@kernel.org \
--cc=john.fastabend@gmail.com \
--cc=lorenzo@kernel.org \
--cc=marcin.s.wojtas@gmail.com \
--cc=mbloch@nvidia.com \
--cc=michael.chan@broadcom.com \
--cc=netdev@vger.kernel.org \
--cc=przemyslaw.kitszel@intel.com \
--cc=sdf@fomichev.me \
--cc=tariqt@nvidia.com \
--cc=toke@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.