netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Joshua Washington <joshwash@google.com>
Cc: netdev@vger.kernel.org, Ankit Garg <nktgrg@google.com>,
	Harshitha Ramamurthy <hramamurthy@google.com>,
	Jordan Rhee <jordanrhee@google.com>,
	Willem de Bruijn <willemb@google.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Jesper Dangaard Brouer <hawk@kernel.org>,
	John Fastabend <john.fastabend@gmail.com>,
	Stanislav Fomichev <sdf@fomichev.me>,
	Praveen Kaligineedi <pkaligineedi@google.com>,
	Ziwei Xiao <ziweixiao@google.com>,
	open list <linux-kernel@vger.kernel.org>,
	"open list:XDP (eXpress Data Path):Keyword:(?:b|_)xdp(?:b|_)"
	<bpf@vger.kernel.org>
Subject: Re: [PATCH net-next 2/3] gve: Allow ethtool to configure rx_buf_len
Date: Thu, 23 Oct 2025 17:14:45 -0700	[thread overview]
Message-ID: <20251023171445.2d470bb3@kernel.org> (raw)
In-Reply-To: <20251022182301.1005777-3-joshwash@google.com>

On Wed, 22 Oct 2025 11:22:24 -0700 Joshua Washington wrote:
> +	if (priv->rx_cfg.packet_buffer_size != SZ_2K) {
> +		netdev_warn(dev,
> +			    "XDP is not supported for Rx buf len %d. Set Rx buf len to %d before using XDP.\n",
> +			    priv->rx_cfg.packet_buffer_size, SZ_2K);
> +		return -EOPNOTSUPP;
> +	}

Please plumb extack thru to here. It's inside struct netdev_bpf

>  	max_xdp_mtu = priv->rx_cfg.packet_buffer_size - sizeof(struct ethhdr);
>  	if (priv->queue_format == GVE_GQI_QPL_FORMAT)
>  		max_xdp_mtu -= GVE_RX_PAD;
> @@ -2050,6 +2057,44 @@ bool gve_header_split_supported(const struct gve_priv *priv)
>  		priv->queue_format == GVE_DQO_RDA_FORMAT && !priv->xdp_prog;
>  }
>  
> +int gve_set_rx_buf_len_config(struct gve_priv *priv, u32 rx_buf_len,
> +			      struct netlink_ext_ack *extack,
> +			      struct gve_rx_alloc_rings_cfg *rx_alloc_cfg)
> +{
> +	u32 old_rx_buf_len = rx_alloc_cfg->packet_buffer_size;
> +
> +	if (rx_buf_len == old_rx_buf_len)
> +		return 0;
> +
> +	if (!gve_is_dqo(priv)) {
> +		NL_SET_ERR_MSG_MOD(extack,
> +				   "Modifying Rx buf len is only supported with DQO format");
> +		return -EOPNOTSUPP;
> +	}
> +
> +	if (priv->xdp_prog && rx_buf_len != SZ_2K) {
> +		NL_SET_ERR_MSG_MOD(extack,
> +				   "Rx buf len can only be 2048 when XDP is on");
> +		return -EINVAL;
> +	}
> +
> +	if (rx_buf_len > priv->max_rx_buffer_size) {

This check looks kinda pointless given the check right below against
the exact sizes?

> +		NL_SET_ERR_MSG_FMT_MOD(extack,
> +				       "Rx buf len exceeds the max supported value of %u",
> +				       priv->max_rx_buffer_size);
> +		return -EINVAL;
> +	}
> +
> +	if (rx_buf_len != SZ_2K && rx_buf_len != SZ_4K) {
> +		NL_SET_ERR_MSG_MOD(extack,
> +				   "Rx buf len can only be 2048 or 4096");
> +		return -EINVAL;
> +	}
> +	rx_alloc_cfg->packet_buffer_size = rx_buf_len;
> +
> +	return 0;
> +}

  reply	other threads:[~2025-10-24  0:14 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-22 18:22 [PATCH net-next 0/3] gve: Improve RX buffer length management Joshua Washington
2025-10-22 18:22 ` [PATCH net-next 1/3] gve: Decouple header split from RX buffer length Joshua Washington
2025-10-22 18:22 ` [PATCH net-next 2/3] gve: Allow ethtool to configure rx_buf_len Joshua Washington
2025-10-24  0:14   ` Jakub Kicinski [this message]
2025-10-24 18:17     ` Ankit Garg
2025-10-24 20:10       ` Jakub Kicinski
2025-10-24 20:14         ` Ankit Garg
2025-11-05 18:31       ` Ankit Garg
2025-10-22 18:22 ` [PATCH net-next 3/3] gve: Default to max_rx_buffer_size for DQO if device supported Joshua Washington
2025-10-24  0:12 ` [PATCH net-next 0/3] gve: Improve RX buffer length management Jakub Kicinski
2025-10-24  2:40   ` Mina Almasry
2025-10-24 17:31     ` Ankit Garg

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=20251023171445.2d470bb3@kernel.org \
    --to=kuba@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hawk@kernel.org \
    --cc=hramamurthy@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=jordanrhee@google.com \
    --cc=joshwash@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nktgrg@google.com \
    --cc=pabeni@redhat.com \
    --cc=pkaligineedi@google.com \
    --cc=sdf@fomichev.me \
    --cc=willemb@google.com \
    --cc=ziweixiao@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;
as well as URLs for NNTP newsgroup(s).