* [PATCH] net/mlx5: fix MTU initialization in device spawn
@ 2025-09-18 5:43 Shani Peretz
0 siblings, 0 replies; only message in thread
From: Shani Peretz @ 2025-09-18 5:43 UTC (permalink / raw)
To: dev
Cc: rasland, Shani Peretz, stable, Dariusz Sosnowski,
Viacheslav Ovsiienko, Bing Zhao, Ori Kam, Suanming Mou,
Matan Azrad, Ophir Munk
Currently with mlx5 PMD, rte_eth_dev_get_mtu() doesn't return
the MTU the device was set with, but the default one.
It happens because mlx5_dev_spawn() is not setting the eth_dev->data->mtu
field after getting the actual MTU from the driver,
so the default value is kept.
This patch fixes the issue by retrieving setting the value of priv->mtu
to eth_dev->data->mtu.
Bugzilla ID: 1768
Fixes: 2eb4d0107acc ("net/mlx5: refactor PCI probing on Linux")
Cc: stable@dpdk.org
Signed-off-by: Shani Peretz <shperetz@nvidia.com>
Acked-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
---
drivers/net/mlx5/linux/mlx5_os.c | 1 +
drivers/net/mlx5/windows/mlx5_os.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c
index 8c37c047bb..8d11b1ac3a 100644
--- a/drivers/net/mlx5/linux/mlx5_os.c
+++ b/drivers/net/mlx5/linux/mlx5_os.c
@@ -1601,6 +1601,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
err = rte_errno;
goto error;
}
+ eth_dev->data->mtu = priv->mtu;
DRV_LOG(DEBUG, "port %u MTU is %u", eth_dev->data->port_id,
priv->mtu);
/* Initialize burst functions to prevent crashes before link-up. */
diff --git a/drivers/net/mlx5/windows/mlx5_os.c b/drivers/net/mlx5/windows/mlx5_os.c
index c4e3430bdc..4eadc872a5 100644
--- a/drivers/net/mlx5/windows/mlx5_os.c
+++ b/drivers/net/mlx5/windows/mlx5_os.c
@@ -509,6 +509,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
err = rte_errno;
goto error;
}
+ eth_dev->data->mtu = priv->mtu;
DRV_LOG(DEBUG, "port %u MTU is %u.", eth_dev->data->port_id,
priv->mtu);
/* Initialize burst functions to prevent crashes before link-up. */
--
2.34.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-09-18 5:43 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-18 5:43 [PATCH] net/mlx5: fix MTU initialization in device spawn Shani Peretz
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).