RDMA: Add NLDEV_GET_CHARDEV to allow char dev discovery and autoload

Allow userspace to issue a netlink query against the ib_device for
something like "uverbs" and get back the char dev name, inode major/minor,
and interface ABI information for "uverbs0".

Since we are now in netlink this can also trigger a module autoload to
make the uverbs device come into existence.

Largely this will let us replace searching and reading inside sysfs to
setup devices, and provides an alternative (using driver_id) to device
name based provider binding for things like rxe.

Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
This commit is contained in:
Jason Gunthorpe 2019-06-13 21:38:18 -03:00 committed by Doug Ledford
parent 5d60c11154
commit 0e2d00eb6f
6 changed files with 221 additions and 0 deletions

View file

@ -279,6 +279,8 @@ enum rdma_nldev_command {
RDMA_NLDEV_CMD_RES_PD_GET, /* can dump */
RDMA_NLDEV_CMD_GET_CHARDEV,
RDMA_NLDEV_NUM_OPS
};
@ -491,6 +493,18 @@ enum rdma_nldev_attr {
*/
RDMA_NLDEV_NET_NS_FD, /* u32 */
/*
* Information about a chardev.
* CHARDEV_TYPE is the name of the chardev ABI (ie uverbs, umad, etc)
* CHARDEV_ABI signals the ABI revision (historical)
* CHARDEV_NAME is the kernel name for the /dev/ file (no directory)
* CHARDEV is the 64 bit dev_t for the inode
*/
RDMA_NLDEV_ATTR_CHARDEV_TYPE, /* string */
RDMA_NLDEV_ATTR_CHARDEV_NAME, /* string */
RDMA_NLDEV_ATTR_CHARDEV_ABI, /* u64 */
RDMA_NLDEV_ATTR_CHARDEV, /* u64 */
/*
* Always the end
*/