From b2536f47cf49b8c59b9e8c91be2d98d6a0fb0d26 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Tue, 19 May 2020 22:05:51 +0000 Subject: [PATCH 1/3] ib_srpt: Reduce QP max_recv_sge to 1 git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8939 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- srpt/src/ib_srpt.c | 5 +---- srpt/src/ib_srpt.h | 2 -- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/srpt/src/ib_srpt.c b/srpt/src/ib_srpt.c index 51286248c..62970cb34 100644 --- a/srpt/src/ib_srpt.c +++ b/srpt/src/ib_srpt.c @@ -2331,10 +2331,8 @@ retry: qp_init->cap.max_send_wr = sq_size; #if HAVE_DEV_ATTR_MAX_SEND_SGE ch->max_send_sge = sdev->dev_attr.max_send_sge; - ch->max_recv_sge = sdev->dev_attr.max_recv_sge; #else ch->max_send_sge = sdev->dev_attr.max_sge; - ch->max_recv_sge = ch->max_send_sge; #endif /* * For max_sge values > 2 * max_sge_delta, subtract max_sge_delta. For @@ -2346,12 +2344,11 @@ retry: max_t(int, 0, ch->max_send_sge - max_sge_delta)); qp_init->cap.max_send_sge = ch->max_send_sge; - qp_init->cap.max_recv_sge = ch->max_recv_sge; + qp_init->cap.max_recv_sge = 1; if (sdev->use_srq) { qp_init->srq = sdev->srq; } else { qp_init->cap.max_recv_wr = ch->rq_size; - qp_init->cap.max_recv_sge = ch->max_recv_sge; } if (ch->using_rdma_cm) { diff --git a/srpt/src/ib_srpt.h b/srpt/src/ib_srpt.h index ce680261a..30b07adfb 100644 --- a/srpt/src/ib_srpt.h +++ b/srpt/src/ib_srpt.h @@ -382,7 +382,6 @@ enum rdma_ch_state { * @kref: kref for this channel. * @rq_size: IB receive queue size. * @max_send_sge: Maximum length of RDMA send scatter list. - * @max_recv_sge: Maximum length of RDMA receive scatter list. * @max_rsp_size: Maximum size of an SRP response message in bytes. * @sq_wr_avail: number of work requests available in the send queue. * @sport: pointer to the information of the HCA port used by this @@ -428,7 +427,6 @@ struct srpt_rdma_ch { struct kref kref; int rq_size; u32 max_send_sge; - u32 max_recv_sge; u32 max_rsp_size; atomic_t sq_wr_avail; struct srpt_port *sport; From de74677c561b89d6a824677a5e19f5f595f31fe6 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Tue, 19 May 2020 22:13:11 +0000 Subject: [PATCH 2/3] ib_srpt: Remove two superfluous assignments git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8940 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- srpt/src/ib_srpt.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/srpt/src/ib_srpt.c b/srpt/src/ib_srpt.c index 62970cb34..d9c341220 100644 --- a/srpt/src/ib_srpt.c +++ b/srpt/src/ib_srpt.c @@ -1304,7 +1304,6 @@ static int srpt_ch_qp_rtr(struct srpt_rdma_ch *ch, struct ib_qp *qp) if (ret) goto out; - attr->qp_access_flags = 0; attr->max_dest_rd_atomic = 4; ret = ib_modify_qp(qp, attr, attr_mask); @@ -1338,7 +1337,6 @@ static int srpt_ch_qp_rts(struct srpt_rdma_ch *ch, struct ib_qp *qp) if (ret) goto out; - attr->qp_access_flags = 0; attr->max_rd_atomic = 4; ret = ib_modify_qp(qp, attr, attr_mask); From 27ab15f57329ae318bd72fc26c42e931177997f8 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Tue, 19 May 2020 22:14:31 +0000 Subject: [PATCH 3/3] ib_srpt: Use kvmalloc() instead of vmalloc() git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8941 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- srpt/src/ib_srpt.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/srpt/src/ib_srpt.c b/srpt/src/ib_srpt.c index d9c341220..930729092 100644 --- a/srpt/src/ib_srpt.c +++ b/srpt/src/ib_srpt.c @@ -889,7 +889,7 @@ static struct srpt_ioctx **srpt_alloc_ioctx_ring(struct srpt_device *sdev, WARN_ON(ioctx_size != sizeof(struct srpt_recv_ioctx) && ioctx_size != sizeof(struct srpt_send_ioctx)); - ring = vmalloc(ring_size * sizeof(ring[0])); + ring = kvmalloc_array(ring_size, sizeof(ring[0]), GFP_KERNEL); if (!ring) goto out; for (i = 0; i < ring_size; ++i) { @@ -904,7 +904,7 @@ static struct srpt_ioctx **srpt_alloc_ioctx_ring(struct srpt_device *sdev, err: while (--i >= 0) srpt_free_ioctx(sdev, ring[i], buf_cache, dir); - vfree(ring); + kvfree(ring); ring = NULL; out: return ring; @@ -930,7 +930,7 @@ static void srpt_free_ioctx_ring(struct srpt_ioctx **ioctx_ring, for (i = 0; i < ring_size; ++i) srpt_free_ioctx(sdev, ioctx_ring[i], buf_cache, dir); - vfree(ioctx_ring); + kvfree(ioctx_ring); } /**