From 72babbc001e837c21e60d2bab554337af239f659 Mon Sep 17 00:00:00 2001 From: Xiaoyun Wang Date: Thu, 14 May 2020 17:29:19 +0800 Subject: [PATCH] net/hinic: optimize RSS RETA table update Before updating RSS indirection table, firstly determine whether rq num in RETA table is legal, if it is invalid(such as exceeding the maximum rxq num), driver will not update hw indirection table and return fail. Signed-off-by: Xiaoyun Wang --- drivers/net/hinic/hinic_pmd_ethdev.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/net/hinic/hinic_pmd_ethdev.c b/drivers/net/hinic/hinic_pmd_ethdev.c index 8634fe814d..2f0f33a8da 100644 --- a/drivers/net/hinic/hinic_pmd_ethdev.c +++ b/drivers/net/hinic/hinic_pmd_ethdev.c @@ -2075,16 +2075,16 @@ static int hinic_rss_indirtbl_update(struct rte_eth_dev *dev, for (i = 0; i < reta_size; i++) { idx = i / RTE_RETA_GROUP_SIZE; shift = i % RTE_RETA_GROUP_SIZE; - if (reta_conf[idx].mask & (1ULL << shift)) - indirtbl[i] = reta_conf[idx].reta[shift]; - } - for (i = 0 ; i < reta_size; i++) { - if (indirtbl[i] >= nic_dev->num_rq) { - PMD_DRV_LOG(ERR, "Invalid reta entry, index: %d, num_rq: %d", - i, nic_dev->num_rq); - goto disable_rss; + if (reta_conf[idx].reta[shift] >= nic_dev->num_rq) { + PMD_DRV_LOG(ERR, "Invalid reta entry, indirtbl[%d]: %d " + "exceeds the maximum rxq num: %d", i, + reta_conf[idx].reta[shift], nic_dev->num_rq); + return -EINVAL; } + + if (reta_conf[idx].mask & (1ULL << shift)) + indirtbl[i] = reta_conf[idx].reta[shift]; } err = hinic_rss_set_indir_tbl(nic_dev->hwdev, tmpl_idx, indirtbl); -- 2.20.1