drivers/scsi/bnx2fc/bnx2fc_tgt.c
Source file repositories/reference/linux-study-clean/drivers/scsi/bnx2fc/bnx2fc_tgt.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/bnx2fc/bnx2fc_tgt.c- Extension
.c- Size
- 24665 bytes
- Lines
- 893
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
bnx2fc.h
Detected Declarations
function bnx2fc_upld_timerfunction bnx2fc_ofld_timerfunction bnx2fc_ofld_waitfunction bnx2fc_offload_sessionfunction bnx2fc_flush_active_iosfunction list_for_each_entry_safefunction list_for_each_entry_safefunction list_for_each_entry_safefunction list_for_each_entry_safefunction bnx2fc_upld_waitfunction bnx2fc_upload_sessionfunction bnx2fc_init_tgtfunction bnx2fc_rport_event_handlerfunction bnx2fc_tgt_lookupfunction bnx2fc_alloc_conn_idfunction bnx2fc_free_conn_idfunction bnx2fc_alloc_session_rescfunction bnx2fc_free_session_resc
Annotated Snippet
if (cancel_delayed_work(&io_req->timeout_work)) {
if (test_and_clear_bit(BNX2FC_FLAG_EH_ABORT,
&io_req->req_flags)) {
/* Handle eh_abort timeout */
BNX2FC_IO_DBG(io_req, "eh_abort for IO "
"cleaned up\n");
complete(&io_req->abts_done);
}
kref_put(&io_req->refcount,
bnx2fc_cmd_release); /* drop timer hold */
}
set_bit(BNX2FC_FLAG_IO_COMPL, &io_req->req_flags);
set_bit(BNX2FC_FLAG_IO_CLEANUP, &io_req->req_flags);
/* Do not issue cleanup when disable request failed */
if (test_bit(BNX2FC_FLAG_DISABLE_FAILED, &tgt->flags))
bnx2fc_process_cleanup_compl(io_req, io_req->task, 0);
else {
rc = bnx2fc_initiate_cleanup(io_req);
BUG_ON(rc);
}
}
list_for_each_entry_safe(io_req, tmp, &tgt->active_tm_queue, link) {
i++;
list_del_init(&io_req->link);
io_req->on_tmf_queue = 0;
BNX2FC_IO_DBG(io_req, "tm_queue cleanup\n");
if (io_req->wait_for_abts_comp)
complete(&io_req->abts_done);
}
list_for_each_entry_safe(io_req, tmp, &tgt->els_queue, link) {
i++;
list_del_init(&io_req->link);
io_req->on_active_queue = 0;
BNX2FC_IO_DBG(io_req, "els_queue cleanup\n");
if (cancel_delayed_work(&io_req->timeout_work))
kref_put(&io_req->refcount,
bnx2fc_cmd_release); /* drop timer hold */
if ((io_req->cb_func) && (io_req->cb_arg)) {
io_req->cb_func(io_req->cb_arg);
io_req->cb_arg = NULL;
}
/* Do not issue cleanup when disable request failed */
if (test_bit(BNX2FC_FLAG_DISABLE_FAILED, &tgt->flags))
bnx2fc_process_cleanup_compl(io_req, io_req->task, 0);
else {
rc = bnx2fc_initiate_cleanup(io_req);
BUG_ON(rc);
}
}
list_for_each_entry_safe(io_req, tmp, &tgt->io_retire_queue, link) {
i++;
list_del_init(&io_req->link);
BNX2FC_IO_DBG(io_req, "retire_queue flush\n");
if (cancel_delayed_work(&io_req->timeout_work)) {
if (test_and_clear_bit(BNX2FC_FLAG_EH_ABORT,
&io_req->req_flags)) {
/* Handle eh_abort timeout */
BNX2FC_IO_DBG(io_req, "eh_abort for IO "
"in retire_q\n");
if (io_req->wait_for_abts_comp)
complete(&io_req->abts_done);
}
kref_put(&io_req->refcount, bnx2fc_cmd_release);
}
clear_bit(BNX2FC_FLAG_ISSUE_RRQ, &io_req->req_flags);
}
BNX2FC_TGT_DBG(tgt, "IOs flushed = %d\n", i);
i = 0;
spin_unlock_bh(&tgt->tgt_lock);
/* wait for active_ios to go to 0 */
while ((tgt->num_active_ios.counter != 0) && (i++ < BNX2FC_WAIT_CNT))
msleep(25);
if (tgt->num_active_ios.counter != 0)
printk(KERN_ERR PFX "CLEANUP on port 0x%x:"
" active_ios = %d\n",
tgt->rdata->ids.port_id, tgt->num_active_ios.counter);
spin_lock_bh(&tgt->tgt_lock);
Annotation
- Immediate include surface: `bnx2fc.h`.
- Detected declarations: `function bnx2fc_upld_timer`, `function bnx2fc_ofld_timer`, `function bnx2fc_ofld_wait`, `function bnx2fc_offload_session`, `function bnx2fc_flush_active_ios`, `function list_for_each_entry_safe`, `function list_for_each_entry_safe`, `function list_for_each_entry_safe`, `function list_for_each_entry_safe`, `function bnx2fc_upld_wait`.
- 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.