Skip to contentSkip to conversation

net: ena: return 0 in ena_get_rxfh_key_size() when RSS hash key is not configurable

PATCH Applied Kohei Enju 2 participants 2 messages Sep 29, 2025 – Sep 30, 2025

Subsystems (3)
lore
Share & tools
lore

Kohei Enju

author
#0 lore raw

PATCH 1/1 net: ena: return 0 in ena_get_rxfh_key_size() when RSS hash key is not configurable

In EC2 instances where the RSS hash key is not configurable, ethtool shows bogus RSS hash key since ena_get_rxfh_key_size() unconditionally returns ENA_HASH_KEY_SIZE.

Commit 6a4f7dc82d1e ("net: ena: rss: do not allocate key when not supported") added proper handling for devices that don't support RSS hash key configuration, but ena_get_rxfh_key_size() has been unchanged.

When the RSS hash key is not configurable, return 0 instead of ENA_HASH_KEY_SIZE to clarify getting the value is not supported.

Tested on m5 instance families.

Without patch:

 # ethtool -x ens5 | grep -A 1 "RSS hash key"
 RSS hash key:
 00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00:00

With patch:

 # ethtool -x ens5 | grep -A 1 "RSS hash key"
 RSS hash key:
 Operation not supported
Fixes 6a4f7dc82d1e ("net: ena: rss: do not allocate key when not supported")

---
I considered two possible commits for the Fixes: tag:
- 1738cd3ed342 ("net: ena: Add a driver for Amazon Elastic Network Adapters (ENA)")
- 6a4f7dc82d1e ("net: ena: rss: do not allocate key when not supported")

and then chose 6a4f7dc82d1e as it introduced the condition where rss->hash_key could be NULL. However I'm not so attached to the choice, so please let me know if you prefer a different approach.

---
 drivers/net/ethernet/amazon/ena/ena_ethtool.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/amazon/ena/ena_ethtool.c +4 -1
index a81d3a7a3bb9..fe3479b84a1f 100644
@@ -865,7 +865,10 @@ static u32 ena_get_rxfh_indir_size(struct net_device *netdev)
 
 static u32 ena_get_rxfh_key_size(struct net_device *netdev)
 {
-	return ENA_HASH_KEY_SIZE;
+	struct ena_adapter *adapter = netdev_priv(netdev);
+	struct ena_rss *rss = &adapter->ena_dev->rss;
+
+	return rss->hash_key ? ENA_HASH_KEY_SIZE : 0;
 }
 
 static int ena_indirection_table_set(struct ena_adapter *adapter,
Signature · 1 line
2.48.1
#1 lore raw
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 9 lines · On Mon, 29 Sep 2025 14:02:22 +0900 you wrote:

In EC2 instances where the RSS hash key is not configurable, ethtool shows bogus RSS hash key since ena_get_rxfh_key_size() unconditionally returns ENA_HASH_KEY_SIZE.

Commit 6a4f7dc82d1e ("net: ena: rss: do not allocate key when not supported") added proper handling for devices that don't support RSS hash key configuration, but ena_get_rxfh_key_size() has been unchanged.

[...]

Here is the summary with links:
- [net,v1] net: ena: return 0 in ena_get_rxfh_key_size() when RSS hash key is not configurable

    https://git.kernel.org/netdev/net/c/f017156aea60

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html