All of lore.kernel.org
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Subject: [PATCH rdma-next 3/4] RDMA/netink: Export lids and sm_lids
Date: Wed, 28 Jun 2017 16:34:44 +0300	[thread overview]
Message-ID: <20170628133445.16550-4-leon@kernel.org> (raw)
In-Reply-To: <20170628133445.16550-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>

From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

According to the IB specification, the LID and SM_LID
are 16-bit wide, but to support OmniPath users, export
it as 32-bit value from the beginning.

Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
 drivers/infiniband/core/nldev.c  | 7 ++++++-
 include/uapi/rdma/rdma_netlink.h | 8 ++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/infiniband/core/nldev.c b/drivers/infiniband/core/nldev.c
index 755b8167280b..6b290dada589 100644
--- a/drivers/infiniband/core/nldev.c
+++ b/drivers/infiniband/core/nldev.c
@@ -45,6 +45,8 @@ static const struct nla_policy nldev_policy[RDMA_NLDEV_ATTR_MAX] = {
 	[RDMA_NLDEV_ATTR_GUID]		= { .type = NLA_U64 },
 	[RDMA_NLDEV_ATTR_SYS_IMAGE_GUID] = { .type = NLA_U64 },
 	[RDMA_NLDEV_ATTR_SUBNET_PREFIX]	= { .type = NLA_U64 },
+	[RDMA_NLDEV_ATTR_LID]		= { .type = NLA_U32 },
+	[RDMA_NLDEV_ATTR_SM_LID]	= { .type = NLA_U32 },
 };

 static int fill_dev_info(struct sk_buff *msg, struct ib_device *device)
@@ -99,7 +101,10 @@ static int fill_port_info(struct sk_buff *msg,
 	if (nla_put_u64_64bit(msg, RDMA_NLDEV_ATTR_SUBNET_PREFIX,
 			      attr.subnet_prefix, 0))
 		return -EMSGSIZE;
-
+	if (nla_put_u32(msg, RDMA_NLDEV_ATTR_LID, attr.lid))
+		return -EMSGSIZE;
+	if (nla_put_u32(msg, RDMA_NLDEV_ATTR_SM_LID, attr.sm_lid))
+		return -EMSGSIZE;
 	return 0;
 }

diff --git a/include/uapi/rdma/rdma_netlink.h b/include/uapi/rdma/rdma_netlink.h
index 5fec88038e6e..22e4870f2e31 100644
--- a/include/uapi/rdma/rdma_netlink.h
+++ b/include/uapi/rdma/rdma_netlink.h
@@ -284,6 +284,14 @@ enum rdma_nldev_attr {
 	 */
 	RDMA_NLDEV_ATTR_SUBNET_PREFIX,		/* u64 */

+	/*
+	 * Local Identifier (LID),
+	 * According to IB specification, It is 16-bit address assigned
+	 * by the Subnet Manager. Extended to be 32-bit for OmniPath users.
+	 */
+	RDMA_NLDEV_ATTR_LID,			/* u32 */
+	RDMA_NLDEV_ATTR_SM_LID,			/* u32 */
+
 	RDMA_NLDEV_ATTR_MAX
 };
 #endif /* _UAPI_RDMA_NETLINK_H */
--
2.13.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2017-06-28 13:34 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-28 13:34 [PATCH rdma-next 0/4] Another round of exported properties for RDMAtool Leon Romanovsky
     [not found] ` <20170628133445.16550-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-06-28 13:34   ` [PATCH rdma-next 1/4] RDMA/netlink: Export guid and sys_image_guid Leon Romanovsky
     [not found]     ` <20170628133445.16550-2-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-06-28 16:00       ` Jason Gunthorpe
     [not found]         ` <20170628160025.GA14375-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-06-28 16:12           ` Leon Romanovsky
2017-06-28 13:34   ` [PATCH rdma-next 2/4] RDMA/netlink: Advertise IB subnet prefix Leon Romanovsky
     [not found]     ` <20170628133445.16550-3-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-06-28 16:02       ` Jason Gunthorpe
     [not found]         ` <20170628160251.GB14375-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-06-28 16:10           ` Leon Romanovsky
     [not found]             ` <20170628161020.GI1248-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-06-28 16:12               ` Jason Gunthorpe
     [not found]                 ` <20170628161236.GC28839-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-06-28 16:21                   ` Leon Romanovsky
2017-06-28 13:34   ` Leon Romanovsky [this message]
     [not found]     ` <20170628133445.16550-4-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-06-28 16:05       ` [PATCH rdma-next 3/4] RDMA/netink: Export lids and sm_lids Jason Gunthorpe
     [not found]         ` <20170628160513.GC14375-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-06-28 16:16           ` Leon Romanovsky
     [not found]             ` <20170628161616.GK1248-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-06-28 16:19               ` Jason Gunthorpe
     [not found]                 ` <20170628161903.GA28996-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-06-28 16:24                   ` Leon Romanovsky
2017-06-28 13:34   ` [PATCH rdma-next 4/4] RDMA/netlink: Export LID mask counter (LMC) 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=20170628133445.16550-4-leon@kernel.org \
    --to=leon-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
    --cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.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.