[PATCH] net/mlx5: update stored Rx queue MTU when port MTU changes

Shani Peretz shperetz at nvidia.com
Mon Nov 17 08:39:36 CET 2025


Offending commit added rxq_ctrl->mtu to track MTU at queue
allocation time for validating shared RX queue compatibility.

When MTU changes via rte_eth_dev_set_mtu(), only priv->mtu was
updated, leaving rxq_ctrl->mtu with the old value. This caused
shared RX queue matching to fail with "mtu mismatch" errors when
ports reconfigured (e.g., enabling buffer_split offload), even
when all ports had identical MTU settings.

Update rxq_ctrl->mtu for all queues when port MTU changes to
keep metadata synchronized with actual port MTU.

Fixes: 4414eb800708 ("net/mlx5: store MTU at Rx queue allocation time")

Signed-off-by: Shani Peretz <shperetz at nvidia.com>
Acked-by: Dariusz Sosnowski <dsosnowski at nvidia.com>
---
 drivers/net/mlx5/mlx5_ethdev.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index 7747b0c869..7bec64c847 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -676,6 +676,7 @@ mlx5_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
 {
 	struct mlx5_priv *priv = dev->data->dev_private;
 	uint16_t kern_mtu = 0;
+	unsigned int i;
 	int ret;
 
 	ret = mlx5_get_mtu(dev, &kern_mtu);
@@ -684,6 +685,17 @@ mlx5_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
 
 	if (kern_mtu == mtu) {
 		priv->mtu = mtu;
+		/*
+		 * Update the MTU stored in RX queue control structures.
+		 * This is necessary for shared RX queues to correctly match
+		 * the MTU when ports try to join the shared group.
+		 */
+		for (i = 0; i < priv->rxqs_n; i++) {
+			struct mlx5_rxq_priv *rxq = mlx5_rxq_get(dev, i);
+
+			if (rxq != NULL && rxq->ctrl != NULL)
+				rxq->ctrl->mtu = mtu;
+		}
 		DRV_LOG(DEBUG, "port %u adapter MTU was already set to %u",
 			dev->data->port_id, mtu);
 		return 0;
@@ -698,6 +710,17 @@ mlx5_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
 		return ret;
 	if (kern_mtu == mtu) {
 		priv->mtu = mtu;
+		/*
+		 * Update the MTU stored in RX queue control structures.
+		 * This is necessary for shared RX queues to correctly match
+		 * the MTU when ports try to join the shared group.
+		 */
+		for (i = 0; i < priv->rxqs_n; i++) {
+			struct mlx5_rxq_priv *rxq = mlx5_rxq_get(dev, i);
+
+			if (rxq != NULL && rxq->ctrl != NULL)
+				rxq->ctrl->mtu = mtu;
+		}
 		DRV_LOG(DEBUG, "port %u adapter MTU set to %u",
 			dev->data->port_id, mtu);
 		return 0;
-- 
2.43.0



More information about the dev mailing list