[DPDK/ethdev Bug 1768] net/mlx5: get_mtu returns 1500 on startup instead of kernel driver MTU
bugzilla at dpdk.org
bugzilla at dpdk.org
Mon Aug 11 23:30:05 CEST 2025
https://bugs.dpdk.org/show_bug.cgi?id=1768
Bug ID: 1768
Summary: net/mlx5: get_mtu returns 1500 on startup instead of
kernel driver MTU
Product: DPDK
Version: 24.11
Hardware: All
OS: All
Status: UNCONFIRMED
Severity: normal
Priority: Normal
Component: ethdev
Assignee: dev at dpdk.org
Reporter: brian90013 at gmail.com
Target Milestone: ---
Hello,
I observe this issue with both DPDK 24.11 and 25.07 on Debian 12 with DOCA
3.0.0 and a ConnectX-5 NIC. My code calls rte_eth_dev_get_mtu() to determine
the existing MTU value of the kernel driver before initializing DPDK. Then it
sets rte_eth_conf.rxmode.mtu equal to the returned value and calls
rte_eth_dev_configure(). This way DPDK uses the same MTU as the kernel driver.
However, when running this code I observe the initial rte_eth_dev_get_mtu()
call always returns 1500B. I have tried setting kernel MTUs of 800, 3000, 4000,
and 9000B. I added tracing to lib/ethdev and drivers/net/mlx5 and believe the
issue is because while mlx5 determines and stores the current MTU, that value
is not propagated back to the ethdev structure.
My attempt at a timeline:
* mlx5_dev_spawn() sets priv->mtu = RTE_ETHER_MTU (1500)
* mlx5_dev_spawn() sets eth_dev = rte_eth_dev_allocate()
* rte_eth_dev_allocate() sets eth_dev->data->mtu = RTE_ETHER_MTU (1500)
* mlx5_dev_spawn() gets actual MTU calling mlx5_get_mtu(&priv->mtu)
#### eth_dev->data->mtu doesn't get updated ####
* I call rte_eth_dev_get_mtu() which returns 1500
For testing, I tried this patch to set the rte_eth_dev_data.mtu field equal to
the value returned from mlx5_get_mtu(). With this change, my code works as
expected. I hope something like this can be merged to allow cooperation between
the kernel and DPDK drivers. Thank you for your time and your work on mlx5!
--- a/drivers/net/mlx5/linux/mlx5_os.c
+++ b/drivers/net/mlx5/linux/mlx5_os.c
@@ -1594,6 +1594,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
}
DRV_LOG(DEBUG, "port %u MTU is %u", eth_dev->data->port_id,
priv->mtu);
+ ethdev->data->mtu = priv->mtu;
/* Initialize burst functions to prevent crashes before link-up. */
eth_dev->rx_pkt_burst = rte_eth_pkt_burst_dummy;
eth_dev->tx_pkt_burst = rte_eth_pkt_burst_dummy;
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mails.dpdk.org/archives/dev/attachments/20250811/c5227f70/attachment-0001.htm>
More information about the dev
mailing list