From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id AF23F46D01; Mon, 11 Aug 2025 23:30:06 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 883CF4013F; Mon, 11 Aug 2025 23:30:06 +0200 (CEST) Received: from inbox.dpdk.org (inbox.dpdk.org [95.142.172.178]) by mails.dpdk.org (Postfix) with ESMTP id 12EDF400D7 for ; Mon, 11 Aug 2025 23:30:05 +0200 (CEST) Received: by inbox.dpdk.org (Postfix, from userid 33) id 0720746D02; Mon, 11 Aug 2025 23:30:05 +0200 (CEST) From: bugzilla@dpdk.org To: dev@dpdk.org Subject: [DPDK/ethdev Bug 1768] net/mlx5: get_mtu returns 1500 on startup instead of kernel driver MTU Date: Mon, 11 Aug 2025 21:30:05 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: DPDK X-Bugzilla-Component: ethdev X-Bugzilla-Version: 24.11 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: brian90013@gmail.com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: Normal X-Bugzilla-Assigned-To: dev@dpdk.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: multipart/alternative; boundary=17549478040.db3DB2cC.3272312 Content-Transfer-Encoding: 7bit X-Bugzilla-URL: https://bugs.dpdk.org/ Auto-Submitted: auto-generated X-Auto-Response-Suppress: All MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org --17549478040.db3DB2cC.3272312 Date: Mon, 11 Aug 2025 23:30:04 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.dpdk.org/ Auto-Submitted: auto-generated X-Auto-Response-Suppress: All https://bugs.dpdk.org/show_bug.cgi?id=3D1768 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 driv= er. 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, 4= 000, and 9000B. I added tracing to lib/ethdev and drivers/net/mlx5 and believe t= he issue is because while mlx5 determines and stores the current MTU, that val= ue is not propagated back to the ethdev structure. My attempt at a timeline: * mlx5_dev_spawn() sets priv->mtu =3D RTE_ETHER_MTU (1500) * mlx5_dev_spawn() sets eth_dev =3D rte_eth_dev_allocate() * rte_eth_dev_allocate() sets eth_dev->data->mtu =3D 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 bet= ween 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 =3D priv->mtu; /* Initialize burst functions to prevent crashes before link-up. */ eth_dev->rx_pkt_burst =3D rte_eth_pkt_burst_dummy; eth_dev->tx_pkt_burst =3D rte_eth_pkt_burst_dummy; --=20 You are receiving this mail because: You are the assignee for the bug.= --17549478040.db3DB2cC.3272312 Date: Mon, 11 Aug 2025 23:30:04 +0200 MIME-Version: 1.0 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.dpdk.org/ Auto-Submitted: auto-generated X-Auto-Response-Suppress: All
Bug ID 1768
Summary net/mlx5: get_mtu returns 1500 on startup instead of kernel d= river 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 driv=
er.

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, 4=
000,
and 9000B. I added tracing to lib/ethdev and drivers/net/mlx5 and believe t=
he
issue is because while mlx5 determines and stores the current MTU, that val=
ue
is not propagated back to the ethdev structure.


My attempt at a timeline:
* mlx5_dev_spawn() sets priv->mtu =3D RTE_ETHER_MTU (1500)
* mlx5_dev_spawn() sets eth_dev =3D rte_eth_dev_allocate()
* rte_eth_dev_allocate() sets eth_dev->data->mtu =3D RTE_ETHER_MTU (1=
500)
* 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 bet=
ween
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 *dpd=
k_dev,
        }
        DRV_LOG(DEBUG, "port %u MTU is %u", eth_dev->data->=
port_id,
                priv->mtu);
+       ethdev->data->mtu =3D priv->mtu;
        /* Initialize burst functions to prevent crashes before link-up. */
        eth_dev->rx_pkt_burst =3D rte_eth_pkt_burst_dummy;
        eth_dev->tx_pkt_burst =3D rte_eth_pkt_burst_dummy;
          


You are receiving this mail because:
  • You are the assignee for the bug.
=20=20=20=20=20=20=20=20=20=20
= --17549478040.db3DB2cC.3272312--