]> git.openfabrics.org - ~shefty/libmlx4.git/commitdiff
Set ownership bit correctly when copying over CQEs during CQ resize
authorJack Morgenstein <jackm@dev.mellanox.co.il>
Sun, 14 Dec 2008 16:14:20 +0000 (18:14 +0200)
committerRoland Dreier <rolandd@cisco.com>
Thu, 25 Dec 2008 04:34:02 +0000 (20:34 -0800)
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 <jackm@dev.mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
src/cq.c

index 68e16e92e826ad5e18f964db5c440f8266ae3b75..8226b6bc5aebc21cdb588675a258290336a484f7 100644 (file)
--- 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;