libhns: Write all 64 bytes of a direct WQE explicitly
[ Upstream commit ffcb5072a2aeffe62dbc782c8431bd062eef78eb ]
hns_roce_write512() passes sizeof(struct hns_roce_rc_sq_wqe), which is
32, to mmio_memcpy_x64(). It writes a 64-byte direct WQE only because
the aarch64 macro takes its 64-byte path for any constant length. On
the generic implementation a length of 32 makes the size_t counter
wrap, and the copy does not stop.
Pass the size of a direct WQE, 1 << HNS_ROCE_SQWQE_SHIFT. On aarch64
the generated code does not change.
Fixes: 159933c37450 ("libhns: Add support for direct wqe")
Reviewed-by: Junxian Huang <huangjunxian6@hisilicon.com>
Tested-by: Junxian Huang <huangjunxian6@hisilicon.com>
Assisted-by: Claude:claude-opus-5-5 <noreply@anthropic.com>
Signed-off-by: Dezhen Lu <dezhen.lu@student.uni-tuebingen.de>
Signed-off-by: Nicolas Morey <nmorey@suse.com>
diff --git a/providers/hns/hns_roce_u_hw_v2.c b/providers/hns/hns_roce_u_hw_v2.c
index 3508cb4..1531a7a 100644
--- a/providers/hns/hns_roce_u_hw_v2.c
+++ b/providers/hns/hns_roce_u_hw_v2.c
@@ -303,7 +303,7 @@
static void hns_roce_write512(uint64_t *dest, uint64_t *val)
{
- mmio_memcpy_x64(dest, val, sizeof(struct hns_roce_rc_sq_wqe));
+ mmio_memcpy_x64(dest, val, 1 << HNS_ROCE_SQWQE_SHIFT);
}
static void hns_roce_write_dwqe(struct hns_roce_qp *qp, void *wqe)