[v3] net/ixgbe: fix ixgbevf link status

Message ID 20180726022449.108272-1-yanglong.wu@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Qi Zhang
Headers
Series [v3] net/ixgbe: fix ixgbevf link status |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Yanglong Wu July 26, 2018, 2:24 a.m. UTC
  ixgbevf can't get right link status unless
it check PF link status in wait mode.

Fixes: dc66e5fd01b9 ("net/ixgbe: improve link state check on VF")

Signed-off-by: Yanglong Wu <yanglong.wu@intel.com>
---
v3:
change to wait mode in ixgbevf
---
v2:
no need to set link status again
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Comments

Wang, Dong1 July 26, 2018, 2:49 a.m. UTC | #1
Hi Yanglong,

I think the risk (or bug) is in ixgbevf_check_link(), not how to invoke this function(). Anyone who call ixgbevf_check_link() with "wait = 0", they must can't get right link status when 82599 use DA Cable.

In ixgbevf kernel driver, ixgbe_check_mac_link_vf(), "wait" didn't be referenced.

What about reference to ixgbevf kernel driver, don't use "wait" parameter in ixgbevf_check_link()?

Regards,
Dong

-----Original Message-----
From: Wu, Yanglong 
Sent: Thursday, July 26, 2018 10:25
To: dev@dpdk.org
Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Wang, Dong1 <dong1.wang@intel.com>; Wu, Yanglong <yanglong.wu@intel.com>
Subject: [PATCH v3] net/ixgbe: fix ixgbevf link status

ixgbevf can't get right link status unless it check PF link status in wait mode.

Fixes: dc66e5fd01b9 ("net/ixgbe: improve link state check on VF")

Signed-off-by: Yanglong Wu <yanglong.wu@intel.com>
---
v3:
change to wait mode in ixgbevf
---
v2:
no need to set link status again
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 26b192737..b90b352e3 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -4006,7 +4006,8 @@ ixgbe_dev_link_update_share(struct rte_eth_dev *dev,
 		wait = 0;
 
 	if (vf)
-		diag = ixgbevf_check_link(hw, &link_speed, &link_up, wait);
+		/* ixgbevf need to wait to get link status */
+		diag = ixgbevf_check_link(hw, &link_speed, &link_up, 1);
 	else
 		diag = ixgbe_check_link(hw, &link_speed, &link_up, wait);
 
--
2.11.0
  
Qi Zhang July 26, 2018, 5:17 a.m. UTC | #2
> -----Original Message-----
> From: Wu, Yanglong
> Sent: Thursday, July 26, 2018 10:25 AM
> To: dev@dpdk.org
> Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Wang, Dong1
> <dong1.wang@intel.com>; Wu, Yanglong <yanglong.wu@intel.com>
> Subject: [PATCH v3] net/ixgbe: fix ixgbevf link status
> 
> ixgbevf can't get right link status unless it check PF link status in wait mode.
> 
> Fixes: dc66e5fd01b9 ("net/ixgbe: improve link state check on VF")
> 
> Signed-off-by: Yanglong Wu <yanglong.wu@intel.com>
> ---
> v3:
> change to wait mode in ixgbevf
> ---
> v2:
> no need to set link status again
> ---
>  drivers/net/ixgbe/ixgbe_ethdev.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c
> b/drivers/net/ixgbe/ixgbe_ethdev.c
> index 26b192737..b90b352e3 100644
> --- a/drivers/net/ixgbe/ixgbe_ethdev.c
> +++ b/drivers/net/ixgbe/ixgbe_ethdev.c
> @@ -4006,7 +4006,8 @@ ixgbe_dev_link_update_share(struct rte_eth_dev
> *dev,
>  		wait = 0;
> 
>  	if (vf)
> -		diag = ixgbevf_check_link(hw, &link_speed, &link_up, wait);
> +		/* ixgbevf need to wait to get link status */
> +		diag = ixgbevf_check_link(hw, &link_speed, &link_up, 1);

Sorry, I mislead you in our offline talk.
I think to implement a no_wait ops with a wait method may confuse the user, because an application may call rte_eth_link_get_nowait in the data path, we should not do any time consume tasks.
So maybe the reasonable way is return -ENOTSUP for a nowait request since ixgbevf can't support this due to hardware limitation.
And also the parameter " wait_to_complete" can be omitted in ixgbevf_check_link, since the nowait implementation is not correct and should be removed.


>  	else
>  		diag = ixgbe_check_link(hw, &link_speed, &link_up, wait);
> 
> --
> 2.11.0
  

Patch

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 26b192737..b90b352e3 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -4006,7 +4006,8 @@  ixgbe_dev_link_update_share(struct rte_eth_dev *dev,
 		wait = 0;
 
 	if (vf)
-		diag = ixgbevf_check_link(hw, &link_speed, &link_up, wait);
+		/* ixgbevf need to wait to get link status */
+		diag = ixgbevf_check_link(hw, &link_speed, &link_up, 1);
 	else
 		diag = ixgbe_check_link(hw, &link_speed, &link_up, wait);