drivers/infiniband/hw/mthca/mthca_qp.c
Source file repositories/reference/linux-study-clean/drivers/infiniband/hw/mthca/mthca_qp.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/infiniband/hw/mthca/mthca_qp.c- Extension
.c- Size
- 62309 bytes
- Lines
- 2318
- Domain
- Driver Families
- Bucket
- drivers/infiniband
- Inferred role
- Driver Families: implementation source
- Status
- source 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.
- 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/string.hlinux/slab.hlinux/sched.hasm/io.hrdma/ib_verbs.hrdma/ib_cache.hrdma/ib_pack.hrdma/uverbs_ioctl.hmthca_dev.hmthca_cmd.hmthca_memfree.hmthca_wqe.h
Detected Declarations
struct mthca_qp_pathstruct mthca_qp_contextstruct mthca_qp_paramfunction is_sqpfunction is_qp0function mthca_wq_resetfunction mthca_qp_eventfunction to_mthca_statefunction to_mthca_stfunction store_attrsfunction init_portfunction get_hw_access_flagsfunction to_ib_qp_statefunction to_ib_mig_statefunction to_ib_qp_access_flagsfunction to_rdma_ah_attrfunction mthca_query_qpfunction mthca_path_setfunction __mthca_modify_qpfunction mthca_modify_qpfunction mthca_max_data_sizefunction mthca_max_inline_datafunction mthca_adjust_qp_capsfunction mthca_alloc_wqe_buffunction mthca_free_wqe_buffunction mthca_map_memfreefunction mthca_unmap_memfreefunction mthca_alloc_memfreefunction mthca_free_memfreefunction mthca_alloc_qp_commonfunction mthca_set_qp_sizefunction mthca_alloc_qpfunction mthca_lock_cqsfunction mthca_unlock_cqsfunction mthca_alloc_sqpfunction get_qp_refcountfunction mthca_free_qpfunction build_mlx_headerfunction mthca_wq_overflowfunction set_raddr_segfunction set_atomic_segfunction set_tavor_ud_segfunction set_arbel_ud_segfunction mthca_tavor_post_sendfunction mthca_tavor_post_receivefunction mthca_arbel_post_sendfunction mthca_arbel_post_receivefunction mthca_free_err_wqe
Annotated Snippet
struct mthca_qp_path {
__be32 port_pkey;
u8 rnr_retry;
u8 g_mylmc;
__be16 rlid;
u8 ackto;
u8 mgid_index;
u8 static_rate;
u8 hop_limit;
__be32 sl_tclass_flowlabel;
u8 rgid[16];
} __packed;
struct mthca_qp_context {
__be32 flags;
__be32 tavor_sched_queue; /* Reserved on Arbel */
u8 mtu_msgmax;
u8 rq_size_stride; /* Reserved on Tavor */
u8 sq_size_stride; /* Reserved on Tavor */
u8 rlkey_arbel_sched_queue; /* Reserved on Tavor */
__be32 usr_page;
__be32 local_qpn;
__be32 remote_qpn;
u32 reserved1[2];
struct mthca_qp_path pri_path;
struct mthca_qp_path alt_path;
__be32 rdd;
__be32 pd;
__be32 wqe_base;
__be32 wqe_lkey;
__be32 params1;
__be32 reserved2;
__be32 next_send_psn;
__be32 cqn_snd;
__be32 snd_wqe_base_l; /* Next send WQE on Tavor */
__be32 snd_db_index; /* (debugging only entries) */
__be32 last_acked_psn;
__be32 ssn;
__be32 params2;
__be32 rnr_nextrecvpsn;
__be32 ra_buff_indx;
__be32 cqn_rcv;
__be32 rcv_wqe_base_l; /* Next recv WQE on Tavor */
__be32 rcv_db_index; /* (debugging only entries) */
__be32 qkey;
__be32 srqn;
__be32 rmsn;
__be16 rq_wqe_counter; /* reserved on Tavor */
__be16 sq_wqe_counter; /* reserved on Tavor */
u32 reserved3[18];
} __packed;
struct mthca_qp_param {
__be32 opt_param_mask;
u32 reserved1;
struct mthca_qp_context context;
u32 reserved2[62];
} __packed;
enum {
MTHCA_QP_OPTPAR_ALT_ADDR_PATH = 1 << 0,
MTHCA_QP_OPTPAR_RRE = 1 << 1,
MTHCA_QP_OPTPAR_RAE = 1 << 2,
MTHCA_QP_OPTPAR_RWE = 1 << 3,
MTHCA_QP_OPTPAR_PKEY_INDEX = 1 << 4,
MTHCA_QP_OPTPAR_Q_KEY = 1 << 5,
MTHCA_QP_OPTPAR_RNR_TIMEOUT = 1 << 6,
MTHCA_QP_OPTPAR_PRIMARY_ADDR_PATH = 1 << 7,
MTHCA_QP_OPTPAR_SRA_MAX = 1 << 8,
MTHCA_QP_OPTPAR_RRA_MAX = 1 << 9,
MTHCA_QP_OPTPAR_PM_STATE = 1 << 10,
MTHCA_QP_OPTPAR_PORT_NUM = 1 << 11,
MTHCA_QP_OPTPAR_RETRY_COUNT = 1 << 12,
MTHCA_QP_OPTPAR_ALT_RNR_RETRY = 1 << 13,
MTHCA_QP_OPTPAR_ACK_TIMEOUT = 1 << 14,
MTHCA_QP_OPTPAR_RNR_RETRY = 1 << 15,
MTHCA_QP_OPTPAR_SCHED_QUEUE = 1 << 16
};
static const u8 mthca_opcode[] = {
[IB_WR_SEND] = MTHCA_OPCODE_SEND,
[IB_WR_SEND_WITH_IMM] = MTHCA_OPCODE_SEND_IMM,
[IB_WR_RDMA_WRITE] = MTHCA_OPCODE_RDMA_WRITE,
[IB_WR_RDMA_WRITE_WITH_IMM] = MTHCA_OPCODE_RDMA_WRITE_IMM,
[IB_WR_RDMA_READ] = MTHCA_OPCODE_RDMA_READ,
[IB_WR_ATOMIC_CMP_AND_SWP] = MTHCA_OPCODE_ATOMIC_CS,
[IB_WR_ATOMIC_FETCH_AND_ADD] = MTHCA_OPCODE_ATOMIC_FA,
};
static int is_sqp(struct mthca_dev *dev, struct mthca_qp *qp)
Annotation
- Immediate include surface: `linux/string.h`, `linux/slab.h`, `linux/sched.h`, `asm/io.h`, `rdma/ib_verbs.h`, `rdma/ib_cache.h`, `rdma/ib_pack.h`, `rdma/uverbs_ioctl.h`.
- Detected declarations: `struct mthca_qp_path`, `struct mthca_qp_context`, `struct mthca_qp_param`, `function is_sqp`, `function is_qp0`, `function mthca_wq_reset`, `function mthca_qp_event`, `function to_mthca_state`, `function to_mthca_st`, `function store_attrs`.
- Atlas domain: Driver Families / drivers/infiniband.
- Implementation status: source 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.