From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id DFD36433A3 for ; Thu, 23 Nov 2023 09:05:31 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C2E9642EFC; Thu, 23 Nov 2023 09:05:31 +0100 (CET) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 74158402C2 for ; Thu, 23 Nov 2023 09:05:30 +0100 (CET) Received: from kwepemm000004.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4SbVv81CFwzrVP7; Thu, 23 Nov 2023 16:01:56 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by kwepemm000004.china.huawei.com (7.193.23.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Thu, 23 Nov 2023 16:05:24 +0800 From: Huisong Li To: , CC: , Subject: [PATCH 21.11 2/4] net/hns3: fix setting DCB capability Date: Thu, 23 Nov 2023 16:05:27 +0800 Message-ID: <20231123080529.15216-3-lihuisong@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20231123080529.15216-1-lihuisong@huawei.com> References: <20231123080529.15216-1-lihuisong@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.69.192.56] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemm000004.china.huawei.com (7.193.23.18) X-CFilter-Loop: Reflected X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org [ upstream commit ac61c444e647298dded80a2ab52966a2dbe22b68 ] The "hw->capability" is set after querying firmware and version. But the DCB capability of PF is set in other place. So this patch moves setting DCB capability to the place where all capabilities are set. Fixes: ab2e2e344163 ("net/hns3: get device capability in primary process") Signed-off-by: Huisong Li Signed-off-by: Jie Hai --- drivers/net/hns3/hns3_cmd.c | 25 +++++++++++++++++++++++++ drivers/net/hns3/hns3_ethdev.c | 13 ------------- 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/drivers/net/hns3/hns3_cmd.c b/drivers/net/hns3/hns3_cmd.c index 3495e2acc1..13f7e37511 100644 --- a/drivers/net/hns3/hns3_cmd.c +++ b/drivers/net/hns3/hns3_cmd.c @@ -523,6 +523,28 @@ hns3_build_api_caps(void) return rte_cpu_to_le_32(api_caps); } +static void +hns3_set_dcb_capability(struct hns3_hw *hw) +{ + struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw); + struct rte_pci_device *pci_dev; + struct rte_eth_dev *eth_dev; + uint16_t device_id; + + if (hns->is_vf) + return; + + eth_dev = &rte_eth_devices[hw->data->port_id]; + pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev); + device_id = pci_dev->id.device_id; + + if (device_id == HNS3_DEV_ID_25GE_RDMA || + device_id == HNS3_DEV_ID_50GE_RDMA || + device_id == HNS3_DEV_ID_100G_RDMA_MACSEC || + device_id == HNS3_DEV_ID_200G_RDMA) + hns3_set_bit(hw->capability, HNS3_DEV_SUPPORT_DCB_B, 1); +} + static int hns3_cmd_query_firmware_version_and_capability(struct hns3_hw *hw) { @@ -540,6 +562,9 @@ hns3_cmd_query_firmware_version_and_capability(struct hns3_hw *hw) return ret; hw->fw_version = rte_le_to_cpu_32(resp->firmware); + + hns3_set_dcb_capability(hw); + /* * Make sure mask the capability before parse capability because it * may overwrite resp's data. diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c index 6ae62879b3..bf612b1830 100644 --- a/drivers/net/hns3/hns3_ethdev.c +++ b/drivers/net/hns3/hns3_ethdev.c @@ -2689,22 +2689,9 @@ static int hns3_get_capability(struct hns3_hw *hw) { struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw); - struct rte_pci_device *pci_dev; struct hns3_pf *pf = &hns->pf; - struct rte_eth_dev *eth_dev; - uint16_t device_id; int ret; - eth_dev = &rte_eth_devices[hw->data->port_id]; - pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev); - device_id = pci_dev->id.device_id; - - if (device_id == HNS3_DEV_ID_25GE_RDMA || - device_id == HNS3_DEV_ID_50GE_RDMA || - device_id == HNS3_DEV_ID_100G_RDMA_MACSEC || - device_id == HNS3_DEV_ID_200G_RDMA) - hns3_set_bit(hw->capability, HNS3_DEV_SUPPORT_DCB_B, 1); - ret = hns3_get_pci_revision_id(hw, &hw->revision); if (ret) return ret; -- 2.33.0