[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260203145658.2936778-5-Raju.Rangoju@amd.com>
Date: Tue, 3 Feb 2026 20:26:58 +0530
From: Raju Rangoju <Raju.Rangoju@....com>
To: <netdev@...r.kernel.org>
CC: <horms@...nel.org>, <pabeni@...hat.com>, <kuba@...nel.org>,
<edumazet@...gle.com>, <davem@...emloft.net>, <andrew+netdev@...n.ch>,
<linux-kernel@...r.kernel.org>, <Shyam-sundar.S-k@....com>, Raju Rangoju
<Raju.Rangoju@....com>
Subject: [PATCH net-next v2 4/4] amd-xgbe: add RSS ethtool self-test
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@....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 b57826a91361..a4e7decf768f 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-selftest.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-selftest.c
@@ -213,8 +213,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;
@@ -267,6 +272,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 = {};
@@ -370,6 +398,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
Powered by blists - more mailing lists