net/bonding: fix RSS key config with extended key length

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.

Fixes: 6b1a001ec546 ("net/bonding: fix RSS key length")
Cc: stable@dpdk.org

Signed-off-by: Ke Zhang <ke1x.zhang@intel.com>
Acked-by: Min Hu (Connor) <humin29@huawei.com>
This commit is contained in:
Ke Zhang 2022-04-11 05:40:03 +00:00 committed by Ferruh Yigit
parent a866966bdf
commit 94d9c7d45b

View File

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