linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Doug Ledford <dledford@redhat.com>, Jason Gunthorpe <jgg@mellanox.com>
Cc: Leon Romanovsky <leonro@mellanox.com>,
	RDMA mailing list <linux-rdma@vger.kernel.org>,
	Erez Alfasi <ereza@mellanox.com>
Subject: [PATCH rdma-next 3/6] RDMA/nldev: Return ODP type per MR
Date: Wed,  7 Aug 2019 13:34:00 +0300	[thread overview]
Message-ID: <20190807103403.8102-4-leon@kernel.org> (raw)
In-Reply-To: <20190807103403.8102-1-leon@kernel.org>

From: Erez Alfasi <ereza@mellanox.com>

Provide an ODP explicit/implicit type indicator
as part of 'rdma resource mr show' dump.

For example:
~$: rdma resource mr show
dev mlx5_0 mrn 1 rkey 0xa99a lkey 0xa99a mrlen 50000000
pdn 9 pid 7372 odp explicit comm ibv_rc_pingpong

For non-ODP MRs, we won't print "odp ..." at all.

Signed-off-by: Erez Alfasi <ereza@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
 drivers/infiniband/core/nldev.c  | 8 ++++++++
 include/uapi/rdma/rdma_netlink.h | 5 +++++
 2 files changed, 13 insertions(+)

diff --git a/drivers/infiniband/core/nldev.c b/drivers/infiniband/core/nldev.c
index e287b71a1cfd..1562b9446c51 100644
--- a/drivers/infiniband/core/nldev.c
+++ b/drivers/infiniband/core/nldev.c
@@ -37,6 +37,8 @@
 #include <net/netlink.h>
 #include <rdma/rdma_cm.h>
 #include <rdma/rdma_netlink.h>
+#include <rdma/ib_umem.h>
+#include <rdma/ib_umem_odp.h>
 
 #include "core_priv.h"
 #include "cma_priv.h"
@@ -101,6 +103,7 @@ static const struct nla_policy nldev_policy[RDMA_NLDEV_ATTR_MAX] = {
 	[RDMA_NLDEV_ATTR_RES_MRLEN]		= { .type = NLA_U64 },
 	[RDMA_NLDEV_ATTR_RES_MRN]		= { .type = NLA_U32 },
 	[RDMA_NLDEV_ATTR_RES_MR_ENTRY]		= { .type = NLA_NESTED },
+	[RDMA_NLDEV_ATTR_RES_MR_ODP_TYPE]	= { .type = NLA_U8 },
 	[RDMA_NLDEV_ATTR_RES_PATH_MIG_STATE]	= { .type = NLA_U8 },
 	[RDMA_NLDEV_ATTR_RES_PD]		= { .type = NLA_NESTED },
 	[RDMA_NLDEV_ATTR_RES_PDN]		= { .type = NLA_U32 },
@@ -589,6 +592,11 @@ static int fill_res_mr_entry(struct sk_buff *msg, bool has_cap_net_admin,
 			goto err;
 	}
 
+	if (mr->umem->is_odp)
+		if (nla_put_u8(msg, RDMA_NLDEV_ATTR_RES_MR_ODP_TYPE,
+			       to_ib_umem_odp(mr->umem)->type))
+			goto err;
+
 	if (nla_put_u64_64bit(msg, RDMA_NLDEV_ATTR_RES_MRLEN, mr->length,
 			      RDMA_NLDEV_ATTR_PAD))
 		goto err;
diff --git a/include/uapi/rdma/rdma_netlink.h b/include/uapi/rdma/rdma_netlink.h
index 8e277783fa96..765771a7caf7 100644
--- a/include/uapi/rdma/rdma_netlink.h
+++ b/include/uapi/rdma/rdma_netlink.h
@@ -525,6 +525,11 @@ enum rdma_nldev_attr {
 	 */
 	RDMA_NLDEV_ATTR_DEV_DIM,                /* u8 */
 
+	/*
+	 * MR ODP type, e.g. implicit/explicit.
+	 */
+	RDMA_NLDEV_ATTR_RES_MR_ODP_TYPE,	/* u8 */
+
 	/*
 	 * Always the end
 	 */
-- 
2.20.1


  parent reply	other threads:[~2019-08-07 10:34 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-07 10:33 [PATCH rdma-next 0/6] ODP information and statistics Leon Romanovsky
2019-08-07 10:33 ` [PATCH rdma-next 1/6] RDMA: Embed umem within core MR Leon Romanovsky
2019-08-14  9:33   ` Devesh Sharma
2019-08-07 10:33 ` [PATCH rdma-next 2/6] RDMA/umem: Add ODP type indicator within ib_umem_odp Leon Romanovsky
2019-08-07 11:23   ` Gal Pressman
2019-08-07 11:44     ` Jason Gunthorpe
2019-08-07 11:49       ` Gal Pressman
2019-08-07 11:44   ` Jason Gunthorpe
2019-08-07 12:13     ` Leon Romanovsky
2019-08-07 12:35       ` Jason Gunthorpe
2019-08-07 13:12         ` Leon Romanovsky
2019-08-12 10:53           ` Leon Romanovsky
2019-08-12 12:11             ` Jason Gunthorpe
2019-08-12 13:32               ` Leon Romanovsky
2019-08-07 10:34 ` Leon Romanovsky [this message]
2019-08-07 10:34 ` [PATCH rdma-next 4/6] IB/mlx5: Introduce ODP diagnostic counters Leon Romanovsky
2019-08-07 10:34 ` [PATCH rdma-next 5/6] RDMA/nldev: Allow different fill function per resource Leon Romanovsky
2019-08-07 10:34 ` [PATCH rdma-next 6/6] RDMA/nldev: Provide MR statistics Leon Romanovsky

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=20190807103403.8102-4-leon@kernel.org \
    --to=leon@kernel.org \
    --cc=dledford@redhat.com \
    --cc=ereza@mellanox.com \
    --cc=jgg@mellanox.com \
    --cc=leonro@mellanox.com \
    --cc=linux-rdma@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 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).