drivers/scsi/qla2xxx/qla_target.c
Source file repositories/reference/linux-study-clean/drivers/scsi/qla2xxx/qla_target.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/qla2xxx/qla_target.c- Extension
.c- Size
- 235231 bytes
- Lines
- 8422
- Domain
- Driver Families
- Bucket
- drivers/scsi
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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/module.hlinux/init.hlinux/types.hlinux/blkdev.hlinux/interrupt.hlinux/pci.hlinux/delay.hlinux/list.hlinux/workqueue.hlinux/unaligned.hscsi/scsi.hscsi/scsi_host.hscsi/scsi_tcq.hqla_def.hqla_target.h
Detected Declarations
enum fcp_resp_rsp_codesfunction wmbfunction qlt_issue_markerfunction qlt_incr_num_pend_cmdsfunction qlt_decr_num_pend_cmdsfunction qlt_queue_unknown_atiofunction qlt_try_to_dequeue_unknown_atiosfunction list_for_each_entry_safefunction qlt_unknown_atio_work_fnfunction qlt_24xx_atio_pkt_all_vpsfunction qlt_response_pkt_all_vpsfunction qla24xx_post_nack_workfunction qla2x00_async_nack_sp_donefunction qla24xx_async_notify_ackfunction qla24xx_do_nack_workfunction qla24xx_delete_sess_fnfunction qla2x00_reg_remote_portfunction qlt_plogi_ack_find_addfunction list_for_each_entryfunction qlt_plogi_ack_unreffunction list_for_each_entryfunction qlt_plogi_ack_linkfunction qlt_send_first_logofunction list_for_each_entryfunction qlt_free_session_donefunction qla2x00_eh_wait_for_pending_commandsfunction qlt_unreg_sessfunction qlt_resetfunction qla24xx_chk_fcp_statefunction qlt_schedule_sess_for_deletionfunction qlt_clear_tgt_dbfunction list_for_each_entryfunction qla24xx_get_loop_idfunction test_tgt_sess_countfunction qlt_stop_phase1function qlt_stop_phase2function qlt_releasefunction qlt_sched_sess_workfunction qlt_send_notify_ackfunction qlt_build_abts_resp_iocbfunction qlt_24xx_send_abts_respfunction qlt_24xx_retry_term_exchangefunction portfunction list_for_each_entryfunction qlt_do_tmr_workfunction __qlt_24xx_handle_abtsfunction qlt_24xx_handle_abtsfunction qlt_24xx_send_task_mgmt_ctio
Annotated Snippet
if (rc != QLA_SUCCESS) {
ql_dbg(ql_dbg_tgt, vha, 0xe03d,
"qla_target(%d): issue_marker() failed\n",
vha->vp_idx);
}
return rc;
}
return QLA_SUCCESS;
}
struct scsi_qla_host *qla_find_host_by_d_id(struct scsi_qla_host *vha,
be_id_t d_id)
{
struct scsi_qla_host *host;
uint32_t key;
if (vha->d_id.b.area == d_id.area &&
vha->d_id.b.domain == d_id.domain &&
vha->d_id.b.al_pa == d_id.al_pa)
return vha;
key = be_to_port_id(d_id).b24;
host = btree_lookup32(&vha->hw->host_map, key);
if (!host)
ql_dbg(ql_dbg_tgt_mgt + ql_dbg_verbose, vha, 0xf005,
"Unable to find host %06x\n", key);
return host;
}
static inline void qlt_incr_num_pend_cmds(struct scsi_qla_host *vha)
{
unsigned long flags;
spin_lock_irqsave(&vha->hw->tgt.q_full_lock, flags);
vha->hw->tgt.num_pend_cmds++;
if (vha->hw->tgt.num_pend_cmds > vha->qla_stats.stat_max_pend_cmds)
vha->qla_stats.stat_max_pend_cmds =
vha->hw->tgt.num_pend_cmds;
spin_unlock_irqrestore(&vha->hw->tgt.q_full_lock, flags);
}
static inline void qlt_decr_num_pend_cmds(struct scsi_qla_host *vha)
{
unsigned long flags;
spin_lock_irqsave(&vha->hw->tgt.q_full_lock, flags);
vha->hw->tgt.num_pend_cmds--;
spin_unlock_irqrestore(&vha->hw->tgt.q_full_lock, flags);
}
static void qlt_queue_unknown_atio(scsi_qla_host_t *vha,
struct atio_from_isp *atio, uint8_t ha_locked)
{
struct qla_tgt_sess_op *u;
struct qla_tgt *tgt = vha->vha_tgt.qla_tgt;
unsigned long flags;
unsigned int add_cdb_len = 0;
/* atio must be the last member of qla_tgt_sess_op for add_cdb_len */
BUILD_BUG_ON(offsetof(struct qla_tgt_sess_op, atio) + sizeof(u->atio) != sizeof(*u));
if (tgt->tgt_stop) {
ql_dbg(ql_dbg_async, vha, 0x502c,
"qla_target(%d): dropping unknown ATIO_TYPE7, because tgt is being stopped",
vha->vp_idx);
goto out_term;
}
if (atio->u.raw.entry_type == ATIO_TYPE7 &&
atio->u.isp24.fcp_cmnd.task_mgmt_flags == 0)
add_cdb_len =
((unsigned int) atio->u.isp24.fcp_cmnd.add_cdb_len) * 4;
u = kzalloc(sizeof(*u) + add_cdb_len, GFP_ATOMIC);
if (u == NULL)
goto out_term;
u->vha = vha;
memcpy(&u->atio, atio, sizeof(*atio) + add_cdb_len);
INIT_LIST_HEAD(&u->cmd_list);
spin_lock_irqsave(&vha->cmd_list_lock, flags);
list_add_tail(&u->cmd_list, &vha->unknown_atio_list);
spin_unlock_irqrestore(&vha->cmd_list_lock, flags);
schedule_delayed_work(&vha->unknown_atio_work, 1);
Annotation
- Immediate include surface: `linux/module.h`, `linux/init.h`, `linux/types.h`, `linux/blkdev.h`, `linux/interrupt.h`, `linux/pci.h`, `linux/delay.h`, `linux/list.h`.
- Detected declarations: `enum fcp_resp_rsp_codes`, `function wmb`, `function qlt_issue_marker`, `function qlt_incr_num_pend_cmds`, `function qlt_decr_num_pend_cmds`, `function qlt_queue_unknown_atio`, `function qlt_try_to_dequeue_unknown_atios`, `function list_for_each_entry_safe`, `function qlt_unknown_atio_work_fn`, `function qlt_24xx_atio_pkt_all_vps`.
- Atlas domain: Driver Families / drivers/scsi.
- Implementation status: integration 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.