drivers/infiniband/hw/hfi1/tid_rdma.c
Source file repositories/reference/linux-study-clean/drivers/infiniband/hw/hfi1/tid_rdma.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/infiniband/hw/hfi1/tid_rdma.c- Extension
.c- Size
- 160873 bytes
- Lines
- 5535
- 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
hfi.hqp.hrc.hverbs.htid_rdma.hexp_rcv.htrace.h
Detected Declarations
function mask_generationfunction validate_r_tid_ackfunction tid_rdma_schedule_ackfunction tid_rdma_trigger_ackfunction tid_rdma_opfn_encodefunction tid_rdma_opfn_decodefunction tid_rdma_opfn_initfunction tid_rdma_conn_reqfunction tid_rdma_conn_replyfunction tid_rdma_conn_respfunction tid_rdma_conn_errorfunction hfi1_kern_exp_rcv_initfunction hfi1_qp_priv_initfunction hfi1_qp_priv_tid_freefunction first_qpfunction kernel_tid_waitersfunction dequeue_tid_waiterfunction queue_qp_for_tid_waitfunction __trigger_tid_waiterfunction first_qpfunction tid_rdma_trigger_resumefunction _tid_rdma_flush_waitfunction hfi1_tid_rdma_flush_waitfunction kern_reserve_flowfunction kern_set_hw_flowfunction kern_setup_hw_flowfunction kern_flow_generation_nextfunction kern_clear_hw_flowfunction hfi1_kern_setup_hw_flowfunction hfi1_kern_clear_hw_flowfunction hfi1_kern_init_ctxt_generationsfunction trdma_pset_orderfunction find_phys_blocksfunction tid_flush_pagesfunction tid_rdma_find_phys_blocks_8kfunction kern_find_pagesfunction dma_unmap_flowfunction dma_map_flowfunction dma_mappedfunction kern_get_phys_blocksfunction kern_add_tid_nodefunction groupfunction kern_program_rcv_groupfunction kern_unprogram_rcv_groupfunction kern_program_rcvarrayfunction hfi1_kern_exp_rcv_setupfunction hfi1_tid_rdma_reset_flowfunction hfi1_kern_exp_rcv_clear
Annotated Snippet
if (ret) {
kfree(priv);
return ret;
}
qp->s_ack_queue[i].priv = priv;
}
}
return 0;
}
void hfi1_qp_priv_tid_free(struct rvt_dev_info *rdi, struct rvt_qp *qp)
{
struct hfi1_qp_priv *qpriv = qp->priv;
struct rvt_swqe *wqe;
u32 i;
if (qp->ibqp.qp_type == IB_QPT_RC && HFI1_CAP_IS_KSET(TID_RDMA)) {
for (i = 0; i < qp->s_size; i++) {
wqe = rvt_get_swqe_ptr(qp, i);
kfree(wqe->priv);
wqe->priv = NULL;
}
for (i = 0; i < rvt_max_atomic(rdi); i++) {
struct hfi1_ack_priv *priv = qp->s_ack_queue[i].priv;
if (priv)
hfi1_kern_exp_rcv_free_flows(&priv->tid_req);
kfree(priv);
qp->s_ack_queue[i].priv = NULL;
}
cancel_work_sync(&qpriv->opfn.opfn_work);
kfree(qpriv->pages);
qpriv->pages = NULL;
}
}
/* Flow and tid waiter functions */
/**
* DOC: lock ordering
*
* There are two locks involved with the queuing
* routines: the qp s_lock and the exp_lock.
*
* Since the tid space allocation is called from
* the send engine, the qp s_lock is already held.
*
* The allocation routines will get the exp_lock.
*
* The first_qp() call is provided to allow the head of
* the rcd wait queue to be fetched under the exp_lock and
* followed by a drop of the exp_lock.
*
* Any qp in the wait list will have the qp reference count held
* to hold the qp in memory.
*/
/*
* return head of rcd wait list
*
* Must hold the exp_lock.
*
* Get a reference to the QP to hold the QP in memory.
*
* The caller must release the reference when the local
* is no longer being used.
*/
static struct rvt_qp *first_qp(struct hfi1_ctxtdata *rcd,
struct tid_queue *queue)
__must_hold(&rcd->exp_lock)
{
struct hfi1_qp_priv *priv;
lockdep_assert_held(&rcd->exp_lock);
priv = list_first_entry_or_null(&queue->queue_head,
struct hfi1_qp_priv,
tid_wait);
if (!priv)
return NULL;
rvt_get_qp(priv->owner);
return priv->owner;
}
/**
* kernel_tid_waiters - determine rcd wait
* @rcd: the receive context
* @queue: the queue to operate on
* @qp: the head of the qp being processed
*
* This routine will return false IFF
Annotation
- Immediate include surface: `hfi.h`, `qp.h`, `rc.h`, `verbs.h`, `tid_rdma.h`, `exp_rcv.h`, `trace.h`.
- Detected declarations: `function mask_generation`, `function validate_r_tid_ack`, `function tid_rdma_schedule_ack`, `function tid_rdma_trigger_ack`, `function tid_rdma_opfn_encode`, `function tid_rdma_opfn_decode`, `function tid_rdma_opfn_init`, `function tid_rdma_conn_req`, `function tid_rdma_conn_reply`, `function tid_rdma_conn_resp`.
- 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.