[v4] net/i40e: fix max frame size config at port level

Message ID 20220518045914.271215-1-wenxuanx.wu@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Qi Zhang
Headers
Series [v4] net/i40e: fix max frame size config at port level |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/github-robot: build success github build: passed
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS

Commit Message

Wu, WenxuanX May 18, 2022, 4:59 a.m. UTC
  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(-)
  

Comments

Qi Zhang May 19, 2022, 5:22 a.m. UTC | #1
> -----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
  

Patch

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");