drivers/scsi/bfa/bfad_im.c
Source file repositories/reference/linux-study-clean/drivers/scsi/bfa/bfad_im.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/bfa/bfad_im.c- Extension
.c- Size
- 34929 bytes
- Lines
- 1332
- 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.
- 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/export.hbfad_drv.hbfad_im.hbfa_fcs.h
Detected Declarations
function bfa_cb_ioim_donefunction bfa_cb_ioim_good_compfunction bfa_cb_ioim_abortfunction bfa_cb_tskim_donefunction bfad_im_infofunction bfad_im_abort_handlerfunction bfad_im_target_reset_sendfunction bfad_im_reset_lun_handlerfunction bfad_im_reset_target_handlerfunction bfad_im_sdev_destroyfunction bfa_fcb_itnim_allocfunction bfa_fcb_itnim_freefunction bfa_fcb_itnim_onlinefunction bfa_fcb_itnim_offlinefunction bfad_im_scsi_host_allocfunction bfad_im_scsi_host_freefunction bfad_im_port_delete_handlerfunction bfad_im_port_newfunction bfad_im_port_deletefunction bfad_im_port_cleanfunction bfad_aen_im_notify_handlerfunction bfad_im_probefunction bfad_im_probe_undofunction bfad_scsi_host_allocfunction bfad_scsi_host_freefunction bfad_destroy_workqfunction bfad_thread_workqfunction bfad_im_sdev_configurefunction bfad_im_module_initfunction bfad_im_module_exitfunction bfad_ramp_up_qdepthfunction bfad_handle_qfullfunction shost_for_each_devicefunction bfad_get_itnimfunction sdev_initfunction bfad_im_sdev_initfunction bfad_im_supported_speedsfunction bfad_fc_host_initfunction bfad_im_fc_rport_addfunction bfad_im_itnim_work_handlerfunction bfad_im_queuecommand_lckfunction DEF_SCSI_QCMDfunction bfad_get_linkup_delay
Annotated Snippet
if (sns_len > 0) {
bfa_trc(bfad, sns_len);
if (sns_len > SCSI_SENSE_BUFFERSIZE)
sns_len = SCSI_SENSE_BUFFERSIZE;
memcpy(cmnd->sense_buffer, sns_info, sns_len);
}
if (residue > 0) {
bfa_trc(bfad, residue);
scsi_set_resid(cmnd, residue);
if (!sns_len && (scsi_status == SAM_STAT_GOOD) &&
(scsi_bufflen(cmnd) - residue) <
cmnd->underflow) {
bfa_trc(bfad, 0);
host_status = DID_ERROR;
}
}
cmnd->result = host_status << 16 | scsi_status;
break;
case BFI_IOIM_STS_TIMEDOUT:
cmnd->result = DID_TIME_OUT << 16;
break;
case BFI_IOIM_STS_PATHTOV:
cmnd->result = DID_TRANSPORT_DISRUPTED << 16;
break;
default:
cmnd->result = DID_ERROR << 16;
}
/* Unmap DMA, if host is NULL, it means a scsi passthru cmd */
if (cmnd->device->host != NULL)
scsi_dma_unmap(cmnd);
cmnd->host_scribble = NULL;
bfa_trc(bfad, cmnd->result);
itnim_data = cmnd->device->hostdata;
if (itnim_data) {
itnim = itnim_data->itnim;
if (!cmnd->result && itnim &&
(bfa_lun_queue_depth > cmnd->device->queue_depth)) {
/* Queue depth adjustment for good status completion */
bfad_ramp_up_qdepth(itnim, cmnd->device);
} else if (cmnd->result == SAM_STAT_TASK_SET_FULL && itnim) {
/* qfull handling */
bfad_handle_qfull(itnim, cmnd->device);
}
}
scsi_done(cmnd);
}
void
bfa_cb_ioim_good_comp(void *drv, struct bfad_ioim_s *dio)
{
struct scsi_cmnd *cmnd = (struct scsi_cmnd *)dio;
struct bfad_itnim_data_s *itnim_data;
struct bfad_itnim_s *itnim;
cmnd->result = DID_OK << 16 | SAM_STAT_GOOD;
/* Unmap DMA, if host is NULL, it means a scsi passthru cmd */
if (cmnd->device->host != NULL)
scsi_dma_unmap(cmnd);
cmnd->host_scribble = NULL;
/* Queue depth adjustment */
if (bfa_lun_queue_depth > cmnd->device->queue_depth) {
itnim_data = cmnd->device->hostdata;
if (itnim_data) {
itnim = itnim_data->itnim;
if (itnim)
bfad_ramp_up_qdepth(itnim, cmnd->device);
}
}
scsi_done(cmnd);
}
void
bfa_cb_ioim_abort(void *drv, struct bfad_ioim_s *dio)
{
struct scsi_cmnd *cmnd = (struct scsi_cmnd *)dio;
struct bfad_s *bfad = drv;
cmnd->result = DID_ERROR << 16;
Annotation
- Immediate include surface: `linux/export.h`, `bfad_drv.h`, `bfad_im.h`, `bfa_fcs.h`.
- Detected declarations: `function bfa_cb_ioim_done`, `function bfa_cb_ioim_good_comp`, `function bfa_cb_ioim_abort`, `function bfa_cb_tskim_done`, `function bfad_im_info`, `function bfad_im_abort_handler`, `function bfad_im_target_reset_send`, `function bfad_im_reset_lun_handler`, `function bfad_im_reset_target_handler`, `function bfad_im_sdev_destroy`.
- 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.
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.