drivers/infiniband/core/verbs.c
Source file repositories/reference/linux-study-clean/drivers/infiniband/core/verbs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/infiniband/core/verbs.c- Extension
.c- Size
- 86154 bytes
- Lines
- 3194
- 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/errno.hlinux/err.hlinux/export.hlinux/string.hlinux/slab.hlinux/in.hlinux/in6.hnet/addrconf.hlinux/security.hrdma/ib_verbs.hrdma/ib_cache.hrdma/ib_addr.hrdma/ib_umem.hrdma/rw.hrdma/lag.hrdma_core.hcore_priv.htrace/events/rdma_core.h
Detected Declarations
struct ib_speed_attrstruct find_gid_index_contextstruct ib_drain_cqefunction ib_event_msgfunction ib_wc_status_msgfunction ib_rate_to_multfunction mult_to_ib_ratefunction ib_rate_to_mbpsfunction ib_port_attr_to_speed_infofunction rdma_node_get_transportfunction rdma_port_get_link_layerfunction ib_dealloc_pd_userfunction rdma_copy_ah_attrfunction rdma_replace_ah_attrfunction rdma_move_ah_attrfunction rdma_check_ah_attrfunction rdma_unfill_sgid_attrfunction rdma_unfill_sgid_attrfunction rdma_update_sgid_attrfunction ib_get_rdma_header_versionfunction ib_get_net_type_by_grhfunction find_gid_indexfunction get_sgid_attr_from_ethfunction ib_get_gids_from_rdma_hdrfunction ib_resolve_unicast_gid_dmacfunction ib_init_ah_attr_from_wcfunction rdma_destroy_ah_attrfunction rdma_destroy_ah_attrfunction rdma_modify_ahfunction rdma_query_ahfunction rdma_destroy_ah_userfunction ib_modify_srqfunction ib_query_srqfunction ib_destroy_srq_userfunction __ib_qp_event_handlerfunction __ib_shared_qp_event_handlerfunction voidfunction ib_qp_usecnt_incfunction ib_qp_usecnt_decfunction ib_modify_qp_is_okfunction ib_resolve_eth_dmacfunction is_qp_type_connectedfunction _ib_modify_qpfunction ib_modify_qp_with_udatafunction ib_get_width_and_speedfunction ib_get_eth_speedfunction ib_modify_qpfunction ib_query_qp
Annotated Snippet
struct ib_speed_attr {
const char *str;
int speed;
};
#define IB_SPEED_ATTR(speed_type, _str, _speed) \
[speed_type] = {.str = _str, .speed = _speed}
static const struct ib_speed_attr ib_speed_attrs[] = {
IB_SPEED_ATTR(IB_SPEED_SDR, " SDR", 25),
IB_SPEED_ATTR(IB_SPEED_DDR, " DDR", 50),
IB_SPEED_ATTR(IB_SPEED_QDR, " QDR", 100),
IB_SPEED_ATTR(IB_SPEED_FDR10, " FDR10", 100),
IB_SPEED_ATTR(IB_SPEED_FDR, " FDR", 140),
IB_SPEED_ATTR(IB_SPEED_EDR, " EDR", 250),
IB_SPEED_ATTR(IB_SPEED_HDR, " HDR", 500),
IB_SPEED_ATTR(IB_SPEED_NDR, " NDR", 1000),
IB_SPEED_ATTR(IB_SPEED_XDR, " XDR", 2000),
};
int ib_port_attr_to_speed_info(struct ib_port_attr *attr,
struct ib_port_speed_info *speed_info)
{
int speed_idx = attr->active_speed;
switch (attr->active_speed) {
case IB_SPEED_DDR:
case IB_SPEED_QDR:
case IB_SPEED_FDR10:
case IB_SPEED_FDR:
case IB_SPEED_EDR:
case IB_SPEED_HDR:
case IB_SPEED_NDR:
case IB_SPEED_XDR:
case IB_SPEED_SDR:
break;
default:
speed_idx = IB_SPEED_SDR; /* Default to SDR for invalid rates */
break;
}
speed_info->str = ib_speed_attrs[speed_idx].str;
speed_info->rate = ib_speed_attrs[speed_idx].speed;
speed_info->rate *= ib_width_enum_to_int(attr->active_width);
if (speed_info->rate < 0)
return -EINVAL;
return 0;
}
EXPORT_SYMBOL(ib_port_attr_to_speed_info);
__attribute_const__ enum rdma_transport_type
rdma_node_get_transport(unsigned int node_type)
{
if (node_type == RDMA_NODE_USNIC)
return RDMA_TRANSPORT_USNIC;
if (node_type == RDMA_NODE_USNIC_UDP)
return RDMA_TRANSPORT_USNIC_UDP;
if (node_type == RDMA_NODE_RNIC)
return RDMA_TRANSPORT_IWARP;
if (node_type == RDMA_NODE_UNSPECIFIED)
return RDMA_TRANSPORT_UNSPECIFIED;
return RDMA_TRANSPORT_IB;
}
EXPORT_SYMBOL(rdma_node_get_transport);
enum rdma_link_layer rdma_port_get_link_layer(struct ib_device *device,
u32 port_num)
{
enum rdma_transport_type lt;
if (device->ops.get_link_layer)
return device->ops.get_link_layer(device, port_num);
lt = rdma_node_get_transport(device->node_type);
if (lt == RDMA_TRANSPORT_IB)
return IB_LINK_LAYER_INFINIBAND;
return IB_LINK_LAYER_ETHERNET;
}
EXPORT_SYMBOL(rdma_port_get_link_layer);
/* Protection domains */
/**
* __ib_alloc_pd - Allocates an unused protection domain.
* @device: The device on which to allocate the protection domain.
* @flags: protection domain flags
* @caller: caller's build-time module name
Annotation
- Immediate include surface: `linux/errno.h`, `linux/err.h`, `linux/export.h`, `linux/string.h`, `linux/slab.h`, `linux/in.h`, `linux/in6.h`, `net/addrconf.h`.
- Detected declarations: `struct ib_speed_attr`, `struct find_gid_index_context`, `struct ib_drain_cqe`, `function ib_event_msg`, `function ib_wc_status_msg`, `function ib_rate_to_mult`, `function mult_to_ib_rate`, `function ib_rate_to_mbps`, `function ib_port_attr_to_speed_info`, `function rdma_node_get_transport`.
- 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.