drivers/scsi/snic/snic_io.c
Source file repositories/reference/linux-study-clean/drivers/scsi/snic/snic_io.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/snic/snic_io.c- Extension
.c- Size
- 13544 bytes
- Lines
- 556
- 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
linux/errno.hlinux/pci.hlinux/slab.hlinux/interrupt.hlinux/workqueue.hlinux/spinlock.hlinux/mempool.hscsi/scsi_tcq.hsnic_io.hsnic.hcq_enet_desc.hsnic_fwint.h
Detected Declarations
function snic_wq_cmpl_frame_sendfunction snic_wq_cmpl_handler_contfunction snic_wq_cmpl_handlerfunction snic_free_wq_buffunction snic_select_wqfunction snic_wqdesc_availfunction snic_queue_wq_descfunction snic_handle_untagged_reqfunction snic_req_initfunction snic_abort_req_initfunction snic_dr_req_initfunction snic_req_freefunction snic_pci_unmap_rsp_buffunction snic_free_all_untagged_reqsfunction snic_release_untagged_reqfunction snic_hex_dumpfunction snic_dump_descfunction snic_print_descfunction snic_calc_io_process_time
Annotated Snippet
if (rqi->sge_va) {
snic_pci_unmap_rsp_buf(snic, rqi);
kfree((void *)rqi->sge_va);
rqi->sge_va = 0;
}
snic_req_free(snic, rqi);
}
spin_unlock_irqrestore(&snic->spl_cmd_lock, flags);
}
/*
* snic_release_untagged_req : Unlinks the untagged req and frees it.
*/
void
snic_release_untagged_req(struct snic *snic, struct snic_req_info *rqi)
{
unsigned long flags;
spin_lock_irqsave(&snic->snic_lock, flags);
if (snic->in_remove) {
spin_unlock_irqrestore(&snic->snic_lock, flags);
goto end;
}
spin_unlock_irqrestore(&snic->snic_lock, flags);
spin_lock_irqsave(&snic->spl_cmd_lock, flags);
if (list_empty(&rqi->list)) {
spin_unlock_irqrestore(&snic->spl_cmd_lock, flags);
goto end;
}
list_del_init(&rqi->list);
spin_unlock_irqrestore(&snic->spl_cmd_lock, flags);
snic_req_free(snic, rqi);
end:
return;
}
/* dump buf in hex fmt */
void
snic_hex_dump(char *pfx, char *data, int len)
{
SNIC_INFO("%s Dumping Data of Len = %d\n", pfx, len);
print_hex_dump_bytes(pfx, DUMP_PREFIX_NONE, data, len);
}
#define LINE_BUFSZ 128 /* for snic_print_desc fn */
static void
snic_dump_desc(const char *fn, char *os_buf, int len)
{
struct snic_host_req *req = (struct snic_host_req *) os_buf;
struct snic_fw_req *fwreq = (struct snic_fw_req *) os_buf;
struct snic_req_info *rqi = NULL;
char line[LINE_BUFSZ] = { '\0' };
char *cmd_str = NULL;
if (req->hdr.type >= SNIC_RSP_REPORT_TGTS_CMPL)
rqi = (struct snic_req_info *) fwreq->hdr.init_ctx;
else
rqi = (struct snic_req_info *) req->hdr.init_ctx;
SNIC_BUG_ON(rqi == NULL || rqi->req == NULL);
switch (req->hdr.type) {
case SNIC_REQ_REPORT_TGTS:
cmd_str = "report-tgt : ";
snprintf(line, LINE_BUFSZ, "SNIC_REQ_REPORT_TGTS :");
break;
case SNIC_REQ_ICMND:
cmd_str = "icmnd : ";
snprintf(line, LINE_BUFSZ, "SNIC_REQ_ICMND : 0x%x :",
req->u.icmnd.cdb[0]);
break;
case SNIC_REQ_ITMF:
cmd_str = "itmf : ";
snprintf(line, LINE_BUFSZ, "SNIC_REQ_ITMF :");
break;
case SNIC_REQ_HBA_RESET:
cmd_str = "hba reset :";
snprintf(line, LINE_BUFSZ, "SNIC_REQ_HBA_RESET :");
break;
case SNIC_REQ_EXCH_VER:
cmd_str = "exch ver : ";
snprintf(line, LINE_BUFSZ, "SNIC_REQ_EXCH_VER :");
break;
Annotation
- Immediate include surface: `linux/errno.h`, `linux/pci.h`, `linux/slab.h`, `linux/interrupt.h`, `linux/workqueue.h`, `linux/spinlock.h`, `linux/mempool.h`, `scsi/scsi_tcq.h`.
- Detected declarations: `function snic_wq_cmpl_frame_send`, `function snic_wq_cmpl_handler_cont`, `function snic_wq_cmpl_handler`, `function snic_free_wq_buf`, `function snic_select_wq`, `function snic_wqdesc_avail`, `function snic_queue_wq_desc`, `function snic_handle_untagged_req`, `function snic_req_init`, `function snic_abort_req_init`.
- 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.