DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jie Hai <haijie1@huawei.com>
To: <dev@dpdk.org>, Yisen Zhuang <yisen.zhuang@huawei.com>,
	"Min Hu (Connor)" <humin29@huawei.com>,
	Hao Chen <chenh@yusur.tech>, Huisong Li <lihuisong@huawei.com>,
	Chengwen Feng <fengchengwen@huawei.com>,
	Ferruh Yigit <ferruh.yigit@intel.com>
Cc: <liudongdong3@huawei.com>
Subject: [PATCH 3/6] net/hns3: fix return value
Date: Tue, 31 Oct 2023 20:23:56 +0800	[thread overview]
Message-ID: <20231031122359.3930935-4-haijie1@huawei.com> (raw)
In-Reply-To: <20231031122359.3930935-1-haijie1@huawei.com>

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 <haijie1@huawei.com>
---
 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);
 }
-- 
2.30.0


  parent reply	other threads:[~2023-10-31 12:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-31 12:23 [PATCH 0/6] net/hns3: add some bugfix for hns3 Jie Hai
2023-10-31 12:23 ` [PATCH 1/6] net/hns3: fix setting DCB capability Jie Hai
2023-10-31 12:23 ` [PATCH 2/6] net/hns3: fix LRO offload to report Jie Hai
2023-10-31 12:23 ` Jie Hai [this message]
2023-10-31 12:23 ` [PATCH 4/6] net/hns3: fix some error log Jie Hai
2023-10-31 12:23 ` [PATCH 5/6] net/hns3: do not export API for setting and getting algo and key Jie Hai
2023-10-31 12:23 ` [PATCH 6/6] net/hns3: fix uninitialized value Jie Hai
2023-11-01 21:40 ` [PATCH 0/6] net/hns3: add some bugfix for hns3 Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231031122359.3930935-4-haijie1@huawei.com \
    --to=haijie1@huawei.com \
    --cc=chenh@yusur.tech \
    --cc=dev@dpdk.org \
    --cc=fengchengwen@huawei.com \
    --cc=ferruh.yigit@intel.com \
    --cc=humin29@huawei.com \
    --cc=lihuisong@huawei.com \
    --cc=liudongdong3@huawei.com \
    --cc=yisen.zhuang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).