Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=082dee3216c99a838af40be403799f60bcea2e97
Commit:     082dee3216c99a838af40be403799f60bcea2e97
Parent:     54e95f8dcbd7d86f79b423e8d11053ec9a2d9946
Author:     Jack Morgenstein <[EMAIL PROTECTED]>
AuthorDate: Mon Jun 18 08:13:59 2007 -0700
Committer:  Roland Dreier <[EMAIL PROTECTED]>
CommitDate: Mon Jun 18 08:13:59 2007 -0700

    IB/mlx4: Handle buffer wraparound in __mlx4_ib_cq_clean()
    
    When compacting CQ entries, we need to set the correct value of the
    ownership bit in case the value is different between the index we copy
    the CQE from and the index we copy it to.
    
    Found by Ronni Zimmerman of Mellanox.
    
    Signed-off-by: Jack Morgenstein <[EMAIL PROTECTED]>
    Signed-off-by: Roland Dreier <[EMAIL PROTECTED]>
---
 drivers/infiniband/hw/mlx4/cq.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/infiniband/hw/mlx4/cq.c b/drivers/infiniband/hw/mlx4/cq.c
index e940521..660b27a 100644
--- a/drivers/infiniband/hw/mlx4/cq.c
+++ b/drivers/infiniband/hw/mlx4/cq.c
@@ -478,7 +478,8 @@ void __mlx4_ib_cq_clean(struct mlx4_ib_cq *cq, u32 qpn, 
struct mlx4_ib_srq *srq)
 {
        u32 prod_index;
        int nfreed = 0;
-       struct mlx4_cqe *cqe;
+       struct mlx4_cqe *cqe, *dest;
+       u8 owner_bit;
 
        /*
         * First we need to find the current producer index, so we
@@ -501,9 +502,13 @@ void __mlx4_ib_cq_clean(struct mlx4_ib_cq *cq, u32 qpn, 
struct mlx4_ib_srq *srq)
                        if (srq && !(cqe->owner_sr_opcode & 
MLX4_CQE_IS_SEND_MASK))
                                mlx4_ib_free_srq_wqe(srq, 
be16_to_cpu(cqe->wqe_index));
                        ++nfreed;
-               } else if (nfreed)
-                       memcpy(get_cqe(cq, (prod_index + nfreed) & 
cq->ibcq.cqe),
-                              cqe, sizeof *cqe);
+               } else if (nfreed) {
+                       dest = get_cqe(cq, (prod_index + nfreed) & 
cq->ibcq.cqe);
+                       owner_bit = dest->owner_sr_opcode & MLX4_CQE_OWNER_MASK;
+                       memcpy(dest, cqe, sizeof *cqe);
+                       dest->owner_sr_opcode = owner_bit |
+                               (dest->owner_sr_opcode & ~MLX4_CQE_OWNER_MASK);
+               }
        }
 
        if (nfreed) {
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to