drivers/infiniband/hw/bng_re/bng_fw.c
Source file repositories/reference/linux-study-clean/drivers/infiniband/hw/bng_re/bng_fw.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/infiniband/hw/bng_re/bng_fw.c- Extension
.c- Size
- 20182 bytes
- Lines
- 766
- 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/pci.hbng_roce_hsi.hbng_res.hbng_fw.hbng_sp.h
Detected Declarations
function resourcesfunction bng_re_free_rcfw_channelfunction bng_re_alloc_fw_channelfunction bng_re_process_qp_eventfunction bng_re_process_func_eventfunction bng_re_service_creqfunction __send_message_basic_sanityfunction __send_messagefunction __wait_for_respfunction bng_re_rcfw_send_messagefunction bng_re_map_cmdq_mboxfunction bng_re_creq_irqfunction bng_re_rcfw_start_irqfunction bng_re_map_creq_dbfunction bng_re_rcfw_stop_irqfunction bng_re_disable_rcfw_channelfunction bng_re_start_rcfwfunction bng_re_enable_fw_channelfunction bng_re_deinit_rcfwfunction _is_hw_retx_supportedfunction _is_optimize_modify_qp_supportedfunction bng_re_init_rcfw
Annotated Snippet
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();
}
}
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;
spin_unlock(&hwq->lock);
}
*num_wait += wait_cmds;
return 0;
}
/* function events */
static int bng_re_process_func_event(struct bng_re_rcfw *rcfw,
struct creq_func_event *func_event)
{
switch (func_event->event) {
case CREQ_FUNC_EVENT_EVENT_TX_WQE_ERROR:
case CREQ_FUNC_EVENT_EVENT_TX_DATA_ERROR:
case CREQ_FUNC_EVENT_EVENT_RX_WQE_ERROR:
case CREQ_FUNC_EVENT_EVENT_RX_DATA_ERROR:
case CREQ_FUNC_EVENT_EVENT_CQ_ERROR:
case CREQ_FUNC_EVENT_EVENT_TQM_ERROR:
case CREQ_FUNC_EVENT_EVENT_CFCQ_ERROR:
case CREQ_FUNC_EVENT_EVENT_CFCS_ERROR:
case CREQ_FUNC_EVENT_EVENT_CFCC_ERROR:
case CREQ_FUNC_EVENT_EVENT_CFCM_ERROR:
case CREQ_FUNC_EVENT_EVENT_TIM_ERROR:
case CREQ_FUNC_EVENT_EVENT_VF_COMM_REQUEST:
case CREQ_FUNC_EVENT_EVENT_RESOURCE_EXHAUSTED:
break;
default:
return -EINVAL;
}
return 0;
}
/* CREQ Completion handlers */
static void bng_re_service_creq(struct tasklet_struct *t)
{
struct bng_re_rcfw *rcfw = from_tasklet(rcfw, t, creq.creq_tasklet);
struct bng_re_creq_ctx *creq = &rcfw->creq;
u32 type, budget = BNG_FW_CREQ_ENTRY_POLL_BUDGET;
struct bng_re_hwq *hwq = &creq->hwq;
struct creq_base *creqe;
u32 num_wakeup = 0;
u32 hw_polled = 0;
/* Service the CREQ until budget is over */
spin_lock_bh(&hwq->lock);
while (budget > 0) {
creqe = bng_re_get_qe(hwq, hwq->cons, NULL);
if (!BNG_FW_CREQ_CMP_VALID(creqe, creq->creq_db.dbinfo.flags))
break;
/* The valid test of the entry must be done first before
* reading any further.
*/
dma_rmb();
type = creqe->type & CREQ_BASE_TYPE_MASK;
switch (type) {
case CREQ_BASE_TYPE_QP_EVENT:
bng_re_process_qp_event
(rcfw, (struct creq_qp_event *)creqe,
&num_wakeup);
creq->stats.creq_qp_event_processed++;
break;
case CREQ_BASE_TYPE_FUNC_EVENT:
if (!bng_re_process_func_event
(rcfw, (struct creq_func_event *)creqe))
creq->stats.creq_func_event_processed++;
Annotation
- Immediate include surface: `linux/pci.h`, `bng_roce_hsi.h`, `bng_res.h`, `bng_fw.h`, `bng_sp.h`.
- Detected declarations: `function resources`, `function bng_re_free_rcfw_channel`, `function bng_re_alloc_fw_channel`, `function bng_re_process_qp_event`, `function bng_re_process_func_event`, `function bng_re_service_creq`, `function __send_message_basic_sanity`, `function __send_message`, `function __wait_for_resp`, `function bng_re_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.