igb: add RSS key get/set support
Subsystems (3)
v2 cover igb: add RSS key get/set support
This series adds ethtool get/set support for the RSS hash key in the igb 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 00:00:00:00:00:00:00:00:00:00:00:00:000 Cannot set RX flow hash configuration: Hash key setting not supported
With patch:
# ethtool -x $DEV | grep key -A1 RSS hash key: 86:5d:11:56:bd:6f:20:38:3b:f8:bb:df:00:3a:b0:24:95:9f:f9:f4:25:a3:01:3e:4a:15:d6:7c:4d:af:39:7e:4a:95:f2:fd:f6:b6:26:f7
# ethtool -X $DEV hkey 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 # ethtool -x $DEV | grep key -A1 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
<Changelog>
v2: Fix typos (igc_* → igb_*)
v1: https://lore.kernel.org/all/[email protected]/
Takashi Kozu (3):
Store the RSS key inside struct igb_adapter and introduce the
igb: expose RSS key via ethtool get_rxfh
igb: allow configuring RSS key via ethtool set_rxfh
drivers/net/ethernet/intel/igb/igb.h | 4 + drivers/net/ethernet/intel/igb/igb_ethtool.c | 77 +++++++++++++------- drivers/net/ethernet/intel/igb/igb_main.c | 7 +- 3 files changed, 58 insertions(+), 30 deletions(-)
Signature · 1 line
2.52.0
PATCH v2 1/3 igb: prepare for RSS key get/set support
Store the RSS key inside struct igb_adapter and introduce the igb_write_rss_key() helper function. This allows the driver to program the E1000 registers using a persistent RSS key, instead of using a stack-local buffer in igb_setup_mrqc().
--- drivers/net/ethernet/intel/igb/igb.h | 3 +++ drivers/net/ethernet/intel/igb/igb_ethtool.c | 12 ++++++++++++ drivers/net/ethernet/intel/igb/igb_main.c | 6 ++---- 3 files changed, 17 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/igb/igb.h +3 -0
@@ -495,6 +495,7 @@ struct hwmon_buff {#define IGB_N_PEROUT 2#define IGB_N_SDP 4#define IGB_RETA_SIZE 128 +#define IGB_RSS_KEY_SIZE 40enum igb_filter_match_flags {IGB_FILTER_FLAG_ETHER_TYPE =0x1 ,
@@ -655,6 +656,7 @@ struct igb_adapter {struct i2c_client *i2c_client;u32 rss_indir_tbl_init;u8 rss_indir_tbl[IGB_RETA_SIZE ]; +u8 rss_key[IGB_RSS_KEY_SIZE ];unsigned long link_check_timeout;int copper_tries;
@@ -735,6 +737,7 @@ void igb_down(struct igb_adapter *);void igb_reinit_locked (struct igb_adapter *);void igb_reset (struct igb_adapter *);int igb_reinit_queues (struct igb_adapter *); +void igb_write_rss_key (struct igb_adapter *adapter);void igb_write_rss_indir_tbl (struct igb_adapter *);int igb_set_spd_dplx (struct igb_adapter *,u32 ,u8 );int igb_setup_tx_resources (struct igb_ring *);
drivers/net/ethernet/intel/igb/igb_ethtool.c +12 -0
@@ -3016,6 +3016,18 @@ static int igb_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd)return ret; } +void igb_write_rss_key (struct igb_adapter *adapter) +{ +struct e1000_hw *hw = &adapter->hw; +u32 val; +int i; + +for (i =0 ; i <IGB_RSS_KEY_SIZE /4 ; i++) { + val =get_unaligned_le32 (&adapter->rss_key[i *4 ]); +wr32 (E1000_RSSRK (i), val); + } +} +static int igb_get_eee (struct net_device *netdev,struct ethtool_keee *edata) {struct igb_adapter *adapter =netdev_priv (netdev);
drivers/net/ethernet/intel/igb/igb_main.c +2 -4
@@ -4525,11 +4525,9 @@ static void igb_setup_mrqc(struct igb_adapter *adapter)struct e1000_hw *hw = &adapter->hw;u32 mrqc, rxcsum;u32 j, num_rx_queues; -u32 rss_key[10 ]; -netdev_rss_key_fill (rss_key,sizeof (rss_key)); -for (j =0 ; j <10 ; j++) -wr32 (E1000_RSSRK (j), rss_key[j]); +netdev_rss_key_fill (adapter->rss_key,sizeof (adapter->rss_key)); +igb_write_rss_key (adapter); num_rx_queues = adapter->rss_queues;
Signature · 1 line
2.52.0
Re: [Intel-wired-lan] [PATCH iwl-next v2 1/3] igb: prepare for RSS key get/set support
Dear Takashi,
Thank you for the patch.
Am 08.01.26 um 06:20 schrieb Takashi Kozu:
Quoted 47 lines
Store the RSS key inside struct
igb_adapterand introduce theigb_write_rss_key()helper function. This allows the driver to program the E1000 registers using a persistent RSS key, instead of using a stack-local buffer inigb_setup_mrqc().Tested-by Kohei Enju <[email protected]>Signed-off-by Takashi Kozu <[email protected]>--- drivers/net/ethernet/intel/igb/igb.h | 3 +++ drivers/net/ethernet/intel/igb/igb_ethtool.c | 12 ++++++++++++ drivers/net/ethernet/intel/igb/igb_main.c | 6 ++---- 3 files changed, 17 insertions(+), 4 deletions(-)drivers/net/ethernet/intel/igb/igb.h +3
-0@@ -495,6 +495,7 @@ struct hwmon_buff {#define IGB_N_PEROUT 2#define IGB_N_SDP 4#define IGB_RETA_SIZE 128 +#define IGB_RSS_KEY_SIZE 40enum igb_filter_match_flags {IGB_FILTER_FLAG_ETHER_TYPE =0x1 ,@@ -655,6 +656,7 @@ struct igb_adapter {struct i2c_client *i2c_client;u32 rss_indir_tbl_init;u8 rss_indir_tbl[IGB_RETA_SIZE ]; +u8 rss_key[IGB_RSS_KEY_SIZE ];unsigned long link_check_timeout;int copper_tries;@@ -735,6 +737,7 @@ void igb_down(struct igb_adapter *);void igb_reinit_locked (struct igb_adapter *);void igb_reset (struct igb_adapter *);int igb_reinit_queues (struct igb_adapter *); +void igb_write_rss_key (struct igb_adapter *adapter);void igb_write_rss_indir_tbl (struct igb_adapter *);int igb_set_spd_dplx (struct igb_adapter *,u32 ,u8 );int igb_setup_tx_resources (struct igb_ring *);drivers/net/ethernet/intel/igb/igb_ethtool.c +0
-0@@ -3016,6 +3016,18 @@ static int igb_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd)return ret;
drivers/net/ethernet/intel/igb/igb_ethtool.c static int igb_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd) · line 3026
Quoted 10 lines
drivers/net/ethernet/intel/igb/igb_ethtool.c +8
-0} +void igb_write_rss_key (struct igb_adapter *adapter) +{ +struct e1000_hw *hw = &adapter->hw; +u32 val; +int i; + +for (i =0 ; i <IGB_RSS_KEY_SIZE /4 ; i++) { + val =get_unaligned_le32 (&adapter->rss_key[i *4 ]);
Why is get_unaligned_le32() needed?
drivers/net/ethernet/intel/igb/igb_ethtool.c static int igb_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd) · line 3027
Quoted 1 line
drivers/net/ethernet/intel/igb/igb_ethtool.c +1
-0+wr32 (E1000_RSSRK (i), val);
I probably wouldn’t get rid of val.
Quoted 13 lines
drivers/net/ethernet/intel/igb/igb_ethtool.c +3
-0+ } +} +static int igb_get_eee (struct net_device *netdev,struct ethtool_keee *edata) {struct igb_adapter *adapter =netdev_priv (netdev);drivers/net/ethernet/intel/igb/igb_main.c +0
-0@@ -4525,11 +4525,9 @@ static void igb_setup_mrqc(struct igb_adapter *adapter)struct e1000_hw *hw = &adapter->hw;u32 mrqc, rxcsum;
drivers/net/ethernet/intel/igb/igb_main.c static void igb_setup_mrqc(struct igb_adapter *adapter) · line 4532
Quoted 10 lines
drivers/net/ethernet/intel/igb/igb_main.c +2
-4u32 j, num_rx_queues; -u32 rss_key[10 ]; -netdev_rss_key_fill (rss_key,sizeof (rss_key)); -for (j =0 ; j <10 ; j++) -wr32 (E1000_RSSRK (j), rss_key[j]); +netdev_rss_key_fill (adapter->rss_key,sizeof (adapter->rss_key)); +igb_write_rss_key (adapter); num_rx_queues = adapter->rss_queues;
Kind regards,
Paul
Re: [Intel-wired-lan] [PATCH iwl-next v2 1/3] igb: prepare for RSS key get/set support
Quoted 67 lines
From: Paul Menzel <[email protected]>
To: Takashi Kozu <[email protected]>
Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected],
[email protected], [email protected],
Kohei Enju <[email protected]>
Subject: Re: [Intel-wired-lan] [PATCH iwl-next v2 1/3] igb: prepare for RSS key get/set support
Date: Thu, 8 Jan 2026 13:27:57 +0100 [thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>Dear Takashi,
Thank you for the patch.
Am 08.01.26 um 06:20 schrieb Takashi Kozu:
Quoted 49 lines
Store the RSS key inside struct
igb_adapterand introduce theigb_write_rss_key()helper function. This allows the driver to program the E1000 registers using a persistent RSS key, instead of using a stack-local buffer inigb_setup_mrqc().Tested-by Kohei Enju <[email protected]>Signed-off-by Takashi Kozu <[email protected]>---
drivers/net/ethernet/intel/igb/igb.h| 3 +++drivers/net/ethernet/intel/igb/igb_ethtool.c| 12 ++++++++++++drivers/net/ethernet/intel/igb/igb_main.c| 6 ++----3 files changed, 17 insertions(+), 4 deletions(-)drivers/net/ethernet/intel/igb/igb.h +3
-0@@ -495,6 +495,7 @@ struct hwmon_buff {#define IGB_N_PEROUT 2#define IGB_N_SDP 4#define IGB_RETA_SIZE 128 +#define IGB_RSS_KEY_SIZE 40enum igb_filter_match_flags {IGB_FILTER_FLAG_ETHER_TYPE =0x1 ,@@ -655,6 +656,7 @@ struct igb_adapter {struct i2c_client *i2c_client;u32 rss_indir_tbl_init;u8 rss_indir_tbl[IGB_RETA_SIZE ]; +u8 rss_key[IGB_RSS_KEY_SIZE ];unsigned long link_check_timeout;int copper_tries;@@ -735,6 +737,7 @@ void igb_down(struct igb_adapter *);void igb_reinit_locked (struct igb_adapter *);void igb_reset (struct igb_adapter *);int igb_reinit_queues (struct igb_adapter *); +void igb_write_rss_key (struct igb_adapter *adapter);void igb_write_rss_indir_tbl (struct igb_adapter *);int igb_set_spd_dplx (struct igb_adapter *,u32 ,u8 );int igb_setup_tx_resources (struct igb_ring *);drivers/net/ethernet/intel/igb/igb_ethtool.c +0
-0@@ -3016,6 +3016,18 @@ static int igb_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd)return ret; }
Quoted 10 lines
drivers/net/ethernet/intel/igb/igb_ethtool.c static int igb_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd)
Quoted 8 lines
drivers/net/ethernet/intel/igb/igb_ethtool.c +8
-0+void igb_write_rss_key (struct igb_adapter *adapter) +{ +struct e1000_hw *hw = &adapter->hw; +u32 val; +int i; + +for (i =0 ; i <IGB_RSS_KEY_SIZE /4 ; i++) { + val = get_unaligned_le32(&adapter->rss_key[i info.plist 4]);Why is
get_unaligned_le32()needed?
I think it's necessary in order to align to 4 bytes.
RE: [Intel-wired-lan] [PATCH iwl-next v2 1/3] igb: prepare for RSS key get/set support
In reply to Takashi KozuQuoted 45 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Takashi Kozu
Sent: Thursday, January 8, 2026 6:20 AM
To: Nguyen, Anthony L <[email protected]>
Cc: Kitszel, Przemyslaw <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Takashi Kozu <[email protected]>; Kohei Enju <[email protected]>
Subject: [Intel-wired-lan] [PATCH iwl-next v2 1/3] igb: prepare for RSS key get/set supportStore the RSS key inside struct
igb_adapterand introduce theigb_write_rss_key()helper function. This allows the driver to program the E1000 registers using a persistent RSS key, instead of using a stack-local buffer inigb_setup_mrqc().Tested-by Kohei Enju <[email protected]>Signed-off-by Takashi Kozu <[email protected]>---
drivers/net/ethernet/intel/igb/igb.h | 3 +++ drivers/net/ethernet/intel/igb/igb_ethtool.c | 12 ++++++++++++ drivers/net/ethernet/intel/igb/igb_main.c | 6 ++---- 3 files changed, 17 insertions(+), 4 deletions(-)drivers/net/ethernet/intel/igb/igb.h +3
-0@@ -495,6 +495,7 @@ struct hwmon_buff {#define IGB_N_PEROUT 2#define IGB_N_SDP 4#define IGB_RETA_SIZE 128 +#define IGB_RSS_KEY_SIZE 40enum igb_filter_match_flags {IGB_FILTER_FLAG_ETHER_TYPE =0x1 ,@@ -655,6 +656,7 @@ struct igb_adapter {struct i2c_client *i2c_client;u32 rss_indir_tbl_init;u8 rss_indir_tbl[IGB_RETA_SIZE ]; +u8 rss_key[IGB_RSS_KEY_SIZE ];unsigned long link_check_timeout;int copper_tries;@@ -735,6 +737,7 @@ void igb_down(struct igb_adapter *); void igb_reinit_locked(struct igb_adapter *); void igb_reset(struct igb_adapter *); int igb_reinit_queues(struct igb_adapter *); +void igb_write_rss_key (struct igb_adapter *adapter);void
igb_write_rss_indir_tbl(struct igb_adapter *); intigb_set_spd_dplx(struct igb_adapter *, u32, u8); intigb_setup_tx_resources(struct igb_ring *); diff --gita/drivers/net/ethernet/intel/igb/igb_ethtool.cb/drivers/net/ethernet/intel/igb/igb_ethtool.cindex10e2445e0ded..8695ff28a7b8100644
drivers/net/ethernet/intel/igb/igb_ethtool.c static int igb_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd) · line 3019
Quoted 4 lines
drivers/net/ethernet/intel/igb/igb_ethtool.c +1
-0@@ -3016,6 +3016,18 @@ static int igb_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd)return ret; } +void igb_write_rss_key (struct igb_adapter *adapter) {
Please add the kernel-doc header.
drivers/net/ethernet/intel/igb/igb_ethtool.c static int igb_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd) · line 3023
Quoted 3 lines
drivers/net/ethernet/intel/igb/igb_ethtool.c +3
-0+struct e1000_hw *hw = &adapter->hw; +u32 val; +int i;
Please consider declaring the the 'val' and 'i' within the scope of the 'for' loop. Piotr
Quoted 6 lines
drivers/net/ethernet/intel/igb/igb_ethtool.c +6
-0+ +for (i =0 ; i <IGB_RSS_KEY_SIZE /4 ; i++) { + val =get_unaligned_le32 (&adapter->rss_key[i *4 ]); +wr32 (E1000_RSSRK (i), val); + } +}
[...]
RE: [Intel-wired-lan] [PATCH iwl-next v2 1/3] igb: prepare for RSS key get/set support
In reply to Takashi KozuQuoted 101 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Takashi Kozu
Sent: Thursday, January 8, 2026 6:20 AM
To: Nguyen, Anthony L <[email protected]>
Cc: Kitszel, Przemyslaw <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Takashi Kozu <[email protected]>; Kohei Enju <[email protected]>
Subject: [Intel-wired-lan] [PATCH iwl-next v2 1/3] igb: prepare for RSS key get/set supportStore the RSS key inside struct
igb_adapterand introduce theigb_write_rss_key()helper function. This allows the driver to program the E1000 registers using a persistent RSS key, instead of using a stack-local buffer inigb_setup_mrqc().Tested-by Kohei Enju <[email protected]>Signed-off-by Takashi Kozu <[email protected]>--- drivers/net/ethernet/intel/igb/igb.h | 3 +++ drivers/net/ethernet/intel/igb/igb_ethtool.c | 12 ++++++++++++ drivers/net/ethernet/intel/igb/igb_main.c | 6 ++---- 3 files changed, 17 insertions(+), 4 deletions(-)drivers/net/ethernet/intel/igb/igb.h +2
-0@@ -495,6 +495,7 @@ struct hwmon_buff {#define IGB_N_PEROUT 2#define IGB_N_SDP 4#define IGB_RETA_SIZE 128 +#define IGB_RSS_KEY_SIZE 40enum igb_filter_match_flags {IGB_FILTER_FLAG_ETHER_TYPE =0x1 ,@@ -655,6 +656,7 @@ struct igb_adapter {struct i2c_client *i2c_client;u32 rss_indir_tbl_init;u8 rss_indir_tbl[IGB_RETA_SIZE ]; +u8 rss_key[IGB_RSS_KEY_SIZE ];unsigned long link_check_timeout;int copper_tries;@@ -735,6 +737,7 @@ void igb_down(struct igb_adapter *); void
igb_reinit_locked(struct igb_adapter *); voidigb_reset(struct igb_adapter *); intigb_reinit_queues(struct igb_adapter *); +voidigb_write_rss_key(struct igb_adapter *adapter);
voidigb_write_rss_indir_tbl(struct igb_adapter *); intigb_set_spd_dplx(struct igb_adapter *, u32, u8); intigb_setup_tx_resources(struct igb_ring *); diff --gita/drivers/net/ethernet/intel/igb/igb_ethtool.cb/drivers/net/ethernet/intel/igb/igb_ethtool.c
index10e2445e0ded..8695ff28a7b8100644drivers/net/ethernet/intel/igb/igb_ethtool.c +11
-0@@ -3016,6 +3016,18 @@ static int igb_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd)return ret; } +void igb_write_rss_key (struct igb_adapter *adapter) { +struct e1000_hw *hw = &adapter->hw; +u32 val; +int i; + +for (i =0 ; i <IGB_RSS_KEY_SIZE /4 ; i++) { + val =get_unaligned_le32 (&adapter->rss_key[i *4 ]); +wr32 (E1000_RSSRK (i), val); + } +} +static int igb_get_eee (struct net_device *netdev,struct ethtool_keee *edata) { struct igb_adapter *adapter = netdev_priv(netdev); diff --git
a/drivers/net/ethernet/intel/igb/igb_main.cb/drivers/net/ethernet/intel/igb/igb_main.c
index85f9589cc568..da0f550de605100644drivers/net/ethernet/intel/igb/igb_main.c +2
-4@@ -4525,11 +4525,9 @@ static void igb_setup_mrqc(struct igb_adapter *adapter)struct e1000_hw *hw = &adapter->hw;u32 mrqc, rxcsum;u32 j, num_rx_queues; -u32 rss_key[10 ]; -netdev_rss_key_fill (rss_key,sizeof (rss_key)); -for (j =0 ; j <10 ; j++) -wr32 (E1000_RSSRK (j), rss_key[j]); +netdev_rss_key_fill (adapter->rss_key,sizeof (adapter- >rss_key)); +igb_write_rss_key (adapter);
num_rx_queues=adapter->rss_queues;
Quoted 2 lines
--
2.52.0
PATCH v2 2/3 igb: expose RSS key via ethtool get_rxfh
In reply to Takashi KozuImplement igb_get_rxfh_key_size() and extend igb_get_rxfh() to return the RSS key to userspace.
This can be tested using ethtool -x <dev>.
--- drivers/net/ethernet/intel/igb/igb_ethtool.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/igb/igb_ethtool.c +12 -4
@@ -3285,11 +3285,13 @@ static int igb_get_rxfh(struct net_device *netdev,int i; rxfh->hfunc =ETH_RSS_HASH_TOP ; -if (!rxfh->indir) -return 0 ; -for (i =0 ; i <IGB_RETA_SIZE ; i++) - rxfh->indir[i] = adapter->rss_indir_tbl[i]; +if (rxfh->indir) +for (i =0 ; i <IGB_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 ; }
@@ -3328,6 +3330,11 @@ void igb_write_rss_indir_tbl(struct igb_adapter *adapter) } } +static u32 igb_get_rxfh_key_size (struct net_device *netdev) +{ +return IGB_RSS_KEY_SIZE ; +} +static int igb_set_rxfh (struct net_device *netdev,struct ethtool_rxfh_param *rxfh,struct netlink_ext_ack *extack)
@@ -3491,6 +3498,7 @@ static const struct ethtool_ops igb_ethtool_ops = { .get_module_eeprom = igb_get_module_eeprom, .get_rxfh_indir_size = igb_get_rxfh_indir_size, .get_rxfh = igb_get_rxfh, + .get_rxfh_key_size = igb_get_rxfh_key_size, .set_rxfh = igb_set_rxfh, .get_rxfh_fields = igb_get_rxfh_fields, .set_rxfh_fields = igb_set_rxfh_fields,
Signature · 1 line
2.52.0
RE: [Intel-wired-lan] [PATCH iwl-next v2 2/3] igb: expose RSS key via ethtool get_rxfh
Quoted 71 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Takashi Kozu
Sent: Thursday, January 8, 2026 6:20 AM
To: Nguyen, Anthony L <[email protected]>
Cc: Kitszel, Przemyslaw <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Takashi Kozu <[email protected]>; Kohei Enju <[email protected]>
Subject: [Intel-wired-lan] [PATCH iwl-next v2 2/3] igb: expose RSS key via ethtoolget_rxfhImplement
igb_get_rxfh_key_size()and extendigb_get_rxfh()to return the RSS key to userspace.This can be tested using
ethtool -x <dev>.Tested-by Kohei Enju <[email protected]>Signed-off-by Takashi Kozu <[email protected]>--- drivers/net/ethernet/intel/igb/igb_ethtool.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)drivers/net/ethernet/intel/igb/igb_ethtool.c +6
-4@@ -3285,11 +3285,13 @@ static int igb_get_rxfh(struct net_device *netdev, int i; rxfh->hfunc =ETH_RSS_HASH_TOP ; -if (!rxfh->indir) -return 0 ; -for (i =0 ; i <IGB_RETA_SIZE ; i++) - rxfh->indir[i] = adapter->rss_indir_tbl[i]; +if (rxfh->indir) +for (i =0 ; i <IGB_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 ;}
drivers/net/ethernet/intel/igb/igb_ethtool.c +5
-0@@ -3328,6 +3330,11 @@ void igb_write_rss_indir_tbl(struct igb_adapter *adapter) } } +static u32 igb_get_rxfh_key_size (struct net_device *netdev) { +return IGB_RSS_KEY_SIZE ; +} +static int igb_set_rxfh (struct net_device *netdev,struct ethtool_rxfh_param *rxfh,struct netlink_ext_ack *extack)@@ -3491,6 +3498,7 @@ static const struct ethtool_ops igb_ethtool_ops = { .get_module_eeprom = igb_get_module_eeprom, .get_rxfh_indir_size = igb_get_rxfh_indir_size, .get_rxfh = igb_get_rxfh, + .get_rxfh_key_size = igb_get_rxfh_key_size, .set_rxfh = igb_set_rxfh, .get_rxfh_fields = igb_get_rxfh_fields,
Quoted 3 lines
.set_rxfh_fields =
igb_set_rxfh_fields,
--
2.52.0
PATCH v2 3/3 igb: allow configuring RSS key via ethtool set_rxfh
In reply to Takashi KozuChange igb_set_rxfh() to accept and save a userspace-provided RSS key. When a key is provided, store it in the adapter and write the E1000 registers accordingly.
This can be tested using ethtool -X <dev> hkey <key>.
--- drivers/net/ethernet/intel/igb/igb.h | 1 + drivers/net/ethernet/intel/igb/igb_ethtool.c | 49 +++++++++++--------- drivers/net/ethernet/intel/igb/igb_main.c | 3 +- 3 files changed, 30 insertions(+), 23 deletions(-)
drivers/net/ethernet/intel/igb/igb.h +1 -0
@@ -657,6 +657,7 @@ struct igb_adapter {u32 rss_indir_tbl_init;u8 rss_indir_tbl[IGB_RETA_SIZE ];u8 rss_key[IGB_RSS_KEY_SIZE ]; +bool has_user_rss_key;unsigned long link_check_timeout;int copper_tries;
drivers/net/ethernet/intel/igb/igb_ethtool.c +27 -22
62 lines not on this page · raw message
drivers/net/ethernet/intel/igb/igb_main.c +2 -1
@@ -4526,7 +4526,8 @@ static void igb_setup_mrqc(struct igb_adapter *adapter)u32 mrqc, rxcsum;u32 j, num_rx_queues; -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));igb_write_rss_key (adapter); num_rx_queues = adapter->rss_queues;
Signature · 1 line
2.52.0
RE: [Intel-wired-lan] [PATCH iwl-next v2 3/3] igb: allow configuring RSS key via ethtool set_rxfh
Quoted 99 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Takashi Kozu
Sent: Thursday, January 8, 2026 6:20 AM
To: Nguyen, Anthony L <[email protected]>
Cc: Kitszel, Przemyslaw <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Takashi Kozu <[email protected]>; Kohei Enju <[email protected]>
Subject: [Intel-wired-lan] [PATCH iwl-next v2 3/3] igb: allow configuring RSS key via ethtoolset_rxfhChange
igb_set_rxfh()to accept and save a userspace-provided RSS key. When a key is provided, store it in the adapter and write the E1000 registers accordingly.This can be tested using
ethtool -X <dev> hkey <key>.Tested-by Kohei Enju <[email protected]>Signed-off-by Takashi Kozu <[email protected]>--- drivers/net/ethernet/intel/igb/igb.h | 1 + drivers/net/ethernet/intel/igb/igb_ethtool.c | 49 +++++++++++--------(quoted diff) +0
-1- drivers/net/ethernet/intel/igb/igb_main.c | 3 +- 3 files changed, 30 insertions(+), 23 deletions(-)drivers/net/ethernet/intel/igb/igb.h +1
-0@@ -657,6 +657,7 @@ struct igb_adapter {u32 rss_indir_tbl_init;u8 rss_indir_tbl[IGB_RETA_SIZE ];u8 rss_key[IGB_RSS_KEY_SIZE ]; +bool has_user_rss_key;unsigned long link_check_timeout;int copper_tries;drivers/net/ethernet/intel/igb/igb_ethtool.c +19
-21@@ -3345,35 +3345,40 @@ static int igb_set_rxfh(struct net_device *netdev, u32 num_queues;/* 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; -switch (hw->mac.type) { -case e1000_82576: -/* 82576 supports 2 RSS queues for SR-IOV */ -if (adapter->vfs_allocated_count) - num_queues =2 ; -break ; -default : -break ; - } +switch (hw->mac.type) { +case e1000_82576: +/* 82576 supports 2 RSS queues for SR-IOV */ +if (adapter->vfs_allocated_count) + num_queues =2 ; +break ; +default : +break ; + } -/* Verify user input. */ -for (i =0 ; i <IGB_RETA_SIZE ; i++) -if (rxfh->indir[i] >= num_queues) -return -EINVAL ; +/* Verify user input. */ +for (i =0 ; i <IGB_RETA_SIZE ; i++) +if (rxfh->indir[i] >= num_queues) +return -EINVAL ; -for (i =0 ; i <IGB_RETA_SIZE ; i++) - adapter->rss_indir_tbl[i] = rxfh->indir[i]; +for (i =0 ; i <IGB_RETA_SIZE ; i++) + adapter->rss_indir_tbl[i] = rxfh->indir[i];
drivers/net/ethernet/intel/igb/igb_ethtool.c static int igb_set_rxfh(struct net_device · line 3382
Quoted 10 lines
drivers/net/ethernet/intel/igb/igb_ethtool.c +7
-1+ +igb_write_rss_indir_tbl (adapter); + } -igb_write_rss_indir_tbl (adapter); +if (rxfh->key) { + adapter->has_user_rss_key = true; +memcpy (adapter->rss_key, rxfh->key,sizeof (adapter- >rss_key)); +igb_write_rss_key (adapter);
It leads to race between ethtool RSS update and concurrent resets. Because igb_setup_mrqc() (called during resets) also calls igb_write_rss_key(adapter). Non-fatal but breaks RSS configuration guarantees.
I think ethtool can/should wait of reset/watchdog task to finish.
I'm against adding locks, and just my personal opinion, it's better to implement igb_rss_key_update_task() in addition to reset and watchdog tasks to be used both in reset and ethtool path.
What do you think?
Quoted 24 lines
drivers/net/ethernet/intel/igb/igb_ethtool.c +1
-0+ }drivers/net/ethernet/intel/igb/igb_ethtool.c +0
-0return 0 ; }drivers/net/ethernet/intel/igb/igb_main.c +2
-1@@ -4526,7 +4526,8 @@ static void igb_setup_mrqc(struct igb_adapter *adapter)u32 mrqc, rxcsum;u32 j, num_rx_queues; -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/igb/igb_main.c +0
-1igb_write_rss_key (adapter); num_rx_queues = adapter->rss_queues; --2.52.0
Re: RE: [Intel-wired-lan] [PATCH iwl-next v2 3/3] igb: allow configuring RSS key via ethtool set_rxfh
Quoted 10 lines · Aleksandr
drivers/net/ethernet/intel/igb/igb_ethtool.c static int igb_set_rxfh(struct net_device *netdev, · line 3380
Quoted 7 lines
drivers/net/ethernet/intel/igb/igb_ethtool.c +3
-1-igb_write_rss_indir_tbl (adapter); +if (rxfh->key) { + adapter->has_user_rss_key = true; + memcpy(adapter->rss_key, rxfh->key, sizeof(adapter-Quoted 1 line
rss_key));drivers/net/ethernet/intel/igb/igb_ethtool.c +1
-0+igb_write_rss_key (adapter);It leads to race between ethtool RSS update and concurrent resets. Because
igb_setup_mrqc()(called during resets) also callsigb_write_rss_key(adapter). Non-fatal but breaks RSS configuration guarantees.
At my first glance, rtnl lock serializes those operation, so it doesn't seem to be racy as long as they are under the rtnl lock.
As far as I skimmed the codes, functions such as igb_open()/ igb_up()/igb_reset_task(), which finally call igb_write_rss_key() are serialized by rtnl lock or serializes igb_write_rss_key() call by locking rtnl.
Please let me know if I'm missing something and it's truly racy.
Quoted 5 lines
I think ethtool can/should wait of reset/watchdog task to finish.
I'm against adding locks, and just my personal opinion, it's better to implementigb_rss_key_update_task()in addition to reset and watchdog tasks to be used both in reset and ethtool path.What do you think?
Loktionov, Aleksandr
Reviewed-byRE: RE: [Intel-wired-lan] [PATCH iwl-next v2 3/3] igb: allow configuring RSS key via ethtool set_rxfh
Quoted 32 lines
-----Original Message-----
From: Kohei Enju <[email protected]>
Sent: Thursday, January 8, 2026 1:04 PM
To: Loktionov, Aleksandr <[email protected]>
Cc: [email protected]; Nguyen, Anthony L <[email protected]>; [email protected]; [email protected]; [email protected]; intel-wired- [email protected]; [email protected]; [email protected]; [email protected]; Kitszel, Przemyslaw <[email protected]>; [email protected]
Subject: Re: RE: [Intel-wired-lan] [PATCH iwl-next v2 3/3] igb: allow configuring RSS key via ethtoolset_rxfhQuoted 9 lines · Aleksandr
drivers/net/ethernet/intel/igb/igb_ethtool.c static int igb_set_rxfh(struct net_device *netdev, · line 3380
Quoted 7 lines
drivers/net/ethernet/intel/igb/igb_ethtool.c +3
-1-igb_write_rss_indir_tbl (adapter); +if (rxfh->key) { + adapter->has_user_rss_key = true; + memcpy(adapter->rss_key, rxfh->key, sizeof(adapter-Quoted 1 line
rss_key));drivers/net/ethernet/intel/igb/igb_ethtool.c +1
-0+igb_write_rss_key (adapter);It leads to race between ethtool RSS update and concurrent resets. Because
igb_setup_mrqc()(called during resets) also calls
igb_write_rss_key(adapter).Quoted 1 line
Non-fatal but breaks RSS configuration guarantees.
At my first glance, rtnl lock serializes those operation, so it doesn't seem to be racy as long as they are under the rtnl lock.
Quoted 6 lines
As far as I skimmed the codes, functions such as igb_open()/ igb_up()/igb_reset_task(), which finally call
igb_write_rss_key()are serialized by rtnl lock or serializesigb_write_rss_key()call by locking rtnl.Please let me know if I'm missing something and it's truly racy.
I think you're right, and I've missed that missing rtnl_lock was added in upstream.
Thank you for clarification
Quoted 8 lines
Quoted 4 lines
I think ethtool can/should wait of reset/watchdog task to finish. I'm against adding locks, and just my personal opinion, it's better
to implement
igb_rss_key_update_task()in addition to reset and watchdog tasks to be used both in reset and ethtool path.Quoted 2 lines
What do you think?
RE: [Intel-wired-lan] [PATCH iwl-next v2 3/3] igb: allow configuring RSS key via ethtool set_rxfh
Quoted 55 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Loktionov, Aleksandr
Sent: Thursday, January 8, 2026 1:28 PM
To: Kohei Enju <[email protected]>
Cc: [email protected]; Nguyen, Anthony L <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Kitszel, Przemyslaw <[email protected]>; [email protected]
Subject: Re: [Intel-wired-lan] [PATCH iwl-next v2 3/3] igb: allow configuring RSS key via ethtoolset_rxfhQuoted 9 lines
-----Original Message-----
From: Kohei Enju <[email protected]>
Sent: Thursday, January 8, 2026 1:04 PM
To: Loktionov, Aleksandr <[email protected]>
Cc: [email protected]; Nguyen, Anthony L <[email protected]>; [email protected]; [email protected]; [email protected]; intel-wired- [email protected]; [email protected]; [email protected]; [email protected]; Kitszel, PrzemyslawQuoted 2 lines
[email protected]
Subject: Re: RE: [Intel-wired-lan] [PATCH iwl-next v2 3/3] igb:allow
Quoted 13 lines
configuring RSS key via ethtool
set_rxfhQuoted 9 lines · Aleksandr
drivers/net/ethernet/intel/igb/igb_ethtool.c static int igb_set_rxfh(struct net_device *netdev, · line 3380
Quoted 7 lines
drivers/net/ethernet/intel/igb/igb_ethtool.c +3
-1-igb_write_rss_indir_tbl (adapter); +if (rxfh->key) { + adapter->has_user_rss_key = true; + memcpy(adapter->rss_key, rxfh->key, sizeof(adapter-Quoted 1 line
rss_key));drivers/net/ethernet/intel/igb/igb_ethtool.c +1
-0+igb_write_rss_key (adapter);It leads to race between ethtool RSS update and concurrent resets. Because
igb_setup_mrqc()(called during resets) also callsQuoted 8 lines
igb_write_rss_key(adapter).Quoted 1 line
Non-fatal but breaks RSS configuration guarantees.
At my first glance, rtnl lock serializes those operation, so it doesn't seem to be racy as long as they are under the rtnl lock.
As far as I skimmed the codes, functions such as igb_open()/ igb_up()/igb_reset_task(), which finally call
igb_write_rss_key()are
Quoted 3 lines
serialized by rtnl lock or serializes
igb_write_rss_key()call by locking rtnl.
Quoted 7 lines
Quoted 1 line
Please let me know if I'm missing something and it's truly racy.
I think you're right, and I've missed that missing
rtnl_lockwas added in upstream.Thank you for clarification
Reviewed-by Aleksandr Loktionov <[email protected]>
Afterthought, I think it could be nice to place ASSERT_RTNL() to show it explicitly. What do you think about this idea?
Re: [Intel-wired-lan] [PATCH iwl-next v2 3/3] igb: allow configuring RSS key via ethtool set_rxfh
Quoted 79 lines
-----Original Message-----
From: "Loktionov, Aleksandr" <[email protected]>
To: "Loktionov, Aleksandr" <[email protected]>,
Kohei Enju <[email protected]>
Cc: "[email protected]" <[email protected]>,
"Nguyen, Anthony L" <[email protected]>,
"[email protected]" <[email protected]>,
"[email protected]" <[email protected]>,
"[email protected]"
<[email protected]>,
"[email protected]" <[email protected]>,
"[email protected]" <[email protected]>,
"[email protected]" <[email protected]>,
"Kitszel, Przemyslaw" <[email protected]>,
"[email protected]" <[email protected]>
Subject: Re: [Intel-wired-lan] [PATCH iwl-next v2 3/3] igb: allow configuring RSS key via ethtoolset_rxfh
Date: Thu, 8 Jan 2026 13:03:12 +0000 [thread overview]
Message-ID: <IA3PR11MB898612B0CDA9C5A5448733EEE585A@IA3PR11MB8986.namprd11.prod.outlook.com> (raw)
In-Reply-To: <IA3PR11MB89865D0189D37BB3393B57F5E585A@IA3PR11MB8986.namprd11.prod.outlook.com>Quoted 57 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Loktionov, Aleksandr
Sent: Thursday, January 8, 2026 1:28 PM
To: Kohei Enju <[email protected]>
Cc: [email protected]; Nguyen, Anthony L <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Kitszel, Przemyslaw <[email protected]>; [email protected]
Subject: Re: [Intel-wired-lan] [PATCH iwl-next v2 3/3] igb: allow configuring RSS key via ethtoolset_rxfhQuoted 9 lines
-----Original Message-----
From: Kohei Enju <[email protected]>
Sent: Thursday, January 8, 2026 1:04 PM
To: Loktionov, Aleksandr <[email protected]>
Cc: [email protected]; Nguyen, Anthony L <[email protected]>; [email protected]; [email protected]; [email protected]; intel-wired- [email protected]; [email protected]; [email protected]; [email protected]; Kitszel, PrzemyslawQuoted 2 lines
[email protected]
Subject: Re: RE: [Intel-wired-lan] [PATCH iwl-next v2 3/3] igb:allow
Quoted 13 lines
configuring RSS key via ethtool
set_rxfhQuoted 9 lines · Aleksandr
Quoted 7 lines
-
igb_write_rss_indir_tbl(adapter);
+ if (rxfh->key) {
+adapter->has_user_rss_key= true;
+ memcpy(adapter->rss_key,rxfh->key, sizeof(adapter-Quoted 1 line
rss_key));+
igb_write_rss_key(adapter);It leads to race between ethtool RSS update and concurrent resets. Because
igb_setup_mrqc()(called during resets) also callsQuoted 8 lines
igb_write_rss_key(adapter).Quoted 1 line
Non-fatal but breaks RSS configuration guarantees.
At my first glance, rtnl lock serializes those operation, so it doesn't seem to be racy as long as they are under the rtnl lock.
As far as I skimmed the codes, functions such as igb_open()/ igb_up()/igb_reset_task(), which finally call
igb_write_rss_key()are
Quoted 4 lines
serialized by rtnl lock or serializes
igb_write_rss_key()call by locking rtnl.Please let me know if I'm missing something and it's truly racy.
I think you're right, and I've missed that missing
rtnl_lockwas added in upstream.
Quoted 6 lines
Quoted 3 lines
Thank you for clarification
Reviewed-by Aleksandr Loktionov <[email protected]>Afterthought, I think it could be nice to place
ASSERT_RTNL()to show it explicitly. What do you think about this idea?
Sorry for the late reply.
I think it's a good idea. I will add ASSERT_RTNL().
Jakub Kicinski
maintainerRe: [PATCH iwl-next v2 3/3] igb: allow configuring RSS key via ethtool set_rxfh
In reply to Takashi Kozudrivers/net/ethernet/intel/igb/igb_main.c static void igb_setup_mrqc(struct igb_adapter *adapter) · line 4531
Quoted 12 lines · On Thu, 8 Jan 2026 14:20:15 +0900 Takashi Kozu wrote:
drivers/net/ethernet/intel/igb/igb_main.c +2
-1@@ -4526,7 +4526,8 @@ static void igb_setup_mrqc(struct igb_adapter *adapter)u32 mrqc, rxcsum;u32 j, num_rx_queues; -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));igb_write_rss_key (adapter);
This is an unusual construct. adapter->rss_key is driver state, does something wipe it? It's normal to have to write the key into the device after reset but initializing the driver state is usually done at probe, just once. Then you don't have to worry whether the state is coming from random or user.
Note that netdev_rss_key_fill() initializes its state once per boot so it will not change its 'return' value without reboot.
Last but not least - would you be able to run:
tools/testing/selftests/drivers/net/hw/toeplitz.py tools/testing/selftests/drivers/net/hw/rss_api.py
against this device? Some more help:
https://github.com/linux-netdev/nipa/wiki/Running-driver-tests