From patchwork Tue Oct 31 12:23:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jie Hai X-Patchwork-Id: 133666 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6AB2043252; Tue, 31 Oct 2023 13:36:20 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7CEB9410E3; Tue, 31 Oct 2023 13:35:48 +0100 (CET) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 81E3040608 for ; Tue, 31 Oct 2023 13:35:41 +0100 (CET) Received: from kwepemi500020.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4SKTxq6p8LzvPyP; Tue, 31 Oct 2023 20:30:39 +0800 (CST) Received: from localhost.localdomain (10.67.165.2) by kwepemi500020.china.huawei.com (7.221.188.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Tue, 31 Oct 2023 20:35:38 +0800 From: Jie Hai To: , Yisen Zhuang , "Min Hu (Connor)" , Hao Chen , Huisong Li , Chengwen Feng , Ferruh Yigit CC: Subject: [PATCH 3/6] net/hns3: fix return value Date: Tue, 31 Oct 2023 20:23:56 +0800 Message-ID: <20231031122359.3930935-4-haijie1@huawei.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20231031122359.3930935-1-haijie1@huawei.com> References: <20231031122359.3930935-1-haijie1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.165.2] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemi500020.china.huawei.com (7.221.188.8) X-CFilter-Loop: Reflected X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 1. Fix the return value of hns3_get_imissed_stats_num as 'uint16_t'. 2. Add some error check for return value. Fixes: fcba820d9b9e ("net/hns3: support flow director") Cc: stable@dpdk.org Signed-off-by: Jie Hai --- drivers/net/hns3/hns3_ethdev_vf.c | 5 ++++- drivers/net/hns3/hns3_fdir.c | 2 +- drivers/net/hns3/hns3_stats.c | 15 ++++++++++----- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c index f5fc272a23bd..065eb63a893c 100644 --- a/drivers/net/hns3/hns3_ethdev_vf.c +++ b/drivers/net/hns3/hns3_ethdev_vf.c @@ -2082,8 +2082,11 @@ hns3vf_reinit_dev(struct hns3_adapter *hns) */ if (pci_dev->kdrv == RTE_PCI_KDRV_IGB_UIO || pci_dev->kdrv == RTE_PCI_KDRV_UIO_GENERIC) { - if (hns3vf_enable_msix(pci_dev, true)) + ret = hns3vf_enable_msix(pci_dev, true); + if (ret != 0) { hns3_err(hw, "Failed to enable msix"); + return ret; + } } rte_intr_enable(pci_dev->intr_handle); diff --git a/drivers/net/hns3/hns3_fdir.c b/drivers/net/hns3/hns3_fdir.c index c80fa59e63c8..d100e58d102b 100644 --- a/drivers/net/hns3/hns3_fdir.c +++ b/drivers/net/hns3/hns3_fdir.c @@ -978,7 +978,7 @@ int hns3_fdir_filter_program(struct hns3_adapter *hns, rule->key_conf.spec.src_port, rule->key_conf.spec.dst_port, ret); else - hns3_remove_fdir_filter(hw, fdir_info, &rule->key_conf); + ret = hns3_remove_fdir_filter(hw, fdir_info, &rule->key_conf); return ret; } diff --git a/drivers/net/hns3/hns3_stats.c b/drivers/net/hns3/hns3_stats.c index c2e692a2c50b..9a1e8935e5e4 100644 --- a/drivers/net/hns3/hns3_stats.c +++ b/drivers/net/hns3/hns3_stats.c @@ -771,7 +771,7 @@ hns3_mac_stats_reset(struct hns3_hw *hw) return 0; } -static int +static uint16_t hns3_get_imissed_stats_num(struct hns3_adapter *hns) { #define NO_IMISSED_STATS_NUM 0 @@ -993,7 +993,7 @@ hns3_imissed_stats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, struct hns3_adapter *hns = dev->data->dev_private; struct hns3_hw *hw = &hns->hw; struct hns3_rx_missed_stats *imissed_stats = &hw->imissed_stats; - int imissed_stats_num; + uint16_t imissed_stats_num; int cnt = *count; char *addr; uint16_t i; @@ -1170,7 +1170,7 @@ hns3_imissed_stats_name_get(struct rte_eth_dev *dev, { struct hns3_adapter *hns = dev->data->dev_private; uint32_t cnt = *count; - int imissed_stats_num; + uint16_t imissed_stats_num; uint16_t i; imissed_stats_num = hns3_get_imissed_stats_num(hns); @@ -1539,8 +1539,13 @@ hns3_stats_init(struct hns3_hw *hw) return ret; } - if (!hns->is_vf) - hns3_mac_stats_reset(hw); + if (!hns->is_vf) { + ret = hns3_mac_stats_reset(hw); + if (ret) { + hns3_err(hw, "reset mac stats failed, ret = %d", ret); + return ret; + } + } return hns3_tqp_stats_init(hw); }