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 3/3] net: amd-xgbe: add RSS ethtool self-test
Date: Mon, 2 Feb 2026 21:05:42 +0530 [thread overview]
Message-ID: <20260202153542.1727429-4-Raju.Rangoju@amd.com> (raw)
In-Reply-To: <20260202153542.1727429-1-Raju.Rangoju@amd.com>
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 ae4825578c59..bd1c757bbc3f 100644
--- a/drivers/net/ethernet/amd/xgbe/xgbe-selftest.c
+++ b/drivers/net/ethernet/amd/xgbe/xgbe-selftest.c
@@ -100,8 +100,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;
@@ -154,6 +159,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_arp_validate(struct sk_buff *skb,
struct net_device *ndev,
struct packet_type *pt,
@@ -368,6 +396,10 @@ static const struct xgbe_test xgbe_selftests[] = {
.name = "ARP Offload ",
.lb = XGBE_LOOPBACK_PHY,
.fn = xgbe_test_arpoffload,
+ }, {
+ .name = "RSS Hash ",
+ .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
prev parent reply other threads:[~2026-02-02 15:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-02 15:35 [PATCH 0/3] net: amd-xgbe: add ARP offload and RSS self-tests Raju Rangoju
2026-02-02 15:35 ` [PATCH 1/3] net: amd-xgbe: add hardware ARP offload support Raju Rangoju
2026-02-02 15:35 ` [PATCH 2/3] net: amd-xgbe: add ARP offload ethtool self-test Raju Rangoju
2026-02-03 2:00 ` kernel test robot
2026-02-03 2:37 ` [2/3] " Jakub Kicinski
2026-02-02 15:35 ` Raju Rangoju [this message]
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=20260202153542.1727429-4-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.