DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v1] net/i40e: clear VF reset flags after resetting done
@ 2018-12-13 15:46 Zhirun Yan
  2018-12-14  1:11 ` Zhang, Qi Z
  0 siblings, 1 reply; 2+ messages in thread
From: Zhirun Yan @ 2018-12-13 15:46 UTC (permalink / raw)
  To: dev, qi.z.zhang; +Cc: Zhirun Yan, Haiyue Wang

The reset flags vf->vf_reset and vf->pend_msg are set when VF received
VIRTCHNL_EVENT_RESET_IMPENDING. So after resetting done, these flags
should be cleared.

Fixes: 8cacf78469a7 ("net/i40e: fix VF initialization error")

Signed-off-by: Zhirun Yan <zhirun.yan@intel.com>
Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
---
 drivers/net/i40e/i40e_ethdev_vf.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index ae55b9b18..7567e260a 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1080,9 +1080,11 @@ i40evf_enable_irq0(struct i40e_hw *hw)
 }
 
 static int
-i40evf_check_vf_reset_done(struct i40e_hw *hw)
+i40evf_check_vf_reset_done(struct rte_eth_dev *dev)
 {
 	int i, reset;
+	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
 
 	for (i = 0; i < MAX_RESET_WAIT_CNT; i++) {
 		reset = I40E_READ_REG(hw, I40E_VFGEN_RSTAT) &
@@ -1097,12 +1099,16 @@ i40evf_check_vf_reset_done(struct i40e_hw *hw)
 	if (i >= MAX_RESET_WAIT_CNT)
 		return -1;
 
+	vf->vf_reset = false;
+	vf->pend_msg &= ~PFMSG_RESET_IMPENDING;
+
 	return 0;
 }
 static int
-i40evf_reset_vf(struct i40e_hw *hw)
+i40evf_reset_vf(struct rte_eth_dev *dev)
 {
 	int ret;
+	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
 	if (i40e_vf_reset(hw) != I40E_SUCCESS) {
 		PMD_INIT_LOG(ERR, "Reset VF NIC failed");
@@ -1119,7 +1125,7 @@ i40evf_reset_vf(struct i40e_hw *hw)
 	  */
 	rte_delay_ms(200);
 
-	ret = i40evf_check_vf_reset_done(hw);
+	ret = i40evf_check_vf_reset_done(dev);
 	if (ret) {
 		PMD_INIT_LOG(ERR, "VF is still resetting");
 		return ret;
@@ -1145,7 +1151,7 @@ i40evf_init_vf(struct rte_eth_dev *dev)
 		goto err;
 	}
 
-	err = i40evf_check_vf_reset_done(hw);
+	err = i40evf_check_vf_reset_done(dev);
 	if (err)
 		goto err;
 
@@ -1157,7 +1163,7 @@ i40evf_init_vf(struct rte_eth_dev *dev)
 	}
 
 	/* Reset VF and wait until it's complete */
-	if (i40evf_reset_vf(hw)) {
+	if (i40evf_reset_vf(dev)) {
 		PMD_INIT_LOG(ERR, "reset NIC failed");
 		goto err_aq;
 	}
@@ -2256,7 +2262,7 @@ i40evf_dev_close(struct rte_eth_dev *dev)
 	i40evf_dev_promiscuous_disable(dev);
 	i40evf_dev_allmulticast_disable(dev);
 
-	i40evf_reset_vf(hw);
+	i40evf_reset_vf(dev);
 	i40e_shutdown_adminq(hw);
 	i40evf_disable_irq0(hw);
 	rte_eal_alarm_cancel(i40evf_dev_alarm_handler, dev);
-- 
2.17.1

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

* Re: [dpdk-dev] [PATCH v1] net/i40e: clear VF reset flags after resetting done
  2018-12-13 15:46 [dpdk-dev] [PATCH v1] net/i40e: clear VF reset flags after resetting done Zhirun Yan
@ 2018-12-14  1:11 ` Zhang, Qi Z
  0 siblings, 0 replies; 2+ messages in thread
From: Zhang, Qi Z @ 2018-12-14  1:11 UTC (permalink / raw)
  To: Yan, Zhirun, dev; +Cc: Wang, Haiyue



> -----Original Message-----
> From: Yan, Zhirun
> Sent: Thursday, December 13, 2018 11:47 PM
> To: dev@dpdk.org; Zhang, Qi Z <qi.z.zhang@intel.com>
> Cc: Yan, Zhirun <zhirun.yan@intel.com>; Wang, Haiyue <haiyue.wang@intel.com>
> Subject: [PATCH v1] net/i40e: clear VF reset flags after resetting done
> 
> The reset flags vf->vf_reset and vf->pend_msg are set when VF received
> VIRTCHNL_EVENT_RESET_IMPENDING. So after resetting done, these flags
> should be cleared.
> 
> Fixes: 8cacf78469a7 ("net/i40e: fix VF initialization error")
> 
> Signed-off-by: Zhirun Yan <zhirun.yan@intel.com>
> Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>

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

Applied to dpdk-next-net-intel.

Thanks
Qi

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

end of thread, other threads:[~2018-12-14  1:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-13 15:46 [dpdk-dev] [PATCH v1] net/i40e: clear VF reset flags after resetting done Zhirun Yan
2018-12-14  1:11 ` 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).