Skip to contentSkip to conversation

net/mlx5: fix VLAN stripping on hairpin queues

PATCH In review Dariusz Sosnowski 4 participants 4 messages Apr 25, 2025 – Jun 2, 2025 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/mlx5: fix VLAN stripping on hairpin queues

Rx hairpin queues support VLAN stripping,
but if port was started and application attempted to configure stripping on hairpin queue,
segfault was triggered because of NULL dereference. Underlying function, which was updating the RQ was passing wrong object handle for hairpin queues.
This patch fixes that.

Fixes e79c9be91515 ("net/mlx5: support Rx hairpin queues")
---
 drivers/net/mlx5/mlx5_devx.c | 2 ++
 drivers/net/mlx5/mlx5_vlan.c | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/net/mlx5/mlx5_devx.c +2 -0
index a12891a983..ed1826a612 100644
@@ -88,6 +88,8 @@ mlx5_rxq_obj_modify_rq_vlan_strip(struct mlx5_rxq_priv *rxq, int on)
 	rq_attr.state = MLX5_RQC_STATE_RDY;
 	rq_attr.vsd = (on ? 0 : 1);
 	rq_attr.modify_bitmask = MLX5_MODIFY_RQ_IN_MODIFY_BITMASK_VSD;
+	if (rxq->ctrl->is_hairpin)
+		return mlx5_devx_cmd_modify_rq(rxq->ctrl->obj->rq, &rq_attr);
 	return mlx5_devx_cmd_modify_rq(rxq->devx_rq.rq, &rq_attr);
 }
 
drivers/net/mlx5/mlx5_vlan.c +1 -1
index 43a314a679..7c7ac78dfe 100644
@@ -107,7 +107,7 @@ mlx5_vlan_strip_queue_set(struct rte_eth_dev *dev, uint16_t queue, int on)
 			dev->data->port_id, queue);
 		return;
 	}
-	DRV_LOG(DEBUG, "port %u set VLAN stripping offloads %d for port %uqueue %d",
+	DRV_LOG(DEBUG, "port %u set VLAN stripping offloads %d for port %u queue %d",
 		dev->data->port_id, on, rxq_data->port_id, queue);
 	if (rxq->ctrl->obj == NULL) {
 		/* Update related bits in RX queue. */
Signature · 1 line
2.39.5
#1 lore raw

Hi, it looks like your patch was affected by an infrastructure issue at the DPDK Community Lab and has a false failure test result on DPDK patchwork. Issuing a retest to correct this:

Recheck-request: iol-intel-Functional

Acked-by on v1 1/1
#2 lore raw
In reply to Dariusz Sosnowski

Hi,

Quoted 55 lines

-----Original Message-----
From: Dariusz Sosnowski <[email protected]>
Sent: Saturday, April 26, 2025 3:49 AM
To: Slava Ovsiienko <[email protected]>; Bing Zhao <[email protected]>; Ori Kam <[email protected]>; Suanming Mou <[email protected]>; Matan Azrad <[email protected]>
Cc: [email protected]; [email protected]
Subject: [PATCH] net/mlx5: fix VLAN stripping on hairpin queues

Rx hairpin queues support VLAN stripping, but if port was started and application attempted to configure stripping on hairpin queue, segfault was triggered because of NULL dereference.
Underlying function, which was updating the RQ was passing wrong object handle for hairpin queues.
This patch fixes that.

Fixes e79c9be91515 ("net/mlx5: support Rx hairpin queues")
---
 drivers/net/mlx5/mlx5_devx.c | 2 ++
 drivers/net/mlx5/mlx5_vlan.c | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/net/mlx5/mlx5_devx.c +2 -0
index a12891a983..ed1826a612 100644
@@ -88,6 +88,8 @@ mlx5_rxq_obj_modify_rq_vlan_strip(struct mlx5_rxq_priv
 *rxq, int on)
 	rq_attr.state = MLX5_RQC_STATE_RDY;
 	rq_attr.vsd = (on ? 0 : 1);
 	rq_attr.modify_bitmask = MLX5_MODIFY_RQ_IN_MODIFY_BITMASK_VSD;
+	if (rxq->ctrl->is_hairpin)
+		return mlx5_devx_cmd_modify_rq(rxq->ctrl->obj->rq, &rq_attr);
 	return mlx5_devx_cmd_modify_rq(rxq->devx_rq.rq, &rq_attr);  }
 
drivers/net/mlx5/mlx5_vlan.c +2 -2
index 43a314a679..7c7ac78dfe 100644
@@ -107,7 +107,7 @@ mlx5_vlan_strip_queue_set(struct rte_eth_dev *dev,
 uint16_t queue, int on)
 			dev->data->port_id, queue);
 		return;
 	}
-	DRV_LOG(DEBUG, "port %u set VLAN stripping offloads %d for
 port %uqueue %d",
+	DRV_LOG(DEBUG, "port %u set VLAN stripping offloads %d for port %u
+queue %d",
 		dev->data->port_id, on, rxq_data->port_id, queue);
 	if (rxq->ctrl->obj == NULL) {
 		/* Update related bits in RX queue. */
--
Quoted 1 line

2.39.5

Thanks

#3 lore raw
In reply to Dariusz Sosnowski

Hi,

Quoted 8 lines · Dariusz Sosnowski

Rx hairpin queues support VLAN stripping,
but if port was started and application attempted to configure stripping on hairpin queue,
segfault was triggered because of NULL dereference. Underlying function, which was updating the RQ was passing wrong object handle for hairpin queues.
This patch fixes that.

Quoted 5 lines
Fixes e79c9be91515 ("net/mlx5: support Rx hairpin queues")

---

Patch applied to next-net-mlx,

Signature · 2 lines
Kindest regards
Raslan Darawsheh