net/ixgbe: fix vf reset hw error handling

Message ID 20200902004425.33423-1-stevex.yang@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Qi Zhang
Headers
Series net/ixgbe: fix vf reset hw error handling |

Checks

Context Check Description
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/travis-robot success Travis build: passed
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

Steve Yang Sept. 2, 2020, 12:44 a.m. UTC
  The PF control message will interrupt the assigning MAC address for
VF when PF physical link down, and the VF reset operation returns
the IXGBE_ERR_INVALID_MAC_ADDR. In this case, reuses the MAC address
from eth_ixgbevf_dev_init() directly, no need care of PF assignment.

Fixes: f69166c9a3c9 ("net/ixgbe: fix reset error handling")

Signed-off-by: SteveX Yang <stevex.yang@intel.com>
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
  

Comments

Qiming Yang Sept. 3, 2020, 2:24 a.m. UTC | #1
Hi,

> -----Original Message-----
> From: Yang, SteveX <stevex.yang@intel.com>
> Sent: 2020年9月2日 8:44
> To: dev@dpdk.org
> Cc: Zhao1, Wei <wei.zhao1@intel.com>; Guo, Jia <jia.guo@intel.com>; Yang,
> Qiming <qiming.yang@intel.com>; Yang, SteveX <stevex.yang@intel.com>
> Subject: [PATCH] net/ixgbe: fix vf reset hw error handling
> 
> The PF control message will interrupt the assigning MAC address for VF when
> PF physical link down, and the VF reset operation returns the
> IXGBE_ERR_INVALID_MAC_ADDR. In this case, reuses the MAC address from
> eth_ixgbevf_dev_init() directly, no need care of PF assignment.

Better do not use function name.
Reuse the MAC address when device initialization instead of waiting PF reassign.

> 
> Fixes: f69166c9a3c9 ("net/ixgbe: fix reset error handling")
> 
> Signed-off-by: SteveX Yang <stevex.yang@intel.com>
> ---
>  drivers/net/ixgbe/ixgbe_ethdev.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c
> b/drivers/net/ixgbe/ixgbe_ethdev.c
> index fd0cb9b0e..c2fa59c73 100644
> --- a/drivers/net/ixgbe/ixgbe_ethdev.c
> +++ b/drivers/net/ixgbe/ixgbe_ethdev.c
> @@ -5326,10 +5326,17 @@ ixgbevf_dev_start(struct rte_eth_dev *dev)
>  	ixgbe_dev_wait_setup_link_complete(dev, 0);
> 
>  	err = hw->mac.ops.reset_hw(hw);
> -	if (err) {
> +
> +	/*
> +	 * The VF reset operation returns the
> IXGBE_ERR_INVALID_MAC_ADDR when
> +	 * the underlying PF driver has not assigned a MAC address to the VF.
> +	 * In this case, reuses the MAC address from eth_ixgbevf_dev_init().
> +	 */
> +	if (err != IXGBE_SUCCESS && err != IXGBE_ERR_INVALID_MAC_ADDR)

Is there any other cases will also caused IXGBE_ERR_INVALID_MAC_ADDR?

> {
>  		PMD_INIT_LOG(ERR, "Unable to reset vf hardware (%d)", err);
>  		return err;
>  	}
> +
>  	hw->mac.get_link_status = true;
> 
>  	/* negotiate mailbox API version to use with the PF. */
> --
> 2.17.1
  

Patch

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index fd0cb9b0e..c2fa59c73 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -5326,10 +5326,17 @@  ixgbevf_dev_start(struct rte_eth_dev *dev)
 	ixgbe_dev_wait_setup_link_complete(dev, 0);
 
 	err = hw->mac.ops.reset_hw(hw);
-	if (err) {
+
+	/*
+	 * The VF reset operation returns the IXGBE_ERR_INVALID_MAC_ADDR when
+	 * the underlying PF driver has not assigned a MAC address to the VF.
+	 * In this case, reuses the MAC address from eth_ixgbevf_dev_init().
+	 */
+	if (err != IXGBE_SUCCESS && err != IXGBE_ERR_INVALID_MAC_ADDR) {
 		PMD_INIT_LOG(ERR, "Unable to reset vf hardware (%d)", err);
 		return err;
 	}
+
 	hw->mac.get_link_status = true;
 
 	/* negotiate mailbox API version to use with the PF. */