drivers/net/ethernet/brocade/bna/bfa_msgq.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/brocade/bna/bfa_msgq.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/brocade/bna/bfa_msgq.c- Extension
.c- Size
- 15085 bytes
- Lines
- 659
- Domain
- Driver Families
- Bucket
- drivers/net
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
bfi.hbfa_msgq.hbfa_ioc.h
Detected Declarations
enum cmdq_eventenum rspq_eventfunction cmdq_sm_stopped_entryfunction cmdq_sm_stoppedfunction cmdq_sm_init_wait_entryfunction cmdq_sm_init_waitfunction cmdq_sm_ready_entryfunction cmdq_sm_dbell_wait_entryfunction cmdq_sm_dbell_waitfunction bfa_msgq_cmdq_dbell_readyfunction bfa_msgq_cmdq_dbellfunction __cmd_copyfunction bfa_msgq_cmdq_ci_updatefunction bfa_msgq_cmdq_copy_nextfunction bfa_msgq_cmdq_copy_reqfunction bfa_msgq_cmdq_copy_rspfunction bfa_msgq_cmdq_attachfunction rspq_sm_stopped_entryfunction rspq_sm_stoppedfunction rspq_sm_init_wait_entryfunction rspq_sm_init_waitfunction rspq_sm_ready_entryfunction rspq_sm_dbell_wait_entryfunction rspq_sm_dbell_waitfunction bfa_msgq_rspq_dbell_readyfunction bfa_msgq_rspq_dbellfunction bfa_msgq_rspq_pi_updatefunction bfa_msgq_rspq_attachfunction bfa_msgq_init_rspfunction bfa_msgq_initfunction bfa_msgq_isrfunction bfa_msgq_notifyfunction bfa_msgq_meminfofunction bfa_msgq_memclaimfunction bfa_msgq_attachfunction bfa_msgq_regisrfunction bfa_msgq_cmd_postfunction bfa_msgq_rsp_copy
Annotated Snippet
if (cmdq->flags & BFA_MSGQ_CMDQ_F_DB_UPDATE) {
cmdq->flags &= ~BFA_MSGQ_CMDQ_F_DB_UPDATE;
bfa_fsm_set_state(cmdq, cmdq_sm_dbell_wait);
} else
bfa_fsm_set_state(cmdq, cmdq_sm_ready);
break;
default:
bfa_sm_fault(event);
}
}
static void
cmdq_sm_ready_entry(struct bfa_msgq_cmdq *cmdq)
{
}
static void
cmdq_sm_ready(struct bfa_msgq_cmdq *cmdq, enum cmdq_event event)
{
switch (event) {
case CMDQ_E_STOP:
case CMDQ_E_FAIL:
bfa_fsm_set_state(cmdq, cmdq_sm_stopped);
break;
case CMDQ_E_POST:
bfa_fsm_set_state(cmdq, cmdq_sm_dbell_wait);
break;
default:
bfa_sm_fault(event);
}
}
static void
cmdq_sm_dbell_wait_entry(struct bfa_msgq_cmdq *cmdq)
{
bfa_msgq_cmdq_dbell(cmdq);
}
static void
cmdq_sm_dbell_wait(struct bfa_msgq_cmdq *cmdq, enum cmdq_event event)
{
switch (event) {
case CMDQ_E_STOP:
case CMDQ_E_FAIL:
bfa_fsm_set_state(cmdq, cmdq_sm_stopped);
break;
case CMDQ_E_POST:
cmdq->flags |= BFA_MSGQ_CMDQ_F_DB_UPDATE;
break;
case CMDQ_E_DB_READY:
if (cmdq->flags & BFA_MSGQ_CMDQ_F_DB_UPDATE) {
cmdq->flags &= ~BFA_MSGQ_CMDQ_F_DB_UPDATE;
bfa_fsm_set_state(cmdq, cmdq_sm_dbell_wait);
} else
bfa_fsm_set_state(cmdq, cmdq_sm_ready);
break;
default:
bfa_sm_fault(event);
}
}
static void
bfa_msgq_cmdq_dbell_ready(void *arg)
{
struct bfa_msgq_cmdq *cmdq = (struct bfa_msgq_cmdq *)arg;
bfa_fsm_send_event(cmdq, CMDQ_E_DB_READY);
}
static void
bfa_msgq_cmdq_dbell(struct bfa_msgq_cmdq *cmdq)
{
struct bfi_msgq_h2i_db *dbell =
(struct bfi_msgq_h2i_db *)(&cmdq->dbell_mb.msg[0]);
memset(dbell, 0, sizeof(struct bfi_msgq_h2i_db));
bfi_h2i_set(dbell->mh, BFI_MC_MSGQ, BFI_MSGQ_H2I_DOORBELL_PI, 0);
dbell->mh.mtag.i2htok = 0;
dbell->idx.cmdq_pi = htons(cmdq->producer_index);
if (!bfa_nw_ioc_mbox_queue(cmdq->msgq->ioc, &cmdq->dbell_mb,
bfa_msgq_cmdq_dbell_ready, cmdq)) {
bfa_msgq_cmdq_dbell_ready(cmdq);
}
}
Annotation
- Immediate include surface: `bfi.h`, `bfa_msgq.h`, `bfa_ioc.h`.
- Detected declarations: `enum cmdq_event`, `enum rspq_event`, `function cmdq_sm_stopped_entry`, `function cmdq_sm_stopped`, `function cmdq_sm_init_wait_entry`, `function cmdq_sm_init_wait`, `function cmdq_sm_ready_entry`, `function cmdq_sm_dbell_wait_entry`, `function cmdq_sm_dbell_wait`, `function bfa_msgq_cmdq_dbell_ready`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
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.