drivers/infiniband/core/uverbs.h
Source file repositories/reference/linux-study-clean/drivers/infiniband/core/uverbs.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/infiniband/core/uverbs.h- Extension
.h- Size
- 11430 bytes
- Lines
- 372
- Domain
- Driver Families
- Bucket
- drivers/infiniband
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kref.hlinux/idr.hlinux/mutex.hlinux/completion.hlinux/cdev.hrdma/ib_verbs.hrdma/ib_umem.hrdma/ib_user_verbs.hrdma/uverbs_std_types.hrdma/uverbs_named_ioctl.h
Detected Declarations
struct ib_uverbs_devicestruct ib_uverbs_event_queuestruct ib_uverbs_async_event_filestruct ib_uverbs_completion_event_filestruct ib_uverbs_dmabuf_filestruct ib_uverbs_eventstruct ib_uverbs_mcast_entrystruct ib_uevent_objectstruct ib_uxrcd_objectstruct ib_usrq_objectstruct ib_uqp_objectstruct ib_uwq_objectstruct ib_ucq_objectstruct bundle_alloc_headstruct bundle_privstruct ib_uverbs_flow_specfunction Copyrightfunction ib_uverbs_init_udata_buf_or_nullfunction uverbs_set_outputfunction make_port_cap_flagsfunction ib_uverbs_get_async_eventfunction ib_uverbs_dmabuf_donefunction ib_uverbs_comp_dev
Annotated Snippet
extern const struct file_operations uverbs_event_fops;
extern const struct file_operations uverbs_async_event_fops;
void ib_uverbs_init_event_queue(struct ib_uverbs_event_queue *ev_queue);
void ib_uverbs_init_async_event_file(struct ib_uverbs_async_event_file *ev_file);
void ib_uverbs_free_event_queue(struct ib_uverbs_event_queue *event_queue);
void ib_uverbs_flow_resources_free(struct ib_uflow_resources *uflow_res);
int ib_alloc_ucontext(struct uverbs_attr_bundle *attrs);
int ib_init_ucontext(struct uverbs_attr_bundle *attrs);
void ib_uverbs_release_ucq(struct ib_uverbs_completion_event_file *ev_file,
struct ib_ucq_object *uobj);
void ib_uverbs_release_uevent(struct ib_uevent_object *uobj);
void ib_uverbs_release_file(struct kref *ref);
void ib_uverbs_async_handler(struct ib_uverbs_async_event_file *async_file,
__u64 element, __u64 event,
struct list_head *obj_list, u32 *counter);
void ib_uverbs_comp_handler(struct ib_cq *cq, void *cq_context);
void ib_uverbs_cq_event_handler(struct ib_event *event, void *context_ptr);
void ib_uverbs_qp_event_handler(struct ib_event *event, void *context_ptr);
void ib_uverbs_wq_event_handler(struct ib_event *event, void *context_ptr);
void ib_uverbs_srq_event_handler(struct ib_event *event, void *context_ptr);
int ib_uverbs_dealloc_xrcd(struct ib_uobject *uobject, struct ib_xrcd *xrcd,
enum rdma_remove_reason why,
struct uverbs_attr_bundle *attrs);
int uverbs_dealloc_mw(struct ib_mw *mw);
void ib_uverbs_detach_umcast(struct ib_qp *qp,
struct ib_uqp_object *uobj);
struct bundle_alloc_head {
struct_group_tagged(bundle_alloc_head_hdr, hdr,
struct bundle_alloc_head *next;
);
u8 data[];
};
struct bundle_priv {
/* Must be first */
struct bundle_alloc_head_hdr alloc_head;
struct bundle_alloc_head *allocated_mem;
size_t internal_avail;
size_t internal_used;
struct radix_tree_root *radix;
void __rcu **radix_slots;
unsigned long radix_slots_len;
u32 method_key;
struct ib_uverbs_attr __user *user_attrs;
struct ib_uverbs_attr *uattrs;
DECLARE_BITMAP(uobj_finalize, UVERBS_API_ATTR_BKEY_LEN);
DECLARE_BITMAP(spec_finalize, UVERBS_API_ATTR_BKEY_LEN);
DECLARE_BITMAP(uobj_hw_obj_valid, UVERBS_API_ATTR_BKEY_LEN);
/*
* Must be last. bundle ends in a flex array which overlaps
* internal_buffer.
*/
struct uverbs_attr_bundle_hdr bundle;
u64 internal_buffer[32];
};
static inline int uverbs_set_output(const struct uverbs_attr_bundle *bundle,
const struct uverbs_attr *attr)
{
struct bundle_priv *pbundle =
container_of(&bundle->hdr, struct bundle_priv, bundle);
u16 flags;
flags = pbundle->uattrs[attr->ptr_attr.uattr_idx].flags |
UVERBS_ATTR_F_VALID_OUTPUT;
if (put_user(flags,
&pbundle->user_attrs[attr->ptr_attr.uattr_idx].flags))
return -EFAULT;
return 0;
}
long ib_uverbs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg);
struct ib_uverbs_flow_spec {
union {
union {
struct ib_uverbs_flow_spec_hdr hdr;
struct {
__u32 type;
__u16 size;
__u16 reserved;
Annotation
- Immediate include surface: `linux/kref.h`, `linux/idr.h`, `linux/mutex.h`, `linux/completion.h`, `linux/cdev.h`, `rdma/ib_verbs.h`, `rdma/ib_umem.h`, `rdma/ib_user_verbs.h`.
- Detected declarations: `struct ib_uverbs_device`, `struct ib_uverbs_event_queue`, `struct ib_uverbs_async_event_file`, `struct ib_uverbs_completion_event_file`, `struct ib_uverbs_dmabuf_file`, `struct ib_uverbs_event`, `struct ib_uverbs_mcast_entry`, `struct ib_uevent_object`, `struct ib_uxrcd_object`, `struct ib_usrq_object`.
- Atlas domain: Driver Families / drivers/infiniband.
- Implementation status: pattern implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.