drivers/infiniband/hw/bnxt_re/qplib_fp.c
Source file repositories/reference/linux-study-clean/drivers/infiniband/hw/bnxt_re/qplib_fp.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/infiniband/hw/bnxt_re/qplib_fp.c- Extension
.c- Size
- 86086 bytes
- Lines
- 3123
- 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/interrupt.hlinux/spinlock.hlinux/sched.hlinux/slab.hlinux/pci.hlinux/delay.hlinux/prefetch.hlinux/if_ether.hlinux/bnxt/ulp.hrdma/ib_mad.hroce_hsi.hqplib_res.hqplib_rcfw.hqplib_sp.hqplib_fp.hrdma/ib_addr.hbnxt_re.hib_verbs.h
Detected Declarations
function bnxt_qplib_cancel_phantom_processingfunction __bnxt_qplib_add_flush_qpfunction bnxt_qplib_acquire_cq_flush_locksfunction bnxt_qplib_release_cq_flush_locksfunction bnxt_qplib_add_flush_qpfunction __bnxt_qplib_del_flush_qpfunction bnxt_qplib_clean_qpfunction bnxt_qpn_cqn_sched_taskfunction bnxt_qplib_free_qp_hdr_buffunction bnxt_qplib_alloc_qp_hdr_buffunction clean_nqfunction __wait_for_all_nqesfunction bnxt_qplib_service_nqfunction bnxt_re_synchronize_nqfunction bnxt_qplib_nq_irqfunction bnxt_qplib_nq_stop_irqfunction bnxt_qplib_disable_nqfunction bnxt_qplib_nq_start_irqfunction bnxt_qplib_map_nq_dbfunction bnxt_qplib_enable_nqfunction bnxt_qplib_free_nqfunction bnxt_qplib_alloc_nqfunction bnxt_qplib_destroy_srqfunction bnxt_qplib_create_srqfunction bnxt_qplib_query_srqfunction bnxt_qplib_post_srq_recvfunction bnxt_qplib_alloc_init_swqfunction bnxt_re_setup_qp_swqsfunction bnxt_qp_init_dbinfofunction bnxt_qplib_init_psn_ptrfunction bnxt_qplib_create_qp1function bnxt_qplib_create_qpfunction __modify_flags_from_init_statefunction __modify_flags_from_rtr_statefunction __filter_modify_flagsfunction bnxt_set_mandatory_attributesfunction is_optimized_state_transitionfunction bnxt_qplib_modify_qpfunction bnxt_qplib_query_qpfunction __clean_cqfunction bnxt_qplib_destroy_qpfunction bnxt_qplib_free_qp_resfunction bnxt_qplib_get_rq_prod_indexfunction bnxt_qplib_get_qp_buf_from_indexfunction bnxt_qplib_fill_msn_searchfunction bnxt_qplib_fill_psn_searchfunction bnxt_qplib_put_inlinefunction bnxt_qplib_put_sges
Annotated Snippet
if (!qp->rq.flushed) {
dev_dbg(&rcq->hwq.pdev->dev,
"FP: Adding to RQ Flush list = %p\n", qp);
list_add_tail(&qp->rq_flush, &rcq->rqf_head);
qp->rq.flushed = true;
}
}
}
static void bnxt_qplib_acquire_cq_flush_locks(struct bnxt_qplib_qp *qp,
unsigned long *flags)
__acquires(&qp->scq->flush_lock) __acquires(&qp->rcq->flush_lock)
{
spin_lock_irqsave(&qp->scq->flush_lock, *flags);
if (qp->scq == qp->rcq)
__acquire(&qp->rcq->flush_lock);
else
spin_lock(&qp->rcq->flush_lock);
}
static void bnxt_qplib_release_cq_flush_locks(struct bnxt_qplib_qp *qp,
unsigned long *flags)
__releases(&qp->scq->flush_lock) __releases(&qp->rcq->flush_lock)
{
if (qp->scq == qp->rcq)
__release(&qp->rcq->flush_lock);
else
spin_unlock(&qp->rcq->flush_lock);
spin_unlock_irqrestore(&qp->scq->flush_lock, *flags);
}
void bnxt_qplib_add_flush_qp(struct bnxt_qplib_qp *qp)
{
unsigned long flags;
bnxt_qplib_acquire_cq_flush_locks(qp, &flags);
__bnxt_qplib_add_flush_qp(qp);
bnxt_qplib_release_cq_flush_locks(qp, &flags);
}
static void __bnxt_qplib_del_flush_qp(struct bnxt_qplib_qp *qp)
{
if (qp->sq.flushed) {
qp->sq.flushed = false;
list_del(&qp->sq_flush);
}
if (!qp->srq) {
if (qp->rq.flushed) {
qp->rq.flushed = false;
list_del(&qp->rq_flush);
}
}
}
void bnxt_qplib_clean_qp(struct bnxt_qplib_qp *qp)
{
unsigned long flags;
bnxt_qplib_acquire_cq_flush_locks(qp, &flags);
__clean_cq(qp->scq, (u64)(unsigned long)qp);
qp->sq.hwq.prod = 0;
qp->sq.hwq.cons = 0;
__clean_cq(qp->rcq, (u64)(unsigned long)qp);
qp->rq.hwq.prod = 0;
qp->rq.hwq.cons = 0;
__bnxt_qplib_del_flush_qp(qp);
bnxt_qplib_release_cq_flush_locks(qp, &flags);
}
static void bnxt_qpn_cqn_sched_task(struct work_struct *work)
{
struct bnxt_qplib_nq_work *nq_work =
container_of(work, struct bnxt_qplib_nq_work, work);
struct bnxt_qplib_cq *cq = nq_work->cq;
struct bnxt_qplib_nq *nq = nq_work->nq;
if (cq && nq) {
spin_lock_bh(&cq->compl_lock);
if (atomic_read(&cq->arm_state) && nq->cqn_handler) {
dev_dbg(&nq->pdev->dev,
"%s:Trigger cq = %p event nq = %p\n",
__func__, cq, nq);
nq->cqn_handler(nq, cq);
}
spin_unlock_bh(&cq->compl_lock);
}
kfree(nq_work);
}
Annotation
- Immediate include surface: `linux/interrupt.h`, `linux/spinlock.h`, `linux/sched.h`, `linux/slab.h`, `linux/pci.h`, `linux/delay.h`, `linux/prefetch.h`, `linux/if_ether.h`.
- Detected declarations: `function bnxt_qplib_cancel_phantom_processing`, `function __bnxt_qplib_add_flush_qp`, `function bnxt_qplib_acquire_cq_flush_locks`, `function bnxt_qplib_release_cq_flush_locks`, `function bnxt_qplib_add_flush_qp`, `function __bnxt_qplib_del_flush_qp`, `function bnxt_qplib_clean_qp`, `function bnxt_qpn_cqn_sched_task`, `function bnxt_qplib_free_qp_hdr_buf`, `function bnxt_qplib_alloc_qp_hdr_buf`.
- 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.