diff mbox series

[v2,2/6] net/iavf: set speed to undefined for default case

Message ID 20200827011410.18401-3-stevex.yang@intel.com (mailing list archive)
State Changes Requested, archived
Delegated to: Qi Zhang
Headers show
Series [v2,1/6] net/iavf: fix scattered Rx enabling | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Steve Yang Aug. 27, 2020, 1:14 a.m. UTC
During PF/VF link update, a default speed value of 100M will be set
if get_link_info has failed or speed is unknown.

Consequently if PF is put in no-carrier state, VFs will switch to
"in carrier" state due to a link up + a link speed set to 100M
(default value if no speed detected).

To be consistent with linux drivers on which PF and VFs are in
same carrier state, sets default speed to undefined (instead of 100M)
and updates a link status of VF only if link is up and speed is
different from undefined.

Fixes: 48de41ca11f0 ("net/avf: enable link status update")

Signed-off-by: SteveX Yang <stevex.yang@intel.com>
---
 drivers/net/iavf/iavf_ethdev.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Xing, Beilei Aug. 27, 2020, 6:46 a.m. UTC | #1
> -----Original Message-----
> From: Yang, SteveX <stevex.yang@intel.com>
> Sent: Thursday, August 27, 2020 9:14 AM
> To: dev@dpdk.org
> Cc: Yang, Qiming <qiming.yang@intel.com>; Wu, Jingjing
> <jingjing.wu@intel.com>; Xing, Beilei <beilei.xing@intel.com>; Yang, SteveX
> <stevex.yang@intel.com>
> Subject: [PATCH v2 2/6] net/iavf: set speed to undefined for default case
> 
> During PF/VF link update, a default speed value of 100M will be set if
> get_link_info has failed or speed is unknown.
> 
> Consequently if PF is put in no-carrier state, VFs will switch to "in carrier" state
> due to a link up + a link speed set to 100M (default value if no speed detected).
> 
> To be consistent with linux drivers on which PF and VFs are in same carrier
> state, sets default speed to undefined (instead of 100M) and updates a link
> status of VF only if link is up and speed is different from undefined.

The original fix is focus on i40e, the fix includes changes for both PF and VF.
But this patch is only for iavf, so please pay attention:
1. rework the commit log, since the PF changes has been applied.
2. double check if the issue exists on ice.

Thanks,
Beilei

> 
> Fixes: 48de41ca11f0 ("net/avf: enable link status update")
> 
> Signed-off-by: SteveX Yang <stevex.yang@intel.com>
> ---
>  drivers/net/iavf/iavf_ethdev.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
> index f9dd5710c..ae508f2f0 100644
> --- a/drivers/net/iavf/iavf_ethdev.c
> +++ b/drivers/net/iavf/iavf_ethdev.c
> @@ -620,8 +620,9 @@ iavf_dev_link_update(struct rte_eth_dev *dev,
>  	}
> 
>  	new_link.link_duplex = ETH_LINK_FULL_DUPLEX;
> -	new_link.link_status = vf->link_up ? ETH_LINK_UP :
> -					     ETH_LINK_DOWN;
> +	new_link.link_status = (vf->link_up &&
> +				new_link.link_speed !=
> ETH_SPEED_NUM_NONE)
> +				? ETH_LINK_UP : ETH_LINK_DOWN;
>  	new_link.link_autoneg = !(dev->data->dev_conf.link_speeds &
>  				ETH_LINK_SPEED_FIXED);
> 
> --
> 2.17.1
diff mbox series

Patch

diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index f9dd5710c..ae508f2f0 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -620,8 +620,9 @@  iavf_dev_link_update(struct rte_eth_dev *dev,
 	}
 
 	new_link.link_duplex = ETH_LINK_FULL_DUPLEX;
-	new_link.link_status = vf->link_up ? ETH_LINK_UP :
-					     ETH_LINK_DOWN;
+	new_link.link_status = (vf->link_up &&
+				new_link.link_speed != ETH_SPEED_NUM_NONE)
+				? ETH_LINK_UP : ETH_LINK_DOWN;
 	new_link.link_autoneg = !(dev->data->dev_conf.link_speeds &
 				ETH_LINK_SPEED_FIXED);