From: Raju Rangoju <Raju.Rangoju@amd.com>
To: <netdev@vger.kernel.org>
Cc: <horms@kernel.org>, <pabeni@redhat.com>, <kuba@kernel.org>,
<edumazet@google.com>, <davem@davemloft.net>,
<andrew+netdev@lunn.ch>, <linux-kernel@vger.kernel.org>,
<Shyam-sundar.S-k@amd.com>, Raju Rangoju <Raju.Rangoju@amd.com>
Subject: [PATCH net-next v3 4/4] amd-xgbe: add RSS ethtool self-test
Date: Wed, 4 Feb 2026 20:36:01 +0530 [thread overview]
Message-ID: <20260204150601.885845-1-Raju.Rangoju@amd.com> (raw)
Add a Receive Side Scaling (RSS) self-test to the ethtool diagnostic
suite to verify that the hardware correctly computes hash values for
incoming packets.
The test validates RSS functionality by:
1. Checking for RSS hardware feature support (rss bit in MAC_HWF1R)
2. Sending a test packet with specific TCP/UDP ports to trigger
hash computation
3. Verifying that the received packet has a non-zero hash value
computed by the hardware
The test uses the existing loopback infrastructure and requires
PHY loopback mode. It uses specific port values (sport=0xabc,
dport=0xdef) to generate a deterministic hash that exercises
the RSS hash computation logic.
This test helps users verify that RSS is properly configured and
functioning, which is essential for multi-queue performance on
multi-core systems.
Usage:
$ ethtool -t <interface>
Signed-off-by: Raju Rangoju <Raju.Rangoju@amd.com>
---
drivers/net/ethernet/amd/xgbe/xgbe-selftest.c | 32 +++++++++++++++++++
include/net/selftests.h | 1 +
2 files changed, 33 insertions(+)
diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-selftest.c b/drivers/net/ethernet/amd/xgbe/xgbe-selftest.c
index 6cb73ff7cf37..296c45d2bb3c 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-selftest.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-selftest.c
@@ -214,8 +214,13 @@ static int xgbe_test_loopback_validate(struct sk_buff *skb,
if (tdata->packet->id != hdr->id)
goto out;
+ /* Validate RSS hash if expected */
+ if (tdata->packet->exp_hash && !skb->hash)
+ goto out;
+
tdata->ok = true;
complete(&tdata->comp);
+
out:
kfree_skb(skb);
return 0;
@@ -268,6 +273,29 @@ static int __xgbe_test_loopback(struct xgbe_prv_data *pdata,
return ret;
}
+static int xgbe_test_rss(struct xgbe_prv_data *pdata)
+{
+ struct net_packet_attrs attr = {};
+ int ret;
+
+ /* Check for RSS hardware support */
+ if (!pdata->hw_feat.rss)
+ return -EOPNOTSUPP;
+
+ attr.dst = pdata->netdev->dev_addr;
+ /*
+ * Use specific port values to generate a hash.
+ * The asymmetric port values ensure the hash computation
+ * produces a non-zero result for test validation.
+ */
+ attr.sport = 0xabc;
+ attr.dport = 0xdef;
+ attr.exp_hash = true;
+ ret = __xgbe_test_loopback(pdata, &attr);
+
+ return ret;
+}
+
static int xgbe_test_mac_loopback(struct xgbe_prv_data *pdata)
{
struct net_packet_attrs attr = {};
@@ -371,6 +399,10 @@ static const struct xgbe_test xgbe_selftests[] = {
.name = "ARP Offload ",
.lb = XGBE_LOOPBACK_PHY,
.fn = xgbe_test_arpoffload,
+ }, {
+ .name = "RSS ",
+ .lb = XGBE_LOOPBACK_PHY,
+ .fn = xgbe_test_rss,
}
};
diff --git a/include/net/selftests.h b/include/net/selftests.h
index c36e07406ad4..18a9b4830dfc 100644
--- a/include/net/selftests.h
+++ b/include/net/selftests.h
@@ -19,6 +19,7 @@ struct net_packet_attrs {
u8 id;
u16 queue_mapping;
bool bad_csum;
+ u32 exp_hash;
};
struct net_test_priv {
--
2.34.1
reply other threads:[~2026-02-04 15:06 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20260204150601.885845-1-Raju.Rangoju@amd.com \
--to=raju.rangoju@amd.com \
--cc=Shyam-sundar.S-k@amd.com \
--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=netdev@vger.kernel.org \
--cc=pabeni@redhat.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