IB/mthca: Fix PRM compliance problem in atomic-send completions
authorJack Morgenstein <jackm@dev.mellanox.co.il>
Mon, 25 Dec 2006 07:24:52 +0000 (09:24 +0200)
committerRoland Dreier <rolandd@cisco.com>
Mon, 8 Jan 2007 04:25:24 +0000 (20:25 -0800)
According to the Tavor and Arbel programmer's reference manuals, the
number of bytes transferred is not provided in the byte_cnt field of
the CQ entry for atomic operation completions.  For atomic operations,
the number of bytes transferred is always 8 (when the status is
"success"), and this constant value should always be used by the
driver in the ib_wc entry returned, rather than using the CQE.

Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
drivers/infiniband/hw/mthca/mthca_cq.c

index 283d50b76c3ddceb274d8445381d5ba569b28884..1159c8a0f2c5211d3b9b6f9f2a2b59ea8de6872b 100644 (file)
@@ -54,6 +54,10 @@ enum {
        MTHCA_CQ_ENTRY_SIZE = 0x20
 };
 
+enum {
+       MTHCA_ATOMIC_BYTE_LEN = 8
+};
+
 /*
  * Must be packed because start is 64 bits but only aligned to 32 bits.
  */
@@ -599,11 +603,11 @@ static inline int mthca_poll_one(struct mthca_dev *dev,
                        break;
                case MTHCA_OPCODE_ATOMIC_CS:
                        entry->opcode    = IB_WC_COMP_SWAP;
-                       entry->byte_len  = be32_to_cpu(cqe->byte_cnt);
+                       entry->byte_len  = MTHCA_ATOMIC_BYTE_LEN;
                        break;
                case MTHCA_OPCODE_ATOMIC_FA:
                        entry->opcode    = IB_WC_FETCH_ADD;
-                       entry->byte_len  = be32_to_cpu(cqe->byte_cnt);
+                       entry->byte_len  = MTHCA_ATOMIC_BYTE_LEN;
                        break;
                case MTHCA_OPCODE_BIND_MW:
                        entry->opcode    = IB_WC_BIND_MW;