patch 'net/iavf: fix crash on VF start' has been queued to stable release 23.11.1
Xueming Li
xuemingl at nvidia.com
Tue Mar 5 10:45:56 CET 2024
Hi,
FYI, your patch has been queued to stable release 23.11.1
Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 03/31/24. So please
shout if anyone has objections.
Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.
Queued patches are on a temporary branch at:
https://git.dpdk.org/dpdk-stable/log/?h=23.11-staging
This queued commit can be viewed at:
https://git.dpdk.org/dpdk-stable/commit/?h=23.11-staging&id=9aa2da4c022425461eb21ffbfef889edae9bd881
Thanks.
Xueming Li <xuemingl at nvidia.com>
---
>From 9aa2da4c022425461eb21ffbfef889edae9bd881 Mon Sep 17 00:00:00 2001
From: Shiyang He <shiyangx.he at intel.com>
Date: Wed, 3 Jan 2024 10:42:07 +0000
Subject: [PATCH] net/iavf: fix crash on VF start
Cc: Xueming Li <xuemingl at nvidia.com>
[ upstream commit 80fb3c92045824da18af333ee8a758145b54b19f ]
When the VF starts to request multiple queues, the PF sends a reset
command to the VF. During the reset process, adminq sends an abnormal
message to PF for an unknown reason, and the resource request fails
resulting in a coredump.
This patch fixes the issue by checking the reset state before resetting.
Fixes: 3e6a5d2d310a ("net/iavf: add devargs to enable VF auto-reset")
Signed-off-by: Shiyang He <shiyangx.he at intel.com>
Acked-by: Qi Zhang <qi.z.zhang at intel.com>
---
drivers/net/iavf/iavf.h | 3 ++-
drivers/net/iavf/iavf_ethdev.c | 45 +++++++++++++++++++++++++++-------
2 files changed, 38 insertions(+), 10 deletions(-)
diff --git a/drivers/net/iavf/iavf.h b/drivers/net/iavf/iavf.h
index 5bfe85dabd..d273d884f5 100644
--- a/drivers/net/iavf/iavf.h
+++ b/drivers/net/iavf/iavf.h
@@ -19,6 +19,7 @@
#define IAVF_AQ_LEN 32
#define IAVF_AQ_BUF_SZ 4096
#define IAVF_RESET_WAIT_CNT 2000
+#define IAVF_RESET_DETECTED_CNT 500
#define IAVF_BUF_SIZE_MIN 1024
#define IAVF_FRAME_SIZE_MAX 9728
#define IAVF_QUEUE_BASE_ADDR_UNIT 128
@@ -511,6 +512,6 @@ int iavf_flow_sub_check(struct iavf_adapter *adapter,
struct iavf_fsub_conf *filter);
void iavf_dev_watchdog_enable(struct iavf_adapter *adapter);
void iavf_dev_watchdog_disable(struct iavf_adapter *adapter);
-int iavf_handle_hw_reset(struct rte_eth_dev *dev);
+void iavf_handle_hw_reset(struct rte_eth_dev *dev);
void iavf_set_no_poll(struct iavf_adapter *adapter, bool link_change);
#endif /* _IAVF_ETHDEV_H_ */
diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index 0952998304..32a1626420 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -1088,9 +1088,6 @@ iavf_dev_stop(struct rte_eth_dev *dev)
PMD_INIT_FUNC_TRACE();
- if (vf->vf_reset)
- return 0;
-
if (adapter->closed)
return -1;
@@ -2955,7 +2952,6 @@ iavf_dev_reset(struct rte_eth_dev *dev)
struct iavf_adapter *adapter =
IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
struct iavf_hw *hw = IAVF_DEV_PRIVATE_TO_HW(dev->data->dev_private);
- struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
/*
* Check whether the VF reset has been done and inform application,
@@ -2967,7 +2963,6 @@ iavf_dev_reset(struct rte_eth_dev *dev)
PMD_DRV_LOG(ERR, "Wait too long for reset done!\n");
return ret;
}
- vf->vf_reset = false;
iavf_set_no_poll(adapter, false);
PMD_DRV_LOG(DEBUG, "Start dev_reset ...\n");
@@ -2978,17 +2973,47 @@ iavf_dev_reset(struct rte_eth_dev *dev)
return iavf_dev_init(dev);
}
+static inline bool
+iavf_is_reset(struct iavf_hw *hw)
+{
+ return !(IAVF_READ_REG(hw, IAVF_VF_ARQLEN1) &
+ IAVF_VF_ARQLEN1_ARQENABLE_MASK);
+}
+
+static bool
+iavf_is_reset_detected(struct iavf_adapter *adapter)
+{
+ struct iavf_hw *hw = IAVF_DEV_PRIVATE_TO_HW(adapter);
+ int i;
+
+ /* poll until we see the reset actually happen */
+ for (i = 0; i < IAVF_RESET_DETECTED_CNT; i++) {
+ if (iavf_is_reset(hw))
+ return true;
+ rte_delay_ms(20);
+ }
+
+ return false;
+}
+
/*
* Handle hardware reset
*/
-int
+void
iavf_handle_hw_reset(struct rte_eth_dev *dev)
{
- struct iavf_adapter *adapter =
- IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
+ struct iavf_adapter *adapter = dev->data->dev_private;
int ret;
+ if (!dev->data->dev_started)
+ return;
+
+ if (!iavf_is_reset_detected(adapter)) {
+ PMD_DRV_LOG(DEBUG, "reset not start\n");
+ return;
+ }
+
vf->in_reset_recovery = true;
iavf_set_no_poll(adapter, false);
@@ -3007,6 +3032,7 @@ iavf_handle_hw_reset(struct rte_eth_dev *dev)
ret = iavf_dev_start(dev);
if (ret)
goto error;
+
dev->data->dev_started = 1;
goto exit;
@@ -3015,7 +3041,8 @@ error:
exit:
vf->in_reset_recovery = false;
iavf_set_no_poll(adapter, false);
- return ret;
+
+ return;
}
void
--
2.34.1
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2024-03-05 17:39:31.566084319 +0800
+++ 0015-net-iavf-fix-crash-on-VF-start.patch 2024-03-05 17:39:30.683566490 +0800
@@ -1 +1 @@
-From 80fb3c92045824da18af333ee8a758145b54b19f Mon Sep 17 00:00:00 2001
+From 9aa2da4c022425461eb21ffbfef889edae9bd881 Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit 80fb3c92045824da18af333ee8a758145b54b19f ]
@@ -14 +16,0 @@
-Cc: stable at dpdk.org
More information about the stable
mailing list