aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeon Romanovsky <leonro@mellanox.com>2019-01-16 02:55:41 -0500
committerJason Gunthorpe <jgg@mellanox.com>2019-02-05 17:30:33 -0500
commita78e8723a50530d15faa25cc0b6f009bcd251c20 (patch)
tree66527f6a7f13090ebc337b82beb167d41beb3455
parentbf3b4f066d992718b1f86f21249d6781fdc8340d (diff)
RDMA/cma: Remove CM_ID statistics provided by rdma-cm module
Netlink statistics exported by rdma-cm never had any working user space component published to the mailing list or to any open source project. Canvassing various proprietary users, and the original requester, we find that there are no real users of this interface. This patch simply removes all occurrences of RDMA CM netlink in favour of modern nldev implementation, which provides the same information and accompanied by widely used user space component. Signed-off-by: Leon Romanovsky <leonro@mellanox.com> Reviewed-by: Steve Wise <swise@opengridcomputing.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
-rw-r--r--drivers/infiniband/core/cma.c83
-rw-r--r--drivers/infiniband/core/netlink.c4
-rw-r--r--include/uapi/rdma/rdma_netlink.h17
3 files changed, 3 insertions, 101 deletions
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index 81bded0d37d1..e15546ae4d0f 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -4616,85 +4616,6 @@ static void cma_remove_one(struct ib_device *device, void *client_data)
4616 kfree(cma_dev); 4616 kfree(cma_dev);
4617} 4617}
4618 4618
4619static int cma_get_id_stats(struct sk_buff *skb, struct netlink_callback *cb)
4620{
4621 struct nlmsghdr *nlh;
4622 struct rdma_cm_id_stats *id_stats;
4623 struct rdma_id_private *id_priv;
4624 struct rdma_cm_id *id = NULL;
4625 struct cma_device *cma_dev;
4626 int i_dev = 0, i_id = 0;
4627
4628 /*
4629 * We export all of the IDs as a sequence of messages. Each
4630 * ID gets its own netlink message.
4631 */
4632 mutex_lock(&lock);
4633
4634 list_for_each_entry(cma_dev, &dev_list, list) {
4635 if (i_dev < cb->args[0]) {
4636 i_dev++;
4637 continue;
4638 }
4639
4640 i_id = 0;
4641 list_for_each_entry(id_priv, &cma_dev->id_list, list) {
4642 if (i_id < cb->args[1]) {
4643 i_id++;
4644 continue;
4645 }
4646
4647 id_stats = ibnl_put_msg(skb, &nlh, cb->nlh->nlmsg_seq,
4648 sizeof *id_stats, RDMA_NL_RDMA_CM,
4649 RDMA_NL_RDMA_CM_ID_STATS,
4650 NLM_F_MULTI);
4651 if (!id_stats)
4652 goto out;
4653
4654 memset(id_stats, 0, sizeof *id_stats);
4655 id = &id_priv->id;
4656 id_stats->node_type = id->route.addr.dev_addr.dev_type;
4657 id_stats->port_num = id->port_num;
4658 id_stats->bound_dev_if =
4659 id->route.addr.dev_addr.bound_dev_if;
4660
4661 if (ibnl_put_attr(skb, nlh,
4662 rdma_addr_size(cma_src_addr(id_priv)),
4663 cma_src_addr(id_priv),
4664 RDMA_NL_RDMA_CM_ATTR_SRC_ADDR))
4665 goto out;
4666 if (ibnl_put_attr(skb, nlh,
4667 rdma_addr_size(cma_dst_addr(id_priv)),
4668 cma_dst_addr(id_priv),
4669 RDMA_NL_RDMA_CM_ATTR_DST_ADDR))
4670 goto out;
4671
4672 id_stats->pid = task_pid_vnr(id_priv->res.task);
4673 id_stats->port_space = id->ps;
4674 id_stats->cm_state = id_priv->state;
4675 id_stats->qp_num = id_priv->qp_num;
4676 id_stats->qp_type = id->qp_type;
4677
4678 i_id++;
4679 nlmsg_end(skb, nlh);
4680 }
4681
4682 cb->args[1] = 0;
4683 i_dev++;
4684 }
4685
4686out:
4687 mutex_unlock(&lock);
4688 cb->args[0] = i_dev;
4689 cb->args[1] = i_id;
4690
4691 return skb->len;
4692}
4693
4694static const struct rdma_nl_cbs cma_cb_table[RDMA_NL_RDMA_CM_NUM_OPS] = {
4695 [RDMA_NL_RDMA_CM_ID_STATS] = { .dump = cma_get_id_stats},
4696};
4697
4698static int cma_init_net(struct net *net) 4619static int cma_init_net(struct net *net)
4699{ 4620{
4700 struct cma_pernet *pernet = cma_pernet(net); 4621 struct cma_pernet *pernet = cma_pernet(net);
@@ -4743,7 +4664,6 @@ static int __init cma_init(void)
4743 if (ret) 4664 if (ret)
4744 goto err; 4665 goto err;
4745 4666
4746 rdma_nl_register(RDMA_NL_RDMA_CM, cma_cb_table);
4747 cma_configfs_init(); 4667 cma_configfs_init();
4748 4668
4749 return 0; 4669 return 0;
@@ -4759,7 +4679,6 @@ err_wq:
4759static void __exit cma_cleanup(void) 4679static void __exit cma_cleanup(void)
4760{ 4680{
4761 cma_configfs_exit(); 4681 cma_configfs_exit();
4762 rdma_nl_unregister(RDMA_NL_RDMA_CM);
4763 ib_unregister_client(&cma_client); 4682 ib_unregister_client(&cma_client);
4764 unregister_netdevice_notifier(&cma_nb); 4683 unregister_netdevice_notifier(&cma_nb);
4765 ib_sa_unregister_client(&sa_client); 4684 ib_sa_unregister_client(&sa_client);
@@ -4767,7 +4686,5 @@ static void __exit cma_cleanup(void)
4767 destroy_workqueue(cma_wq); 4686 destroy_workqueue(cma_wq);
4768} 4687}
4769 4688
4770MODULE_ALIAS_RDMA_NETLINK(RDMA_NL_RDMA_CM, 1);
4771
4772module_init(cma_init); 4689module_init(cma_init);
4773module_exit(cma_cleanup); 4690module_exit(cma_cleanup);
diff --git a/drivers/infiniband/core/netlink.c b/drivers/infiniband/core/netlink.c
index 724f5a62e82f..eecfc0b377c9 100644
--- a/drivers/infiniband/core/netlink.c
+++ b/drivers/infiniband/core/netlink.c
@@ -56,7 +56,6 @@ EXPORT_SYMBOL(rdma_nl_chk_listeners);
56static bool is_nl_msg_valid(unsigned int type, unsigned int op) 56static bool is_nl_msg_valid(unsigned int type, unsigned int op)
57{ 57{
58 static const unsigned int max_num_ops[RDMA_NL_NUM_CLIENTS] = { 58 static const unsigned int max_num_ops[RDMA_NL_NUM_CLIENTS] = {
59 [RDMA_NL_RDMA_CM] = RDMA_NL_RDMA_CM_NUM_OPS,
60 [RDMA_NL_IWCM] = RDMA_NL_IWPM_NUM_OPS, 59 [RDMA_NL_IWCM] = RDMA_NL_IWPM_NUM_OPS,
61 [RDMA_NL_LS] = RDMA_NL_LS_NUM_OPS, 60 [RDMA_NL_LS] = RDMA_NL_LS_NUM_OPS,
62 [RDMA_NL_NLDEV] = RDMA_NLDEV_NUM_OPS, 61 [RDMA_NL_NLDEV] = RDMA_NLDEV_NUM_OPS,
@@ -181,8 +180,7 @@ static int rdma_nl_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh,
181 return -EINVAL; 180 return -EINVAL;
182 } 181 }
183 /* FIXME: Convert IWCM to properly handle doit callbacks */ 182 /* FIXME: Convert IWCM to properly handle doit callbacks */
184 if ((nlh->nlmsg_flags & NLM_F_DUMP) || index == RDMA_NL_RDMA_CM || 183 if ((nlh->nlmsg_flags & NLM_F_DUMP) || index == RDMA_NL_IWCM) {
185 index == RDMA_NL_IWCM) {
186 struct netlink_dump_control c = { 184 struct netlink_dump_control c = {
187 .dump = cb_table[op].dump, 185 .dump = cb_table[op].dump,
188 }; 186 };
diff --git a/include/uapi/rdma/rdma_netlink.h b/include/uapi/rdma/rdma_netlink.h
index 0f5263767fb4..3a9e681e4257 100644
--- a/include/uapi/rdma/rdma_netlink.h
+++ b/include/uapi/rdma/rdma_netlink.h
@@ -5,8 +5,7 @@
5#include <linux/types.h> 5#include <linux/types.h>
6 6
7enum { 7enum {
8 RDMA_NL_RDMA_CM = 1, 8 RDMA_NL_IWCM = 2,
9 RDMA_NL_IWCM,
10 RDMA_NL_RSVD, 9 RDMA_NL_RSVD,
11 RDMA_NL_LS, /* RDMA Local Services */ 10 RDMA_NL_LS, /* RDMA Local Services */
12 RDMA_NL_NLDEV, /* RDMA device interface */ 11 RDMA_NL_NLDEV, /* RDMA device interface */
@@ -14,8 +13,7 @@ enum {
14}; 13};
15 14
16enum { 15enum {
17 RDMA_NL_GROUP_CM = 1, 16 RDMA_NL_GROUP_IWPM = 2,
18 RDMA_NL_GROUP_IWPM,
19 RDMA_NL_GROUP_LS, 17 RDMA_NL_GROUP_LS,
20 RDMA_NL_NUM_GROUPS 18 RDMA_NL_NUM_GROUPS
21}; 19};
@@ -24,17 +22,6 @@ enum {
24#define RDMA_NL_GET_OP(type) (type & ((1 << 10) - 1)) 22#define RDMA_NL_GET_OP(type) (type & ((1 << 10) - 1))
25#define RDMA_NL_GET_TYPE(client, op) ((client << 10) + op) 23#define RDMA_NL_GET_TYPE(client, op) ((client << 10) + op)
26 24
27enum {
28 RDMA_NL_RDMA_CM_ID_STATS = 0,
29 RDMA_NL_RDMA_CM_NUM_OPS
30};
31
32enum {
33 RDMA_NL_RDMA_CM_ATTR_SRC_ADDR = 1,
34 RDMA_NL_RDMA_CM_ATTR_DST_ADDR,
35 RDMA_NL_RDMA_CM_NUM_ATTR,
36};
37
38/* The minimum version that the iwpm kernel supports */ 25/* The minimum version that the iwpm kernel supports */
39#define IWPM_UABI_VERSION_MIN 3 26#define IWPM_UABI_VERSION_MIN 3
40 27