Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Leon Romanovsky and committed by
Jason Gunthorpe
a78e8723 bf3b4f06

+3 -101
-83
drivers/infiniband/core/cma.c
··· 4616 4616 kfree(cma_dev); 4617 4617 } 4618 4618 4619 - static 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 - 4686 - out: 4687 - mutex_unlock(&lock); 4688 - cb->args[0] = i_dev; 4689 - cb->args[1] = i_id; 4690 - 4691 - return skb->len; 4692 - } 4693 - 4694 - static 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 - 4698 4619 static int cma_init_net(struct net *net) 4699 4620 { 4700 4621 struct cma_pernet *pernet = cma_pernet(net); ··· 4664 4743 if (ret) 4665 4744 goto err; 4666 4745 4667 - rdma_nl_register(RDMA_NL_RDMA_CM, cma_cb_table); 4668 4746 cma_configfs_init(); 4669 4747 4670 4748 return 0; ··· 4679 4759 static void __exit cma_cleanup(void) 4680 4760 { 4681 4761 cma_configfs_exit(); 4682 - rdma_nl_unregister(RDMA_NL_RDMA_CM); 4683 4762 ib_unregister_client(&cma_client); 4684 4763 unregister_netdevice_notifier(&cma_nb); 4685 4764 ib_sa_unregister_client(&sa_client); 4686 4765 unregister_pernet_subsys(&cma_pernet_operations); 4687 4766 destroy_workqueue(cma_wq); 4688 4767 } 4689 - 4690 - MODULE_ALIAS_RDMA_NETLINK(RDMA_NL_RDMA_CM, 1); 4691 4768 4692 4769 module_init(cma_init); 4693 4770 module_exit(cma_cleanup);
+1 -3
drivers/infiniband/core/netlink.c
··· 56 56 static bool is_nl_msg_valid(unsigned int type, unsigned int op) 57 57 { 58 58 static const unsigned int max_num_ops[RDMA_NL_NUM_CLIENTS] = { 59 - [RDMA_NL_RDMA_CM] = RDMA_NL_RDMA_CM_NUM_OPS, 60 59 [RDMA_NL_IWCM] = RDMA_NL_IWPM_NUM_OPS, 61 60 [RDMA_NL_LS] = RDMA_NL_LS_NUM_OPS, 62 61 [RDMA_NL_NLDEV] = RDMA_NLDEV_NUM_OPS, ··· 180 181 return -EINVAL; 181 182 } 182 183 /* FIXME: Convert IWCM to properly handle doit callbacks */ 183 - if ((nlh->nlmsg_flags & NLM_F_DUMP) || index == RDMA_NL_RDMA_CM || 184 - index == RDMA_NL_IWCM) { 184 + if ((nlh->nlmsg_flags & NLM_F_DUMP) || index == RDMA_NL_IWCM) { 185 185 struct netlink_dump_control c = { 186 186 .dump = cb_table[op].dump, 187 187 };
+2 -15
include/uapi/rdma/rdma_netlink.h
··· 5 5 #include <linux/types.h> 6 6 7 7 enum { 8 - RDMA_NL_RDMA_CM = 1, 9 - RDMA_NL_IWCM, 8 + RDMA_NL_IWCM = 2, 10 9 RDMA_NL_RSVD, 11 10 RDMA_NL_LS, /* RDMA Local Services */ 12 11 RDMA_NL_NLDEV, /* RDMA device interface */ ··· 13 14 }; 14 15 15 16 enum { 16 - RDMA_NL_GROUP_CM = 1, 17 - RDMA_NL_GROUP_IWPM, 17 + RDMA_NL_GROUP_IWPM = 2, 18 18 RDMA_NL_GROUP_LS, 19 19 RDMA_NL_NUM_GROUPS 20 20 }; ··· 21 23 #define RDMA_NL_GET_CLIENT(type) ((type & (((1 << 6) - 1) << 10)) >> 10) 22 24 #define RDMA_NL_GET_OP(type) (type & ((1 << 10) - 1)) 23 25 #define RDMA_NL_GET_TYPE(client, op) ((client << 10) + op) 24 - 25 - enum { 26 - RDMA_NL_RDMA_CM_ID_STATS = 0, 27 - RDMA_NL_RDMA_CM_NUM_OPS 28 - }; 29 - 30 - enum { 31 - RDMA_NL_RDMA_CM_ATTR_SRC_ADDR = 1, 32 - RDMA_NL_RDMA_CM_ATTR_DST_ADDR, 33 - RDMA_NL_RDMA_CM_NUM_ATTR, 34 - }; 35 26 36 27 /* The minimum version that the iwpm kernel supports */ 37 28 #define IWPM_UABI_VERSION_MIN 3