DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/i40e: set speed to undefined for default case in link update
@ 2019-09-11 16:02 Thierry Herbelot
  2019-09-17  2:40 ` Zhang, Qi Z
  2019-09-30 10:53 ` Ye Xiaolong
  0 siblings, 2 replies; 3+ messages in thread
From: Thierry Herbelot @ 2019-09-11 16:02 UTC (permalink / raw)
  To: dev; +Cc: Laurent Hardy, Thomas Monjalon, stable, beilei.xing, qi.z.zhang

From: Laurent Hardy <laurent.hardy@6wind.com>

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: 4861cde46116 ('i40e: new poll mode driver')
Cc: stable@dpdk.org
Cc: beilei.xing@intel.com
Cc: qi.z.zhang@intel.com

Signed-off-by: Laurent Hardy <laurent.hardy@6wind.com>
---
 drivers/net/i40e/i40e_ethdev.c    | 4 ++--
 drivers/net/i40e/i40e_ethdev_vf.c | 8 +++++---
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 4e40b7ab5250..76abe8209a10 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -2743,7 +2743,7 @@ update_link_aq(struct i40e_hw *hw, struct rte_eth_link *link,
 		status = i40e_aq_get_link_info(hw, enable_lse,
 						&link_status, NULL);
 		if (unlikely(status != I40E_SUCCESS)) {
-			link->link_speed = ETH_SPEED_NUM_100M;
+			link->link_speed = ETH_SPEED_NUM_NONE;
 			link->link_duplex = ETH_LINK_FULL_DUPLEX;
 			PMD_DRV_LOG(ERR, "Failed to get link info");
 			return;
@@ -2777,7 +2777,7 @@ update_link_aq(struct i40e_hw *hw, struct rte_eth_link *link,
 		link->link_speed = ETH_SPEED_NUM_40G;
 		break;
 	default:
-		link->link_speed = ETH_SPEED_NUM_100M;
+		link->link_speed = ETH_SPEED_NUM_NONE;
 		break;
 	}
 }
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index c77b30c54ba7..a63b83f81718 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -2143,13 +2143,15 @@ i40evf_dev_link_update(struct rte_eth_dev *dev,
 		new_link.link_speed = ETH_SPEED_NUM_40G;
 		break;
 	default:
-		new_link.link_speed = ETH_SPEED_NUM_100M;
+		new_link.link_speed = ETH_SPEED_NUM_NONE;
 		break;
 	}
 	/* full duplex only */
 	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.20.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] net/i40e: set speed to undefined for default case in link update
  2019-09-11 16:02 [dpdk-dev] [PATCH] net/i40e: set speed to undefined for default case in link update Thierry Herbelot
@ 2019-09-17  2:40 ` Zhang, Qi Z
  2019-09-30 10:53 ` Ye Xiaolong
  1 sibling, 0 replies; 3+ messages in thread
From: Zhang, Qi Z @ 2019-09-17  2:40 UTC (permalink / raw)
  To: Thierry Herbelot, dev
  Cc: Laurent Hardy, Thomas Monjalon, stable, Xing, Beilei



> -----Original Message-----
> From: Thierry Herbelot [mailto:thierry.herbelot@6wind.com]
> Sent: Thursday, September 12, 2019 12:03 AM
> To: dev@dpdk.org
> Cc: Laurent Hardy <laurent.hardy@6wind.com>; Thomas Monjalon
> <thomas@monjalon.net>; stable@dpdk.org; Xing, Beilei
> <beilei.xing@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>
> Subject: [PATCH] net/i40e: set speed to undefined for default case in link
> update
> 
> From: Laurent Hardy <laurent.hardy@6wind.com>
> 
> 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: 4861cde46116 ('i40e: new poll mode driver')
> Cc: stable@dpdk.org
> Cc: beilei.xing@intel.com
> Cc: qi.z.zhang@intel.com
> 
> Signed-off-by: Laurent Hardy <laurent.hardy@6wind.com>

Acked-by: Qi Zhang <qi.z.zhang@intel.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] net/i40e: set speed to undefined for default case in link update
  2019-09-11 16:02 [dpdk-dev] [PATCH] net/i40e: set speed to undefined for default case in link update Thierry Herbelot
  2019-09-17  2:40 ` Zhang, Qi Z
@ 2019-09-30 10:53 ` Ye Xiaolong
  1 sibling, 0 replies; 3+ messages in thread
From: Ye Xiaolong @ 2019-09-30 10:53 UTC (permalink / raw)
  To: Thierry Herbelot
  Cc: dev, Laurent Hardy, Thomas Monjalon, stable, beilei.xing, qi.z.zhang

On 09/11, Thierry Herbelot wrote:
>From: Laurent Hardy <laurent.hardy@6wind.com>
>
>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: 4861cde46116 ('i40e: new poll mode driver')
>Cc: stable@dpdk.org
>Cc: beilei.xing@intel.com
>Cc: qi.z.zhang@intel.com
>
>Signed-off-by: Laurent Hardy <laurent.hardy@6wind.com>
>---
> drivers/net/i40e/i40e_ethdev.c    | 4 ++--
> drivers/net/i40e/i40e_ethdev_vf.c | 8 +++++---
> 2 files changed, 7 insertions(+), 5 deletions(-)
>

Reviewed-by: Xiaolong Ye <xiaolong.ye@intel.com>

Applied to dpdk-next-net-intel.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-09-30 10:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-11 16:02 [dpdk-dev] [PATCH] net/i40e: set speed to undefined for default case in link update Thierry Herbelot
2019-09-17  2:40 ` Zhang, Qi Z
2019-09-30 10:53 ` Ye Xiaolong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).