All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH rdma-next 00/19] RDMA Netlink Device Client
@ 2017-06-21  6:05 Leon Romanovsky
  2017-06-21  6:05 ` [PATCH rdma-next 02/19] RDMA/netlink: Simplify the put_msg and put_attr Leon Romanovsky
                   ` (14 more replies)
  0 siblings, 15 replies; 69+ messages in thread
From: Leon Romanovsky @ 2017-06-21  6:05 UTC (permalink / raw)
  To: Doug Ledford
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Chien Tin Tung, Steve Wise,
	Stephen Hemminger, Jiri Pirko, Ariel Almog, Linux Netdev

The following patch set is an implementation of NLDEV - RDMA netlink
device client. It is based on the already sent patch [1] and patch set [2].

This client is needed to properly integrate coming RDMAtool [3]
into iproute2 package which is based on netlink.

The following patch set can be logically divided into three parts:
 * Cleanup of RDMA netlink interface to handle dumpit/doit callbacks.
 * NLDEV initial implementation
 * Exposing device and capability masks via this interface

The supplementary user space part will follow later or.

Thanks

[1] "Revert "IB/core: Add flow control to the portmapper netlink calls""
     https://patchwork.kernel.org/patch/9752865/

[2] [PATCH rdma-next V2 0/5] Refactor RDMA netlink infrastructure
    https://www.spinics.net/lists/linux-rdma/msg50945.html

[3] [RFC iproute2 0/8] RDMA tool
    https://www.spinics.net/lists/linux-rdma/msg49575.html

Available in the "topic/rdma-netlink" topic branch of this git repo:
git://git.kernel.org/pub/scm/linux/kernel/git/leon/linux-rdma.git

Or for browsing:
https://git.kernel.org/cgit/linux/kernel/git/leon/linux-rdma.git/log/?h=topic/rdma-netlink

CC: Chien Tin Tung <chien.tin.tung-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
CC: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
CC: Stephen Hemminger <stephen-OTpzqLSitTUnbdJkjeBofR2eb7JE58TQ@public.gmane.org>
CC: Jiri Pirko <jiri-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
CC: Ariel Almog <ariela-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
CC: Linux RDMA <linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
CC: Linux Netdev <netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>

Leon Romanovsky (19):
  RDMA/netlink: Add flag to consolidate common handing
  RDMA/netlink: Simplify the put_msg and put_attr
  RDMA/netlink: Rename and remove redundant parameter from ibnl_unicast
  RDMA/netlink: Rename and remove redundant parameter from
    ibnl_multicast
  RDMA/netlink: Simplify and rename ibnl_chk_listeners
  RDMA/netlink: Rename netlink callback struct
  RDMA/core: Add iterator over ib_devices
  RDMA/core: Expose translation from device name to ib_device
  RDMA/netlink: Add and implement doit netlink callback
  RDMA/netlink: Reduce indirection access to cb_table
  RDMA/netlink: Convert LS to doit callback
  RDMA/netlink: Update copyright
  RDMA/netlink: Add netlink device definitions to UAPI
  RDMA/netlink: Add nldev initialization flows
  RDMA/netlink: Implement nldev device dumpit calback
  RDMa/netlink: Add nldev device doit implementation
  RDMA/netlink: Add nldev port dumpit implementation
  RDMA/netlink: Implement nldev port doit callback
  RDMA/netlink: Expose device and port capability masks

 drivers/infiniband/core/Makefile    |   4 +-
 drivers/infiniband/core/addr.c      |  12 +-
 drivers/infiniband/core/cma.c       |   2 +-
 drivers/infiniband/core/core_priv.h |  22 ++-
 drivers/infiniband/core/device.c    |  44 +++++-
 drivers/infiniband/core/iwcm.c      |   2 +-
 drivers/infiniband/core/iwpm_msg.c  |   8 +-
 drivers/infiniband/core/iwpm_util.c |   4 +-
 drivers/infiniband/core/netlink.c   |  98 ++++++-------
 drivers/infiniband/core/nldev.c     | 268 ++++++++++++++++++++++++++++++++++++
 drivers/infiniband/core/sa_query.c  |  18 ++-
 include/rdma/rdma_netlink.h         |  22 +--
 include/uapi/rdma/rdma_netlink.h    |  47 +++++++
 13 files changed, 454 insertions(+), 97 deletions(-)
 create mode 100644 drivers/infiniband/core/nldev.c

--
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

^ permalink raw reply	[flat|nested] 69+ messages in thread

* [PATCH rdma-next 01/19] RDMA/netlink: Add flag to consolidate common handing
       [not found] ` <20170621060528.3752-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
@ 2017-06-21  6:05   ` Leon Romanovsky
       [not found]     ` <20170621060528.3752-2-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
  2017-06-21  6:05   ` [PATCH rdma-next 04/19] RDMA/netlink: Rename and remove redundant parameter from ibnl_multicast Leon Romanovsky
                     ` (3 subsequent siblings)
  4 siblings, 1 reply; 69+ messages in thread
From: Leon Romanovsky @ 2017-06-21  6:05 UTC (permalink / raw)
  To: Doug Ledford
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Chien Tin Tung, Steve Wise,
	Stephen Hemminger, Jiri Pirko, Ariel Almog, Linux Netdev,
	Leon Romanovsky

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

Add ability to provide flags to control RDMA netlink callbacks
and convert addr.c and sa_query.c to be first users of such
infrastructure. It allows to move their CAP_NET_ADMIN checks
into netlink core.

Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
 drivers/infiniband/core/addr.c     |  3 +--
 drivers/infiniband/core/device.c   | 12 +++++++++---
 drivers/infiniband/core/netlink.c  |  4 ++++
 drivers/infiniband/core/sa_query.c |  6 ++----
 include/rdma/rdma_netlink.h        |  6 ++++++
 5 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c
index 02971e239a18..134d8394fca5 100644
--- a/drivers/infiniband/core/addr.c
+++ b/drivers/infiniband/core/addr.c
@@ -134,8 +134,7 @@ int ib_nl_handle_ip_res_resp(struct sk_buff *skb,
 	const struct nlmsghdr *nlh = (struct nlmsghdr *)cb->nlh;
 
 	if ((nlh->nlmsg_flags & NLM_F_REQUEST) ||
-	    !(NETLINK_CB(skb).sk) ||
-	    !netlink_capable(skb, CAP_NET_ADMIN))
+	    !(NETLINK_CB(skb).sk))
 		return -EPERM;
 
 	if (ib_nl_is_good_ip_resp(nlh))
diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
index 5c70ea49d5ad..2001dabd1444 100644
--- a/drivers/infiniband/core/device.c
+++ b/drivers/infiniband/core/device.c
@@ -1010,11 +1010,17 @@ EXPORT_SYMBOL(ib_get_net_dev_by_params);
 
 static const struct ibnl_client_cbs ibnl_ls_cb_table[] = {
 	[RDMA_NL_LS_OP_RESOLVE] = {
-		.dump = ib_nl_handle_resolve_resp},
+		.dump = ib_nl_handle_resolve_resp,
+		.flags = RDMA_NL_ADMIN_PERM,
+	},
 	[RDMA_NL_LS_OP_SET_TIMEOUT] = {
-		.dump = ib_nl_handle_set_timeout},
+		.dump = ib_nl_handle_set_timeout,
+		.flags = RDMA_NL_ADMIN_PERM,
+	},
 	[RDMA_NL_LS_OP_IP_RESOLVE] = {
-		.dump = ib_nl_handle_ip_res_resp},
+		.dump = ib_nl_handle_ip_res_resp,
+		.flags = RDMA_NL_ADMIN_PERM,
+	},
 };
 
 static int __init ib_core_init(void)
diff --git a/drivers/infiniband/core/netlink.c b/drivers/infiniband/core/netlink.c
index 4fa6746a62b1..f0d482009c69 100644
--- a/drivers/infiniband/core/netlink.c
+++ b/drivers/infiniband/core/netlink.c
@@ -171,6 +171,10 @@ static int rdma_nl_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh,
 	if (!is_nl_valid(index, op))
 		return -EINVAL;
 
+	if ((rdma_nl_types[index].cb_table[op].flags & RDMA_NL_ADMIN_PERM) &&
+	    !netlink_capable(skb, CAP_NET_ADMIN))
+		return -EPERM;
+
 	/*
 	 * For response or local service set_timeout request,
 	 * there is no need to use netlink_dump_start.
diff --git a/drivers/infiniband/core/sa_query.c b/drivers/infiniband/core/sa_query.c
index e335b09c022e..6e39a763b220 100644
--- a/drivers/infiniband/core/sa_query.c
+++ b/drivers/infiniband/core/sa_query.c
@@ -1034,8 +1034,7 @@ int ib_nl_handle_set_timeout(struct sk_buff *skb,
 	int ret;
 
 	if (!(nlh->nlmsg_flags & NLM_F_REQUEST) ||
-	    !(NETLINK_CB(skb).sk) ||
-	    !netlink_capable(skb, CAP_NET_ADMIN))
+	    !(NETLINK_CB(skb).sk))
 		return -EPERM;
 
 	ret = nla_parse(tb, LS_NLA_TYPE_MAX - 1, nlmsg_data(nlh),
@@ -1110,8 +1109,7 @@ int ib_nl_handle_resolve_resp(struct sk_buff *skb,
 	int ret;
 
 	if ((nlh->nlmsg_flags & NLM_F_REQUEST) ||
-	    !(NETLINK_CB(skb).sk) ||
-	    !netlink_capable(skb, CAP_NET_ADMIN))
+	    !(NETLINK_CB(skb).sk))
 		return -EPERM;
 
 	spin_lock_irqsave(&ib_nl_request_lock, flags);
diff --git a/include/rdma/rdma_netlink.h b/include/rdma/rdma_netlink.h
index 761517105a36..6932b7acd3a6 100644
--- a/include/rdma/rdma_netlink.h
+++ b/include/rdma/rdma_netlink.h
@@ -7,6 +7,12 @@
 
 struct ibnl_client_cbs {
 	int (*dump)(struct sk_buff *skb, struct netlink_callback *nlcb);
+	u8 flags;
+};
+
+enum rdma_nl_flags {
+	/* Require CAP_NET_ADMIN */
+	RDMA_NL_ADMIN_PERM	= 1 << 0,
 };
 
 int rdma_nl_init(void);
-- 
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

^ permalink raw reply related	[flat|nested] 69+ messages in thread

* [PATCH rdma-next 02/19] RDMA/netlink: Simplify the put_msg and put_attr
  2017-06-21  6:05 [PATCH rdma-next 00/19] RDMA Netlink Device Client Leon Romanovsky
@ 2017-06-21  6:05 ` Leon Romanovsky
  2017-06-21 14:01     ` Steve Wise
  2017-06-21  6:05 ` [PATCH rdma-next 03/19] RDMA/netlink: Rename and remove redundant parameter from ibnl_unicast Leon Romanovsky
                   ` (13 subsequent siblings)
  14 siblings, 1 reply; 69+ messages in thread
From: Leon Romanovsky @ 2017-06-21  6:05 UTC (permalink / raw)
  To: Doug Ledford
  Cc: linux-rdma, Chien Tin Tung, Steve Wise, Stephen Hemminger,
	Jiri Pirko, Ariel Almog, Linux Netdev, Leon Romanovsky

From: Leon Romanovsky <leonro@mellanox.com>

Reuse standard macros to cancel the netlink message
in case of error.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
 drivers/infiniband/core/netlink.c | 31 +++++++++----------------------
 1 file changed, 9 insertions(+), 22 deletions(-)

diff --git a/drivers/infiniband/core/netlink.c b/drivers/infiniband/core/netlink.c
index f0d482009c69..96057e722123 100644
--- a/drivers/infiniband/core/netlink.c
+++ b/drivers/infiniband/core/netlink.c
@@ -126,36 +126,23 @@ EXPORT_SYMBOL(rdma_nl_unregister);
 void *ibnl_put_msg(struct sk_buff *skb, struct nlmsghdr **nlh, int seq,
 		   int len, int client, int op, int flags)
 {
-	unsigned char *prev_tail;
-
-	prev_tail = skb_tail_pointer(skb);
-	*nlh = nlmsg_put(skb, 0, seq, RDMA_NL_GET_TYPE(client, op),
-			 len, flags);
-	if (!*nlh)
-		goto out_nlmsg_trim;
-	(*nlh)->nlmsg_len = skb_tail_pointer(skb) - prev_tail;
+	*nlh = nlmsg_put(skb, 0, seq, RDMA_NL_GET_TYPE(client, op), len, flags);
+	if (!*nlh) {
+		nlmsg_cancel(skb, *nlh);
+		return NULL;
+	}
 	return nlmsg_data(*nlh);
-
-out_nlmsg_trim:
-	nlmsg_trim(skb, prev_tail);
-	return NULL;
 }
 EXPORT_SYMBOL(ibnl_put_msg);
 
 int ibnl_put_attr(struct sk_buff *skb, struct nlmsghdr *nlh,
 		  int len, void *data, int type)
 {
-	unsigned char *prev_tail;
-
-	prev_tail = skb_tail_pointer(skb);
-	if (nla_put(skb, type, len, data))
-		goto nla_put_failure;
-	nlh->nlmsg_len += skb_tail_pointer(skb) - prev_tail;
+	if (nla_put(skb, type, len, data)) {
+		nlmsg_cancel(skb, nlh);
+		return -EMSGSIZE;
+	}
 	return 0;
-
-nla_put_failure:
-	nlmsg_trim(skb, prev_tail - nlh->nlmsg_len);
-	return -EMSGSIZE;
 }
 EXPORT_SYMBOL(ibnl_put_attr);
 
-- 
2.13.1

^ permalink raw reply related	[flat|nested] 69+ messages in thread

* [PATCH rdma-next 03/19] RDMA/netlink: Rename and remove redundant parameter from ibnl_unicast
  2017-06-21  6:05 [PATCH rdma-next 00/19] RDMA Netlink Device Client Leon Romanovsky
  2017-06-21  6:05 ` [PATCH rdma-next 02/19] RDMA/netlink: Simplify the put_msg and put_attr Leon Romanovsky
@ 2017-06-21  6:05 ` Leon Romanovsky
  2017-06-21 14:01     ` Steve Wise
  2017-06-21  6:05 ` [PATCH rdma-next 05/19] RDMA/netlink: Simplify and rename ibnl_chk_listeners Leon Romanovsky
                   ` (12 subsequent siblings)
  14 siblings, 1 reply; 69+ messages in thread
From: Leon Romanovsky @ 2017-06-21  6:05 UTC (permalink / raw)
  To: Doug Ledford
  Cc: linux-rdma, Chien Tin Tung, Steve Wise, Stephen Hemminger,
	Jiri Pirko, Ariel Almog, Linux Netdev, Leon Romanovsky

From: Leon Romanovsky <leonro@mellanox.com>

Netlink message header is not needed for unicast reply, hence remove it.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
 drivers/infiniband/core/iwpm_msg.c  | 6 +++---
 drivers/infiniband/core/iwpm_util.c | 4 ++--
 drivers/infiniband/core/netlink.c   | 5 ++---
 include/rdma/rdma_netlink.h         | 4 +---
 4 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/drivers/infiniband/core/iwpm_msg.c b/drivers/infiniband/core/iwpm_msg.c
index 1fab707b1f68..8f84557d04e3 100644
--- a/drivers/infiniband/core/iwpm_msg.c
+++ b/drivers/infiniband/core/iwpm_msg.c
@@ -172,7 +172,7 @@ int iwpm_add_mapping(struct iwpm_sa_data *pm_msg, u8 nl_client)
 		goto add_mapping_error;
 	nlmsg_request->req_buffer = pm_msg;
 
-	ret = ibnl_unicast(skb, nlh, iwpm_user_pid);
+	ret = rdma_nl_unicast(skb, iwpm_user_pid);
 	if (ret) {
 		skb = NULL; /* skb is freed in the netlink send-op handling */
 		iwpm_user_pid = IWPM_PID_UNDEFINED;
@@ -248,7 +248,7 @@ int iwpm_add_and_query_mapping(struct iwpm_sa_data *pm_msg, u8 nl_client)
 		goto query_mapping_error;
 	nlmsg_request->req_buffer = pm_msg;
 
-	ret = ibnl_unicast(skb, nlh, iwpm_user_pid);
+	ret = rdma_nl_unicast(skb, iwpm_user_pid);
 	if (ret) {
 		skb = NULL; /* skb is freed in the netlink send-op handling */
 		err_str = "Unable to send a nlmsg";
@@ -308,7 +308,7 @@ int iwpm_remove_mapping(struct sockaddr_storage *local_addr, u8 nl_client)
 	if (ret)
 		goto remove_mapping_error;
 
-	ret = ibnl_unicast(skb, nlh, iwpm_user_pid);
+	ret = rdma_nl_unicast(skb, iwpm_user_pid);
 	if (ret) {
 		skb = NULL; /* skb is freed in the netlink send-op handling */
 		iwpm_user_pid = IWPM_PID_UNDEFINED;
diff --git a/drivers/infiniband/core/iwpm_util.c b/drivers/infiniband/core/iwpm_util.c
index c46442ac71a2..c81c55942626 100644
--- a/drivers/infiniband/core/iwpm_util.c
+++ b/drivers/infiniband/core/iwpm_util.c
@@ -597,7 +597,7 @@ static int send_mapinfo_num(u32 mapping_num, u8 nl_client, int iwpm_pid)
 				&mapping_num, IWPM_NLA_MAPINFO_SEND_NUM);
 	if (ret)
 		goto mapinfo_num_error;
-	ret = ibnl_unicast(skb, nlh, iwpm_pid);
+	ret = rdma_nl_unicast(skb, iwpm_pid);
 	if (ret) {
 		skb = NULL;
 		err_str = "Unable to send a nlmsg";
@@ -626,7 +626,7 @@ static int send_nlmsg_done(struct sk_buff *skb, u8 nl_client, int iwpm_pid)
 		return -ENOMEM;
 	}
 	nlh->nlmsg_type = NLMSG_DONE;
-	ret = ibnl_unicast(skb, (struct nlmsghdr *)skb->data, iwpm_pid);
+	ret = rdma_nl_unicast(skb, iwpm_pid);
 	if (ret)
 		pr_warn("%s Unable to send a nlmsg\n", __func__);
 	return ret;
diff --git a/drivers/infiniband/core/netlink.c b/drivers/infiniband/core/netlink.c
index 96057e722123..cd29311078b5 100644
--- a/drivers/infiniband/core/netlink.c
+++ b/drivers/infiniband/core/netlink.c
@@ -241,12 +241,11 @@ static void rdma_nl_rcv(struct sk_buff *skb)
 	mutex_unlock(&rdma_nl_mutex);
 }
 
-int ibnl_unicast(struct sk_buff *skb, struct nlmsghdr *nlh,
-			__u32 pid)
+int rdma_nl_unicast(struct sk_buff *skb, u32 pid)
 {
 	return nlmsg_unicast(nls, skb, pid);
 }
-EXPORT_SYMBOL(ibnl_unicast);
+EXPORT_SYMBOL(rdma_nl_unicast);
 
 int ibnl_multicast(struct sk_buff *skb, struct nlmsghdr *nlh,
 			unsigned int group, gfp_t flags)
diff --git a/include/rdma/rdma_netlink.h b/include/rdma/rdma_netlink.h
index 6932b7acd3a6..9779cd5520d7 100644
--- a/include/rdma/rdma_netlink.h
+++ b/include/rdma/rdma_netlink.h
@@ -59,12 +59,10 @@ int ibnl_put_attr(struct sk_buff *skb, struct nlmsghdr *nlh,
 /**
  * Send the supplied skb to a specific userspace PID.
  * @skb: The netlink skb
- * @nlh: Header of the netlink message to send
  * @pid: Userspace netlink process ID
  * Returns 0 on success or a negative error code.
  */
-int ibnl_unicast(struct sk_buff *skb, struct nlmsghdr *nlh,
-			__u32 pid);
+int rdma_nl_unicast(struct sk_buff *skb, u32 pid);
 
 /**
  * Send the supplied skb to a netlink group.
-- 
2.13.1

^ permalink raw reply related	[flat|nested] 69+ messages in thread

* [PATCH rdma-next 04/19] RDMA/netlink: Rename and remove redundant parameter from ibnl_multicast
       [not found] ` <20170621060528.3752-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
  2017-06-21  6:05   ` [PATCH rdma-next 01/19] RDMA/netlink: Add flag to consolidate common handing Leon Romanovsky
@ 2017-06-21  6:05   ` Leon Romanovsky
       [not found]     ` <20170621060528.3752-5-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
  2017-06-21  6:05   ` [PATCH rdma-next 06/19] RDMA/netlink: Rename netlink callback struct Leon Romanovsky
                     ` (2 subsequent siblings)
  4 siblings, 1 reply; 69+ messages in thread
From: Leon Romanovsky @ 2017-06-21  6:05 UTC (permalink / raw)
  To: Doug Ledford
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Chien Tin Tung, Steve Wise,
	Stephen Hemminger, Jiri Pirko, Ariel Almog, Linux Netdev,
	Leon Romanovsky

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

The pointer to netlink header was not used in the ibnl_multicast
function, so let's remove it and simplify the function
signature.

Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
 drivers/infiniband/core/addr.c     | 2 +-
 drivers/infiniband/core/iwpm_msg.c | 2 +-
 drivers/infiniband/core/netlink.c  | 5 ++---
 drivers/infiniband/core/sa_query.c | 2 +-
 include/rdma/rdma_netlink.h        | 4 +---
 5 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c
index 134d8394fca5..ebd0242bab3d 100644
--- a/drivers/infiniband/core/addr.c
+++ b/drivers/infiniband/core/addr.c
@@ -185,7 +185,7 @@ static int ib_nl_ip_send_msg(struct rdma_dev_addr *dev_addr,
 
 	/* Repair the nlmsg header length */
 	nlmsg_end(skb, nlh);
-	ibnl_multicast(skb, nlh, RDMA_NL_GROUP_LS, GFP_KERNEL);
+	rdma_nl_multicast(skb, RDMA_NL_GROUP_LS, GFP_KERNEL);
 
 	/* Make the request retry, so when we get the response from userspace
 	 * we will have something.
diff --git a/drivers/infiniband/core/iwpm_msg.c b/drivers/infiniband/core/iwpm_msg.c
index 8f84557d04e3..561f312ea35a 100644
--- a/drivers/infiniband/core/iwpm_msg.c
+++ b/drivers/infiniband/core/iwpm_msg.c
@@ -103,7 +103,7 @@ int iwpm_register_pid(struct iwpm_dev_data *pm_msg, u8 nl_client)
 	pr_debug("%s: Multicasting a nlmsg (dev = %s ifname = %s iwpm = %s)\n",
 		__func__, pm_msg->dev_name, pm_msg->if_name, iwpm_ulib_name);
 
-	ret = ibnl_multicast(skb, nlh, RDMA_NL_GROUP_IWPM, GFP_KERNEL);
+	ret = rdma_nl_multicast(skb, RDMA_NL_GROUP_IWPM, GFP_KERNEL);
 	if (ret) {
 		skb = NULL; /* skb is freed in the netlink send-op handling */
 		iwpm_user_pid = IWPM_PID_UNAVAILABLE;
diff --git a/drivers/infiniband/core/netlink.c b/drivers/infiniband/core/netlink.c
index cd29311078b5..89a6219b6ec8 100644
--- a/drivers/infiniband/core/netlink.c
+++ b/drivers/infiniband/core/netlink.c
@@ -247,12 +247,11 @@ int rdma_nl_unicast(struct sk_buff *skb, u32 pid)
 }
 EXPORT_SYMBOL(rdma_nl_unicast);
 
-int ibnl_multicast(struct sk_buff *skb, struct nlmsghdr *nlh,
-			unsigned int group, gfp_t flags)
+int rdma_nl_multicast(struct sk_buff *skb, unsigned int group, gfp_t flags)
 {
 	return nlmsg_multicast(nls, skb, 0, group, flags);
 }
-EXPORT_SYMBOL(ibnl_multicast);
+EXPORT_SYMBOL(rdma_nl_multicast);
 
 int __init rdma_nl_init(void)
 {
diff --git a/drivers/infiniband/core/sa_query.c b/drivers/infiniband/core/sa_query.c
index 6e39a763b220..d890600f1e2d 100644
--- a/drivers/infiniband/core/sa_query.c
+++ b/drivers/infiniband/core/sa_query.c
@@ -862,7 +862,7 @@ static int ib_nl_send_msg(struct ib_sa_query *query, gfp_t gfp_mask)
 	/* Repair the nlmsg header length */
 	nlmsg_end(skb, nlh);
 
-	ret = ibnl_multicast(skb, nlh, RDMA_NL_GROUP_LS, gfp_mask);
+	ret = rdma_nl_multicast(skb, RDMA_NL_GROUP_LS, gfp_mask);
 	if (!ret)
 		ret = len;
 	else
diff --git a/include/rdma/rdma_netlink.h b/include/rdma/rdma_netlink.h
index 9779cd5520d7..145283896417 100644
--- a/include/rdma/rdma_netlink.h
+++ b/include/rdma/rdma_netlink.h
@@ -67,13 +67,11 @@ int rdma_nl_unicast(struct sk_buff *skb, u32 pid);
 /**
  * Send the supplied skb to a netlink group.
  * @skb: The netlink skb
- * @nlh: Header of the netlink message to send
  * @group: Netlink group ID
  * @flags: allocation flags
  * Returns 0 on success or a negative error code.
  */
-int ibnl_multicast(struct sk_buff *skb, struct nlmsghdr *nlh,
-			unsigned int group, gfp_t flags);
+int rdma_nl_multicast(struct sk_buff *skb, unsigned int group, gfp_t flags);
 
 /**
  * Check if there are any listeners to the netlink group
-- 
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

^ permalink raw reply related	[flat|nested] 69+ messages in thread

* [PATCH rdma-next 05/19] RDMA/netlink: Simplify and rename ibnl_chk_listeners
  2017-06-21  6:05 [PATCH rdma-next 00/19] RDMA Netlink Device Client Leon Romanovsky
  2017-06-21  6:05 ` [PATCH rdma-next 02/19] RDMA/netlink: Simplify the put_msg and put_attr Leon Romanovsky
  2017-06-21  6:05 ` [PATCH rdma-next 03/19] RDMA/netlink: Rename and remove redundant parameter from ibnl_unicast Leon Romanovsky
@ 2017-06-21  6:05 ` Leon Romanovsky
       [not found]   ` <20170621060528.3752-6-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
  2017-06-21  6:05 ` [PATCH rdma-next 07/19] RDMA/core: Add iterator over ib_devices Leon Romanovsky
                   ` (11 subsequent siblings)
  14 siblings, 1 reply; 69+ messages in thread
From: Leon Romanovsky @ 2017-06-21  6:05 UTC (permalink / raw)
  To: Doug Ledford
  Cc: linux-rdma, Chien Tin Tung, Steve Wise, Stephen Hemminger,
	Jiri Pirko, Ariel Almog, Linux Netdev, Leon Romanovsky

From: Leon Romanovsky <leonro@mellanox.com>

Make ibnl_chk_listeners function to be one line by removing
unneeded comparison.

Rename that function to be complaint to other functions in RDMA netlink.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
 drivers/infiniband/core/addr.c     | 2 +-
 drivers/infiniband/core/netlink.c  | 8 +++-----
 drivers/infiniband/core/sa_query.c | 2 +-
 include/rdma/rdma_netlink.h        | 2 +-
 4 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c
index ebd0242bab3d..2cc23a26ce4f 100644
--- a/drivers/infiniband/core/addr.c
+++ b/drivers/infiniband/core/addr.c
@@ -324,7 +324,7 @@ static void queue_req(struct addr_req *req)
 static int ib_nl_fetch_ha(struct dst_entry *dst, struct rdma_dev_addr *dev_addr,
 			  const void *daddr, u32 seq, u16 family)
 {
-	if (ibnl_chk_listeners(RDMA_NL_GROUP_LS))
+	if (rdma_nl_chk_listeners(RDMA_NL_GROUP_LS))
 		return -EADDRNOTAVAIL;
 
 	/* We fill in what we can, the response will fill the rest */
diff --git a/drivers/infiniband/core/netlink.c b/drivers/infiniband/core/netlink.c
index 89a6219b6ec8..1022ce6628ae 100644
--- a/drivers/infiniband/core/netlink.c
+++ b/drivers/infiniband/core/netlink.c
@@ -46,13 +46,11 @@ static struct {
 	const struct ibnl_client_cbs   *cb_table;
 } rdma_nl_types[RDMA_NL_NUM_CLIENTS];
 
-int ibnl_chk_listeners(unsigned int group)
+int rdma_nl_chk_listeners(unsigned int group)
 {
-	if (netlink_has_listeners(nls, group) == 0)
-		return -1;
-	return 0;
+	return (netlink_has_listeners(nls, group)) ? 0 : -1;
 }
-EXPORT_SYMBOL(ibnl_chk_listeners);
+EXPORT_SYMBOL(rdma_nl_chk_listeners);
 
 static bool is_nl_msg_valid(unsigned int type, unsigned int op)
 {
diff --git a/drivers/infiniband/core/sa_query.c b/drivers/infiniband/core/sa_query.c
index d890600f1e2d..c06b7deea4d2 100644
--- a/drivers/infiniband/core/sa_query.c
+++ b/drivers/infiniband/core/sa_query.c
@@ -1419,7 +1419,7 @@ static int send_mad(struct ib_sa_query *query, int timeout_ms, gfp_t gfp_mask)
 
 	if ((query->flags & IB_SA_ENABLE_LOCAL_SERVICE) &&
 	    (!(query->flags & IB_SA_QUERY_OPA))) {
-		if (!ibnl_chk_listeners(RDMA_NL_GROUP_LS)) {
+		if (!rdma_nl_chk_listeners(RDMA_NL_GROUP_LS)) {
 			if (!ib_nl_make_request(query, gfp_mask))
 				return id;
 		}
diff --git a/include/rdma/rdma_netlink.h b/include/rdma/rdma_netlink.h
index 145283896417..b39e030b3a64 100644
--- a/include/rdma/rdma_netlink.h
+++ b/include/rdma/rdma_netlink.h
@@ -78,6 +78,6 @@ int rdma_nl_multicast(struct sk_buff *skb, unsigned int group, gfp_t flags);
  * @group: the netlink group ID
  * Returns 0 on success or a negative for no listeners.
  */
-int ibnl_chk_listeners(unsigned int group);
+int rdma_nl_chk_listeners(unsigned int group);
 
 #endif /* _RDMA_NETLINK_H */
-- 
2.13.1

^ permalink raw reply related	[flat|nested] 69+ messages in thread

* [PATCH rdma-next 06/19] RDMA/netlink: Rename netlink callback struct
       [not found] ` <20170621060528.3752-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
  2017-06-21  6:05   ` [PATCH rdma-next 01/19] RDMA/netlink: Add flag to consolidate common handing Leon Romanovsky
  2017-06-21  6:05   ` [PATCH rdma-next 04/19] RDMA/netlink: Rename and remove redundant parameter from ibnl_multicast Leon Romanovsky
@ 2017-06-21  6:05   ` Leon Romanovsky
  2017-06-21 14:04       ` Steve Wise
  2017-06-21  6:05   ` [PATCH rdma-next 09/19] RDMA/netlink: Add and implement doit netlink callback Leon Romanovsky
  2017-06-21  6:05   ` [PATCH rdma-next 13/19] RDMA/netlink: Add netlink device definitions to UAPI Leon Romanovsky
  4 siblings, 1 reply; 69+ messages in thread
From: Leon Romanovsky @ 2017-06-21  6:05 UTC (permalink / raw)
  To: Doug Ledford
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Chien Tin Tung, Steve Wise,
	Stephen Hemminger, Jiri Pirko, Ariel Almog, Linux Netdev,
	Leon Romanovsky

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

The RDMA netlink client infrastructure was removed and made
obsolete the old name (ibnl_client_cbs). This patch renames
to the more appropriate name (rdma_nl_cbs).

Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
 drivers/infiniband/core/cma.c     | 2 +-
 drivers/infiniband/core/device.c  | 2 +-
 drivers/infiniband/core/iwcm.c    | 2 +-
 drivers/infiniband/core/netlink.c | 4 ++--
 include/rdma/rdma_netlink.h       | 4 ++--
 5 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index a4013b0908e2..2af30a19b926 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -4477,7 +4477,7 @@ static int cma_get_id_stats(struct sk_buff *skb, struct netlink_callback *cb)
 	return skb->len;
 }
 
-static const struct ibnl_client_cbs cma_cb_table[] = {
+static const struct rdma_nl_cbs cma_cb_table[] = {
 	[RDMA_NL_RDMA_CM_ID_STATS] = { .dump = cma_get_id_stats},
 };
 
diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
index 2001dabd1444..5326dcc6ede7 100644
--- a/drivers/infiniband/core/device.c
+++ b/drivers/infiniband/core/device.c
@@ -1008,7 +1008,7 @@ struct net_device *ib_get_net_dev_by_params(struct ib_device *dev,
 }
 EXPORT_SYMBOL(ib_get_net_dev_by_params);
 
-static const struct ibnl_client_cbs ibnl_ls_cb_table[] = {
+static const struct rdma_nl_cbs ibnl_ls_cb_table[] = {
 	[RDMA_NL_LS_OP_RESOLVE] = {
 		.dump = ib_nl_handle_resolve_resp,
 		.flags = RDMA_NL_ADMIN_PERM,
diff --git a/drivers/infiniband/core/iwcm.c b/drivers/infiniband/core/iwcm.c
index 8599271d8be6..452a3115e3e6 100644
--- a/drivers/infiniband/core/iwcm.c
+++ b/drivers/infiniband/core/iwcm.c
@@ -80,7 +80,7 @@ const char *__attribute_const__ iwcm_reject_msg(int reason)
 }
 EXPORT_SYMBOL(iwcm_reject_msg);
 
-static struct ibnl_client_cbs iwcm_nl_cb_table[] = {
+static struct rdma_nl_cbs iwcm_nl_cb_table[] = {
 	[RDMA_NL_IWPM_REG_PID] = {.dump = iwpm_register_pid_cb},
 	[RDMA_NL_IWPM_ADD_MAPPING] = {.dump = iwpm_add_mapping_cb},
 	[RDMA_NL_IWPM_QUERY_MAPPING] = {.dump = iwpm_add_and_query_mapping_cb},
diff --git a/drivers/infiniband/core/netlink.c b/drivers/infiniband/core/netlink.c
index 1022ce6628ae..14b64e4d1e06 100644
--- a/drivers/infiniband/core/netlink.c
+++ b/drivers/infiniband/core/netlink.c
@@ -43,7 +43,7 @@
 static DEFINE_MUTEX(rdma_nl_mutex);
 static struct sock *nls;
 static struct {
-	const struct ibnl_client_cbs   *cb_table;
+	const struct rdma_nl_cbs   *cb_table;
 } rdma_nl_types[RDMA_NL_NUM_CLIENTS];
 
 int rdma_nl_chk_listeners(unsigned int group)
@@ -83,7 +83,7 @@ static bool is_nl_valid(unsigned int type, unsigned int op)
 }
 
 void rdma_nl_register(unsigned int index,
-		      const struct ibnl_client_cbs cb_table[])
+		      const struct rdma_nl_cbs cb_table[])
 {
 	mutex_lock(&rdma_nl_mutex);
 	if (!is_nl_msg_valid(index, 0)) {
diff --git a/include/rdma/rdma_netlink.h b/include/rdma/rdma_netlink.h
index b39e030b3a64..8feeb899e2b2 100644
--- a/include/rdma/rdma_netlink.h
+++ b/include/rdma/rdma_netlink.h
@@ -5,7 +5,7 @@
 #include <linux/netlink.h>
 #include <uapi/rdma/rdma_netlink.h>
 
-struct ibnl_client_cbs {
+struct rdma_nl_cbs {
 	int (*dump)(struct sk_buff *skb, struct netlink_callback *nlcb);
 	u8 flags;
 };
@@ -24,7 +24,7 @@ void rdma_nl_exit(void);
  * @cb_table: A table for op->callback
  */
 void rdma_nl_register(unsigned int index,
-		      const struct ibnl_client_cbs cb_table[]);
+		      const struct rdma_nl_cbs cb_table[]);
 
 /**
  * Remove a client from IB netlink.
-- 
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

^ permalink raw reply related	[flat|nested] 69+ messages in thread

* [PATCH rdma-next 07/19] RDMA/core: Add iterator over ib_devices
  2017-06-21  6:05 [PATCH rdma-next 00/19] RDMA Netlink Device Client Leon Romanovsky
                   ` (2 preceding siblings ...)
  2017-06-21  6:05 ` [PATCH rdma-next 05/19] RDMA/netlink: Simplify and rename ibnl_chk_listeners Leon Romanovsky
@ 2017-06-21  6:05 ` Leon Romanovsky
       [not found]   ` <20170621060528.3752-8-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
  2017-06-21  6:05 ` [PATCH rdma-next 08/19] RDMA/core: Expose translation from device name to ib_device Leon Romanovsky
                   ` (10 subsequent siblings)
  14 siblings, 1 reply; 69+ messages in thread
From: Leon Romanovsky @ 2017-06-21  6:05 UTC (permalink / raw)
  To: Doug Ledford
  Cc: linux-rdma, Chien Tin Tung, Steve Wise, Stephen Hemminger,
	Jiri Pirko, Ariel Almog, Linux Netdev, Leon Romanovsky

From: Leon Romanovsky <leonro@mellanox.com>

The coming nldev needs iterate over all IB devices in the system
and in order do not expose the ib_devices list outside the devices.c,
it is necessary to provide function iterator.

Current version is written explicitly for nldev callback to avoid
over-engineering at this stage, but it can be easily extended for
other types.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
 drivers/infiniband/core/core_priv.h |  8 ++++++++
 drivers/infiniband/core/device.c    | 25 +++++++++++++++++++++++++
 2 files changed, 33 insertions(+)

diff --git a/drivers/infiniband/core/core_priv.h b/drivers/infiniband/core/core_priv.h
index cb7d372e4bdf..4a150c4be175 100644
--- a/drivers/infiniband/core/core_priv.h
+++ b/drivers/infiniband/core/core_priv.h
@@ -92,6 +92,14 @@ void ib_enum_all_roce_netdevs(roce_netdev_filter filter,
 			      roce_netdev_callback cb,
 			      void *cookie);
 
+typedef int (*nldev_callback)(struct ib_device *device,
+			      struct sk_buff *skb,
+			      struct netlink_callback *cb,
+			      unsigned int idx);
+
+int ib_enum_all_devs(nldev_callback nldev_cb, struct sk_buff *skb,
+		     struct netlink_callback *cb);
+
 enum ib_cache_gid_default_mode {
 	IB_CACHE_GID_DEFAULT_MODE_SET,
 	IB_CACHE_GID_DEFAULT_MODE_DELETE
diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
index 5326dcc6ede7..7a799fc90348 100644
--- a/drivers/infiniband/core/device.c
+++ b/drivers/infiniband/core/device.c
@@ -815,6 +815,31 @@ void ib_enum_all_roce_netdevs(roce_netdev_filter filter,
 }
 
 /**
+ * ib_enum_all_devs - enumerate all ib_devices
+ * @cb: Callback to call for each found ib_device
+ *
+ * Enumerates all ib_devices and calls callback() on each device.
+ */
+int ib_enum_all_devs(nldev_callback nldev_cb, struct sk_buff *skb,
+		     struct netlink_callback *cb)
+{
+	struct ib_device *dev;
+	unsigned int idx = 0;
+	int ret = 0;
+
+	down_read(&lists_rwsem);
+	list_for_each_entry(dev, &device_list, core_list) {
+		ret = nldev_cb(dev, skb, cb, idx);
+		if (ret)
+			break;
+		idx++;
+	}
+
+	up_read(&lists_rwsem);
+	return ret;
+}
+
+/**
  * ib_query_pkey - Get P_Key table entry
  * @device:Device to query
  * @port_num:Port number to query
-- 
2.13.1

^ permalink raw reply related	[flat|nested] 69+ messages in thread

* [PATCH rdma-next 08/19] RDMA/core: Expose translation from device name to ib_device
  2017-06-21  6:05 [PATCH rdma-next 00/19] RDMA Netlink Device Client Leon Romanovsky
                   ` (3 preceding siblings ...)
  2017-06-21  6:05 ` [PATCH rdma-next 07/19] RDMA/core: Add iterator over ib_devices Leon Romanovsky
@ 2017-06-21  6:05 ` Leon Romanovsky
       [not found]   ` <20170621060528.3752-9-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
  2017-06-21 16:07   ` Jason Gunthorpe
  2017-06-21  6:05 ` [PATCH rdma-next 10/19] RDMA/netlink: Reduce indirection access to cb_table Leon Romanovsky
                   ` (9 subsequent siblings)
  14 siblings, 2 replies; 69+ messages in thread
From: Leon Romanovsky @ 2017-06-21  6:05 UTC (permalink / raw)
  To: Doug Ledford
  Cc: linux-rdma, Chien Tin Tung, Steve Wise, Stephen Hemminger,
	Jiri Pirko, Ariel Almog, Linux Netdev, Leon Romanovsky

From: Leon Romanovsky <leonro@mellanox.com>

Provide ability to convert from device name to ib_device for the
IB/core users.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
 drivers/infiniband/core/core_priv.h | 1 +
 drivers/infiniband/core/device.c    | 3 +--
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/core/core_priv.h b/drivers/infiniband/core/core_priv.h
index 4a150c4be175..049ccbfca988 100644
--- a/drivers/infiniband/core/core_priv.h
+++ b/drivers/infiniband/core/core_priv.h
@@ -184,4 +184,5 @@ int ib_nl_handle_set_timeout(struct sk_buff *skb,
 int ib_nl_handle_ip_res_resp(struct sk_buff *skb,
 			     struct netlink_callback *cb);
 
+struct ib_device *__ib_device_get_by_name(const char *name);
 #endif /* _CORE_PRIV_H */
diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
index 7a799fc90348..4ec1b24258de 100644
--- a/drivers/infiniband/core/device.c
+++ b/drivers/infiniband/core/device.c
@@ -124,7 +124,7 @@ static int ib_device_check_mandatory(struct ib_device *device)
 	return 0;
 }
 
-static struct ib_device *__ib_device_get_by_name(const char *name)
+struct ib_device *__ib_device_get_by_name(const char *name)
 {
 	struct ib_device *device;
 
@@ -135,7 +135,6 @@ static struct ib_device *__ib_device_get_by_name(const char *name)
 	return NULL;
 }
 
-
 static int alloc_name(char *name)
 {
 	unsigned long *inuse;
-- 
2.13.1

^ permalink raw reply related	[flat|nested] 69+ messages in thread

* [PATCH rdma-next 09/19] RDMA/netlink: Add and implement doit netlink callback
       [not found] ` <20170621060528.3752-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
                     ` (2 preceding siblings ...)
  2017-06-21  6:05   ` [PATCH rdma-next 06/19] RDMA/netlink: Rename netlink callback struct Leon Romanovsky
@ 2017-06-21  6:05   ` Leon Romanovsky
  2017-06-21 14:11       ` Steve Wise
  2017-06-21  6:05   ` [PATCH rdma-next 13/19] RDMA/netlink: Add netlink device definitions to UAPI Leon Romanovsky
  4 siblings, 1 reply; 69+ messages in thread
From: Leon Romanovsky @ 2017-06-21  6:05 UTC (permalink / raw)
  To: Doug Ledford
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Chien Tin Tung, Steve Wise,
	Stephen Hemminger, Jiri Pirko, Ariel Almog, Linux Netdev,
	Leon Romanovsky

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

The .doit callback is used by netlink core to differentiate
between get and set operations. Common convention is to use
that call for command operations like (SET, ADD, e.t.c.) and/or
access without NLF_M_DUMP flag.

This commit adds proper declaration and implementation
to RDMA netlink.

Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
 drivers/infiniband/core/netlink.c | 19 ++++++++++++++-----
 include/rdma/rdma_netlink.h       |  2 ++
 2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/drivers/infiniband/core/netlink.c b/drivers/infiniband/core/netlink.c
index 14b64e4d1e06..34f529cc9776 100644
--- a/drivers/infiniband/core/netlink.c
+++ b/drivers/infiniband/core/netlink.c
@@ -75,9 +75,13 @@ static bool is_nl_msg_valid(unsigned int type, unsigned int op)
 
 static bool is_nl_valid(unsigned int type, unsigned int op)
 {
-	if (!is_nl_msg_valid(type, op) ||
-	    !rdma_nl_types[type].cb_table ||
-	    !rdma_nl_types[type].cb_table[op].dump)
+	const struct rdma_nl_cbs *cb_table;
+
+	if (!is_nl_msg_valid(type, op))
+		return false;
+
+	cb_table = rdma_nl_types[type].cb_table;
+	if (!cb_table || (!cb_table[op].dump && !cb_table[op].doit))
 		return false;
 	return true;
 }
@@ -152,6 +156,7 @@ static int rdma_nl_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh,
 	unsigned int op = RDMA_NL_GET_OP(type);
 	struct netlink_callback cb = {};
 	struct netlink_dump_control c = {};
+	int ret;
 
 	if (!is_nl_valid(index, op))
 		return -EINVAL;
@@ -170,10 +175,14 @@ static int rdma_nl_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh,
 		cb.nlh = nlh;
 		cb.dump = rdma_nl_types[index].cb_table[op].dump;
 		return cb.dump(skb, &cb);
+	} else {
+		c.dump = rdma_nl_types[index].cb_table[op].dump;
+		return netlink_dump_start(nls, skb, nlh, &c);
 	}
+	if (rdma_nl_types[index].cb_table[op].doit)
+		ret = rdma_nl_types[index].cb_table[op].doit(skb, nlh, extack);
+	return ret;
 
-	c.dump = rdma_nl_types[index].cb_table[op].dump;
-	return netlink_dump_start(nls, skb, nlh, &c);
 }
 
 /*
diff --git a/include/rdma/rdma_netlink.h b/include/rdma/rdma_netlink.h
index 8feeb899e2b2..d6a481880f41 100644
--- a/include/rdma/rdma_netlink.h
+++ b/include/rdma/rdma_netlink.h
@@ -6,6 +6,8 @@
 #include <uapi/rdma/rdma_netlink.h>
 
 struct rdma_nl_cbs {
+	int (*doit)(struct sk_buff *skb, struct nlmsghdr *nlh,
+		    struct netlink_ext_ack *extack);
 	int (*dump)(struct sk_buff *skb, struct netlink_callback *nlcb);
 	u8 flags;
 };
-- 
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

^ permalink raw reply related	[flat|nested] 69+ messages in thread

* [PATCH rdma-next 10/19] RDMA/netlink: Reduce indirection access to cb_table
  2017-06-21  6:05 [PATCH rdma-next 00/19] RDMA Netlink Device Client Leon Romanovsky
                   ` (4 preceding siblings ...)
  2017-06-21  6:05 ` [PATCH rdma-next 08/19] RDMA/core: Expose translation from device name to ib_device Leon Romanovsky
@ 2017-06-21  6:05 ` Leon Romanovsky
       [not found]   ` <20170621060528.3752-11-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
  2017-06-21  6:05 ` [PATCH rdma-next 11/19] RDMA/netlink: Convert LS to doit callback Leon Romanovsky
                   ` (8 subsequent siblings)
  14 siblings, 1 reply; 69+ messages in thread
From: Leon Romanovsky @ 2017-06-21  6:05 UTC (permalink / raw)
  To: Doug Ledford
  Cc: linux-rdma, Chien Tin Tung, Steve Wise, Stephen Hemminger,
	Jiri Pirko, Ariel Almog, Linux Netdev, Leon Romanovsky

From: Leon Romanovsky <leonro@mellanox.com>

Introduce intermediate variable to store access to fields
of cb_table.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
 drivers/infiniband/core/netlink.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/infiniband/core/netlink.c b/drivers/infiniband/core/netlink.c
index 34f529cc9776..73c74d1cd2a3 100644
--- a/drivers/infiniband/core/netlink.c
+++ b/drivers/infiniband/core/netlink.c
@@ -156,12 +156,15 @@ static int rdma_nl_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh,
 	unsigned int op = RDMA_NL_GET_OP(type);
 	struct netlink_callback cb = {};
 	struct netlink_dump_control c = {};
+	const struct rdma_nl_cbs *cb_table;
 	int ret;
 
 	if (!is_nl_valid(index, op))
 		return -EINVAL;
 
-	if ((rdma_nl_types[index].cb_table[op].flags & RDMA_NL_ADMIN_PERM) &&
+	cb_table = rdma_nl_types[type].cb_table;
+
+	if ((cb_table[op].flags & RDMA_NL_ADMIN_PERM) &&
 	    !netlink_capable(skb, CAP_NET_ADMIN))
 		return -EPERM;
 
@@ -173,14 +176,14 @@ static int rdma_nl_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh,
 	    (index == RDMA_NL_LS && op == RDMA_NL_LS_OP_SET_TIMEOUT)) {
 		cb.skb = skb;
 		cb.nlh = nlh;
-		cb.dump = rdma_nl_types[index].cb_table[op].dump;
+		cb.dump = cb_table[op].dump;
 		return cb.dump(skb, &cb);
 	} else {
-		c.dump = rdma_nl_types[index].cb_table[op].dump;
+		c.dump = cb_table[op].dump;
 		return netlink_dump_start(nls, skb, nlh, &c);
 	}
-	if (rdma_nl_types[index].cb_table[op].doit)
-		ret = rdma_nl_types[index].cb_table[op].doit(skb, nlh, extack);
+	if (cb_table[op].doit)
+		ret = cb_table[op].doit(skb, nlh, extack);
 	return ret;
 
 }
-- 
2.13.1

^ permalink raw reply related	[flat|nested] 69+ messages in thread

* [PATCH rdma-next 11/19] RDMA/netlink: Convert LS to doit callback
  2017-06-21  6:05 [PATCH rdma-next 00/19] RDMA Netlink Device Client Leon Romanovsky
                   ` (5 preceding siblings ...)
  2017-06-21  6:05 ` [PATCH rdma-next 10/19] RDMA/netlink: Reduce indirection access to cb_table Leon Romanovsky
@ 2017-06-21  6:05 ` Leon Romanovsky
       [not found]   ` <20170621060528.3752-12-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
  2017-06-21  6:05 ` [PATCH rdma-next 12/19] RDMA/netlink: Update copyright Leon Romanovsky
                   ` (7 subsequent siblings)
  14 siblings, 1 reply; 69+ messages in thread
From: Leon Romanovsky @ 2017-06-21  6:05 UTC (permalink / raw)
  To: Doug Ledford
  Cc: linux-rdma, Chien Tin Tung, Steve Wise, Stephen Hemminger,
	Jiri Pirko, Ariel Almog, Linux Netdev, Leon Romanovsky

From: Leon Romanovsky <leonro@mellanox.com>

RDMA_NL_LS protocol is actually is not dump anything,
but sets data and it should be handled by doit callback.

This patch actually converts RDMA_NL_LS to doit callback, while
preserving IWCM and RDMA_CM flows through netlink_dump_start().

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
 drivers/infiniband/core/addr.c      |  5 ++---
 drivers/infiniband/core/core_priv.h |  9 ++++++---
 drivers/infiniband/core/device.c    |  6 +++---
 drivers/infiniband/core/netlink.c   | 28 ++++++++++------------------
 drivers/infiniband/core/sa_query.c  |  8 ++++----
 5 files changed, 25 insertions(+), 31 deletions(-)

diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c
index 2cc23a26ce4f..0b283029bc61 100644
--- a/drivers/infiniband/core/addr.c
+++ b/drivers/infiniband/core/addr.c
@@ -129,10 +129,9 @@ static void ib_nl_process_good_ip_rsep(const struct nlmsghdr *nlh)
 }
 
 int ib_nl_handle_ip_res_resp(struct sk_buff *skb,
-			     struct netlink_callback *cb)
+			     struct nlmsghdr *nlh,
+			     struct netlink_ext_ack *extack)
 {
-	const struct nlmsghdr *nlh = (struct nlmsghdr *)cb->nlh;
-
 	if ((nlh->nlmsg_flags & NLM_F_REQUEST) ||
 	    !(NETLINK_CB(skb).sk))
 		return -EPERM;
diff --git a/drivers/infiniband/core/core_priv.h b/drivers/infiniband/core/core_priv.h
index 049ccbfca988..0137aa1ec471 100644
--- a/drivers/infiniband/core/core_priv.h
+++ b/drivers/infiniband/core/core_priv.h
@@ -178,11 +178,14 @@ int ib_sa_init(void);
 void ib_sa_cleanup(void);
 
 int ib_nl_handle_resolve_resp(struct sk_buff *skb,
-			      struct netlink_callback *cb);
+			      struct nlmsghdr *nlh,
+			      struct netlink_ext_ack *extack);
 int ib_nl_handle_set_timeout(struct sk_buff *skb,
-			     struct netlink_callback *cb);
+			     struct nlmsghdr *nlh,
+			     struct netlink_ext_ack *extack);
 int ib_nl_handle_ip_res_resp(struct sk_buff *skb,
-			     struct netlink_callback *cb);
+			     struct nlmsghdr *nlh,
+			     struct netlink_ext_ack *extack);
 
 struct ib_device *__ib_device_get_by_name(const char *name);
 #endif /* _CORE_PRIV_H */
diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
index 4ec1b24258de..7317f203a315 100644
--- a/drivers/infiniband/core/device.c
+++ b/drivers/infiniband/core/device.c
@@ -1034,15 +1034,15 @@ EXPORT_SYMBOL(ib_get_net_dev_by_params);
 
 static const struct rdma_nl_cbs ibnl_ls_cb_table[] = {
 	[RDMA_NL_LS_OP_RESOLVE] = {
-		.dump = ib_nl_handle_resolve_resp,
+		.doit = ib_nl_handle_resolve_resp,
 		.flags = RDMA_NL_ADMIN_PERM,
 	},
 	[RDMA_NL_LS_OP_SET_TIMEOUT] = {
-		.dump = ib_nl_handle_set_timeout,
+		.doit = ib_nl_handle_set_timeout,
 		.flags = RDMA_NL_ADMIN_PERM,
 	},
 	[RDMA_NL_LS_OP_IP_RESOLVE] = {
-		.dump = ib_nl_handle_ip_res_resp,
+		.doit = ib_nl_handle_ip_res_resp,
 		.flags = RDMA_NL_ADMIN_PERM,
 	},
 };
diff --git a/drivers/infiniband/core/netlink.c b/drivers/infiniband/core/netlink.c
index 73c74d1cd2a3..52fce73be9c1 100644
--- a/drivers/infiniband/core/netlink.c
+++ b/drivers/infiniband/core/netlink.c
@@ -154,38 +154,30 @@ static int rdma_nl_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh,
 	int type = nlh->nlmsg_type;
 	unsigned int index = RDMA_NL_GET_CLIENT(type);
 	unsigned int op = RDMA_NL_GET_OP(type);
-	struct netlink_callback cb = {};
-	struct netlink_dump_control c = {};
 	const struct rdma_nl_cbs *cb_table;
-	int ret;
 
 	if (!is_nl_valid(index, op))
 		return -EINVAL;
 
-	cb_table = rdma_nl_types[type].cb_table;
+	cb_table = rdma_nl_types[index].cb_table;
 
 	if ((cb_table[op].flags & RDMA_NL_ADMIN_PERM) &&
 	    !netlink_capable(skb, CAP_NET_ADMIN))
 		return -EPERM;
 
-	/*
-	 * For response or local service set_timeout request,
-	 * there is no need to use netlink_dump_start.
-	 */
-	if (!(nlh->nlmsg_flags & NLM_F_REQUEST) ||
-	    (index == RDMA_NL_LS && op == RDMA_NL_LS_OP_SET_TIMEOUT)) {
-		cb.skb = skb;
-		cb.nlh = nlh;
-		cb.dump = cb_table[op].dump;
-		return cb.dump(skb, &cb);
-	} else {
-		c.dump = cb_table[op].dump;
+	/* TODO: Convert IWCM to properly handle doit callbacks */
+	if ((nlh->nlmsg_flags & NLM_F_DUMP) || index == RDMA_NL_RDMA_CM ||
+	    index == RDMA_NL_IWCM) {
+		struct netlink_dump_control c = {
+			.dump = cb_table[op].dump,
+		};
 		return netlink_dump_start(nls, skb, nlh, &c);
 	}
+
 	if (cb_table[op].doit)
-		ret = cb_table[op].doit(skb, nlh, extack);
-	return ret;
+		return cb_table[op].doit(skb, nlh, extack);
 
+	return 0;
 }
 
 /*
diff --git a/drivers/infiniband/core/sa_query.c b/drivers/infiniband/core/sa_query.c
index c06b7deea4d2..42869d11e81e 100644
--- a/drivers/infiniband/core/sa_query.c
+++ b/drivers/infiniband/core/sa_query.c
@@ -1022,9 +1022,9 @@ static void ib_nl_request_timeout(struct work_struct *work)
 }
 
 int ib_nl_handle_set_timeout(struct sk_buff *skb,
-			     struct netlink_callback *cb)
+			     struct nlmsghdr *nlh,
+			     struct netlink_ext_ack *extack)
 {
-	const struct nlmsghdr *nlh = (struct nlmsghdr *)cb->nlh;
 	int timeout, delta, abs_delta;
 	const struct nlattr *attr;
 	unsigned long flags;
@@ -1098,9 +1098,9 @@ static inline int ib_nl_is_good_resolve_resp(const struct nlmsghdr *nlh)
 }
 
 int ib_nl_handle_resolve_resp(struct sk_buff *skb,
-			      struct netlink_callback *cb)
+			      struct nlmsghdr *nlh,
+			      struct netlink_ext_ack *extack)
 {
-	const struct nlmsghdr *nlh = (struct nlmsghdr *)cb->nlh;
 	unsigned long flags;
 	struct ib_sa_query *query;
 	struct ib_mad_send_buf *send_buf;
-- 
2.13.1

^ permalink raw reply related	[flat|nested] 69+ messages in thread

* [PATCH rdma-next 12/19] RDMA/netlink: Update copyright
  2017-06-21  6:05 [PATCH rdma-next 00/19] RDMA Netlink Device Client Leon Romanovsky
                   ` (6 preceding siblings ...)
  2017-06-21  6:05 ` [PATCH rdma-next 11/19] RDMA/netlink: Convert LS to doit callback Leon Romanovsky
@ 2017-06-21  6:05 ` Leon Romanovsky
  2017-06-21 14:18     ` Steve Wise
       [not found] ` <20170621060528.3752-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
                   ` (6 subsequent siblings)
  14 siblings, 1 reply; 69+ messages in thread
From: Leon Romanovsky @ 2017-06-21  6:05 UTC (permalink / raw)
  To: Doug Ledford
  Cc: linux-rdma, Chien Tin Tung, Steve Wise, Stephen Hemminger,
	Jiri Pirko, Ariel Almog, Linux Netdev, Leon Romanovsky

From: Leon Romanovsky <leonro@mellanox.com>

Add Mellanox to the copyright header.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
 drivers/infiniband/core/netlink.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/infiniband/core/netlink.c b/drivers/infiniband/core/netlink.c
index 52fce73be9c1..9731c313e9b9 100644
--- a/drivers/infiniband/core/netlink.c
+++ b/drivers/infiniband/core/netlink.c
@@ -1,4 +1,5 @@
 /*
+ * Copyright (c) 2017 Mellanox Technologies Inc.  All rights reserved.
  * Copyright (c) 2010 Voltaire Inc.  All rights reserved.
  *
  * This software is available to you under a choice of one of two
-- 
2.13.1

^ permalink raw reply related	[flat|nested] 69+ messages in thread

* [PATCH rdma-next 13/19] RDMA/netlink: Add netlink device definitions to UAPI
       [not found] ` <20170621060528.3752-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
                     ` (3 preceding siblings ...)
  2017-06-21  6:05   ` [PATCH rdma-next 09/19] RDMA/netlink: Add and implement doit netlink callback Leon Romanovsky
@ 2017-06-21  6:05   ` Leon Romanovsky
  2017-06-21 14:21       ` Steve Wise
  2017-06-21 16:11     ` Jason Gunthorpe
  4 siblings, 2 replies; 69+ messages in thread
From: Leon Romanovsky @ 2017-06-21  6:05 UTC (permalink / raw)
  To: Doug Ledford
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Chien Tin Tung, Steve Wise,
	Stephen Hemminger, Jiri Pirko, Ariel Almog, Linux Netdev,
	Leon Romanovsky

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

Introduce new defines to rdma_netlink.h, so the RDMA configuration tool
will be able to communicate with RDMA subsystem by using the shared defines.

The addition of new client (NLDEV) revealed the fact that we exposed by
mistake the RDMA_NL_I40IW define which is not backed by any RDMA netlink
by now and it won't be exposed in the future too. So this patch reuses
the value and leaves the comment together with old definition to whose
who are using RDMA_NL_I40IW as a replacement for digit "5".

The NLDEV operates with objects. The struct ib_device has two straightforward
objects: device itself and ports of that device.

This brings us to propose the following commands to work on those objects:
 * RDMA_NLDEV_CMD_{GET,SET,NEW,DEL} - works on ib_device itself
 * RDMA_NLDEV_CMD_PORT_{GET,SET,NEW,DEL} - works on ports of specific ib_device

Those commands receive/return the device name (RDMA_NLDEV_ATTR_DEV_NAME)
and port index (RDMA_NLDEV_ATTR_PORT_INDEX). For device object accesses,
the RDMA_NLDEV_ATTR_PORT_INDEX will return the maximum number of ports
for specific ib_device and for port access the actual port index.

The port index starts from 1 to follow RDMA/core internal semantics and
the sysfs exposed knobs..

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

diff --git a/drivers/infiniband/core/netlink.c b/drivers/infiniband/core/netlink.c
index 9731c313e9b9..cce9b7af4a3b 100644
--- a/drivers/infiniband/core/netlink.c
+++ b/drivers/infiniband/core/netlink.c
@@ -60,7 +60,7 @@ static bool is_nl_msg_valid(unsigned int type, unsigned int op)
 				  RDMA_NL_IWPM_NUM_OPS,
 				  0,
 				  RDMA_NL_LS_NUM_OPS,
-				  0 };
+				  RDMA_NLDEV_NUM_OPS };
 
 	/*
 	 * This BUILD_BUG_ON is intended to catch addition of new
diff --git a/include/uapi/rdma/rdma_netlink.h b/include/uapi/rdma/rdma_netlink.h
index 02fe8390c18f..bfafd5996d52 100644
--- a/include/uapi/rdma/rdma_netlink.h
+++ b/include/uapi/rdma/rdma_netlink.h
@@ -8,7 +8,14 @@ enum {
 	RDMA_NL_IWCM,
 	RDMA_NL_RSVD,
 	RDMA_NL_LS,	/* RDMA Local Services */
+	/*
+	 * RDMA_NL_I40IW not in use and it was added here by mistake,
+	 * but we need to keep it anyway, because it is UAPI and for
+	 * unknown reasons, someone in the field decided to replace "5"
+	 * with this define.
+	 */
 	RDMA_NL_I40IW,
+	RDMA_NL_NLDEV = RDMA_NL_I40IW, /* RDMA device interface */
 	RDMA_NL_NUM_CLIENTS
 };
 
@@ -222,4 +229,39 @@ struct rdma_nla_ls_gid {
 	__u8		gid[16];
 };
 
+enum rdma_nldev_command {
+	RDMA_NLDEV_CMD_UNSPEC,
+
+	RDMA_NLDEV_CMD_GET, /* can dump */
+	RDMA_NLDEV_CMD_SET,
+	RDMA_NLDEV_CMD_NEW,
+	RDMA_NLDEV_CMD_DEL,
+
+	RDMA_NLDEV_CMD_PORT_GET, /* can dump */
+	RDMA_NLDEV_CMD_PORT_SET,
+	RDMA_NLDEV_CMD_PORT_NEW,
+	RDMA_NLDEV_CMD_PORT_DEL,
+
+	RDMA_NLDEV_NUM_OPS
+};
+
+enum rdma_nldev_attr {
+	/* don't change the order or add anything between, this is ABI! */
+	RDMA_NLDEV_ATTR_UNSPEC,
+
+	/* Identifier for ib_device */
+	RDMA_NLDEV_ATTR_DEV_NAME,		/* string */
+	/*
+	 * Device name together with port index are identifiers
+	 * for port/link properties.
+	 *
+	 * For RDMA_NLDEV_CMD_GET comamnd, port index will return number
+	 * of available ports in ib_device, while for port specific operations,
+	 * it will be real port index as it appears in sysfs. Port index follows
+	 * sysfs notation and starts from 1 for the first port.
+	 */
+	RDMA_NLDEV_ATTR_PORT_INDEX,		/* 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

^ permalink raw reply related	[flat|nested] 69+ messages in thread

* [PATCH rdma-next 14/19] RDMA/netlink: Add nldev initialization flows
  2017-06-21  6:05 [PATCH rdma-next 00/19] RDMA Netlink Device Client Leon Romanovsky
                   ` (8 preceding siblings ...)
       [not found] ` <20170621060528.3752-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
@ 2017-06-21  6:05 ` Leon Romanovsky
       [not found]   ` <20170621060528.3752-15-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
  2017-06-21  6:05 ` [PATCH rdma-next 15/19] RDMA/netlink: Implement nldev device dumpit calback Leon Romanovsky
                   ` (4 subsequent siblings)
  14 siblings, 1 reply; 69+ messages in thread
From: Leon Romanovsky @ 2017-06-21  6:05 UTC (permalink / raw)
  To: Doug Ledford
  Cc: linux-rdma, Chien Tin Tung, Steve Wise, Stephen Hemminger,
	Jiri Pirko, Ariel Almog, Linux Netdev, Leon Romanovsky

From: Leon Romanovsky <leonro@mellanox.com>

Add nldev init and exit flows to the RDMA/core.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
 drivers/infiniband/core/Makefile    |  4 +++-
 drivers/infiniband/core/core_priv.h |  4 ++++
 drivers/infiniband/core/device.c    |  2 ++
 drivers/infiniband/core/nldev.c     | 45 +++++++++++++++++++++++++++++++++++++
 4 files changed, 54 insertions(+), 1 deletion(-)
 create mode 100644 drivers/infiniband/core/nldev.c

diff --git a/drivers/infiniband/core/Makefile b/drivers/infiniband/core/Makefile
index 6ebd9ad95010..d260c5ecf656 100644
--- a/drivers/infiniband/core/Makefile
+++ b/drivers/infiniband/core/Makefile
@@ -10,7 +10,9 @@ obj-$(CONFIG_INFINIBAND_USER_ACCESS) +=	ib_uverbs.o ib_ucm.o \
 ib_core-y :=			packer.o ud_header.o verbs.o cq.o rw.o sysfs.o \
 				device.o fmr_pool.o cache.o netlink.o \
 				roce_gid_mgmt.o mr_pool.o addr.o sa_query.o \
-				multicast.o mad.o smi.o agent.o mad_rmpp.o
+				multicast.o mad.o smi.o agent.o mad_rmpp.o \
+				nldev.o
+
 ib_core-$(CONFIG_INFINIBAND_USER_MEM) += umem.o
 ib_core-$(CONFIG_INFINIBAND_ON_DEMAND_PAGING) += umem_odp.o umem_rbtree.o
 ib_core-$(CONFIG_CGROUP_RDMA) += cgroup.o
diff --git a/drivers/infiniband/core/core_priv.h b/drivers/infiniband/core/core_priv.h
index 0137aa1ec471..492c856393c9 100644
--- a/drivers/infiniband/core/core_priv.h
+++ b/drivers/infiniband/core/core_priv.h
@@ -188,4 +188,8 @@ int ib_nl_handle_ip_res_resp(struct sk_buff *skb,
 			     struct netlink_ext_ack *extack);
 
 struct ib_device *__ib_device_get_by_name(const char *name);
+
+/* RDMA device netlink */
+void nldev_init(void);
+void nldev_exit(void);
 #endif /* _CORE_PRIV_H */
diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
index 7317f203a315..bbcc210731e2 100644
--- a/drivers/infiniband/core/device.c
+++ b/drivers/infiniband/core/device.c
@@ -1092,6 +1092,7 @@ static int __init ib_core_init(void)
 		goto err_mad;
 	}
 
+	nldev_init();
 	rdma_nl_register(RDMA_NL_LS, ibnl_ls_cb_table);
 	ib_cache_setup();
 
@@ -1115,6 +1116,7 @@ static int __init ib_core_init(void)
 static void __exit ib_core_cleanup(void)
 {
 	ib_cache_cleanup();
+	nldev_exit();
 	rdma_nl_unregister(RDMA_NL_LS);
 	ib_sa_cleanup();
 	ib_mad_cleanup();
diff --git a/drivers/infiniband/core/nldev.c b/drivers/infiniband/core/nldev.c
new file mode 100644
index 000000000000..1d1e4f214874
--- /dev/null
+++ b/drivers/infiniband/core/nldev.c
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2017 Mellanox Technologies. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the names of the copyright holders nor the names of its
+ *    contributors may be used to endorse or promote products derived from
+ *    this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <rdma/rdma_netlink.h>
+
+#include "core_priv.h"
+
+void __init nldev_init(void)
+{
+	rdma_nl_register(RDMA_NL_NLDEV, NULL);
+}
+
+void __exit nldev_exit(void)
+{
+	rdma_nl_unregister(RDMA_NL_NLDEV);
+}
-- 
2.13.1

^ permalink raw reply related	[flat|nested] 69+ messages in thread

* [PATCH rdma-next 15/19] RDMA/netlink: Implement nldev device dumpit calback
  2017-06-21  6:05 [PATCH rdma-next 00/19] RDMA Netlink Device Client Leon Romanovsky
                   ` (9 preceding siblings ...)
  2017-06-21  6:05 ` [PATCH rdma-next 14/19] RDMA/netlink: Add nldev initialization flows Leon Romanovsky
@ 2017-06-21  6:05 ` Leon Romanovsky
  2017-06-21 14:25     ` Steve Wise
  2017-06-21  6:05 ` [PATCH rdma-next 16/19] RDMa/netlink: Add nldev device doit implementation Leon Romanovsky
                   ` (3 subsequent siblings)
  14 siblings, 1 reply; 69+ messages in thread
From: Leon Romanovsky @ 2017-06-21  6:05 UTC (permalink / raw)
  To: Doug Ledford
  Cc: linux-rdma, Chien Tin Tung, Steve Wise, Stephen Hemminger,
	Jiri Pirko, Ariel Almog, Linux Netdev, Leon Romanovsky

From: Leon Romanovsky <leonro@mellanox.com>

This patch adds the ability to return all available devices
together with their properties.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
 drivers/infiniband/core/nldev.c | 61 ++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 60 insertions(+), 1 deletion(-)

diff --git a/drivers/infiniband/core/nldev.c b/drivers/infiniband/core/nldev.c
index 1d1e4f214874..219b52166c46 100644
--- a/drivers/infiniband/core/nldev.c
+++ b/drivers/infiniband/core/nldev.c
@@ -30,13 +30,72 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include <net/netlink.h>
 #include <rdma/rdma_netlink.h>
 
 #include "core_priv.h"
 
+static const struct nla_policy nldev_policy[RDMA_NLDEV_ATTR_MAX] = {
+	[RDMA_NLDEV_ATTR_DEV_NAME]	= { .type = NLA_NUL_STRING,
+					    .len = IB_DEVICE_NAME_MAX - 1},
+	[RDMA_NLDEV_ATTR_PORT_INDEX]	= { .type = NLA_U32 },
+};
+
+static int fill_dev_info(struct sk_buff *msg, struct ib_device *device)
+{
+	if (nla_put_string(msg, RDMA_NLDEV_ATTR_DEV_NAME, device->name))
+		return -EMSGSIZE;
+	if (nla_put_u32(msg, RDMA_NLDEV_ATTR_PORT_INDEX, rdma_end_port(device)))
+		return -EMSGSIZE;
+	return 0;
+}
+
+static int _nldev_get_dumpit(struct ib_device *device,
+			     struct sk_buff *skb,
+			     struct netlink_callback *cb,
+			     unsigned int idx)
+{
+	int start = cb->args[0];
+	struct nlmsghdr *nlh;
+
+	if (idx < start)
+		return 0;
+
+	nlh = nlmsg_put(skb, NETLINK_CB(cb->skb).portid, cb->nlh->nlmsg_seq,
+			RDMA_NL_GET_TYPE(RDMA_NL_NLDEV, RDMA_NLDEV_CMD_GET),
+			0, NLM_F_MULTI);
+
+	if (fill_dev_info(skb, device)) {
+		nlmsg_cancel(skb, nlh);
+		goto out;
+	}
+
+	nlmsg_end(skb, nlh);
+
+	idx++;
+
+out:	cb->args[0] = idx;
+	return skb->len;
+}
+
+static int nldev_get_dumpit(struct sk_buff *skb, struct netlink_callback *cb)
+{
+	/*
+	 * There is no need to take lock, because
+	 * we are relying on ib_core's lists_rwsem
+	 */
+	return ib_enum_all_devs(_nldev_get_dumpit, skb, cb);
+}
+
+static const struct rdma_nl_cbs nldev_cb_table[] = {
+	[RDMA_NLDEV_CMD_GET] = {
+		.dump = nldev_get_dumpit,
+	},
+};
+
 void __init nldev_init(void)
 {
-	rdma_nl_register(RDMA_NL_NLDEV, NULL);
+	rdma_nl_register(RDMA_NL_NLDEV, nldev_cb_table);
 }
 
 void __exit nldev_exit(void)
-- 
2.13.1

^ permalink raw reply related	[flat|nested] 69+ messages in thread

* [PATCH rdma-next 16/19] RDMa/netlink: Add nldev device doit implementation
  2017-06-21  6:05 [PATCH rdma-next 00/19] RDMA Netlink Device Client Leon Romanovsky
                   ` (10 preceding siblings ...)
  2017-06-21  6:05 ` [PATCH rdma-next 15/19] RDMA/netlink: Implement nldev device dumpit calback Leon Romanovsky
@ 2017-06-21  6:05 ` Leon Romanovsky
       [not found]   ` <20170621060528.3752-17-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
  2017-06-21  6:05 ` [PATCH rdma-next 17/19] RDMA/netlink: Add nldev port dumpit implementation Leon Romanovsky
                   ` (2 subsequent siblings)
  14 siblings, 1 reply; 69+ messages in thread
From: Leon Romanovsky @ 2017-06-21  6:05 UTC (permalink / raw)
  To: Doug Ledford
  Cc: linux-rdma, Chien Tin Tung, Steve Wise, Stephen Hemminger,
	Jiri Pirko, Ariel Almog, Linux Netdev, Leon Romanovsky

From: Leon Romanovsky <leonro@mellanox.com>

Provide ability to query specific device.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
 drivers/infiniband/core/nldev.c | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/drivers/infiniband/core/nldev.c b/drivers/infiniband/core/nldev.c
index 219b52166c46..8d3fd9b58cc1 100644
--- a/drivers/infiniband/core/nldev.c
+++ b/drivers/infiniband/core/nldev.c
@@ -50,6 +50,45 @@ static int fill_dev_info(struct sk_buff *msg, struct ib_device *device)
 	return 0;
 }
 
+static int nldev_get_doit(struct sk_buff *skb, struct nlmsghdr *nlh,
+			  struct netlink_ext_ack *extack)
+{
+	struct nlattr *tb[RDMA_NLDEV_ATTR_MAX];
+	char name[IB_DEVICE_NAME_MAX];
+	struct ib_device *device;
+	struct sk_buff *msg;
+	int err;
+
+	err = nlmsg_parse(nlh, 0, tb, RDMA_NLDEV_ATTR_MAX,
+			  nldev_policy, extack);
+	if (err || !tb[RDMA_NLDEV_ATTR_DEV_NAME])
+		return -EINVAL;
+
+	nla_strlcpy(name, tb[RDMA_NLDEV_ATTR_DEV_NAME], IB_DEVICE_NAME_MAX);
+
+	device = __ib_device_get_by_name(name);
+	if (!device)
+		return -EINVAL;
+
+	msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
+	if (!msg)
+		return -ENOMEM;
+
+	nlh = nlmsg_put(msg, NETLINK_CB(skb).portid, nlh->nlmsg_seq,
+			RDMA_NL_GET_TYPE(RDMA_NL_NLDEV, RDMA_NLDEV_CMD_GET),
+			0, 0);
+
+	err = fill_dev_info(msg, device);
+	if (err) {
+		nlmsg_free(msg);
+		return err;
+	}
+
+	nlmsg_end(msg, nlh);
+
+	return rdma_nl_unicast(msg, NETLINK_CB(skb).portid);
+}
+
 static int _nldev_get_dumpit(struct ib_device *device,
 			     struct sk_buff *skb,
 			     struct netlink_callback *cb,
@@ -89,6 +128,7 @@ static int nldev_get_dumpit(struct sk_buff *skb, struct netlink_callback *cb)
 
 static const struct rdma_nl_cbs nldev_cb_table[] = {
 	[RDMA_NLDEV_CMD_GET] = {
+		.doit = nldev_get_doit,
 		.dump = nldev_get_dumpit,
 	},
 };
-- 
2.13.1

^ permalink raw reply related	[flat|nested] 69+ messages in thread

* [PATCH rdma-next 17/19] RDMA/netlink: Add nldev port dumpit implementation
  2017-06-21  6:05 [PATCH rdma-next 00/19] RDMA Netlink Device Client Leon Romanovsky
                   ` (11 preceding siblings ...)
  2017-06-21  6:05 ` [PATCH rdma-next 16/19] RDMa/netlink: Add nldev device doit implementation Leon Romanovsky
@ 2017-06-21  6:05 ` Leon Romanovsky
       [not found]   ` <20170621060528.3752-18-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
  2017-06-21  6:05 ` [PATCH rdma-next 18/19] RDMA/netlink: Implement nldev port doit callback Leon Romanovsky
  2017-06-21  6:05 ` [PATCH rdma-next 19/19] RDMA/netlink: Expose device and port capability masks Leon Romanovsky
  14 siblings, 1 reply; 69+ messages in thread
From: Leon Romanovsky @ 2017-06-21  6:05 UTC (permalink / raw)
  To: Doug Ledford
  Cc: linux-rdma, Chien Tin Tung, Steve Wise, Stephen Hemminger,
	Jiri Pirko, Ariel Almog, Linux Netdev, Leon Romanovsky

From: Leon Romanovsky <leonro@mellanox.com>

This patch implements the query interface to get all
ports data for the specific device.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
 drivers/infiniband/core/nldev.c | 60 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 60 insertions(+)

diff --git a/drivers/infiniband/core/nldev.c b/drivers/infiniband/core/nldev.c
index 8d3fd9b58cc1..ded06fa69ccb 100644
--- a/drivers/infiniband/core/nldev.c
+++ b/drivers/infiniband/core/nldev.c
@@ -50,6 +50,16 @@ static int fill_dev_info(struct sk_buff *msg, struct ib_device *device)
 	return 0;
 }
 
+static int fill_port_info(struct sk_buff *msg,
+			  struct ib_device *device, u32 port)
+{
+	if (nla_put_string(msg, RDMA_NLDEV_ATTR_DEV_NAME, device->name))
+		return -EMSGSIZE;
+	if (nla_put_u32(msg, RDMA_NLDEV_ATTR_PORT_INDEX, port))
+		return -EMSGSIZE;
+	return 0;
+}
+
 static int nldev_get_doit(struct sk_buff *skb, struct nlmsghdr *nlh,
 			  struct netlink_ext_ack *extack)
 {
@@ -126,11 +136,61 @@ static int nldev_get_dumpit(struct sk_buff *skb, struct netlink_callback *cb)
 	return ib_enum_all_devs(_nldev_get_dumpit, skb, cb);
 }
 
+static int nldev_port_get_dumpit(struct sk_buff *skb,
+				 struct netlink_callback *cb)
+{
+	struct nlattr *tb[RDMA_NLDEV_ATTR_MAX];
+	char name[IB_DEVICE_NAME_MAX];
+	struct ib_device *device;
+	int start = cb->args[0];
+	struct nlmsghdr *nlh;
+	u32 idx = 0;
+	int err;
+	u32 p;
+
+	err = nlmsg_parse(cb->nlh, 0, tb, RDMA_NLDEV_ATTR_MAX,
+			  nldev_policy, NULL);
+	if (err || !tb[RDMA_NLDEV_ATTR_DEV_NAME])
+		return -EINVAL;
+
+	nla_strlcpy(name, tb[RDMA_NLDEV_ATTR_DEV_NAME], IB_DEVICE_NAME_MAX);
+
+	device = __ib_device_get_by_name(name);
+	if (!device)
+		return -EINVAL;
+
+	for (p = rdma_start_port(device); p <= rdma_end_port(device); ++p) {
+		if (idx < start) {
+			idx++;
+			continue;
+		}
+
+		nlh = nlmsg_put(skb, NETLINK_CB(cb->skb).portid,
+				cb->nlh->nlmsg_seq,
+				RDMA_NL_GET_TYPE(RDMA_NL_NLDEV,
+						 RDMA_NLDEV_CMD_PORT_GET),
+				0, NLM_F_MULTI);
+
+		if (fill_port_info(skb, device, p)) {
+			nlmsg_cancel(skb, nlh);
+			goto out;
+		}
+		idx++;
+		nlmsg_end(skb, nlh);
+	}
+
+out:	cb->args[0] = idx;
+	return skb->len;
+}
+
 static const struct rdma_nl_cbs nldev_cb_table[] = {
 	[RDMA_NLDEV_CMD_GET] = {
 		.doit = nldev_get_doit,
 		.dump = nldev_get_dumpit,
 	},
+	[RDMA_NLDEV_CMD_PORT_GET] = {
+		.dump = nldev_port_get_dumpit,
+	},
 };
 
 void __init nldev_init(void)
-- 
2.13.1

^ permalink raw reply related	[flat|nested] 69+ messages in thread

* [PATCH rdma-next 18/19] RDMA/netlink: Implement nldev port doit callback
  2017-06-21  6:05 [PATCH rdma-next 00/19] RDMA Netlink Device Client Leon Romanovsky
                   ` (12 preceding siblings ...)
  2017-06-21  6:05 ` [PATCH rdma-next 17/19] RDMA/netlink: Add nldev port dumpit implementation Leon Romanovsky
@ 2017-06-21  6:05 ` Leon Romanovsky
       [not found]   ` <20170621060528.3752-19-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
  2017-06-21  6:05 ` [PATCH rdma-next 19/19] RDMA/netlink: Expose device and port capability masks Leon Romanovsky
  14 siblings, 1 reply; 69+ messages in thread
From: Leon Romanovsky @ 2017-06-21  6:05 UTC (permalink / raw)
  To: Doug Ledford
  Cc: linux-rdma, Chien Tin Tung, Steve Wise, Stephen Hemminger,
	Jiri Pirko, Ariel Almog, Linux Netdev, Leon Romanovsky

From: Leon Romanovsky <leonro@mellanox.com>

Provide ability to get specific to device and port information.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
 drivers/infiniband/core/nldev.c | 45 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)

diff --git a/drivers/infiniband/core/nldev.c b/drivers/infiniband/core/nldev.c
index ded06fa69ccb..250965329592 100644
--- a/drivers/infiniband/core/nldev.c
+++ b/drivers/infiniband/core/nldev.c
@@ -136,6 +136,50 @@ static int nldev_get_dumpit(struct sk_buff *skb, struct netlink_callback *cb)
 	return ib_enum_all_devs(_nldev_get_dumpit, skb, cb);
 }
 
+static int nldev_port_get_doit(struct sk_buff *skb, struct nlmsghdr *nlh,
+			       struct netlink_ext_ack *extack)
+{
+	struct nlattr *tb[RDMA_NLDEV_ATTR_MAX];
+	char name[IB_DEVICE_NAME_MAX];
+	struct ib_device *device;
+	struct sk_buff *msg;
+	u32 port;
+	int err;
+
+	err = nlmsg_parse(nlh, 0, tb, RDMA_NLDEV_ATTR_MAX,
+			  nldev_policy, extack);
+	if (err || !tb[RDMA_NLDEV_ATTR_DEV_NAME] ||
+	    !tb[RDMA_NLDEV_ATTR_PORT_INDEX])
+		return -EINVAL;
+
+	nla_strlcpy(name, tb[RDMA_NLDEV_ATTR_DEV_NAME], IB_DEVICE_NAME_MAX);
+	device = __ib_device_get_by_name(name);
+	if (!device)
+		return -EINVAL;
+
+	port = nla_get_u32(tb[RDMA_NLDEV_ATTR_PORT_INDEX]);
+	if (rdma_is_port_valid(device, port))
+		return -EINVAL;
+
+	msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
+	if (!msg)
+		return -ENOMEM;
+
+	nlh = nlmsg_put(msg, NETLINK_CB(skb).portid, nlh->nlmsg_seq,
+			RDMA_NL_GET_TYPE(RDMA_NL_NLDEV, RDMA_NLDEV_CMD_GET),
+			0, 0);
+
+	err = fill_port_info(msg, device, port);
+	if (err) {
+		nlmsg_free(msg);
+		return err;
+	}
+
+	nlmsg_end(msg, nlh);
+
+	return rdma_nl_unicast(msg, NETLINK_CB(skb).portid);
+}
+
 static int nldev_port_get_dumpit(struct sk_buff *skb,
 				 struct netlink_callback *cb)
 {
@@ -189,6 +233,7 @@ static const struct rdma_nl_cbs nldev_cb_table[] = {
 		.dump = nldev_get_dumpit,
 	},
 	[RDMA_NLDEV_CMD_PORT_GET] = {
+		.doit = nldev_port_get_doit,
 		.dump = nldev_port_get_dumpit,
 	},
 };
-- 
2.13.1

^ permalink raw reply related	[flat|nested] 69+ messages in thread

* [PATCH rdma-next 19/19] RDMA/netlink: Expose device and port capability masks
  2017-06-21  6:05 [PATCH rdma-next 00/19] RDMA Netlink Device Client Leon Romanovsky
                   ` (13 preceding siblings ...)
  2017-06-21  6:05 ` [PATCH rdma-next 18/19] RDMA/netlink: Implement nldev port doit callback Leon Romanovsky
@ 2017-06-21  6:05 ` Leon Romanovsky
       [not found]   ` <20170621060528.3752-20-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
  14 siblings, 1 reply; 69+ messages in thread
From: Leon Romanovsky @ 2017-06-21  6:05 UTC (permalink / raw)
  To: Doug Ledford
  Cc: linux-rdma, Chien Tin Tung, Steve Wise, Stephen Hemminger,
	Jiri Pirko, Ariel Almog, Linux Netdev, Leon Romanovsky

From: Leon Romanovsky <leonro@mellanox.com>

The port capability mask is exposed to user space via sysfs interface,
while device capabilities are available for verbs only.

This patch provides those capabilities through netlink interface.

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

diff --git a/drivers/infiniband/core/nldev.c b/drivers/infiniband/core/nldev.c
index 250965329592..77135fb29179 100644
--- a/drivers/infiniband/core/nldev.c
+++ b/drivers/infiniband/core/nldev.c
@@ -47,16 +47,35 @@ static int fill_dev_info(struct sk_buff *msg, struct ib_device *device)
 		return -EMSGSIZE;
 	if (nla_put_u32(msg, RDMA_NLDEV_ATTR_PORT_INDEX, rdma_end_port(device)))
 		return -EMSGSIZE;
+
+	BUILD_BUG_ON(sizeof(device->attrs.device_cap_flags) != sizeof(u64));
+	if (nla_put_u64_64bit(msg, RDMA_NLDEV_ATTR_CAP_FLAGS,
+			      device->attrs.device_cap_flags, 0))
+		return -EMSGSIZE;
+
 	return 0;
 }
 
 static int fill_port_info(struct sk_buff *msg,
 			  struct ib_device *device, u32 port)
 {
+	struct ib_port_attr attr;
+	int ret;
+
 	if (nla_put_string(msg, RDMA_NLDEV_ATTR_DEV_NAME, device->name))
 		return -EMSGSIZE;
 	if (nla_put_u32(msg, RDMA_NLDEV_ATTR_PORT_INDEX, port))
 		return -EMSGSIZE;
+
+	ret = ib_query_port(device, port, &attr);
+	if (ret)
+		return ret;
+
+	BUILD_BUG_ON(sizeof(attr.port_cap_flags) > sizeof(u64));
+	if (nla_put_u64_64bit(msg, RDMA_NLDEV_ATTR_CAP_FLAGS,
+			      (u64)attr.port_cap_flags, 0))
+		return -EMSGSIZE;
+
 	return 0;
 }
 
diff --git a/include/uapi/rdma/rdma_netlink.h b/include/uapi/rdma/rdma_netlink.h
index bfafd5996d52..1fff898632f4 100644
--- a/include/uapi/rdma/rdma_netlink.h
+++ b/include/uapi/rdma/rdma_netlink.h
@@ -262,6 +262,11 @@ enum rdma_nldev_attr {
 	 */
 	RDMA_NLDEV_ATTR_PORT_INDEX,		/* u32 */
 
+	/*
+	 * Device and port capabilities
+	 */
+	RDMA_NLDEV_ATTR_CAP_FLAGS,		/* u64 */
+
 	RDMA_NLDEV_ATTR_MAX
 };
 #endif /* _UAPI_RDMA_NETLINK_H */
-- 
2.13.1

^ permalink raw reply related	[flat|nested] 69+ messages in thread

* RE: [PATCH rdma-next 01/19] RDMA/netlink: Add flag to consolidate common handing
       [not found]     ` <20170621060528.3752-2-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
@ 2017-06-21 14:01         ` Steve Wise
  0 siblings, 0 replies; 69+ messages in thread
From: Steve Wise @ 2017-06-21 14:01 UTC (permalink / raw)
  To: 'Leon Romanovsky', 'Doug Ledford'
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, 'Chien Tin Tung',
	'Stephen Hemminger', 'Jiri Pirko',
	'Ariel Almog', 'Linux Netdev',
	'Leon Romanovsky'

> From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> 
> Add ability to provide flags to control RDMA netlink callbacks
> and convert addr.c and sa_query.c to be first users of such
> infrastructure. It allows to move their CAP_NET_ADMIN checks
> into netlink core.
> 
> Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

Looks fine.

Reviewed-by: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>



--
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

^ permalink raw reply	[flat|nested] 69+ messages in thread

* RE: [PATCH rdma-next 01/19] RDMA/netlink: Add flag to consolidate common handing
@ 2017-06-21 14:01         ` Steve Wise
  0 siblings, 0 replies; 69+ messages in thread
From: Steve Wise @ 2017-06-21 14:01 UTC (permalink / raw)
  To: 'Leon Romanovsky', 'Doug Ledford'
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, 'Chien Tin Tung',
	'Stephen Hemminger', 'Jiri Pirko',
	'Ariel Almog', 'Linux Netdev',
	'Leon Romanovsky'

> From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> 
> Add ability to provide flags to control RDMA netlink callbacks
> and convert addr.c and sa_query.c to be first users of such
> infrastructure. It allows to move their CAP_NET_ADMIN checks
> into netlink core.
> 
> Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

Looks fine.

Reviewed-by: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>



--
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

^ permalink raw reply	[flat|nested] 69+ messages in thread

* RE: [PATCH rdma-next 02/19] RDMA/netlink: Simplify the put_msg and put_attr
  2017-06-21  6:05 ` [PATCH rdma-next 02/19] RDMA/netlink: Simplify the put_msg and put_attr Leon Romanovsky
@ 2017-06-21 14:01     ` Steve Wise
  0 siblings, 0 replies; 69+ messages in thread
From: Steve Wise @ 2017-06-21 14:01 UTC (permalink / raw)
  To: 'Leon Romanovsky', 'Doug Ledford'
  Cc: linux-rdma, 'Chien Tin Tung', 'Stephen Hemminger',
	'Jiri Pirko', 'Ariel Almog',
	'Linux Netdev', 'Leon Romanovsky'

> From: Leon Romanovsky <leonro@mellanox.com>
> 
> Reuse standard macros to cancel the netlink message
> in case of error.
> 
> Signed-off-by: Leon Romanovsky <leonro@mellanox.com>

Looks good.

Reviewed-by: Steve Wise <swise@opengridcomputing.com>

^ permalink raw reply	[flat|nested] 69+ messages in thread

* RE: [PATCH rdma-next 02/19] RDMA/netlink: Simplify the put_msg and put_attr
@ 2017-06-21 14:01     ` Steve Wise
  0 siblings, 0 replies; 69+ messages in thread
From: Steve Wise @ 2017-06-21 14:01 UTC (permalink / raw)
  To: 'Leon Romanovsky', 'Doug Ledford'
  Cc: linux-rdma, 'Chien Tin Tung', 'Stephen Hemminger',
	'Jiri Pirko', 'Ariel Almog',
	'Linux Netdev', 'Leon Romanovsky'

> From: Leon Romanovsky <leonro@mellanox.com>
> 
> Reuse standard macros to cancel the netlink message
> in case of error.
> 
> Signed-off-by: Leon Romanovsky <leonro@mellanox.com>

Looks good.

Reviewed-by: Steve Wise <swise@opengridcomputing.com>

^ permalink raw reply	[flat|nested] 69+ messages in thread

* RE: [PATCH rdma-next 03/19] RDMA/netlink: Rename and remove redundant parameter from ibnl_unicast
  2017-06-21  6:05 ` [PATCH rdma-next 03/19] RDMA/netlink: Rename and remove redundant parameter from ibnl_unicast Leon Romanovsky
@ 2017-06-21 14:01     ` Steve Wise
  0 siblings, 0 replies; 69+ messages in thread
From: Steve Wise @ 2017-06-21 14:01 UTC (permalink / raw)
  To: 'Leon Romanovsky', 'Doug Ledford'
  Cc: linux-rdma, 'Chien Tin Tung', 'Stephen Hemminger',
	'Jiri Pirko', 'Ariel Almog',
	'Linux Netdev', 'Leon Romanovsky'

> From: Leon Romanovsky <leonro@mellanox.com>
> 
> Netlink message header is not needed for unicast reply, hence remove it.
> 
> Signed-off-by: Leon Romanovsky <leonro@mellanox.com>

Looks good.

Reviewed-by: Steve Wise <swise@opengridcomputing.com>

^ permalink raw reply	[flat|nested] 69+ messages in thread

* RE: [PATCH rdma-next 03/19] RDMA/netlink: Rename and remove redundant parameter from ibnl_unicast
@ 2017-06-21 14:01     ` Steve Wise
  0 siblings, 0 replies; 69+ messages in thread
From: Steve Wise @ 2017-06-21 14:01 UTC (permalink / raw)
  To: 'Leon Romanovsky', 'Doug Ledford'
  Cc: linux-rdma, 'Chien Tin Tung', 'Stephen Hemminger',
	'Jiri Pirko', 'Ariel Almog',
	'Linux Netdev', 'Leon Romanovsky'

> From: Leon Romanovsky <leonro@mellanox.com>
> 
> Netlink message header is not needed for unicast reply, hence remove it.
> 
> Signed-off-by: Leon Romanovsky <leonro@mellanox.com>

Looks good.

Reviewed-by: Steve Wise <swise@opengridcomputing.com>

^ permalink raw reply	[flat|nested] 69+ messages in thread

* RE: [PATCH rdma-next 04/19] RDMA/netlink: Rename and remove redundant parameter from ibnl_multicast
       [not found]     ` <20170621060528.3752-5-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
@ 2017-06-21 14:03         ` Steve Wise
  0 siblings, 0 replies; 69+ messages in thread
From: Steve Wise @ 2017-06-21 14:03 UTC (permalink / raw)
  To: 'Leon Romanovsky', 'Doug Ledford'
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, 'Chien Tin Tung',
	'Stephen Hemminger', 'Jiri Pirko',
	'Ariel Almog', 'Linux Netdev',
	'Leon Romanovsky'

> From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> 
> The pointer to netlink header was not used in the ibnl_multicast
> function, so let's remove it and simplify the function
> signature.
> 
> Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

Looks good.

Reviewed-by: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>


--
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

^ permalink raw reply	[flat|nested] 69+ messages in thread

* RE: [PATCH rdma-next 04/19] RDMA/netlink: Rename and remove redundant parameter from ibnl_multicast
@ 2017-06-21 14:03         ` Steve Wise
  0 siblings, 0 replies; 69+ messages in thread
From: Steve Wise @ 2017-06-21 14:03 UTC (permalink / raw)
  To: 'Leon Romanovsky', 'Doug Ledford'
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, 'Chien Tin Tung',
	'Stephen Hemminger', 'Jiri Pirko',
	'Ariel Almog', 'Linux Netdev',
	'Leon Romanovsky'

> From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> 
> The pointer to netlink header was not used in the ibnl_multicast
> function, so let's remove it and simplify the function
> signature.
> 
> Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

Looks good.

Reviewed-by: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>


--
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

^ permalink raw reply	[flat|nested] 69+ messages in thread

* RE: [PATCH rdma-next 05/19] RDMA/netlink: Simplify and rename ibnl_chk_listeners
       [not found]   ` <20170621060528.3752-6-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
@ 2017-06-21 14:04       ` Steve Wise
  0 siblings, 0 replies; 69+ messages in thread
From: Steve Wise @ 2017-06-21 14:04 UTC (permalink / raw)
  To: 'Leon Romanovsky', 'Doug Ledford'
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, 'Chien Tin Tung',
	'Stephen Hemminger', 'Jiri Pirko',
	'Ariel Almog', 'Linux Netdev',
	'Leon Romanovsky'

> From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> 
> Make ibnl_chk_listeners function to be one line by removing
> unneeded comparison.
> 
> Rename that function to be complaint to other functions in RDMA netlink.
> 
> Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>


Reviewed-by: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>


--
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

^ permalink raw reply	[flat|nested] 69+ messages in thread

* RE: [PATCH rdma-next 05/19] RDMA/netlink: Simplify and rename ibnl_chk_listeners
@ 2017-06-21 14:04       ` Steve Wise
  0 siblings, 0 replies; 69+ messages in thread
From: Steve Wise @ 2017-06-21 14:04 UTC (permalink / raw)
  To: 'Leon Romanovsky', 'Doug Ledford'
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, 'Chien Tin Tung',
	'Stephen Hemminger', 'Jiri Pirko',
	'Ariel Almog', 'Linux Netdev',
	'Leon Romanovsky'

> From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> 
> Make ibnl_chk_listeners function to be one line by removing
> unneeded comparison.
> 
> Rename that function to be complaint to other functions in RDMA netlink.
> 
> Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>


Reviewed-by: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>


--
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

^ permalink raw reply	[flat|nested] 69+ messages in thread

* RE: [PATCH rdma-next 06/19] RDMA/netlink: Rename netlink callback struct
  2017-06-21  6:05   ` [PATCH rdma-next 06/19] RDMA/netlink: Rename netlink callback struct Leon Romanovsky
@ 2017-06-21 14:04       ` Steve Wise
  0 siblings, 0 replies; 69+ messages in thread
From: Steve Wise @ 2017-06-21 14:04 UTC (permalink / raw)
  To: 'Leon Romanovsky', 'Doug Ledford'
  Cc: linux-rdma, 'Chien Tin Tung', 'Stephen Hemminger',
	'Jiri Pirko', 'Ariel Almog',
	'Linux Netdev', 'Leon Romanovsky'

> From: Leon Romanovsky <leonro@mellanox.com>
> 
> The RDMA netlink client infrastructure was removed and made
> obsolete the old name (ibnl_client_cbs). This patch renames
> to the more appropriate name (rdma_nl_cbs).
> 
> Signed-off-by: Leon Romanovsky <leonro@mellanox.com>

Looks good.

Reviewed-by: Steve Wise <swise@opengridcomputing.com>

^ permalink raw reply	[flat|nested] 69+ messages in thread

* RE: [PATCH rdma-next 06/19] RDMA/netlink: Rename netlink callback struct
@ 2017-06-21 14:04       ` Steve Wise
  0 siblings, 0 replies; 69+ messages in thread
From: Steve Wise @ 2017-06-21 14:04 UTC (permalink / raw)
  To: 'Leon Romanovsky', 'Doug Ledford'
  Cc: linux-rdma, 'Chien Tin Tung', 'Stephen Hemminger',
	'Jiri Pirko', 'Ariel Almog',
	'Linux Netdev', 'Leon Romanovsky'

> From: Leon Romanovsky <leonro@mellanox.com>
> 
> The RDMA netlink client infrastructure was removed and made
> obsolete the old name (ibnl_client_cbs). This patch renames
> to the more appropriate name (rdma_nl_cbs).
> 
> Signed-off-by: Leon Romanovsky <leonro@mellanox.com>

Looks good.

Reviewed-by: Steve Wise <swise@opengridcomputing.com>

^ permalink raw reply	[flat|nested] 69+ messages in thread

* RE: [PATCH rdma-next 07/19] RDMA/core: Add iterator over ib_devices
       [not found]   ` <20170621060528.3752-8-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
@ 2017-06-21 14:07       ` Steve Wise
  0 siblings, 0 replies; 69+ messages in thread
From: Steve Wise @ 2017-06-21 14:07 UTC (permalink / raw)
  To: 'Leon Romanovsky', 'Doug Ledford'
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, 'Chien Tin Tung',
	'Stephen Hemminger', 'Jiri Pirko',
	'Ariel Almog', 'Linux Netdev',
	'Leon Romanovsky'

> From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> 
> The coming nldev needs iterate over all IB devices in the system
> and in order do not expose the ib_devices list outside the devices.c,
> it is necessary to provide function iterator.

nit: "needs iterate over" -> "needs to iterate over..."
nit: "order do" -> "order to"

> 
> Current version is written explicitly for nldev callback to avoid
> over-engineering at this stage, but it can be easily extended for
> other types.
> 
> Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>


Reviewed-by: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>


--
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

^ permalink raw reply	[flat|nested] 69+ messages in thread

* RE: [PATCH rdma-next 07/19] RDMA/core: Add iterator over ib_devices
@ 2017-06-21 14:07       ` Steve Wise
  0 siblings, 0 replies; 69+ messages in thread
From: Steve Wise @ 2017-06-21 14:07 UTC (permalink / raw)
  To: 'Leon Romanovsky', 'Doug Ledford'
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, 'Chien Tin Tung',
	'Stephen Hemminger', 'Jiri Pirko',
	'Ariel Almog', 'Linux Netdev',
	'Leon Romanovsky'

> From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> 
> The coming nldev needs iterate over all IB devices in the system
> and in order do not expose the ib_devices list outside the devices.c,
> it is necessary to provide function iterator.

nit: "needs iterate over" -> "needs to iterate over..."
nit: "order do" -> "order to"

> 
> Current version is written explicitly for nldev callback to avoid
> over-engineering at this stage, but it can be easily extended for
> other types.
> 
> Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>


Reviewed-by: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>


--
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

^ permalink raw reply	[flat|nested] 69+ messages in thread

* RE: [PATCH rdma-next 08/19] RDMA/core: Expose translation from device name to ib_device
       [not found]   ` <20170621060528.3752-9-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
@ 2017-06-21 14:09       ` Steve Wise
  0 siblings, 0 replies; 69+ messages in thread
From: Steve Wise @ 2017-06-21 14:09 UTC (permalink / raw)
  To: 'Leon Romanovsky', 'Doug Ledford'
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, 'Chien Tin Tung',
	'Stephen Hemminger', 'Jiri Pirko',
	'Ariel Almog', 'Linux Netdev',
	'Leon Romanovsky'

> From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> 
> Provide ability to convert from device name to ib_device for the
> IB/core users.
> 
> Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> ---
>  drivers/infiniband/core/core_priv.h | 1 +
>  drivers/infiniband/core/device.c    | 3 +--
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/infiniband/core/core_priv.h
> b/drivers/infiniband/core/core_priv.h
> index 4a150c4be175..049ccbfca988 100644
> --- a/drivers/infiniband/core/core_priv.h
> +++ b/drivers/infiniband/core/core_priv.h
> @@ -184,4 +184,5 @@ int ib_nl_handle_set_timeout(struct sk_buff *skb,
>  int ib_nl_handle_ip_res_resp(struct sk_buff *skb,
>  			     struct netlink_callback *cb);
> 
> +struct ib_device *__ib_device_get_by_name(const char *name);
>  #endif /* _CORE_PRIV_H */
> diff --git a/drivers/infiniband/core/device.c
b/drivers/infiniband/core/device.c
> index 7a799fc90348..4ec1b24258de 100644
> --- a/drivers/infiniband/core/device.c
> +++ b/drivers/infiniband/core/device.c
> @@ -124,7 +124,7 @@ static int ib_device_check_mandatory(struct ib_device
> *device)
>  	return 0;
>  }
> 
> -static struct ib_device *__ib_device_get_by_name(const char *name)
> +struct ib_device *__ib_device_get_by_name(const char *name)
>  {
>  	struct ib_device *device;
> 
>

Nit: Why is this function prefixed with __?   Perhaps now it should just be
ib_device_get_by_name()?


Reviewed-by: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>


--
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

^ permalink raw reply	[flat|nested] 69+ messages in thread

* RE: [PATCH rdma-next 08/19] RDMA/core: Expose translation from device name to ib_device
@ 2017-06-21 14:09       ` Steve Wise
  0 siblings, 0 replies; 69+ messages in thread
From: Steve Wise @ 2017-06-21 14:09 UTC (permalink / raw)
  To: 'Leon Romanovsky', 'Doug Ledford'
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, 'Chien Tin Tung',
	'Stephen Hemminger', 'Jiri Pirko',
	'Ariel Almog', 'Linux Netdev',
	'Leon Romanovsky'

> From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> 
> Provide ability to convert from device name to ib_device for the
> IB/core users.
> 
> Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> ---
>  drivers/infiniband/core/core_priv.h | 1 +
>  drivers/infiniband/core/device.c    | 3 +--
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/infiniband/core/core_priv.h
> b/drivers/infiniband/core/core_priv.h
> index 4a150c4be175..049ccbfca988 100644
> --- a/drivers/infiniband/core/core_priv.h
> +++ b/drivers/infiniband/core/core_priv.h
> @@ -184,4 +184,5 @@ int ib_nl_handle_set_timeout(struct sk_buff *skb,
>  int ib_nl_handle_ip_res_resp(struct sk_buff *skb,
>  			     struct netlink_callback *cb);
> 
> +struct ib_device *__ib_device_get_by_name(const char *name);
>  #endif /* _CORE_PRIV_H */
> diff --git a/drivers/infiniband/core/device.c
b/drivers/infiniband/core/device.c
> index 7a799fc90348..4ec1b24258de 100644
> --- a/drivers/infiniband/core/device.c
> +++ b/drivers/infiniband/core/device.c
> @@ -124,7 +124,7 @@ static int ib_device_check_mandatory(struct ib_device
> *device)
>  	return 0;
>  }
> 
> -static struct ib_device *__ib_device_get_by_name(const char *name)
> +struct ib_device *__ib_device_get_by_name(const char *name)
>  {
>  	struct ib_device *device;
> 
>

Nit: Why is this function prefixed with __?   Perhaps now it should just be
ib_device_get_by_name()?


Reviewed-by: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>


--
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

^ permalink raw reply	[flat|nested] 69+ messages in thread

* RE: [PATCH rdma-next 09/19] RDMA/netlink: Add and implement doit netlink callback
  2017-06-21  6:05   ` [PATCH rdma-next 09/19] RDMA/netlink: Add and implement doit netlink callback Leon Romanovsky
@ 2017-06-21 14:11       ` Steve Wise
  0 siblings, 0 replies; 69+ messages in thread
From: Steve Wise @ 2017-06-21 14:11 UTC (permalink / raw)
  To: 'Leon Romanovsky', 'Doug Ledford'
  Cc: linux-rdma, 'Chien Tin Tung', 'Stephen Hemminger',
	'Jiri Pirko', 'Ariel Almog',
	'Linux Netdev', 'Leon Romanovsky'

> From: Leon Romanovsky <leonro@mellanox.com>
> 
> The .doit callback is used by netlink core to differentiate
> between get and set operations. Common convention is to use
> that call for command operations like (SET, ADD, e.t.c.) and/or
> access without NLF_M_DUMP flag.
> 
> This commit adds proper declaration and implementation
> to RDMA netlink.
> 
> Signed-off-by: Leon Romanovsky <leonro@mellanox.com>

Looks good.

Reviewed-by: Steve Wise <swise@opengridcomputing.com>

^ permalink raw reply	[flat|nested] 69+ messages in thread

* RE: [PATCH rdma-next 09/19] RDMA/netlink: Add and implement doit netlink callback
@ 2017-06-21 14:11       ` Steve Wise
  0 siblings, 0 replies; 69+ messages in thread
From: Steve Wise @ 2017-06-21 14:11 UTC (permalink / raw)
  To: 'Leon Romanovsky', 'Doug Ledford'
  Cc: linux-rdma, 'Chien Tin Tung', 'Stephen Hemminger',
	'Jiri Pirko', 'Ariel Almog',
	'Linux Netdev', 'Leon Romanovsky'

> From: Leon Romanovsky <leonro@mellanox.com>
> 
> The .doit callback is used by netlink core to differentiate
> between get and set operations. Common convention is to use
> that call for command operations like (SET, ADD, e.t.c.) and/or
> access without NLF_M_DUMP flag.
> 
> This commit adds proper declaration and implementation
> to RDMA netlink.
> 
> Signed-off-by: Leon Romanovsky <leonro@mellanox.com>

Looks good.

Reviewed-by: Steve Wise <swise@opengridcomputing.com>

^ permalink raw reply	[flat|nested] 69+ messages in thread

* RE: [PATCH rdma-next 10/19] RDMA/netlink: Reduce indirection access to cb_table
       [not found]   ` <20170621060528.3752-11-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
@ 2017-06-21 14:13       ` Steve Wise
  0 siblings, 0 replies; 69+ messages in thread
From: Steve Wise @ 2017-06-21 14:13 UTC (permalink / raw)
  To: 'Leon Romanovsky', 'Doug Ledford'
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, 'Chien Tin Tung',
	'Stephen Hemminger', 'Jiri Pirko',
	'Ariel Almog', 'Linux Netdev',
	'Leon Romanovsky'

> From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> 
> Introduce intermediate variable to store access to fields
> of cb_table.
> 
> Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

Reviewed-by: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>


--
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

^ permalink raw reply	[flat|nested] 69+ messages in thread

* RE: [PATCH rdma-next 10/19] RDMA/netlink: Reduce indirection access to cb_table
@ 2017-06-21 14:13       ` Steve Wise
  0 siblings, 0 replies; 69+ messages in thread
From: Steve Wise @ 2017-06-21 14:13 UTC (permalink / raw)
  To: 'Leon Romanovsky', 'Doug Ledford'
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, 'Chien Tin Tung',
	'Stephen Hemminger', 'Jiri Pirko',
	'Ariel Almog', 'Linux Netdev',
	'Leon Romanovsky'

> From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> 
> Introduce intermediate variable to store access to fields
> of cb_table.
> 
> Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

Reviewed-by: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>


--
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

^ permalink raw reply	[flat|nested] 69+ messages in thread

* RE: [PATCH rdma-next 11/19] RDMA/netlink: Convert LS to doit callback
       [not found]   ` <20170621060528.3752-12-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
@ 2017-06-21 14:18       ` Steve Wise
  0 siblings, 0 replies; 69+ messages in thread
From: Steve Wise @ 2017-06-21 14:18 UTC (permalink / raw)
  To: 'Leon Romanovsky', 'Doug Ledford'
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, 'Chien Tin Tung',
	'Stephen Hemminger', 'Jiri Pirko',
	'Ariel Almog', 'Linux Netdev',
	'Leon Romanovsky'

> From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> 
> RDMA_NL_LS protocol is actually is not dump anything,

nit:  "is not" -> "does not"

> but sets data and it should be handled by doit callback.
> 
> This patch actually converts RDMA_NL_LS to doit callback, while
> preserving IWCM and RDMA_CM flows through netlink_dump_start().
> 
> Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>



> ---
>  drivers/infiniband/core/addr.c      |  5 ++---
>  drivers/infiniband/core/core_priv.h |  9 ++++++---
>  drivers/infiniband/core/device.c    |  6 +++---
>  drivers/infiniband/core/netlink.c   | 28 ++++++++++------------------
>  drivers/infiniband/core/sa_query.c  |  8 ++++----
>  5 files changed, 25 insertions(+), 31 deletions(-)
> 
> diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c
> index 2cc23a26ce4f..0b283029bc61 100644
> --- a/drivers/infiniband/core/addr.c
> +++ b/drivers/infiniband/core/addr.c
> @@ -129,10 +129,9 @@ static void ib_nl_process_good_ip_rsep(const struct
> nlmsghdr *nlh)
>  }
> 
>  int ib_nl_handle_ip_res_resp(struct sk_buff *skb,
> -			     struct netlink_callback *cb)
> +			     struct nlmsghdr *nlh,
> +			     struct netlink_ext_ack *extack)
>  {
> -	const struct nlmsghdr *nlh = (struct nlmsghdr *)cb->nlh;
> -
>  	if ((nlh->nlmsg_flags & NLM_F_REQUEST) ||
>  	    !(NETLINK_CB(skb).sk))
>  		return -EPERM;
> diff --git a/drivers/infiniband/core/core_priv.h
> b/drivers/infiniband/core/core_priv.h
> index 049ccbfca988..0137aa1ec471 100644
> --- a/drivers/infiniband/core/core_priv.h
> +++ b/drivers/infiniband/core/core_priv.h
> @@ -178,11 +178,14 @@ int ib_sa_init(void);
>  void ib_sa_cleanup(void);
> 
>  int ib_nl_handle_resolve_resp(struct sk_buff *skb,
> -			      struct netlink_callback *cb);
> +			      struct nlmsghdr *nlh,
> +			      struct netlink_ext_ack *extack);
>  int ib_nl_handle_set_timeout(struct sk_buff *skb,
> -			     struct netlink_callback *cb);
> +			     struct nlmsghdr *nlh,
> +			     struct netlink_ext_ack *extack);
>  int ib_nl_handle_ip_res_resp(struct sk_buff *skb,
> -			     struct netlink_callback *cb);
> +			     struct nlmsghdr *nlh,
> +			     struct netlink_ext_ack *extack);
> 
>  struct ib_device *__ib_device_get_by_name(const char *name);
>  #endif /* _CORE_PRIV_H */
> diff --git a/drivers/infiniband/core/device.c
b/drivers/infiniband/core/device.c
> index 4ec1b24258de..7317f203a315 100644
> --- a/drivers/infiniband/core/device.c
> +++ b/drivers/infiniband/core/device.c
> @@ -1034,15 +1034,15 @@ EXPORT_SYMBOL(ib_get_net_dev_by_params);
> 
>  static const struct rdma_nl_cbs ibnl_ls_cb_table[] = {
>  	[RDMA_NL_LS_OP_RESOLVE] = {
> -		.dump = ib_nl_handle_resolve_resp,
> +		.doit = ib_nl_handle_resolve_resp,
>  		.flags = RDMA_NL_ADMIN_PERM,
>  	},
>  	[RDMA_NL_LS_OP_SET_TIMEOUT] = {
> -		.dump = ib_nl_handle_set_timeout,
> +		.doit = ib_nl_handle_set_timeout,
>  		.flags = RDMA_NL_ADMIN_PERM,
>  	},
>  	[RDMA_NL_LS_OP_IP_RESOLVE] = {
> -		.dump = ib_nl_handle_ip_res_resp,
> +		.doit = ib_nl_handle_ip_res_resp,
>  		.flags = RDMA_NL_ADMIN_PERM,
>  	},
>  };
> diff --git a/drivers/infiniband/core/netlink.c
b/drivers/infiniband/core/netlink.c
> index 73c74d1cd2a3..52fce73be9c1 100644
> --- a/drivers/infiniband/core/netlink.c
> +++ b/drivers/infiniband/core/netlink.c
> @@ -154,38 +154,30 @@ static int rdma_nl_rcv_msg(struct sk_buff *skb, struct
> nlmsghdr *nlh,
>  	int type = nlh->nlmsg_type;
>  	unsigned int index = RDMA_NL_GET_CLIENT(type);
>  	unsigned int op = RDMA_NL_GET_OP(type);
> -	struct netlink_callback cb = {};
> -	struct netlink_dump_control c = {};
>  	const struct rdma_nl_cbs *cb_table;
> -	int ret;
> 
>  	if (!is_nl_valid(index, op))
>  		return -EINVAL;
> 
> -	cb_table = rdma_nl_types[type].cb_table;
> +	cb_table = rdma_nl_types[index].cb_table;
> 
>  	if ((cb_table[op].flags & RDMA_NL_ADMIN_PERM) &&
>  	    !netlink_capable(skb, CAP_NET_ADMIN))
>  		return -EPERM;
> 
> -	/*
> -	 * For response or local service set_timeout request,
> -	 * there is no need to use netlink_dump_start.
> -	 */
> -	if (!(nlh->nlmsg_flags & NLM_F_REQUEST) ||
> -	    (index == RDMA_NL_LS && op == RDMA_NL_LS_OP_SET_TIMEOUT)) {
> -		cb.skb = skb;
> -		cb.nlh = nlh;
> -		cb.dump = cb_table[op].dump;
> -		return cb.dump(skb, &cb);
> -	} else {
> -		c.dump = cb_table[op].dump;
> +	/* TODO: Convert IWCM to properly handle doit callbacks */
> +	if ((nlh->nlmsg_flags & NLM_F_DUMP) || index == RDMA_NL_RDMA_CM
> ||
> +	    index == RDMA_NL_IWCM) {
> +		struct netlink_dump_control c = {
> +			.dump = cb_table[op].dump,
> +		};

Any reason you didn't fix IWCM as part of this series?  Or will you fix it in an
upcoming series?  Also, isn't FIXME: the norm for these sorts of "I don't want
to fix this now" comments?


--
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

^ permalink raw reply	[flat|nested] 69+ messages in thread

* RE: [PATCH rdma-next 11/19] RDMA/netlink: Convert LS to doit callback
@ 2017-06-21 14:18       ` Steve Wise
  0 siblings, 0 replies; 69+ messages in thread
From: Steve Wise @ 2017-06-21 14:18 UTC (permalink / raw)
  To: 'Leon Romanovsky', 'Doug Ledford'
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, 'Chien Tin Tung',
	'Stephen Hemminger', 'Jiri Pirko',
	'Ariel Almog', 'Linux Netdev',
	'Leon Romanovsky'

> From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> 
> RDMA_NL_LS protocol is actually is not dump anything,

nit:  "is not" -> "does not"

> but sets data and it should be handled by doit callback.
> 
> This patch actually converts RDMA_NL_LS to doit callback, while
> preserving IWCM and RDMA_CM flows through netlink_dump_start().
> 
> Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>



> ---
>  drivers/infiniband/core/addr.c      |  5 ++---
>  drivers/infiniband/core/core_priv.h |  9 ++++++---
>  drivers/infiniband/core/device.c    |  6 +++---
>  drivers/infiniband/core/netlink.c   | 28 ++++++++++------------------
>  drivers/infiniband/core/sa_query.c  |  8 ++++----
>  5 files changed, 25 insertions(+), 31 deletions(-)
> 
> diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c
> index 2cc23a26ce4f..0b283029bc61 100644
> --- a/drivers/infiniband/core/addr.c
> +++ b/drivers/infiniband/core/addr.c
> @@ -129,10 +129,9 @@ static void ib_nl_process_good_ip_rsep(const struct
> nlmsghdr *nlh)
>  }
> 
>  int ib_nl_handle_ip_res_resp(struct sk_buff *skb,
> -			     struct netlink_callback *cb)
> +			     struct nlmsghdr *nlh,
> +			     struct netlink_ext_ack *extack)
>  {
> -	const struct nlmsghdr *nlh = (struct nlmsghdr *)cb->nlh;
> -
>  	if ((nlh->nlmsg_flags & NLM_F_REQUEST) ||
>  	    !(NETLINK_CB(skb).sk))
>  		return -EPERM;
> diff --git a/drivers/infiniband/core/core_priv.h
> b/drivers/infiniband/core/core_priv.h
> index 049ccbfca988..0137aa1ec471 100644
> --- a/drivers/infiniband/core/core_priv.h
> +++ b/drivers/infiniband/core/core_priv.h
> @@ -178,11 +178,14 @@ int ib_sa_init(void);
>  void ib_sa_cleanup(void);
> 
>  int ib_nl_handle_resolve_resp(struct sk_buff *skb,
> -			      struct netlink_callback *cb);
> +			      struct nlmsghdr *nlh,
> +			      struct netlink_ext_ack *extack);
>  int ib_nl_handle_set_timeout(struct sk_buff *skb,
> -			     struct netlink_callback *cb);
> +			     struct nlmsghdr *nlh,
> +			     struct netlink_ext_ack *extack);
>  int ib_nl_handle_ip_res_resp(struct sk_buff *skb,
> -			     struct netlink_callback *cb);
> +			     struct nlmsghdr *nlh,
> +			     struct netlink_ext_ack *extack);
> 
>  struct ib_device *__ib_device_get_by_name(const char *name);
>  #endif /* _CORE_PRIV_H */
> diff --git a/drivers/infiniband/core/device.c
b/drivers/infiniband/core/device.c
> index 4ec1b24258de..7317f203a315 100644
> --- a/drivers/infiniband/core/device.c
> +++ b/drivers/infiniband/core/device.c
> @@ -1034,15 +1034,15 @@ EXPORT_SYMBOL(ib_get_net_dev_by_params);
> 
>  static const struct rdma_nl_cbs ibnl_ls_cb_table[] = {
>  	[RDMA_NL_LS_OP_RESOLVE] = {
> -		.dump = ib_nl_handle_resolve_resp,
> +		.doit = ib_nl_handle_resolve_resp,
>  		.flags = RDMA_NL_ADMIN_PERM,
>  	},
>  	[RDMA_NL_LS_OP_SET_TIMEOUT] = {
> -		.dump = ib_nl_handle_set_timeout,
> +		.doit = ib_nl_handle_set_timeout,
>  		.flags = RDMA_NL_ADMIN_PERM,
>  	},
>  	[RDMA_NL_LS_OP_IP_RESOLVE] = {
> -		.dump = ib_nl_handle_ip_res_resp,
> +		.doit = ib_nl_handle_ip_res_resp,
>  		.flags = RDMA_NL_ADMIN_PERM,
>  	},
>  };
> diff --git a/drivers/infiniband/core/netlink.c
b/drivers/infiniband/core/netlink.c
> index 73c74d1cd2a3..52fce73be9c1 100644
> --- a/drivers/infiniband/core/netlink.c
> +++ b/drivers/infiniband/core/netlink.c
> @@ -154,38 +154,30 @@ static int rdma_nl_rcv_msg(struct sk_buff *skb, struct
> nlmsghdr *nlh,
>  	int type = nlh->nlmsg_type;
>  	unsigned int index = RDMA_NL_GET_CLIENT(type);
>  	unsigned int op = RDMA_NL_GET_OP(type);
> -	struct netlink_callback cb = {};
> -	struct netlink_dump_control c = {};
>  	const struct rdma_nl_cbs *cb_table;
> -	int ret;
> 
>  	if (!is_nl_valid(index, op))
>  		return -EINVAL;
> 
> -	cb_table = rdma_nl_types[type].cb_table;
> +	cb_table = rdma_nl_types[index].cb_table;
> 
>  	if ((cb_table[op].flags & RDMA_NL_ADMIN_PERM) &&
>  	    !netlink_capable(skb, CAP_NET_ADMIN))
>  		return -EPERM;
> 
> -	/*
> -	 * For response or local service set_timeout request,
> -	 * there is no need to use netlink_dump_start.
> -	 */
> -	if (!(nlh->nlmsg_flags & NLM_F_REQUEST) ||
> -	    (index == RDMA_NL_LS && op == RDMA_NL_LS_OP_SET_TIMEOUT)) {
> -		cb.skb = skb;
> -		cb.nlh = nlh;
> -		cb.dump = cb_table[op].dump;
> -		return cb.dump(skb, &cb);
> -	} else {
> -		c.dump = cb_table[op].dump;
> +	/* TODO: Convert IWCM to properly handle doit callbacks */
> +	if ((nlh->nlmsg_flags & NLM_F_DUMP) || index == RDMA_NL_RDMA_CM
> ||
> +	    index == RDMA_NL_IWCM) {
> +		struct netlink_dump_control c = {
> +			.dump = cb_table[op].dump,
> +		};

Any reason you didn't fix IWCM as part of this series?  Or will you fix it in an
upcoming series?  Also, isn't FIXME: the norm for these sorts of "I don't want
to fix this now" comments?


--
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

^ permalink raw reply	[flat|nested] 69+ messages in thread

* RE: [PATCH rdma-next 12/19] RDMA/netlink: Update copyright
  2017-06-21  6:05 ` [PATCH rdma-next 12/19] RDMA/netlink: Update copyright Leon Romanovsky
@ 2017-06-21 14:18     ` Steve Wise
  0 siblings, 0 replies; 69+ messages in thread
From: Steve Wise @ 2017-06-21 14:18 UTC (permalink / raw)
  To: 'Leon Romanovsky', 'Doug Ledford'
  Cc: linux-rdma, 'Chien Tin Tung', 'Stephen Hemminger',
	'Jiri Pirko', 'Ariel Almog',
	'Linux Netdev', 'Leon Romanovsky'

> From: Leon Romanovsky <leonro@mellanox.com>
> 
> Add Mellanox to the copyright header.
> 
> Signed-off-by: Leon Romanovsky <leonro@mellanox.com>

Reviewed-by: Steve Wise <swise@opengridcomputing.com>

^ permalink raw reply	[flat|nested] 69+ messages in thread

* RE: [PATCH rdma-next 12/19] RDMA/netlink: Update copyright
@ 2017-06-21 14:18     ` Steve Wise
  0 siblings, 0 replies; 69+ messages in thread
From: Steve Wise @ 2017-06-21 14:18 UTC (permalink / raw)
  To: 'Leon Romanovsky', 'Doug Ledford'
  Cc: linux-rdma, 'Chien Tin Tung', 'Stephen Hemminger',
	'Jiri Pirko', 'Ariel Almog',
	'Linux Netdev', 'Leon Romanovsky'

> From: Leon Romanovsky <leonro@mellanox.com>
> 
> Add Mellanox to the copyright header.
> 
> Signed-off-by: Leon Romanovsky <leonro@mellanox.com>

Reviewed-by: Steve Wise <swise@opengridcomputing.com>

^ permalink raw reply	[flat|nested] 69+ messages in thread

* RE: [PATCH rdma-next 13/19] RDMA/netlink: Add netlink device definitions to UAPI
  2017-06-21  6:05   ` [PATCH rdma-next 13/19] RDMA/netlink: Add netlink device definitions to UAPI Leon Romanovsky
@ 2017-06-21 14:21       ` Steve Wise
  2017-06-21 16:11     ` Jason Gunthorpe
  1 sibling, 0 replies; 69+ messages in thread
From: Steve Wise @ 2017-06-21 14:21 UTC (permalink / raw)
  To: 'Leon Romanovsky', 'Doug Ledford'
  Cc: linux-rdma, 'Chien Tin Tung', 'Stephen Hemminger',
	'Jiri Pirko', 'Ariel Almog',
	'Linux Netdev', 'Leon Romanovsky'

> From: Leon Romanovsky <leonro@mellanox.com>
> 
> Introduce new defines to rdma_netlink.h, so the RDMA configuration tool
> will be able to communicate with RDMA subsystem by using the shared defines.
> 
> The addition of new client (NLDEV) revealed the fact that we exposed by
> mistake the RDMA_NL_I40IW define which is not backed by any RDMA netlink
> by now and it won't be exposed in the future too. So this patch reuses
> the value and leaves the comment together with old definition to whose
> who are using RDMA_NL_I40IW as a replacement for digit "5".
> 
> The NLDEV operates with objects. The struct ib_device has two straightforward
> objects: device itself and ports of that device.
> 
> This brings us to propose the following commands to work on those objects:
>  * RDMA_NLDEV_CMD_{GET,SET,NEW,DEL} - works on ib_device itself
>  * RDMA_NLDEV_CMD_PORT_{GET,SET,NEW,DEL} - works on ports of specific
> ib_device
> 
> Those commands receive/return the device name
> (RDMA_NLDEV_ATTR_DEV_NAME)
> and port index (RDMA_NLDEV_ATTR_PORT_INDEX). For device object accesses,
> the RDMA_NLDEV_ATTR_PORT_INDEX will return the maximum number of ports
> for specific ib_device and for port access the actual port index.
> 
> The port index starts from 1 to follow RDMA/core internal semantics and
> the sysfs exposed knobs..
> 
> Signed-off-by: Leon Romanovsky <leonro@mellanox.com>

Reviewed-by: Steve Wise <swise@opengridcomputing.com>

^ permalink raw reply	[flat|nested] 69+ messages in thread

* RE: [PATCH rdma-next 13/19] RDMA/netlink: Add netlink device definitions to UAPI
@ 2017-06-21 14:21       ` Steve Wise
  0 siblings, 0 replies; 69+ messages in thread
From: Steve Wise @ 2017-06-21 14:21 UTC (permalink / raw)
  To: 'Leon Romanovsky', 'Doug Ledford'
  Cc: linux-rdma, 'Chien Tin Tung', 'Stephen Hemminger',
	'Jiri Pirko', 'Ariel Almog',
	'Linux Netdev', 'Leon Romanovsky'

> From: Leon Romanovsky <leonro@mellanox.com>
> 
> Introduce new defines to rdma_netlink.h, so the RDMA configuration tool
> will be able to communicate with RDMA subsystem by using the shared defines.
> 
> The addition of new client (NLDEV) revealed the fact that we exposed by
> mistake the RDMA_NL_I40IW define which is not backed by any RDMA netlink
> by now and it won't be exposed in the future too. So this patch reuses
> the value and leaves the comment together with old definition to whose
> who are using RDMA_NL_I40IW as a replacement for digit "5".
> 
> The NLDEV operates with objects. The struct ib_device has two straightforward
> objects: device itself and ports of that device.
> 
> This brings us to propose the following commands to work on those objects:
>  * RDMA_NLDEV_CMD_{GET,SET,NEW,DEL} - works on ib_device itself
>  * RDMA_NLDEV_CMD_PORT_{GET,SET,NEW,DEL} - works on ports of specific
> ib_device
> 
> Those commands receive/return the device name
> (RDMA_NLDEV_ATTR_DEV_NAME)
> and port index (RDMA_NLDEV_ATTR_PORT_INDEX). For device object accesses,
> the RDMA_NLDEV_ATTR_PORT_INDEX will return the maximum number of ports
> for specific ib_device and for port access the actual port index.
> 
> The port index starts from 1 to follow RDMA/core internal semantics and
> the sysfs exposed knobs..
> 
> Signed-off-by: Leon Romanovsky <leonro@mellanox.com>

Reviewed-by: Steve Wise <swise@opengridcomputing.com>

^ permalink raw reply	[flat|nested] 69+ messages in thread

* RE: [PATCH rdma-next 14/19] RDMA/netlink: Add nldev initialization flows
       [not found]   ` <20170621060528.3752-15-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
@ 2017-06-21 14:22       ` Steve Wise
  0 siblings, 0 replies; 69+ messages in thread
From: Steve Wise @ 2017-06-21 14:22 UTC (permalink / raw)
  To: 'Leon Romanovsky', 'Doug Ledford'
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, 'Chien Tin Tung',
	'Stephen Hemminger', 'Jiri Pirko',
	'Ariel Almog', 'Linux Netdev',
	'Leon Romanovsky'

> From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> 
> Add nldev init and exit flows to the RDMA/core.
> 
> Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

Reviewed-by: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>



--
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

^ permalink raw reply	[flat|nested] 69+ messages in thread

* RE: [PATCH rdma-next 14/19] RDMA/netlink: Add nldev initialization flows
@ 2017-06-21 14:22       ` Steve Wise
  0 siblings, 0 replies; 69+ messages in thread
From: Steve Wise @ 2017-06-21 14:22 UTC (permalink / raw)
  To: 'Leon Romanovsky', 'Doug Ledford'
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, 'Chien Tin Tung',
	'Stephen Hemminger', 'Jiri Pirko',
	'Ariel Almog', 'Linux Netdev',
	'Leon Romanovsky'

> From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> 
> Add nldev init and exit flows to the RDMA/core.
> 
> Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

Reviewed-by: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>



--
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

^ permalink raw reply	[flat|nested] 69+ messages in thread

* RE: [PATCH rdma-next 15/19] RDMA/netlink: Implement nldev device dumpit calback
  2017-06-21  6:05 ` [PATCH rdma-next 15/19] RDMA/netlink: Implement nldev device dumpit calback Leon Romanovsky
@ 2017-06-21 14:25     ` Steve Wise
  0 siblings, 0 replies; 69+ messages in thread
From: Steve Wise @ 2017-06-21 14:25 UTC (permalink / raw)
  To: 'Leon Romanovsky', 'Doug Ledford'
  Cc: linux-rdma, 'Chien Tin Tung', 'Stephen Hemminger',
	'Jiri Pirko', 'Ariel Almog',
	'Linux Netdev', 'Leon Romanovsky'

> From: Leon Romanovsky <leonro@mellanox.com>
> 
> This patch adds the ability to return all available devices
> together with their properties.
> 
> Signed-off-by: Leon Romanovsky <leonro@mellanox.com>

Reviewed-by: Steve Wise <swise@opengridcomputing.com>

^ permalink raw reply	[flat|nested] 69+ messages in thread

* RE: [PATCH rdma-next 15/19] RDMA/netlink: Implement nldev device dumpit calback
@ 2017-06-21 14:25     ` Steve Wise
  0 siblings, 0 replies; 69+ messages in thread
From: Steve Wise @ 2017-06-21 14:25 UTC (permalink / raw)
  To: 'Leon Romanovsky', 'Doug Ledford'
  Cc: linux-rdma, 'Chien Tin Tung', 'Stephen Hemminger',
	'Jiri Pirko', 'Ariel Almog',
	'Linux Netdev', 'Leon Romanovsky'

> From: Leon Romanovsky <leonro@mellanox.com>
> 
> This patch adds the ability to return all available devices
> together with their properties.
> 
> Signed-off-by: Leon Romanovsky <leonro@mellanox.com>

Reviewed-by: Steve Wise <swise@opengridcomputing.com>

^ permalink raw reply	[flat|nested] 69+ messages in thread

* RE: [PATCH rdma-next 16/19] RDMa/netlink: Add nldev device doit implementation
       [not found]   ` <20170621060528.3752-17-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
@ 2017-06-21 14:26       ` Steve Wise
  0 siblings, 0 replies; 69+ messages in thread
From: Steve Wise @ 2017-06-21 14:26 UTC (permalink / raw)
  To: 'Leon Romanovsky', 'Doug Ledford'
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, 'Chien Tin Tung',
	'Stephen Hemminger', 'Jiri Pirko',
	'Ariel Almog', 'Linux Netdev',
	'Leon Romanovsky'


> From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> 
> Provide ability to query specific device.
> 
> Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

Reviewed-by: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>


--
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

^ permalink raw reply	[flat|nested] 69+ messages in thread

* RE: [PATCH rdma-next 16/19] RDMa/netlink: Add nldev device doit implementation
@ 2017-06-21 14:26       ` Steve Wise
  0 siblings, 0 replies; 69+ messages in thread
From: Steve Wise @ 2017-06-21 14:26 UTC (permalink / raw)
  To: 'Leon Romanovsky', 'Doug Ledford'
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, 'Chien Tin Tung',
	'Stephen Hemminger', 'Jiri Pirko',
	'Ariel Almog', 'Linux Netdev',
	'Leon Romanovsky'


> From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> 
> Provide ability to query specific device.
> 
> Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

Reviewed-by: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>


--
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

^ permalink raw reply	[flat|nested] 69+ messages in thread

* RE: [PATCH rdma-next 17/19] RDMA/netlink: Add nldev port dumpit implementation
       [not found]   ` <20170621060528.3752-18-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
@ 2017-06-21 14:28       ` Steve Wise
  0 siblings, 0 replies; 69+ messages in thread
From: Steve Wise @ 2017-06-21 14:28 UTC (permalink / raw)
  To: 'Leon Romanovsky', 'Doug Ledford'
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, 'Chien Tin Tung',
	'Stephen Hemminger', 'Jiri Pirko',
	'Ariel Almog', 'Linux Netdev',
	'Leon Romanovsky'

> From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> 
> This patch implements the query interface to get all
> ports data for the specific device.
> 
> Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

The fill_port/dev_info is just filling in names and indexes.  Shouldn't it have
all kinds of goodies about the port/dev?  Will this be enhanced going forward as
needed?

Reviewed-by: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>


--
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

^ permalink raw reply	[flat|nested] 69+ messages in thread

* RE: [PATCH rdma-next 17/19] RDMA/netlink: Add nldev port dumpit implementation
@ 2017-06-21 14:28       ` Steve Wise
  0 siblings, 0 replies; 69+ messages in thread
From: Steve Wise @ 2017-06-21 14:28 UTC (permalink / raw)
  To: 'Leon Romanovsky', 'Doug Ledford'
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, 'Chien Tin Tung',
	'Stephen Hemminger', 'Jiri Pirko',
	'Ariel Almog', 'Linux Netdev',
	'Leon Romanovsky'

> From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> 
> This patch implements the query interface to get all
> ports data for the specific device.
> 
> Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

The fill_port/dev_info is just filling in names and indexes.  Shouldn't it have
all kinds of goodies about the port/dev?  Will this be enhanced going forward as
needed?

Reviewed-by: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>


--
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

^ permalink raw reply	[flat|nested] 69+ messages in thread

* RE: [PATCH rdma-next 18/19] RDMA/netlink: Implement nldev port doit callback
       [not found]   ` <20170621060528.3752-19-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
@ 2017-06-21 14:29       ` Steve Wise
  0 siblings, 0 replies; 69+ messages in thread
From: Steve Wise @ 2017-06-21 14:29 UTC (permalink / raw)
  To: 'Leon Romanovsky', 'Doug Ledford'
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, 'Chien Tin Tung',
	'Stephen Hemminger', 'Jiri Pirko',
	'Ariel Almog', 'Linux Netdev',
	'Leon Romanovsky'

> From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> 
> Provide ability to get specific to device and port information.
> 
> Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

Reviewed-by: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>


--
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

^ permalink raw reply	[flat|nested] 69+ messages in thread

* RE: [PATCH rdma-next 18/19] RDMA/netlink: Implement nldev port doit callback
@ 2017-06-21 14:29       ` Steve Wise
  0 siblings, 0 replies; 69+ messages in thread
From: Steve Wise @ 2017-06-21 14:29 UTC (permalink / raw)
  To: 'Leon Romanovsky', 'Doug Ledford'
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, 'Chien Tin Tung',
	'Stephen Hemminger', 'Jiri Pirko',
	'Ariel Almog', 'Linux Netdev',
	'Leon Romanovsky'

> From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> 
> Provide ability to get specific to device and port information.
> 
> Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

Reviewed-by: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>


--
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

^ permalink raw reply	[flat|nested] 69+ messages in thread

* RE: [PATCH rdma-next 19/19] RDMA/netlink: Expose device and port capability masks
       [not found]   ` <20170621060528.3752-20-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
@ 2017-06-21 14:31       ` Steve Wise
  0 siblings, 0 replies; 69+ messages in thread
From: Steve Wise @ 2017-06-21 14:31 UTC (permalink / raw)
  To: 'Leon Romanovsky', 'Doug Ledford'
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, 'Chien Tin Tung',
	'Stephen Hemminger', 'Jiri Pirko',
	'Ariel Almog', 'Linux Netdev',
	'Leon Romanovsky'

> From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> 
> The port capability mask is exposed to user space via sysfs interface,
> while device capabilities are available for verbs only.
> 
> This patch provides those capabilities through netlink interface.
> 
> Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

Reviewed-by: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>


--
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

^ permalink raw reply	[flat|nested] 69+ messages in thread

* RE: [PATCH rdma-next 19/19] RDMA/netlink: Expose device and port capability masks
@ 2017-06-21 14:31       ` Steve Wise
  0 siblings, 0 replies; 69+ messages in thread
From: Steve Wise @ 2017-06-21 14:31 UTC (permalink / raw)
  To: 'Leon Romanovsky', 'Doug Ledford'
  Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, 'Chien Tin Tung',
	'Stephen Hemminger', 'Jiri Pirko',
	'Ariel Almog', 'Linux Netdev',
	'Leon Romanovsky'

> From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> 
> The port capability mask is exposed to user space via sysfs interface,
> while device capabilities are available for verbs only.
> 
> This patch provides those capabilities through netlink interface.
> 
> Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

Reviewed-by: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>


--
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

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [PATCH rdma-next 17/19] RDMA/netlink: Add nldev port dumpit implementation
  2017-06-21 14:28       ` Steve Wise
  (?)
@ 2017-06-21 14:42       ` Leon Romanovsky
       [not found]         ` <20170621144211.GE1248-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
  -1 siblings, 1 reply; 69+ messages in thread
From: Leon Romanovsky @ 2017-06-21 14:42 UTC (permalink / raw)
  To: Steve Wise
  Cc: 'Doug Ledford',
	linux-rdma-u79uwXL29TY76Z2rM5mHXA, 'Chien Tin Tung',
	'Stephen Hemminger', 'Jiri Pirko',
	'Ariel Almog', 'Linux Netdev'

[-- Attachment #1: Type: text/plain, Size: 642 bytes --]

On Wed, Jun 21, 2017 at 09:28:12AM -0500, Steve Wise wrote:
> > From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> >
> > This patch implements the query interface to get all
> > ports data for the specific device.
> >
> > Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
>
> The fill_port/dev_info is just filling in names and indexes.  Shouldn't it have
> all kinds of goodies about the port/dev?  Will this be enhanced going forward as
> needed?

Yes, exactly.

>
> Reviewed-by: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>

Thank you a lot for your review.

>
>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [PATCH rdma-next 11/19] RDMA/netlink: Convert LS to doit callback
  2017-06-21 14:18       ` Steve Wise
  (?)
@ 2017-06-21 14:53       ` Leon Romanovsky
  2017-06-21 15:25           ` Steve Wise
  -1 siblings, 1 reply; 69+ messages in thread
From: Leon Romanovsky @ 2017-06-21 14:53 UTC (permalink / raw)
  To: Steve Wise
  Cc: 'Doug Ledford',
	linux-rdma-u79uwXL29TY76Z2rM5mHXA, 'Chien Tin Tung',
	'Stephen Hemminger', 'Jiri Pirko',
	'Ariel Almog', 'Linux Netdev'

[-- Attachment #1: Type: text/plain, Size: 5703 bytes --]

On Wed, Jun 21, 2017 at 09:18:25AM -0500, Steve Wise wrote:
> > From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> >
> > RDMA_NL_LS protocol is actually is not dump anything,
>
> nit:  "is not" -> "does not"
>
> > but sets data and it should be handled by doit callback.
> >
> > This patch actually converts RDMA_NL_LS to doit callback, while
> > preserving IWCM and RDMA_CM flows through netlink_dump_start().
> >
> > Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
>
>
>
> > ---
> >  drivers/infiniband/core/addr.c      |  5 ++---
> >  drivers/infiniband/core/core_priv.h |  9 ++++++---
> >  drivers/infiniband/core/device.c    |  6 +++---
> >  drivers/infiniband/core/netlink.c   | 28 ++++++++++------------------
> >  drivers/infiniband/core/sa_query.c  |  8 ++++----
> >  5 files changed, 25 insertions(+), 31 deletions(-)
> >
> > diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c
> > index 2cc23a26ce4f..0b283029bc61 100644
> > --- a/drivers/infiniband/core/addr.c
> > +++ b/drivers/infiniband/core/addr.c
> > @@ -129,10 +129,9 @@ static void ib_nl_process_good_ip_rsep(const struct
> > nlmsghdr *nlh)
> >  }
> >
> >  int ib_nl_handle_ip_res_resp(struct sk_buff *skb,
> > -			     struct netlink_callback *cb)
> > +			     struct nlmsghdr *nlh,
> > +			     struct netlink_ext_ack *extack)
> >  {
> > -	const struct nlmsghdr *nlh = (struct nlmsghdr *)cb->nlh;
> > -
> >  	if ((nlh->nlmsg_flags & NLM_F_REQUEST) ||
> >  	    !(NETLINK_CB(skb).sk))
> >  		return -EPERM;
> > diff --git a/drivers/infiniband/core/core_priv.h
> > b/drivers/infiniband/core/core_priv.h
> > index 049ccbfca988..0137aa1ec471 100644
> > --- a/drivers/infiniband/core/core_priv.h
> > +++ b/drivers/infiniband/core/core_priv.h
> > @@ -178,11 +178,14 @@ int ib_sa_init(void);
> >  void ib_sa_cleanup(void);
> >
> >  int ib_nl_handle_resolve_resp(struct sk_buff *skb,
> > -			      struct netlink_callback *cb);
> > +			      struct nlmsghdr *nlh,
> > +			      struct netlink_ext_ack *extack);
> >  int ib_nl_handle_set_timeout(struct sk_buff *skb,
> > -			     struct netlink_callback *cb);
> > +			     struct nlmsghdr *nlh,
> > +			     struct netlink_ext_ack *extack);
> >  int ib_nl_handle_ip_res_resp(struct sk_buff *skb,
> > -			     struct netlink_callback *cb);
> > +			     struct nlmsghdr *nlh,
> > +			     struct netlink_ext_ack *extack);
> >
> >  struct ib_device *__ib_device_get_by_name(const char *name);
> >  #endif /* _CORE_PRIV_H */
> > diff --git a/drivers/infiniband/core/device.c
> b/drivers/infiniband/core/device.c
> > index 4ec1b24258de..7317f203a315 100644
> > --- a/drivers/infiniband/core/device.c
> > +++ b/drivers/infiniband/core/device.c
> > @@ -1034,15 +1034,15 @@ EXPORT_SYMBOL(ib_get_net_dev_by_params);
> >
> >  static const struct rdma_nl_cbs ibnl_ls_cb_table[] = {
> >  	[RDMA_NL_LS_OP_RESOLVE] = {
> > -		.dump = ib_nl_handle_resolve_resp,
> > +		.doit = ib_nl_handle_resolve_resp,
> >  		.flags = RDMA_NL_ADMIN_PERM,
> >  	},
> >  	[RDMA_NL_LS_OP_SET_TIMEOUT] = {
> > -		.dump = ib_nl_handle_set_timeout,
> > +		.doit = ib_nl_handle_set_timeout,
> >  		.flags = RDMA_NL_ADMIN_PERM,
> >  	},
> >  	[RDMA_NL_LS_OP_IP_RESOLVE] = {
> > -		.dump = ib_nl_handle_ip_res_resp,
> > +		.doit = ib_nl_handle_ip_res_resp,
> >  		.flags = RDMA_NL_ADMIN_PERM,
> >  	},
> >  };
> > diff --git a/drivers/infiniband/core/netlink.c
> b/drivers/infiniband/core/netlink.c
> > index 73c74d1cd2a3..52fce73be9c1 100644
> > --- a/drivers/infiniband/core/netlink.c
> > +++ b/drivers/infiniband/core/netlink.c
> > @@ -154,38 +154,30 @@ static int rdma_nl_rcv_msg(struct sk_buff *skb, struct
> > nlmsghdr *nlh,
> >  	int type = nlh->nlmsg_type;
> >  	unsigned int index = RDMA_NL_GET_CLIENT(type);
> >  	unsigned int op = RDMA_NL_GET_OP(type);
> > -	struct netlink_callback cb = {};
> > -	struct netlink_dump_control c = {};
> >  	const struct rdma_nl_cbs *cb_table;
> > -	int ret;
> >
> >  	if (!is_nl_valid(index, op))
> >  		return -EINVAL;
> >
> > -	cb_table = rdma_nl_types[type].cb_table;
> > +	cb_table = rdma_nl_types[index].cb_table;
> >
> >  	if ((cb_table[op].flags & RDMA_NL_ADMIN_PERM) &&
> >  	    !netlink_capable(skb, CAP_NET_ADMIN))
> >  		return -EPERM;
> >
> > -	/*
> > -	 * For response or local service set_timeout request,
> > -	 * there is no need to use netlink_dump_start.
> > -	 */
> > -	if (!(nlh->nlmsg_flags & NLM_F_REQUEST) ||
> > -	    (index == RDMA_NL_LS && op == RDMA_NL_LS_OP_SET_TIMEOUT)) {
> > -		cb.skb = skb;
> > -		cb.nlh = nlh;
> > -		cb.dump = cb_table[op].dump;
> > -		return cb.dump(skb, &cb);
> > -	} else {
> > -		c.dump = cb_table[op].dump;
> > +	/* TODO: Convert IWCM to properly handle doit callbacks */
> > +	if ((nlh->nlmsg_flags & NLM_F_DUMP) || index == RDMA_NL_RDMA_CM
> > ||
> > +	    index == RDMA_NL_IWCM) {
> > +		struct netlink_dump_control c = {
> > +			.dump = cb_table[op].dump,
> > +		};
>
> Any reason you didn't fix IWCM as part of this series?  Or will you fix it in an
> upcoming series?  Also, isn't FIXME: the norm for these sorts of "I don't want
> to fix this now" comments?

I wanted to stop before it is growing into enormous series. There are
number of things which I wanted to discuss and fix before moving forward.

1. What should we do with exported RDMA-CM statistics and structures? I
have a very strong feeling that it is broken and anyway, I'm not going to
use it, because it doesn't follow netlink's TLV style.

2. How to handle IWCM code which sets manually MSG_DONE and isn't using
MULTI flag? It has very similar pattern to my "workarounds", when I didn't
handle properly end of message.

3. Need to remove nl_client from IWCM code.

Thanks

>
>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [PATCH rdma-next 08/19] RDMA/core: Expose translation from device name to ib_device
  2017-06-21 14:09       ` Steve Wise
  (?)
@ 2017-06-21 15:00       ` Leon Romanovsky
  -1 siblings, 0 replies; 69+ messages in thread
From: Leon Romanovsky @ 2017-06-21 15:00 UTC (permalink / raw)
  To: Steve Wise
  Cc: 'Doug Ledford',
	linux-rdma-u79uwXL29TY76Z2rM5mHXA, 'Chien Tin Tung',
	'Stephen Hemminger', 'Jiri Pirko',
	'Ariel Almog', 'Linux Netdev'

[-- Attachment #1: Type: text/plain, Size: 1854 bytes --]

On Wed, Jun 21, 2017 at 09:09:27AM -0500, Steve Wise wrote:
> > From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> >
> > Provide ability to convert from device name to ib_device for the
> > IB/core users.
> >
> > Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> > ---
> >  drivers/infiniband/core/core_priv.h | 1 +
> >  drivers/infiniband/core/device.c    | 3 +--
> >  2 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/infiniband/core/core_priv.h
> > b/drivers/infiniband/core/core_priv.h
> > index 4a150c4be175..049ccbfca988 100644
> > --- a/drivers/infiniband/core/core_priv.h
> > +++ b/drivers/infiniband/core/core_priv.h
> > @@ -184,4 +184,5 @@ int ib_nl_handle_set_timeout(struct sk_buff *skb,
> >  int ib_nl_handle_ip_res_resp(struct sk_buff *skb,
> >  			     struct netlink_callback *cb);
> >
> > +struct ib_device *__ib_device_get_by_name(const char *name);
> >  #endif /* _CORE_PRIV_H */
> > diff --git a/drivers/infiniband/core/device.c
> b/drivers/infiniband/core/device.c
> > index 7a799fc90348..4ec1b24258de 100644
> > --- a/drivers/infiniband/core/device.c
> > +++ b/drivers/infiniband/core/device.c
> > @@ -124,7 +124,7 @@ static int ib_device_check_mandatory(struct ib_device
> > *device)
> >  	return 0;
> >  }
> >
> > -static struct ib_device *__ib_device_get_by_name(const char *name)
> > +struct ib_device *__ib_device_get_by_name(const char *name)
> >  {
> >  	struct ib_device *device;
> >
> >
>
> Nit: Why is this function prefixed with __?   Perhaps now it should just be
> ib_device_get_by_name()?

The access to this function should be protected by device_mutex and
the convention is to prefix functions with "_" to mark that it needs
to handle lock.

>
>
> Reviewed-by: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
>
>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [PATCH rdma-next 17/19] RDMA/netlink: Add nldev port dumpit implementation
       [not found]         ` <20170621144211.GE1248-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
@ 2017-06-21 15:21           ` Leon Romanovsky
  0 siblings, 0 replies; 69+ messages in thread
From: Leon Romanovsky @ 2017-06-21 15:21 UTC (permalink / raw)
  To: Steve Wise
  Cc: 'Doug Ledford',
	linux-rdma-u79uwXL29TY76Z2rM5mHXA, 'Chien Tin Tung',
	'Stephen Hemminger', 'Jiri Pirko',
	'Ariel Almog', 'Linux Netdev'

[-- Attachment #1: Type: text/plain, Size: 800 bytes --]

On Wed, Jun 21, 2017 at 05:42:11PM +0300, Leon Romanovsky wrote:
> On Wed, Jun 21, 2017 at 09:28:12AM -0500, Steve Wise wrote:
> > > From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> > >
> > > This patch implements the query interface to get all
> > > ports data for the specific device.
> > >
> > > Signed-off-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> >
> > The fill_port/dev_info is just filling in names and indexes.  Shouldn't it have
> > all kinds of goodies about the port/dev?  Will this be enhanced going forward as
> > needed?
>
> Yes, exactly.

You can see, it is happening in patch #19.

Thanks

>
> >
> > Reviewed-by: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
>
> Thank you a lot for your review.
>
> >
> >



[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 69+ messages in thread

* RE: [PATCH rdma-next 11/19] RDMA/netlink: Convert LS to doit callback
  2017-06-21 14:53       ` Leon Romanovsky
@ 2017-06-21 15:25           ` Steve Wise
  0 siblings, 0 replies; 69+ messages in thread
From: Steve Wise @ 2017-06-21 15:25 UTC (permalink / raw)
  To: 'Leon Romanovsky'
  Cc: 'Doug Ledford', linux-rdma, 'Chien Tin Tung',
	'Stephen Hemminger', 'Jiri Pirko',
	'Ariel Almog', 'Linux Netdev'

> > > -	/*
> > > -	 * For response or local service set_timeout request,
> > > -	 * there is no need to use netlink_dump_start.
> > > -	 */
> > > -	if (!(nlh->nlmsg_flags & NLM_F_REQUEST) ||
> > > -	    (index == RDMA_NL_LS && op == RDMA_NL_LS_OP_SET_TIMEOUT)) {
> > > -		cb.skb = skb;
> > > -		cb.nlh = nlh;
> > > -		cb.dump = cb_table[op].dump;
> > > -		return cb.dump(skb, &cb);
> > > -	} else {
> > > -		c.dump = cb_table[op].dump;
> > > +	/* TODO: Convert IWCM to properly handle doit callbacks */
> > > +	if ((nlh->nlmsg_flags & NLM_F_DUMP) || index == RDMA_NL_RDMA_CM
> > > ||
> > > +	    index == RDMA_NL_IWCM) {
> > > +		struct netlink_dump_control c = {
> > > +			.dump = cb_table[op].dump,
> > > +		};
> >
> > Any reason you didn't fix IWCM as part of this series?  Or will you fix it
in an
> > upcoming series?  Also, isn't FIXME: the norm for these sorts of "I don't
want
> > to fix this now" comments?
> 
> I wanted to stop before it is growing into enormous series. There are
> number of things which I wanted to discuss and fix before moving forward.
> 
> 1. What should we do with exported RDMA-CM statistics and structures? I
> have a very strong feeling that it is broken and anyway, I'm not going to
> use it, because it doesn't follow netlink's TLV style.
> 
> 2. How to handle IWCM code which sets manually MSG_DONE and isn't using
> MULTI flag? It has very similar pattern to my "workarounds", when I didn't
> handle properly end of message.
> 
> 3. Need to remove nl_client from IWCM code.
> 

Chien, can you please comment on this? 

Thanks!

Steve.

^ permalink raw reply	[flat|nested] 69+ messages in thread

* RE: [PATCH rdma-next 11/19] RDMA/netlink: Convert LS to doit callback
@ 2017-06-21 15:25           ` Steve Wise
  0 siblings, 0 replies; 69+ messages in thread
From: Steve Wise @ 2017-06-21 15:25 UTC (permalink / raw)
  To: 'Leon Romanovsky'
  Cc: 'Doug Ledford', linux-rdma, 'Chien Tin Tung',
	'Stephen Hemminger', 'Jiri Pirko',
	'Ariel Almog', 'Linux Netdev'

> > > -	/*
> > > -	 * For response or local service set_timeout request,
> > > -	 * there is no need to use netlink_dump_start.
> > > -	 */
> > > -	if (!(nlh->nlmsg_flags & NLM_F_REQUEST) ||
> > > -	    (index == RDMA_NL_LS && op == RDMA_NL_LS_OP_SET_TIMEOUT)) {
> > > -		cb.skb = skb;
> > > -		cb.nlh = nlh;
> > > -		cb.dump = cb_table[op].dump;
> > > -		return cb.dump(skb, &cb);
> > > -	} else {
> > > -		c.dump = cb_table[op].dump;
> > > +	/* TODO: Convert IWCM to properly handle doit callbacks */
> > > +	if ((nlh->nlmsg_flags & NLM_F_DUMP) || index == RDMA_NL_RDMA_CM
> > > ||
> > > +	    index == RDMA_NL_IWCM) {
> > > +		struct netlink_dump_control c = {
> > > +			.dump = cb_table[op].dump,
> > > +		};
> >
> > Any reason you didn't fix IWCM as part of this series?  Or will you fix it
in an
> > upcoming series?  Also, isn't FIXME: the norm for these sorts of "I don't
want
> > to fix this now" comments?
> 
> I wanted to stop before it is growing into enormous series. There are
> number of things which I wanted to discuss and fix before moving forward.
> 
> 1. What should we do with exported RDMA-CM statistics and structures? I
> have a very strong feeling that it is broken and anyway, I'm not going to
> use it, because it doesn't follow netlink's TLV style.
> 
> 2. How to handle IWCM code which sets manually MSG_DONE and isn't using
> MULTI flag? It has very similar pattern to my "workarounds", when I didn't
> handle properly end of message.
> 
> 3. Need to remove nl_client from IWCM code.
> 

Chien, can you please comment on this? 

Thanks!

Steve.

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [PATCH rdma-next 08/19] RDMA/core: Expose translation from device name to ib_device
  2017-06-21  6:05 ` [PATCH rdma-next 08/19] RDMA/core: Expose translation from device name to ib_device Leon Romanovsky
       [not found]   ` <20170621060528.3752-9-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
@ 2017-06-21 16:07   ` Jason Gunthorpe
       [not found]     ` <20170621160748.GA10200-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
  1 sibling, 1 reply; 69+ messages in thread
From: Jason Gunthorpe @ 2017-06-21 16:07 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: Doug Ledford, linux-rdma, Chien Tin Tung, Steve Wise,
	Stephen Hemminger, Jiri Pirko, Ariel Almog, Linux Netdev,
	Leon Romanovsky

On Wed, Jun 21, 2017 at 09:05:17AM +0300, Leon Romanovsky wrote:
> From: Leon Romanovsky <leonro@mellanox.com>
> 
> Provide ability to convert from device name to ib_device for the
> IB/core users.

FWIW, as a general comment, we really need to start using some kind of
device index like netdev does instead of the name. I'd like the see
the new netlink interface be index based.

As we saw in a past discussion there is a desire to have stable device
naming, which means renaming...

Jason

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [PATCH rdma-next 13/19] RDMA/netlink: Add netlink device definitions to UAPI
  2017-06-21  6:05   ` [PATCH rdma-next 13/19] RDMA/netlink: Add netlink device definitions to UAPI Leon Romanovsky
  2017-06-21 14:21       ` Steve Wise
@ 2017-06-21 16:11     ` Jason Gunthorpe
       [not found]       ` <20170621161149.GB10200-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
  1 sibling, 1 reply; 69+ messages in thread
From: Jason Gunthorpe @ 2017-06-21 16:11 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: Doug Ledford, linux-rdma, Chien Tin Tung, Steve Wise,
	Stephen Hemminger, Jiri Pirko, Ariel Almog, Linux Netdev,
	Leon Romanovsky

On Wed, Jun 21, 2017 at 09:05:22AM +0300, Leon Romanovsky wrote:
>  	RDMA_NL_IWCM,
>  	RDMA_NL_RSVD,
>  	RDMA_NL_LS,	/* RDMA Local Services */
> +	/*
> +	 * RDMA_NL_I40IW not in use and it was added here by mistake,
> +	 * but we need to keep it anyway, because it is UAPI and for
> +	 * unknown reasons, someone in the field decided to replace "5"
> +	 * with this define.
> +	 */
>  	RDMA_NL_I40IW,

Since this doesn't do anything, never did anything, I think you should
just delete it. Anything in userspace that refers to this name is
unconditionally broken and a compile failure is the better choice.

Jason

^ permalink raw reply	[flat|nested] 69+ messages in thread

* RE: [PATCH rdma-next 13/19] RDMA/netlink: Add netlink device definitions to UAPI
       [not found]       ` <20170621161149.GB10200-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
@ 2017-06-21 16:18         ` Tung, Chien Tin
       [not found]           ` <748B799B6A00724488C603FD7E5E7EB976FA5C5C-XfjTATA9Em864kNsxIetb7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
  0 siblings, 1 reply; 69+ messages in thread
From: Tung, Chien Tin @ 2017-06-21 16:18 UTC (permalink / raw)
  To: Jason Gunthorpe, Leon Romanovsky
  Cc: Doug Ledford, linux-rdma-u79uwXL29TY76Z2rM5mHXA, Steve Wise,
	Stephen Hemminger, Jiri Pirko, Ariel Almog, Linux Netdev,
	Leon Romanovsky

> From: Jason Gunthorpe [mailto:jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org]
> Sent: Wednesday, June 21, 2017 11:12 AM
> To: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> Cc: Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>; linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; Tung,
> Chien Tin <chien.tin.tung-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>; Steve Wise
> <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>; Stephen Hemminger
> <stephen-OTpzqLSitTUnbdJkjeBofR2eb7JE58TQ@public.gmane.org>; Jiri Pirko <jiri-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>; Ariel Almog
> <ariela-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>; Linux Netdev <netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>; Leon
> Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> Subject: Re: [PATCH rdma-next 13/19] RDMA/netlink: Add netlink device
> definitions to UAPI
> 
> On Wed, Jun 21, 2017 at 09:05:22AM +0300, Leon Romanovsky wrote:
> >  	RDMA_NL_IWCM,
> >  	RDMA_NL_RSVD,
> >  	RDMA_NL_LS,	/* RDMA Local Services */
> > +	/*
> > +	 * RDMA_NL_I40IW not in use and it was added here by mistake,
> > +	 * but we need to keep it anyway, because it is UAPI and for
> > +	 * unknown reasons, someone in the field decided to replace "5"
> > +	 * with this define.
> > +	 */
> >  	RDMA_NL_I40IW,
> 
> Since this doesn't do anything, never did anything, I think you should just
> delete it. Anything in userspace that refers to this name is unconditionally
> broken and a compile failure is the better choice.
> 
> Jason

I agree.  Please delete RDMA_NL_I40IW.

Chien
--
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

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [PATCH rdma-next 13/19] RDMA/netlink: Add netlink device definitions to UAPI
       [not found]           ` <748B799B6A00724488C603FD7E5E7EB976FA5C5C-XfjTATA9Em864kNsxIetb7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
@ 2017-06-22  4:28             ` Leon Romanovsky
  0 siblings, 0 replies; 69+ messages in thread
From: Leon Romanovsky @ 2017-06-22  4:28 UTC (permalink / raw)
  To: Tung, Chien Tin
  Cc: Jason Gunthorpe, Doug Ledford, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	Steve Wise, Stephen Hemminger, Jiri Pirko, Ariel Almog,
	Linux Netdev

[-- Attachment #1: Type: text/plain, Size: 1769 bytes --]

On Wed, Jun 21, 2017 at 04:18:54PM +0000, Tung, Chien Tin wrote:
> > From: Jason Gunthorpe [mailto:jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org]
> > Sent: Wednesday, June 21, 2017 11:12 AM
> > To: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> > Cc: Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>; linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; Tung,
> > Chien Tin <chien.tin.tung-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>; Steve Wise
> > <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>; Stephen Hemminger
> > <stephen-OTpzqLSitTUnbdJkjeBofR2eb7JE58TQ@public.gmane.org>; Jiri Pirko <jiri-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>; Ariel Almog
> > <ariela-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>; Linux Netdev <netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>; Leon
> > Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> > Subject: Re: [PATCH rdma-next 13/19] RDMA/netlink: Add netlink device
> > definitions to UAPI
> >
> > On Wed, Jun 21, 2017 at 09:05:22AM +0300, Leon Romanovsky wrote:
> > >  	RDMA_NL_IWCM,
> > >  	RDMA_NL_RSVD,
> > >  	RDMA_NL_LS,	/* RDMA Local Services */
> > > +	/*
> > > +	 * RDMA_NL_I40IW not in use and it was added here by mistake,
> > > +	 * but we need to keep it anyway, because it is UAPI and for
> > > +	 * unknown reasons, someone in the field decided to replace "5"
> > > +	 * with this define.
> > > +	 */
> > >  	RDMA_NL_I40IW,
> >
> > Since this doesn't do anything, never did anything, I think you should just
> > delete it. Anything in userspace that refers to this name is unconditionally
> > broken and a compile failure is the better choice.
> >
> > Jason
>
> I agree.  Please delete RDMA_NL_I40IW.

Fixed and Steve's comments too.

Thanks

>
> Chien

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [PATCH rdma-next 08/19] RDMA/core: Expose translation from device name to ib_device
       [not found]     ` <20170621160748.GA10200-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
@ 2017-06-22  5:31       ` Leon Romanovsky
  0 siblings, 0 replies; 69+ messages in thread
From: Leon Romanovsky @ 2017-06-22  5:31 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: Doug Ledford, linux-rdma-u79uwXL29TY76Z2rM5mHXA, Chien Tin Tung,
	Steve Wise, Stephen Hemminger, Jiri Pirko, Ariel Almog,
	Linux Netdev

[-- Attachment #1: Type: text/plain, Size: 866 bytes --]

On Wed, Jun 21, 2017 at 10:07:48AM -0600, Jason Gunthorpe wrote:
> On Wed, Jun 21, 2017 at 09:05:17AM +0300, Leon Romanovsky wrote:
> > From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> >
> > Provide ability to convert from device name to ib_device for the
> > IB/core users.
>
> FWIW, as a general comment, we really need to start using some kind of
> device index like netdev does instead of the name. I'd like the see
> the new netlink interface be index based.

I can do it, but it won't be full solution as I would like to have.

At this stage, IB doesn't support namespaces yet and to implement them
is a little bit overkill for rdmatool.

>
> As we saw in a past discussion there is a desire to have stable device
> naming, which means renaming...

If I recall correctly, after your proposal the participants disappeared :).

>
> Jason

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 69+ messages in thread

end of thread, other threads:[~2017-06-22  5:31 UTC | newest]

Thread overview: 69+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-21  6:05 [PATCH rdma-next 00/19] RDMA Netlink Device Client Leon Romanovsky
2017-06-21  6:05 ` [PATCH rdma-next 02/19] RDMA/netlink: Simplify the put_msg and put_attr Leon Romanovsky
2017-06-21 14:01   ` Steve Wise
2017-06-21 14:01     ` Steve Wise
2017-06-21  6:05 ` [PATCH rdma-next 03/19] RDMA/netlink: Rename and remove redundant parameter from ibnl_unicast Leon Romanovsky
2017-06-21 14:01   ` Steve Wise
2017-06-21 14:01     ` Steve Wise
2017-06-21  6:05 ` [PATCH rdma-next 05/19] RDMA/netlink: Simplify and rename ibnl_chk_listeners Leon Romanovsky
     [not found]   ` <20170621060528.3752-6-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-06-21 14:04     ` Steve Wise
2017-06-21 14:04       ` Steve Wise
2017-06-21  6:05 ` [PATCH rdma-next 07/19] RDMA/core: Add iterator over ib_devices Leon Romanovsky
     [not found]   ` <20170621060528.3752-8-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-06-21 14:07     ` Steve Wise
2017-06-21 14:07       ` Steve Wise
2017-06-21  6:05 ` [PATCH rdma-next 08/19] RDMA/core: Expose translation from device name to ib_device Leon Romanovsky
     [not found]   ` <20170621060528.3752-9-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-06-21 14:09     ` Steve Wise
2017-06-21 14:09       ` Steve Wise
2017-06-21 15:00       ` Leon Romanovsky
2017-06-21 16:07   ` Jason Gunthorpe
     [not found]     ` <20170621160748.GA10200-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-06-22  5:31       ` Leon Romanovsky
2017-06-21  6:05 ` [PATCH rdma-next 10/19] RDMA/netlink: Reduce indirection access to cb_table Leon Romanovsky
     [not found]   ` <20170621060528.3752-11-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-06-21 14:13     ` Steve Wise
2017-06-21 14:13       ` Steve Wise
2017-06-21  6:05 ` [PATCH rdma-next 11/19] RDMA/netlink: Convert LS to doit callback Leon Romanovsky
     [not found]   ` <20170621060528.3752-12-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-06-21 14:18     ` Steve Wise
2017-06-21 14:18       ` Steve Wise
2017-06-21 14:53       ` Leon Romanovsky
2017-06-21 15:25         ` Steve Wise
2017-06-21 15:25           ` Steve Wise
2017-06-21  6:05 ` [PATCH rdma-next 12/19] RDMA/netlink: Update copyright Leon Romanovsky
2017-06-21 14:18   ` Steve Wise
2017-06-21 14:18     ` Steve Wise
     [not found] ` <20170621060528.3752-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-06-21  6:05   ` [PATCH rdma-next 01/19] RDMA/netlink: Add flag to consolidate common handing Leon Romanovsky
     [not found]     ` <20170621060528.3752-2-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-06-21 14:01       ` Steve Wise
2017-06-21 14:01         ` Steve Wise
2017-06-21  6:05   ` [PATCH rdma-next 04/19] RDMA/netlink: Rename and remove redundant parameter from ibnl_multicast Leon Romanovsky
     [not found]     ` <20170621060528.3752-5-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-06-21 14:03       ` Steve Wise
2017-06-21 14:03         ` Steve Wise
2017-06-21  6:05   ` [PATCH rdma-next 06/19] RDMA/netlink: Rename netlink callback struct Leon Romanovsky
2017-06-21 14:04     ` Steve Wise
2017-06-21 14:04       ` Steve Wise
2017-06-21  6:05   ` [PATCH rdma-next 09/19] RDMA/netlink: Add and implement doit netlink callback Leon Romanovsky
2017-06-21 14:11     ` Steve Wise
2017-06-21 14:11       ` Steve Wise
2017-06-21  6:05   ` [PATCH rdma-next 13/19] RDMA/netlink: Add netlink device definitions to UAPI Leon Romanovsky
2017-06-21 14:21     ` Steve Wise
2017-06-21 14:21       ` Steve Wise
2017-06-21 16:11     ` Jason Gunthorpe
     [not found]       ` <20170621161149.GB10200-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-06-21 16:18         ` Tung, Chien Tin
     [not found]           ` <748B799B6A00724488C603FD7E5E7EB976FA5C5C-XfjTATA9Em864kNsxIetb7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2017-06-22  4:28             ` Leon Romanovsky
2017-06-21  6:05 ` [PATCH rdma-next 14/19] RDMA/netlink: Add nldev initialization flows Leon Romanovsky
     [not found]   ` <20170621060528.3752-15-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-06-21 14:22     ` Steve Wise
2017-06-21 14:22       ` Steve Wise
2017-06-21  6:05 ` [PATCH rdma-next 15/19] RDMA/netlink: Implement nldev device dumpit calback Leon Romanovsky
2017-06-21 14:25   ` Steve Wise
2017-06-21 14:25     ` Steve Wise
2017-06-21  6:05 ` [PATCH rdma-next 16/19] RDMa/netlink: Add nldev device doit implementation Leon Romanovsky
     [not found]   ` <20170621060528.3752-17-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-06-21 14:26     ` Steve Wise
2017-06-21 14:26       ` Steve Wise
2017-06-21  6:05 ` [PATCH rdma-next 17/19] RDMA/netlink: Add nldev port dumpit implementation Leon Romanovsky
     [not found]   ` <20170621060528.3752-18-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-06-21 14:28     ` Steve Wise
2017-06-21 14:28       ` Steve Wise
2017-06-21 14:42       ` Leon Romanovsky
     [not found]         ` <20170621144211.GE1248-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-06-21 15:21           ` Leon Romanovsky
2017-06-21  6:05 ` [PATCH rdma-next 18/19] RDMA/netlink: Implement nldev port doit callback Leon Romanovsky
     [not found]   ` <20170621060528.3752-19-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-06-21 14:29     ` Steve Wise
2017-06-21 14:29       ` Steve Wise
2017-06-21  6:05 ` [PATCH rdma-next 19/19] RDMA/netlink: Expose device and port capability masks Leon Romanovsky
     [not found]   ` <20170621060528.3752-20-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2017-06-21 14:31     ` Steve Wise
2017-06-21 14:31       ` Steve Wise

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.