drivers/s390/scsi/zfcp_scsi.c
Source file repositories/reference/linux-study-clean/drivers/s390/scsi/zfcp_scsi.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/s390/scsi/zfcp_scsi.c- Extension
.c- Size
- 29757 bytes
- Lines
- 989
- Domain
- Driver Families
- Bucket
- drivers/s390
- 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.
- 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/module.hlinux/types.hlinux/slab.hscsi/fc/fc_fcp.hscsi/scsi_eh.hlinux/atomic.hzfcp_ext.hzfcp_dbf.hzfcp_fc.hzfcp_reqlist.h
Detected Declarations
struct zfcp_scsi_req_filterfunction zfcp_scsi_sdev_destroyfunction zfcp_scsi_sdev_configurefunction zfcp_scsi_command_failfunction zfcp_scsi_queuecommandfunction zfcp_scsi_sdev_initfunction zfcp_scsi_eh_abort_handlerfunction zfcp_scsi_forget_cmndfunction zfcp_scsi_forget_cmndsfunction zfcp_scsi_task_mgmt_functionfunction zfcp_scsi_eh_device_reset_handlerfunction zfcp_scsi_eh_target_reset_handlerfunction shost_for_each_devicefunction zfcp_scsi_eh_host_reset_handlerfunction zfcp_scsi_sysfs_host_resetfunction zfcp_scsi_adapter_registerfunction zfcp_scsi_adapter_unregisterfunction zfcp_scsi_init_fc_host_statsfunction zfcp_scsi_adjust_fc_host_statsfunction zfcp_scsi_set_fc_host_statsfunction zfcp_scsi_get_fc_host_statsfunction zfcp_scsi_reset_fc_host_statsfunction zfcp_scsi_get_host_port_statefunction zfcp_scsi_set_rport_dev_loss_tmofunction zfcp_scsi_terminate_rport_iofunction zfcp_scsi_rport_registerfunction zfcp_scsi_rport_blockfunction zfcp_scsi_schedule_rport_registerfunction zfcp_scsi_schedule_rport_blockfunction zfcp_scsi_schedule_rports_blockfunction zfcp_scsi_rport_workfunction zfcp_scsi_set_protfunction zfcp_scsi_dif_sense_errorfunction zfcp_scsi_shost_update_config_datafunction zfcp_scsi_shost_update_port_data
Annotated Snippet
struct zfcp_scsi_req_filter {
u8 tmf_scope;
u32 lun_handle;
u32 port_handle;
};
static void zfcp_scsi_forget_cmnd(struct zfcp_fsf_req *old_req, void *data)
{
struct zfcp_scsi_req_filter *filter =
(struct zfcp_scsi_req_filter *)data;
/* already aborted - prevent side-effects - or not a SCSI command */
if (old_req->data == NULL ||
zfcp_fsf_req_is_status_read_buffer(old_req) ||
old_req->qtcb->header.fsf_command != FSF_QTCB_FCP_CMND)
return;
/* (tmf_scope == FCP_TMF_TGT_RESET || tmf_scope == FCP_TMF_LUN_RESET) */
if (old_req->qtcb->header.port_handle != filter->port_handle)
return;
if (filter->tmf_scope == FCP_TMF_LUN_RESET &&
old_req->qtcb->header.lun_handle != filter->lun_handle)
return;
zfcp_dbf_scsi_nullcmnd((struct scsi_cmnd *)old_req->data, old_req);
old_req->data = NULL;
}
static void zfcp_scsi_forget_cmnds(struct zfcp_scsi_dev *zsdev, u8 tm_flags)
{
struct zfcp_adapter *adapter = zsdev->port->adapter;
struct zfcp_scsi_req_filter filter = {
.tmf_scope = FCP_TMF_TGT_RESET,
.port_handle = zsdev->port->handle,
};
unsigned long flags;
if (tm_flags == FCP_TMF_LUN_RESET) {
filter.tmf_scope = FCP_TMF_LUN_RESET;
filter.lun_handle = zsdev->lun_handle;
}
/*
* abort_lock secures against other processings - in the abort-function
* and normal cmnd-handler - of (struct zfcp_fsf_req *)->data
*/
write_lock_irqsave(&adapter->abort_lock, flags);
zfcp_reqlist_apply_for_all(adapter->req_list, zfcp_scsi_forget_cmnd,
&filter);
write_unlock_irqrestore(&adapter->abort_lock, flags);
}
/**
* zfcp_scsi_task_mgmt_function() - Send a task management function (sync).
* @sdev: Pointer to SCSI device to send the task management command to.
* @tm_flags: Task management flags,
* here we only handle %FCP_TMF_TGT_RESET or %FCP_TMF_LUN_RESET.
*/
static int zfcp_scsi_task_mgmt_function(struct scsi_device *sdev, u8 tm_flags)
{
struct zfcp_scsi_dev *zfcp_sdev = sdev_to_zfcp(sdev);
struct zfcp_adapter *adapter = zfcp_sdev->port->adapter;
struct fc_rport *rport = starget_to_rport(scsi_target(sdev));
struct zfcp_fsf_req *fsf_req = NULL;
int retval = SUCCESS, ret;
int retry = 3;
while (retry--) {
fsf_req = zfcp_fsf_fcp_task_mgmt(sdev, tm_flags);
if (fsf_req)
break;
zfcp_dbf_scsi_devreset("wait", sdev, tm_flags, NULL);
zfcp_erp_wait(adapter);
ret = fc_block_rport(rport);
if (ret) {
zfcp_dbf_scsi_devreset("fiof", sdev, tm_flags, NULL);
return ret;
}
if (!(atomic_read(&adapter->status) &
ZFCP_STATUS_COMMON_RUNNING)) {
zfcp_dbf_scsi_devreset("nres", sdev, tm_flags, NULL);
return SUCCESS;
}
}
if (!fsf_req) {
zfcp_dbf_scsi_devreset("reqf", sdev, tm_flags, NULL);
return FAILED;
Annotation
- Immediate include surface: `linux/module.h`, `linux/types.h`, `linux/slab.h`, `scsi/fc/fc_fcp.h`, `scsi/scsi_eh.h`, `linux/atomic.h`, `zfcp_ext.h`, `zfcp_dbf.h`.
- Detected declarations: `struct zfcp_scsi_req_filter`, `function zfcp_scsi_sdev_destroy`, `function zfcp_scsi_sdev_configure`, `function zfcp_scsi_command_fail`, `function zfcp_scsi_queuecommand`, `function zfcp_scsi_sdev_init`, `function zfcp_scsi_eh_abort_handler`, `function zfcp_scsi_forget_cmnd`, `function zfcp_scsi_forget_cmnds`, `function zfcp_scsi_task_mgmt_function`.
- Atlas domain: Driver Families / drivers/s390.
- Implementation status: source 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.