Skip to content

Commit 0af3c4e

Browse files
Sameeh Jubrandavem330
authored andcommitted
net: ena: changes to RSS hash key allocation
This commit contains 2 cosmetic changes: 1. Use ena_com_check_supported_feature_id() in ena_com_hash_key_fill_default_key() instead of rewriting its implementation. This also saves us a superfluous admin command by using the cached value. 2. Change if conditions in ena_com_rss_init() to be clearer. Signed-off-by: Arthur Kiyanovski <[email protected]> Signed-off-by: Sameeh Jubran <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent c1bd17e commit 0af3c4e

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

drivers/net/ethernet/amazon/ena/ena_com.c

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,16 +1067,10 @@ static void ena_com_hash_key_fill_default_key(struct ena_com_dev *ena_dev)
10671067
static int ena_com_hash_key_allocate(struct ena_com_dev *ena_dev)
10681068
{
10691069
struct ena_rss *rss = &ena_dev->rss;
1070-
struct ena_admin_get_feat_resp get_resp;
1071-
int rc;
10721070

1073-
rc = ena_com_get_feature_ex(ena_dev, &get_resp,
1074-
ENA_ADMIN_RSS_HASH_FUNCTION,
1075-
ena_dev->rss.hash_key_dma_addr,
1076-
sizeof(ena_dev->rss.hash_key), 0);
1077-
if (unlikely(rc)) {
1071+
if (!ena_com_check_supported_feature_id(ena_dev,
1072+
ENA_ADMIN_RSS_HASH_FUNCTION))
10781073
return -EOPNOTSUPP;
1079-
}
10801074

10811075
rss->hash_key =
10821076
dma_alloc_coherent(ena_dev->dmadev, sizeof(*rss->hash_key),
@@ -2650,10 +2644,10 @@ int ena_com_rss_init(struct ena_com_dev *ena_dev, u16 indr_tbl_log_size)
26502644
* ignore this error and have indirection table support only.
26512645
*/
26522646
rc = ena_com_hash_key_allocate(ena_dev);
2653-
if (unlikely(rc) && rc != -EOPNOTSUPP)
2654-
goto err_hash_key;
2655-
else if (rc != -EOPNOTSUPP)
2647+
if (likely(!rc))
26562648
ena_com_hash_key_fill_default_key(ena_dev);
2649+
else if (rc != -EOPNOTSUPP)
2650+
goto err_hash_key;
26572651

26582652
rc = ena_com_hash_ctrl_init(ena_dev);
26592653
if (unlikely(rc))

0 commit comments

Comments
 (0)