]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
RDMA/cma: Remove CM_ID statistics provided by rdma-cm module
authorLeon Romanovsky <leonro@mellanox.com>
Wed, 16 Jan 2019 07:55:41 +0000 (09:55 +0200)
committerJason Gunthorpe <jgg@mellanox.com>
Tue, 5 Feb 2019 22:30:33 +0000 (15:30 -0700)
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>
drivers/infiniband/core/cma.c
drivers/infiniband/core/netlink.c
include/uapi/rdma/rdma_netlink.h

index 81bded0d37d1e798daa0fa8f902b213dab32c874..e15546ae4d0f0c5cfceda9407ab8c2919df866a0 100644 (file)
@@ -4616,85 +4616,6 @@ static void cma_remove_one(struct ib_device *device, void *client_data)
        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,
-                                               NLM_F_MULTI);
-                       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 (ibnl_put_attr(skb, nlh,
-                                         rdma_addr_size(cma_src_addr(id_priv)),
-                                         cma_src_addr(id_priv),
-                                         RDMA_NL_RDMA_CM_ATTR_SRC_ADDR))
-                               goto out;
-                       if (ibnl_put_attr(skb, nlh,
-                                         rdma_addr_size(cma_dst_addr(id_priv)),
-                                         cma_dst_addr(id_priv),
-                                         RDMA_NL_RDMA_CM_ATTR_DST_ADDR))
-                               goto out;
-
-                       id_stats->pid   = task_pid_vnr(id_priv->res.task);
-                       id_stats->port_space    = id->ps;
-                       id_stats->cm_state      = id_priv->state;
-                       id_stats->qp_num        = id_priv->qp_num;
-                       id_stats->qp_type       = id->qp_type;
-
-                       i_id++;
-                       nlmsg_end(skb, nlh);
-               }
-
-               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 rdma_nl_cbs cma_cb_table[RDMA_NL_RDMA_CM_NUM_OPS] = {
-       [RDMA_NL_RDMA_CM_ID_STATS] = { .dump = cma_get_id_stats},
-};
-
 static int cma_init_net(struct net *net)
 {
        struct cma_pernet *pernet = cma_pernet(net);
@@ -4743,7 +4664,6 @@ static int __init cma_init(void)
        if (ret)
                goto err;
 
-       rdma_nl_register(RDMA_NL_RDMA_CM, cma_cb_table);
        cma_configfs_init();
 
        return 0;
@@ -4759,7 +4679,6 @@ static int __init cma_init(void)
 static void __exit cma_cleanup(void)
 {
        cma_configfs_exit();
-       rdma_nl_unregister(RDMA_NL_RDMA_CM);
        ib_unregister_client(&cma_client);
        unregister_netdevice_notifier(&cma_nb);
        ib_sa_unregister_client(&sa_client);
@@ -4767,7 +4686,5 @@ static void __exit cma_cleanup(void)
        destroy_workqueue(cma_wq);
 }
 
-MODULE_ALIAS_RDMA_NETLINK(RDMA_NL_RDMA_CM, 1);
-
 module_init(cma_init);
 module_exit(cma_cleanup);
index 724f5a62e82f8ca40d8a00cf6390e426b1ec60ba..eecfc0b377c9876f99f5510122031c896060582a 100644 (file)
@@ -56,7 +56,6 @@ EXPORT_SYMBOL(rdma_nl_chk_listeners);
 static bool is_nl_msg_valid(unsigned int type, unsigned int op)
 {
        static const unsigned int max_num_ops[RDMA_NL_NUM_CLIENTS] = {
-               [RDMA_NL_RDMA_CM] = RDMA_NL_RDMA_CM_NUM_OPS,
                [RDMA_NL_IWCM] = RDMA_NL_IWPM_NUM_OPS,
                [RDMA_NL_LS] = RDMA_NL_LS_NUM_OPS,
                [RDMA_NL_NLDEV] = RDMA_NLDEV_NUM_OPS,
@@ -181,8 +180,7 @@ static int rdma_nl_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh,
                return -EINVAL;
        }
        /* FIXME: Convert IWCM to properly handle doit callbacks */
-       if ((nlh->nlmsg_flags & NLM_F_DUMP) || index == RDMA_NL_RDMA_CM ||
-           index == RDMA_NL_IWCM) {
+       if ((nlh->nlmsg_flags & NLM_F_DUMP) || index == RDMA_NL_IWCM) {
                struct netlink_dump_control c = {
                        .dump = cb_table[op].dump,
                };
index 0f5263767fb4f0b43a439eafb4c88a7b0d2ccc1c..3a9e681e4257be750f695ad88722af5848637011 100644 (file)
@@ -5,8 +5,7 @@
 #include <linux/types.h>
 
 enum {
-       RDMA_NL_RDMA_CM = 1,
-       RDMA_NL_IWCM,
+       RDMA_NL_IWCM = 2,
        RDMA_NL_RSVD,
        RDMA_NL_LS,     /* RDMA Local Services */
        RDMA_NL_NLDEV,  /* RDMA device interface */
@@ -14,8 +13,7 @@ enum {
 };
 
 enum {
-       RDMA_NL_GROUP_CM = 1,
-       RDMA_NL_GROUP_IWPM,
+       RDMA_NL_GROUP_IWPM = 2,
        RDMA_NL_GROUP_LS,
        RDMA_NL_NUM_GROUPS
 };
@@ -24,17 +22,6 @@ enum {
 #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,
-};
-
 /* The minimum version that the iwpm kernel supports */
 #define IWPM_UABI_VERSION_MIN  3