drivers/scsi/qla2xxx/qla_inline.h
Source file repositories/reference/linux-study-clean/drivers/scsi/qla2xxx/qla_inline.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/qla2xxx/qla_inline.h- Extension
.h- Size
- 14762 bytes
- Lines
- 641
- 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_target.h
Detected Declarations
function Copyrightfunction qla2x00_debounce_registerfunction qla2x00_pollfunction host_to_fcp_swapfunction host_to_adapfunction qla2x00_clean_dsd_poolfunction qla2x00_set_fcport_disc_statefunction qla2x00_hba_err_chk_enabledfunction qla2x00_reset_activefunction qla2x00_chip_is_downfunction qla2xxx_init_spfunction qla2xxx_get_qpair_spfunction qla2xxx_rel_qpair_spfunction qla2x00_get_spfunction qla2x00_rel_spfunction qla2x00_gid_list_sizefunction qla2x00_handle_mbx_completionfunction qla2x00_set_retry_delay_timestampfunction qla_is_exch_offld_enabledfunction qla_cpu_updatefunction qla_qpair_to_hintfunction qla_83xx_start_iocbsfunction qla2xxx_get_fc4_priorityfunction qla_get_fw_resourcesfunction qla_atomic_dtzfunction qla_put_fw_resourcesfunction qla2x00_isp_reg_statfunction qla_pci_disconnectedfunction fcport_is_smallerfunction fcport_is_biggerfunction qla_mapq_nvme_select_qpairfunction qla_mapq_init_qp_cpu_mapfunction qla_mapq_free_qp_cpu_mapfunction qla_mapq_alloc_qp_cpu_mapfunction val_is_in_range
Annotated Snippet
if ((iores->iocb_cnt + iocbs_used) >= qp->fwres.iocbs_limit) {
iores->res_type = RESOURCE_NONE;
return -ENOSPC;
}
}
if (iores->res_type & RESOURCE_EXCH) {
exch_used = ha->base_qpair->fwres.exch_used;
for (i = 0; i < ha->max_qpairs; i++) {
if (ha->queue_pair_map[i])
exch_used += ha->queue_pair_map[i]->fwres.exch_used;
}
if ((exch_used + iores->exch_cnt) >= qp->fwres.exch_limit) {
iores->res_type = RESOURCE_NONE;
return -ENOSPC;
}
}
if (ql2xenforce_iocb_limit == 2) {
if ((iores->iocb_cnt + atomic_read(&ha->fwres.iocb_used)) >=
ha->fwres.iocb_limit) {
iores->res_type = RESOURCE_NONE;
return -ENOSPC;
}
if (iores->res_type & RESOURCE_EXCH) {
if ((iores->exch_cnt + atomic_read(&ha->fwres.exch_used)) >=
ha->fwres.exch_limit) {
iores->res_type = RESOURCE_NONE;
return -ENOSPC;
}
}
}
force:
qp->fwres.iocbs_used += iores->iocb_cnt;
qp->fwres.exch_used += iores->exch_cnt;
if (ql2xenforce_iocb_limit == 2) {
atomic_add(iores->iocb_cnt, &ha->fwres.iocb_used);
atomic_add(iores->exch_cnt, &ha->fwres.exch_used);
iores->res_type |= RESOURCE_HA;
}
return 0;
}
/*
* decrement to zero. This routine will not decrement below zero
* @v: pointer of type atomic_t
* @amount: amount to decrement from v
*/
static void qla_atomic_dtz(atomic_t *v, int amount)
{
int c, old, dec;
c = atomic_read(v);
for (;;) {
dec = c - amount;
if (unlikely(dec < 0))
dec = 0;
old = atomic_cmpxchg((v), c, dec);
if (likely(old == c))
break;
c = old;
}
}
static inline void
qla_put_fw_resources(struct qla_qpair *qp, struct iocb_resource *iores)
{
struct qla_hw_data *ha = qp->hw;
if (iores->res_type & RESOURCE_HA) {
if (iores->res_type & RESOURCE_IOCB)
qla_atomic_dtz(&ha->fwres.iocb_used, iores->iocb_cnt);
if (iores->res_type & RESOURCE_EXCH)
qla_atomic_dtz(&ha->fwres.exch_used, iores->exch_cnt);
}
if (iores->res_type & RESOURCE_IOCB) {
if (qp->fwres.iocbs_used >= iores->iocb_cnt) {
qp->fwres.iocbs_used -= iores->iocb_cnt;
} else {
/* should not happen */
qp->fwres.iocbs_used = 0;
}
}
Annotation
- Immediate include surface: `qla_target.h`.
- Detected declarations: `function Copyright`, `function qla2x00_debounce_register`, `function qla2x00_poll`, `function host_to_fcp_swap`, `function host_to_adap`, `function qla2x00_clean_dsd_pool`, `function qla2x00_set_fcport_disc_state`, `function qla2x00_hba_err_chk_enabled`, `function qla2x00_reset_active`, `function qla2x00_chip_is_down`.
- 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.