From: maxg@mellanox.com (Max Gurtovoy)
Subject: [PATCH v2 1/4] IB/core: Add inline function to get sg mr type
Date: Thu, 13 Apr 2017 18:56:14 +0300 [thread overview]
Message-ID: <1492098977-5231-2-git-send-email-maxg@mellanox.com> (raw)
In-Reply-To: <1492098977-5231-1-git-send-email-maxg@mellanox.com>
ULPs such as iSER/NVMEoF can use memory regions that support
arbitrary sg list mapping in order to allow the block layer to
send us gappy bios and reduce the stack workload. Add an helper
function to get IB_MR_TYPE_SG_GAPS mr_type if the device support
this kind of mapping.
Signed-off-by: Max Gurtovoy <maxg at mellanox.com>
Reviewed-by: Leon Romanovsky <leon at kernel.org>
---
include/rdma/ib_verbs.h | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 99e4423..dd97169 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -3375,6 +3375,23 @@ int ib_map_mr_sg(struct ib_mr *mr, struct scatterlist *sg, int sg_nents,
int ib_sg_to_pages(struct ib_mr *mr, struct scatterlist *sgl, int sg_nents,
unsigned int *sg_offset, int (*set_page)(struct ib_mr *, u64));
+/**
+ * ib_get_sg_mr_type() - check if the device support arbitrary
+ * sg mapping and return a suitable mr type.
+ * @device: The device on which to check support.
+ *
+ * Return: IB_MR_TYPE_SG_GAPS if the device support.
+ * Otherwise, return IB_MR_TYPE_MEM_REG.
+ */
+static inline enum ib_mr_type ib_get_sg_mr_type(struct ib_device *device)
+{
+ if (device->attrs.device_cap_flags & IB_DEVICE_SG_GAPS_REG)
+ return IB_MR_TYPE_SG_GAPS;
+ else
+ return IB_MR_TYPE_MEM_REG;
+
+}
+
void ib_drain_rq(struct ib_qp *qp);
void ib_drain_sq(struct ib_qp *qp);
void ib_drain_qp(struct ib_qp *qp);
--
1.7.1
next prev parent reply other threads:[~2017-04-13 15:56 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-13 15:56 [PATCH v2 0/4] arbitrary sg lists support Max Gurtovoy
2017-04-13 15:56 ` Max Gurtovoy [this message]
2017-04-20 11:24 ` [PATCH v2 1/4] IB/core: Add inline function to get sg mr type Sagi Grimberg
2017-04-13 15:56 ` [PATCH v2 2/4] IB/iser: Use ib_get_sg_mr_type() helper Max Gurtovoy
2017-04-13 15:56 ` [PATCH v2 3/4] nvme: enable SG gaps support Max Gurtovoy
2017-04-20 11:27 ` Sagi Grimberg
2017-04-21 6:44 ` Christoph Hellwig
2017-04-23 7:20 ` Sagi Grimberg
2017-04-23 8:45 ` Christoph Hellwig
2017-04-23 9:45 ` Sagi Grimberg
2017-04-23 13:23 ` Max Gurtovoy
2017-04-24 7:02 ` Christoph Hellwig
2017-04-13 15:56 ` [PATCH v2 4/4] nvme-rdma: add support for arbitrary sg lists mapping Max Gurtovoy
2017-04-13 16:31 ` [PATCH v2 0/4] arbitrary sg lists support Bart Van Assche
2017-04-13 16:46 ` Max Gurtovoy
2017-04-13 16:59 ` Laurence Oberman
2017-04-20 11:30 ` Sagi Grimberg
2017-04-23 10:34 ` Leon Romanovsky
2017-04-23 11:49 ` Sagi Grimberg
2017-04-23 12:12 ` Leon Romanovsky
2017-04-23 12:28 ` Sagi Grimberg
2017-04-23 13:35 ` Max Gurtovoy
2017-04-23 14:35 ` Sagi Grimberg
2017-05-01 18:50 ` Doug Ledford
2017-05-02 16:14 ` Max Gurtovoy
2017-05-02 16:39 ` Laurence Oberman
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=1492098977-5231-2-git-send-email-maxg@mellanox.com \
--to=maxg@mellanox.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).