Skip to contentSkip to conversation

net/mlx5: store rxq MTU at allocation time

PATCH Superseded [email protected] 3 participants 8 messages Oct 28, 2025 – Nov 2, 2025 1 message not in the archive Network drivers

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/1 net/mlx5: store rxq MTU at allocation time

From: Adrian Schollmeyer <[email protected]>

For shared Rx queues, equal MTU for all ports sharing queues is enforced using mlx5_shared_rxq_match() to make sure, the memory allocated in the Rx buffer is large enough. The check uses the MTU as reported by the ports' private dev_data structs, which contain the MTU currently set for the device. In case one port's MTU is altered after Rx queues are allocated and then a second port joins the shared Rx queue with the old, yet correct MTU, the check fails despite the fact that the Rx buffer size is correct for both ports.

This patch adds a new entry to the Rx queue control structure that captures the MTU at the time the Rx buffer was allocated, since this is the relevant information that needs to be checked when a port joins a shared Rx queue.

Fixes 09c2555303be ("net/mlx5: support shared Rx queue")
---
 drivers/net/mlx5/mlx5_rx.h  | 1 +
 drivers/net/mlx5/mlx5_rxq.c | 6 +++++-
 2 files changed, 6 insertions(+), 1 deletion(-)
drivers/net/mlx5/mlx5_rx.h +1 -0
index 6380895502..58bc2c9f21 100644
@@ -169,6 +169,7 @@ struct __rte_cache_aligned mlx5_rxq_data {
 /* RX queue control descriptor. */
 struct mlx5_rxq_ctrl {
 	struct mlx5_rxq_data rxq; /* Data path structure. */
+	uint16_t mtu; /* Original MTU that the queue was allocated with. */
 	LIST_ENTRY(mlx5_rxq_ctrl) next; /* Pointer to the next element. */
 	LIST_HEAD(priv, mlx5_rxq_priv) owners; /* Owner rxq list. */
 	struct mlx5_rxq_obj *obj; /* Verbs/DevX elements. */
drivers/net/mlx5/mlx5_rxq.c +5 -1
index 5cf7d4971b..c652204ea8 100644
@@ -773,7 +773,7 @@ mlx5_shared_rxq_match(struct mlx5_rxq_ctrl *rxq_ctrl, struct rte_eth_dev *dev,
 			dev->data->port_id, idx);
 		return false;
 	}
-	if (priv->mtu != spriv->mtu) {
+	if (priv->mtu != rxq_ctrl->mtu) {
 		DRV_LOG(ERR, "port %u queue index %u failed to join shared group: mtu mismatch",
 			dev->data->port_id, idx);
 		return false;
@@ -1799,6 +1799,10 @@ mlx5_rxq_new(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
 	}
 	LIST_INIT(&tmpl->owners);
 	MLX5_ASSERT(n_seg && n_seg <= MLX5_MAX_RXQ_NSEG);
+	/*
+	 * Save the original MTU to check against for shared rx queues.
+	 */
+	tmpl->mtu = dev->data->mtu;
 	/*
 	 * Save the original segment configuration in the shared queue
 	 * descriptor for the later check on the sibling queue creation.
Signature · 1 line
2.34.1
#2 lore raw

Hi,

Thank you very much for your contribution.

Code looks good to me. Please see a small comment below.

Quoted 11 lines · On Tue, Oct 28, 2025 at 11:01:44AM +0100, [email protected] wrote:

From: Adrian Schollmeyer <[email protected]>

For shared Rx queues, equal MTU for all ports sharing queues is enforced using mlx5_shared_rxq_match() to make sure, the memory allocated in the Rx buffer is large enough. The check uses the MTU as reported by the ports' private dev_data structs, which contain the MTU currently set for the device. In case one port's MTU is altered after Rx queues are allocated and then a second port joins the shared Rx queue with the old, yet correct MTU, the check fails despite the fact that the Rx buffer size is correct for both ports.

Quoted 6 lines

This patch adds a new entry to the Rx queue control structure that captures the MTU at the time the Rx buffer was allocated, since this is the relevant information that needs to be checked when a port joins a shared Rx queue.

Fixes 09c2555303be ("net/mlx5: support shared Rx queue")

The offending patch was part of 21.11,
so this fix is a candidate for backporting to previously released LTS versions.

Could you send a v2 patch with "Cc: [email protected]" added after "Fixes" tag?

When sending this change, could you also please send the patch directly to mlx5 maintainers as well? There's a script in DPDK repository which would add relevant people
based on the changed files - devtools/get-maintainer.sh
It's usage is described in here: https://doc.dpdk.org/guides/contributing/patches.html#sending-patches

Quoted 46 lines
---
 drivers/net/mlx5/mlx5_rx.h  | 1 +
 drivers/net/mlx5/mlx5_rxq.c | 6 +++++-
 2 files changed, 6 insertions(+), 1 deletion(-)
drivers/net/mlx5/mlx5_rx.h +1 -0
index 6380895502..58bc2c9f21 100644
@@ -169,6 +169,7 @@ struct __rte_cache_aligned mlx5_rxq_data {
 /* RX queue control descriptor. */
 struct mlx5_rxq_ctrl {
 	struct mlx5_rxq_data rxq; /* Data path structure. */
+	uint16_t mtu; /* Original MTU that the queue was allocated with. */
 	LIST_ENTRY(mlx5_rxq_ctrl) next; /* Pointer to the next element. */
 	LIST_HEAD(priv, mlx5_rxq_priv) owners; /* Owner rxq list. */
 	struct mlx5_rxq_obj *obj; /* Verbs/DevX elements. */
drivers/net/mlx5/mlx5_rxq.c +5 -1
index 5cf7d4971b..c652204ea8 100644
@@ -773,7 +773,7 @@ mlx5_shared_rxq_match(struct mlx5_rxq_ctrl *rxq_ctrl, struct rte_eth_dev *dev,
 			dev->data->port_id, idx);
 		return false;
 	}
-	if (priv->mtu != spriv->mtu) {
+	if (priv->mtu != rxq_ctrl->mtu) {
 		DRV_LOG(ERR, "port %u queue index %u failed to join shared group: mtu mismatch",
 			dev->data->port_id, idx);
 		return false;
@@ -1799,6 +1799,10 @@ mlx5_rxq_new(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
 	}
 	LIST_INIT(&tmpl->owners);
 	MLX5_ASSERT(n_seg && n_seg <= MLX5_MAX_RXQ_NSEG);
+	/*
+	 * Save the original MTU to check against for shared rx queues.
+	 */
+	tmpl->mtu = dev->data->mtu;
 	/*
 	 * Save the original segment configuration in the shared queue
 	 * descriptor for the later check on the sibling queue creation.
Signature · 1 line
2.34.1

Best regards,
Dariusz Sosnowski

#3 lore raw

PATCH v2 1/1 net/mlx5: store rxq MTU at allocation time

In reply to [email protected]

From: Adrian Schollmeyer <[email protected]>

For shared Rx queues, equal MTU for all ports sharing queues is enforced using mlx5_shared_rxq_match() to make sure, the memory allocated in the Rx buffer is large enough. The check uses the MTU as reported by the ports' private dev_data structs, which contain the MTU currently set for the device. In case one port's MTU is altered after Rx queues are allocated and then a second port joins the shared Rx queue with the old, yet correct MTU, the check fails despite the fact that the Rx buffer size is correct for both ports.

This patch adds a new entry to the Rx queue control structure that captures the MTU at the time the Rx buffer was allocated, since this is the relevant information that needs to be checked when a port joins a shared Rx queue.

Fixes 09c2555303be ("net/mlx5: support shared Rx queue")
---
 drivers/net/mlx5/mlx5_rx.h  | 1 +
 drivers/net/mlx5/mlx5_rxq.c | 6 +++++-
 2 files changed, 6 insertions(+), 1 deletion(-)
drivers/net/mlx5/mlx5_rx.h +1 -0
index 6380895502..58bc2c9f21 100644
@@ -169,6 +169,7 @@ struct __rte_cache_aligned mlx5_rxq_data {
 /* RX queue control descriptor. */
 struct mlx5_rxq_ctrl {
 	struct mlx5_rxq_data rxq; /* Data path structure. */
+	uint16_t mtu; /* Original MTU that the queue was allocated with. */
 	LIST_ENTRY(mlx5_rxq_ctrl) next; /* Pointer to the next element. */
 	LIST_HEAD(priv, mlx5_rxq_priv) owners; /* Owner rxq list. */
 	struct mlx5_rxq_obj *obj; /* Verbs/DevX elements. */
drivers/net/mlx5/mlx5_rxq.c +5 -1
index 5cf7d4971b..c652204ea8 100644
@@ -773,7 +773,7 @@ mlx5_shared_rxq_match(struct mlx5_rxq_ctrl *rxq_ctrl, struct rte_eth_dev *dev,
 			dev->data->port_id, idx);
 		return false;
 	}
-	if (priv->mtu != spriv->mtu) {
+	if (priv->mtu != rxq_ctrl->mtu) {
 		DRV_LOG(ERR, "port %u queue index %u failed to join shared group: mtu mismatch",
 			dev->data->port_id, idx);
 		return false;
@@ -1799,6 +1799,10 @@ mlx5_rxq_new(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
 	}
 	LIST_INIT(&tmpl->owners);
 	MLX5_ASSERT(n_seg && n_seg <= MLX5_MAX_RXQ_NSEG);
+	/*
+	 * Save the original MTU to check against for shared rx queues.
+	 */
+	tmpl->mtu = dev->data->mtu;
 	/*
 	 * Save the original segment configuration in the shared queue
 	 * descriptor for the later check on the sibling queue creation.
Signature · 1 line
2.34.1
Acked-by on v2 1/1
#4 lore raw

Hi,

Thank you very much for applying the changes from last review.

Quoted 16 lines · On Thu, Oct 30, 2025 at 10:13:13AM +0100, [email protected] wrote:

From: Adrian Schollmeyer <[email protected]>

For shared Rx queues, equal MTU for all ports sharing queues is enforced using mlx5_shared_rxq_match() to make sure, the memory allocated in the Rx buffer is large enough. The check uses the MTU as reported by the ports' private dev_data structs, which contain the MTU currently set for the device. In case one port's MTU is altered after Rx queues are allocated and then a second port joins the shared Rx queue with the old, yet correct MTU, the check fails despite the fact that the Rx buffer size is correct for both ports.

This patch adds a new entry to the Rx queue control structure that captures the MTU at the time the Rx buffer was allocated, since this is the relevant information that needs to be checked when a port joins a shared Rx queue.

Quoted 4 lines
Fixes 09c2555303be ("net/mlx5: support shared Rx queue")

Best regards,
Dariusz Sosnowski

#5 lore raw
Quoted 21 lines · Dariusz Sosnowski

Hi,

Thank you very much for applying the changes from last review.

Quoted 16 lines · On Thu, Oct 30, 2025 at 10:13:13AM +0100, [email protected] wrote:

From: Adrian Schollmeyer <[email protected]>

For shared Rx queues, equal MTU for all ports sharing queues is enforced using mlx5_shared_rxq_match() to make sure, the memory allocated in the Rx buffer is large enough. The check uses the MTU as reported by the ports' private dev_data structs, which contain the MTU currently set for the device. In case one port's MTU is altered after Rx queues are allocated and then a second port joins the shared Rx queue with the old, yet correct MTU, the check fails despite the fact that the Rx buffer size is correct for both ports.

This patch adds a new entry to the Rx queue control structure that captures the MTU at the time the Rx buffer was allocated, since this is the relevant information that needs to be checked when a port joins a shared Rx queue.

Quoted 6 lines
Quoted 4 lines
Fixes 09c2555303be ("net/mlx5: support shared Rx queue")

One other thing, unrelated to the patch content.

Could you please change the state of previous versions of this patch to "Superseded" in Patchwork?
This would be very helpful since it reduces the amount of patches to track.

This requires creating the account on Patchwork - https://patches.dpdk.org/

Best regards,
Dariusz Sosnowski

#6 lore raw

Hi,

Am Donnerstag, dem 30.10.2025 um 11:40 +0100 schrieb Dariusz Sosnowski:

Quoted 2 lines

Could you please change the state of previous versions of this patch to "Superseded" in Patchwork?

done. I hope everything should be okay now.

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
#7 lore raw
Quoted 31 lines · Adrian Schollmeyer

Hi,

Am Donnerstag, dem 30.10.2025 um 11:40 +0100 schrieb Dariusz Sosnowski:

Quoted 2 lines

Could you please change the state of previous versions of this patch to "Superseded" in Patchwork?

done. I hope everything should be okay now.

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

Everything's perfect. Thank you very much and thank you for the contribution.

Best regards,
Dariusz Sosnowski

#8 lore raw
In reply to [email protected]

Hi,

Quoted 16 lines · On 30/10/2025 11:13 AM, [email protected] wrote:

From: Adrian Schollmeyer <[email protected]>

For shared Rx queues, equal MTU for all ports sharing queues is enforced using mlx5_shared_rxq_match() to make sure, the memory allocated in the Rx buffer is large enough. The check uses the MTU as reported by the ports' private dev_data structs, which contain the MTU currently set for the device. In case one port's MTU is altered after Rx queues are allocated and then a second port joins the shared Rx queue with the old, yet correct MTU, the check fails despite the fact that the Rx buffer size is correct for both ports.

This patch adds a new entry to the Rx queue control structure that captures the MTU at the time the Rx buffer was allocated, since this is the relevant information that needs to be checked when a port joins a shared Rx queue.

Quoted 4 lines
Fixes 09c2555303be ("net/mlx5: support shared Rx queue")

Patch applied to next-net-mlx,

Kindest regards
Raslan Darawsheh