[PATCH net-next v3 1/3] net: rss: Require indir table size or hash key size to support RSS
Nicolai Buchwitz
nb at tipi-net.de
Fri Oct 2 07:59:46 PDT 2026
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 at 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 at tipi-net.de>
Thanks,
Nicolai
More information about the linux-arm-kernel
mailing list