DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH v2] net/iavf: add VF reset check
@ 2023-06-02  2:37 Zhichao Zeng
  0 siblings, 0 replies; 3+ messages in thread
From: Zhichao Zeng @ 2023-06-02  2:37 UTC (permalink / raw)
  To: dev
  Cc: qi.z.zhang, Zhichao Zeng, Liang-Min Larry Wang, Jingjing Wu, Beilei Xing

In the current implementation, after application calls rte_eth_dev_reset,
it has no way to know if reset has been completed, and if the virtual
channel command is called before it is completed, it may cause the dev to
be abnormal. To avoid this issue, an uncertain delay need to be added.

This commit adds a VF reset check before the dev_reset to inform
the application not to invoke any virtual channel commands, to avoid making
the device to be abnormal.

Suggested-by: Liang-Min Larry Wang <liang-min.wang@intel.com>
Signed-off-by: Zhichao Zeng <zhichaox.zeng@intel.com>
---
 drivers/net/iavf/iavf_ethdev.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index e6cf897293..96004220a1 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -2855,7 +2855,20 @@ static int
 iavf_dev_reset(struct rte_eth_dev *dev)
 {
 	int ret;
+	struct iavf_hw *hw = IAVF_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+	/*
+	 * Check whether the VF reset has been done and inform application,
+	 * to avoid calling the virtual channel command, which may cause
+	 * the device to be abnormal.
+	 */
+	ret = iavf_check_vf_reset_done(hw);
+	if (ret) {
+		PMD_DRV_LOG(ERR, "Wait too long for reset done!\n");
+		return ret;
+	}
 
+	PMD_DRV_LOG(DEBUG, "Start dev_reset ...\n");
 	ret = iavf_dev_uninit(dev);
 	if (ret)
 		return ret;
-- 
2.34.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH v2] net/iavf: add VF reset check
  2023-06-02  2:38 ` [PATCH v2] " Zhichao Zeng
@ 2023-06-02  3:25   ` Zhang, Qi Z
  0 siblings, 0 replies; 3+ messages in thread
From: Zhang, Qi Z @ 2023-06-02  3:25 UTC (permalink / raw)
  To: Zeng, ZhichaoX, dev; +Cc: Wang, Liang-min, Wu, Jingjing, Xing, Beilei



> -----Original Message-----
> From: Zeng, ZhichaoX <zhichaox.zeng@intel.com>
> Sent: Friday, June 2, 2023 10:38 AM
> To: dev@dpdk.org
> Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Zeng, ZhichaoX
> <zhichaox.zeng@intel.com>; Wang, Liang-min <liang-min.wang@intel.com>;
> Wu, Jingjing <jingjing.wu@intel.com>; Xing, Beilei <beilei.xing@intel.com>
> Subject: [PATCH v2] net/iavf: add VF reset check
> 
> In the current implementation, after application calls rte_eth_dev_reset, it
> has no way to know if reset has been completed, and if the virtual channel
> command is called before it is completed, it may cause the dev to be
> abnormal. To avoid this issue, an uncertain delay need to be added.
> 
> This commit adds a VF reset check before the dev_reset to inform the
> application not to invoke any virtual channel commands, to avoid making the
> device to be abnormal.
> 
> Suggested-by: Liang-Min Larry Wang <liang-min.wang@intel.com>
> Signed-off-by: Zhichao Zeng <zhichaox.zeng@intel.com>

Acked-by: Qi Zhang <qi.z.zhang@intel.com>

Applied to dpdk-next-net-intel.

Thanks
Qi


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2] net/iavf: add VF reset check
  2023-05-25  2:17 [PATCH] " Zhichao Zeng
@ 2023-06-02  2:38 ` Zhichao Zeng
  2023-06-02  3:25   ` Zhang, Qi Z
  0 siblings, 1 reply; 3+ messages in thread
From: Zhichao Zeng @ 2023-06-02  2:38 UTC (permalink / raw)
  To: dev
  Cc: qi.z.zhang, Zhichao Zeng, Liang-Min Larry Wang, Jingjing Wu, Beilei Xing

In the current implementation, after application calls rte_eth_dev_reset,
it has no way to know if reset has been completed, and if the virtual
channel command is called before it is completed, it may cause the dev to
be abnormal. To avoid this issue, an uncertain delay need to be added.

This commit adds a VF reset check before the dev_reset to inform
the application not to invoke any virtual channel commands, to avoid making
the device to be abnormal.

Suggested-by: Liang-Min Larry Wang <liang-min.wang@intel.com>
Signed-off-by: Zhichao Zeng <zhichaox.zeng@intel.com>
---
 drivers/net/iavf/iavf_ethdev.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index e6cf897293..96004220a1 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -2855,7 +2855,20 @@ static int
 iavf_dev_reset(struct rte_eth_dev *dev)
 {
 	int ret;
+	struct iavf_hw *hw = IAVF_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+	/*
+	 * Check whether the VF reset has been done and inform application,
+	 * to avoid calling the virtual channel command, which may cause
+	 * the device to be abnormal.
+	 */
+	ret = iavf_check_vf_reset_done(hw);
+	if (ret) {
+		PMD_DRV_LOG(ERR, "Wait too long for reset done!\n");
+		return ret;
+	}
 
+	PMD_DRV_LOG(DEBUG, "Start dev_reset ...\n");
 	ret = iavf_dev_uninit(dev);
 	if (ret)
 		return ret;
-- 
2.34.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-06-02  3:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-02  2:37 [PATCH v2] net/iavf: add VF reset check Zhichao Zeng
  -- strict thread matches above, loose matches on Subject: below --
2023-05-25  2:17 [PATCH] " Zhichao Zeng
2023-06-02  2:38 ` [PATCH v2] " Zhichao Zeng
2023-06-02  3:25   ` Zhang, Qi Z

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).