mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-17 10:41:26 +00:00
ib_srpt: Micro-optimize srpt_adjust_srq_wr_avail()
The overhead of atomic_add_return() is lower than that of a spin_lock() / spin_unlock() pair, hence switch to the former. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5367 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user