[v2,1/1] net/bonding: fix rss key configuration when the key length is 52

Message ID 20220411030231.58268-1-ke1x.zhang@intel.com (mailing list archive)
State Superseded, archived
Headers
Series [v2,1/1] net/bonding: fix rss key configuration when the key length is 52 |

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/Intel-compilation success Compilation OK
ci/github-robot: build success github build: passed
ci/intel-Testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS

Commit Message

Zhang, Ke1X April 11, 2022, 3:02 a.m. UTC
  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.

Signed-off-by: Ke Zhang <ke1x.zhang@intel.com>
---
 drivers/net/bonding/rte_eth_bond_pmd.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)
  

Comments

humin (Q) April 11, 2022, 3:41 a.m. UTC | #1
在 2022/4/11 11:02, 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.

> Signed-off-by: Ke Zhang <ke1x.zhang@intel.com>
> ---
>   drivers/net/bonding/rte_eth_bond_pmd.c | 17 +++++++++++------
>   1 file changed, 11 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
> index b305b6a35b..027339b0d9 100644
> --- a/drivers/net/bonding/rte_eth_bond_pmd.c
> +++ b/drivers/net/bonding/rte_eth_bond_pmd.c
> @@ -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
> +				 * larger than default rss key length, so it should
> +				 * re-calculate the hash key
recalculate

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++) {
>
  

Patch

diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index b305b6a35b..027339b0d9 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -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++) {