drivers/infiniband/hw/irdma/puda.c
Source file repositories/reference/linux-study-clean/drivers/infiniband/hw/irdma/puda.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/infiniband/hw/irdma/puda.c- Extension
.c- Size
- 46681 bytes
- Lines
- 1733
- 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
osdep.hhmc.hdefs.htype.hprotos.hpuda.hws.h
Detected Declarations
function irdma_puda_ret_bufpoolfunction irdma_puda_post_recvbuffunction irdma_puda_replenish_rqfunction irdma_puda_dele_buffunction irdma_puda_poll_infofunction irdma_puda_poll_cmplfunction irdma_puda_sendfunction irdma_puda_send_buffunction irdma_puda_qp_setctxfunction irdma_puda_qp_wqefunction irdma_puda_qp_createfunction irdma_puda_cq_wqefunction irdma_puda_cq_createfunction scoped_guardfunction irdma_puda_free_qpfunction irdma_puda_free_cqfunction scoped_guardfunction irdma_puda_dele_rsrcfunction irdma_puda_allocbufsfunction irdma_puda_create_rsrcfunction irdma_ilq_putback_rcvbuffunction irdma_ieq_get_fpdu_lenfunction irdma_ieq_copy_to_txbuffunction irdma_ieq_setup_tx_buffunction irdma_ieq_check_first_buffunction irdma_ieq_compl_pfpdufunction irdma_ieq_create_pbuflfunction irdma_ieq_handle_partialfunction irdma_ieq_process_buffunction irdma_ieq_process_fpdusfunction irdma_ieq_create_ahfunction irdma_ieq_handle_exceptionfunction irdma_ieq_receivefunction irdma_ieq_tx_complfunction irdma_ieq_cleanup_qp
Annotated Snippet
if (ext_valid) {
info->vlan_valid = (bool)FIELD_GET(IRDMA_CQ_UDVLANVALID, qword7);
if (info->vlan_valid) {
get_64bit_val(ext_cqe, 16, &qword6);
info->vlan = (u16)FIELD_GET(IRDMA_CQ_UDVLAN, qword6);
}
info->smac_valid = (bool)FIELD_GET(IRDMA_CQ_UDSMACVALID, qword7);
if (info->smac_valid) {
get_64bit_val(ext_cqe, 16, &qword6);
info->smac[0] = (u8)((qword6 >> 40) & 0xFF);
info->smac[1] = (u8)((qword6 >> 32) & 0xFF);
info->smac[2] = (u8)((qword6 >> 24) & 0xFF);
info->smac[3] = (u8)((qword6 >> 16) & 0xFF);
info->smac[4] = (u8)((qword6 >> 8) & 0xFF);
info->smac[5] = (u8)(qword6 & 0xFF);
}
}
if (cq->dev->hw_attrs.uk_attrs.hw_rev == IRDMA_GEN_1) {
info->vlan_valid = (bool)FIELD_GET(IRDMA_VLAN_TAG_VALID, qword3);
info->l4proto = (u8)FIELD_GET(IRDMA_UDA_L4PROTO, qword2);
info->l3proto = (u8)FIELD_GET(IRDMA_UDA_L3PROTO, qword2);
}
info->payload_len = (u32)FIELD_GET(IRDMACQ_PAYLDLEN, qword0);
}
return 0;
}
/**
* irdma_puda_poll_cmpl - processes completion for cq
* @dev: iwarp device
* @cq: cq getting interrupt
* @compl_err: return any completion err
*/
int irdma_puda_poll_cmpl(struct irdma_sc_dev *dev, struct irdma_sc_cq *cq,
u32 *compl_err)
{
struct irdma_qp_uk *qp;
struct irdma_cq_uk *cq_uk = &cq->cq_uk;
struct irdma_puda_cmpl_info info = {};
int ret = 0;
struct irdma_puda_buf *buf;
struct irdma_puda_rsrc *rsrc;
u8 cq_type = cq->cq_type;
unsigned long flags;
if (cq_type == IRDMA_CQ_TYPE_ILQ || cq_type == IRDMA_CQ_TYPE_IEQ) {
rsrc = (cq_type == IRDMA_CQ_TYPE_ILQ) ? cq->vsi->ilq :
cq->vsi->ieq;
} else {
ibdev_dbg(to_ibdev(dev), "PUDA: qp_type error\n");
return -EINVAL;
}
ret = irdma_puda_poll_info(cq, &info);
*compl_err = info.compl_error;
if (ret == -ENOENT)
return ret;
if (ret)
goto done;
qp = info.qp;
if (!qp || !rsrc) {
ret = -EFAULT;
goto done;
}
if (qp->qp_id != rsrc->qp_id) {
ret = -EFAULT;
goto done;
}
if (info.q_type == IRDMA_CQE_QTYPE_RQ) {
buf = (struct irdma_puda_buf *)(uintptr_t)
qp->rq_wrid_array[info.wqe_idx];
/* reusing so synch the buffer for CPU use */
dma_sync_single_for_cpu(dev->hw->device, buf->mem.pa,
buf->mem.size, DMA_BIDIRECTIONAL);
/* Get all the tcpip information in the buf header */
ret = irdma_puda_get_tcpip_info(&info, buf);
if (ret) {
rsrc->stats_rcvd_pkt_err++;
if (cq_type == IRDMA_CQ_TYPE_ILQ) {
irdma_ilq_putback_rcvbuf(&rsrc->qp, buf,
info.wqe_idx);
} else {
irdma_puda_ret_bufpool(rsrc, buf);
Annotation
- Immediate include surface: `osdep.h`, `hmc.h`, `defs.h`, `type.h`, `protos.h`, `puda.h`, `ws.h`.
- Detected declarations: `function irdma_puda_ret_bufpool`, `function irdma_puda_post_recvbuf`, `function irdma_puda_replenish_rq`, `function irdma_puda_dele_buf`, `function irdma_puda_poll_info`, `function irdma_puda_poll_cmpl`, `function irdma_puda_send`, `function irdma_puda_send_buf`, `function irdma_puda_qp_setctx`, `function irdma_puda_qp_wqe`.
- 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.