All of lore.kernel.org
 help / color / mirror / Atom feed
From: swise@opengridcomputing.com (Steve Wise)
Subject: [PATCH v3 2/3] nvme-rdma: support up to 4 segments of inline data
Date: Wed, 30 May 2018 16:46:55 -0500	[thread overview]
Message-ID: <cef84f5b-8a5d-e19c-57ba-5dd87601bc07@opengridcomputing.com> (raw)
In-Reply-To: <2a3d3a38-9ab9-d83f-33c4-51a1ea05a7d7@grimberg.me>

Hey Sagi,


On 5/30/2018 4:42 PM, Sagi Grimberg wrote:
>
>
> On 05/29/2018 09:25 PM, Steve Wise wrote:
>> Allow up to 4 segments of inline data for NVMF WRITE operations. This
>> reduces latency for small WRITEs by removing the need for the target to
>> issue a READ WR for IB, or a REG_MR + READ WR chain for iWarp.
>>
>> Also cap the inline segments used based on the limitations of the
>> device.
>>
>> Signed-off-by: Steve Wise <swise at opengridcomputing.com>
>> Reviewed-by: Christoph Hellwig <hch at lst.de>
>> ---
>> ? drivers/nvme/host/rdma.c | 39 ++++++++++++++++++++++++++++-----------
>> ? 1 file changed, 28 insertions(+), 11 deletions(-)
>>
>> diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c
>> index f11faa8..32d2f4c 100644
>> --- a/drivers/nvme/host/rdma.c
>> +++ b/drivers/nvme/host/rdma.c
>> @@ -40,13 +40,14 @@
>> ? ? #define NVME_RDMA_MAX_SEGMENTS??????? 256
>> ? -#define NVME_RDMA_MAX_INLINE_SEGMENTS??? 1
>> +#define NVME_RDMA_MAX_INLINE_SEGMENTS??? 4
>> ? ? struct nvme_rdma_device {
>> ????? struct ib_device??? *dev;
>> ????? struct ib_pd??????? *pd;
>> ????? struct kref??????? ref;
>> ????? struct list_head??? entry;
>> +??? unsigned int??????? num_inline_segments;
>> ? };
>> ? ? struct nvme_rdma_qe {
>> @@ -117,6 +118,7 @@ struct nvme_rdma_ctrl {
>> ????? struct sockaddr_storage src_addr;
>> ? ????? struct nvme_ctrl??? ctrl;
>> +??? bool??????????? use_inline_data;
>> ? };
>> ? ? static inline struct nvme_rdma_ctrl *to_rdma_ctrl(struct
>> nvme_ctrl *ctrl)
>> @@ -249,7 +251,7 @@ static int nvme_rdma_create_qp(struct
>> nvme_rdma_queue *queue, const int factor)
>> ????? /* +1 for drain */
>> ????? init_attr.cap.max_recv_wr = queue->queue_size + 1;
>> ????? init_attr.cap.max_recv_sge = 1;
>> -??? init_attr.cap.max_send_sge = 1 + NVME_RDMA_MAX_INLINE_SEGMENTS;
>> +??? init_attr.cap.max_send_sge = 1 + dev->num_inline_segments;
>> ????? init_attr.sq_sig_type = IB_SIGNAL_REQ_WR;
>> ????? init_attr.qp_type = IB_QPT_RC;
>> ????? init_attr.send_cq = queue->ib_cq;
>> @@ -374,6 +376,9 @@ static int nvme_rdma_dev_get(struct
>> nvme_rdma_device *dev)
>> ????????? goto out_free_pd;
>> ????? }
>> ? +??? ndev->num_inline_segments = min(NVME_RDMA_MAX_INLINE_SEGMENTS,
>> +??????????????????? ndev->dev->attrs.max_sge - 1);
>> +??? pr_debug("num_inline_segments = %u\n", ndev->num_inline_segments);
>
> insist on keeping it? ibv_devinfo -v can give this info to the
> user/developer.
>

I agree.? I'll remove it.?

>> ????? list_add(&ndev->entry, &device_list);
>> ? out_unlock:
>> ????? mutex_unlock(&device_list_mutex);
>> @@ -1086,19 +1091,27 @@ static int nvme_rdma_set_sg_null(struct
>> nvme_command *c)
>> ? }
>> ? ? static int nvme_rdma_map_sg_inline(struct nvme_rdma_queue *queue,
>> -??????? struct nvme_rdma_request *req, struct nvme_command *c)
>> +??????? struct nvme_rdma_request *req, struct nvme_command *c,
>> +??????? int count)
>> ? {
>> ????? struct nvme_sgl_desc *sg = &c->common.dptr.sgl;
>> +??? struct scatterlist *sgl = req->sg_table.sgl;
>> +??? struct ib_sge *sge = &req->sge[1];
>> +??? u32 len = 0;
>> +??? int i;
>> ? -??? req->sge[1].addr = sg_dma_address(req->sg_table.sgl);
>> -??? req->sge[1].length = sg_dma_len(req->sg_table.sgl);
>> -??? req->sge[1].lkey = queue->device->pd->local_dma_lkey;
>> +??? for (i = 0; i < count; i++, sgl++, sge++) {
>> +??????? sge->addr = sg_dma_address(sgl);
>> +??????? sge->length = sg_dma_len(sgl);
>> +??????? sge->lkey = queue->device->pd->local_dma_lkey;
>> +??????? len += sge->length;
>> +??? }
>> ? ????? sg->addr = cpu_to_le64(queue->ctrl->ctrl.icdoff);
>> -??? sg->length = cpu_to_le32(sg_dma_len(req->sg_table.sgl));
>> +??? sg->length = cpu_to_le32(len);
>> ????? sg->type = (NVME_SGL_FMT_DATA_DESC << 4) | NVME_SGL_FMT_OFFSET;
>> ? -??? req->num_sge++;
>> +??? req->num_sge += count;
>> ????? return 0;
>> ? }
>> ? @@ -1191,13 +1204,14 @@ static int nvme_rdma_map_data(struct
>> nvme_rdma_queue *queue,
>> ????????? return -EIO;
>> ????? }
>> ? -??? if (count == 1) {
>> +??? if (count <= dev->num_inline_segments) {
>> ????????? if (rq_data_dir(rq) == WRITE && nvme_rdma_queue_idx(queue) &&
>> +??????????? queue->ctrl->use_inline_data &&
>> ????????????? blk_rq_payload_bytes(rq) <=
>> ????????????????? nvme_rdma_inline_data_size(queue))
>> -??????????? return nvme_rdma_map_sg_inline(queue, req, c);
>> +??????????? return nvme_rdma_map_sg_inline(queue, req, c, count);
>> ? -??????? if (dev->pd->flags & IB_PD_UNSAFE_GLOBAL_RKEY)
>> +??????? if (count == 1 && dev->pd->flags & IB_PD_UNSAFE_GLOBAL_RKEY)
>> ????????????? return nvme_rdma_map_sg_single(queue, req, c);
>> ????? }
>> ? @@ -1955,6 +1969,9 @@ static struct nvme_ctrl
>> *nvme_rdma_create_ctrl(struct device *dev,
>> ????????? goto out_remove_admin_queue;
>> ????? }
>> ? +??? if ((ctrl->ctrl.sgls & (1 << 20)))
>> +??????? ctrl->use_inline_data = true;
>> +
>
> Here it is... discard my last comment.

  reply	other threads:[~2018-05-30 21:46 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-29 18:26 [PATCH v3 0/3] NVMF/RDMA 16K Inline Support Steve Wise
2018-05-29 18:25 ` [PATCH v3 1/3] nvme-rdma: correctly check for target keyed sgl support Steve Wise
2018-05-29 20:23   ` Ruhl, Michael J
2018-05-30 14:39     ` Steve Wise
2018-05-30 15:11       ` Steve Wise
2018-05-30 21:37         ` Sagi Grimberg
2018-05-31 17:02           ` hch
2018-05-31 17:17             ` Steve Wise
2018-05-31 17:25               ` hch
2018-06-01 13:08                 ` Steve Wise
2018-06-03 11:57                 ` Sagi Grimberg
2018-06-03 18:27                   ` Steve Wise
2018-06-04 12:01                     ` Sagi Grimberg
2018-06-04 12:11                       ` Christoph Hellwig
2018-06-04 12:17                         ` Steve Wise
2018-06-04 13:52                         ` Max Gurtovoy
2018-06-04 14:21                           ` Steve Wise
2018-06-04 14:29                             ` Max Gurtovoy
2018-06-04 14:31                               ` Steve Wise
2018-06-04 14:37                                 ` Max Gurtovoy
2018-06-04 14:45                                   ` Steve Wise
2018-05-31 17:00     ` hch
2018-05-29 18:25 ` [PATCH v3 2/3] nvme-rdma: support up to 4 segments of inline data Steve Wise
2018-05-30 21:42   ` Sagi Grimberg
2018-05-30 21:46     ` Steve Wise [this message]
2018-05-29 18:25 ` [PATCH v3 3/3] nvmet-rdma: support 16K " Steve Wise
2018-05-30 15:49   ` Christopher Lameter
2018-05-30 16:46     ` Steve Wise
2018-05-30 17:02       ` Christopher Lameter
2018-05-30 21:45     ` Sagi Grimberg
2018-05-30 21:52       ` Steve Wise
2018-05-30 22:13         ` Sagi Grimberg
2018-05-30 22:26           ` Steve Wise
2018-06-03  8:39   ` Max Gurtovoy
2018-06-03 18:25     ` Steve Wise
2018-06-04 13:58       ` Max Gurtovoy
2018-06-04 14:18         ` Steve Wise
2018-06-05  8:52           ` Max Gurtovoy
2018-06-05 14:28             ` Steve Wise

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=cef84f5b-8a5d-e19c-57ba-5dd87601bc07@opengridcomputing.com \
    --to=swise@opengridcomputing.com \
    /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.