Skip to contentSkip to conversation

vdpa/mlx5: Fix needs_teardown flag calculation

PATCH In review Dragos Tatulea 2 participants 2 messages Jun 4, 2025 – Jun 5, 2025

Subsystems (2)
lore
Share & tools
lore

Dragos Tatulea

author maintainer
#0 lore raw

PATCH 1/1 vdpa/mlx5: Fix needs_teardown flag calculation

needs_teardown is a device flag that indicates when virtual queues need to be recreated. This happens for certain configuration changes: queue size and some specific features.

Currently, the needs_teardown state can be incorrectly reset by subsequent .set_vq_num() calls. For example, for 1 rx VQ with size 512 and 1 tx VQ with size 256:

.set_vq_num(0, 512) -> sets needs_teardown to true (rx queue has a
non-default size)
.set_vq_num(1, 256) -> sets needs_teardown to false (tx queue has a
default size)

This change takes into account the previous value of the needs_teardown flag when re-calculating it during VQ size configuration.

Fixes 0fe963d6fc16 ("vdpa/mlx5: Re-create HW VQs under certain conditions")
---
 drivers/vdpa/mlx5/net/mlx5_vnet.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/vdpa/mlx5/net/mlx5_vnet.c +1 -1
index cccc49a08a1a..efb5fa694f1e 100644
@@ -2491,7 +2491,7 @@ static void mlx5_vdpa_set_vq_num(struct vdpa_device *vdev, u16 idx, u32 num)
         }
 
 	mvq = &ndev->vqs[idx];
-	ndev->needs_teardown = num != mvq->num_ent;
+	ndev->needs_teardown |= num != mvq->num_ent;
 	mvq->num_ent = num;
 }
 
Signature · 1 line
2.43.0
Acked-by on v1 1/1
#1 lore raw
Quoted 17 lines · Dragos Tatulea

needs_teardown is a device flag that indicates when virtual queues need to be recreated. This happens for certain configuration changes: queue size and some specific features.

Currently, the needs_teardown state can be incorrectly reset by subsequent .set_vq_num() calls. For example, for 1 rx VQ with size 512 and 1 tx VQ with size 256:

.set_vq_num(0, 512) -> sets needs_teardown to true (rx queue has a
non-default size)
.set_vq_num(1, 256) -> sets needs_teardown to false (tx queue has a
default size)

This change takes into account the previous value of the needs_teardown flag when re-calculating it during VQ size configuration.

Quoted 6 lines
Fixes 0fe963d6fc16 ("vdpa/mlx5: Re-create HW VQs under certain conditions")

---

Thanks