From: Xiaoyun Wang Date: Thu, 14 May 2020 09:29:19 +0000 (+0800) Subject: net/hinic: optimize RSS RETA table update X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=72babbc001e837c21e60d2bab554337af239f659;p=dpdk.git 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 --- 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);