drivers/scsi/qla2xxx/qla_iocb.c
Source file repositories/reference/linux-study-clean/drivers/scsi/qla2xxx/qla_iocb.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/qla2xxx/qla_iocb.c- Extension
.c- Size
- 121920 bytes
- Lines
- 4490
- 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
qla_def.hqla_target.hlinux/blkdev.hlinux/delay.hscsi/scsi_tcq.h
Detected Declarations
struct fw_dif_contextfunction qla2x00_get_cmd_directionfunction qla2x00_calc_iocbs_32function qla2x00_calc_iocbs_64function qla2x00_prep_cont_type0_iocbfunction qla2x00_prep_cont_type1_iocbfunction qla24xx_configure_prot_modefunction qla2x00_build_scsi_iocbs_32function qla2x00_build_scsi_iocbs_64function qla2xxx_get_next_handlefunction qla2x00_start_scsifunction qla2x00_start_iocbsfunction __qla2x00_markerfunction qla2x00_markerfunction qla2x00_issue_markerfunction qla24xx_build_scsi_type_6_iocbsfunction qla24xx_calc_dsd_listsfunction qla24xx_build_scsi_iocbsfunction scsi_for_each_sgfunction qla24xx_set_t10dif_tagsfunction qla24xx_get_one_block_sgfunction qla24xx_walk_and_build_sglist_no_difbfunction qla24xx_walk_and_build_sglistfunction for_each_sgfunction qla24xx_walk_and_build_prot_sglistfunction for_each_sgfunction for_each_sgfunction list_for_each_entry_safefunction for_each_sgfunction qla24xx_build_scsi_crc_2_iocbsfunction qla24xx_start_scsifunction qla24xx_dif_start_scsifunction qla2xxx_start_scsi_mqfunction qla2xxx_dif_start_scsi_mqfunction __qla2x00_alloc_iocbsfunction qla2x00_alloc_iocbs_readyfunction qla2x00_alloc_iocbsfunction qla24xx_prli_iocbfunction qla24xx_login_iocbfunction qla2x00_login_iocbfunction qla24xx_logout_iocbfunction qla2x00_logout_iocbfunction qla24xx_adisc_iocbfunction qla2x00_adisc_iocbfunction qla24xx_tm_iocbfunction qla2x00_async_donefunction qla2x00_sp_releasefunction qla2x00_init_async_sp
Annotated Snippet
struct fw_dif_context {
__le32 ref_tag;
__le16 app_tag;
uint8_t ref_tag_mask[4]; /* Validation/Replacement Mask*/
uint8_t app_tag_mask[2]; /* Validation/Replacement Mask*/
};
/*
* qla24xx_set_t10dif_tags_from_cmd - Extract Ref and App tags from SCSI command
*
*/
static inline void
qla24xx_set_t10dif_tags(srb_t *sp, struct fw_dif_context *pkt,
unsigned int protcnt)
{
struct scsi_cmnd *cmd = GET_CMD_SP(sp);
pkt->ref_tag = cpu_to_le32(scsi_prot_ref_tag(cmd));
if (cmd->prot_flags & SCSI_PROT_REF_CHECK &&
qla2x00_hba_err_chk_enabled(sp)) {
pkt->ref_tag_mask[0] = 0xff;
pkt->ref_tag_mask[1] = 0xff;
pkt->ref_tag_mask[2] = 0xff;
pkt->ref_tag_mask[3] = 0xff;
}
pkt->app_tag = cpu_to_le16(0);
pkt->app_tag_mask[0] = 0x0;
pkt->app_tag_mask[1] = 0x0;
}
int
qla24xx_get_one_block_sg(uint32_t blk_sz, struct qla2_sgx *sgx,
uint32_t *partial)
{
struct scatterlist *sg;
uint32_t cumulative_partial, sg_len;
dma_addr_t sg_dma_addr;
if (sgx->num_bytes == sgx->tot_bytes)
return 0;
sg = sgx->cur_sg;
cumulative_partial = sgx->tot_partial;
sg_dma_addr = sg_dma_address(sg);
sg_len = sg_dma_len(sg);
sgx->dma_addr = sg_dma_addr + sgx->bytes_consumed;
if ((cumulative_partial + (sg_len - sgx->bytes_consumed)) >= blk_sz) {
sgx->dma_len = (blk_sz - cumulative_partial);
sgx->tot_partial = 0;
sgx->num_bytes += blk_sz;
*partial = 0;
} else {
sgx->dma_len = sg_len - sgx->bytes_consumed;
sgx->tot_partial += sgx->dma_len;
*partial = 1;
}
sgx->bytes_consumed += sgx->dma_len;
if (sg_len == sgx->bytes_consumed) {
sg = sg_next(sg);
sgx->num_sg++;
sgx->cur_sg = sg;
sgx->bytes_consumed = 0;
}
return 1;
}
int
qla24xx_walk_and_build_sglist_no_difb(struct qla_hw_data *ha, srb_t *sp,
struct dsd64 *dsd, uint16_t tot_dsds, struct qla_tc_param *tc)
{
void *next_dsd;
uint8_t avail_dsds = 0;
uint32_t dsd_list_len;
struct dsd_dma *dsd_ptr;
struct scatterlist *sg_prot;
struct dsd64 *cur_dsd = dsd;
uint16_t used_dsds = tot_dsds;
uint32_t prot_int; /* protection interval */
uint32_t partial;
struct qla2_sgx sgx;
dma_addr_t sle_dma;
uint32_t sle_dma_len, tot_prot_dma_len = 0;
Annotation
- Immediate include surface: `qla_def.h`, `qla_target.h`, `linux/blkdev.h`, `linux/delay.h`, `scsi/scsi_tcq.h`.
- Detected declarations: `struct fw_dif_context`, `function qla2x00_get_cmd_direction`, `function qla2x00_calc_iocbs_32`, `function qla2x00_calc_iocbs_64`, `function qla2x00_prep_cont_type0_iocb`, `function qla2x00_prep_cont_type1_iocb`, `function qla24xx_configure_prot_mode`, `function qla2x00_build_scsi_iocbs_32`, `function qla2x00_build_scsi_iocbs_64`, `function qla2xxx_get_next_handle`.
- 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.