History

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.

Jason Gunthorpe committed 7 years ago

Commit 0e2d00e1 parent 5d60c116 files · +221 −0Browse files

Showing the changes to include/uapi (1 of 6 files). Show all

Unified · Split

include/uapi/rdma/rdma_netlink.h+14−0
@@ -279,6 +279,8 @@ enum rdma_nldev_command { · 278 unmodified lines
279 279
280 RDMA_NLDEV_CMD_RES_PD_GET, /* can dump */280 RDMA_NLDEV_CMD_RES_PD_GET, /* can dump */
281 281
282 RDMA_NLDEV_CMD_GET_CHARDEV,
283
282 RDMA_NLDEV_NUM_OPS284 RDMA_NLDEV_NUM_OPS
283};285};
284 286
@@ -491,6 +493,18 @@ enum rdma_nldev_attr { · 206 unmodified lines
491 */493 */
492 RDMA_NLDEV_NET_NS_FD, /* u32 */494 RDMA_NLDEV_NET_NS_FD, /* u32 */
493 495
496 /*
497 * Information about a chardev.
498 * CHARDEV_TYPE is the name of the chardev ABI (ie uverbs, umad, etc)
499 * CHARDEV_ABI signals the ABI revision (historical)
500 * CHARDEV_NAME is the kernel name for the /dev/ file (no directory)
501 * CHARDEV is the 64 bit dev_t for the inode
502 */
503 RDMA_NLDEV_ATTR_CHARDEV_TYPE, /* string */
504 RDMA_NLDEV_ATTR_CHARDEV_NAME, /* string */
505 RDMA_NLDEV_ATTR_CHARDEV_ABI, /* u64 */
506 RDMA_NLDEV_ATTR_CHARDEV, /* u64 */
507
494 /*508 /*
495 * Always the end509 * Always the end
496 */510 */