drivers/scsi/be2iscsi/be_cmds.c
Source file repositories/reference/linux-study-clean/drivers/scsi/be2iscsi/be_cmds.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/be2iscsi/be_cmds.c- Extension
.c- Size
- 52540 bytes
- Lines
- 1865
- Domain
- Driver Families
- Bucket
- drivers/scsi
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
scsi/iscsi_proto.hbe_main.hbe.hbe_mgmt.h
Detected Declarations
function free_mcc_wrbfunction __beiscsi_mcc_compl_statusfunction beiscsi_mccq_compl_waitfunction beiscsi_process_mbox_complfunction datafunction beiscsi_process_async_linkfunction beiscsi_process_async_slifunction beiscsi_process_async_eventfunction beiscsi_process_mcc_complfunction be_mcc_notifyfunction be_mbox_db_ready_pollfunction be_mbox_notifyfunction be_wrb_hdr_preparefunction be_cmd_hdr_preparefunction be_cmd_page_addrs_preparefunction eq_delay_to_multfunction beiscsi_cmd_eq_createfunction beiscsi_cmd_cq_createfunction be_encoded_q_lenfunction beiscsi_cmd_mccq_createfunction beiscsi_cmd_q_destroyfunction be_cmd_create_default_pdu_queuefunction be_cmd_wrbq_createfunction be_cmd_iscsi_post_template_hdrfunction be_cmd_iscsi_remove_template_hdrfunction be_cmd_iscsi_post_sgl_pagesfunction be_cmd_set_vlanfunction beiscsi_check_supported_fwfunction beiscsi_get_fw_configfunction beiscsi_get_port_namefunction beiscsi_set_host_datafunction beiscsi_set_uer_featurefunction beiscsi_get_post_stagefunction beiscsi_check_fw_rdyfunction beiscsi_cmd_function_resetfunction beiscsi_cmd_special_wrbfunction beiscsi_init_sliportfunction beiscsi_cmd_iscsi_cleanupfunction beiscsi_detect_uefunction beiscsi_detect_tpe
Annotated Snippet
if (status == MCC_STATUS_INSUFFICIENT_BUFFER) {
mbx_resp_hdr = (struct be_cmd_resp_hdr *)mbx_hdr;
beiscsi_log(phba, KERN_WARNING,
BEISCSI_LOG_INIT | BEISCSI_LOG_EH |
BEISCSI_LOG_CONFIG,
"BC_%d : Insufficient Buffer Error Resp_Len : %d Actual_Resp_Len : %d\n",
mbx_resp_hdr->response_length,
mbx_resp_hdr->actual_resp_len);
rc = -EAGAIN;
}
}
return rc;
}
/*
* beiscsi_mccq_compl_wait()- Process completion in MCC CQ
* @phba: Driver private structure
* @tag: Tag for the MBX Command
* @wrb: the WRB used for the MBX Command
* @mbx_cmd_mem: ptr to memory allocated for MBX Cmd
*
* Waits for MBX completion with the passed TAG.
*
* return
* Success: 0
* Failure: Non-Zero
**/
int beiscsi_mccq_compl_wait(struct beiscsi_hba *phba,
unsigned int tag,
struct be_mcc_wrb **wrb,
struct be_dma_mem *mbx_cmd_mem)
{
int rc = 0;
if (!tag || tag > MAX_MCC_CMD) {
__beiscsi_log(phba, KERN_ERR,
"BC_%d : invalid tag %u\n", tag);
return -EINVAL;
}
if (beiscsi_hba_in_error(phba)) {
clear_bit(MCC_TAG_STATE_RUNNING,
&phba->ctrl.ptag_state[tag].tag_state);
return -EIO;
}
/* wait for the mccq completion */
rc = wait_event_interruptible_timeout(phba->ctrl.mcc_wait[tag],
phba->ctrl.mcc_tag_status[tag],
msecs_to_jiffies(
BEISCSI_HOST_MBX_TIMEOUT));
/**
* Return EIO if port is being disabled. Associated DMA memory, if any,
* is freed by the caller. When port goes offline, MCCQ is cleaned up
* so does WRB.
*/
if (!test_bit(BEISCSI_HBA_ONLINE, &phba->state)) {
clear_bit(MCC_TAG_STATE_RUNNING,
&phba->ctrl.ptag_state[tag].tag_state);
return -EIO;
}
/**
* If MBOX cmd timeout expired, tag and resource allocated
* for cmd is not freed until FW returns completion.
*/
if (rc <= 0) {
struct be_dma_mem *tag_mem;
/**
* PCI/DMA memory allocated and posted in non-embedded mode
* will have mbx_cmd_mem != NULL.
* Save virtual and bus addresses for the command so that it
* can be freed later.
**/
tag_mem = &phba->ctrl.ptag_state[tag].tag_mem_state;
if (mbx_cmd_mem) {
tag_mem->size = mbx_cmd_mem->size;
tag_mem->va = mbx_cmd_mem->va;
tag_mem->dma = mbx_cmd_mem->dma;
} else
tag_mem->size = 0;
/* first make tag_mem_state visible to all */
wmb();
set_bit(MCC_TAG_STATE_TIMEOUT,
&phba->ctrl.ptag_state[tag].tag_state);
beiscsi_log(phba, KERN_ERR,
Annotation
- Immediate include surface: `scsi/iscsi_proto.h`, `be_main.h`, `be.h`, `be_mgmt.h`.
- Detected declarations: `function free_mcc_wrb`, `function __beiscsi_mcc_compl_status`, `function beiscsi_mccq_compl_wait`, `function beiscsi_process_mbox_compl`, `function data`, `function beiscsi_process_async_link`, `function beiscsi_process_async_sli`, `function beiscsi_process_async_event`, `function beiscsi_process_mcc_compl`, `function be_mcc_notify`.
- Atlas domain: Driver Families / drivers/scsi.
- 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.