diff options
author | Jack Morgenstein <jackm@mellanox.co.il> | 2005-12-15 21:50:51 +0000 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2006-11-09 19:57:04 -0800 |
commit | 3035e72a76e86070ead62050109d1aa70bfc7526 (patch) | |
tree | 1e83f2ae4ed540eaa44202285d844ddeee7a375a | |
parent | 182c04e4c642169d17e4415240be0a57b01d8567 (diff) | |
download | libmthca-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-- | ChangeLog | 5 | ||||
-rw-r--r-- | src/cq.c | 11 |
2 files changed, 15 insertions, 1 deletions
@@ -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 @@ -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; |