Skip to content

Commit

Permalink
net/hns3: fix possible truncation of hash key when config
Browse files Browse the repository at this point in the history
[ upstream commit bb38316e738ad6009b3f20b3abfaf27ea8cb0202 ]

The hash key length of hns3 driver is obtained from firmware. If the
length is a multiple of HNS3_RSS_HASH_KEY_NUM (16), the last part
of hash key will be truncated.

Fixes: 88347111eb53 ("net/hns3: refactor set RSS hash algorithm and key interface")

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
  • Loading branch information
LiHuiSong1 authored and bluca committed Mar 15, 2023
1 parent c7154a7 commit add16de
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/net/hns3/hns3_rss.c
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,8 @@ hns3_set_rss_algo_key(struct hns3_hw *hw, uint8_t hash_algo,
req->hash_config |= (hash_algo & HNS3_RSS_HASH_ALGO_MASK);
req->hash_config |= (idx << HNS3_RSS_HASH_KEY_OFFSET_B);

if (idx == max_bd_num - 1)
if (idx == max_bd_num - 1 &&
(key_len % HNS3_RSS_HASH_KEY_NUM) != 0)
cur_key_size = key_len % HNS3_RSS_HASH_KEY_NUM;
else
cur_key_size = HNS3_RSS_HASH_KEY_NUM;
Expand Down

0 comments on commit add16de

Please sign in to comment.