drivers/infiniband/core/sa_query.c
Source file repositories/reference/linux-study-clean/drivers/infiniband/core/sa_query.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/infiniband/core/sa_query.c- Extension
.c- Size
- 68959 bytes
- Lines
- 2553
- 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.
- 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/init.hlinux/err.hlinux/random.hlinux/spinlock.hlinux/slab.hlinux/dma-mapping.hlinux/kref.hlinux/xarray.hlinux/workqueue.huapi/linux/if_ether.hrdma/ib_pack.hrdma/ib_cache.hrdma/rdma_netlink.hnet/netlink.huapi/rdma/ib_user_sa.hrdma/ib_marshall.hrdma/ib_addr.hrdma/opa_addr.hrdma/rdma_cm.hsa.hcore_priv.h
Detected Declarations
struct ib_sa_sm_ahstruct rdma_class_port_infostruct ib_sa_classport_cachestruct ib_sa_portstruct ib_sa_devicestruct ib_sa_querystruct ib_sa_path_querystruct ib_sa_guidinfo_querystruct ib_sa_classport_info_querystruct ib_sa_mcmember_querystruct ib_sa_service_querystruct ib_classport_info_contextenum rdma_class_port_info_typeenum opa_pr_supportedfunction ib_sa_disable_local_svcfunction ib_sa_query_cancelledfunction ib_nl_set_path_rec_attrsfunction ib_nl_get_path_rec_attrs_lenfunction ib_nl_make_requestfunction ib_nl_cancel_requestfunction ib_nl_process_good_resolve_rspfunction nla_for_each_attrfunction ib_nl_request_timeoutfunction ib_nl_handle_set_timeoutfunction list_for_each_entryfunction ib_nl_is_good_resolve_respfunction ib_nl_handle_resolve_respfunction free_sm_ahfunction ib_sa_register_clientfunction ib_sa_unregister_clientfunction ib_sa_cancel_queryfunction get_src_path_maskfunction init_ah_attr_grh_fieldsfunction ib_init_ah_attr_from_pathfunction alloc_madfunction free_madfunction init_madfunction send_madfunction ib_sa_unpack_pathfunction ib_sa_pack_pathfunction ib_sa_pack_servicefunction ib_sa_unpack_servicefunction ib_sa_opa_pathrecord_supportfunction opa_pr_query_possiblefunction ib_sa_path_rec_callbackfunction ib_unpack_service_rmppfunction list_for_each_entryfunction ib_sa_service_rec_callback
Annotated Snippet
struct ib_sa_sm_ah {
struct ib_ah *ah;
struct kref ref;
u16 pkey_index;
u8 src_path_mask;
};
enum rdma_class_port_info_type {
RDMA_CLASS_PORT_INFO_IB,
RDMA_CLASS_PORT_INFO_OPA
};
struct rdma_class_port_info {
enum rdma_class_port_info_type type;
union {
struct ib_class_port_info ib;
struct opa_class_port_info opa;
};
};
struct ib_sa_classport_cache {
bool valid;
int retry_cnt;
struct rdma_class_port_info data;
};
struct ib_sa_port {
struct ib_mad_agent *agent;
struct ib_sa_sm_ah *sm_ah;
struct work_struct update_task;
struct ib_sa_classport_cache classport_info;
struct delayed_work ib_cpi_work;
spinlock_t classport_lock; /* protects class port info set */
spinlock_t ah_lock;
u32 port_num;
};
struct ib_sa_device {
int start_port, end_port;
struct ib_event_handler event_handler;
struct ib_sa_port port[];
};
struct ib_sa_query {
void (*callback)(struct ib_sa_query *sa_query, int status,
struct ib_sa_mad *mad);
void (*rmpp_callback)(struct ib_sa_query *sa_query, int status,
struct ib_mad_recv_wc *mad);
void (*release)(struct ib_sa_query *);
struct ib_sa_client *client;
struct ib_sa_port *port;
struct ib_mad_send_buf *mad_buf;
struct ib_sa_sm_ah *sm_ah;
int id;
u32 flags;
struct list_head list; /* Local svc request list */
u32 seq; /* Local svc request sequence number */
unsigned long timeout; /* Local svc timeout */
u8 path_use; /* How will the pathrecord be used */
};
#define IB_SA_ENABLE_LOCAL_SERVICE 0x00000001
#define IB_SA_CANCEL 0x00000002
#define IB_SA_QUERY_OPA 0x00000004
struct ib_sa_path_query {
void (*callback)(int status, struct sa_path_rec *rec,
unsigned int num_paths, void *context);
void *context;
struct ib_sa_query sa_query;
struct sa_path_rec *conv_pr;
};
struct ib_sa_guidinfo_query {
void (*callback)(int, struct ib_sa_guidinfo_rec *, void *);
void *context;
struct ib_sa_query sa_query;
};
struct ib_sa_classport_info_query {
void (*callback)(void *);
void *context;
struct ib_sa_query sa_query;
};
struct ib_sa_mcmember_query {
void (*callback)(int, struct ib_sa_mcmember_rec *, void *);
void *context;
struct ib_sa_query sa_query;
};
Annotation
- Immediate include surface: `linux/init.h`, `linux/err.h`, `linux/random.h`, `linux/spinlock.h`, `linux/slab.h`, `linux/dma-mapping.h`, `linux/kref.h`, `linux/xarray.h`.
- Detected declarations: `struct ib_sa_sm_ah`, `struct rdma_class_port_info`, `struct ib_sa_classport_cache`, `struct ib_sa_port`, `struct ib_sa_device`, `struct ib_sa_query`, `struct ib_sa_path_query`, `struct ib_sa_guidinfo_query`, `struct ib_sa_classport_info_query`, `struct ib_sa_mcmember_query`.
- 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.
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.