mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 10:58:48 +09:00
net: ena: Fix toeplitz initial hash value
[ Upstream commit332b49ff63] On driver initialization, RSS hash initial value is set to zero, instead of the default value. This happens because we pass NULL as the RSS key parameter, which caused us to never initialize the RSS hash value. This patch fixes it by making sure the initial value is set, no matter what the value of the RSS key is. Fixes:91a65b7d3e("net: ena: fix potential crash when rxfh key is NULL") Signed-off-by: Nati Koler <nkoler@amazon.com> Signed-off-by: David Arinzon <darinzon@amazon.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
aafd7d5ecc
commit
1ee3d84b0d
@@ -2400,29 +2400,18 @@ int ena_com_fill_hash_function(struct ena_com_dev *ena_dev,
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
switch (func) {
|
||||
case ENA_ADMIN_TOEPLITZ:
|
||||
if (key) {
|
||||
if (key_len != sizeof(hash_key->key)) {
|
||||
netdev_err(ena_dev->net_device,
|
||||
"key len (%u) doesn't equal the supported size (%zu)\n",
|
||||
key_len, sizeof(hash_key->key));
|
||||
return -EINVAL;
|
||||
}
|
||||
memcpy(hash_key->key, key, key_len);
|
||||
rss->hash_init_val = init_val;
|
||||
hash_key->key_parts = key_len / sizeof(hash_key->key[0]);
|
||||
if ((func == ENA_ADMIN_TOEPLITZ) && key) {
|
||||
if (key_len != sizeof(hash_key->key)) {
|
||||
netdev_err(ena_dev->net_device,
|
||||
"key len (%u) doesn't equal the supported size (%zu)\n",
|
||||
key_len, sizeof(hash_key->key));
|
||||
return -EINVAL;
|
||||
}
|
||||
break;
|
||||
case ENA_ADMIN_CRC32:
|
||||
rss->hash_init_val = init_val;
|
||||
break;
|
||||
default:
|
||||
netdev_err(ena_dev->net_device, "Invalid hash function (%d)\n",
|
||||
func);
|
||||
return -EINVAL;
|
||||
memcpy(hash_key->key, key, key_len);
|
||||
hash_key->key_parts = key_len / sizeof(hash_key->key[0]);
|
||||
}
|
||||
|
||||
rss->hash_init_val = init_val;
|
||||
old_func = rss->hash_func;
|
||||
rss->hash_func = func;
|
||||
rc = ena_com_set_hash_function(ena_dev);
|
||||
|
||||
Reference in New Issue
Block a user