dpdk/0093-net-hns3-fix-unrelease-some-resources-on-reset-case.patch
Dengdui Huang 37c95ab89b sync some bugfixes from upstreaming
- net/hns3: fix unrelease some resources on reset case
 - net/hns3: fix divide by zero
 - net/hns3: fix incorrect failed rollback
 - net/hns3: fix memory leakage for indirect action
 - net/hns3: fix extra waiting for link up
 - net/hns3: fix variable overflow
 - net/hns3: fix memory leakage in failure path
 - devtools: fix symbol listing
 - net/hns3: remove weak symbols
 - net/hns3: fix reset timeout
 - net/hns3: fix copper port inialization
 - net/hns3: rename RAS module
 - net/hns3: remove PVID info dump for VF
 - net/hns3: fix mbuf freeing in simple Tx path

Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
(cherry picked from commit 4f2a5e819346fb5bf12b9de68352782319e4a2a6)
2025-04-28 15:33:14 +08:00

57 lines
1.8 KiB
Diff

From d64f33e9b9cc9d445927015da4055787d75d7ff4 Mon Sep 17 00:00:00 2001
From: Dengdui Huang <huangdengdui@huawei.com>
Date: Tue, 8 Apr 2025 16:31:00 +0800
Subject: [PATCH] net/hns3: fix unrelease some resources on reset case
[ upstream commit 56386ece674eea9e5a3cdbe130eeb278764a0a6c ]
Some resources, like, unmapping Rx interrupt, doesn't perform
when execute dev_stop on reset. This will lead to other issues.
Fixes: 2790c6464725 ("net/hns3: support device reset")
Cc: stable@dpdk.org
Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
---
drivers/net/hns3/hns3_ethdev.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index 032d5b6..d324a37 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -5219,20 +5219,22 @@ hns3_dev_stop(struct rte_eth_dev *dev)
struct hns3_hw *hw = &hns->hw;
PMD_INIT_FUNC_TRACE();
+ if (__atomic_load_n(&hw->reset.resetting, __ATOMIC_RELAXED) == 0) {
+ hns3_warn(hw, "device is resetting, stop operation is not allowed.");
+ return -EBUSY;
+ }
dev->data->dev_started = 0;
hw->adapter_state = HNS3_NIC_STOPPING;
hns3_stop_rxtx_datapath(dev);
rte_spinlock_lock(&hw->lock);
- if (__atomic_load_n(&hw->reset.resetting, __ATOMIC_RELAXED) == 0) {
- hns3_tm_dev_stop_proc(hw);
- hns3_config_mac_tnl_int(hw, false);
- hns3_stop_tqps(hw);
- hns3_do_stop(hns);
- hns3_unmap_rx_interrupt(dev);
- hw->adapter_state = HNS3_NIC_CONFIGURED;
- }
+ hns3_tm_dev_stop_proc(hw);
+ hns3_config_mac_tnl_int(hw, false);
+ hns3_stop_tqps(hw);
+ hns3_do_stop(hns);
+ hns3_unmap_rx_interrupt(dev);
+ hw->adapter_state = HNS3_NIC_CONFIGURED;
hns3_rx_scattered_reset(dev);
rte_eal_alarm_cancel(hns3_service_handler, dev);
hns3_stop_report_lse(dev);
--
2.25.1