diff mbox series

[v4,6/7] net/i40e: return unknown speed in status

Message ID 20200702132139.28078-7-i.dyukov@samsung.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers show
Series ethdev: allow unknown link speed | expand

Checks

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

Commit Message

Ivan Dyukov July 2, 2020, 1:21 p.m. UTC
rte_ethdev has declared new NUM_UNKNOWN speed which
could be used in case when no speed information is available and
link is up. NUM_NONE should be returned, if link is down.

Signed-off-by: Ivan Dyukov <i.dyukov@samsung.com>
---
 drivers/net/i40e/i40e_ethdev.c    |  5 ++++-
 drivers/net/i40e/i40e_ethdev_vf.c | 10 +++++-----
 2 files changed, 9 insertions(+), 6 deletions(-)

Comments

Guo, Jia July 3, 2020, 8:13 a.m. UTC | #1
On 7/2/2020 9:21 PM, Ivan Dyukov wrote:
> rte_ethdev has declared new NUM_UNKNOWN speed which
> could be used in case when no speed information is available and
> link is up. NUM_NONE should be returned, if link is down.
>
> Signed-off-by: Ivan Dyukov <i.dyukov@samsung.com>
> ---
>   drivers/net/i40e/i40e_ethdev.c    |  5 ++++-
>   drivers/net/i40e/i40e_ethdev_vf.c | 10 +++++-----
>   2 files changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
> index 749d85f54..d09b77674 100644
> --- a/drivers/net/i40e/i40e_ethdev.c
> +++ b/drivers/net/i40e/i40e_ethdev.c
> @@ -2889,7 +2889,10 @@ 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_NONE;
> +		if (link->link_status)
> +			link->link_speed = ETH_SPEED_NUM_UNKNOWN;
> +		else
> +			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 bb5d28a44..1da185485 100644
> --- a/drivers/net/i40e/i40e_ethdev_vf.c
> +++ b/drivers/net/i40e/i40e_ethdev_vf.c
> @@ -2165,15 +2165,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_NONE;
> +		if (vf->link_up)
> +			new_link.link_speed = ETH_SPEED_NUM_UNKNOWN;
> +		else
> +			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 &&
> -				new_link.link_speed != ETH_SPEED_NUM_NONE
> -				? ETH_LINK_UP
> -				: ETH_LINK_DOWN;
> +	new_link.link_status = vf->link_up ? ETH_LINK_UP : ETH_LINK_DOWN;
>   	new_link.link_autoneg =
>   		!(dev->data->dev_conf.link_speeds & ETH_LINK_SPEED_FIXED);
>   

Acked-by: Jeff Guo <jia.guo@intel.com <mailto:jia.guo@intel.com>>
diff mbox series

Patch

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 749d85f54..d09b77674 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -2889,7 +2889,10 @@  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_NONE;
+		if (link->link_status)
+			link->link_speed = ETH_SPEED_NUM_UNKNOWN;
+		else
+			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 bb5d28a44..1da185485 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -2165,15 +2165,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_NONE;
+		if (vf->link_up)
+			new_link.link_speed = ETH_SPEED_NUM_UNKNOWN;
+		else
+			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 &&
-				new_link.link_speed != ETH_SPEED_NUM_NONE
-				? ETH_LINK_UP
-				: ETH_LINK_DOWN;
+	new_link.link_status = vf->link_up ? ETH_LINK_UP : ETH_LINK_DOWN;
 	new_link.link_autoneg =
 		!(dev->data->dev_conf.link_speeds & ETH_LINK_SPEED_FIXED);