1 Star 0 Fork 75

sky/dpdk

forked from src-openEuler/dpdk 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0380-net-hns3-fix-some-return-values.patch 3.06 KB
一键复制 编辑 原始数据 按行查看 历史
huangdengdui 提交于 2023-11-20 17:28 . sync some patchs from upstreaming
From 52f35192771e5a62412a5fcaebd0d694355efdfa Mon Sep 17 00:00:00 2001
From: Jie Hai <haijie1@huawei.com>
Date: Tue, 31 Oct 2023 20:23:56 +0800
Subject: [PATCH 380/394] net/hns3: fix some return values
[ upstream commit 08159599978f7f7eb6c4aaed7c290e33b8bc3d64 ]
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 ba4fe13c01..db1a30aff0 100644
--- a/drivers/net/hns3/hns3_ethdev_vf.c
+++ b/drivers/net/hns3/hns3_ethdev_vf.c
@@ -2162,8 +2162,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 c80fa59e63..d100e58d10 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 c2e692a2c5..9a1e8935e5 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.23.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/nlgwcy/dpdk.git
git@gitee.com:nlgwcy/dpdk.git
nlgwcy
dpdk
dpdk
master

搜索帮助