mbox series

[0/3] Add RDMA_NLDEV_GET_CHARDEV

Message ID 20190605183252.6687-1-jgg@ziepe.ca (mailing list archive)
Headers show
Series Add RDMA_NLDEV_GET_CHARDEV | expand

Message

Jason Gunthorpe June 5, 2019, 6:32 p.m. UTC
From: Jason Gunthorpe <jgg@mellanox.com>

This allows userspace to ask the kernel for information on a specific char
device implemented under the RDMA subsytem. For instance the kernel can ask
for details on the uverbs0 chardev related to the mlx5_0 device.

The resulting information is enough for libibverbs/etc to connect to the
device without having to rely on sysfs.

By using netlink this also supports automatic module loading. When userspace
requests for a chardev that is not yet loaded, the kernel will load it, bind
it to the device, and then return back.

For uverbs the DRIVER_ID is returned in the GET_CHARDEV response. This allows
libibverbs to bind drivers by ID instead of using modalias, or worse, the
device name. This also fixes the problem where siw and rxe devices cannot be
renamed.

Only three drivers do not support this mechanism because their probe in
userspace is too complicated (hns, mthca, cxgb3). As only hns is a current
product, it should be revised to support DRIVER_ID matching.

While the kernel side is fairly simple, the userspace is big and needs some
more time to test:

https://github.com/linux-rdma/rdma-core/pull/539

Jason Gunthorpe (3):
  RDMA: Move rdma_node_type to uapi/
  RDMA: Add NLDEV_GET_CHARDEV to allow char dev discovery and autoload
  RDMA: Report available cdevs through RDMA_NLDEV_CMD_GET_CHARDEV

 drivers/infiniband/core/core_priv.h          |  9 ++
 drivers/infiniband/core/device.c             | 91 ++++++++++++++++++++
 drivers/infiniband/core/nldev.c              | 91 ++++++++++++++++++++
 drivers/infiniband/core/ucma.c               | 23 +++++
 drivers/infiniband/core/user_mad.c           | 51 ++++++++++-
 drivers/infiniband/core/uverbs_main.c        | 32 ++++++-
 drivers/infiniband/core/verbs.c              |  2 +-
 drivers/infiniband/hw/cxgb3/iwch_provider.c  |  1 +
 drivers/infiniband/hw/hns/hns_roce_main.c    |  1 +
 drivers/infiniband/hw/mthca/mthca_provider.c |  1 +
 include/rdma/ib_verbs.h                      | 18 ++--
 include/rdma/rdma_netlink.h                  |  2 +
 include/uapi/rdma/rdma_netlink.h             | 23 +++++
 13 files changed, 327 insertions(+), 18 deletions(-)