[PATCH] net/mlx5: fix MTU initialization in device spawn
Shani Peretz
shperetz at nvidia.com
Thu Sep 18 07:43:25 CEST 2025
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 at dpdk.org
Signed-off-by: Shani Peretz <shperetz at nvidia.com>
Acked-by: Dariusz Sosnowski <dsosnowski at 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
More information about the stable
mailing list