From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C83DA365A07; Fri, 13 Mar 2026 07:13:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773386011; cv=none; b=txmJq+3TklqjYcBrJB0oVzsrz5/UuvXBULOUlUoWl2Wc4pPtdZ/TyXYXlF9u/MiRY6sl7Wjk7++NyuOLsGS5LT6YnraYQuzF8j2B7veDLSY3RjsGXCwiHUbHbd1TdkOZiFqGDR1Tj6Qowu23pSORqYovsUU9KDu6d6MrKqZzdbA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773386011; c=relaxed/simple; bh=52rK1vJ2UEr4Cg3fNf+SMnYKPYSV6Vh79e8DNQmUQig=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=nUCDIrd1eGNXuOiwj18O4wX14blHNs6dp6cToc0F0DWCVLuPwepaeKxZg0dXXj/LR4mFF6nm38mw323ei9NqzDkSNAohiIDYJyqfnrPE7MPWLYgU0RVKsz4rgsb7qO36yqu5BJYtRl4aWOFGlQdM7yi4dokYPRRhV01WS6JiAq8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=e60CD2xz; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="e60CD2xz" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 898E6C2BC86; Fri, 13 Mar 2026 07:13:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773386011; bh=52rK1vJ2UEr4Cg3fNf+SMnYKPYSV6Vh79e8DNQmUQig=; h=From:To:Cc:Subject:Date:From; b=e60CD2xzMsASAI+BRx4YVj6vqhjaOxhdiLxlz2rn0mthyaa2lrmymB2BX/VEUHOW+ e0CSgKQk4e5VfU4LUpU7SG+YBls4nYf+A64RXwCivqN6pgpIhgzwFe10D5lbVqhqkg ElMbO1jvx8c/qtkXkt0xpjwk414dl8WnzK0WhySTJTp/+jwwv6QiHAniM7eUbd4HKA Gh19s/t7auGm0lnz3+kN1qRWQsw7BR2Od1HxsJkuj/bwkPG8NGOVMmlfr0miYH2Yw6 j9pEUZ5oi89w/cfu3wToRUTdvtlj3uELPUTibnj+PRdfAuU/jaKmtalFVlbVV95Mzj xsOW4/FwCjsRg== From: =?UTF-8?q?Bj=C3=B6rn=20T=C3=B6pel?= To: Michael Chan , Pavan Chebbi , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , netdev@vger.kernel.org, linux-kselftest@vger.kernel.org Cc: =?UTF-8?q?Bj=C3=B6rn=20T=C3=B6pel?= , Willem de Bruijn , Shuah Khan , Maxime Chevallier , Andrew Lunn Subject: [PATCH net-next v4 0/3] ethtool: Dynamic RSS context indirection table resizing Date: Fri, 13 Mar 2026 08:13:12 +0100 Message-ID: <20260313071322.3489243-1-bjorn@kernel.org> X-Mailer: git-send-email 2.53.0 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. Patch 1 adds core helpers: ethtool_rxfh_can_resize() - read-only validation ethtool_rxfh_resize() - fold/unfold a raw table in place ethtool_rxfh_ctxs_can_resize() - validate all non-default contexts ethtool_rxfh_ctxs_resize() - resize all non-default contexts, with locking and RSS_NTF notifications Patch 2 uses them in bnxt_set_channels(). Validation runs before bnxt_close_nic(); actual resize is deferred until after. RSS table size only changes on P5 chips with older firmware. Patch 3 adds HW tests in rss_drv.py (devices without dynamic table sizing are skipped): resize_periodic - fold/unfold with a non-default [3,2,1,0]xN pattern, verifying exact content preservation (main + ctx) resize_nonperiodic_reject - non-periodic table blocks channel reduction, with an extra periodic context to exercise multi-context validation (main + ctx) resize_nonperiodic_no_corruption - failed resize leaves table contents and channel count unchanged (main + ctx) Running the tests: # On real hardware sudo NETIF=eth0 ./rss_drv.py Changes v3 -> v4: - Rebased onto net-next - Added Reviewed-by: from Michael - Added missing Cc: to make the pwbots happier Changes v2 -> v3: - Changed ethtool_rxfh_can_resize() to return bool instead of int; true means resize is possible, false means it is not. Inverted callers accordingly. (Jakub) - Added Tested-by from Pavan Changes v1 -> v2: - Dropped netdevsim support and netdevsim selftest (Jakub) - Split ethtool_rxfh_contexts_resize_all() into separate validate (ethtool_rxfh_ctxs_can_resize) and apply (ethtool_rxfh_ctxs_resize) so drivers can validate before closing the device (Jakub) - Shortened helper names (Jakub) - Replaced scoped_guard(mutex) with explicit mutex_lock/unlock (Jakub) - Removed defensive zero-size check, bare expressions instead of != 0 comparisons, ! instead of == 0 (Jakub) - In bnxt, moved bnxt_check_rings() before RSS validation and deferred actual resize to after bnxt_close_nic() (Jakub, Michael) - Added comment that RSS table size only changes on P5 chips with older firmware (Michael) - Use non-default [3,2,1,0]xN pattern set via netlink to distinguish correct fold from driver resetting to defaults (Jakub) - Check exact indirection table pattern, not just set(indir) (Jakub) - Use ksft_raises() instead of try/except/else (Jakub) - Removed queue_count=8 from NetDrvEnv (Jakub) - Added ksft_variants to resize_nonperiodic_reject for ctx coverage - Added extra periodic context in reject test for multi-context validation coverage - Added resize_nonperiodic_no_corruption test Open items: - 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. Björn Töpel (3): ethtool: Add RSS indirection table resize helpers bnxt_en: Resize RSS contexts on channel count change selftests: rss_drv: Add RSS indirection table resize tests .../net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 36 +++- include/linux/ethtool.h | 4 + net/ethtool/common.c | 143 +++++++++++++++ .../selftests/drivers/net/hw/rss_drv.py | 163 +++++++++++++++++- 4 files changed, 335 insertions(+), 11 deletions(-) base-commit: 8f921f61005450589c0bc1a941a5ddde21d9aed9 -- 2.53.0