aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/ulp/srpt
diff options
context:
space:
mode:
authorBart Van Assche <bart.vanassche@wdc.com>2017-10-11 10:27:23 -0700
committerDoug Ledford <dledford@redhat.com>2017-10-18 10:49:54 -0400
commit7a01d05cd5bed9594fbc4dff5e944652ff23876c (patch)
tree8de9968af9acbe944ef3c9e6f45562554237b24a /drivers/infiniband/ulp/srpt
parentIB/srpt: Do not accept invalid initiator port names (diff)
downloadlinux-dev-7a01d05cd5bed9594fbc4dff5e944652ff23876c.tar.xz
linux-dev-7a01d05cd5bed9594fbc4dff5e944652ff23876c.zip
IB/srpt: Limit the send and receive queue sizes to what the HCA supports
Additionally, correct the comment about ch->rq_size. Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband/ulp/srpt')
-rw-r--r--drivers/infiniband/ulp/srpt/ib_srpt.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c
index 95178b4e3565..76370e39857d 100644
--- a/drivers/infiniband/ulp/srpt/ib_srpt.c
+++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
@@ -1650,7 +1650,7 @@ retry:
* both both, as RDMA contexts will also post completions for the
* RDMA READ case.
*/
- qp_init->cap.max_send_wr = srp_sq_size / 2;
+ qp_init->cap.max_send_wr = min(srp_sq_size / 2, attrs->max_qp_wr + 0U);
qp_init->cap.max_rdma_ctxs = srp_sq_size / 2;
qp_init->cap.max_send_sge = min(attrs->max_sge, SRPT_MAX_SG_PER_WQE);
qp_init->port_num = ch->sport->port;
@@ -1953,10 +1953,11 @@ static int srpt_cm_req_recv(struct ib_cm_id *cm_id,
ch->cm_id = cm_id;
cm_id->context = ch;
/*
- * Avoid QUEUE_FULL conditions by limiting the number of buffers used
- * for the SRP protocol to the command queue size.
+ * ch->rq_size should be at least as large as the initiator queue
+ * depth to avoid that the initiator driver has to report QUEUE_FULL
+ * to the SCSI mid-layer.
*/
- ch->rq_size = SRPT_RQ_SIZE;
+ ch->rq_size = min(SRPT_RQ_SIZE, sdev->device->attrs.max_qp_wr);
spin_lock_init(&ch->spinlock);
ch->state = CH_CONNECTING;
INIT_LIST_HEAD(&ch->cmd_wait_list);