DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] net/i40e: fix max frmame size config at port level
@ 2022-04-28 11:12 wenxuanx.wu
  2022-05-11  1:56 ` [PATCH v2] net/i40e: fix max frame " wenxuanx.wu
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: wenxuanx.wu @ 2022-04-28 11:12 UTC (permalink / raw)
  To: beilei.xing, dev; +Cc: wenxuanx.wu, yidingx.zhou, stable

From: Wenxuan Wu <wenxuanx.wu@intel.com>

Previously, max frame size can only be set when link is up, and the wait
time is 1 sec. But for nic media type of I40E_10G_BASET would consume longer
time which is too short to up would result in error.

Acctually, max frame size of media type I40E_MEDIA_TYPE_BASET can be set
regardless of link status.

This patch omit the status check of 10G_MEDIA_TYPE_BASET.

Fixes: a4ba77367923 ("net/i40e: enable maximum frame size at port level")
Cc: stable@dpdk.org

Signed-off-by: Wenxuan Wu <wenxuanx.wu@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 755786dc10..5762cd526a 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -12102,23 +12102,21 @@ i40e_set_mac_max_frame(struct rte_eth_dev *dev, uint16_t size)
 	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	uint32_t rep_cnt = MAX_REPEAT_TIME;
 	struct rte_eth_link link;
-	enum i40e_status_code status;
+	enum i40e_status_code status = I40E_ERR_DEVICE_NOT_SUPPORTED;
 
 	do {
 		update_link_reg(hw, &link);
 		if (link.link_status)
 			break;
-
 		rte_delay_ms(CHECK_INTERVAL);
 	} while (--rep_cnt);
 
-	if (link.link_status) {
+	/* Only I40E_MEDIA_TYPE_FIBER link up should be guaranteed */
+	if (hw->phy.media_type == I40E_MEDIA_TYPE_BASET || link.link_status)
 		status = i40e_aq_set_mac_config(hw, size, TRUE, 0, false, NULL);
-		if (status != I40E_SUCCESS)
-			PMD_DRV_LOG(ERR, "Failed to set max frame size at port level");
-	} else {
-		PMD_DRV_LOG(ERR, "Set max frame size at port level not applicable on link down");
-	}
+
+	if (status != I40E_SUCCESS)
+		PMD_DRV_LOG(ERR, "Failed to set max frame size at port level");
 }
 
 RTE_LOG_REGISTER_SUFFIX(i40e_logtype_init, init, NOTICE);
-- 
2.25.1


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

* [PATCH v2] net/i40e: fix max frame size config at port level
  2022-04-28 11:12 [PATCH] net/i40e: fix max frmame size config at port level wenxuanx.wu
@ 2022-05-11  1:56 ` wenxuanx.wu
  2022-05-11  4:04 ` wenxuanx.wu
  2022-05-13  7:20 ` [PATCH v3] " wenxuanx.wu
  2 siblings, 0 replies; 11+ messages in thread
From: wenxuanx.wu @ 2022-05-11  1:56 UTC (permalink / raw)
  To: beilei.xing, yuying.zhang, dev; +Cc: wenxuanx.wu, yidingx.zhou, stable

From: Wenxuan Wu <wenxuanx.wu@intel.com>

Previously, max frame size can only be set when link is up, and the wait
time is 1 sec. For media type of I40E_10G_BASET would consume longer
time which is too short to up would result in error.

Acctually, max frame size of media type I40E_MEDIA_TYPE_BASET can be set
regardless of link status.

This patch omit the status check of 10G_MEDIA_TYPE_BASET.

Fixes: a4ba77367923 ("net/i40e: enable maximum frame size at port level")
Cc: stable@dpdk.org

Signed-off-by: Wenxuan Wu <wenxuanx.wu@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 755786dc10..5762cd526a 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -12102,23 +12102,21 @@ i40e_set_mac_max_frame(struct rte_eth_dev *dev, uint16_t size)
 	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	uint32_t rep_cnt = MAX_REPEAT_TIME;
 	struct rte_eth_link link;
-	enum i40e_status_code status;
+	enum i40e_status_code status = I40E_ERR_DEVICE_NOT_SUPPORTED;
 
 	do {
 		update_link_reg(hw, &link);
 		if (link.link_status)
 			break;
-
 		rte_delay_ms(CHECK_INTERVAL);
 	} while (--rep_cnt);
 
-	if (link.link_status) {
+	/* Only I40E_MEDIA_TYPE_FIBER link up should be guaranteed */
+	if (hw->phy.media_type == I40E_MEDIA_TYPE_BASET || link.link_status)
 		status = i40e_aq_set_mac_config(hw, size, TRUE, 0, false, NULL);
-		if (status != I40E_SUCCESS)
-			PMD_DRV_LOG(ERR, "Failed to set max frame size at port level");
-	} else {
-		PMD_DRV_LOG(ERR, "Set max frame size at port level not applicable on link down");
-	}
+
+	if (status != I40E_SUCCESS)
+		PMD_DRV_LOG(ERR, "Failed to set max frame size at port level");
 }
 
 RTE_LOG_REGISTER_SUFFIX(i40e_logtype_init, init, NOTICE);
-- 
2.25.1


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

* [PATCH v2] net/i40e: fix max frame size config at port level
  2022-04-28 11:12 [PATCH] net/i40e: fix max frmame size config at port level wenxuanx.wu
  2022-05-11  1:56 ` [PATCH v2] net/i40e: fix max frame " wenxuanx.wu
@ 2022-05-11  4:04 ` wenxuanx.wu
  2022-05-13  6:27   ` Zhang, Yuying
  2022-05-13  7:20 ` [PATCH v3] " wenxuanx.wu
  2 siblings, 1 reply; 11+ messages in thread
From: wenxuanx.wu @ 2022-05-11  4:04 UTC (permalink / raw)
  To: beilei.xing, yuying.zhang, dev; +Cc: wenxuanx.wu, yidingx.zhou, stable

From: Wenxuan Wu <wenxuanx.wu@intel.com>

Previously, max frame size can only be set when link is up, and the wait
time is 1 sec. For media type of I40E_10G_BASET would consume longer
time which is too short to up would result in error.

Acctually, max frame size of media type I40E_MEDIA_TYPE_BASET can be set
regardless of link status.

This patch omitted the status check of 10G_MEDIA_TYPE_BASET.

Fixes: a4ba77367923 ("net/i40e: enable maximum frame size at port level")
Cc: stable@dpdk.org

Signed-off-by: Wenxuan Wu <wenxuanx.wu@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c | 32 +++++++++++++++++---------------
 1 file changed, 17 insertions(+), 15 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 755786dc10..383e9a542e 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -12102,23 +12102,25 @@ i40e_set_mac_max_frame(struct rte_eth_dev *dev, uint16_t size)
 	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	uint32_t rep_cnt = MAX_REPEAT_TIME;
 	struct rte_eth_link link;
-	enum i40e_status_code status;
-
-	do {
-		update_link_reg(hw, &link);
-		if (link.link_status)
-			break;
-
-		rte_delay_ms(CHECK_INTERVAL);
-	} while (--rep_cnt);
+	enum i40e_status_code status = I40E_ERR_DEVICE_NOT_SUPPORTED;
+	bool can_be_set = true;
+
+	/* I40E_MEDIA_TYPE_BASET link up can be ignored */
+	if (hw->phy.media_type != I40E_MEDIA_TYPE_BASET) {
+		do {
+			update_link_reg(hw, &link);
+			if (link.link_status)
+				break;
+			rte_delay_ms(CHECK_INTERVAL);
+		} while (--rep_cnt);
+		can_be_set = link.link_status != 0;
+	}
 
-	if (link.link_status) {
+	if (can_be_set)
 		status = i40e_aq_set_mac_config(hw, size, TRUE, 0, false, NULL);
-		if (status != I40E_SUCCESS)
-			PMD_DRV_LOG(ERR, "Failed to set max frame size at port level");
-	} else {
-		PMD_DRV_LOG(ERR, "Set max frame size at port level not applicable on link down");
-	}
+
+	if (status != I40E_SUCCESS)
+		PMD_DRV_LOG(ERR, "Failed to set max frame size at port level");
 }
 
 RTE_LOG_REGISTER_SUFFIX(i40e_logtype_init, init, NOTICE);
-- 
2.25.1


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

* RE: [PATCH v2] net/i40e: fix max frame size config at port level
  2022-05-11  4:04 ` wenxuanx.wu
@ 2022-05-13  6:27   ` Zhang, Yuying
  0 siblings, 0 replies; 11+ messages in thread
From: Zhang, Yuying @ 2022-05-13  6:27 UTC (permalink / raw)
  To: Wu, WenxuanX, Xing, Beilei, dev; +Cc: Zhou, YidingX, stable

Hi Wenxuan,

> -----Original Message-----
> From: Wu, WenxuanX <wenxuanx.wu@intel.com>
> Sent: Wednesday, May 11, 2022 12:05 PM
> To: Xing, Beilei <beilei.xing@intel.com>; Zhang, Yuying
> <yuying.zhang@intel.com>; dev@dpdk.org
> Cc: Wu, WenxuanX <wenxuanx.wu@intel.com>; Zhou, YidingX
> <yidingx.zhou@intel.com>; stable@dpdk.org
> Subject: [PATCH v2] net/i40e: fix max frame size config at port level
> 
> From: Wenxuan Wu <wenxuanx.wu@intel.com>
> 
> Previously, max frame size can only be set when link is up, and the wait time
> is 1 sec. For media type of I40E_10G_BASET would consume longer time
> which is too short to up would result in error.

Above sentence lacks of subject. 
"This time is too short for some media types such as I40E_10G_BASET to uplink
which results in error."

> 
> Acctually, max frame size of media type I40E_MEDIA_TYPE_BASET can be set
> regardless of link status.
> 
> This patch omitted the status check of 10G_MEDIA_TYPE_BASET.
> 
> Fixes: a4ba77367923 ("net/i40e: enable maximum frame size at port level")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Wenxuan Wu <wenxuanx.wu@intel.com>
> ---
>  drivers/net/i40e/i40e_ethdev.c | 32 +++++++++++++++++---------------
>  1 file changed, 17 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
> index 755786dc10..383e9a542e 100644
> --- a/drivers/net/i40e/i40e_ethdev.c
> +++ b/drivers/net/i40e/i40e_ethdev.c
> @@ -12102,23 +12102,25 @@ i40e_set_mac_max_frame(struct rte_eth_dev
> *dev, uint16_t size)
>  	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data-
> >dev_private);
>  	uint32_t rep_cnt = MAX_REPEAT_TIME;
>  	struct rte_eth_link link;
> -	enum i40e_status_code status;
> -
> -	do {
> -		update_link_reg(hw, &link);
> -		if (link.link_status)
> -			break;
> -
> -		rte_delay_ms(CHECK_INTERVAL);
> -	} while (--rep_cnt);
> +	enum i40e_status_code status = I40E_ERR_DEVICE_NOT_SUPPORTED;
> +	bool can_be_set = true;
> +
> +	/* I40E_MEDIA_TYPE_BASET link up can be ignored */
> +	if (hw->phy.media_type != I40E_MEDIA_TYPE_BASET) {
> +		do {
> +			update_link_reg(hw, &link);
> +			if (link.link_status)
> +				break;
> +			rte_delay_ms(CHECK_INTERVAL);
> +		} while (--rep_cnt);
> +		can_be_set = link.link_status != 0;
> +	}
> 
> -	if (link.link_status) {
> +	if (can_be_set)
>  		status = i40e_aq_set_mac_config(hw, size, TRUE, 0, false,
> NULL);
> -		if (status != I40E_SUCCESS)
> -			PMD_DRV_LOG(ERR, "Failed to set max frame size at
> port level");
> -	} else {
> -		PMD_DRV_LOG(ERR, "Set max frame size at port level not
> applicable on link down");

You can reserve above LOG to reduce the change of other types.

> -	}
> +
> +	if (status != I40E_SUCCESS)
> +		PMD_DRV_LOG(ERR, "Failed to set max frame size at port
> level");
>  }
> 
>  RTE_LOG_REGISTER_SUFFIX(i40e_logtype_init, init, NOTICE);
> --
> 2.25.1


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

* [PATCH v3] net/i40e: fix max frame size config at port level
  2022-04-28 11:12 [PATCH] net/i40e: fix max frmame size config at port level wenxuanx.wu
  2022-05-11  1:56 ` [PATCH v2] net/i40e: fix max frame " wenxuanx.wu
  2022-05-11  4:04 ` wenxuanx.wu
@ 2022-05-13  7:20 ` wenxuanx.wu
  2022-05-17 14:40   ` Zhang, Yuying
                     ` (2 more replies)
  2 siblings, 3 replies; 11+ messages in thread
From: wenxuanx.wu @ 2022-05-13  7:20 UTC (permalink / raw)
  To: beilei.xing, yuying.zhang, dev; +Cc: wenxuanx.wu, yidingx.zhou, stable

From: Wenxuan Wu <wenxuanx.wu@intel.com>

Previously, max frame size can only be set when link is up, and the wait
time is 1 sec. Startup time of 10G_BASET longer than 1s would result in
failure.

Acctually, max frame size of media type I40E_MEDIA_TYPE_BASET can be set
regardless of link status.

This patch omitted the link status check of 10G_MEDIA_TYPE_BASET.

Fixes: a4ba77367923 ("net/i40e: enable maximum frame size at port level")
Cc: stable@dpdk.org

Signed-off-by: Wenxuan Wu <wenxuanx.wu@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 755786dc10..12d3cd9b0c 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -12102,17 +12102,21 @@ i40e_set_mac_max_frame(struct rte_eth_dev *dev, uint16_t size)
 	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	uint32_t rep_cnt = MAX_REPEAT_TIME;
 	struct rte_eth_link link;
-	enum i40e_status_code status;
-
-	do {
-		update_link_reg(hw, &link);
-		if (link.link_status)
-			break;
-
-		rte_delay_ms(CHECK_INTERVAL);
-	} while (--rep_cnt);
+	enum i40e_status_code status = I40E_ERR_DEVICE_NOT_SUPPORTED;
+	bool can_be_set = true;
+
+	/* I40E_MEDIA_TYPE_BASET link up can be ignored */
+	if (hw->phy.media_type != I40E_MEDIA_TYPE_BASET) {
+		do {
+			update_link_reg(hw, &link);
+			if (link.link_status)
+				break;
+			rte_delay_ms(CHECK_INTERVAL);
+		} while (--rep_cnt);
+		can_be_set = link.link_status != 0;
+	}
 
-	if (link.link_status) {
+	if (can_be_set) {
 		status = i40e_aq_set_mac_config(hw, size, TRUE, 0, false, NULL);
 		if (status != I40E_SUCCESS)
 			PMD_DRV_LOG(ERR, "Failed to set max frame size at port level");
-- 
2.25.1


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

* RE: [PATCH v3] net/i40e: fix max frame size config at port level
  2022-05-13  7:20 ` [PATCH v3] " wenxuanx.wu
@ 2022-05-17 14:40   ` Zhang, Yuying
  2022-05-18  7:31     ` Wu, WenxuanX
  2022-05-18  4:49   ` [PATCH v4] " wenxuanx.wu
  2022-05-18  4:59   ` wenxuanx.wu
  2 siblings, 1 reply; 11+ messages in thread
From: Zhang, Yuying @ 2022-05-17 14:40 UTC (permalink / raw)
  To: Wu, WenxuanX, Xing, Beilei, dev; +Cc: Zhou, YidingX, stable

Hi Wenxuan,

> -----Original Message-----
> From: Wu, WenxuanX <wenxuanx.wu@intel.com>
> Sent: Friday, May 13, 2022 3:21 PM
> To: Xing, Beilei <beilei.xing@intel.com>; Zhang, Yuying
> <yuying.zhang@intel.com>; dev@dpdk.org
> Cc: Wu, WenxuanX <wenxuanx.wu@intel.com>; Zhou, YidingX
> <yidingx.zhou@intel.com>; stable@dpdk.org
> Subject: [PATCH v3] net/i40e: fix max frame size config at port level
> 
> From: Wenxuan Wu <wenxuanx.wu@intel.com>
> 
> Previously, max frame size can only be set when link is up, and the wait time
> is 1 sec. Startup time of 10G_BASET longer than 1s would result in failure.
> 
> Acctually, max frame size of media type I40E_MEDIA_TYPE_BASET can be set
> regardless of link status.
> 
> This patch omitted the link status check of 10G_MEDIA_TYPE_BASET.
> 
> Fixes: a4ba77367923 ("net/i40e: enable maximum frame size at port level")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Wenxuan Wu <wenxuanx.wu@intel.com>
> ---
>  drivers/net/i40e/i40e_ethdev.c | 24 ++++++++++++++----------
>  1 file changed, 14 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
> index 755786dc10..12d3cd9b0c 100644
> --- a/drivers/net/i40e/i40e_ethdev.c
> +++ b/drivers/net/i40e/i40e_ethdev.c
> @@ -12102,17 +12102,21 @@ i40e_set_mac_max_frame(struct rte_eth_dev
> *dev, uint16_t size)
>  	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data-
> >dev_private);
>  	uint32_t rep_cnt = MAX_REPEAT_TIME;
>  	struct rte_eth_link link;
> -	enum i40e_status_code status;
> -
> -	do {
> -		update_link_reg(hw, &link);
> -		if (link.link_status)
> -			break;
> -
> -		rte_delay_ms(CHECK_INTERVAL);
> -	} while (--rep_cnt);
> +	enum i40e_status_code status = I40E_ERR_DEVICE_NOT_SUPPORTED;

There is no need to initialize status. You can reserve the original code.

> +	bool can_be_set = true;
> +
> +	/* I40E_MEDIA_TYPE_BASET link up can be ignored */
> +	if (hw->phy.media_type != I40E_MEDIA_TYPE_BASET) {
> +		do {
> +			update_link_reg(hw, &link);
> +			if (link.link_status)
> +				break;
> +			rte_delay_ms(CHECK_INTERVAL);
> +		} while (--rep_cnt);
> +		can_be_set = link.link_status != 0;

can_be_set = !(! link.link_status);

> +	}
> 
> -	if (link.link_status) {
> +	if (can_be_set) {
>  		status = i40e_aq_set_mac_config(hw, size, TRUE, 0, false,
> NULL);
>  		if (status != I40E_SUCCESS)
>  			PMD_DRV_LOG(ERR, "Failed to set max frame size at
> port level");
> --
> 2.25.1


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

* [PATCH v4] net/i40e: fix max frame size config at port level
  2022-05-13  7:20 ` [PATCH v3] " wenxuanx.wu
  2022-05-17 14:40   ` Zhang, Yuying
@ 2022-05-18  4:49   ` wenxuanx.wu
  2022-05-18  4:59   ` wenxuanx.wu
  2 siblings, 0 replies; 11+ messages in thread
From: wenxuanx.wu @ 2022-05-18  4:49 UTC (permalink / raw)
  To: beilei.xing, yuying.zhang, dev; +Cc: wenxuanx.wu, yidingx.zhou, stable

From: Wenxuan Wu <wenxuanx.wu@intel.com>

Previously, max frame size can only be set when link is up, and the wait
time is 1 sec. Startup time of 10G_BASET longer than 1s would result in
failure.

Acctually, max frame size of media type I40E_MEDIA_TYPE_BASET can be set
regardless of link status.

This patch omitted the link status check of 10G_MEDIA_TYPE_BASET.

Fixes: a4ba77367923 ("net/i40e: enable maximum frame size at port level")
Cc: stable@dpdk.org

Signed-off-by: Wenxuan Wu <wenxuanx.wu@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 755786dc10..50182e0ea3 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -12103,16 +12103,20 @@ i40e_set_mac_max_frame(struct rte_eth_dev *dev, uint16_t size)
 	uint32_t rep_cnt = MAX_REPEAT_TIME;
 	struct rte_eth_link link;
 	enum i40e_status_code status;
+	bool can_be_set = true;
 
-	do {
-		update_link_reg(hw, &link);
-		if (link.link_status)
-			break;
-
-		rte_delay_ms(CHECK_INTERVAL);
-	} while (--rep_cnt);
+	/* I40E_MEDIA_TYPE_BASET link up can be ignored */
+	if (hw->phy.media_type != I40E_MEDIA_TYPE_BASET) {
+		do {
+			update_link_reg(hw, &link);
+			if (link.link_status)
+				break;
+			rte_delay_ms(CHECK_INTERVAL);
+		} while (--rep_cnt);
+		can_be_set = !(!link.link_status);
+	}
 
-	if (link.link_status) {
+	if (can_be_set) {
 		status = i40e_aq_set_mac_config(hw, size, TRUE, 0, false, NULL);
 		if (status != I40E_SUCCESS)
 			PMD_DRV_LOG(ERR, "Failed to set max frame size at port level");
-- 
2.25.1


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

* [PATCH v4] net/i40e: fix max frame size config at port level
  2022-05-13  7:20 ` [PATCH v3] " wenxuanx.wu
  2022-05-17 14:40   ` Zhang, Yuying
  2022-05-18  4:49   ` [PATCH v4] " wenxuanx.wu
@ 2022-05-18  4:59   ` wenxuanx.wu
  2022-05-19  5:22     ` Zhang, Qi Z
  2 siblings, 1 reply; 11+ messages in thread
From: wenxuanx.wu @ 2022-05-18  4:59 UTC (permalink / raw)
  To: beilei.xing, yuying.zhang, dev; +Cc: wenxuanx.wu, yidingx.zhou, stable

From: Wenxuan Wu <wenxuanx.wu@intel.com>

Previously, max frame size can only be set when link is up, and the wait
time is 1 sec. Startup time of 10G_BASET longer than 1s would result in
failure.

Acctually, max frame size of media type I40E_MEDIA_TYPE_BASET can be set
regardless of link status.

This patch omitted the link status check of 10G_MEDIA_TYPE_BASET.

Fixes: a4ba77367923 ("net/i40e: enable maximum frame size at port level")
Cc: stable@dpdk.org

Signed-off-by: Wenxuan Wu <wenxuanx.wu@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 755786dc10..7ffd7e7384 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -12103,16 +12103,20 @@ i40e_set_mac_max_frame(struct rte_eth_dev *dev, uint16_t size)
 	uint32_t rep_cnt = MAX_REPEAT_TIME;
 	struct rte_eth_link link;
 	enum i40e_status_code status;
+	bool can_be_set = true;
 
-	do {
-		update_link_reg(hw, &link);
-		if (link.link_status)
-			break;
-
-		rte_delay_ms(CHECK_INTERVAL);
-	} while (--rep_cnt);
+	/* I40E_MEDIA_TYPE_BASET link up can be ignored */
+	if (hw->phy.media_type != I40E_MEDIA_TYPE_BASET) {
+		do {
+			update_link_reg(hw, &link);
+			if (link.link_status)
+				break;
+			rte_delay_ms(CHECK_INTERVAL);
+		} while (--rep_cnt);
+		can_be_set = !!link.link_status;
+	}
 
-	if (link.link_status) {
+	if (can_be_set) {
 		status = i40e_aq_set_mac_config(hw, size, TRUE, 0, false, NULL);
 		if (status != I40E_SUCCESS)
 			PMD_DRV_LOG(ERR, "Failed to set max frame size at port level");
-- 
2.25.1


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

* RE: [PATCH v3] net/i40e: fix max frame size config at port level
  2022-05-17 14:40   ` Zhang, Yuying
@ 2022-05-18  7:31     ` Wu, WenxuanX
  2022-05-19  1:05       ` Zhang, Yuying
  0 siblings, 1 reply; 11+ messages in thread
From: Wu, WenxuanX @ 2022-05-18  7:31 UTC (permalink / raw)
  To: Zhang, Yuying, Xing, Beilei, dev; +Cc: Zhou, YidingX, stable

Hi, Yuying

> -----Original Message-----
> From: Zhang, Yuying <yuying.zhang@intel.com>
> Sent: 2022年5月17日 22:40
> To: Wu, WenxuanX <wenxuanx.wu@intel.com>; Xing, Beilei
> <beilei.xing@intel.com>; dev@dpdk.org
> Cc: Zhou, YidingX <yidingx.zhou@intel.com>; stable@dpdk.org
> Subject: RE: [PATCH v3] net/i40e: fix max frame size config at port level
> 
> Hi Wenxuan,
> 
> > -----Original Message-----
> > From: Wu, WenxuanX <wenxuanx.wu@intel.com>
> > Sent: Friday, May 13, 2022 3:21 PM
> > To: Xing, Beilei <beilei.xing@intel.com>; Zhang, Yuying
> > <yuying.zhang@intel.com>; dev@dpdk.org
> > Cc: Wu, WenxuanX <wenxuanx.wu@intel.com>; Zhou, YidingX
> > <yidingx.zhou@intel.com>; stable@dpdk.org
> > Subject: [PATCH v3] net/i40e: fix max frame size config at port level
> >
> > From: Wenxuan Wu <wenxuanx.wu@intel.com>
> >
> > Previously, max frame size can only be set when link is up, and the
> > wait time is 1 sec. Startup time of 10G_BASET longer than 1s would result in
> failure.
> >
> > Acctually, max frame size of media type I40E_MEDIA_TYPE_BASET can be
> > set regardless of link status.
> >
> > This patch omitted the link status check of 10G_MEDIA_TYPE_BASET.
> >
> > Fixes: a4ba77367923 ("net/i40e: enable maximum frame size at port
> > level")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Wenxuan Wu <wenxuanx.wu@intel.com>
> > ---
> >  drivers/net/i40e/i40e_ethdev.c | 24 ++++++++++++++----------
> >  1 file changed, 14 insertions(+), 10 deletions(-)
> >
> > diff --git a/drivers/net/i40e/i40e_ethdev.c
> > b/drivers/net/i40e/i40e_ethdev.c index 755786dc10..12d3cd9b0c 100644
> > --- a/drivers/net/i40e/i40e_ethdev.c
> > +++ b/drivers/net/i40e/i40e_ethdev.c
> > @@ -12102,17 +12102,21 @@ i40e_set_mac_max_frame(struct
> rte_eth_dev
> > *dev, uint16_t size)
> >  	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data-
> > >dev_private);
> >  	uint32_t rep_cnt = MAX_REPEAT_TIME;
> >  	struct rte_eth_link link;
> > -	enum i40e_status_code status;
> > -
> > -	do {
> > -		update_link_reg(hw, &link);
> > -		if (link.link_status)
> > -			break;
> > -
> > -		rte_delay_ms(CHECK_INTERVAL);
> > -	} while (--rep_cnt);
> > +	enum i40e_status_code status =
> I40E_ERR_DEVICE_NOT_SUPPORTED;
> 
> There is no need to initialize status. You can reserve the original code.
> 
Yeah, will fix in next version.
> > +	bool can_be_set = true;
> > +
> > +	/* I40E_MEDIA_TYPE_BASET link up can be ignored */
> > +	if (hw->phy.media_type != I40E_MEDIA_TYPE_BASET) {
> > +		do {
> > +			update_link_reg(hw, &link);
> > +			if (link.link_status)
> > +				break;
> > +			rte_delay_ms(CHECK_INTERVAL);
> > +		} while (--rep_cnt);
> > +		can_be_set = link.link_status != 0;
> 
> can_be_set = !(! link.link_status);
Will fix  like this without parentheses in next version e.g.  !(! link.link_status) -> !!link.link_status
> 
> > +	}
> >
> > -	if (link.link_status) {
> > +	if (can_be_set) {
> >  		status = i40e_aq_set_mac_config(hw, size, TRUE, 0, false,
> NULL);
> >  		if (status != I40E_SUCCESS)
> >  			PMD_DRV_LOG(ERR, "Failed to set max frame size at
> port level");
> > --
> > 2.25.1
Thanks
Wenxuan

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

* RE: [PATCH v3] net/i40e: fix max frame size config at port level
  2022-05-18  7:31     ` Wu, WenxuanX
@ 2022-05-19  1:05       ` Zhang, Yuying
  0 siblings, 0 replies; 11+ messages in thread
From: Zhang, Yuying @ 2022-05-19  1:05 UTC (permalink / raw)
  To: Wu, WenxuanX, Xing, Beilei, dev; +Cc: Zhou, YidingX, stable

Hi Wenxuan,
LGTM.

> -----Original Message-----
> From: Wu, WenxuanX <wenxuanx.wu@intel.com>
> Sent: Wednesday, May 18, 2022 3:32 PM
> To: Zhang, Yuying <yuying.zhang@intel.com>; Xing, Beilei
> <beilei.xing@intel.com>; dev@dpdk.org
> Cc: Zhou, YidingX <yidingx.zhou@intel.com>; stable@dpdk.org
> Subject: RE: [PATCH v3] net/i40e: fix max frame size config at port level
> 
> Hi, Yuying
> 
> > -----Original Message-----
> > From: Zhang, Yuying <yuying.zhang@intel.com>
> > Sent: 2022年5月17日 22:40
> > To: Wu, WenxuanX <wenxuanx.wu@intel.com>; Xing, Beilei
> > <beilei.xing@intel.com>; dev@dpdk.org
> > Cc: Zhou, YidingX <yidingx.zhou@intel.com>; stable@dpdk.org
> > Subject: RE: [PATCH v3] net/i40e: fix max frame size config at port
> > level
> >
> > Hi Wenxuan,
> >
> > > -----Original Message-----
> > > From: Wu, WenxuanX <wenxuanx.wu@intel.com>
> > > Sent: Friday, May 13, 2022 3:21 PM
> > > To: Xing, Beilei <beilei.xing@intel.com>; Zhang, Yuying
> > > <yuying.zhang@intel.com>; dev@dpdk.org
> > > Cc: Wu, WenxuanX <wenxuanx.wu@intel.com>; Zhou, YidingX
> > > <yidingx.zhou@intel.com>; stable@dpdk.org
> > > Subject: [PATCH v3] net/i40e: fix max frame size config at port
> > > level
> > >
> > > From: Wenxuan Wu <wenxuanx.wu@intel.com>
> > >
> > > Previously, max frame size can only be set when link is up, and the
> > > wait time is 1 sec. Startup time of 10G_BASET longer than 1s would
> > > result in
> > failure.
> > >
> > > Acctually, max frame size of media type I40E_MEDIA_TYPE_BASET can be
> > > set regardless of link status.
> > >
> > > This patch omitted the link status check of 10G_MEDIA_TYPE_BASET.
> > >
> > > Fixes: a4ba77367923 ("net/i40e: enable maximum frame size at port
> > > level")
> > > Cc: stable@dpdk.org
> > >
> > > Signed-off-by: Wenxuan Wu <wenxuanx.wu@intel.com>

Acked-by: Yuying Zhang <yuying.zhang@intel.com>

> > > ---
> > >  drivers/net/i40e/i40e_ethdev.c | 24 ++++++++++++++----------
> > >  1 file changed, 14 insertions(+), 10 deletions(-)
> > >
> > > diff --git a/drivers/net/i40e/i40e_ethdev.c
> > > b/drivers/net/i40e/i40e_ethdev.c index 755786dc10..12d3cd9b0c 100644
> > > --- a/drivers/net/i40e/i40e_ethdev.c
> > > +++ b/drivers/net/i40e/i40e_ethdev.c
> > > @@ -12102,17 +12102,21 @@ i40e_set_mac_max_frame(struct
> > rte_eth_dev
> > > *dev, uint16_t size)
> > >  	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data-
> > > >dev_private);
> > >  	uint32_t rep_cnt = MAX_REPEAT_TIME;
> > >  	struct rte_eth_link link;
> > > -	enum i40e_status_code status;
> > > -
> > > -	do {
> > > -		update_link_reg(hw, &link);
> > > -		if (link.link_status)
> > > -			break;
> > > -
> > > -		rte_delay_ms(CHECK_INTERVAL);
> > > -	} while (--rep_cnt);
> > > +	enum i40e_status_code status =
> > I40E_ERR_DEVICE_NOT_SUPPORTED;
> >
> > There is no need to initialize status. You can reserve the original code.
> >
> Yeah, will fix in next version.
> > > +	bool can_be_set = true;
> > > +
> > > +	/* I40E_MEDIA_TYPE_BASET link up can be ignored */
> > > +	if (hw->phy.media_type != I40E_MEDIA_TYPE_BASET) {
> > > +		do {
> > > +			update_link_reg(hw, &link);
> > > +			if (link.link_status)
> > > +				break;
> > > +			rte_delay_ms(CHECK_INTERVAL);
> > > +		} while (--rep_cnt);
> > > +		can_be_set = link.link_status != 0;
> >
> > can_be_set = !(! link.link_status);
> Will fix  like this without parentheses in next version e.g.  !(! link.link_status) -
> > !!link.link_status
> >
> > > +	}
> > >
> > > -	if (link.link_status) {
> > > +	if (can_be_set) {
> > >  		status = i40e_aq_set_mac_config(hw, size, TRUE, 0, false,
> > NULL);
> > >  		if (status != I40E_SUCCESS)
> > >  			PMD_DRV_LOG(ERR, "Failed to set max frame size at
> > port level");
> > > --
> > > 2.25.1
> Thanks
> Wenxuan

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

* RE: [PATCH v4] net/i40e: fix max frame size config at port level
  2022-05-18  4:59   ` wenxuanx.wu
@ 2022-05-19  5:22     ` Zhang, Qi Z
  0 siblings, 0 replies; 11+ messages in thread
From: Zhang, Qi Z @ 2022-05-19  5:22 UTC (permalink / raw)
  To: Wu, WenxuanX, Xing, Beilei, Zhang, Yuying, dev
  Cc: Wu, WenxuanX, Zhou, YidingX, stable



> -----Original Message-----
> From: wenxuanx.wu@intel.com <wenxuanx.wu@intel.com>
> Sent: Wednesday, May 18, 2022 12:59 PM
> To: Xing, Beilei <beilei.xing@intel.com>; Zhang, Yuying
> <yuying.zhang@intel.com>; dev@dpdk.org
> Cc: Wu, WenxuanX <wenxuanx.wu@intel.com>; Zhou, YidingX
> <yidingx.zhou@intel.com>; stable@dpdk.org
> Subject: [PATCH v4] net/i40e: fix max frame size config at port level
> 
> From: Wenxuan Wu <wenxuanx.wu@intel.com>
> 
> Previously, max frame size can only be set when link is up, and the wait time is
> 1 sec. Startup time of 10G_BASET longer than 1s would result in failure.
> 
> Acctually, max frame size of media type I40E_MEDIA_TYPE_BASET can be set
> regardless of link status.
> 
> This patch omitted the link status check of 10G_MEDIA_TYPE_BASET.
> 
> Fixes: a4ba77367923 ("net/i40e: enable maximum frame size at port level")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Wenxuan Wu <wenxuanx.wu@intel.com>

Added
Acked-by: Yuying Zhang <yuying.zhang@intel.com> from v3

Applied to dpdk-next-net-intel.

Thanks
Qi

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

end of thread, other threads:[~2022-05-19  5:22 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-28 11:12 [PATCH] net/i40e: fix max frmame size config at port level wenxuanx.wu
2022-05-11  1:56 ` [PATCH v2] net/i40e: fix max frame " wenxuanx.wu
2022-05-11  4:04 ` wenxuanx.wu
2022-05-13  6:27   ` Zhang, Yuying
2022-05-13  7:20 ` [PATCH v3] " wenxuanx.wu
2022-05-17 14:40   ` Zhang, Yuying
2022-05-18  7:31     ` Wu, WenxuanX
2022-05-19  1:05       ` Zhang, Yuying
2022-05-18  4:49   ` [PATCH v4] " wenxuanx.wu
2022-05-18  4:59   ` wenxuanx.wu
2022-05-19  5:22     ` Zhang, Qi Z

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ http://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git