diff --git a/srpt/src/ib_srpt.c b/srpt/src/ib_srpt.c index 19c0f87ec..a16532e09 100644 --- a/srpt/src/ib_srpt.c +++ b/srpt/src/ib_srpt.c @@ -925,15 +925,7 @@ static int srpt_post_recv(struct srpt_device *sdev, static int srpt_adjust_srq_wr_avail(struct srpt_rdma_ch *ch, int delta) { - int res; - unsigned long flags; - - spin_lock_irqsave(&ch->spinlock, flags); - ch->sq_wr_avail += delta; - res = ch->sq_wr_avail; - spin_unlock_irqrestore(&ch->spinlock, flags); - - return res; + return atomic_add_return(delta, &ch->sq_wr_avail); } /** @@ -2158,7 +2150,7 @@ static int srpt_create_ch_ib(struct srpt_rdma_ch *ch) TRACE_DBG("qp_num = %#x", ch->qp->qp_num); - ch->sq_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 max_sge= %d sq_size = %d" " cm_id= %p", __func__, ch->cq->cqe, diff --git a/srpt/src/ib_srpt.h b/srpt/src/ib_srpt.h index f530e1288..39272015b 100644 --- a/srpt/src/ib_srpt.h +++ b/srpt/src/ib_srpt.h @@ -338,7 +338,7 @@ struct srpt_rdma_ch { int rq_size; int max_sge; int max_rsp_size; - int sq_wr_avail; + atomic_t sq_wr_avail; struct srpt_port *sport; struct srpt_tgt *srpt_tgt; int max_ti_iu_len;