All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steve Wise <swise@opengridcomputing.com>
To: dledford@redhat.com
Cc: infinipath@intel.com, sagig@mellanox.com, ogerlitz@mellanox.com,
	roid@mellanox.com, linux-rdma@vger.kernel.org, eli@mellanox.com,
	target-devel@vger.kernel.org, linux-nfs@vger.kernel.org,
	bfields@fieldses.org
Subject: [PATCH V6 5/9] RDMA/isert: Limit read depth based on the device max_sge_rd capability
Date: Fri, 24 Jul 2015 11:18:43 -0500	[thread overview]
Message-ID: <20150724161842.25617.8145.stgit@build2.ogc.int> (raw)
In-Reply-To: <20150724161331.25617.8475.stgit@build2.ogc.int>

Use the device's max_sge_rd capability to compute the target's read sge
depth.  Save both the read and write max_sge values in the isert_conn
struct, and use these when creating RDMA_WRITE/READ work requests.

Signed-off-by: Steve Wise <swise@opengridcomputing.com>
---

 drivers/infiniband/ulp/isert/ib_isert.c |   24 ++++++++++++++++--------
 drivers/infiniband/ulp/isert/ib_isert.h |    3 ++-
 2 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c
index 7717009..6af3dd4 100644
--- a/drivers/infiniband/ulp/isert/ib_isert.c
+++ b/drivers/infiniband/ulp/isert/ib_isert.c
@@ -165,7 +165,9 @@ isert_create_qp(struct isert_conn *isert_conn,
 	 * outgoing control PDU responses.
 	 */
 	attr.cap.max_send_sge = max(2, device->dev_attr.max_sge - 2);
-	isert_conn->max_sge = attr.cap.max_send_sge;
+	isert_conn->max_write_sge = attr.cap.max_send_sge;
+	isert_conn->max_read_sge = min_t(u32, device->dev_attr.max_sge_rd,
+					 attr.cap.max_send_sge);
 
 	attr.cap.max_recv_sge = 1;
 	attr.sq_sig_type = IB_SIGNAL_REQ_WR;
@@ -2392,7 +2394,7 @@ isert_put_text_rsp(struct iscsi_cmd *cmd, struct iscsi_conn *conn)
 static int
 isert_build_rdma_wr(struct isert_conn *isert_conn, struct isert_cmd *isert_cmd,
 		    struct ib_sge *ib_sge, struct ib_send_wr *send_wr,
-		    u32 data_left, u32 offset)
+		    u32 data_left, u32 offset, u32 max_sge)
 {
 	struct iscsi_cmd *cmd = isert_cmd->iscsi_cmd;
 	struct scatterlist *sg_start, *tmp_sg;
@@ -2403,7 +2405,7 @@ isert_build_rdma_wr(struct isert_conn *isert_conn, struct isert_cmd *isert_cmd,
 
 	sg_off = offset / PAGE_SIZE;
 	sg_start = &cmd->se_cmd.t_data_sg[sg_off];
-	sg_nents = min(cmd->se_cmd.t_data_nents - sg_off, isert_conn->max_sge);
+	sg_nents = min(cmd->se_cmd.t_data_nents - sg_off, max_sge);
 	page_off = offset % PAGE_SIZE;
 
 	send_wr->sg_list = ib_sge;
@@ -2449,8 +2451,9 @@ isert_map_rdma(struct iscsi_conn *conn, struct iscsi_cmd *cmd,
 	struct isert_data_buf *data = &wr->data;
 	struct ib_send_wr *send_wr;
 	struct ib_sge *ib_sge;
-	u32 offset, data_len, data_left, rdma_write_max, va_offset = 0;
+	u32 offset, data_len, data_left, rdma_max_len, va_offset = 0;
 	int ret = 0, i, ib_sge_cnt;
+	u32 max_sge;
 
 	isert_cmd->tx_desc.isert_cmd = isert_cmd;
 
@@ -2472,7 +2475,12 @@ isert_map_rdma(struct iscsi_conn *conn, struct iscsi_cmd *cmd,
 	}
 	wr->ib_sge = ib_sge;
 
-	wr->send_wr_num = DIV_ROUND_UP(data->nents, isert_conn->max_sge);
+	if (wr->iser_ib_op == ISER_IB_RDMA_WRITE)
+		max_sge = isert_conn->max_write_sge;
+	else
+		max_sge =  isert_conn->max_read_sge;
+
+	wr->send_wr_num = DIV_ROUND_UP(data->nents, max_sge);
 	wr->send_wr = kzalloc(sizeof(struct ib_send_wr) * wr->send_wr_num,
 				GFP_KERNEL);
 	if (!wr->send_wr) {
@@ -2482,11 +2490,11 @@ isert_map_rdma(struct iscsi_conn *conn, struct iscsi_cmd *cmd,
 	}
 
 	wr->isert_cmd = isert_cmd;
-	rdma_write_max = isert_conn->max_sge * PAGE_SIZE;
+	rdma_max_len = max_sge * PAGE_SIZE;
 
 	for (i = 0; i < wr->send_wr_num; i++) {
 		send_wr = &isert_cmd->rdma_wr.send_wr[i];
-		data_len = min(data_left, rdma_write_max);
+		data_len = min(data_left, rdma_max_len);
 
 		send_wr->send_flags = 0;
 		if (wr->iser_ib_op == ISER_IB_RDMA_WRITE) {
@@ -2508,7 +2516,7 @@ isert_map_rdma(struct iscsi_conn *conn, struct iscsi_cmd *cmd,
 		}
 
 		ib_sge_cnt = isert_build_rdma_wr(isert_conn, isert_cmd, ib_sge,
-					send_wr, data_len, offset);
+					send_wr, data_len, offset, max_sge);
 		ib_sge += ib_sge_cnt;
 
 		offset += data_len;
diff --git a/drivers/infiniband/ulp/isert/ib_isert.h b/drivers/infiniband/ulp/isert/ib_isert.h
index 9ec23a7..29fde27 100644
--- a/drivers/infiniband/ulp/isert/ib_isert.h
+++ b/drivers/infiniband/ulp/isert/ib_isert.h
@@ -152,7 +152,8 @@ struct isert_conn {
 	u32			responder_resources;
 	u32			initiator_depth;
 	bool			pi_support;
-	u32			max_sge;
+	u32			max_write_sge;
+	u32			max_read_sge;
 	char			*login_buf;
 	char			*login_req_buf;
 	char			*login_rsp_buf;

  parent reply	other threads:[~2015-07-24 16:18 UTC|newest]

Thread overview: 76+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-24 16:18 [PATCH V6 0/9] iSER support for iWARP Steve Wise
2015-07-24 16:18 ` Steve Wise
     [not found] ` <20150724161331.25617.8475.stgit-PBeJgSbIpn97NCTnQtmixQ@public.gmane.org>
2015-07-24 16:18   ` [PATCH V6 1/9] RDMA/iser: Limit sg tablesize and max_sectors to device fastreg max depth Steve Wise
2015-07-24 16:18     ` Steve Wise
     [not found]     ` <20150724161820.25617.63886.stgit-PBeJgSbIpn97NCTnQtmixQ@public.gmane.org>
2015-07-24 16:41       ` Jason Gunthorpe
2015-07-24 16:41         ` Jason Gunthorpe
2015-07-24 18:40         ` Steve Wise
2015-07-24 18:40           ` Steve Wise
2015-07-24 19:14           ` Jason Gunthorpe
2015-07-26  9:58             ` Sagi Grimberg
2015-07-26  9:57           ` Sagi Grimberg
2015-07-26  9:57             ` Sagi Grimberg
2015-07-24 16:18   ` [PATCH V6 2/9] mlx4, mlx5, mthca: Expose max_sge_rd correctly Steve Wise
2015-07-24 16:18     ` Steve Wise
2015-07-24 16:18   ` [PATCH V6 3/9] ipath,qib: " Steve Wise
2015-07-24 16:18     ` Steve Wise
2015-07-24 16:18   ` [PATCH V6 4/9] svcrdma: Use max_sge_rd for destination read depths Steve Wise
2015-07-24 16:18     ` Steve Wise
     [not found]     ` <20150724161837.25617.48584.stgit-PBeJgSbIpn97NCTnQtmixQ@public.gmane.org>
2015-07-24 18:51       ` Steve Wise
2015-07-24 18:51         ` Steve Wise
2015-07-26  9:58         ` Sagi Grimberg
     [not found]           ` <55B4AF63.3040108-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2015-07-26 10:42             ` Christoph Hellwig
2015-07-26 10:42               ` Christoph Hellwig
2015-07-24 16:18   ` [PATCH V6 6/9] isert: Rename IO functions to more descriptive names Steve Wise
2015-07-24 16:18     ` Steve Wise
     [not found]     ` <20150724161848.25617.26092.stgit-PBeJgSbIpn97NCTnQtmixQ@public.gmane.org>
2015-07-26 10:08       ` Sagi Grimberg
2015-07-26 10:08         ` Sagi Grimberg
     [not found]         ` <55B4B190.7070305-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2015-07-26 10:43           ` Christoph Hellwig
2015-07-26 10:43             ` Christoph Hellwig
     [not found]             ` <20150726104328.GB18944-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2015-07-26 11:00               ` Sagi Grimberg
2015-07-26 11:00                 ` Sagi Grimberg
2015-07-26 15:53                 ` Christoph Hellwig
2015-07-26 16:44                   ` Sagi Grimberg
     [not found]                 ` <55B4BDE3.8040801-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2015-07-26 17:32                   ` Steve Wise
2015-07-26 17:32                     ` Steve Wise
2015-07-26 17:40                     ` Sagi Grimberg
     [not found]                       ` <55B51B7A.8030008-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2015-07-26 20:15                         ` Steve Wise
2015-07-26 20:15                           ` Steve Wise
2015-07-26 20:17           ` Steve Wise
2015-07-26 20:17             ` Steve Wise
     [not found]             ` <55B5404F.5040404-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
2015-07-27 21:45               ` Steve Wise
2015-07-27 21:45                 ` Steve Wise
2015-08-03 19:32               ` Steve Wise
2015-08-03 19:32                 ` Steve Wise
2015-08-04 17:26                 ` Sagi Grimberg
     [not found]                   ` <55C0F5B7.4040100-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2015-08-04 17:44                     ` Steve Wise
2015-08-04 17:44                       ` Steve Wise
2015-08-05 21:23                   ` Steve Wise
2015-08-05 21:23                     ` Steve Wise
2015-08-06 15:37                     ` Sagi Grimberg
2015-08-06 15:37                       ` Sagi Grimberg
     [not found]                       ` <55C37F43.6080106-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2015-08-12 22:15                         ` Steve Wise
2015-08-12 22:15                           ` Steve Wise
2015-08-13 13:09                           ` Sagi Grimberg
2015-07-24 16:18 ` Steve Wise [this message]
2015-07-24 16:18 ` [PATCH V6 7/9] isert: Use the device's max fastreg page list depth Steve Wise
2015-07-24 16:18 ` [PATCH V6 8/9] isert: Use local_dma_lkey whenever possible Steve Wise
     [not found]   ` <20150724161859.25617.17286.stgit-PBeJgSbIpn97NCTnQtmixQ@public.gmane.org>
2015-07-24 16:49     ` Jason Gunthorpe
2015-07-24 16:49       ` Jason Gunthorpe
     [not found]       ` <20150724164909.GB25480-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-07-24 18:41         ` Steve Wise
2015-07-24 18:41           ` Steve Wise
2015-07-24 16:19 ` [PATCH V6 9/9] isert: Support iWARP transports using FRMRs Steve Wise
2015-07-24 16:57   ` Jason Gunthorpe
2015-07-24 18:48     ` Steve Wise
2015-07-24 18:48       ` Steve Wise
2015-07-24 19:24       ` Jason Gunthorpe
2015-07-24 19:24         ` Jason Gunthorpe
2015-07-24 19:57         ` Steve Wise
2015-07-24 19:57           ` Steve Wise
2015-07-24 22:11           ` Steve Wise
2015-07-24 22:11             ` Steve Wise
2015-07-24 22:38             ` Jason Gunthorpe
2015-07-24 22:38               ` Jason Gunthorpe
     [not found]         ` <20150724192411.GC26225-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-07-26 10:23           ` Sagi Grimberg
2015-07-26 10:23             ` Sagi Grimberg
2015-07-27 17:07             ` Jason Gunthorpe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150724161842.25617.8145.stgit@build2.ogc.int \
    --to=swise@opengridcomputing.com \
    --cc=bfields@fieldses.org \
    --cc=dledford@redhat.com \
    --cc=eli@mellanox.com \
    --cc=infinipath@intel.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=ogerlitz@mellanox.com \
    --cc=roid@mellanox.com \
    --cc=sagig@mellanox.com \
    --cc=target-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.