From fe81f9766c0db6e6984da43f707eda489592f657 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Wed, 14 Jul 2010 17:22:52 +0000 Subject: [PATCH] Changed two PRINT_INFO() messages that reported that the send queue was full into PRINT_ERROR() messages, and renamed a few variables. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@1824 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- srpt/src/ib_srpt.c | 32 +++++++++++++++++--------------- srpt/src/ib_srpt.h | 4 ++-- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/srpt/src/ib_srpt.c b/srpt/src/ib_srpt.c index 4399394a4..3ae744385 100644 --- a/srpt/src/ib_srpt.c +++ b/srpt/src/ib_srpt.c @@ -805,8 +805,8 @@ static int srpt_post_send(struct srpt_rdma_ch *ch, struct srpt_ioctx *ioctx, int ret; ret = -ENOMEM; - if (atomic_dec_return(&ch->qp_wr_avail) < 0) { - PRINT_ERROR("%s[%d]: SRQ full", __func__, __LINE__); + if (atomic_dec_return(&ch->sq_wr_avail) < 0) { + PRINT_ERROR("%s[%d]: send queue full", __func__, __LINE__); goto out; } @@ -828,7 +828,7 @@ static int srpt_post_send(struct srpt_rdma_ch *ch, struct srpt_ioctx *ioctx, out: if (ret < 0) - atomic_inc(&ch->qp_wr_avail); + atomic_inc(&ch->sq_wr_avail); return ret; } @@ -1756,7 +1756,7 @@ static void srpt_send_completion(struct ib_cq *cq, void *ctx) ioctx = sdev->ioctx_ring[wc.wr_id]; if (wc.opcode == IB_WC_SEND) { - atomic_inc(&ch->qp_wr_avail); + atomic_inc(&ch->sq_wr_avail); srpt_handle_send_comp(ch, ioctx, context); } else { #if defined(CONFIG_SCST_DEBUG) @@ -1764,7 +1764,7 @@ static void srpt_send_completion(struct ib_cq *cq, void *ctx) WARN_ON(ioctx->n_rdma <= 0); #endif atomic_add(ioctx->n_rdma, - &ch->qp_wr_avail); + &ch->sq_wr_avail); srpt_handle_rdma_comp(ch, ioctx, context); } @@ -1843,11 +1843,12 @@ static int srpt_create_ch_ib(struct srpt_rdma_ch *ch) goto out_destroy_scq; } - atomic_set(&ch->qp_wr_avail, qp_init->cap.max_send_wr); + atomic_set(&ch->sq_wr_avail, qp_init->cap.max_send_wr); - TRACE_DBG("%s: max_cqe= %d r max_sge= %d s max_sge= %d cm_id= %p", - __func__, ch->rcq->cqe, ch->scq->cqe, qp_init->cap.max_send_sge, - ch->cm_id); + TRACE_DBG("%s: max_cqe= %d r max_sge= %d s max_sge= %d sq_size = %d" + " cm_id= %p", __func__, ch->rcq->cqe, ch->scq->cqe, + qp_init->cap.max_send_sge, qp_init->cap.max_send_wr, + ch->cm_id); /* Modify the attributes and the state of queue pair ch->qp. */ @@ -2688,15 +2689,16 @@ static int srpt_perform_rdmas(struct srpt_rdma_ch *ch, struct srpt_ioctx *ioctx, struct rdma_iu *riu; int i; int ret; - int srq_wr_avail; + int sq_wr_avail; if (dir == SCST_DATA_WRITE) { ret = -ENOMEM; - srq_wr_avail = atomic_sub_return(ioctx->n_rdma, - &ch->qp_wr_avail); - if (srq_wr_avail < 0) { - atomic_add(ioctx->n_rdma, &ch->qp_wr_avail); - PRINT_INFO("%s[%d]: SRQ full", __func__, __LINE__); + sq_wr_avail = atomic_sub_return(ioctx->n_rdma, + &ch->sq_wr_avail); + if (sq_wr_avail < 0) { + atomic_add(ioctx->n_rdma, &ch->sq_wr_avail); + PRINT_ERROR("%s[%d]: send queue full", + __func__, __LINE__); goto out; } } diff --git a/srpt/src/ib_srpt.h b/srpt/src/ib_srpt.h index 262250a47..9e341677f 100644 --- a/srpt/src/ib_srpt.h +++ b/srpt/src/ib_srpt.h @@ -211,7 +211,7 @@ enum rdma_ch_state { * struct srpt_rdma_ch - RDMA channel. * @cm_id: IB CM ID associated with the channel. * @qp: IB queue pair used for communicating over this channel. - * @qp_wr_avail: number of WRs in qp that are not being processed by the HCA. + * @sq_wr_avail: number of work requests available in the send queue. * @rcq: completion queue for receive operations over this channel. * @scq: completion queue for send operations over this channel. * @sport: pointer to the information of the HCA port used by this @@ -235,7 +235,7 @@ enum rdma_ch_state { struct srpt_rdma_ch { struct ib_cm_id *cm_id; struct ib_qp *qp; - atomic_t qp_wr_avail; + atomic_t sq_wr_avail; spinlock_t recv_lock; struct ib_cq *rcq; struct ib_cq *scq;