Skip to contentSkip to conversation

ixgbe: preserve RSS indirection table across admin down/up

PATCH Superseded Kohei Enju 2 participants 4 messages Aug 28, 2025

Subsystems (3)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Kohei Enju

author
#0 lore raw

PATCH v2 1/1 ixgbe: preserve RSS indirection table across admin down/up

Currently, the RSS indirection table configured by user via ethtool is reinitialized to default values during interface resets (e.g., admin down/up, MTU change). As for RSS hash key, commit 3dfbfc7ebb95 ("ixgbe:
Check for RSS key before setting value") made it persistent across interface resets.

Adopt the same approach used in igc and igb drivers which reinitializes the RSS indirection table only when the queue count changes. Since the number of RETA entries can also change in ixgbe, let's make user configuration persistent as long as both queue count and the number of RETA entries remain unchanged.

Tested on Intel Corporation 82599ES 10-Gigabit SFI/SFP+ Network Connection.

Test:
Set custom indirection table and check the value after interface down/up

  # ethtool --set-rxfh-indir ens5 equal 2
  # ethtool --show-rxfh-indir ens5 | head -5

RX flow hash indirection table for ens5 with 12 RX ring(s):

      0:      0     1     0     1     0     1     0     1
      8:      0     1     0     1     0     1     0     1
     16:      0     1     0     1     0     1     0     1
  # ip link set dev ens5 down && ip link set dev ens5 up

Without patch:

  # ethtool --show-rxfh-indir ens5 | head -5

RX flow hash indirection table for ens5 with 12 RX ring(s):

      0:      0     1     2     3     4     5     6     7
      8:      8     9    10    11     0     1     2     3
     16:      4     5     6     7     8     9    10    11

With patch:

  # ethtool --show-rxfh-indir ens5 | head -5

RX flow hash indirection table for ens5 with 12 RX ring(s):

      0:      0     1     0     1     0     1     0     1
      8:      0     1     0     1     0     1     0     1
     16:      0     1     0     1     0     1     0     1

---
Changes:
v1->v2:
- add check for reta_entries in addition to rss_i
- update the commit message to reflect the additional check
v1: https://lore.kernel.org/intel-wired-lan/[email protected]/

---
 drivers/net/ethernet/intel/ixgbe/ixgbe.h      |  2 +
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 41 +++++++++++++------
 2 files changed, 31 insertions(+), 12 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe.h +2 -0
index 14d275270123..da3b23bdcce1 100644
@@ -838,6 +838,8 @@ struct ixgbe_adapter {
  */
 #define IXGBE_MAX_RETA_ENTRIES 512
 	u8 rss_indir_tbl[IXGBE_MAX_RETA_ENTRIES];
+	u32 last_reta_entries;
+	u16 last_rss_i;
 
 #define IXGBE_RSS_KEY_SIZE     40  /* size of RSS Hash Key in bytes */
 	u32 *rss_key;
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +29 -12

63 lines not on this page · raw message

Signature · 1 line
2.51.0
#1 lore raw
Quoted 85 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Kohei Enju
Sent: Thursday, August 28, 2025 6:01 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 v2] ixgbe: preserve RSS indirection table across admin down/up

Currently, the RSS indirection table configured by user via ethtool is
reinitialized to default values during interface resets (e.g., admin down/up, MTU change). As for RSS hash key, commit 3dfbfc7ebb95 ("ixgbe:
Check for RSS key before setting value") made it persistent across interface resets.

Adopt the same approach used in igc and igb drivers which reinitializes
the RSS indirection table only when the queue count changes. Since the
number of RETA entries can also change in ixgbe, let's make user configuration persistent as long as both queue count and the number of
RETA entries remain unchanged.

Tested on Intel Corporation 82599ES 10-Gigabit SFI/SFP+ Network Connection.

Test:
Set custom indirection table and check the value after interface down/up

  # ethtool --set-rxfh-indir ens5 equal 2
  # ethtool --show-rxfh-indir ens5 | head -5

RX flow hash indirection table for ens5 with 12 RX ring(s):

      0:      0     1     0     1     0     1     0     1
      8:      0     1     0     1     0     1     0     1
     16:      0     1     0     1     0     1     0     1
  # ip link set dev ens5 down && ip link set dev ens5 up

Without patch:

  # ethtool --show-rxfh-indir ens5 | head -5

RX flow hash indirection table for ens5 with 12 RX ring(s):

      0:      0     1     2     3     4     5     6     7
      8:      8     9    10    11     0     1     2     3
     16:      4     5     6     7     8     9    10    11

With patch:

  # ethtool --show-rxfh-indir ens5 | head -5

RX flow hash indirection table for ens5 with 12 RX ring(s):

      0:      0     1     0     1     0     1     0     1
      8:      0     1     0     1     0     1     0     1
     16:      0     1     0     1     0     1     0     1

---
Changes:
v1->v2:
- add check for reta_entries in addition to rss_i
- update the commit message to reflect the additional check
v1: https://lore.kernel.org/intel-wired-lan/20250824112037.32692-
[email protected]/

---
 drivers/net/ethernet/intel/ixgbe/ixgbe.h      |  2 +
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 41 +++++++++++++---
---
 2 files changed, 31 insertions(+), 12 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe.h +0 -0
index 14d275270123..da3b23bdcce1 100644

drivers/net/ethernet/intel/ixgbe/ixgbe.h struct ixgbe_adapter { · line 842

Quoted 5 lines
drivers/net/ethernet/intel/ixgbe/ixgbe.h +2 -0
@@ -838,6 +838,8 @@ struct ixgbe_adapter {
  */
 #define IXGBE_MAX_RETA_ENTRIES 512
 	u8 rss_indir_tbl[IXGBE_MAX_RETA_ENTRIES];
+	u32 last_reta_entries;
+	u16 last_rss_i;

last_rss_i is cryptic; please, consider last_rss_indices (or similar)

Quoted 21 lines
drivers/net/ethernet/intel/ixgbe/ixgbe.h +0 -0
 #define IXGBE_RSS_KEY_SIZE     40  /* size of RSS Hash Key in bytes
 */
 	u32 *rss_key;
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +2 -2
index 27040076f068..05dfb06173d4 100644
@@ -4323,14 +4323,21 @@ static void ixgbe_setup_reta(struct
 ixgbe_adapter *adapter)
 	/* Fill out hash function seeds */
 	ixgbe_store_key(adapter);
 
-	/* Fill out redirection table */
-	memset(adapter->rss_indir_tbl, 0, sizeof(adapter-
 >rss_indir_tbl));
+	/* Update redirection table in memory on first init, queue
 count change,
+	 * or reta entries change, otherwise preserve user

configurations. Then

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c static void ixgbe_setup_reta(struct ixgbe_adapter *adapter) · line 4332

Quoted 5 lines
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +5 -0
+	 * always write to hardware.
+	 */
+	if (adapter->last_rss_i != rss_i ||
+	    adapter->last_reta_entries != reta_entries) {
+		for (i = 0, j = 0; i < reta_entries; i++, j++) {

You can avoid the top-of-loop equality test by using modulo, which reads easier, like:
for (i = 0, j = 0; i < reta_entries; i++, j++)

    adapter->rss_indir_tbl[i] = j % rss_i;
Quoted 16 lines
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +6 -4
+			if (j == rss_i)
+				j = 0;
 
-	for (i = 0, j = 0; i < reta_entries; i++, j++) {
-		if (j == rss_i)
-			j = 0;
+			adapter->rss_indir_tbl[i] = j;
+		}
 
-		adapter->rss_indir_tbl[i] = j;
+		adapter->last_rss_i = rss_i;
+		adapter->last_reta_entries = reta_entries;
 	}
 
 	ixgbe_store_reta(adapter);

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c static void ixgbe_setup_reta(struct · line 4351

Quoted 8 lines
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +2 -1
@@ -4338,8 +4345,9 @@ static void ixgbe_setup_reta(struct
 ixgbe_adapter *adapter)
 
 static void ixgbe_setup_vfreta(struct ixgbe_adapter *adapter)
 {
-	struct ixgbe_hw *hw = &adapter->hw;
 	u16 rss_i = adapter->ring_feature[RING_F_RSS].indices;
+	struct ixgbe_hw *hw = &adapter->hw;
+	u32 reta_entries = 64;

Magic number. Can you #define IXGBE_VFRETA_ENTRIES 64 ?

Quoted 35 lines
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +0 -0
 	int i, j;
 
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +2 -4
 	/* Fill out hash function seeds */
@@ -4352,12 +4360,21 @@ static void ixgbe_setup_vfreta(struct
 ixgbe_adapter *adapter)
 					*(adapter->rss_key + i));
 	}
 
-	/* Fill out the redirection table */
-	for (i = 0, j = 0; i < 64; i++, j++) {
-		if (j == rss_i)
-			j = 0;
+	/* Update redirection table in memory on first init, queue
 count change,
+	 * or reta entries change, otherwise preserve user

configurations. Then

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +12 -2
+	 * always write to hardware.
+	 */
+	if (adapter->last_rss_i != rss_i ||
+	    adapter->last_reta_entries != reta_entries) {
+		for (i = 0, j = 0; i < reta_entries; i++, j++) {
+			if (j == rss_i)
+				j = 0;
+
+			adapter->rss_indir_tbl[i] = j;
+		}
 
-		adapter->rss_indir_tbl[i] = j;
+		adapter->last_rss_i = rss_i;
+		adapter->last_reta_entries = reta_entries;
 	}
 
 	ixgbe_store_vfreta(adapter);
--

2.51.0

author
#2 lore raw
Quoted 79 lines · Aleksandr
Quoted 79 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Kohei Enju
Sent: Thursday, August 28, 2025 6:01 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 v2] ixgbe: preserve RSS indirection table across admin down/up

Currently, the RSS indirection table configured by user via ethtool is
reinitialized to default values during interface resets (e.g., admin down/up, MTU change). As for RSS hash key, commit 3dfbfc7ebb95 ("ixgbe:
Check for RSS key before setting value") made it persistent across interface resets.

Adopt the same approach used in igc and igb drivers which reinitializes
the RSS indirection table only when the queue count changes. Since the
number of RETA entries can also change in ixgbe, let's make user configuration persistent as long as both queue count and the number of
RETA entries remain unchanged.

Tested on Intel Corporation 82599ES 10-Gigabit SFI/SFP+ Network Connection.

Test:
Set custom indirection table and check the value after interface down/up

  # ethtool --set-rxfh-indir ens5 equal 2
  # ethtool --show-rxfh-indir ens5 | head -5

RX flow hash indirection table for ens5 with 12 RX ring(s):

      0:      0     1     0     1     0     1     0     1
      8:      0     1     0     1     0     1     0     1
     16:      0     1     0     1     0     1     0     1
  # ip link set dev ens5 down && ip link set dev ens5 up

Without patch:

  # ethtool --show-rxfh-indir ens5 | head -5

RX flow hash indirection table for ens5 with 12 RX ring(s):

      0:      0     1     2     3     4     5     6     7
      8:      8     9    10    11     0     1     2     3
     16:      4     5     6     7     8     9    10    11

With patch:

  # ethtool --show-rxfh-indir ens5 | head -5

RX flow hash indirection table for ens5 with 12 RX ring(s):

      0:      0     1     0     1     0     1     0     1
      8:      0     1     0     1     0     1     0     1
     16:      0     1     0     1     0     1     0     1

---
Changes:
v1->v2:
- add check for reta_entries in addition to rss_i
- update the commit message to reflect the additional check
v1: https://lore.kernel.org/intel-wired-lan/20250824112037.32692-
[email protected]/

---
 drivers/net/ethernet/intel/ixgbe/ixgbe.h      |  2 +
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 41 +++++++++++++---
---
 2 files changed, 31 insertions(+), 12 deletions(-)
Quoted 12 lines

drivers/net/ethernet/intel/ixgbe/ixgbe.h struct ixgbe_adapter { · line 842

Quoted 11 lines
drivers/net/ethernet/intel/ixgbe/ixgbe.h +2 -0
index 14d275270123..da3b23bdcce1 100644
@@ -838,6 +838,8 @@ struct ixgbe_adapter {
  */
 #define IXGBE_MAX_RETA_ENTRIES 512
 	u8 rss_indir_tbl[IXGBE_MAX_RETA_ENTRIES];
+	u32 last_reta_entries;
+	u16 last_rss_i;

last_rss_i is cryptic; please, consider last_rss_indices (or similar)

Sure, I'll rename it to last_rss_indices for clarity.

Quoted 29 lines
Quoted 22 lines
drivers/net/ethernet/intel/ixgbe/ixgbe.h +0 -0
 #define IXGBE_RSS_KEY_SIZE     40  /* size of RSS Hash Key in bytes
 */
 	u32 *rss_key;
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +2 -2
index 27040076f068..05dfb06173d4 100644
@@ -4323,14 +4323,21 @@ static void ixgbe_setup_reta(struct
 ixgbe_adapter *adapter)
 	/* Fill out hash function seeds */
 	ixgbe_store_key(adapter);
 
-	/* Fill out redirection table */
-	memset(adapter->rss_indir_tbl, 0, sizeof(adapter-
 >rss_indir_tbl));
+	/* Update redirection table in memory on first init, queue
 count change,
+	 * or reta entries change, otherwise preserve user

configurations. Then

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c static void ixgbe_setup_reta(struct ixgbe_adapter *adapter) · line 4332

Quoted 5 lines
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +5 -0
+	 * always write to hardware.
+	 */
+	if (adapter->last_rss_i != rss_i ||
+	    adapter->last_reta_entries != reta_entries) {
+		for (i = 0, j = 0; i < reta_entries; i++, j++) {

You can avoid the top-of-loop equality test by using modulo, which reads easier, like:
for (i = 0, j = 0; i < reta_entries; i++, j++)

Quoted 1 line
    adapter->rss_indir_tbl[i] = j % rss_i;

I got it. I'll use modulo and then j can be removed like:

    for (i = 0; i < reta_entries; i++)
           adapter->rss_indir_tbl[i] = i % rss_i;
Quoted 19 lines
Quoted 19 lines
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +6 -4
+			if (j == rss_i)
+				j = 0;
 
-	for (i = 0, j = 0; i < reta_entries; i++, j++) {
-		if (j == rss_i)
-			j = 0;
+			adapter->rss_indir_tbl[i] = j;
+		}
 
-		adapter->rss_indir_tbl[i] = j;
+		adapter->last_rss_i = rss_i;
+		adapter->last_reta_entries = reta_entries;
 	}
 
 	ixgbe_store_reta(adapter);
@@ -4338,8 +4345,9 @@ static void ixgbe_setup_reta(struct
 ixgbe_adapter *adapter)
 
Quoted 7 lines

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c static void ixgbe_setup_reta(struct ixgbe_adapter *adapter) · line 4350

Quoted 6 lines
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +2 -1
 static void ixgbe_setup_vfreta(struct ixgbe_adapter *adapter)
 {
-	struct ixgbe_hw *hw = &adapter->hw;
 	u16 rss_i = adapter->ring_feature[RING_F_RSS].indices;
+	struct ixgbe_hw *hw = &adapter->hw;
+	u32 reta_entries = 64;

Magic number. Can you #define IXGBE_VFRETA_ENTRIES 64 ?

You're right about the magic number.
I see it was introduced in commit 0f9b232b176d ("ixgbe: add support for X550 extended RSS support").

I'm considering using ixgbe_rss_indir_tbl_entries() instead of #define to avoid the magic number, since ixgbe_store_vfreta() already uses it. This would ensure consistency between the two functions. Would that be acceptable, or would you prefer a #define?

Quoted 36 lines
Quoted 36 lines
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +0 -0
 	int i, j;
 
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +2 -4
 	/* Fill out hash function seeds */
@@ -4352,12 +4360,21 @@ static void ixgbe_setup_vfreta(struct
 ixgbe_adapter *adapter)
 					*(adapter->rss_key + i));
 	}
 
-	/* Fill out the redirection table */
-	for (i = 0, j = 0; i < 64; i++, j++) {
-		if (j == rss_i)
-			j = 0;
+	/* Update redirection table in memory on first init, queue
 count change,
+	 * or reta entries change, otherwise preserve user

configurations. Then

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +12 -2
+	 * always write to hardware.
+	 */
+	if (adapter->last_rss_i != rss_i ||
+	    adapter->last_reta_entries != reta_entries) {
+		for (i = 0, j = 0; i < reta_entries; i++, j++) {
+			if (j == rss_i)
+				j = 0;
+
+			adapter->rss_indir_tbl[i] = j;
+		}
 
-		adapter->rss_indir_tbl[i] = j;
+		adapter->last_rss_i = rss_i;
+		adapter->last_reta_entries = reta_entries;
 	}
 
 	ixgbe_store_vfreta(adapter);
--

2.51.0

#3 lore raw
Quoted 190 lines

-----Original Message-----
From: Kohei Enju <[email protected]>
Sent: Thursday, August 28, 2025 7:41 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]; [email protected]; Kitszel, Przemyslaw <[email protected]>
Subject: Re: [Intel-wired-lan] [PATCH iwl-next v2] ixgbe: preserve RSS indirection table across admin down/up

Quoted 4 lines · Aleksandr
Quoted 4 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On

Behalf

Quoted 6 lines
Quoted 6 lines

Of Kohei Enju
Sent: Thursday, August 28, 2025 6:01 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

Quoted 2 lines
Quoted 2 lines

Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>; [email protected]; Kohei

Enju

Quoted 2 lines
Quoted 2 lines

<[email protected]>
Subject: [Intel-wired-lan] [PATCH iwl-next v2] ixgbe: preserve

RSS

Quoted 3 lines
Quoted 3 lines

indirection table across admin down/up

Currently, the RSS indirection table configured by user via

ethtool

Quoted 1 line
Quoted 1 line

is reinitialized to default values during interface resets

(e.g.,

Quoted 1 line
Quoted 1 line

admin down/up, MTU change). As for RSS hash key, commit

3dfbfc7ebb95

Quoted 2 lines
Quoted 2 lines

("ixgbe:
Check for RSS key before setting value") made it persistent

across

Quoted 4 lines
Quoted 4 lines

interface resets.

Adopt the same approach used in igc and igb drivers which reinitializes the RSS indirection table only when the queue

count

Quoted 1 line
Quoted 1 line

changes. Since the number of RETA entries can also change in

ixgbe,

Quoted 1 line
Quoted 1 line

let's make user configuration persistent as long as both queue

count

Quoted 34 lines
Quoted 34 lines

and the number of RETA entries remain unchanged.

Tested on Intel Corporation 82599ES 10-Gigabit SFI/SFP+ Network Connection.

Test:
Set custom indirection table and check the value after interface down/up

  # ethtool --set-rxfh-indir ens5 equal 2
  # ethtool --show-rxfh-indir ens5 | head -5

RX flow hash indirection table for ens5 with 12 RX ring(s):

      0:      0     1     0     1     0     1     0     1
      8:      0     1     0     1     0     1     0     1
     16:      0     1     0     1     0     1     0     1
  # ip link set dev ens5 down && ip link set dev ens5 up

Without patch:

  # ethtool --show-rxfh-indir ens5 | head -5

RX flow hash indirection table for ens5 with 12 RX ring(s):

      0:      0     1     2     3     4     5     6     7
      8:      8     9    10    11     0     1     2     3
     16:      4     5     6     7     8     9    10    11

With patch:

  # ethtool --show-rxfh-indir ens5 | head -5

RX flow hash indirection table for ens5 with 12 RX ring(s):

      0:      0     1     0     1     0     1     0     1
      8:      0     1     0     1     0     1     0     1
     16:      0     1     0     1     0     1     0     1
Quoted 7 lines
Quoted 7 lines

---
Changes:
v1->v2:
- add check for reta_entries in addition to rss_i
- update the commit message to reflect the additional check
v1: https://lore.kernel.org/intel-wired-

lan/20250824112037.32692-

Quoted 4 lines
Quoted 4 lines

[email protected]/

---
 drivers/net/ethernet/intel/ixgbe/ixgbe.h      |  2 +
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 41

+++++++++++++---

Quoted 15 lines
Quoted 9 lines

---

 2 files changed, 31 insertions(+), 12 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe.h +0 -0
index 14d275270123..da3b23bdcce1 100644

drivers/net/ethernet/intel/ixgbe/ixgbe.h struct ixgbe_adapter { · line 842

Quoted 5 lines
drivers/net/ethernet/intel/ixgbe/ixgbe.h +2 -0
@@ -838,6 +838,8 @@ struct ixgbe_adapter {
  */
 #define IXGBE_MAX_RETA_ENTRIES 512
 	u8 rss_indir_tbl[IXGBE_MAX_RETA_ENTRIES];
+	u32 last_reta_entries;
+	u16 last_rss_i;

last_rss_i is cryptic; please, consider last_rss_indices (or

similar)

Sure, I'll rename it to last_rss_indices for clarity.

Quoted 3 lines

drivers/net/ethernet/intel/ixgbe/ixgbe.h struct ixgbe_adapter { · line 843

Quoted 3 lines
drivers/net/ethernet/intel/ixgbe/ixgbe.h +0 -0
 #define IXGBE_RSS_KEY_SIZE     40  /* size of RSS Hash Key in

bytes

Quoted 15 lines
Quoted 15 lines
drivers/net/ethernet/intel/ixgbe/ixgbe.h +0 -0
 */
 	u32 *rss_key;
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +0 -2
index 27040076f068..05dfb06173d4 100644
@@ -4323,14 +4323,21 @@ static void ixgbe_setup_reta(struct
 ixgbe_adapter *adapter)
 	/* Fill out hash function seeds */
 	ixgbe_store_key(adapter);
 
-	/* Fill out redirection table */
-	memset(adapter->rss_indir_tbl, 0, sizeof(adapter-
 >rss_indir_tbl));
Quoted 10 lines

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c static void ixgbe_setup_reta(struct ixgbe_adapter *adapter) · line 4332

Quoted 9 lines
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +2 -0
+	/* Update redirection table in memory on first init, queue
 count change,
+	 * or reta entries change, otherwise preserve user

configurations. Then

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +5 -0
+	 * always write to hardware.
+	 */
+	if (adapter->last_rss_i != rss_i ||
+	    adapter->last_reta_entries != reta_entries) {
+		for (i = 0, j = 0; i < reta_entries; i++, j++) {

You can avoid the top-of-loop equality test by using modulo, which

reads easier, like:

Quoted 2 lines

for (i = 0, j = 0; i < reta_entries; i++, j++)

    adapter->rss_indir_tbl[i] = j % rss_i;

I got it. I'll use modulo and then j can be removed like:

    for (i = 0; i < reta_entries; i++)
           adapter->rss_indir_tbl[i] = i % rss_i;
Quoted 15 lines
Quoted 15 lines
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +6 -4
+			if (j == rss_i)
+				j = 0;
 
-	for (i = 0, j = 0; i < reta_entries; i++, j++) {
-		if (j == rss_i)
-			j = 0;
+			adapter->rss_indir_tbl[i] = j;
+		}
 
-		adapter->rss_indir_tbl[i] = j;
+		adapter->last_rss_i = rss_i;
+		adapter->last_reta_entries = reta_entries;
 	}
Quoted 5 lines

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c static void ixgbe_setup_reta(struct · line 4347

Quoted 5 lines
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +0 -0
 	ixgbe_store_reta(adapter);
@@ -4338,8 +4345,9 @@ static void ixgbe_setup_reta(struct
 ixgbe_adapter *adapter)
 
 static void ixgbe_setup_vfreta(struct ixgbe_adapter *adapter)

{

Quoted 5 lines

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c static void ixgbe_setup_reta(struct ixgbe_adapter *adapter) · line 4350

Quoted 4 lines
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +2 -1
-	struct ixgbe_hw *hw = &adapter->hw;
 	u16 rss_i = adapter->ring_feature[RING_F_RSS].indices;
+	struct ixgbe_hw *hw = &adapter->hw;
+	u32 reta_entries = 64;

Magic number. Can you #define IXGBE_VFRETA_ENTRIES 64 ?

You're right about the magic number.
I see it was introduced in commit 0f9b232b176d ("ixgbe: add support for
X550 extended RSS support").

Quoted 6 lines

I'm considering using ixgbe_rss_indir_tbl_entries() instead of #define to avoid the magic number, since ixgbe_store_vfreta() already uses it.
This would ensure consistency between the two functions. Would that be acceptable, or would you prefer a #define?

Good catch!
ixgbe_rss_indir_tbl_entries() is proper solution ,because it's h/w and configuration dependent.

Quoted 36 lines
Quoted 4 lines

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c static void ixgbe_setup_reta(struct ixgbe_adapter *adapter)

Quoted 4 lines
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +0 -0
 	int i, j;
 
 	/* Fill out hash function seeds */ @@ -4352,12 +4360,21 @@

static

Quoted 31 lines
Quoted 31 lines

void ixgbe_setup_vfreta(struct ixgbe_adapter *adapter)

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +1 -4
 					*(adapter->rss_key + i));
 	}
 
-	/* Fill out the redirection table */
-	for (i = 0, j = 0; i < 64; i++, j++) {
-		if (j == rss_i)
-			j = 0;
+	/* Update redirection table in memory on first init, queue

count change,

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +1 -0
+	 * or reta entries change, otherwise preserve user

configurations. Then

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +12 -2
+	 * always write to hardware.
+	 */
+	if (adapter->last_rss_i != rss_i ||
+	    adapter->last_reta_entries != reta_entries) {
+		for (i = 0, j = 0; i < reta_entries; i++, j++) {
+			if (j == rss_i)
+				j = 0;
+
+			adapter->rss_indir_tbl[i] = j;
+		}
 
-		adapter->rss_indir_tbl[i] = j;
+		adapter->last_rss_i = rss_i;
+		adapter->last_reta_entries = reta_entries;
 	}
 
 	ixgbe_store_vfreta(adapter);
--

2.51.0