public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: "Björn Töpel" <bjorn@kernel.org>
To: Michael Chan <michael.chan@broadcom.com>,
	Pavan Chebbi <pavan.chebbi@broadcom.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	linux-kselftest@vger.kernel.org
Cc: "Björn Töpel" <bjorn@kernel.org>,
	"Willem de Bruijn" <willemb@google.com>
Subject: [PATCH net-next 0/5] ethtool: Dynamic RSS context indirection table resizing
Date: Tue,  3 Mar 2026 19:15:28 +0100	[thread overview]
Message-ID: <20260303181535.2671734-1-bjorn@kernel.org> (raw)

Hi!

Some NICs (e.g. bnxt) change their RSS indirection table size based on
the queue count, because the hardware table is a shared resource. The
ethtool core locks ctx->indir_size at context creation, so drivers
have to reject channel changes when RSS contexts exist.

This series adds resize helpers and wires them up in bnxt and
netdevsim.

Patch 1 adds three core helpers:
  ethtool_rxfh_indir_can_resize() - read-only validation
  ethtool_rxfh_indir_resize() - fold/unfold a raw table in place
  ethtool_rxfh_contexts_resize_all() - resize all non-default
    contexts (all-or-none), with locking and RSS_NTF notifications

Patch 2 uses them in bnxt_set_channels(), replacing the -EINVAL
rejection. Context 0 is validated first, then non-default contexts are
resized, then context 0 is mutated.

Patch 3 adds RSS context support to netdevsim with dynamic table
sizing (roundup_pow_of_two(channels) * 16), exercising the full resize
path.

Patches 4-5 add tests:
  ethtool-rss.sh - netdevsim-specific bash test
  rss_drv.py - Python test that runs on any device with dynamic
    table sizing (skips otherwise)

Running the tests:

  # netdevsim bash test (requires root, netdevsim module)
  cd tools/testing/selftests/drivers/net/netdevsim
  sudo ./ethtool-rss.sh

  # Python test on netdevsim
  cd tools/testing/selftests/drivers/net/hw
  sudo ./rss_drv.py

  # Python test on real hardware
  sudo NETIF=eth0 ./rss_drv.py

Open items:

 - Pre-existing bug in bnxt: the IFF_RXFH_CONFIGURED guard in
   bnxt_set_channels() only protects context 0. If context 0 uses
   defaults but non-default contexts exist, channel changes that
   change the table size succeed without updating ctx->indir_size for
   those contexts. The core's ethtool_check_max_channel() prevents
   invalid queue references but not the size mismatch itself. This
   series fixes it by resizing all contexts. Should a separate fix be
   sent to net for the existing bug?

 - No user-controlled minimum table size yet. The plan is to record
   the user-provided indirection table length in the context (e.g.
   ctx->user_indir_size) and use it as a floor when folding: reject if
   new_size < user_indir_size. This way the user's original table size
   serves as an implicit minimum, preventing the driver from shrinking
   below what the user intended. Left for a follow-up.

 - rss_drv.py lives in drivers/net/hw/ but runs on netdevsim too now.
   Maybe move up a level?


Björn Töpel (5):
  ethtool: Add RSS indirection table resize helpers
  bnxt_en: Resize RSS contexts on channel count change
  netdevsim: Add RSS context support with dynamic table sizing
  selftests: netdevsim: Add RSS indirection table resize test
  selftests: rss_drv: Add RSS indirection table resize tests

 .../net/ethernet/broadcom/bnxt/bnxt_ethtool.c |  23 +++-
 drivers/net/netdevsim/ethtool.c               | 119 ++++++++++++++++-
 drivers/net/netdevsim/netdevsim.h             |   4 +
 include/linux/ethtool.h                       |   3 +
 net/ethtool/common.c                          | 126 ++++++++++++++++++
 .../selftests/drivers/net/hw/rss_drv.py       | 101 +++++++++++++-
 .../selftests/drivers/net/netdevsim/Makefile  |   1 +
 .../drivers/net/netdevsim/ethtool-rss.sh      | 123 +++++++++++++++++
 8 files changed, 488 insertions(+), 12 deletions(-)
 create mode 100755 tools/testing/selftests/drivers/net/netdevsim/ethtool-rss.sh


base-commit: ed0abfe93fd135dac223e87a3c945017b1fa8bfc
-- 
2.53.0


             reply	other threads:[~2026-03-03 18:15 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-03 18:15 Björn Töpel [this message]
2026-03-03 18:15 ` [PATCH net-next 1/5] ethtool: Add RSS indirection table resize helpers Björn Töpel
2026-03-04  0:03   ` Jakub Kicinski
2026-03-04 11:37     ` Björn Töpel
2026-03-04 17:09       ` Jakub Kicinski
2026-03-03 18:15 ` [PATCH net-next 2/5] bnxt_en: Resize RSS contexts on channel count change Björn Töpel
2026-03-03 19:20   ` Michael Chan
2026-03-04 11:38     ` Björn Töpel
2026-03-04  0:05   ` Jakub Kicinski
2026-03-04 11:39     ` Björn Töpel
2026-03-03 18:15 ` [PATCH net-next 3/5] netdevsim: Add RSS context support with dynamic table sizing Björn Töpel
2026-03-04  0:07   ` Jakub Kicinski
2026-03-04 11:40     ` Björn Töpel
2026-03-03 18:15 ` [PATCH net-next 4/5] selftests: netdevsim: Add RSS indirection table resize test Björn Töpel
2026-03-04  0:07   ` Jakub Kicinski
2026-03-03 18:15 ` [PATCH net-next 5/5] selftests: rss_drv: Add RSS indirection table resize tests Björn Töpel
2026-03-04  0:16   ` Jakub Kicinski
2026-03-04  8:23 ` [PATCH net-next 0/5] ethtool: Dynamic RSS context indirection table resizing Pavan Chebbi

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=20260303181535.2671734-1-bjorn@kernel.org \
    --to=bjorn@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=michael.chan@broadcom.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pavan.chebbi@broadcom.com \
    --cc=willemb@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