drivers/infiniband/hw/bnxt_re/qplib_rcfw.c
Source file repositories/reference/linux-study-clean/drivers/infiniband/hw/bnxt_re/qplib_rcfw.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/infiniband/hw/bnxt_re/qplib_rcfw.c- Extension
.c- Size
- 35129 bytes
- Lines
- 1202
- 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/pci.hlinux/prefetch.hlinux/delay.hroce_hsi.hqplib_res.hqplib_rcfw.hqplib_sp.hqplib_fp.hqplib_tlv.h
Detected Declarations
function resourcesfunction bnxt_re_is_fw_stalledfunction __wait_for_respfunction cpufunction __send_message_no_waiterfunction __send_messagefunction __poll_for_respfunction __send_message_basic_sanityfunction __destroy_timedout_ahfunction __bnxt_qplib_rcfw_send_messagefunction bnxt_qplib_rcfw_send_messagefunction bnxt_qplib_process_func_eventfunction bnxt_qplib_process_qp_eventfunction bnxt_qplib_service_creqfunction bnxt_qplib_creq_irqfunction bnxt_qplib_deinit_rcfwfunction bnxt_qplib_init_rcfwfunction bnxt_qplib_free_rcfw_channelfunction bnxt_qplib_alloc_rcfw_channelfunction bnxt_qplib_rcfw_stop_irqfunction bnxt_qplib_disable_rcfw_channelfunction bnxt_qplib_rcfw_start_irqfunction bnxt_qplib_map_cmdq_mboxfunction bnxt_qplib_map_creq_dbfunction bnxt_qplib_start_rcfwfunction bnxt_qplib_enable_rcfw_channel
Annotated Snippet
if (!qp) {
spin_unlock(&rcfw->tbl_lock);
break;
}
bnxt_qplib_mark_qp_error(qp);
rc = rcfw->creq.aeq_handler(rcfw, qp_event, qp);
spin_unlock(&rcfw->tbl_lock);
dev_dbg(&pdev->dev, "Received QP error notification\n");
dev_dbg(&pdev->dev,
"qpid 0x%x, req_err=0x%x, resp_err=0x%x\n",
qp_id, err_event->req_err_state_reason,
err_event->res_err_state_reason);
break;
default:
/*
* Command Response
* cmdq->lock needs to be acquired to synchronie
* the command send and completion reaping. This function
* is always called with creq->lock held. Using
* the nested variant of spin_lock.
*
*/
spin_lock_nested(&hwq->lock, SINGLE_DEPTH_NESTING);
cookie = le16_to_cpu(qp_event->cookie);
blocked = cookie & RCFW_CMD_IS_BLOCKING;
cookie &= RCFW_MAX_COOKIE_VALUE;
crsqe = &rcfw->crsqe_tbl[cookie];
if (WARN_ONCE(test_bit(FIRMWARE_STALL_DETECTED,
&rcfw->cmdq.flags),
"QPLIB: Unreponsive rcfw channel detected.!!")) {
dev_info(&pdev->dev,
"rcfw timedout: cookie = %#x, free_slots = %d",
cookie, crsqe->free_slots);
spin_unlock(&hwq->lock);
return rc;
}
if (crsqe->is_internal_cmd && !qp_event->status)
atomic_dec(&rcfw->timeout_send);
if (crsqe->is_waiter_alive) {
if (crsqe->resp) {
memcpy(crsqe->resp, qp_event, sizeof(*qp_event));
/* Insert write memory barrier to ensure that
* response data is copied before clearing the
* flags
*/
smp_wmb();
}
if (!blocked)
wait_cmds++;
}
req_size = crsqe->req_size;
is_waiter_alive = crsqe->is_waiter_alive;
crsqe->req_size = 0;
if (!is_waiter_alive)
crsqe->resp = NULL;
crsqe->is_in_used = false;
hwq->cons += req_size;
/* This is a case to handle below scenario -
* Create AH is completed successfully by firmware,
* but completion took more time and driver already lost
* the context of create_ah from caller.
* We have already return failure for create_ah verbs,
* so let's destroy the same address vector since it is
* no more used in stack. We don't care about completion
* in __send_message_no_waiter.
* If destroy_ah is failued by firmware, there will be AH
* resource leak and relatively not critical + unlikely
* scenario. Current design is not to handle such case.
*/
if (!is_waiter_alive && !qp_event->status &&
qp_event->event == CREQ_QP_EVENT_EVENT_CREATE_AH)
__destroy_timedout_ah(rcfw,
(struct creq_create_ah_resp *)
qp_event);
spin_unlock(&hwq->lock);
}
*num_wait += wait_cmds;
return rc;
}
/* SP - CREQ Completion handlers */
Annotation
- Immediate include surface: `linux/interrupt.h`, `linux/spinlock.h`, `linux/pci.h`, `linux/prefetch.h`, `linux/delay.h`, `roce_hsi.h`, `qplib_res.h`, `qplib_rcfw.h`.
- Detected declarations: `function resources`, `function bnxt_re_is_fw_stalled`, `function __wait_for_resp`, `function cpu`, `function __send_message_no_waiter`, `function __send_message`, `function __poll_for_resp`, `function __send_message_basic_sanity`, `function __destroy_timedout_ah`, `function __bnxt_qplib_rcfw_send_message`.
- 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.