drivers/s390/scsi/zfcp_fc.c
Source file repositories/reference/linux-study-clean/drivers/s390/scsi/zfcp_fc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/s390/scsi/zfcp_fc.c- Extension
.c- Size
- 31835 bytes
- Lines
- 1138
- 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/types.hlinux/slab.hlinux/utsname.hlinux/random.hlinux/bsg-lib.hscsi/fc/fc_els.hscsi/libfc.hzfcp_ext.hzfcp_fc.h
Detected Declarations
function zfcp_fc_port_scan_backofffunction zfcp_fc_port_scan_timefunction zfcp_fc_port_scanfunction zfcp_fc_conditional_port_scanfunction zfcp_fc_inverse_conditional_port_scanfunction zfcp_fc_post_eventfunction list_for_each_entry_safefunction zfcp_fc_enqueue_eventfunction zfcp_fc_wka_port_getfunction zfcp_fc_wka_port_offlinefunction zfcp_fc_wka_port_putfunction zfcp_fc_wka_port_initfunction zfcp_fc_wka_port_force_offlinefunction zfcp_fc_wka_ports_force_offlinefunction _zfcp_fc_incoming_rscnfunction zfcp_fc_incoming_rscnfunction list_for_each_entryfunction zfcp_fc_incoming_wwpnfunction zfcp_fc_incoming_plogifunction zfcp_fc_incoming_logofunction zfcp_fc_incoming_elsfunction zfcp_fc_ns_gid_pn_evalfunction zfcp_fc_completefunction zfcp_fc_ct_ns_initfunction zfcp_fc_ns_gid_pn_requestfunction zfcp_fc_ns_gid_pnfunction zfcp_fc_port_did_lookupfunction zfcp_fc_trigger_did_lookupfunction zfcp_fc_plogi_evaluatefunction zfcp_fc_adisc_handlerfunction zfcp_fc_adiscfunction zfcp_fc_link_test_workfunction zfcp_fc_test_linkfunction zfcp_fc_sg_free_tablefunction zfcp_fc_sg_setup_tablefunction zfcp_fc_send_gpn_ftfunction zfcp_fc_validate_portfunction zfcp_fc_eval_gpn_ftfunction list_for_each_entry_safefunction zfcp_fc_scan_portsfunction zfcp_fc_gspnfunction zfcp_fc_rspnfunction zfcp_fc_sym_name_updatefunction zfcp_fc_ct_els_job_handlerfunction zfcp_fc_ct_job_handlerfunction zfcp_fc_exec_els_jobfunction zfcp_fc_exec_ct_jobfunction zfcp_fc_exec_bsg_job
Annotated Snippet
if (zfcp_fsf_open_wka_port(wka_port)) {
/* could not even send request, nothing to wait for */
wka_port->status = ZFCP_FC_WKA_PORT_OFFLINE;
goto out;
}
}
wait_event(wka_port->opened,
wka_port->status == ZFCP_FC_WKA_PORT_ONLINE ||
wka_port->status == ZFCP_FC_WKA_PORT_OFFLINE);
if (wka_port->status == ZFCP_FC_WKA_PORT_ONLINE) {
atomic_inc(&wka_port->refcount);
ret = 0;
goto out;
}
out:
mutex_unlock(&wka_port->mutex);
return ret;
}
static void zfcp_fc_wka_port_offline(struct work_struct *work)
{
struct delayed_work *dw = to_delayed_work(work);
struct zfcp_fc_wka_port *wka_port =
container_of(dw, struct zfcp_fc_wka_port, work);
mutex_lock(&wka_port->mutex);
if ((atomic_read(&wka_port->refcount) != 0) ||
(wka_port->status != ZFCP_FC_WKA_PORT_ONLINE))
goto out;
wka_port->status = ZFCP_FC_WKA_PORT_CLOSING;
if (zfcp_fsf_close_wka_port(wka_port)) {
/* could not even send request, nothing to wait for */
wka_port->status = ZFCP_FC_WKA_PORT_OFFLINE;
goto out;
}
wait_event(wka_port->closed,
wka_port->status == ZFCP_FC_WKA_PORT_OFFLINE);
out:
mutex_unlock(&wka_port->mutex);
}
static void zfcp_fc_wka_port_put(struct zfcp_fc_wka_port *wka_port)
{
if (atomic_dec_return(&wka_port->refcount) != 0)
return;
/* wait 10 milliseconds, other reqs might pop in */
queue_delayed_work(wka_port->adapter->work_queue, &wka_port->work,
msecs_to_jiffies(10));
}
static void zfcp_fc_wka_port_init(struct zfcp_fc_wka_port *wka_port, u32 d_id,
struct zfcp_adapter *adapter)
{
init_waitqueue_head(&wka_port->opened);
init_waitqueue_head(&wka_port->closed);
wka_port->adapter = adapter;
wka_port->d_id = d_id;
wka_port->status = ZFCP_FC_WKA_PORT_OFFLINE;
atomic_set(&wka_port->refcount, 0);
mutex_init(&wka_port->mutex);
INIT_DELAYED_WORK(&wka_port->work, zfcp_fc_wka_port_offline);
}
static void zfcp_fc_wka_port_force_offline(struct zfcp_fc_wka_port *wka)
{
cancel_delayed_work_sync(&wka->work);
mutex_lock(&wka->mutex);
wka->status = ZFCP_FC_WKA_PORT_OFFLINE;
mutex_unlock(&wka->mutex);
}
void zfcp_fc_wka_ports_force_offline(struct zfcp_fc_wka_ports *gs)
{
if (!gs)
return;
zfcp_fc_wka_port_force_offline(&gs->ms);
zfcp_fc_wka_port_force_offline(&gs->ts);
zfcp_fc_wka_port_force_offline(&gs->ds);
zfcp_fc_wka_port_force_offline(&gs->as);
}
static void _zfcp_fc_incoming_rscn(struct zfcp_fsf_req *fsf_req, u32 range,
struct fc_els_rscn_page *page)
{
unsigned long flags;
Annotation
- Immediate include surface: `linux/types.h`, `linux/slab.h`, `linux/utsname.h`, `linux/random.h`, `linux/bsg-lib.h`, `scsi/fc/fc_els.h`, `scsi/libfc.h`, `zfcp_ext.h`.
- Detected declarations: `function zfcp_fc_port_scan_backoff`, `function zfcp_fc_port_scan_time`, `function zfcp_fc_port_scan`, `function zfcp_fc_conditional_port_scan`, `function zfcp_fc_inverse_conditional_port_scan`, `function zfcp_fc_post_event`, `function list_for_each_entry_safe`, `function zfcp_fc_enqueue_event`, `function zfcp_fc_wka_port_get`, `function zfcp_fc_wka_port_offline`.
- 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.