Skip to content

Commit

Permalink
net/iavf: delay VF reset command
Browse files Browse the repository at this point in the history
Commit 0f9ec0c ("net/iavf: fix VF reset when using DCF"),
introduced a VF-reset adminq call into the reset sequence for iavf.
However, that call was very early in the sequence before other adminq
commands had been sent.

To delay the VF reset, we can put the message sending in the "dev_close"
function, right before the adminq is shut down, and thereby guaranteeing
that we won't have any subsequent issues with adminq messages.

In the process of making this change, we can also use the iavf_vf_reset
function from common/iavf, rather than hard-coding the message sending
lower-level calls in the net driver.

Fixes: e74e1bb ("net/iavf: enable port reset")
Fixes: 0f9ec0c ("net/iavf: fix VF reset when using DCF")
Cc: kaiwenx.deng@intel.com
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Tested-by: Hongbo Li <hongbox.li@intel.com>
  • Loading branch information
bruce-richardson committed Sep 17, 2024
1 parent fa95bb4 commit a071bb2
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 11 deletions.
1 change: 1 addition & 0 deletions drivers/common/iavf/iavf_prototype.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ STATIC INLINE struct iavf_rx_ptype_decoded decode_rx_desc_ptype(u8 ptype)
__rte_internal
void iavf_vf_parse_hw_config(struct iavf_hw *hw,
struct virtchnl_vf_resource *msg);
__rte_internal
enum iavf_status iavf_vf_reset(struct iavf_hw *hw);
__rte_internal
enum iavf_status iavf_aq_send_msg_to_pf(struct iavf_hw *hw,
Expand Down
1 change: 1 addition & 0 deletions drivers/common/iavf/version.map
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ INTERNAL {
iavf_set_mac_type;
iavf_shutdown_adminq;
iavf_vf_parse_hw_config;
iavf_vf_reset;

local: *;
};
12 changes: 1 addition & 11 deletions drivers/net/iavf/iavf_ethdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -2962,6 +2962,7 @@ iavf_dev_close(struct rte_eth_dev *dev)
if (vf->promisc_unicast_enabled || vf->promisc_multicast_enabled)
iavf_config_promisc(adapter, false, false);

iavf_vf_reset(hw);
iavf_shutdown_adminq(hw);
if (vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_WB_ON_ITR) {
/* disable uio intr before callback unregister */
Expand Down Expand Up @@ -3041,17 +3042,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);

if (!vf->in_reset_recovery) {
ret = iavf_aq_send_msg_to_pf(hw, VIRTCHNL_OP_RESET_VF,
IAVF_SUCCESS, NULL, 0, NULL);
if (ret) {
PMD_DRV_LOG(ERR, "fail to send cmd VIRTCHNL_OP_RESET_VF");
return ret;
}
}

/*
* Check whether the VF reset has been done and inform application,
* to avoid calling the virtual channel command, which may cause
Expand Down

0 comments on commit a071bb2

Please sign in to comment.