netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michal Kubiak <michal.kubiak@intel.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: <davem@davemloft.net>, <netdev@vger.kernel.org>,
	<edumazet@google.com>, <pabeni@redhat.com>,
	<andrew+netdev@lunn.ch>, <horms@kernel.org>, <sdf@fomichev.me>
Subject: Re: [PATCH net-next] netdevsim: 'support' multi-buf XDP
Date: Tue, 11 Mar 2025 11:51:31 +0100	[thread overview]
Message-ID: <Z9AVs2laMDqYPp6S@localhost.localdomain> (raw)
In-Reply-To: <20250311092820.542148-1-kuba@kernel.org>

On Tue, Mar 11, 2025 at 10:28:20AM +0100, Jakub Kicinski wrote:
> Don't error out on large MTU if XDP is multi-buf.
> The ping test now tests ping with XDP and high MTU.
> netdevsim doesn't actually run the prog (yet?) so
> it doesn't matter if the prog was multi-buf..
> 
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
>  drivers/net/netdevsim/bpf.c    | 3 ++-
>  drivers/net/netdevsim/netdev.c | 3 ++-
>  2 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/netdevsim/bpf.c b/drivers/net/netdevsim/bpf.c
> index 608953d4f98d..49537d3c4120 100644
> --- a/drivers/net/netdevsim/bpf.c
> +++ b/drivers/net/netdevsim/bpf.c
> @@ -296,7 +296,8 @@ static int nsim_setup_prog_checks(struct netdevsim *ns, struct netdev_bpf *bpf)
>  		NSIM_EA(bpf->extack, "attempt to load offloaded prog to drv");
>  		return -EINVAL;
>  	}
> -	if (ns->netdev->mtu > NSIM_XDP_MAX_MTU) {
> +	if (bpf->prog && !bpf->prog->aux->xdp_has_frags &&
> +	    ns->netdev->mtu > NSIM_XDP_MAX_MTU) {
>  		NSIM_EA(bpf->extack, "MTU too large w/ XDP enabled");

Would it make sense to extend this error message to indicate that single-buf
XDP is being used? For example: "MTU too large w/ single-buf XDP enabled"?
(Please consider this as a suggestion only.)

>  		return -EINVAL;
>  	}
> diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c
> index d71fd2907cc8..a5e5e064927d 100644
> --- a/drivers/net/netdevsim/netdev.c
> +++ b/drivers/net/netdevsim/netdev.c
> @@ -116,7 +116,8 @@ static int nsim_change_mtu(struct net_device *dev, int new_mtu)
>  {
>  	struct netdevsim *ns = netdev_priv(dev);
>  
> -	if (ns->xdp.prog && new_mtu > NSIM_XDP_MAX_MTU)
> +	if (ns->xdp.prog && !ns->xdp.prog->aux->xdp_has_frags &&
> +	    new_mtu > NSIM_XDP_MAX_MTU)
>  		return -EBUSY;
>  
>  	WRITE_ONCE(dev->mtu, new_mtu);
> -- 
> 2.48.1
> 
> 

Thanks,
Reviewed-by: Michal Kubiak <michal.kubiak@intel.com>


  reply	other threads:[~2025-03-11 10:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-11  9:28 [PATCH net-next] netdevsim: 'support' multi-buf XDP Jakub Kicinski
2025-03-11 10:51 ` Michal Kubiak [this message]
2025-03-12 20:42   ` Jakub Kicinski
2025-03-12 20:50 ` 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=Z9AVs2laMDqYPp6S@localhost.localdomain \
    --to=michal.kubiak@intel.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sdf@fomichev.me \
    /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;
as well as URLs for NNTP newsgroup(s).