drivers/infiniband/hw/mana/qp.c
Source file repositories/reference/linux-study-clean/drivers/infiniband/hw/mana/qp.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/infiniband/hw/mana/qp.c- Extension
.c- Size
- 26912 bytes
- Lines
- 952
- 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.
- 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
mana_ib.h
Detected Declarations
function Copyrightfunction mana_ib_create_qp_rssfunction mana_ib_create_qp_rawfunction mana_ib_wqe_sizefunction mana_ib_queue_sizefunction mana_ib_queue_typefunction mana_table_store_rc_qpfunction mana_table_remove_rc_qpfunction mana_table_store_ud_qpfunction mana_table_remove_ud_qpfunction mana_table_store_qpfunction mana_table_remove_qpfunction mana_ib_create_rc_qpfunction mana_add_qp_to_cqsfunction mana_remove_qp_from_cqsfunction mana_ib_create_ud_qpfunction mana_ib_create_qpfunction mana_ib_gd_modify_qpfunction mana_ib_modify_qpfunction mana_ib_destroy_qp_rssfunction mana_ib_destroy_qp_rawfunction mana_ib_destroy_rc_qpfunction mana_ib_destroy_ud_qpfunction mana_ib_destroy_qp
Annotated Snippet
if (ret) {
mana_destroy_wq_obj(mpc, GDMA_RQ, wq->rx_object);
goto free_vport;
}
}
resp.num_entries = i;
ret = mana_ib_cfg_vport_steering(mdev, ndev, wq->rx_object,
mana_ind_table,
ind_tbl->log_ind_tbl_size,
ucmd.rx_hash_key_len,
ucmd.rx_hash_key);
if (ret)
goto free_vport;
ret = ib_respond_udata(udata, resp);
if (ret)
goto err_disable_vport_rx;
kfree(mana_ind_table);
return 0;
err_disable_vport_rx:
mana_disable_vport_rx(mpc);
free_vport:
while (i-- > 0) {
ibwq = ind_tbl->ind_tbl[i];
ibcq = ibwq->cq;
wq = container_of(ibwq, struct mana_ib_wq, ibwq);
cq = container_of(ibcq, struct mana_ib_cq, ibcq);
mana_ib_remove_cq_cb(mdev, cq);
mana_destroy_wq_obj(mpc, GDMA_RQ, wq->rx_object);
}
mutex_lock(&mana_pd->vport_mutex);
mana_pd->has_rss_qp = false;
mutex_unlock(&mana_pd->vport_mutex);
mana_ib_uncfg_vport(mdev, mana_pd, port);
fail:
kfree(mana_ind_table);
return ret;
}
static int mana_ib_create_qp_raw(struct ib_qp *ibqp, struct ib_pd *ibpd,
struct ib_qp_init_attr *attr,
struct ib_udata *udata)
{
struct mana_ib_pd *pd = container_of(ibpd, struct mana_ib_pd, ibpd);
struct mana_ib_qp *qp = container_of(ibqp, struct mana_ib_qp, ibqp);
struct mana_ib_dev *mdev =
container_of(ibpd->device, struct mana_ib_dev, ib_dev);
struct mana_ib_cq *send_cq =
container_of(attr->send_cq, struct mana_ib_cq, ibcq);
struct mana_ib_ucontext *mana_ucontext =
rdma_udata_to_drv_context(udata, struct mana_ib_ucontext,
ibucontext);
struct mana_ib_create_qp_resp resp = {};
struct mana_ib_create_qp ucmd = {};
struct mana_obj_spec wq_spec = {};
struct mana_obj_spec cq_spec = {};
struct mana_port_context *mpc;
struct net_device *ndev;
struct mana_eq *eq;
int eq_vec;
u32 port;
int err;
if (!mana_ucontext)
return -EINVAL;
err = ib_copy_validate_udata_in(udata, ucmd, port);
if (err)
return err;
if (attr->cap.max_send_wr > mdev->adapter_caps.max_qp_wr) {
ibdev_dbg(&mdev->ib_dev,
"Requested max_send_wr %d exceeding limit\n",
attr->cap.max_send_wr);
return -EINVAL;
}
if (attr->cap.max_send_sge > MAX_TX_WQE_SGL_ENTRIES) {
ibdev_dbg(&mdev->ib_dev,
"Requested max_send_sge %d exceeding limit\n",
attr->cap.max_send_sge);
Annotation
- Immediate include surface: `mana_ib.h`.
- Detected declarations: `function Copyright`, `function mana_ib_create_qp_rss`, `function mana_ib_create_qp_raw`, `function mana_ib_wqe_size`, `function mana_ib_queue_size`, `function mana_ib_queue_type`, `function mana_table_store_rc_qp`, `function mana_table_remove_rc_qp`, `function mana_table_store_ud_qp`, `function mana_table_remove_ud_qp`.
- 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.
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.