diff mbox

[rdma-next,V2,25/27] RDMA/netlink: Export LID mask counter (LMC)

Message ID 20170703062830.30361-26-leon@kernel.org
State Not Applicable, archived
Delegated to: David Miller
Headers show

Commit Message

Leon Romanovsky July 3, 2017, 6:28 a.m. UTC
From: Leon Romanovsky <leonro@mellanox.com>

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

Comments

Dennis Dalessandro July 17, 2017, 3:14 p.m. UTC | #1
On 7/3/2017 2:28 AM, Leon Romanovsky wrote:
> From: Leon Romanovsky <leonro@mellanox.com>
> 
> Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
> ---
>   drivers/infiniband/core/nldev.c  | 3 +++
>   include/uapi/rdma/rdma_netlink.h | 5 +++++
>   2 files changed, 8 insertions(+)
> 
> diff --git a/drivers/infiniband/core/nldev.c b/drivers/infiniband/core/nldev.c
> index ce733bf33ed9..f968a40ef5d3 100644
> --- a/drivers/infiniband/core/nldev.c
> +++ b/drivers/infiniband/core/nldev.c
> @@ -47,6 +47,7 @@ static const struct nla_policy nldev_policy[RDMA_NLDEV_ATTR_MAX] = {
>   	[RDMA_NLDEV_ATTR_SUBNET_PREFIX]	= { .type = NLA_U64 },
>   	[RDMA_NLDEV_ATTR_LID]		= { .type = NLA_U32 },
>   	[RDMA_NLDEV_ATTR_SM_LID]	= { .type = NLA_U32 },
> +	[RDMA_NLDEV_ATTR_LMC]		= { .type = NLA_U8 },
>   };
>   
>   static int fill_dev_info(struct sk_buff *msg, struct ib_device *device)
> @@ -109,6 +110,8 @@ static int fill_port_info(struct sk_buff *msg,
>   			return -EMSGSIZE;
>   		if (nla_put_u32(msg, RDMA_NLDEV_ATTR_SM_LID, attr.sm_lid))
>   			return -EMSGSIZE;
> +		if (nla_put_u8(msg, RDMA_NLDEV_ATTR_LMC, attr.lmc))
> +			return -EMSGSIZE;
>   	}
>   	return 0;
>   }
> diff --git a/include/uapi/rdma/rdma_netlink.h b/include/uapi/rdma/rdma_netlink.h
> index 82e0d64346e1..d4b862e8ed15 100644
> --- a/include/uapi/rdma/rdma_netlink.h
> +++ b/include/uapi/rdma/rdma_netlink.h
> @@ -292,6 +292,11 @@ enum rdma_nldev_attr {
>   	RDMA_NLDEV_ATTR_LID,			/* u32 */
>   	RDMA_NLDEV_ATTR_SM_LID,			/* u32 */
>   
> +	/*
> +	 * LID mask count (LMC)
> +	 */
> +	RDMA_NLDEV_ATTR_LMC,			/* u8 */
> +
>   	RDMA_NLDEV_ATTR_MAX
>   };
>   #endif /* _UAPI_RDMA_NETLINK_H */
> 

LMC = "Counter" or "Control"? I always thought it was the latter.

-Denny
Leon Romanovsky July 17, 2017, 6:32 p.m. UTC | #2
On Mon, Jul 17, 2017 at 11:14:28AM -0400, Dennis Dalessandro wrote:
> On 7/3/2017 2:28 AM, Leon Romanovsky wrote:
> > From: Leon Romanovsky <leonro@mellanox.com>
> >
> > Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
> > ---
> >   drivers/infiniband/core/nldev.c  | 3 +++
> >   include/uapi/rdma/rdma_netlink.h | 5 +++++
> >   2 files changed, 8 insertions(+)
> >
> > diff --git a/drivers/infiniband/core/nldev.c b/drivers/infiniband/core/nldev.c
> > index ce733bf33ed9..f968a40ef5d3 100644
> > --- a/drivers/infiniband/core/nldev.c
> > +++ b/drivers/infiniband/core/nldev.c
> > @@ -47,6 +47,7 @@ static const struct nla_policy nldev_policy[RDMA_NLDEV_ATTR_MAX] = {
> >   	[RDMA_NLDEV_ATTR_SUBNET_PREFIX]	= { .type = NLA_U64 },
> >   	[RDMA_NLDEV_ATTR_LID]		= { .type = NLA_U32 },
> >   	[RDMA_NLDEV_ATTR_SM_LID]	= { .type = NLA_U32 },
> > +	[RDMA_NLDEV_ATTR_LMC]		= { .type = NLA_U8 },
> >   };
> >   static int fill_dev_info(struct sk_buff *msg, struct ib_device *device)
> > @@ -109,6 +110,8 @@ static int fill_port_info(struct sk_buff *msg,
> >   			return -EMSGSIZE;
> >   		if (nla_put_u32(msg, RDMA_NLDEV_ATTR_SM_LID, attr.sm_lid))
> >   			return -EMSGSIZE;
> > +		if (nla_put_u8(msg, RDMA_NLDEV_ATTR_LMC, attr.lmc))
> > +			return -EMSGSIZE;
> >   	}
> >   	return 0;
> >   }
> > diff --git a/include/uapi/rdma/rdma_netlink.h b/include/uapi/rdma/rdma_netlink.h
> > index 82e0d64346e1..d4b862e8ed15 100644
> > --- a/include/uapi/rdma/rdma_netlink.h
> > +++ b/include/uapi/rdma/rdma_netlink.h
> > @@ -292,6 +292,11 @@ enum rdma_nldev_attr {
> >   	RDMA_NLDEV_ATTR_LID,			/* u32 */
> >   	RDMA_NLDEV_ATTR_SM_LID,			/* u32 */
> > +	/*
> > +	 * LID mask count (LMC)
> > +	 */
> > +	RDMA_NLDEV_ATTR_LMC,			/* u8 */
> > +
> >   	RDMA_NLDEV_ATTR_MAX
> >   };
> >   #endif /* _UAPI_RDMA_NETLINK_H */
> >
>
> LMC = "Counter" or "Control"? I always thought it was the latter.

You are right, it is control.
From spec:
LID Mask Control - A per-port value assigned by the Subnet Manager. The value of the LMC
specifies the number of Path Bits in the Local Identifier.

I don't know why I called it "counter".

It is wrong comment and not something else, so I'll wait till Doug's branches will be ready and send fix after that.

Thanks

>
> -Denny
diff mbox

Patch

diff --git a/drivers/infiniband/core/nldev.c b/drivers/infiniband/core/nldev.c
index ce733bf33ed9..f968a40ef5d3 100644
--- a/drivers/infiniband/core/nldev.c
+++ b/drivers/infiniband/core/nldev.c
@@ -47,6 +47,7 @@  static const struct nla_policy nldev_policy[RDMA_NLDEV_ATTR_MAX] = {
 	[RDMA_NLDEV_ATTR_SUBNET_PREFIX]	= { .type = NLA_U64 },
 	[RDMA_NLDEV_ATTR_LID]		= { .type = NLA_U32 },
 	[RDMA_NLDEV_ATTR_SM_LID]	= { .type = NLA_U32 },
+	[RDMA_NLDEV_ATTR_LMC]		= { .type = NLA_U8 },
 };
 
 static int fill_dev_info(struct sk_buff *msg, struct ib_device *device)
@@ -109,6 +110,8 @@  static int fill_port_info(struct sk_buff *msg,
 			return -EMSGSIZE;
 		if (nla_put_u32(msg, RDMA_NLDEV_ATTR_SM_LID, attr.sm_lid))
 			return -EMSGSIZE;
+		if (nla_put_u8(msg, RDMA_NLDEV_ATTR_LMC, attr.lmc))
+			return -EMSGSIZE;
 	}
 	return 0;
 }
diff --git a/include/uapi/rdma/rdma_netlink.h b/include/uapi/rdma/rdma_netlink.h
index 82e0d64346e1..d4b862e8ed15 100644
--- a/include/uapi/rdma/rdma_netlink.h
+++ b/include/uapi/rdma/rdma_netlink.h
@@ -292,6 +292,11 @@  enum rdma_nldev_attr {
 	RDMA_NLDEV_ATTR_LID,			/* u32 */
 	RDMA_NLDEV_ATTR_SM_LID,			/* u32 */
 
+	/*
+	 * LID mask count (LMC)
+	 */
+	RDMA_NLDEV_ATTR_LMC,			/* u8 */
+
 	RDMA_NLDEV_ATTR_MAX
 };
 #endif /* _UAPI_RDMA_NETLINK_H */