All of lore.kernel.org
 help / color / mirror / Atom feed
From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
To: "Björn Töpel" <bjorn@kernel.org>
Cc: <netdev@vger.kernel.org>, <bpf@vger.kernel.org>,
	<magnus.karlsson@intel.com>, <stfomichev@gmail.com>,
	<kuba@kernel.org>, <pabeni@redhat.com>, <horms@kernel.org>,
	<larysa.zaremba@intel.com>, <aleksander.lobakin@intel.com>
Subject: Re: [PATCH v2 net 5/8] xsk: validate MTU against usable frame size on bind
Date: Sat, 21 Mar 2026 13:21:32 +0100	[thread overview]
Message-ID: <ab6NTLRYG4LgqQn6@boxer> (raw)
In-Reply-To: <ab1s9J5yGxCbqB28@boxer>

On Fri, Mar 20, 2026 at 04:51:16PM +0100, Maciej Fijalkowski wrote:
> On Fri, Mar 20, 2026 at 09:38:00AM +0100, Björn Töpel wrote:
> > Maciej Fijalkowski <maciej.fijalkowski@intel.com> writes:
> > 

[...]

> > > diff --git a/net/xdp/xsk_buff_pool.c b/net/xdp/xsk_buff_pool.c
> > > index 37b7a68b89b3..e9377b05118b 100644
> > > --- a/net/xdp/xsk_buff_pool.c
> > > +++ b/net/xdp/xsk_buff_pool.c
> > > @@ -157,6 +157,7 @@ static void xp_disable_drv_zc(struct xsk_buff_pool *pool)
> > >  int xp_assign_dev(struct xsk_buff_pool *pool,
> > >  		  struct net_device *netdev, u16 queue_id, u16 flags)
> > >  {
> > > +	bool mbuf = flags & XDP_USE_SG;
> > >  	bool force_zc, force_copy;
> > >  	struct netdev_bpf bpf;
> > >  	int err = 0;
> > > @@ -178,7 +179,7 @@ int xp_assign_dev(struct xsk_buff_pool *pool,
> > >  	if (err)
> > >  		return err;
> > >  
> > > -	if (flags & XDP_USE_SG)
> > > +	if (mbuf)
> > >  		pool->umem->flags |= XDP_UMEM_SG_FLAG;
> > >  
> > >  	if (flags & XDP_USE_NEED_WAKEUP)
> > > @@ -200,10 +201,18 @@ int xp_assign_dev(struct xsk_buff_pool *pool,
> > >  		goto err_unreg_pool;
> > >  	}
> > >  
> > > -	if (netdev->xdp_zc_max_segs == 1 && (flags & XDP_USE_SG)) {
> > > +	if (netdev->xdp_zc_max_segs == 1 && mbuf) {
> > >  		err = -EOPNOTSUPP;
> > >  		goto err_unreg_pool;
> > >  	}
> > > +#define ETH_PAD_LEN (ETH_HLEN + 2 * VLAN_HLEN  + ETH_FCS_LEN)
> > 
> > Yuk! Move this somewhere else.

Forgot to respond here. I'm gonna just place it at the top of the file but
to properly address this we could introduce a common define for this
calculation, since we define it already three times, at least from intel
source code PoV + i assume i could easily dig up more open-coded examples:

drivers/net/ethernet/intel/ice/ice_txrx.h:73
#define ICE_ETH_PKT_HDR_PAD	(ETH_HLEN + ETH_FCS_LEN + (VLAN_HLEN * 2))

drivers/net/ethernet/intel/i40e/i40e_txrx.h:115
#define I40E_PACKET_HDR_PAD (ETH_HLEN + ETH_FCS_LEN + (VLAN_HLEN * 2))

include/net/libeth/rx.h:21
#define LIBETH_RX_LL_LEN	(ETH_HLEN + 2 * VLAN_HLEN + ETH_FCS_LEN)

But such refactor is obviously a -next material.

[...]

  reply	other threads:[~2026-03-21 12:21 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-19 17:55 [PATCH v2 net 0/8] xsk: tailroom reservation and MTU validation Maciej Fijalkowski
2026-03-19 17:55 ` [PATCH v2 net 1/8] xsk: tighten UMEM headroom validation to account for tailroom and min frame Maciej Fijalkowski
2026-03-20  8:13   ` Björn Töpel
2026-03-20 15:01   ` Stanislav Fomichev
2026-03-19 17:55 ` [PATCH v2 net 2/8] xsk: respect tailroom for ZC setups Maciej Fijalkowski
2026-03-20  8:14   ` Björn Töpel
2026-03-20 15:01   ` Stanislav Fomichev
2026-03-19 17:55 ` [PATCH v2 net 3/8] ice: do not round up result of dbuf calculation for xsk pool Maciej Fijalkowski
2026-03-20  8:18   ` Björn Töpel
2026-03-20 15:57     ` Maciej Fijalkowski
2026-03-19 17:55 ` [PATCH v2 net 4/8] i40e: do not round up result of dbuff " Maciej Fijalkowski
2026-03-19 17:55 ` [PATCH v2 net 5/8] xsk: validate MTU against usable frame size on bind Maciej Fijalkowski
2026-03-20  8:38   ` Björn Töpel
2026-03-20 15:51     ` Maciej Fijalkowski
2026-03-21 12:21       ` Maciej Fijalkowski [this message]
2026-03-19 17:55 ` [PATCH v2 net 6/8] selftests: bpf: fix pkt grow tests Maciej Fijalkowski
2026-03-20  8:40   ` Björn Töpel
2026-03-19 17:55 ` [PATCH v2 net 7/8] selftests: bpf: have a separate variable for drop test Maciej Fijalkowski
2026-03-20  8:41   ` Björn Töpel
2026-03-19 17:55 ` [PATCH v2 net 8/8] selftests: bpf: adjust rx_dropped xskxceiver's test to respect tailroom Maciej Fijalkowski
2026-03-20  8:42   ` Björn Töpel

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=ab6NTLRYG4LgqQn6@boxer \
    --to=maciej.fijalkowski@intel.com \
    --cc=aleksander.lobakin@intel.com \
    --cc=bjorn@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=larysa.zaremba@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 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.