* [DPDK/ethdev Bug 1768] net/mlx5: get_mtu returns 1500 on startup instead of kernel driver MTU
@ 2025-08-11 21:30 bugzilla
0 siblings, 0 replies; only message in thread
From: bugzilla @ 2025-08-11 21:30 UTC (permalink / raw)
To: dev
[-- Attachment #1: Type: text/plain, Size: 2545 bytes --]
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@dpdk.org
Reporter: brian90013@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.
[-- Attachment #2: Type: text/html, Size: 4494 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-08-11 21:30 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-08-11 21:30 [DPDK/ethdev Bug 1768] net/mlx5: get_mtu returns 1500 on startup instead of kernel driver MTU bugzilla
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).