drivers/scsi/qedi/qedi_fw.c
Source file repositories/reference/linux-study-clean/drivers/scsi/qedi/qedi_fw.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/qedi/qedi_fw.c- Extension
.c- Size
- 66445 bytes
- Lines
- 2159
- 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.
- 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/blkdev.hscsi/scsi_tcq.hlinux/delay.hqedi.hqedi_iscsi.hqedi_gbl.hqedi_fw_iscsi.hqedi_fw_scsi.h
Detected Declarations
function qedi_iscsi_unmap_sg_listfunction qedi_process_logout_respfunction qedi_process_text_respfunction qedi_tmf_resp_workfunction qedi_process_tmf_respfunction qedi_process_login_respfunction qedi_get_rq_bdq_buffunction qedi_put_rq_bdq_buffunction qedi_unsol_pdu_adjust_bdqfunction qedi_process_nopin_mesgfunction qedi_process_async_mesgfunction qedi_process_reject_mesgfunction qedi_scsi_completionfunction GET_FIELDfunction qedi_mtask_completionfunction qedi_process_nopin_local_cmplfunction qedi_process_cmd_cleanup_respfunction qedi_fp_process_cqesfunction qedi_ring_doorbellfunction qedi_get_wqe_idxfunction qedi_send_iscsi_loginfunction qedi_send_iscsi_logoutfunction qedi_cleanup_all_iofunction list_for_each_entry_safefunction atomic_readfunction qedi_clearsqfunction qedi_wait_for_cleanup_requestfunction qedi_abort_workfunction send_iscsi_tmffunction qedi_send_iscsi_tmffunction qedi_send_iscsi_textfunction qedi_send_iscsi_nopoutfunction qedi_split_bdfunction qedi_map_scsi_sgfunction scsi_for_each_sgfunction qedi_iscsi_map_sg_listfunction qedi_cpy_scsi_cdbfunction qedi_trace_iofunction qedi_iscsi_send_ioreqfunction qedi_iscsi_cleanup_task
Annotated Snippet
if (qedi_conn->ep_disconnect_starting) {
/* Session is down so ep_disconnect will clean up */
spin_unlock(&qedi_conn->tmf_work_lock);
goto unblock_sess;
}
qedi_conn->fw_cleanup_works++;
spin_unlock(&qedi_conn->tmf_work_lock);
INIT_WORK(&qedi_cmd->tmf_work, qedi_tmf_resp_work);
queue_work(qedi->tmf_thread, &qedi_cmd->tmf_work);
goto unblock_sess;
}
spin_unlock(&qedi_conn->tmf_work_lock);
__iscsi_complete_pdu(conn, (struct iscsi_hdr *)resp_hdr_ptr, NULL, 0);
kfree(resp_hdr_ptr);
unblock_sess:
spin_unlock(&session->back_lock);
}
static void qedi_process_login_resp(struct qedi_ctx *qedi,
union iscsi_cqe *cqe,
struct iscsi_task *task,
struct qedi_conn *qedi_conn)
{
struct iscsi_conn *conn = qedi_conn->cls_conn->dd_data;
struct iscsi_session *session = conn->session;
struct iscsi_task_context *task_ctx;
struct iscsi_login_rsp *resp_hdr_ptr;
struct iscsi_login_response_hdr *cqe_login_response;
struct qedi_cmd *cmd;
int pld_len;
cmd = (struct qedi_cmd *)task->dd_data;
cqe_login_response = &cqe->cqe_common.iscsi_hdr.login_response;
task_ctx = qedi_get_task_mem(&qedi->tasks, cmd->task_id);
spin_lock(&session->back_lock);
resp_hdr_ptr = (struct iscsi_login_rsp *)&qedi_conn->gen_pdu.resp_hdr;
memset(resp_hdr_ptr, 0, sizeof(struct iscsi_login_rsp));
resp_hdr_ptr->opcode = cqe_login_response->opcode;
resp_hdr_ptr->flags = cqe_login_response->flags_attr;
resp_hdr_ptr->hlength = 0;
hton24(resp_hdr_ptr->dlength,
(cqe_login_response->hdr_second_dword &
ISCSI_LOGIN_RESPONSE_HDR_DATA_SEG_LEN_MASK));
resp_hdr_ptr->itt = build_itt(cqe->cqe_solicited.itid,
conn->session->age);
resp_hdr_ptr->tsih = cqe_login_response->tsih;
resp_hdr_ptr->statsn = cpu_to_be32(cqe_login_response->stat_sn);
resp_hdr_ptr->exp_cmdsn = cpu_to_be32(cqe_login_response->exp_cmd_sn);
resp_hdr_ptr->max_cmdsn = cpu_to_be32(cqe_login_response->max_cmd_sn);
resp_hdr_ptr->status_class = cqe_login_response->status_class;
resp_hdr_ptr->status_detail = cqe_login_response->status_detail;
pld_len = cqe_login_response->hdr_second_dword &
ISCSI_LOGIN_RESPONSE_HDR_DATA_SEG_LEN_MASK;
qedi_conn->gen_pdu.resp_wr_ptr = qedi_conn->gen_pdu.resp_buf + pld_len;
spin_lock(&qedi_conn->list_lock);
if (likely(cmd->io_cmd_in_list)) {
cmd->io_cmd_in_list = false;
list_del_init(&cmd->io_cmd);
qedi_conn->active_cmd_count--;
}
spin_unlock(&qedi_conn->list_lock);
memset(task_ctx, '\0', sizeof(*task_ctx));
__iscsi_complete_pdu(conn, (struct iscsi_hdr *)resp_hdr_ptr,
qedi_conn->gen_pdu.resp_buf,
(qedi_conn->gen_pdu.resp_wr_ptr -
qedi_conn->gen_pdu.resp_buf));
spin_unlock(&session->back_lock);
QEDI_INFO(&qedi->dbg_ctx, QEDI_LOG_TID,
"Freeing tid=0x%x for cid=0x%x\n",
cmd->task_id, qedi_conn->iscsi_conn_id);
cmd->state = RESPONSE_RECEIVED;
}
static void qedi_get_rq_bdq_buf(struct qedi_ctx *qedi,
struct iscsi_cqe_unsolicited *cqe,
char *ptr, int len)
{
u16 idx = 0;
Annotation
- Immediate include surface: `linux/blkdev.h`, `scsi/scsi_tcq.h`, `linux/delay.h`, `qedi.h`, `qedi_iscsi.h`, `qedi_gbl.h`, `qedi_fw_iscsi.h`, `qedi_fw_scsi.h`.
- Detected declarations: `function qedi_iscsi_unmap_sg_list`, `function qedi_process_logout_resp`, `function qedi_process_text_resp`, `function qedi_tmf_resp_work`, `function qedi_process_tmf_resp`, `function qedi_process_login_resp`, `function qedi_get_rq_bdq_buf`, `function qedi_put_rq_bdq_buf`, `function qedi_unsol_pdu_adjust_bdq`, `function qedi_process_nopin_mesg`.
- 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.