Skip to contentSkip to conversation

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

PATCH In review Shani Peretz 3 participants 4 messages Nov 17, 2025 – Feb 8 Network drivers

lore
Share & tools
lore
#0 lore raw

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

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")
---
 drivers/net/mlx5/mlx5_ethdev.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
drivers/net/mlx5/mlx5_ethdev.c +23 -0
index 7747b0c869..7bec64c847 100644
@@ -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;
Signature · 1 line
2.43.0
#1 lore raw

Hi,

Am Montag, dem 17.11.2025 um 09:39 +0200 schrieb Shani Peretz:

Quoted 5 lines

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.

If you read the commit message of the offending patch, this was in fact intentional. The MTU at allocation time is relevant when joining a Rx share group, as it is (to the best of my knowledge) the only MTU setting that actually has an influence on the size of the packet buffers. Therefore, it is the value which is relevant for sharing packet buffers.

I've tested your patch again with the prototype I used to discover the original bug and unfortunately it reappears.

Best regards,
Adrian

Signature · 19 lines
Adrian Schollmeyer

SysEleven GmbH 
Boxhagener Straße 80 
10245 Berlin 

T +49 30 / 23 32 012-0
F +49 30 / 61 67 55 5-0 

https://www.syseleven.de 
https://www.linkedin.com/company/syseleven-gmbh

Current system status always at: 
https://www.syseleven-status.net/ 

Company headquarters: Berlin 
Registered court: AG Berlin Charlottenburg, HRB 108571 Berlin 
Managing directors: Andreas Hermann, Jens Ihlenfeld, Jens Plogsties,
Andreas Rückriegel
#2 lore raw

PATCH v2 1/1 net/mlx5: allow MTU mismatch for running shared Rx queues

In reply to Shani Peretz

Previously, mlx5_shared_rxq_match() rejected any MTU mismatch between a port and the shared RX queue, even when the queue hardware was already running. This caused failures when hot-adding representors after runtime MTU changes (new port has default MTU=1500, but running queue was created with MTU=9000). It also prevented proper port reconfiguration scenarios.

The fix allows MTU mismatches when rxq_ctrl->obj != NULL (queue is running), since runtime MTU changes via rte_eth_dev_set_mtu() only update software bookkeeping without recreating hardware resources. Stopped queues still enforce MTU matching to trigger proper reconfiguration.

This patch also removes the redundant priv->mtu field and uses dev->data->mtu consistently for MTU tracking throughout the driver.

Fixes 4414eb800708 ("net/mlx5: store MTU at Rx queue allocation time")
Fixes 09c2555303be ("net/mlx5: support shared Rx queue")
---
 doc/guides/nics/mlx5.rst           |  6 +++
 drivers/net/mlx5/linux/mlx5_os.c   |  6 +--
 drivers/net/mlx5/mlx5.h            |  1 -
 drivers/net/mlx5/mlx5_ethdev.c     |  3 --
 drivers/net/mlx5/mlx5_rxq.c        | 85 ++++++++++++++++++++++++------
 drivers/net/mlx5/windows/mlx5_os.c |  6 +--
 6 files changed, 78 insertions(+), 29 deletions(-)
doc/guides/nics/mlx5.rst +6 -0
index 904a0ac358..66323907a9 100644
@@ -1827,6 +1827,12 @@ Limitations
 
 #. Counters of received packets and bytes of queues in the same group and queue ID are same.
 
+#. Each Rx queue in share group must have the same queue configuration.
+
+#. Ports in share group must have equal MTU at port start time.
+
+#. Reconfiguring a shared queue while it is in use (started or referenced by flows) is not allowed.
+
 
 .. _mlx5_rx_threshold:
 
drivers/net/mlx5/linux/mlx5_os.c +2 -4
index 7f73183bb1..e8c4fb62c8 100644
@@ -1334,7 +1334,6 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 	priv->sh = sh;
 	priv->dev_port = spawn->phys_port;
 	priv->pci_dev = spawn->pci_dev;
-	priv->mtu = RTE_ETHER_MTU;
 	/* Some internal functions rely on Netlink sockets, open them now. */
 	priv->nl_socket_rdma = nl_rdma;
 	priv->nl_socket_route =	mlx5_nl_init(NETLINK_ROUTE, 0);
@@ -1606,14 +1605,13 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 	}
 #endif
 	/* Get actual MTU if possible. */
-	err = mlx5_get_mtu(eth_dev, &priv->mtu);
+	err = mlx5_get_mtu(eth_dev, &eth_dev->data->mtu);
 	if (err) {
 		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);
+		eth_dev->data->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;
drivers/net/mlx5/mlx5.h +0 -1
index 966e802f5f..551f3b9d17 100644
@@ -1983,7 +1983,6 @@ struct mlx5_priv {
 	uint16_t vlan_filter[MLX5_MAX_VLAN_IDS]; /* VLAN filters table. */
 	unsigned int vlan_filter_n; /* Number of configured VLAN filters. */
 	/* Device properties. */
-	uint16_t mtu; /* Configured MTU. */
 	uint16_t min_mtu; /* Minimum MTU allowed on the NIC. */
 	uint16_t max_mtu; /* Maximum MTU allowed on the NIC. */
 	unsigned int isolated:1; /* Whether isolated mode is enabled. */
drivers/net/mlx5/mlx5_ethdev.c +0 -3
index c93a7ac4f2..00a1d444ef 100644
@@ -679,7 +679,6 @@ mlx5_dev_supported_ptypes_get(struct rte_eth_dev *dev, size_t *no_of_elements)
 int
 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;
 	int ret;
 
@@ -688,7 +687,6 @@ mlx5_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
 		return ret;
 
 	if (kern_mtu == mtu) {
-		priv->mtu = mtu;
 		DRV_LOG(DEBUG, "port %u adapter MTU was already set to %u",
 			dev->data->port_id, mtu);
 		return 0;
@@ -702,7 +700,6 @@ mlx5_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
 	if (ret)
 		return ret;
 	if (kern_mtu == mtu) {
-		priv->mtu = mtu;
 		DRV_LOG(DEBUG, "port %u adapter MTU set to %u",
 			dev->data->port_id, mtu);
 		return 0;
drivers/net/mlx5/mlx5_rxq.c +68 -17

115 lines not on this page · raw message

drivers/net/mlx5/windows/mlx5_os.c +2 -4
index 4eadc872a5..5dcabfbed2 100644
@@ -396,7 +396,6 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 	priv->sh = sh;
 	priv->dev_port = spawn->phys_port;
 	priv->pci_dev = spawn->pci_dev;
-	priv->mtu = RTE_ETHER_MTU;
 	priv->mp_id.port_id = port_id;
 	strlcpy(priv->mp_id.name, MLX5_MP_NAME, RTE_MP_MAX_NAME_LEN);
 	priv->representor = !!switch_info->representor;
@@ -504,14 +503,13 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
 	}
 #endif
 	/* Get actual MTU if possible. */
-	err = mlx5_get_mtu(eth_dev, &priv->mtu);
+	err = mlx5_get_mtu(eth_dev, &eth_dev->data->mtu);
 	if (err) {
 		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);
+		eth_dev->data->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;
Signature · 1 line
2.43.0
#3 lore raw

Re: [PATCH v2] net/mlx5: allow MTU mismatch for running shared Rx queues

Hi,

Quoted 14 lines · Shani Peretz

Previously, mlx5_shared_rxq_match() rejected any MTU mismatch between a port and the shared RX queue, even when the queue hardware was already running. This caused failures when hot-adding representors after runtime MTU changes (new port has default MTU=1500, but running queue was created with MTU=9000). It also prevented proper port reconfiguration scenarios.

The fix allows MTU mismatches when rxq_ctrl->obj != NULL (queue is running), since runtime MTU changes via rte_eth_dev_set_mtu() only update software bookkeeping without recreating hardware resources. Stopped queues still enforce MTU matching to trigger proper reconfiguration.

This patch also removes the redundant priv->mtu field and uses dev->data->mtu consistently for MTU tracking throughout the driver.

Quoted 7 lines
Fixes 4414eb800708 ("net/mlx5: store MTU at Rx queue allocation time")
Fixes 09c2555303be ("net/mlx5: support shared Rx queue")

Patch applied to next-net-mlx,

Kindest regards
Raslan Darawsheh