[PATCH rdma-next 2/5] RDMA/irdma: Register irdma UVERBS ioctl namespace

From: David Hu

Date: Sat Oct 10 2026 - 21:12:18 EST


From: David Hu <xuehaohu@xxxxxxxxxx>

An irdma UVERBS module is now created. An irdma
specific shadow buf is defined for CQ, while QP and
SRQ reuses core's uapi definitions. This works since
core builds shared core ioctl parsing tree first,
before adding driver specific `uapi_definition`.

Destroy paths are automatically handled by core
dispatchers, as objects are now registered in the
parsing tree and no additional driver specifics are
needed in destroy ioctls. Resize, Query, and Modify
continue to go through write() cmds.

Signed-off-by: David Hu <xuehaohu@xxxxxxxxxx>
---
drivers/infiniband/hw/irdma/verbs.c | 18 ++++++++++++++++++
include/uapi/rdma/irdma-abi.h | 5 +++++
2 files changed, 23 insertions(+)

diff --git a/drivers/infiniband/hw/irdma/verbs.c b/drivers/infiniband/hw/irdma/verbs.c
index 10c790fdfc57..b2ffdc8e3d67 100644
--- a/drivers/infiniband/hw/irdma/verbs.c
+++ b/drivers/infiniband/hw/irdma/verbs.c
@@ -1,6 +1,22 @@
// SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB
/* Copyright (c) 2015 - 2021 Intel Corporation */
#include "main.h"
+#include <rdma/uverbs_ioctl.h>
+#define UVERBS_MODULE_NAME irdma
+#include <rdma/uverbs_named_ioctl.h>
+#include <rdma/ib_user_ioctl_cmds.h>
+
+ADD_UVERBS_ATTRIBUTES_SIMPLE(
+ irdma_cq_attrs,
+ UVERBS_OBJECT_CQ,
+ UVERBS_METHOD_CQ_CREATE,
+ UVERBS_ATTR_UMEM(IRDMA_IB_ATTR_CREATE_CQ_SHADOW_BUF_UMEM, UA_OPTIONAL)
+);
+
+static const struct uapi_definition irdma_uapi_defs[] = {
+ UAPI_DEF_CHAIN_OBJ_TREE(UVERBS_OBJECT_CQ, &irdma_cq_attrs),
+ {}
+};

/**
* irdma_query_device - get device attributes
@@ -5629,6 +5645,8 @@ static void irdma_init_rdma_device(struct irdma_device *iwdev)
iwdev->ibdev.phys_port_cnt = 1;
iwdev->ibdev.num_comp_vectors = iwdev->rf->ceqs_count;
iwdev->ibdev.dev.parent = &pcidev->dev;
+ if (IS_ENABLED(CONFIG_INFINIBAND_USER_ACCESS))
+ iwdev->ibdev.driver_def = irdma_uapi_defs;
ib_set_device_ops(&iwdev->ibdev, &irdma_dev_ops);
if (iwdev->rf->rdma_ver == IRDMA_GEN_1)
ib_set_device_ops(&iwdev->ibdev, &irdma_gen1_dev_ops);
diff --git a/include/uapi/rdma/irdma-abi.h b/include/uapi/rdma/irdma-abi.h
index 38155affc8b4..a1a26529aa85 100644
--- a/include/uapi/rdma/irdma-abi.h
+++ b/include/uapi/rdma/irdma-abi.h
@@ -10,6 +10,7 @@
#define IRDMA_ABI_H

#include <linux/types.h>
+#include <rdma/ib_user_ioctl_cmds.h>

/* irdma must support legacy GEN_1 i40iw kernel
* and user-space whose last ABI ver is 5
@@ -23,6 +24,10 @@ enum irdma_memreg_type {
IRDMA_MEMREG_TYPE_SRQ = 3,
};

+enum irdma_ib_create_cq_attrs {
+ IRDMA_IB_ATTR_CREATE_CQ_SHADOW_BUF_UMEM = UVERBS_ID_DRIVER_NS_WITH_UHW,
+};
+
enum {
IRDMA_ALLOC_UCTX_USE_RAW_ATTR = 1 << 0,
IRDMA_ALLOC_UCTX_MIN_HW_WQ_SIZE = 1 << 1,
--
2.56.0.385.gd3acb90ef8-goog