From: Jack Morgenstein Date: Sun, 14 Dec 2008 16:14:20 +0000 (+0200) Subject: Set ownership bit correctly when copying over CQEs during CQ resize X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=7cad1a1d412ea0e7566f27ce83e224c29c7dbdbe;p=~shefty%2Flibmlx4.git Set ownership bit correctly when copying over CQEs during CQ resize When resizing a CQ, when copying over unpolled CQEs from the old CQE buffer to the new buffer, the ownership bit must be set appropriately for the new buffer, or the ownership bit in the new buffer gets corrupted. Signed-off-by: Jack Morgenstein Signed-off-by: Roland Dreier --- diff --git a/src/cq.c b/src/cq.c index 68e16e9..8226b6b 100644 --- a/src/cq.c +++ b/src/cq.c @@ -455,6 +455,8 @@ void mlx4_cq_resize_copy_cqes(struct mlx4_cq *cq, void *buf, int old_cqe) cqe = get_cqe(cq, (i & old_cqe)); while ((cqe->owner_sr_opcode & MLX4_CQE_OPCODE_MASK) != MLX4_CQE_OPCODE_RESIZE) { + cqe->owner_sr_opcode = (cqe->owner_sr_opcode & ~MLX4_CQE_OWNER_MASK) | + (((i + 1) & (cq->ibv_cq.cqe + 1)) ? MLX4_CQE_OWNER_MASK : 0); memcpy(buf + ((i + 1) & cq->ibv_cq.cqe) * MLX4_CQ_ENTRY_SIZE, cqe, MLX4_CQ_ENTRY_SIZE); ++i;