Skip to contentSkip to conversation

igc: add RSS key get/set support

PATCH In review Kohei Enju 5 participants 17 messages Oct 25, 2025 – Feb 24

Subsystems (3)
lore
Share & tools
lore

Kohei Enju

author
#0 lore raw

cover igc: add RSS key get/set support

This series adds ethtool get/set support for the RSS hash key in the igc driver.
- ethtool -x <dev> to display the RSS key
- ethtool -X <dev> hkey <key> to configure the RSS key

Without patch:

 # ethtool -x $DEV | grep key -A1
 RSS hash key:
 Operation not supported
 # ethtool -X $DEV hkey be:ef:be:ef:be:ef:be:ef:be:ef:be:ef:be:ef:be:ef:be:ef:be:ef:be:ef:be:ef:be:ef:be:ef:be:ef:be:ef:be:ef:be:ef:be:ef:be:ef
 Cannot set RX flow hash configuration:
  Hash key setting not supported

With patch:

 # ethtool -x $DEV | grep key -A1
 RSS hash key:
 dd:7c:1f:06:1a:42:dc:e5:7e:90:2c:48:aa:3f:5d:5a:d7:da:ec:44:3e:3f:df:78:89:1e:3c:68:2e:59:da:a0:23:5a:32:5c:cf:5e:7e:7b
 # ethtool -X $DEV hkey be:ef:be:ef:be:ef:be:ef:be:ef:be:ef:be:ef:be:ef:be:ef:be:ef:be:ef:be:ef:be:ef:be:ef:be:ef:be:ef:be:ef:be:ef:be:ef:be:ef
 # ethtool -x $DEV | grep key -A1
 RSS hash key:
 be:ef:be:ef:be:ef:be:ef:be:ef:be:ef:be:ef:be:ef:be:ef:be:ef:be:ef:be:ef:be:ef:be:ef:be:ef:be:ef:be:ef:be:ef:be:ef:be:ef

Kohei Enju (3):
igc: prepare for RSS key get/set support
igc: expose RSS key via ethtool get_rxfh
igc: allow configuring RSS key via ethtool set_rxfh

 drivers/net/ethernet/intel/igc/igc.h         |  4 ++
 drivers/net/ethernet/intel/igc/igc_ethtool.c | 60 ++++++++++++++------
 drivers/net/ethernet/intel/igc/igc_main.c    |  7 +--
 3 files changed, 50 insertions(+), 21 deletions(-)
Signature · 1 line
2.51.0
author
#1 lore raw

PATCH 1/3 igc: prepare for RSS key get/set support

Store the RSS key inside struct igc_adapter and introduce the igc_write_rss_key() helper function. This allows the driver to program the RSSRK registers using a persistent RSS key, instead of using a stack-local buffer in igc_setup_mrqc().

This is a preparation patch for adding RSS key get/set support in subsequent changes, and no functional change is intended in this patch.

---
 drivers/net/ethernet/intel/igc/igc.h         |  3 +++
 drivers/net/ethernet/intel/igc/igc_ethtool.c | 12 ++++++++++++
 drivers/net/ethernet/intel/igc/igc_main.c    |  6 ++----
 3 files changed, 17 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/igc/igc.h +3 -0
index a427f05814c1..dd159397d191 100644
@@ -30,6 +30,7 @@ void igc_ethtool_set_ops(struct net_device *);
 
 #define MAX_ETYPE_FILTER		8
 #define IGC_RETA_SIZE			128
+#define IGC_RSS_KEY_SIZE		40
 
 /* SDP support */
 #define IGC_N_EXTTS	2
@@ -302,6 +303,7 @@ struct igc_adapter {
 	unsigned int nfc_rule_count;
 
 	u8 rss_indir_tbl[IGC_RETA_SIZE];
+	u8 rss_key[IGC_RSS_KEY_SIZE];
 
 	unsigned long link_check_timeout;
 	struct igc_info ei;
@@ -360,6 +362,7 @@ unsigned int igc_get_max_rss_queues(struct igc_adapter *adapter);
 void igc_set_flag_queue_pairs(struct igc_adapter *adapter,
 			      const u32 max_rss_queues);
 int igc_reinit_queues(struct igc_adapter *adapter);
+void igc_write_rss_key(struct igc_adapter *adapter);
 void igc_write_rss_indir_tbl(struct igc_adapter *adapter);
 bool igc_has_link(struct igc_adapter *adapter);
 void igc_reset(struct igc_adapter *adapter);
drivers/net/ethernet/intel/igc/igc_ethtool.c +12 -0
index ca93629b1d3a..f89c2cbaace0 100644
@@ -1456,6 +1456,18 @@ static int igc_ethtool_set_rxnfc(struct net_device *dev,
 	}
 }
 
+void igc_write_rss_key(struct igc_adapter *adapter)
+{
+	struct igc_hw *hw = &adapter->hw;
+	u32 val;
+	int i;
+
+	for (i = 0; i < IGC_RSS_KEY_SIZE / 4; i++) {
+		val = get_unaligned_le32(&adapter->rss_key[i * 4]);
+		wr32(IGC_RSSRK(i), val);
+	}
+}
+
 void igc_write_rss_indir_tbl(struct igc_adapter *adapter)
 {
 	struct igc_hw *hw = &adapter->hw;
drivers/net/ethernet/intel/igc/igc_main.c +2 -4
index 728d7ca5338b..1f0a601cbcef 100644
@@ -778,11 +778,9 @@ static void igc_setup_mrqc(struct igc_adapter *adapter)
 	struct igc_hw *hw = &adapter->hw;
 	u32 j, num_rx_queues;
 	u32 mrqc, rxcsum;
-	u32 rss_key[10];
 
-	netdev_rss_key_fill(rss_key, sizeof(rss_key));
-	for (j = 0; j < 10; j++)
-		wr32(IGC_RSSRK(j), rss_key[j]);
+	netdev_rss_key_fill(adapter->rss_key, sizeof(adapter->rss_key));
+	igc_write_rss_key(adapter);
 
 	num_rx_queues = adapter->rss_queues;
 
Signature · 1 line
2.51.0
Reviewed-by on v1 1/3
#2 lore raw

RE: [Intel-wired-lan] [PATCH iwl-next v1 1/3] igc: prepare for RSS key get/set support

Quoted 106 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Kohei Enju
Sent: Saturday, October 25, 2025 5:02 PM
To: [email protected]; [email protected]
Cc: Nguyen, Anthony L <[email protected]>; Kitszel, Przemyslaw <[email protected]>; Andrew Lunn <[email protected]>; David S. Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; [email protected]; Kohei Enju <[email protected]>
Subject: [Intel-wired-lan] [PATCH iwl-next v1 1/3] igc: prepare for RSS key get/set support

Store the RSS key inside struct igc_adapter and introduce the igc_write_rss_key() helper function. This allows the driver to program the RSSRK registers using a persistent RSS key, instead of using a stack-local buffer in igc_setup_mrqc().

This is a preparation patch for adding RSS key get/set support in subsequent changes, and no functional change is intended in this patch.

---
 drivers/net/ethernet/intel/igc/igc.h         |  3 +++
 drivers/net/ethernet/intel/igc/igc_ethtool.c | 12 ++++++++++++
 drivers/net/ethernet/intel/igc/igc_main.c    |  6 ++----
 3 files changed, 17 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/igc/igc.h +2 -0
index a427f05814c1..dd159397d191 100644
@@ -30,6 +30,7 @@ void igc_ethtool_set_ops(struct net_device *);
 
 #define MAX_ETYPE_FILTER		8
 #define IGC_RETA_SIZE			128
+#define IGC_RSS_KEY_SIZE		40
 
 /* SDP support */
 #define IGC_N_EXTTS	2
@@ -302,6 +303,7 @@ struct igc_adapter {
 	unsigned int nfc_rule_count;
 
 	u8 rss_indir_tbl[IGC_RETA_SIZE];
+	u8 rss_key[IGC_RSS_KEY_SIZE];
 
 	unsigned long link_check_timeout;
 	struct igc_info ei;
@@ -360,6 +362,7 @@ unsigned int igc_get_max_rss_queues(struct

igc_adapter *adapter); void igc_set_flag_queue_pairs(struct igc_adapter *adapter,

drivers/net/ethernet/intel/igc/igc.h +1 -0
 			      const u32 max_rss_queues);
 int igc_reinit_queues(struct igc_adapter *adapter);
+void igc_write_rss_key(struct igc_adapter *adapter);
 void igc_write_rss_indir_tbl(struct igc_adapter *adapter);  bool

igc_has_link(struct igc_adapter *adapter); void igc_reset(struct igc_adapter *adapter); diff --git a/drivers/net/ethernet/intel/igc/igc_ethtool.c b/drivers/net/ethernet/intel/igc/igc_ethtool.c
index ca93629b1d3a..f89c2cbaace0 100644

drivers/net/ethernet/intel/igc/igc_ethtool.c +11 -0
@@ -1456,6 +1456,18 @@ static int igc_ethtool_set_rxnfc(struct
 net_device *dev,
 	}
 }
 
+void igc_write_rss_key(struct igc_adapter *adapter) {
+	struct igc_hw *hw = &adapter->hw;
+	u32 val;
+	int i;
+
+	for (i = 0; i < IGC_RSS_KEY_SIZE / 4; i++) {
+		val = get_unaligned_le32(&adapter->rss_key[i * 4]);
+		wr32(IGC_RSSRK(i), val);
+	}
+}
+
 void igc_write_rss_indir_tbl(struct igc_adapter *adapter)  {
 	struct igc_hw *hw = &adapter->hw;
drivers/net/ethernet/intel/igc/igc_main.c +2 -4
index 728d7ca5338b..1f0a601cbcef 100644
@@ -778,11 +778,9 @@ static void igc_setup_mrqc(struct igc_adapter
 *adapter)
 	struct igc_hw *hw = &adapter->hw;
 	u32 j, num_rx_queues;
 	u32 mrqc, rxcsum;
-	u32 rss_key[10];
 
-	netdev_rss_key_fill(rss_key, sizeof(rss_key));
-	for (j = 0; j < 10; j++)
-		wr32(IGC_RSSRK(j), rss_key[j]);
+	netdev_rss_key_fill(adapter->rss_key, sizeof(adapter-
 >rss_key));
+	igc_write_rss_key(adapter);
 

num_rx_queues = adapter->rss_queues;

Quoted 2 lines

--
2.51.0

reviewer Reviewed-by on v1 1/3
#3 lore raw

Re: [PATCH iwl-next v1 1/3] igc: prepare for RSS key get/set support

In reply to Kohei Enju
Quoted 9 lines · Kohei Enju

Store the RSS key inside struct igc_adapter and introduce the igc_write_rss_key() helper function. This allows the driver to program the RSSRK registers using a persistent RSS key, instead of using a stack-local buffer in igc_setup_mrqc().

This is a preparation patch for adding RSS key get/set support in subsequent changes, and no functional change is intended in this patch.

Reviewed-by
#4 lore raw

Re: [Intel-wired-lan] [PATCH iwl-next v1 1/3] igc: prepare for RSS key get/set support

Quoted 6 lines · Simon Horman
Quoted 5 lines · Kohei Enju

Store the RSS key inside struct igc_adapter and introduce the igc_write_rss_key() helper function. This allows the driver to program the RSSRK registers using a persistent RSS key, instead of using a stack-local buffer in igc_setup_mrqc().

Quoted 7 lines
Quoted 4 lines

This is a preparation patch for adding RSS key get/set support in subsequent changes, and no functional change is intended in this patch.

Tested-by on v1 1/3
#5 lore raw

Re: [Intel-wired-lan] [PATCH iwl-next v1 1/3] igc: prepare for RSS key get/set support

In reply to Kohei Enju
Quoted 8 lines · Kohei Enju

Store the RSS key inside struct igc_adapter and introduce the igc_write_rss_key() helper function. This allows the driver to program the RSSRK registers using a persistent RSS key, instead of using a stack-local buffer in igc_setup_mrqc().

This is a preparation patch for adding RSS key get/set support in subsequent changes, and no functional change is intended in this patch.

Quoted 7 lines
---
  drivers/net/ethernet/intel/igc/igc.h         |  3 +++
  drivers/net/ethernet/intel/igc/igc_ethtool.c | 12 ++++++++++++
  drivers/net/ethernet/intel/igc/igc_main.c    |  6 ++----
  3 files changed, 17 insertions(+), 4 deletions(-)
Tested-by on v1 1/3
#6 lore raw

Re: [Intel-wired-lan] [PATCH iwl-next v1 1/3] igc: prepare for RSS key get/set support

In reply to Kohei Enju
Quoted 8 lines · Kohei Enju

Store the RSS key inside struct igc_adapter and introduce the igc_write_rss_key() helper function. This allows the driver to program the RSSRK registers using a persistent RSS key, instead of using a stack-local buffer in igc_setup_mrqc().

This is a preparation patch for adding RSS key get/set support in subsequent changes, and no functional change is intended in this patch.

Quoted 7 lines
---
  drivers/net/ethernet/intel/igc/igc.h         |  3 +++
  drivers/net/ethernet/intel/igc/igc_ethtool.c | 12 ++++++++++++
  drivers/net/ethernet/intel/igc/igc_main.c    |  6 ++----
  3 files changed, 17 insertions(+), 4 deletions(-)
author
#7 lore raw

PATCH 2/3 igc: expose RSS key via ethtool get_rxfh

In reply to Kohei Enju

Implement igc_ethtool_get_rxfh_key_size() and extend igc_ethtool_get_rxfh() to return the RSS key to userspace.

This can be tested using ethtool -x <dev>.

---
 drivers/net/ethernet/intel/igc/igc_ethtool.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/igc/igc_ethtool.c +13 -4
index f89c2cbaace0..0482e590bc5a 100644
@@ -1490,6 +1490,11 @@ void igc_write_rss_indir_tbl(struct igc_adapter *adapter)
 	}
 }
 
+static u32 igc_ethtool_get_rxfh_key_size(struct net_device *netdev)
+{
+	return IGC_RSS_KEY_SIZE;
+}
+
 static u32 igc_ethtool_get_rxfh_indir_size(struct net_device *netdev)
 {
 	return IGC_RETA_SIZE;
@@ -1502,10 +1507,13 @@ static int igc_ethtool_get_rxfh(struct net_device *netdev,
 	int i;
 
 	rxfh->hfunc = ETH_RSS_HASH_TOP;
-	if (!rxfh->indir)
-		return 0;
-	for (i = 0; i < IGC_RETA_SIZE; i++)
-		rxfh->indir[i] = adapter->rss_indir_tbl[i];
+
+	if (rxfh->indir)
+		for (i = 0; i < IGC_RETA_SIZE; i++)
+			rxfh->indir[i] = adapter->rss_indir_tbl[i];
+
+	if (rxfh->key)
+		memcpy(rxfh->key, adapter->rss_key, sizeof(adapter->rss_key));
 
 	return 0;
 }
@@ -2182,6 +2190,7 @@ static const struct ethtool_ops igc_ethtool_ops = {
 	.set_coalesce		= igc_ethtool_set_coalesce,
 	.get_rxnfc		= igc_ethtool_get_rxnfc,
 	.set_rxnfc		= igc_ethtool_set_rxnfc,
+	.get_rxfh_key_size	= igc_ethtool_get_rxfh_key_size,
 	.get_rxfh_indir_size	= igc_ethtool_get_rxfh_indir_size,
 	.get_rxfh		= igc_ethtool_get_rxfh,
 	.set_rxfh		= igc_ethtool_set_rxfh,
Signature · 1 line
2.51.0
Reviewed-by on v1 2/3
#8 lore raw

RE: [Intel-wired-lan] [PATCH iwl-next v1 2/3] igc: expose RSS key via ethtool get_rxfh

Quoted 71 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Kohei Enju
Sent: Saturday, October 25, 2025 5:02 PM
To: [email protected]; [email protected]
Cc: Nguyen, Anthony L <[email protected]>; Kitszel, Przemyslaw <[email protected]>; Andrew Lunn <[email protected]>; David S. Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; [email protected]; Kohei Enju <[email protected]>
Subject: [Intel-wired-lan] [PATCH iwl-next v1 2/3] igc: expose RSS key via ethtool get_rxfh

Implement igc_ethtool_get_rxfh_key_size() and extend igc_ethtool_get_rxfh() to return the RSS key to userspace.

This can be tested using ethtool -x <dev>.

---
 drivers/net/ethernet/intel/igc/igc_ethtool.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/igc/igc_ethtool.c +11 -4
index f89c2cbaace0..0482e590bc5a 100644
@@ -1490,6 +1490,11 @@ void igc_write_rss_indir_tbl(struct igc_adapter
 *adapter)
 	}
 }
 
+static u32 igc_ethtool_get_rxfh_key_size(struct net_device *netdev) {
+	return IGC_RSS_KEY_SIZE;
+}
+
 static u32 igc_ethtool_get_rxfh_indir_size(struct net_device *netdev)
 {
 	return IGC_RETA_SIZE;
@@ -1502,10 +1507,13 @@ static int igc_ethtool_get_rxfh(struct
 net_device *netdev,
 	int i;
 
 	rxfh->hfunc = ETH_RSS_HASH_TOP;
-	if (!rxfh->indir)
-		return 0;
-	for (i = 0; i < IGC_RETA_SIZE; i++)
-		rxfh->indir[i] = adapter->rss_indir_tbl[i];
+
+	if (rxfh->indir)
+		for (i = 0; i < IGC_RETA_SIZE; i++)
+			rxfh->indir[i] = adapter->rss_indir_tbl[i];
+
+	if (rxfh->key)
+		memcpy(rxfh->key, adapter->rss_key, sizeof(adapter-
 >rss_key));
 
drivers/net/ethernet/intel/igc/igc_ethtool.c +1 -0
 	return 0;
 }
@@ -2182,6 +2190,7 @@ static const struct ethtool_ops igc_ethtool_ops
 = {
 	.set_coalesce		= igc_ethtool_set_coalesce,
 	.get_rxnfc		= igc_ethtool_get_rxnfc,
 	.set_rxnfc		= igc_ethtool_set_rxnfc,
+	.get_rxfh_key_size	= igc_ethtool_get_rxfh_key_size,
 	.get_rxfh_indir_size	= igc_ethtool_get_rxfh_indir_size,
 	.get_rxfh		= igc_ethtool_get_rxfh,
Quoted 3 lines

.set_rxfh = igc_ethtool_set_rxfh,
--
2.51.0

Reviewed-by
#10 lore raw

Re: [Intel-wired-lan] [PATCH iwl-next v1 2/3] igc: expose RSS key via ethtool get_rxfh

Quoted 10 lines · Simon Horman
Quoted 6 lines · Kohei Enju

Implement igc_ethtool_get_rxfh_key_size() and extend igc_ethtool_get_rxfh() to return the RSS key to userspace.

This can be tested using ethtool -x <dev>.

Tested-by on v1 2/3
#11 lore raw

Re: [Intel-wired-lan] [PATCH iwl-next v1 2/3] igc: expose RSS key via ethtool get_rxfh

In reply to Kohei Enju
Quoted 10 lines · Kohei Enju

Implement igc_ethtool_get_rxfh_key_size() and extend igc_ethtool_get_rxfh() to return the RSS key to userspace.

This can be tested using ethtool -x <dev>.

---
  drivers/net/ethernet/intel/igc/igc_ethtool.c | 17 +++++++++++++----
  1 file changed, 13 insertions(+), 4 deletions(-)
author
#12 lore raw

PATCH 3/3 igc: allow configuring RSS key via ethtool set_rxfh

In reply to Kohei Enju

Change igc_ethtool_set_rxfh() to accept and save a userspace-provided RSS key. When a key is provided, store it in the adapter and write the RSSRK registers accordingly.

This can be tested using ethtool -X <dev> hkey <key>.

---
 drivers/net/ethernet/intel/igc/igc.h         |  1 +
 drivers/net/ethernet/intel/igc/igc_ethtool.c | 31 ++++++++++++--------
 drivers/net/ethernet/intel/igc/igc_main.c    |  3 +-
 3 files changed, 21 insertions(+), 14 deletions(-)
drivers/net/ethernet/intel/igc/igc.h +1 -0
index dd159397d191..c894a5a99fc0 100644
@@ -304,6 +304,7 @@ struct igc_adapter {
 
 	u8 rss_indir_tbl[IGC_RETA_SIZE];
 	u8 rss_key[IGC_RSS_KEY_SIZE];
+	bool has_user_rss_key;
 
 	unsigned long link_check_timeout;
 	struct igc_info ei;
drivers/net/ethernet/intel/igc/igc_ethtool.c +18 -13
index 0482e590bc5a..64eac1ccb3ff 100644
@@ -1527,24 +1527,29 @@ static int igc_ethtool_set_rxfh(struct net_device *netdev,
 	int i;
 
 	/* We do not allow change in unsupported parameters */
-	if (rxfh->key ||
-	    (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE &&
-	     rxfh->hfunc != ETH_RSS_HASH_TOP))
+	if (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE &&
+	    rxfh->hfunc != ETH_RSS_HASH_TOP)
 		return -EOPNOTSUPP;
-	if (!rxfh->indir)
-		return 0;
 
-	num_queues = adapter->rss_queues;
+	if (rxfh->indir) {
+		num_queues = adapter->rss_queues;
 
-	/* Verify user input. */
-	for (i = 0; i < IGC_RETA_SIZE; i++)
-		if (rxfh->indir[i] >= num_queues)
-			return -EINVAL;
+		/* Verify user input. */
+		for (i = 0; i < IGC_RETA_SIZE; i++)
+			if (rxfh->indir[i] >= num_queues)
+				return -EINVAL;
 
-	for (i = 0; i < IGC_RETA_SIZE; i++)
-		adapter->rss_indir_tbl[i] = rxfh->indir[i];
+		for (i = 0; i < IGC_RETA_SIZE; i++)
+			adapter->rss_indir_tbl[i] = rxfh->indir[i];
 
-	igc_write_rss_indir_tbl(adapter);
+		igc_write_rss_indir_tbl(adapter);
+	}
+
+	if (rxfh->key) {
+		adapter->has_user_rss_key = true;
+		memcpy(adapter->rss_key, rxfh->key, sizeof(adapter->rss_key));
+		igc_write_rss_key(adapter);
+	}
 
 	return 0;
 }
drivers/net/ethernet/intel/igc/igc_main.c +2 -1
index 1f0a601cbcef..e977661bed2f 100644
@@ -779,7 +779,8 @@ static void igc_setup_mrqc(struct igc_adapter *adapter)
 	u32 j, num_rx_queues;
 	u32 mrqc, rxcsum;
 
-	netdev_rss_key_fill(adapter->rss_key, sizeof(adapter->rss_key));
+	if (!adapter->has_user_rss_key)
+		netdev_rss_key_fill(adapter->rss_key, sizeof(adapter->rss_key));
 	igc_write_rss_key(adapter);
 
 	num_rx_queues = adapter->rss_queues;
Signature · 1 line
2.51.0
Reviewed-by on v1 3/3
#13 lore raw

RE: [Intel-wired-lan] [PATCH iwl-next v1 3/3] igc: allow configuring RSS key via ethtool set_rxfh

Quoted 112 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Kohei Enju
Sent: Saturday, October 25, 2025 5:02 PM
To: [email protected]; [email protected]
Cc: Nguyen, Anthony L <[email protected]>; Kitszel, Przemyslaw <[email protected]>; Andrew Lunn <[email protected]>; David S. Miller <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; [email protected]; Kohei Enju <[email protected]>
Subject: [Intel-wired-lan] [PATCH iwl-next v1 3/3] igc: allow configuring RSS key via ethtool set_rxfh

Change igc_ethtool_set_rxfh() to accept and save a userspace-provided RSS key. When a key is provided, store it in the adapter and write the RSSRK registers accordingly.

This can be tested using ethtool -X <dev> hkey <key>.

---
 drivers/net/ethernet/intel/igc/igc.h         |  1 +
 drivers/net/ethernet/intel/igc/igc_ethtool.c | 31 ++++++++++++-------
(quoted diff) +0 -1
-
 drivers/net/ethernet/intel/igc/igc_main.c    |  3 +-
 3 files changed, 21 insertions(+), 14 deletions(-)
drivers/net/ethernet/intel/igc/igc.h +1 -0
index dd159397d191..c894a5a99fc0 100644
@@ -304,6 +304,7 @@ struct igc_adapter {
 
 	u8 rss_indir_tbl[IGC_RETA_SIZE];
 	u8 rss_key[IGC_RSS_KEY_SIZE];
+	bool has_user_rss_key;
 
 	unsigned long link_check_timeout;
 	struct igc_info ei;
drivers/net/ethernet/intel/igc/igc_ethtool.c +18 -13
index 0482e590bc5a..64eac1ccb3ff 100644
@@ -1527,24 +1527,29 @@ static int igc_ethtool_set_rxfh(struct
 net_device *netdev,
 	int i;
 
 	/* We do not allow change in unsupported parameters */
-	if (rxfh->key ||
-	    (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE &&
-	     rxfh->hfunc != ETH_RSS_HASH_TOP))
+	if (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE &&
+	    rxfh->hfunc != ETH_RSS_HASH_TOP)
 		return -EOPNOTSUPP;
-	if (!rxfh->indir)
-		return 0;
 
-	num_queues = adapter->rss_queues;
+	if (rxfh->indir) {
+		num_queues = adapter->rss_queues;
 
-	/* Verify user input. */
-	for (i = 0; i < IGC_RETA_SIZE; i++)
-		if (rxfh->indir[i] >= num_queues)
-			return -EINVAL;
+		/* Verify user input. */
+		for (i = 0; i < IGC_RETA_SIZE; i++)
+			if (rxfh->indir[i] >= num_queues)
+				return -EINVAL;
 
-	for (i = 0; i < IGC_RETA_SIZE; i++)
-		adapter->rss_indir_tbl[i] = rxfh->indir[i];
+		for (i = 0; i < IGC_RETA_SIZE; i++)
+			adapter->rss_indir_tbl[i] = rxfh->indir[i];
 
-	igc_write_rss_indir_tbl(adapter);
+		igc_write_rss_indir_tbl(adapter);
+	}
+
+	if (rxfh->key) {
+		adapter->has_user_rss_key = true;
+		memcpy(adapter->rss_key, rxfh->key, sizeof(adapter-
 >rss_key));
+		igc_write_rss_key(adapter);
+	}
 
drivers/net/ethernet/intel/igc/igc_ethtool.c +0 -0
 	return 0;
 }
drivers/net/ethernet/intel/igc/igc_main.c +2 -1
index 1f0a601cbcef..e977661bed2f 100644
@@ -779,7 +779,8 @@ static void igc_setup_mrqc(struct igc_adapter
 *adapter)
 	u32 j, num_rx_queues;
 	u32 mrqc, rxcsum;
 
-	netdev_rss_key_fill(adapter->rss_key, sizeof(adapter-
 >rss_key));
+	if (!adapter->has_user_rss_key)
+		netdev_rss_key_fill(adapter->rss_key, sizeof(adapter-
 >rss_key));
drivers/net/ethernet/intel/igc/igc_main.c +0 -1
 	igc_write_rss_key(adapter);
 
 	num_rx_queues = adapter->rss_queues;
--
Quoted 1 line

2.51.0

reviewer Reviewed-by on v1 3/3
#14 lore raw

Re: [PATCH iwl-next v1 3/3] igc: allow configuring RSS key via ethtool set_rxfh

In reply to Kohei Enju
Quoted 7 lines · Kohei Enju

Change igc_ethtool_set_rxfh() to accept and save a userspace-provided RSS key. When a key is provided, store it in the adapter and write the RSSRK registers accordingly.

This can be tested using ethtool -X <dev> hkey <key>.

Reviewed-by
#15 lore raw

Re: [Intel-wired-lan] [PATCH iwl-next v1 3/3] igc: allow configuring RSS key via ethtool set_rxfh

Quoted 11 lines · Simon Horman
Quoted 7 lines · Kohei Enju

Change igc_ethtool_set_rxfh() to accept and save a userspace-provided RSS key. When a key is provided, store it in the adapter and write the RSSRK registers accordingly.

This can be tested using ethtool -X <dev> hkey <key>.

Tested-by on v1 3/3
#16 lore raw

Re: [Intel-wired-lan] [PATCH iwl-next v1 3/3] igc: allow configuring RSS key via ethtool set_rxfh

In reply to Kohei Enju
Quoted 4 lines · Kohei Enju

Change igc_ethtool_set_rxfh() to accept and save a userspace-provided RSS key. When a key is provided, store it in the adapter and write the RSSRK registers accordingly.

Quoted 9 lines

This can be tested using ethtool -X <dev> hkey <key>.

---
  drivers/net/ethernet/intel/igc/igc.h         |  1 +
  drivers/net/ethernet/intel/igc/igc_ethtool.c | 31 ++++++++++++--------
  drivers/net/ethernet/intel/igc/igc_main.c    |  3 +-
  3 files changed, 21 insertions(+), 14 deletions(-)