dpdk/0380-net-hns3-fix-some-return-values.patch
Dengdui Huang bc76778e92 sync some patchs from upstreaming
Sync some patchs from upstreaming and modifies are as follow:
- net/hns3: fix mailbox sync
- net/hns3: report maximum buffer size
- ethdev: add maximum Rx buffer size
- app/procinfo: show RSS hash algorithm
- ethdev: get RSS algorithm names
- app/procinfo: adjust format of RSS info
- app/procinfo: fix RSS info
- net/hns3: support setting and querying RSS hash function
- net/hns3: report RSS hash algorithms capability
- ethdev: set and query RSS hash algorithm
- ethdev: clarify RSS related fields usage
- net/hns3: fix uninitialized hash algo value
- net/hns3: keep set/get algo key functions local
- net/hns3: fix some error logs
- net/hns3: fix some return values
- net/hns3: fix LRO offload to report
- net/hns3: fix setting DCB capability
- app/testpmd: ease configuring all offloads
- net/hns3: refactor interrupt state query
- net/hns3: fix IMP or global reset
- net/hns3: fix multiple reset detected log
- net/hns3: remove reset log in secondary
- net/hns3: fix double stats for IMP and global reset
- net/hns3: fix crash for NEON and SVE
- net/hns3: fix unchecked Rx free threshold
- net/hns3: fix typo in function name
- net/hns3: fix build warning
- telemetry: fix repeat display when callback don't init dict

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
2023-11-21 21:38:03 +08:00

101 lines
3.1 KiB
Diff

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