[PATCH net-next v2 2/2] net: stmmac: Don't set or get RSS parameters when not supported

From: Maxime Chevallier

Date: Mon Sep 28 2026 - 10:52:55 EST


The RSS kselftests fail on stmmac, and this is partly due to the driver
reporting bogus data for the RSS ops :

- ethtool -x reports an indirection table and a key while the hardware
doesn't have any of that
- ethtool -X fails with -EINVAL.

Let's return early in the rss ops if we know the hardware and platform
don't support RSS.

Signed-off-by: Maxime Chevallier <maxime.chevallier@xxxxxxxxxxx>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 12 ++++++++++++
1 file changed, 12 insertions(+)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
index 154cc0c7623d..b78dc301d70d 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
@@ -927,6 +927,9 @@ static u32 stmmac_get_rxfh_key_size(struct net_device *dev)
{
struct stmmac_priv *priv = netdev_priv(dev);

+ if (!stmmac_rss_is_supported(priv))
+ return 0;
+
return sizeof(priv->rss.key);
}

@@ -934,6 +937,9 @@ static u32 stmmac_get_rxfh_indir_size(struct net_device *dev)
{
struct stmmac_priv *priv = netdev_priv(dev);

+ if (!stmmac_rss_is_supported(priv))
+ return 0;
+
return ARRAY_SIZE(priv->rss.table);
}

@@ -943,6 +949,9 @@ static int stmmac_get_rxfh(struct net_device *dev,
struct stmmac_priv *priv = netdev_priv(dev);
int i;

+ if (!stmmac_rss_is_supported(priv))
+ return -EOPNOTSUPP;
+
if (rxfh->indir) {
for (i = 0; i < ARRAY_SIZE(priv->rss.table); i++)
rxfh->indir[i] = priv->rss.table[i];
@@ -962,6 +971,9 @@ static int stmmac_set_rxfh(struct net_device *dev,
struct stmmac_priv *priv = netdev_priv(dev);
int i;

+ if (!stmmac_rss_is_supported(priv))
+ return -EOPNOTSUPP;
+
if (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE &&
rxfh->hfunc != ETH_RSS_HASH_TOP)
return -EOPNOTSUPP;
--
2.55.0