]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
RDMA/hns: Fix out-of-order issue of requester when setting FENCE
authorJunxian Huang <huangjunxian6@hisilicon.com>
Fri, 8 Nov 2024 07:57:42 +0000 (15:57 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 14 Dec 2024 18:51:02 +0000 (19:51 +0100)
[ Upstream commit 5dbcb1c1900f45182b5651c89257c272f1f3ead7 ]

The FENCE indicator in hns WQE doesn't ensure that response data from
a previous Read/Atomic operation has been written to the requester's
memory before the subsequent Send/Write operation is processed. This
may result in the subsequent Send/Write operation accessing the original
data in memory instead of the expected response data.

Unlike FENCE, the SO (Strong Order) indicator blocks the subsequent
operation until the previous response data is written to memory and a
bresp is returned. Set the SO indicator instead of FENCE to maintain
strict order.

Fixes: 9a4435375cd1 ("IB/hns: Add driver files for hns RoCE driver")
Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
Link: https://patch.msgid.link/20241108075743.2652258-2-huangjunxian6@hisilicon.com
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/infiniband/hw/hns/hns_roce_hw_v2.c
drivers/infiniband/hw/hns/hns_roce_hw_v2.h

index 64d458fd39ba992e472f6a18faf1edf7149defd4..c013e96f956e20349482780074a2678abdad2825 100644 (file)
@@ -566,7 +566,7 @@ static inline int set_rc_wqe(struct hns_roce_qp *qp,
        if (WARN_ON(ret))
                return ret;
 
-       hr_reg_write(rc_sq_wqe, RC_SEND_WQE_FENCE,
+       hr_reg_write(rc_sq_wqe, RC_SEND_WQE_SO,
                     (wr->send_flags & IB_SEND_FENCE) ? 1 : 0);
 
        hr_reg_write(rc_sq_wqe, RC_SEND_WQE_SE,
index 0c120a4b48c0bd9a692e11b0ffe9ed2cefa6458e..a03dfde796ca4f2d5739f7b433c903099cd55c07 100644 (file)
@@ -948,6 +948,7 @@ struct hns_roce_v2_rc_send_wqe {
 #define RC_SEND_WQE_OWNER RC_SEND_WQE_FIELD_LOC(7, 7)
 #define RC_SEND_WQE_CQE RC_SEND_WQE_FIELD_LOC(8, 8)
 #define RC_SEND_WQE_FENCE RC_SEND_WQE_FIELD_LOC(9, 9)
+#define RC_SEND_WQE_SO RC_SEND_WQE_FIELD_LOC(10, 10)
 #define RC_SEND_WQE_SE RC_SEND_WQE_FIELD_LOC(11, 11)
 #define RC_SEND_WQE_INLINE RC_SEND_WQE_FIELD_LOC(12, 12)
 #define RC_SEND_WQE_WQE_INDEX RC_SEND_WQE_FIELD_LOC(30, 15)