[DPDK] net/i40e: max frame size config regardless of link status

wenxuanx.wu at intel.com wenxuanx.wu at intel.com
Fri Apr 15 05:14:48 CEST 2022


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

Previously, max frame size can only be set when link is up, testpmd configuration
when port is down, so there is a confilict to apply this max frame size before
link up.

Actual results:

Set max frame size at port level not applicable on link down
----
  RX-packets: 0          RX-missed: 0          RX-bytes:  0
  RX-errors: 1
  RX-nombuf:  0
  TX-packets: 0          TX-errors: 0          TX-bytes:  0  Throughput (since last show)
  Rx-pps:            0          Rx-bps:            0
  Tx-pps:    

Expected results:
----
  RX-packets: 1          RX-missed: 0          RX-bytes:  5061
  RX-errors: 0
  RX-nombuf:  0
  TX-packets: 0          TX-errors: 0          TX-bytes:  0  Throughput (since last show)
  Rx-pps:            0          Rx-bps:         3464
  Tx-pps:            0          Tx-bps:            0

This fix resolve max frame configuration regardless of link status, which  means
port mtu can be set whether link is down or up which is identical to ifconfig mtu
config. 

Fixes: a4ba77367923 
Cc: stable at dpdk.org 
Signed-off-by: Wenxuan Wu <wenxuanx.wu at intel.com>

---
 drivers/net/i40e/i40e_ethdev.c | 21 ++++-----------------
 1 file changed, 4 insertions(+), 17 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 755786dc10..25c40ffceb 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -12100,25 +12100,12 @@ static void
 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);
-
-	if (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");
-	}
+	status = i40e_aq_set_mac_config(hw, size, TRUE, 0, false, NULL);
+	if (status)
+		PMD_DRV_LOG(ERR, "Failed to set max frame size at port level");
+	return;
 }
 
 RTE_LOG_REGISTER_SUFFIX(i40e_logtype_init, init, NOTICE);
-- 
2.25.1



More information about the stable mailing list