Blame SOURCES/0001-mlx5-Initialize-wr_data-when-post-a-work-request.patch

5d8808
From 3ea45d65d42e5daf032164240abebec82e987f90 Mon Sep 17 00:00:00 2001
5d8808
From: Mark Zhang <markzhang@nvidia.com>
5d8808
Date: Mon, 20 Dec 2021 11:19:46 +0200
5d8808
Subject: [PATCH] mlx5: Initialize wr_data when post a work request
5d8808
5d8808
[ Upstream commit 4c905646de3e75bdccada4abe9f0d273d76eaf50 ]
5d8808
5d8808
With raw_wqe feature enabled, the wc opcode will be set to
5d8808
IBV_WC_DRIVER2 if the wr_data is set to it.
5d8808
So if wr_data is not initialized, there's a chance that it happens to be
5d8808
IBV_WC_DRIVER2, then the application gets this wc opcode unexpectedly.
5d8808
5d8808
Fixes: 8ff1c5c3c411 ("mlx5: Introduce mlx5dv_wr_raw_wqe builder")
5d8808
Signed-off-by: Mark Zhang <markzhang@nvidia.com>
5d8808
Signed-off-by: Yishai Hadas <yishaih@nvidia.com>
5d8808
Signed-off-by: Nicolas Morey-Chaisemartin <nmoreychaisemartin@suse.com>
5d8808
---
5d8808
 providers/mlx5/qp.c | 3 +++
5d8808
 1 file changed, 3 insertions(+)
5d8808
5d8808
diff --git a/providers/mlx5/qp.c b/providers/mlx5/qp.c
5d8808
index 70c1afb2..8a99f504 100644
5d8808
--- a/providers/mlx5/qp.c
5d8808
+++ b/providers/mlx5/qp.c
5d8808
@@ -871,6 +871,7 @@ static inline int _mlx5_post_send(struct ibv_qp *ibqp, struct ibv_send_wr *wr,
5d8808
 
5d8808
 		seg += sizeof *ctrl;
5d8808
 		size = sizeof *ctrl / 16;
5d8808
+		qp->sq.wr_data[idx] = 0;
5d8808
 
5d8808
 		switch (ibqp->qp_type) {
5d8808
 		case IBV_QPT_XRC_SEND:
5d8808
@@ -1251,6 +1252,8 @@ static inline void _common_wqe_init_op(struct ibv_qp_ex *ibqp, int ib_op,
5d8808
 		mqp->sq.wr_data[idx] = IBV_WC_DRIVER1;
5d8808
 	else if (mlx5_op == MLX5_OPCODE_MMO)
5d8808
 		mqp->sq.wr_data[idx] = IBV_WC_DRIVER3;
5d8808
+	else
5d8808
+		mqp->sq.wr_data[idx] = 0;
5d8808
 
5d8808
 	ctrl = mlx5_get_send_wqe(mqp, idx);
5d8808
 	*(uint32_t *)((void *)ctrl + 8) = 0;
5d8808
-- 
5d8808
2.31.1
5d8808