Skip to contentSkip to conversation

ethdev: account for smaller MTU when setting default

PATCH Superseded Joshua Washington 1 participant 1 message Nov 7, 2023

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ethdev: account for smaller MTU when setting default

Currently, if not specified in the user configuration, rte_eth_dev_configure() sets the MTU of the device to RTE_EHTER_MTU. This value could potentially be larger than the MTU that the device supports. This change updates the configured MTU to be the minimum of the maximum suported MTU and the default DPDK MTU.

Fixes 1bb4a528c4 ("ethdev: fix max Rx packet length")
---
 lib/ethdev/rte_ethdev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
lib/ethdev/rte_ethdev.c +2 -1
index 9163ef47ea..bba94311d3 100644
@@ -1419,7 +1419,8 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
 	}
 
 	if (dev_conf->rxmode.mtu == 0)
-		dev->data->dev_conf.rxmode.mtu = RTE_ETHER_MTU;
+		dev->data->dev_conf.rxmode.mtu
+			= RTE_MIN(RTE_ETHER_MTU, dev_info.max_mtu);
 
 	ret = eth_dev_validate_mtu(port_id, &dev_info,
 			dev->data->dev_conf.rxmode.mtu);
Signature · 1 line
2.42.0.869.gea05f2083d-goog