From patchwork Fri Nov 20 11:27:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lijun Ou X-Patchwork-Id: 84416 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id A61F3A04DD; Fri, 20 Nov 2020 12:27:46 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E1497C8B6; Fri, 20 Nov 2020 12:27:29 +0100 (CET) Received: from szxga07-in.huawei.com (szxga07-in.huawei.com [45.249.212.35]) by dpdk.org (Postfix) with ESMTP id 8049BDED for ; Fri, 20 Nov 2020 12:27:26 +0100 (CET) Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4CcvQg2Dyxz7065 for ; Fri, 20 Nov 2020 19:27:07 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.487.0; Fri, 20 Nov 2020 19:27:15 +0800 From: Lijun Ou To: CC: , Date: Fri, 20 Nov 2020 19:27:33 +0800 Message-ID: <1605871656-51819-2-git-send-email-oulijun@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1605871656-51819-1-git-send-email-oulijun@huawei.com> References: <1605871656-51819-1-git-send-email-oulijun@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.56] X-CFilter-Loop: Reflected Subject: [dpdk-dev] [PATCH 1/4] net/hns3: fix segment fault with the multi-TC 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" From: Huisong Li The HW and SW DCB configurations need to be updated only after the DCB configuration information changed. But the change of tx/rx queue number is ignored. If user decreases the number of tx queue after configuring multi-TC, the queue mapping information in hns3_tc_queue_info can not be updated. And then accessing the released queue resource in "hns3_init_tx_ring_tc" will trigger a segment fault. Fixes: 62e3ccc2b94c ("net/hns3: support flow control") Cc: stable@dpdk.org Signed-off-by: Huisong Li Signed-off-by: Lijun Ou --- drivers/net/hns3/hns3_dcb.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/hns3/hns3_dcb.c b/drivers/net/hns3/hns3_dcb.c index ab02c87..fb50179 100644 --- a/drivers/net/hns3/hns3_dcb.c +++ b/drivers/net/hns3/hns3_dcb.c @@ -1351,6 +1351,8 @@ hns3_dcb_cfg_validate(struct hns3_adapter *hns, uint8_t *tc, bool *changed) { struct rte_eth_dcb_rx_conf *dcb_rx_conf; struct hns3_hw *hw = &hns->hw; + uint16_t nb_rx_q = hw->data->nb_rx_queues; + uint16_t nb_tx_q = hw->data->nb_tx_queues; uint8_t max_tc = 0; uint8_t pfc_en; int i; @@ -1376,6 +1378,10 @@ hns3_dcb_cfg_validate(struct hns3_adapter *hns, uint8_t *tc, bool *changed) pfc_en = RTE_LEN2MASK((uint8_t)dcb_rx_conf->nb_tcs, uint8_t); if (hw->dcb_info.pfc_en != pfc_en) *changed = true; + + /* tx/rx queue number is reconfigured. */ + if (nb_rx_q != hw->used_rx_queues || nb_tx_q != hw->used_tx_queues) + *changed = true; } static int