public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Cc: netdev@vger.kernel.org, bpf@vger.kernel.org,
	magnus.karlsson@intel.com, stfomichev@gmail.com,
	pabeni@redhat.com, horms@kernel.org, larysa.zaremba@intel.com,
	aleksander.lobakin@intel.com, bjorn@kernel.org
Subject: Re: [PATCH v6 net 3/8] xsk: fix XDP_UMEM_SG_FLAG issues
Date: Fri, 3 Apr 2026 16:56:36 -0700	[thread overview]
Message-ID: <20260403165636.1f4ee958@kernel.org> (raw)
In-Reply-To: <20260402154958.562179-4-maciej.fijalkowski@intel.com>

On Thu,  2 Apr 2026 17:49:53 +0200 Maciej Fijalkowski wrote:
> Currently xp_assign_dev_shared() is missing XDP_USE_SG being propagated
> to flags so set it in order to preserve mtu check that is supposed to be
> done only when no multi-buffer setup is in picture.
> 
> Also, this flag has the same value as XDP_UMEM_TX_SW_CSUM so we could
> get unexpected SG setups for software Tx checksums. Since csum flag is
> UAPI, modify value of XDP_UMEM_SG_FLAG.

should we maybe add:

BUILD_BUG_ON(XDP_UMEM_SG_FLAG & XDP_UMEM_FLAGS_VALID)

somewhere or use a hack like this ?

#define XDP_UMEM_SG_FLAG	(XDP_UMEM_FLAGS_VALID + 1)

> diff --git a/include/net/xdp_sock.h b/include/net/xdp_sock.h
> index 23e8861e8b25..ebac60a3d8a1 100644
> --- a/include/net/xdp_sock.h
> +++ b/include/net/xdp_sock.h
> @@ -14,7 +14,7 @@
>  #include <linux/mm.h>
>  #include <net/sock.h>
>  
> -#define XDP_UMEM_SG_FLAG (1 << 1)
> +#define XDP_UMEM_SG_FLAG BIT(3)
>  
>  struct net_device;
>  struct xsk_queue;
> diff --git a/net/xdp/xsk_buff_pool.c b/net/xdp/xsk_buff_pool.c
> index 37b7a68b89b3..729602a3cec0 100644
> --- a/net/xdp/xsk_buff_pool.c
> +++ b/net/xdp/xsk_buff_pool.c
> @@ -247,6 +247,10 @@ int xp_assign_dev_shared(struct xsk_buff_pool *pool, struct xdp_sock *umem_xs,
>  	struct xdp_umem *umem = umem_xs->umem;
>  
>  	flags = umem->zc ? XDP_ZEROCOPY : XDP_COPY;
> +
> +	if (umem->flags & XDP_UMEM_SG_FLAG)
> +		flags |= XDP_USE_SG;
> +
>  	if (umem_xs->pool->uses_need_wakeup)
>  		flags |= XDP_USE_NEED_WAKEUP;
>  


  reply	other threads:[~2026-04-03 23:56 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-02 15:49 [PATCH v6 net 0/8] xsk: tailroom reservation and MTU validation Maciej Fijalkowski
2026-04-02 15:49 ` [PATCH v6 net 1/8] xsk: tighten UMEM headroom validation to account for tailroom and min frame Maciej Fijalkowski
2026-04-04  0:01   ` Jakub Kicinski
2026-04-04 10:07     ` Maciej Fijalkowski
2026-04-02 15:49 ` [PATCH v6 net 2/8] xsk: respect tailroom for ZC setups Maciej Fijalkowski
2026-04-02 15:49 ` [PATCH v6 net 3/8] xsk: fix XDP_UMEM_SG_FLAG issues Maciej Fijalkowski
2026-04-03 23:56   ` Jakub Kicinski [this message]
2026-04-04 10:11     ` Maciej Fijalkowski
2026-04-07  1:45       ` Jakub Kicinski
2026-04-02 15:49 ` [PATCH v6 net 4/8] xsk: validate MTU against usable frame size on bind Maciej Fijalkowski
2026-04-04  0:03   ` Jakub Kicinski
2026-04-04 10:02     ` Maciej Fijalkowski
2026-04-06 18:00       ` Jakub Kicinski
2026-04-02 15:49 ` [PATCH v6 net 5/8] selftests: bpf: introduce a common routine for reading procfs Maciej Fijalkowski
2026-04-02 15:49 ` [PATCH v6 net 6/8] selftests: bpf: fix pkt grow tests Maciej Fijalkowski
2026-04-02 15:49 ` [PATCH v6 net 7/8] selftests: bpf: have a separate variable for drop test Maciej Fijalkowski
2026-04-02 15:49 ` [PATCH v6 net 8/8] selftests: bpf: adjust rx_dropped xskxceiver's test to respect tailroom Maciej Fijalkowski
2026-04-07  1:50 ` [PATCH v6 net 0/8] xsk: tailroom reservation and MTU validation patchwork-bot+netdevbpf

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=20260403165636.1f4ee958@kernel.org \
    --to=kuba@kernel.org \
    --cc=aleksander.lobakin@intel.com \
    --cc=bjorn@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=horms@kernel.org \
    --cc=larysa.zaremba@intel.com \
    --cc=maciej.fijalkowski@intel.com \
    --cc=magnus.karlsson@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=stfomichev@gmail.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