drivers/scsi/qla2xxx/qla_bsg.c
Source file repositories/reference/linux-study-clean/drivers/scsi/qla2xxx/qla_bsg.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/qla2xxx/qla_bsg.c- Extension
.c- Size
- 92595 bytes
- Lines
- 3374
- 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_gbl.hlinux/kthread.hlinux/vmalloc.hlinux/delay.hlinux/bsg-lib.h
Detected Declarations
function qla2xxx_free_fcport_workfunction qla2x00_bsg_job_donefunction qla2x00_bsg_sp_freefunction qla24xx_fcp_prio_cfg_validfunction qla24xx_proc_fcp_prio_cfg_cmdfunction qla2x00_process_elsfunction qla24xx_calc_ct_iocbsfunction qla2x00_process_ctfunction qla81xx_reset_loopback_modefunction qla81xx_set_loopback_modefunction qla2x00_process_loopbackfunction qla84xx_resetfunction qla84xx_updatefwfunction qla84xx_mgmt_cmdfunction qla24xx_iidmafunction list_for_each_entryfunction qla2x00_optrom_setupfunction qla2x00_read_optromfunction qla2x00_update_optromfunction qla2x00_update_fru_versionsfunction qla2x00_read_fru_statusfunction qla2x00_write_fru_statusfunction qla2x00_write_i2cfunction qla2x00_read_i2cfunction qla24xx_process_bidir_cmdfunction qlafx00_mgmt_cmdfunction qla26xx_serdes_opfunction qla8044_serdes_opfunction qla27xx_get_flash_upd_capfunction qla27xx_set_flash_upd_capfunction qla27xx_get_bbcr_datafunction qla2x00_get_priv_statsfunction qla2x00_do_dport_diagnosticsfunction qla2x00_do_dport_diagnostics_v2function qla2x00_get_flash_image_statusfunction qla2x00_get_drv_attrfunction qla2x00_manage_host_statsfunction qla2x00_get_host_statsfunction qla2xxx_find_rportfunction list_for_each_entryfunction qla2x00_get_tgt_statsfunction qla2x00_manage_host_portfunction qla2x00_process_vendor_specificfunction qla24xx_bsg_requestfunction qla_bsg_foundfunction qla24xx_bsg_timeoutfunction qla2x00_mailbox_passthrufunction qla28xx_do_validate_flash_image
Annotated Snippet
if (sp->remap.remapped) {
dma_pool_free(ha->purex_dma_pool, sp->remap.rsp.buf,
sp->remap.rsp.dma);
dma_pool_free(ha->purex_dma_pool, sp->remap.req.buf,
sp->remap.req.dma);
} else {
dma_unmap_sg(&ha->pdev->dev, bsg_job->request_payload.sg_list,
bsg_job->request_payload.sg_cnt, DMA_TO_DEVICE);
dma_unmap_sg(&ha->pdev->dev, bsg_job->reply_payload.sg_list,
bsg_job->reply_payload.sg_cnt, DMA_FROM_DEVICE);
}
}
if (sp->type == SRB_CT_CMD ||
sp->type == SRB_FXIOCB_BCMD ||
sp->type == SRB_ELS_CMD_HST) {
INIT_WORK(&sp->fcport->free_work, qla2xxx_free_fcport_work);
queue_work(ha->wq, &sp->fcport->free_work);
}
qla2x00_rel_sp(sp);
}
int
qla24xx_fcp_prio_cfg_valid(scsi_qla_host_t *vha,
struct qla_fcp_prio_cfg *pri_cfg, uint8_t flag)
{
int i, ret, num_valid;
uint8_t *bcode;
struct qla_fcp_prio_entry *pri_entry;
uint32_t *bcode_val_ptr, bcode_val;
ret = 1;
num_valid = 0;
bcode = (uint8_t *)pri_cfg;
bcode_val_ptr = (uint32_t *)pri_cfg;
bcode_val = (uint32_t)(*bcode_val_ptr);
if (bcode_val == 0xFFFFFFFF) {
/* No FCP Priority config data in flash */
ql_dbg(ql_dbg_user, vha, 0x7051,
"No FCP Priority config data.\n");
return 0;
}
if (memcmp(bcode, "HQOS", 4)) {
/* Invalid FCP priority data header*/
ql_dbg(ql_dbg_user, vha, 0x7052,
"Invalid FCP Priority data header. bcode=0x%x.\n",
bcode_val);
return 0;
}
if (flag != 1)
return ret;
pri_entry = &pri_cfg->entry[0];
for (i = 0; i < pri_cfg->num_entries; i++) {
if (pri_entry->flags & FCP_PRIO_ENTRY_TAG_VALID)
num_valid++;
pri_entry++;
}
if (num_valid == 0) {
/* No valid FCP priority data entries */
ql_dbg(ql_dbg_user, vha, 0x7053,
"No valid FCP Priority data entries.\n");
ret = 0;
} else {
/* FCP priority data is valid */
ql_dbg(ql_dbg_user, vha, 0x7054,
"Valid FCP priority data. num entries = %d.\n",
num_valid);
}
return ret;
}
static int
qla24xx_proc_fcp_prio_cfg_cmd(struct bsg_job *bsg_job)
{
struct Scsi_Host *host = fc_bsg_to_shost(bsg_job);
struct fc_bsg_request *bsg_request = bsg_job->request;
struct fc_bsg_reply *bsg_reply = bsg_job->reply;
scsi_qla_host_t *vha = shost_priv(host);
struct qla_hw_data *ha = vha->hw;
int ret = 0;
uint32_t len;
uint32_t oper;
Annotation
- Immediate include surface: `qla_def.h`, `qla_gbl.h`, `linux/kthread.h`, `linux/vmalloc.h`, `linux/delay.h`, `linux/bsg-lib.h`.
- Detected declarations: `function qla2xxx_free_fcport_work`, `function qla2x00_bsg_job_done`, `function qla2x00_bsg_sp_free`, `function qla24xx_fcp_prio_cfg_valid`, `function qla24xx_proc_fcp_prio_cfg_cmd`, `function qla2x00_process_els`, `function qla24xx_calc_ct_iocbs`, `function qla2x00_process_ct`, `function qla81xx_reset_loopback_mode`, `function qla81xx_set_loopback_mode`.
- 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.