<html>
<head>
<base href="https://bugs.dpdk.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8" class="bz_new_table">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_UNCONFIRMED "
title="UNCONFIRMED - net/mlx5: get_mtu returns 1500 on startup instead of kernel driver MTU"
href="https://bugs.dpdk.org/show_bug.cgi?id=1768">1768</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>net/mlx5: get_mtu returns 1500 on startup instead of kernel driver MTU
</td>
</tr>
<tr>
<th>Product</th>
<td>DPDK
</td>
</tr>
<tr>
<th>Version</th>
<td>24.11
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>UNCONFIRMED
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>Normal
</td>
</tr>
<tr>
<th>Component</th>
<td>ethdev
</td>
</tr>
<tr>
<th>Assignee</th>
<td>dev@dpdk.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>brian90013@gmail.com
</td>
</tr>
<tr>
<th>Target Milestone</th>
<td>---
</td>
</tr></table>
<p>
<div class="bz_comment_block">
<pre class="bz_comment_text">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;
</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
<link itemprop="url" href="https://bugs.dpdk.org/show_bug.cgi?id=1768">
<meta itemprop="name" content="View bug">
</div>
<meta itemprop="description" content="Bugzilla bug update notification">
</div>
</body>
</html>