From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7E509A00C3; Thu, 14 May 2020 11:06:35 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CA8AC1D71D; Thu, 14 May 2020 11:06:22 +0200 (CEST) Received: from huawei.com (szxga06-in.huawei.com [45.249.212.32]) by dpdk.org (Postfix) with ESMTP id 873841D70A for ; Thu, 14 May 2020 11:06:20 +0200 (CEST) Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 1ADE931DD81C61A9C7D8; Thu, 14 May 2020 17:06:05 +0800 (CST) Received: from tester.localdomain (10.175.119.39) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.487.0; Thu, 14 May 2020 17:05:57 +0800 From: Xiaoyun wang To: CC: , , , , , , , , , , Xiaoyun wang Date: Thu, 14 May 2020 17:29:19 +0800 Message-ID: X-Mailer: git-send-email 1.8.3.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.119.39] X-CFilter-Loop: Reflected Subject: [dpdk-dev] [PATCH v1 4/4] net/hinic: optimize RSS RETA table updates X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 8634fe8..2f0f33a 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); -- 1.8.3.1