From: Shani Peretz <shperetz@nvidia.com>
To: <dev@dpdk.org>
Cc: <rasland@nvidia.com>, Shani Peretz <shperetz@nvidia.com>,
<stable@dpdk.org>, Dariusz Sosnowski <dsosnowski@nvidia.com>,
"Viacheslav Ovsiienko" <viacheslavo@nvidia.com>,
Bing Zhao <bingz@nvidia.com>, Ori Kam <orika@nvidia.com>,
Suanming Mou <suanmingm@nvidia.com>,
Matan Azrad <matan@nvidia.com>, Ophir Munk <ophirmu@nvidia.com>
Subject: [PATCH] net/mlx5: fix MTU initialization in device spawn
Date: Thu, 18 Sep 2025 08:43:25 +0300 [thread overview]
Message-ID: <20250918054325.777881-1-shperetz@nvidia.com> (raw)
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
reply other threads:[~2025-09-18 5:43 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250918054325.777881-1-shperetz@nvidia.com \
--to=shperetz@nvidia.com \
--cc=bingz@nvidia.com \
--cc=dev@dpdk.org \
--cc=dsosnowski@nvidia.com \
--cc=matan@nvidia.com \
--cc=ophirmu@nvidia.com \
--cc=orika@nvidia.com \
--cc=rasland@nvidia.com \
--cc=stable@dpdk.org \
--cc=suanmingm@nvidia.com \
--cc=viacheslavo@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).