aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Morgenstein <jackm@mellanox.co.il>2005-12-15 21:50:51 +0000
committerRoland Dreier <rolandd@cisco.com>2006-11-09 19:57:04 -0800
commit3035e72a76e86070ead62050109d1aa70bfc7526 (patch)
tree1e83f2ae4ed540eaa44202285d844ddeee7a375a
parent182c04e4c642169d17e4415240be0a57b01d8567 (diff)
downloadlibmthca-3035e72a76e86070ead62050109d1aa70bfc7526.tar.gz
Only free SRQ WQEs for receive completions
When cleaning up a CQ for a QP attached to SRQ, need to free an SRQ WQE only if the CQE is a receive completion. Signed-off-by: Jack Morgenstein <jackm@mellanox.co.il> Signed-off-by: Roland Dreier <rolandd@cisco.com>
-rw-r--r--ChangeLog5
-rw-r--r--src/cq.c11
2 files changed, 15 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index fa90316..e14dd05 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2005-12-15 Jack Morgenstein <jackm@mellanox.co.il>
+
+ * src/cq.c (mthca_cq_clean): When cleaning up a CQ, we should free
+ an SRQ WQE if and only if the CQE is a receive.
+
2005-12-15 Michael S. Tsirkin <mst@mellanox.co.il>
* src/qp.c (mthca_store_qp): Don't increment qp_table ref count if
diff --git a/src/cq.c b/src/cq.c
index 5e69d61..f159382 100644
--- a/src/cq.c
+++ b/src/cq.c
@@ -121,6 +121,15 @@ struct mthca_err_cqe {
uint8_t owner;
};
+static inline int is_recv_cqe(struct mthca_cqe * cqe)
+{
+ if ((cqe->opcode & MTHCA_ERROR_CQE_OPCODE_MASK) ==
+ MTHCA_ERROR_CQE_OPCODE_MASK)
+ return !(cqe->opcode & 0x01);
+ else
+ return !(cqe->is_send & 0x80);
+}
+
static inline struct mthca_cqe *get_cqe(struct mthca_cq *cq, int entry)
{
return cq->buf + entry * MTHCA_CQ_ENTRY_SIZE;
@@ -549,7 +558,7 @@ void mthca_cq_clean(struct mthca_cq *cq, uint32_t qpn, struct mthca_srq *srq)
while ((int) --prod_index - (int) cq->cons_index >= 0) {
cqe = get_cqe(cq, prod_index & cq->ibv_cq.cqe);
if (cqe->my_qpn == htonl(qpn)) {
- if (srq)
+ if (srq && is_recv_cqe(cqe))
mthca_free_srq_wqe(srq,
ntohl(cqe->wqe) >> srq->wqe_shift);
++nfreed;