提交 332b49ff 编写于 作者: D David Arinzon 提交者: David S. Miller

net: ena: Fix toeplitz initial hash value

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: 91a65b7d ("net: ena: fix potential crash when rxfh key is NULL")
Signed-off-by: NNati Koler <nkoler@amazon.com>
Signed-off-by: NDavid Arinzon <darinzon@amazon.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 1573c688
...@@ -2400,9 +2400,7 @@ int ena_com_fill_hash_function(struct ena_com_dev *ena_dev, ...@@ -2400,9 +2400,7 @@ int ena_com_fill_hash_function(struct ena_com_dev *ena_dev,
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
switch (func) { if ((func == ENA_ADMIN_TOEPLITZ) && key) {
case ENA_ADMIN_TOEPLITZ:
if (key) {
if (key_len != sizeof(hash_key->key)) { if (key_len != sizeof(hash_key->key)) {
netdev_err(ena_dev->net_device, netdev_err(ena_dev->net_device,
"key len (%u) doesn't equal the supported size (%zu)\n", "key len (%u) doesn't equal the supported size (%zu)\n",
...@@ -2410,19 +2408,10 @@ int ena_com_fill_hash_function(struct ena_com_dev *ena_dev, ...@@ -2410,19 +2408,10 @@ int ena_com_fill_hash_function(struct ena_com_dev *ena_dev,
return -EINVAL; return -EINVAL;
} }
memcpy(hash_key->key, key, key_len); memcpy(hash_key->key, key, key_len);
rss->hash_init_val = init_val;
hash_key->key_parts = key_len / sizeof(hash_key->key[0]); hash_key->key_parts = key_len / sizeof(hash_key->key[0]);
} }
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;
}
rss->hash_init_val = init_val;
old_func = rss->hash_func; old_func = rss->hash_func;
rss->hash_func = func; rss->hash_func = func;
rc = ena_com_set_hash_function(ena_dev); rc = ena_com_set_hash_function(ena_dev);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册