net/iavf: fix handle VF reset
Checks
Commit Message
This patch adds detection to avoid repeated calls to dev_reset.
And enables the iavf_dev_watchdog to detect some VF reset without PF event
(VIRTCHNL_EVENT_RESET_IMPENDING), one of which is after an NVM update.
Fixes: e74e1bb6280d ("net/iavf: enable port reset")
Fixes: 5e03e316c753 ("net/iavf: handle virtchnl event message without interrupt")
Cc: stable@dpdk.org
Signed-off-by: Zhichao Zeng <zhichaox.zeng@intel.com>
---
drivers/net/iavf/iavf.h | 2 +-
drivers/net/iavf/iavf_ethdev.c | 9 +++++++++
drivers/net/iavf/iavf_vchnl.c | 17 ++++++++++++-----
3 files changed, 22 insertions(+), 6 deletions(-)
@@ -31,7 +31,7 @@
#define IAVF_NUM_MACADDR_MAX 64
-#define IAVF_DEV_WATCHDOG_PERIOD 0
+#define IAVF_DEV_WATCHDOG_PERIOD 50000 /* 0 means disabled*/
#define IAVF_DEFAULT_RX_PTHRESH 8
#define IAVF_DEFAULT_RX_HTHRESH 8
@@ -299,6 +299,7 @@ iavf_dev_watchdog(void *cb_arg)
"VF \"%s\" reset event detected by watchdog",
adapter->vf.eth_dev->data->name);
+ adapter->vf.link_up = false;
/* enter reset state with VFLR event */
adapter->vf.vf_reset = true;
@@ -2806,7 +2807,15 @@ 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);
+
+ 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;
@@ -260,8 +260,12 @@ iavf_read_msg_from_pf(struct iavf_adapter *adapter, uint16_t buf_len,
vf->link_up ? "up" : "down");
break;
case VIRTCHNL_EVENT_RESET_IMPENDING:
- vf->vf_reset = true;
- PMD_DRV_LOG(INFO, "VF is resetting");
+ vf->link_up = false;
+ if (!vf->vf_reset) {
+ vf->vf_reset = true;
+ iavf_dev_event_post(vf->eth_dev, RTE_ETH_EVENT_INTR_RESET, NULL, 0);
+ PMD_DRV_LOG(INFO, "VF is resetting");
+ }
break;
case VIRTCHNL_EVENT_PF_DRIVER_CLOSE:
vf->dev_closed = true;
@@ -433,9 +437,12 @@ iavf_handle_pf_event_msg(struct rte_eth_dev *dev, uint8_t *msg,
switch (pf_msg->event) {
case VIRTCHNL_EVENT_RESET_IMPENDING:
PMD_DRV_LOG(DEBUG, "VIRTCHNL_EVENT_RESET_IMPENDING event");
- vf->vf_reset = true;
- iavf_dev_event_post(dev, RTE_ETH_EVENT_INTR_RESET,
- NULL, 0);
+ vf->link_up = false;
+ if (!vf->vf_reset) {
+ vf->vf_reset = true;
+ iavf_dev_event_post(dev, RTE_ETH_EVENT_INTR_RESET,
+ NULL, 0);
+ }
break;
case VIRTCHNL_EVENT_LINK_CHANGE:
PMD_DRV_LOG(DEBUG, "VIRTCHNL_EVENT_LINK_CHANGE event");