Skip to contentSkip to conversation

net/bonding: fix rss key configuration when the key length is 52

PATCH Superseded Ke Zhang 4 participants 11 messages Apr 7, 2022 – May 4, 2022

Subsystems (2)
lore
Share & tools
lore

Ke Zhang

author
#0 lore raw

PATCH 1/1 net/bonding: fix rss key configuration when the key length is 52

when creating a bonding device, if the slave device's rss key length is 52, then bonding device will be same as slave, in function bond_ethdev_configure(), the default_rss_key length is 40, it is not matched, so it should calculate a new key for bonding device if the deault key could not be used.

---
 drivers/net/bonding/rte_eth_bond_pmd.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/net/bonding/rte_eth_bond_pmd.c +6 -6
index b305b6a35b..4214b33f40 100644
@@ -3617,13 +3617,13 @@ bond_ethdev_configure(struct rte_eth_dev *dev)
 			       internals->rss_key_len);
 		} else {
 			if (internals->rss_key_len > sizeof(default_rss_key)) {
-				RTE_BOND_LOG(ERR,
-				       "There is no suitable default hash key");
-				return -EINVAL;
+				/* If the rss_key_len is 52, it should calculate the hash key */
+				for (i = 0; i < internals->rss_key_len; i++)
+					internals->rss_key[i] = (uint8_t)rte_rand();
+			} else {
+				memcpy(internals->rss_key, default_rss_key,
+					internals->rss_key_len);
 			}
-
-			memcpy(internals->rss_key, default_rss_key,
-			       internals->rss_key_len);
 		}
 
 		for (i = 0; i < RTE_DIM(internals->reta_conf); i++) {
Signature · 1 line
2.25.1
#1 lore raw

Hi,

Quoted 5 lines · Ke Zhang

when creating a bonding device, if the slave device's rss key length is 52, then bonding device will be same as slave, in function bond_ethdev_configure(), the default_rss_key length is 40, it is not matched, so it should calculate a new key for bonding device if the deault key could not be used.

wrong spelling.

Quoted 11 lines
---
  drivers/net/bonding/rte_eth_bond_pmd.c | 12 ++++++------
  1 file changed, 6 insertions(+), 6 deletions(-)
drivers/net/bonding/rte_eth_bond_pmd.c +0 -0
index b305b6a35b..4214b33f40 100644

drivers/net/bonding/rte_eth_bond_pmd.c bond_ethdev_configure(struct rte_eth_dev *dev) · line 3620

Quoted 7 lines
drivers/net/bonding/rte_eth_bond_pmd.c +1 -3
@@ -3617,13 +3617,13 @@ bond_ethdev_configure(struct rte_eth_dev *dev)
  			       internals->rss_key_len);
  		} else {
  			if (internals->rss_key_len > sizeof(default_rss_key)) {
-				RTE_BOND_LOG(ERR,
-				       "There is no suitable default hash key");
-				return -EINVAL;
+				/* If the rss_key_len is 52, it should calculate the hash key */

I think the comment should be more common, no need to emphysize '52'.

Quoted 13 lines
drivers/net/bonding/rte_eth_bond_pmd.c +5 -3
+				for (i = 0; i < internals->rss_key_len; i++)
+					internals->rss_key[i] = (uint8_t)rte_rand();
+			} else {
+				memcpy(internals->rss_key, default_rss_key,
+					internals->rss_key_len);
  			}
-
-			memcpy(internals->rss_key, default_rss_key,
-			       internals->rss_key_len);
  		}
 
  		for (i = 0; i < RTE_DIM(internals->reta_conf); i++) {
#2 lore raw
Quoted 11 lines

-----Original Message-----
From: Min Hu (Connor) <[email protected]>
Sent: Friday, April 8, 2022 10:33 AM
To: Zhang, Ke1X <[email protected]>; [email protected]; [email protected]
Subject: Re: [PATCH] net/bonding: fix rss key configuration when the key length is 52

Hi,

Quoted 7 lines
Quoted 5 lines · Ke Zhang

when creating a bonding device, if the slave device's rss key length is 52, then bonding device will be same as slave, in function bond_ethdev_configure(), the default_rss_key length is 40, it is not matched, so it should calculate a new key for bonding device if the deault key could not be used.

wrong spelling.

This is a coding waring as below:

_coding style issues_

WARNING:TYPO_SPELLING: 'slave' may be misspelled - perhaps 'secondary'? #64:
when creating a bonding device, if the slave device's rss key length

WARNING:TYPO_SPELLING: 'slave' may be misspelled - perhaps 'secondary'? #65:
is 52, then bonding device will be same as slave, in function

total: 0 errors, 2 warnings, 0 checks, 19 lines checked

the 'slave' is correct, for exsample, testpmd cmd:
add bonding slave 0 2

Quoted 37 lines

drivers/net/bonding/rte_eth_bond_pmd.c bond_ethdev_configure(struct rte_eth_dev

Quoted 12 lines
---
  drivers/net/bonding/rte_eth_bond_pmd.c | 12 ++++++------
  1 file changed, 6 insertions(+), 6 deletions(-)
drivers/net/bonding/rte_eth_bond_pmd.c +0 -0
index b305b6a35b..4214b33f40 100644
@@ -3617,13 +3617,13 @@ bond_ethdev_configure(struct rte_eth_dev

*dev)

drivers/net/bonding/rte_eth_bond_pmd.c bond_ethdev_configure(struct rte_eth_dev *dev)

Quoted 3 lines
drivers/net/bonding/rte_eth_bond_pmd.c +0 -0
  			       internals->rss_key_len);
  		} else {
  			if (internals->rss_key_len > sizeof(default_rss_key))

{

drivers/net/bonding/rte_eth_bond_pmd.c bond_ethdev_configure(struct rte_eth_dev *dev)

Quoted 4 lines
drivers/net/bonding/rte_eth_bond_pmd.c +1 -3
-				RTE_BOND_LOG(ERR,
-				       "There is no suitable default hash key");
-				return -EINVAL;
+				/* If the rss_key_len is 52, it should calculate

the hash key */
I think the comment should be more common, no need to emphysize '52'.

drivers/net/bonding/rte_eth_bond_pmd.c bond_ethdev_configure(struct rte_eth_dev · line 3622

Quoted 2 lines
drivers/net/bonding/rte_eth_bond_pmd.c +2 -0
+				for (i = 0; i < internals->rss_key_len; i++)
+					internals->rss_key[i] =

(uint8_t)rte_rand();

Quoted 11 lines
drivers/net/bonding/rte_eth_bond_pmd.c +3 -3
+			} else {
+				memcpy(internals->rss_key, default_rss_key,
+					internals->rss_key_len);
  			}
-
-			memcpy(internals->rss_key, default_rss_key,
-			       internals->rss_key_len);
  		}
 
  		for (i = 0; i < RTE_DIM(internals->reta_conf); i++) {
#3 lore raw
Quoted 8 lines · On Mon, 11 Apr 2022 03:06:46 +0000 "Zhang, Ke1X" <[email protected]> wrote:

This is a coding waring as below:

_coding style issues_

WARNING:TYPO_SPELLING: 'slave' may be misspelled - perhaps 'secondary'? #64:
when creating a bonding device, if the slave device's rss key length

Quoted 8 lines

WARNING:TYPO_SPELLING: 'slave' may be misspelled - perhaps 'secondary'? #65:
is 52, then bonding device will be same as slave, in function

total: 0 errors, 2 warnings, 0 checks, 19 lines checked

the 'slave' is correct, for exsample, testpmd cmd:
add bonding slave 0 2

Just a heads up, for 22.11 I plan to replace/deprecate use of master/slave terminology in bonding driver. The terms master/slave are legacy and most commercial products have switched to the terms from the 802 standard.

#4 lore raw

Hi, Stephen,

Quoted 15 lines · Stephen Hemminger
Quoted 12 lines · On Mon, 11 Apr 2022 03:06:46 +0000 "Zhang, Ke1X" <[email protected]> wrote:

This is a coding waring as below:

_coding style issues_

WARNING:TYPO_SPELLING: 'slave' may be misspelled - perhaps 'secondary'? #64:
when creating a bonding device, if the slave device's rss key length

WARNING:TYPO_SPELLING: 'slave' may be misspelled - perhaps 'secondary'? #65:
is 52, then bonding device will be same as slave, in function

Quoted 8 lines
Quoted 4 lines

total: 0 errors, 2 warnings, 0 checks, 19 lines checked

the 'slave' is correct, for exsample, testpmd cmd:
add bonding slave 0 2

Just a heads up, for 22.11 I plan to replace/deprecate use of master/slave terminology in bonding driver. The terms master/slave are legacy and most commercial products have switched to the terms from the 802 standard.

What are the terms ? Could you show them for us?

Quoted 2 lines

.

#5 lore raw
Quoted 20 lines · On Wed, 13 Apr 2022 17:03:07 +0800 "Min Hu (Connor)" <[email protected]> wrote:

Hi, Stephen,

Quoted 17 lines · Stephen Hemminger
Quoted 14 lines · On Mon, 11 Apr 2022 03:06:46 +0000 "Zhang, Ke1X" <[email protected]> wrote:

This is a coding waring as below:

_coding style issues_

WARNING:TYPO_SPELLING: 'slave' may be misspelled - perhaps 'secondary'? #64:
when creating a bonding device, if the slave device's rss key length

WARNING:TYPO_SPELLING: 'slave' may be misspelled - perhaps 'secondary'? #65:
is 52, then bonding device will be same as slave, in function

total: 0 errors, 2 warnings, 0 checks, 19 lines checked

Quoted 7 lines
Quoted 6 lines
Quoted 2 lines

the 'slave' is correct, for exsample, testpmd cmd:
add bonding slave 0 2

Just a heads up, for 22.11 I plan to replace/deprecate use of master/slave terminology in bonding driver. The terms master/slave are legacy and most commercial products have switched to the terms from the 802 standard.

What are the terms ? Could you show them for us?

The current IEEE std is https://standards.ieee.org/ieee/802.1AX/6768/
which is unfortunately paywalled.

The terms in standard are "Aggregator Client" for the ports used in the device and "Aggregator Partner/Multiplexor" but they are not quite the same.

Probably going to use client and multiplexor as terms; but open for discussion.

author
#6 lore raw

PATCH v2 1/1 net/bonding: fix rss key configuration when the key length is 52

In reply to Ke Zhang

when creating a bonding device, if the slave device's rss key length is 52, then bonding device will be same as slave, in function bond_ethdev_configure(), the default_rss_key length is 40, it is not matched, so it should calculate a new key for bonding device if the deault key could not be used.

---
 drivers/net/bonding/rte_eth_bond_pmd.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)
drivers/net/bonding/rte_eth_bond_pmd.c +11 -6
index b305b6a35b..027339b0d9 100644
@@ -3617,13 +3617,18 @@ bond_ethdev_configure(struct rte_eth_dev *dev)
 			       internals->rss_key_len);
 		} else {
 			if (internals->rss_key_len > sizeof(default_rss_key)) {
-				RTE_BOND_LOG(ERR,
-				       "There is no suitable default hash key");
-				return -EINVAL;
+				/*
+				 * If the rss_key includes standard_rss_key and
+				 * extended_hash_key, the rss key length will
+				 * larger than default rss key length, so it should
+				 * re-calculate the hash key
+				 */
+				for (i = 0; i < internals->rss_key_len; i++)
+					internals->rss_key[i] = (uint8_t)rte_rand();
+			} else {
+				memcpy(internals->rss_key, default_rss_key,
+					internals->rss_key_len);
 			}
-
-			memcpy(internals->rss_key, default_rss_key,
-			       internals->rss_key_len);
 		}
 
 		for (i = 0; i < RTE_DIM(internals->reta_conf); i++) {
Signature · 1 line
2.25.1
#7 lore raw
Quoted 6 lines · Ke Zhang

when creating a bonding device, if the slave device's rss key length is 52, then bonding device will be same as slave, in function bond_ethdev_configure(), the default_rss_key length is 40, it is not matched, so it should calculate a new key for bonding device if the deault key could not be used.

I mean 'deault ' is wrong.

Quoted 10 lines
---
  drivers/net/bonding/rte_eth_bond_pmd.c | 17 +++++++++++------
  1 file changed, 11 insertions(+), 6 deletions(-)
drivers/net/bonding/rte_eth_bond_pmd.c +0 -0
index b305b6a35b..027339b0d9 100644

drivers/net/bonding/rte_eth_bond_pmd.c bond_ethdev_configure(struct rte_eth_dev *dev) · line 3622

Quoted 9 lines
drivers/net/bonding/rte_eth_bond_pmd.c +3 -3
@@ -3617,13 +3617,18 @@ bond_ethdev_configure(struct rte_eth_dev *dev)
  			       internals->rss_key_len);
  		} else {
  			if (internals->rss_key_len > sizeof(default_rss_key)) {
-				RTE_BOND_LOG(ERR,
-				       "There is no suitable default hash key");
-				return -EINVAL;
+				/*
+				 * If the rss_key includes standard_rss_key and
+				 * extended_hash_key, the rss key length will

will be

drivers/net/bonding/rte_eth_bond_pmd.c bond_ethdev_configure(struct rte_eth_dev *dev) · line 3624

Quoted 2 lines
drivers/net/bonding/rte_eth_bond_pmd.c +2 -0
+				 * larger than default rss key length, so it should
+				 * re-calculate the hash key

recalculate

key.

Quoted 14 lines
drivers/net/bonding/rte_eth_bond_pmd.c +6 -3
+				 */
+				for (i = 0; i < internals->rss_key_len; i++)
+					internals->rss_key[i] = (uint8_t)rte_rand();
+			} else {
+				memcpy(internals->rss_key, default_rss_key,
+					internals->rss_key_len);
  			}
-
-			memcpy(internals->rss_key, default_rss_key,
-			       internals->rss_key_len);
  		}
 
  		for (i = 0; i < RTE_DIM(internals->reta_conf); i++) {
author
#8 lore raw

PATCH v3 1/1 net/bonding: fix rss key configuration when the key length is 52

In reply to Ke Zhang

when creating a bonding device, if the slave device's rss key length = standard_rss_key length + extended_hash_key length, then bonding device will be same as slave, in function bond_ethdev_configure(), the default_rss_key length is 40, it is not matched, so it should calculate a new key for bonding device if the default key could not be used.

---
 drivers/net/bonding/rte_eth_bond_pmd.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)
drivers/net/bonding/rte_eth_bond_pmd.c +11 -6
index b305b6a35b..5cbe89031b 100644
@@ -3617,13 +3617,18 @@ bond_ethdev_configure(struct rte_eth_dev *dev)
 			       internals->rss_key_len);
 		} else {
 			if (internals->rss_key_len > sizeof(default_rss_key)) {
-				RTE_BOND_LOG(ERR,
-				       "There is no suitable default hash key");
-				return -EINVAL;
+				/*
+				 * If the rss_key includes standard_rss_key and
+				 * extended_hash_key, the rss key length will be
+				 * larger than default rss key length, so it should
+				 * re-calculate the hash key.
+				 */
+				for (i = 0; i < internals->rss_key_len; i++)
+					internals->rss_key[i] = (uint8_t)rte_rand();
+			} else {
+				memcpy(internals->rss_key, default_rss_key,
+					internals->rss_key_len);
 			}
-
-			memcpy(internals->rss_key, default_rss_key,
-			       internals->rss_key_len);
 		}
 
 		for (i = 0; i < RTE_DIM(internals->reta_conf); i++) {
Signature · 1 line
2.25.1
Acked-by on v3 1/1
#9 lore raw
Quoted 42 lines · Ke Zhang

when creating a bonding device, if the slave device's rss key length = standard_rss_key length + extended_hash_key length, then bonding device will be same as slave, in function bond_ethdev_configure(), the default_rss_key length is 40, it is not matched, so it should calculate a new key for bonding device if the default key could not be used.

---
  drivers/net/bonding/rte_eth_bond_pmd.c | 17 +++++++++++------
  1 file changed, 11 insertions(+), 6 deletions(-)
drivers/net/bonding/rte_eth_bond_pmd.c +11 -6
index b305b6a35b..5cbe89031b 100644
@@ -3617,13 +3617,18 @@ bond_ethdev_configure(struct rte_eth_dev *dev)
  			       internals->rss_key_len);
  		} else {
  			if (internals->rss_key_len > sizeof(default_rss_key)) {
-				RTE_BOND_LOG(ERR,
-				       "There is no suitable default hash key");
-				return -EINVAL;
+				/*
+				 * If the rss_key includes standard_rss_key and
+				 * extended_hash_key, the rss key length will be
+				 * larger than default rss key length, so it should
+				 * re-calculate the hash key.
+				 */
+				for (i = 0; i < internals->rss_key_len; i++)
+					internals->rss_key[i] = (uint8_t)rte_rand();
+			} else {
+				memcpy(internals->rss_key, default_rss_key,
+					internals->rss_key_len);
  			}
-
-			memcpy(internals->rss_key, default_rss_key,
-			       internals->rss_key_len);
  		}
 
  		for (i = 0; i < RTE_DIM(internals->reta_conf); i++) {
Applied
#10 lore raw

On 4/13/2022 10:01 AM, Min Hu (Connor) wrote:

<...>

Quoted 8 lines · Ke Zhang
Quoted 7 lines

when creating a bonding device, if the slave device's rss key length = standard_rss_key length + extended_hash_key length, then bonding device will be same as slave, in function bond_ethdev_configure(), the default_rss_key length is 40, it is not matched, so it should calculate a new key for bonding device if the default key could not be used.

Quoted 4 lines
Quoted 1 line
    Fixes: 6b1a001ec546 ("net/bonding: fix RSS key length")
    Cc: [email protected]

(The fixes line not exactly true, since 52 byte keys seems not considered from the begging, but above commit seems the closest one to make the patch backported to proper releases.)

Applied to dpdk-next-net/main, thanks.