DPDK patches and discussions
 help / color / mirror / Atom feed
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	[thread overview]
Message-ID: <bug-1768-3@https.bugs.dpdk.org/> (raw)

[-- 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 --]

                 reply	other threads:[~2025-08-11 21:30 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=bug-1768-3@https.bugs.dpdk.org/ \
    --to=bugzilla@dpdk.org \
    --cc=dev@dpdk.org \
    /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).