drivers/infiniband/core/nldev.c
Source file repositories/reference/linux-study-clean/drivers/infiniband/core/nldev.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/infiniband/core/nldev.c- Extension
.c- Size
- 85210 bytes
- Lines
- 3225
- Domain
- Driver Families
- Bucket
- drivers/infiniband
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/pid.hlinux/pid_namespace.hlinux/mutex.hnet/netlink.hrdma/rdma_cm.hrdma/rdma_netlink.hrdma/frmr_pools.hcore_priv.hcma_priv.hrestrack.huverbs.hfrmr_pools.h
Detected Declarations
struct nldev_fill_res_entryenum nldev_res_flagsfunction put_driver_name_print_typefunction _rdma_nl_put_driver_u32function _rdma_nl_put_driver_u64function rdma_nl_put_driver_stringfunction rdma_nl_put_driver_u32function rdma_nl_put_driver_u32_hexfunction rdma_nl_put_driver_u64function rdma_nl_put_driver_u64_hexfunction rdma_nl_get_privileged_qkeyfunction fill_nldev_handlefunction fill_dev_infofunction fill_port_infofunction fill_res_info_entryfunction fill_res_infofunction fill_res_name_pidfunction fill_res_qp_entry_queryfunction fill_res_qp_entryfunction fill_res_qp_raw_entryfunction fill_res_cm_id_entryfunction fill_res_cq_entryfunction fill_res_cq_raw_entryfunction fill_res_mr_entryfunction fill_res_mr_raw_entryfunction fill_res_pd_entryfunction fill_res_ctx_entryfunction fill_res_range_qp_entryfunction fill_res_srq_qpsfunction fill_res_srq_entryfunction fill_res_srq_raw_entryfunction fill_stat_counter_modefunction fill_stat_counter_qp_entryfunction fill_stat_counter_qpsfunction rdma_nl_stat_hwcounter_entryfunction fill_stat_mr_entryfunction fill_stat_counter_hwcountersfunction fill_res_counter_entryfunction nldev_get_doitfunction nldev_set_doitfunction _nldev_get_dumpitfunction nldev_get_dumpitfunction nldev_port_get_doitfunction nldev_port_get_dumpitfunction rdma_for_each_portfunction nldev_res_get_doitfunction _nldev_res_get_dumpitfunction nldev_res_get_dumpit
Annotated Snippet
struct nldev_fill_res_entry {
enum rdma_nldev_attr nldev_attr;
u8 flags;
u32 entry;
u32 id;
};
enum nldev_res_flags {
NLDEV_PER_DEV = 1 << 0,
};
static const struct nldev_fill_res_entry fill_entries[RDMA_RESTRACK_MAX] = {
[RDMA_RESTRACK_QP] = {
.nldev_attr = RDMA_NLDEV_ATTR_RES_QP,
.entry = RDMA_NLDEV_ATTR_RES_QP_ENTRY,
.id = RDMA_NLDEV_ATTR_RES_LQPN,
},
[RDMA_RESTRACK_CM_ID] = {
.nldev_attr = RDMA_NLDEV_ATTR_RES_CM_ID,
.entry = RDMA_NLDEV_ATTR_RES_CM_ID_ENTRY,
.id = RDMA_NLDEV_ATTR_RES_CM_IDN,
},
[RDMA_RESTRACK_CQ] = {
.nldev_attr = RDMA_NLDEV_ATTR_RES_CQ,
.flags = NLDEV_PER_DEV,
.entry = RDMA_NLDEV_ATTR_RES_CQ_ENTRY,
.id = RDMA_NLDEV_ATTR_RES_CQN,
},
[RDMA_RESTRACK_MR] = {
.nldev_attr = RDMA_NLDEV_ATTR_RES_MR,
.flags = NLDEV_PER_DEV,
.entry = RDMA_NLDEV_ATTR_RES_MR_ENTRY,
.id = RDMA_NLDEV_ATTR_RES_MRN,
},
[RDMA_RESTRACK_PD] = {
.nldev_attr = RDMA_NLDEV_ATTR_RES_PD,
.flags = NLDEV_PER_DEV,
.entry = RDMA_NLDEV_ATTR_RES_PD_ENTRY,
.id = RDMA_NLDEV_ATTR_RES_PDN,
},
[RDMA_RESTRACK_COUNTER] = {
.nldev_attr = RDMA_NLDEV_ATTR_STAT_COUNTER,
.entry = RDMA_NLDEV_ATTR_STAT_COUNTER_ENTRY,
.id = RDMA_NLDEV_ATTR_STAT_COUNTER_ID,
},
[RDMA_RESTRACK_CTX] = {
.nldev_attr = RDMA_NLDEV_ATTR_RES_CTX,
.flags = NLDEV_PER_DEV,
.entry = RDMA_NLDEV_ATTR_RES_CTX_ENTRY,
.id = RDMA_NLDEV_ATTR_RES_CTXN,
},
[RDMA_RESTRACK_SRQ] = {
.nldev_attr = RDMA_NLDEV_ATTR_RES_SRQ,
.flags = NLDEV_PER_DEV,
.entry = RDMA_NLDEV_ATTR_RES_SRQ_ENTRY,
.id = RDMA_NLDEV_ATTR_RES_SRQN,
},
};
static noinline_for_stack int
res_get_common_doit(struct sk_buff *skb, struct nlmsghdr *nlh,
struct netlink_ext_ack *extack,
enum rdma_restrack_type res_type,
res_fill_func_t fill_func)
{
const struct nldev_fill_res_entry *fe = &fill_entries[res_type];
struct nlattr *tb[RDMA_NLDEV_ATTR_MAX];
struct rdma_restrack_entry *res;
struct ib_device *device;
u32 index, id, port = 0;
bool has_cap_net_admin;
struct sk_buff *msg;
int ret;
ret = __nlmsg_parse(nlh, 0, tb, RDMA_NLDEV_ATTR_MAX - 1,
nldev_policy, NL_VALIDATE_LIBERAL, extack);
if (ret || !tb[RDMA_NLDEV_ATTR_DEV_INDEX] || !fe->id || !tb[fe->id])
return -EINVAL;
index = nla_get_u32(tb[RDMA_NLDEV_ATTR_DEV_INDEX]);
device = ib_device_get_by_index(sock_net(skb->sk), index);
if (!device)
return -EINVAL;
if (tb[RDMA_NLDEV_ATTR_PORT_INDEX]) {
port = nla_get_u32(tb[RDMA_NLDEV_ATTR_PORT_INDEX]);
if (!rdma_is_port_valid(device, port)) {
ret = -EINVAL;
goto err;
Annotation
- Immediate include surface: `linux/module.h`, `linux/pid.h`, `linux/pid_namespace.h`, `linux/mutex.h`, `net/netlink.h`, `rdma/rdma_cm.h`, `rdma/rdma_netlink.h`, `rdma/frmr_pools.h`.
- Detected declarations: `struct nldev_fill_res_entry`, `enum nldev_res_flags`, `function put_driver_name_print_type`, `function _rdma_nl_put_driver_u32`, `function _rdma_nl_put_driver_u64`, `function rdma_nl_put_driver_string`, `function rdma_nl_put_driver_u32`, `function rdma_nl_put_driver_u32_hex`, `function rdma_nl_put_driver_u64`, `function rdma_nl_put_driver_u64_hex`.
- Atlas domain: Driver Families / drivers/infiniband.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.