Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 98714cb1 authored by Jack Morgenstein's avatar Jack Morgenstein Committed by Roland Dreier
Browse files

IB/mthca: Fix PRM compliance problem in atomic-send completions



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: default avatarJack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
parent 0cefcf0b
Loading
Loading
Loading
Loading
+6 −2
Original line number Original line Diff line number Diff line
@@ -54,6 +54,10 @@ enum {
	MTHCA_CQ_ENTRY_SIZE = 0x20
	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.
 * 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;
			break;
		case MTHCA_OPCODE_ATOMIC_CS:
		case MTHCA_OPCODE_ATOMIC_CS:
			entry->opcode    = IB_WC_COMP_SWAP;
			entry->opcode    = IB_WC_COMP_SWAP;
			entry->byte_len  = be32_to_cpu(cqe->byte_cnt);
			entry->byte_len  = MTHCA_ATOMIC_BYTE_LEN;
			break;
			break;
		case MTHCA_OPCODE_ATOMIC_FA:
		case MTHCA_OPCODE_ATOMIC_FA:
			entry->opcode    = IB_WC_FETCH_ADD;
			entry->opcode    = IB_WC_FETCH_ADD;
			entry->byte_len  = be32_to_cpu(cqe->byte_cnt);
			entry->byte_len  = MTHCA_ATOMIC_BYTE_LEN;
			break;
			break;
		case MTHCA_OPCODE_BIND_MW:
		case MTHCA_OPCODE_BIND_MW:
			entry->opcode    = IB_WC_BIND_MW;
			entry->opcode    = IB_WC_BIND_MW;