RDMA: Add netlink infrastructure
Subsystems (3)
cover RDMA: Add netlink infrastructure
From: Roland Dreier <[email protected]>
Hi,
Here are the highlights of a patch series adding support for getting information on active RDMA connections via netlink. I would really appreciate it if netlink experts could take a look and make sure we are doing this the right way and using a suitably extensible structure.
I'm by no means particularly knowledgeable about netlink, so although the RDMA side of things looks OK to me, I hope we can get some level of review of the netlink side of things; the changelog for patch 2/3 tries to explain the messages we're using.
The full series based on 2.6.39-rc7 is also available at:
git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband.git netlink
Thanks!
Roland
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
RFC 1/3 RDMA: Add netlink infrastructure
From: Roland Dreier <[email protected]>
[Dave please do not apply even if this ends up in netdev patchwork!]
Add basic RDMA netlink infrastructure that allows for registration of RDMA clients for which data is to be exported and supplies message construction callbacks.
[ Rename and reorganize a few things. - Roland ]
--- drivers/infiniband/core/Makefile | 2 +- drivers/infiniband/core/device.c | 11 ++ drivers/infiniband/core/netlink.c | 190 +++++++++++++++++++++++++++++++++++++ include/linux/netlink.h | 1 + include/rdma/rdma_netlink.h | 64 +++++++++++++ 5 files changed, 267 insertions(+), 1 deletions(-) create mode 100644 drivers/infiniband/core/netlink.c create mode 100644 include/rdma/rdma_netlink.h
drivers/infiniband/core/Makefile +1 -1
@@ -8,7 +8,7 @@ obj-$(CONFIG_INFINIBAND_USER_ACCESS) += ib_uverbs.o ib_ucm.o \ $(user_access-y) ib_core-y := packer.o ud_header.o verbs.o sysfs.o \ - device.o fmr_pool.o cache.o + device.o fmr_pool.o cache.o netlink.o ib_core-$(CONFIG_INFINIBAND_USER_MEM) += umem.o ib_mad-y := mad.o smi.o agent.o mad_rmpp.o
drivers/infiniband/core/device.c +11 -0
@@ -38,6 +38,7 @@#include <linux/slab.h> #include <linux/init.h> #include <linux/mutex.h> +#include <rdma/rdma_netlink.h> #include "core_priv.h"
@@ -736,8 +737,17 @@ static int __init ib_core_init(void) goto err_sysfs; } + ret =ibnl_init (); +if (ret) { +printk (KERN_WARNING "Couldn't init IB netlink interface\n" ); + goto err_cache; + } +return 0 ; +err_cache: +ib_cache_cleanup (); + err_sysfs:ib_sysfs_cleanup ();
@@ -748,6 +758,7 @@ err: static void __exit ib_core_cleanup(void) { +ibnl_cleanup ();ib_cache_cleanup ();ib_sysfs_cleanup ();/* Make sure that any pending umem accounting work is done. */
drivers/infiniband/core/netlink.c new file +190 -0
190 lines not on this page · raw message
include/linux/netlink.h +1 -0
@@ -24,6 +24,7 @@/* leave room for NETLINK_DM (DM Events) */ #define NETLINK_SCSITRANSPORT 18/* SCSI Transports */ #define NETLINK_ECRYPTFS 19 +#define NETLINK_INFINIBAND 20#define MAX_LINKS 32
include/rdma/rdma_netlink.h new file +64 -0
64 lines not on this page · raw message
Signature · 1 line
1.7.4.1
A message that is not in the archive (sent off-list or not yet received): 1305303525-11113-2-git-send-email-roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org
Quoted 2 lines · Roland Dreier
From: Roland Dreier <[email protected]> [Dave please do not apply even if this ends up in netdev patchwork!]
Just trivia:
drivers/infiniband/core/netlink.c
Quoted 1 line
drivers/infiniband/core/netlink.c +0
-0
[]
Quoted 1 line
+#define
pr_fmt(fmt)"%s:%s: " fmt,KBUILD_MODNAME,__func__
Using #define pr_fmt(fmt) KBUILD_MODNAME ":%s: " fmt, __func__ generally produces smaller overall object size, especially at 64 bit.
For instance, here's the size of netlink.o at 32 bit:
$ size drivers/infiniband/core/netlink.o.* text data bss dec hex filename 2663 153 736 3552 de0 drivers/infiniband/core/netlink.o.old 2640 153 736 3529 dc9 drivers/infiniband/core/netlink.o.new
Also, I rarely find __func__ useful in message output. It may be more useful for active development/debugging.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 16 lines · Joe Perches
Quoted 2 lines · Roland Dreier
From: Roland Dreier <[email protected]> [Dave please do not apply even if this ends up in netdev patchwork!]
Just trivia:
drivers/infiniband/core/netlink.c
Quoted 1 line
drivers/infiniband/core/netlink.c +0
-0[]
Quoted 1 line
+#define
pr_fmt(fmt)"%s:%s: " fmt,KBUILD_MODNAME,__func__Using #define
pr_fmt(fmt)KBUILD_MODNAME":%s: " fmt,__func__generally produces smaller overall object size, especially at 64 bit.For instance, here's the size of netlink.o at 32 bit:
Quoted 7 lines
$ size drivers/infiniband/core/netlink.o.* text data bss dec hex filename 2663 153 736 3552 de0 drivers/infiniband/core/netlink.o.old 2640 153 736 3529 dc9 drivers/infiniband/core/netlink.o.newAlso, I rarely find
__func__useful in message output. It may be more useful for active development/debugging.
A recent dynamic debug patch made it possible to enable/disable at runtime whether or not the function name (and more) should be included in the output. See also http://lwn.net/Articles/434833/ for more information.
Bart.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): BANLkTikpzn6R-QH__dtmwz=fO1QMUN+qag-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Quoted 17 lines · Bart Van Assche
Quoted 10 lines · Joe Perches
drivers/infiniband/core/netlink.c
Quoted 3 lines · Roland Dreier
From: Roland Dreier <[email protected]> [Dave please do not apply even if this ends up in netdev patchwork!]
drivers/infiniband/core/netlink.c +0
-0[]
Quoted 1 line
+#define
pr_fmt(fmt)"%s:%s: " fmt,KBUILD_MODNAME,__func__Using #define
pr_fmt(fmt)KBUILD_MODNAME":%s: " fmt,__func__generally produces smaller overall object size, especially at 64 bit.
For instance, here's the size of netlink.o at 32 bit:Quoted 6 lines
$ size drivers/infiniband/core/netlink.o.* text data bss dec hex filename 2663 153 736 3552 de0 drivers/infiniband/core/netlink.o.old 2640 153 736 3529 dc9 drivers/infiniband/core/netlink.o.new Also, I rarely find __func__ useful in message output. It may be more useful for active development/debugging.
Quoted 4 lines
A recent dynamic debug patch made it possible to enable/disable at runtime whether or not the function name (and more) should be included in the output. See also http://lwn.net/Articles/434833/ for more information.
One long term goal for me is a generic run-time mechanism to prefix all pr_<level> uses not just the <foo>_dbg ones with or without module or function name.
It will also allow the removal of all the uses of
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
New #define pr_fmt lines need to be added to the current files that use pr_<level> without a prefix so it could take awhile.
Eventually.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 10 lines · Joe Perches
Quoted 4 lines · Bart Van Assche
A recent dynamic debug patch made it possible to enable/disable at runtime whether or not the function name (and more) should be included in the output. See also http://lwn.net/Articles/434833/ for more information.
One long term goal for me is a generic run-time mechanism to prefix all pr_<level> uses not just the <foo>_dbg ones with or without module or function name.
Quoted 6 lines
It will also allow the removal of all the uses of #define
pr_fmt(fmt)KBUILD_MODNAME": " fmtNew #define
pr_fmtlines need to be added to the current files that use pr_<level> without a prefix so it could take awhile.
Something like the +m flag documented in
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=Documentation/dynamic-debug-howto.txt;hb=HEAD
?
Bart.
A message that is not in the archive (sent off-list or not yet received): BANLkTi=P7u2XPx+_F9d9waP5xuXqDYb5yQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
Quoted 10 lines · Bart Van Assche
Quoted 9 lines · Joe Perches
On Fri, 2011-05-13 at 19:18 +0200, Bart Van Assche wrote:
One long term goal for me is a generic run-time mechanism to prefix all pr_<level> uses not just the <foo>_dbg ones with or without module or function name.
It will also allow the removal of all the uses of #definepr_fmt(fmt)KBUILD_MODNAME": " fmt
New #definepr_fmtlines need to be added to the current files that use pr_<level> without a prefix so it could take awhile.
Quoted 3 lines
Something like the +m flag documented in
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=Documentation/dynamic-debug-howto.txt;hb=HEAD
?
Yes, akin to that, but using /proc not debugfs.
Basically, just per module on/off prefixing of
module name and optionally function name via aCONFIG_PR_LEVEL_STORE_FUNCTION_NAME.
I'd like to remove all current specific uses of__func__ in pr_<level> and use per module
/proc controls to add them back as requested.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 1 line
+#define
NETLINK_INFINIBAND20
Would NETLINK_RDMA be better?
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1828884A29C6694DAF28B7E6B8A82373F414-P5GAC/[email protected]
Quoted 3 lines · Sean
Quoted 1 line
+#define
NETLINK_INFINIBAND20Would
NETLINK_RDMAbe better?
Yes, I tried to change all the externally visible examples of IB to RDMA, but I missed that one (I figure internal kernel APIs can be cleaned up later). I'll update my tree.
- R.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1305303525-11113-1-git-send-email-roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org
RFC 2/3 RDMA/cma: Add support for netlink statistics export
From: Nir Muchtar <nirm-smomgflXvOZWk0Htik3J/[email protected]>
[Dave please do not apply even if this ends up in netdev patchwork!]
Add callbacks and data types for statistics export of all current devices/ids. The schema for RDMA CM is a series of netlink messages. Each one contains an rdma_cm_stat struct. Additionally, two netlink attributes are created for the addresses for each message (if applicable).
Their types used are:RDMA_NL_RDMA_CM_ATTR_SRC_ADDR (The source address for this ID) RDMA_NL_RDMA_CM_ATTR_DST_ADDR (The destination address for this ID) sockaddr_* structs are encapsulated within these attributes.
In other words, every transaction contains a series of messages like:
-------message 1-------
struct rdma_cm_id_stats {
__u32 qp_num;
__u32 bound_dev_if;
__u32 port_space;
__s32 pid;
__u8 cm_state;
__u8 node_type;
__u8 port_num;
__u8 reserved;
}RDMA_NL_RDMA_CM_ATTR_SRC_ADDR attribute - contains the source address RDMA_NL_RDMA_CM_ATTR_DST_ADDR attribute - contains the destination address -------end 1-------
-------message 2-------
struct rdma_cm_id_statsRDMA_NL_RDMA_CM_ATTR_SRC_ADDR attribute RDMA_NL_RDMA_CM_ATTR_DST_ADDR attribute
-------end 2-------
--- drivers/infiniband/core/cma.c | 98 +++++++++++++++++++++++++++++++++++++++++ include/rdma/rdma_netlink.h | 28 ++++++++++++ 2 files changed, 126 insertions(+), 0 deletions(-)
drivers/infiniband/core/cma.c +98 -0
@@ -47,6 +47,7 @@#include <rdma/rdma_cm.h> #include <rdma/rdma_cm_ib.h> +#include <rdma/rdma_netlink.h> #include <rdma/ib_cache.h> #include <rdma/ib_cm.h> #include <rdma/ib_sa.h>
@@ -3247,6 +3248,98 @@ static void cma_remove_one(struct ib_device *device)kfree (cma_dev); } +static int cma_get_id_stats (struct sk_buff *skb,struct netlink_callback *cb) +{ +struct nlmsghdr *nlh; +struct rdma_cm_id_stats *id_stats; +struct rdma_id_private *id_priv; +struct rdma_cm_id *id =NULL ; +struct cma_device *cma_dev; +int i_dev =0 , i_id =0 ; + +/* +* We export all of the IDs as a sequence of messages. Each +* ID gets its own netlink message. +*/ +mutex_lock (&lock); + +list_for_each_entry (cma_dev, &dev_list, list) { +if (i_dev < cb->args[0 ]) { + i_dev++; +continue ; + } + + i_id =0 ; +list_for_each_entry (id_priv, &cma_dev->id_list, list) { +if (i_id < cb->args[1 ]) { + i_id++; +continue ; + } + + id_stats =ibnl_put_msg (skb, &nlh, cb->nlh->nlmsg_seq, +sizeof *id_stats,RDMA_NL_RDMA_CM , +RDMA_NL_RDMA_CM_ID_STATS ); +if (!id_stats) + goto out; + +memset (id_stats,0 ,sizeof *id_stats); + id = &id_priv->id; + id_stats->node_type = id->route.addr.dev_addr.dev_type; + id_stats->port_num = id->port_num; + id_stats->bound_dev_if = + id->route.addr.dev_addr.bound_dev_if; + +if (id->route.addr.src_addr.ss_family ==AF_INET ) { +if (ibnl_put_attr (skb, nlh, +sizeof (struct sockaddr_in ), + &id->route.addr.src_addr, +RDMA_NL_RDMA_CM_ATTR_SRC_ADDR )) { + goto out; + } +if (ibnl_put_attr (skb, nlh, +sizeof (struct sockaddr_in ), + &id->route.addr.dst_addr, +RDMA_NL_RDMA_CM_ATTR_DST_ADDR )) { + goto out; + } + }else if (id->route.addr.src_addr.ss_family ==AF_INET6 ) { +if (ibnl_put_attr (skb, nlh, +sizeof (struct sockaddr_in6 ), + &id->route.addr.src_addr, +RDMA_NL_RDMA_CM_ATTR_SRC_ADDR )) { + goto out; + } +if (ibnl_put_attr (skb, nlh, +sizeof (struct sockaddr_in6 ), + &id->route.addr.dst_addr, +RDMA_NL_RDMA_CM_ATTR_DST_ADDR )) { + goto out; + } + } + + id_stats->port_space = id->ps; + id_stats->cm_state = id_priv->state; + id_stats->qp_num = id_priv->qp_num; + + i_id++; + } + + cb->args[1 ] =0 ; + i_dev++; + } + +out: +mutex_unlock (&lock); + cb->args[0 ] = i_dev; + cb->args[1 ] = i_id; + +return skb->len; +} + +static const struct ibnl_client_cbs cma_cb_table[] = { + [RDMA_NL_RDMA_CM_ID_STATS ] = { .dump = cma_get_id_stats }, +}; +static int __init cma_init (void ) {int ret;
@@ -3262,6 +3355,10 @@ static int __init cma_init(void) ret =ib_register_client (&cma_client);if (ret) goto err; + +if (ibnl_add_client (RDMA_NL_RDMA_CM ,RDMA_NL_RDMA_CM_NUM_OPS , cma_cb_table)) +printk (KERN_WARNING "RDMA CMA: failed to add netlink callback\n" ); +return 0 ; err:
@@ -3274,6 +3371,7 @@ err: static void __exit cma_cleanup(void) { +ibnl_remove_client (RDMA_NL_RDMA_CM );ib_unregister_client (&cma_client);unregister_netdevice_notifier (&cma_nb);rdma_addr_unregister_client (&addr_client);
include/rdma/rdma_netlink.h +28 -0
@@ -1,10 +1,38 @@#ifndef _RDMA_NETLINK_H#define _RDMA_NETLINK_H +#include <linux/types.h> + +enum { +RDMA_NL_RDMA_CM =1 +}; +#define RDMA_NL_GET_CLIENT (type) ((type & (((1 << 6) - 1) << 10)) >> 10)#define RDMA_NL_GET_OP (type) (type & ((1 << 10) - 1))#define RDMA_NL_GET_TYPE (client, op) ((client << 10) + op) +enum { +RDMA_NL_RDMA_CM_ID_STATS =0 , +RDMA_NL_RDMA_CM_NUM_OPS +}; + +enum { +RDMA_NL_RDMA_CM_ATTR_SRC_ADDR =1 , +RDMA_NL_RDMA_CM_ATTR_DST_ADDR , +RDMA_NL_RDMA_CM_NUM_ATTR , +}; + +struct rdma_cm_id_stats { +__u32 qp_num; +__u32 bound_dev_if; +__u32 port_space; +__s32 pid; +__u8 cm_state; +__u8 node_type; +__u8 port_num; +__u8 reserved; +}; +#ifdef __KERNEL__#include <linux/netlink.h>
Signature · 6 lines
1.7.4.1 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [RFC 2/3] RDMA/cma: Add support for netlink statistics export
include/rdma/rdma_netlink.h line 34
Quoted 10 lines
include/rdma/rdma_netlink.h +10
-0+struct rdma_cm_id_stats { +__u32 qp_num; +__u32 bound_dev_if; +__u32 port_space; +__s32 pid; +__u8 cm_state; +__u8 node_type; +__u8 port_num; +__u8 reserved; +};
We may also want to add qp_type
A message that is not in the archive (sent off-list or not yet received): 1828884A29C6694DAF28B7E6B8A82373F428-P5GAC/[email protected]
Re: [RFC 2/3] RDMA/cma: Add support for netlink statistics export
Quoted 4 lines · Sean
Quoted 4 lines
include/rdma/rdma_netlink.h +4
-0+struct rdma_cm_id_stats { +__u32 qp_num; +__u32 bound_dev_if; +__u32 port_space;
Quoted 8 lines
include/rdma/rdma_netlink.h line 34
Quoted 6 lines
include/rdma/rdma_netlink.h +6
-0+__s32 pid; +__u8 cm_state; +__u8 node_type; +__u8 port_num; +__u8 reserved; +};We may also want to add
qp_type
Sean,
Isn't the port space enough here? specifically, what qp type buys us over port space?
Or.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 4DD0DAB2.1080600-VPRAkNaXOzVWk0Htik3J/[email protected]
RE: [RFC 2/3] RDMA/cma: Add support for netlink statistics export
Quoted 2 lines
Isn't the port space enough here? specifically, what qp type buys us over port space?
That assumes a 1:1 relationship between the port space and QP type, or more specifically, that the IB SID range is divided based on QP type. This is outside of the architecture. If we look at UC or XRC, it's not clear what port space those map to, but I believe it's desirable for the rdma_cm to support those. Note that the AF_IB patch set ended up requiring that the user specify the qp type for these reasons.
- Sean
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1828884A29C6694DAF28B7E6B8A82373F654-P5GAC/[email protected]
Re: [RFC 2/3] RDMA/cma: Add support for netlink statistics export
Quoted 4 lines · Sean
That assumes a 1:1 relationship between the port space and QP type, or more specifically, that the IB SID range is divided based on QP type. This is outside of the architecture. If we look at UC or XRC, it's not clear what port space those map to, but I believe it's desirable for the
rdma_cmto support those.
makes sense, so we can add the qp type here.
Or.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC 2/3] RDMA/cma: Add support for netlink statistics export
In reply to a message not in the archiveQuoted 4 lines · Sean
Quoted 4 lines
+struct
rdma_cm_id_stats{
+__u32qp_num;
+__u32bound_dev_if;
+__u32port_space;
Quoted 8 lines
Quoted 6 lines
+
__s32pid;
+__u8cm_state;
+__u8node_type;
+__u8port_num;
+__u8reserved;
+};We may also want to add
qp_type
Is there an easy way to get the qp_type from a struct rdma_cm_id?
ie what code needs to go into cma_get_id_stats() to handle this?
Thanks,
Roland
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [RFC 2/3] RDMA/cma: Add support for netlink statistics export
Quoted 3 lines
Is there an easy way to get the
qp_typefrom a structrdma_cm_id?ie what code needs to go into
cma_get_id_stats()to handle this?
With the current code, you'd need to map from the port space:
static inline enum ib_qp_type cma_get_qp_type(struct rdma_cm_id *id)
{
if (id->ps == RDMA_PS_IPOIB || id->ps == RDMA_PS_UDP)
return IB_QPT_RC;
else
return IB_QPT_RC;
}.. id_stats->qp_type = cma_get_qp_type(id); ..
One of the patches in the af_ib patch set adds the qp_type to struct rdma_cm_id. I'm guessing that patch will also be needed for xrc.
- Sean
A message that is not in the archive (sent off-list or not yet received): 1828884A29C6694DAF28B7E6B8A82373FF9E-P5GAC/[email protected]
Re: [RFC 2/3] RDMA/cma: Add support for netlink statistics export
Quoted 1 line · Sean
One of the patches in the
af_ibpatch set adds theqp_typeto structrdma_cm_id. I'm guessing that patch will also be needed for xrc.
Would it make sense to pull that patch at least in?
Sorry I haven't had time to really think about AF_IB in general but maybe I can at least merge the netlink stuff this cycle?
- R.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC 2/3] RDMA/cma: Add support for netlink statistics export
Quoted 7 lines · Roland Dreier
Quoted 1 line · Sean
One of the patches in the
af_ibpatch set adds theqp_typeto structrdma_cm_id. I'm guessing that patch will also be needed for xrc.Would it make sense to pull that patch at least in?
Sorry I haven't had time to really think about
AF_IBin general but maybe I can at least merge the netlink stuff this cycle?
And actually looking at https://patchwork.kernel.org/patch/90204/
it looks reasonable to merge now... or I could just use cma_is_ud_ps() in the netlink stuff.
I'm inclined to just take your patch now if that makes sense to you (it looks pretty independent of everything else)
Is that the latest version in patchwork?
Thanks,
- R.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): BANLkTimjhAVfpJQX-PshVBgcshzfh-taRw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org
RE: [RFC 2/3] RDMA/cma: Add support for netlink statistics export
Quoted 8 lines
And actually looking at https://patchwork.kernel.org/patch/90204/
it looks reasonable to merge now... or I could just usecma_is_ud_ps()in the netlink stuff.I'm inclined to just take your patch now if that makes sense to you (it looks pretty independent of everything else)
Is that the latest version in patchwork?
The only difference that I see between that patch and what's in my tree are the line numbers. The patch looks safe enough to me to go in separately from anything else. Thanks
- Sean
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
RFC 3/3 RDMA/cma: Save PID of ID's owner
In reply to Roland DreierFrom: Nir Muchtar <[email protected]>
[Dave please do not apply even if this ends up in netdev patchwork!]
Save the PID associated with an RDMA CM ID for reporting via netlink.
--- drivers/infiniband/core/cma.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
drivers/infiniband/core/cma.c +6 -0
@@ -133,6 +133,7 @@ struct rdma_id_private {u32 seq_num;u32 qkey;u32 qp_num; +pid_t owner;u8 srq;u8 tos; };
@@ -423,6 +424,7 @@ struct rdma_cm_id *rdma_create_id(rdma_cm_event_handler event_handler,if (!id_priv)return ERR_PTR (-ENOMEM ); + id_priv->owner =task_pid_nr (current); id_priv->state =RDMA_CM_IDLE ; id_priv->id.context = context; id_priv->id.event_handler = event_handler;
@@ -2678,6 +2680,9 @@ int rdma_accept(struct rdma_cm_id *id, struct rdma_conn_param *conn_param)int ret; id_priv = container_of(id, struct rdma_id_private, id); + + id_priv->owner =task_pid_nr (current); +if (!cma_comp (id_priv,RDMA_CM_CONNECT ))return -EINVAL ;
@@ -3320,6 +3325,7 @@ static int cma_get_id_stats(struct sk_buff *skb, struct netlink_callback *cb) id_stats->port_space = id->ps; id_stats->cm_state = id_priv->state; id_stats->qp_num = id_priv->qp_num; + id_stats->pid = id_priv->owner; i_id++; }
Signature · 1 line
1.7.4.1