mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nicolai Buchwitz <nb@tipi-net.de>
To: Maxime Chevallier <maxime.chevallier@bootlin.com>
Cc: "Andrew Lunn" <andrew+netdev@lunn.ch>,
	"Jakub Kicinski" <kuba@kernel.org>,
	davem@davemloft.net, "Eric Dumazet" <edumazet@google.com>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"Simon Horman" <horms@kernel.org>,
	"Maxime Coquelin" <mcoquelin.stm32@gmail.com>,
	"Alexandre Torgue" <alexandre.torgue@foss.st.com>,
	"Russell King" <linux@armlinux.org.uk>,
	"Lorenzo Bianconi" <lorenzo.bianconi@oss.qualcomm.com>,
	"Jitendra Vegiraju" <jitendra.vegiraju@broadcom.com>,
	thomas.petazzoni@bootlin.com,
	"Alexis Lothoré" <alexis.lothore@bootlin.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-stm32@st-md-mailman.stormreply.com,
	"Peter Robinson" <pbrobinson@gmail.com>,
	"Joe Damato" <joe@dama.to>
Subject: Re: [PATCH net-next v3 1/3] net: rss: Require indir table size or hash key size to support RSS
Date: Fri, 02 Oct 2026 16:59:46 +0200	[thread overview]
Message-ID: <da1589545fdaf4f3c7ed3b0059366bcf@tipi-net.de> (raw)
In-Reply-To: <20261002142806.1299041-2-maxime.chevallier@bootlin.com>

Hi Maxime

On 2.10.2026 16:28, Maxime Chevallier wrote:
> A point can be made that devices that report a 0-size indirection table
> and 0-length key size don't really support RSS. Let's return 
> -EOPNOTSUPP
> in that case, and skip these devices during DUMP requests.
> 
> This however also reports -ENOTSUPP for devices that only supports flow
> hash fields ops now.

nit: -EOPNOTSUPP

> 
> Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
> ---
>  net/ethtool/ioctl.c | 6 ++++++
>  net/ethtool/rss.c   | 7 +++++--
>  2 files changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/net/ethtool/ioctl.c b/net/ethtool/ioctl.c
> index 27b0e2e275dc..d32b403c8d3a 100644
> --- a/net/ethtool/ioctl.c
> +++ b/net/ethtool/ioctl.c
> @@ -1444,6 +1444,9 @@ static noinline_for_stack int 
> ethtool_get_rxfh(struct net_device *dev,
>  	if (ops->get_rxfh_key_size)
>  		rxfh_dev.key_size = ops->get_rxfh_key_size(dev);
> 
> +	if (!rxfh_dev.indir_size && !rxfh_dev.key_size)
> +		return -EOPNOTSUPP;
> +
>  	if (copy_from_user(&rxfh, useraddr, sizeof(rxfh)))
>  		return -EFAULT;
>  	user_indir_size = rxfh.indir_size;
> @@ -1554,6 +1557,9 @@ static noinline_for_stack int 
> ethtool_set_rxfh(struct net_device *dev,
>  	if (ops->get_rxfh_key_size)
>  		dev_key_size = ops->get_rxfh_key_size(dev);
> 
> +	if (!dev_indir_size && !dev_key_size)
> +		return -EOPNOTSUPP;
> +
>  	if (copy_from_user(&rxfh, useraddr, sizeof(rxfh)))
>  		return -EFAULT;
> 
> diff --git a/net/ethtool/rss.c b/net/ethtool/rss.c
> index d4a1a4724b67..cb9bead0cedd 100644
> --- a/net/ethtool/rss.c
> +++ b/net/ethtool/rss.c
> @@ -129,6 +129,9 @@ rss_get_data_alloc(struct net_device *dev, struct 
> rss_reply_data *data)
>  	if (ops->get_rxfh_key_size)
>  		data->hkey_size = ops->get_rxfh_key_size(dev);
> 
> +	if (!data->indir_size && !data->hkey_size)
> +		return -EOPNOTSUPP;
> +
>  	indir_bytes = data->indir_size * sizeof(u32);
>  	total_size = indir_bytes + data->hkey_size;
>  	rss_config = kzalloc(total_size, GFP_KERNEL);
> @@ -449,7 +452,7 @@ rss_dump_one_dev(struct sk_buff *skb, struct 
> netlink_callback *cb,
> 
>  	if (!ctx->ctx_idx) {
>  		ret = rss_dump_one_ctx(skb, cb, dev, 0);
> -		if (ret)
> +		if (ret && ret != -EOPNOTSUPP)
>  			return ret;
>  		ctx->ctx_idx++;
>  	}
> @@ -457,7 +460,7 @@ rss_dump_one_dev(struct sk_buff *skb, struct 
> netlink_callback *cb,
>  	for (; xa_find(&dev->ethtool->rss_ctx, &ctx->ctx_idx,
>  		       ULONG_MAX, XA_PRESENT); ctx->ctx_idx++) {
>  		ret = rss_dump_one_ctx(skb, cb, dev, ctx->ctx_idx);
> -		if (ret)
> +		if (ret && ret != -EOPNOTSUPP)
>  			return ret;
>  	}
>  	ctx->ctx_idx = ctx->start_ctx;

Reviewed-by: Nicolai Buchwitz <nb@tipi-net.de>

Thanks,
Nicolai

  reply	other threads:[~2026-10-02 14:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-02 14:28 [PATCH net-next v3 0/3] net: rss: Consider RSS not supported when key and indir sizes are 0 Maxime Chevallier
2026-10-02 14:28 ` [PATCH net-next v3 1/3] net: rss: Require indir table size or hash key size to support RSS Maxime Chevallier
2026-10-02 14:59   ` Nicolai Buchwitz [this message]
2026-10-02 14:28 ` [PATCH net-next v3 2/3] net: stmmac: Introduce a helper to check RSS support Maxime Chevallier
2026-10-02 15:00   ` Nicolai Buchwitz
2026-10-02 14:28 ` [PATCH net-next v3 3/3] net: stmmac: Don't set or get RSS parameters when not supported Maxime Chevallier
2026-10-02 15:00   ` Nicolai Buchwitz

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=da1589545fdaf4f3c7ed3b0059366bcf@tipi-net.de \
    --to=nb@tipi-net.de \
    --cc=alexandre.torgue@foss.st.com \
    --cc=alexis.lothore@bootlin.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=jitendra.vegiraju@broadcom.com \
    --cc=joe@dama.to \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=linux@armlinux.org.uk \
    --cc=lorenzo.bianconi@oss.qualcomm.com \
    --cc=maxime.chevallier@bootlin.com \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pbrobinson@gmail.com \
    --cc=thomas.petazzoni@bootlin.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

all inboxes | Powered by JetHome®