drivers/scsi/bnx2fc/bnx2fc_els.c
Source file repositories/reference/linux-study-clean/drivers/scsi/bnx2fc/bnx2fc_els.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/bnx2fc/bnx2fc_els.c- Extension
.c- Size
- 26468 bytes
- Lines
- 951
- 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.
- 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
bnx2fc.h
Detected Declarations
function bnx2fc_rrq_complfunction bnx2fc_send_rrqfunction bnx2fc_l2_els_complfunction bnx2fc_send_adiscfunction bnx2fc_send_logofunction bnx2fc_send_rlsfunction bnx2fc_srr_complfunction test_bitfunction bnx2fc_rec_complfunction bnx2fc_send_recfunction bnx2fc_send_srrfunction bnx2fc_initiate_elsfunction bnx2fc_process_els_complfunction bnx2fc_flogi_respfunction bnx2fc_logo_respfunction void
Annotated Snippet
if (rrq_req->on_active_queue) {
list_del_init(&rrq_req->link);
rrq_req->on_active_queue = 0;
rc = bnx2fc_initiate_cleanup(rrq_req);
BUG_ON(rc);
}
}
kfree(cb_arg);
}
int bnx2fc_send_rrq(struct bnx2fc_cmd *aborted_io_req)
{
struct fc_els_rrq rrq;
struct bnx2fc_rport *tgt = aborted_io_req->tgt;
struct fc_lport *lport = NULL;
struct bnx2fc_els_cb_arg *cb_arg = NULL;
u32 sid = 0;
u32 r_a_tov = 0;
unsigned long start = jiffies;
int rc;
if (!test_bit(BNX2FC_FLAG_SESSION_READY, &tgt->flags))
return -EINVAL;
lport = tgt->rdata->local_port;
sid = tgt->sid;
r_a_tov = lport->r_a_tov;
BNX2FC_ELS_DBG("Sending RRQ orig_xid = 0x%x\n",
aborted_io_req->xid);
memset(&rrq, 0, sizeof(rrq));
cb_arg = kzalloc_obj(struct bnx2fc_els_cb_arg, GFP_NOIO);
if (!cb_arg) {
printk(KERN_ERR PFX "Unable to allocate cb_arg for RRQ\n");
rc = -ENOMEM;
goto rrq_err;
}
cb_arg->aborted_io_req = aborted_io_req;
rrq.rrq_cmd = ELS_RRQ;
hton24(rrq.rrq_s_id, sid);
rrq.rrq_ox_id = htons(aborted_io_req->xid);
rrq.rrq_rx_id = htons(aborted_io_req->task->rxwr_txrd.var_ctx.rx_id);
retry_rrq:
rc = bnx2fc_initiate_els(tgt, ELS_RRQ, &rrq, sizeof(rrq),
bnx2fc_rrq_compl, cb_arg,
r_a_tov);
if (rc == -ENOMEM) {
if (time_after(jiffies, start + (10 * HZ))) {
BNX2FC_ELS_DBG("rrq Failed\n");
rc = FAILED;
goto rrq_err;
}
msleep(20);
goto retry_rrq;
}
rrq_err:
if (rc) {
BNX2FC_ELS_DBG("RRQ failed - release orig io req 0x%x\n",
aborted_io_req->xid);
kfree(cb_arg);
spin_lock_bh(&tgt->tgt_lock);
kref_put(&aborted_io_req->refcount, bnx2fc_cmd_release);
spin_unlock_bh(&tgt->tgt_lock);
}
return rc;
}
static void bnx2fc_l2_els_compl(struct bnx2fc_els_cb_arg *cb_arg)
{
struct bnx2fc_cmd *els_req;
struct bnx2fc_rport *tgt;
struct bnx2fc_mp_req *mp_req;
struct fc_frame_header *fc_hdr;
unsigned char *buf;
void *resp_buf;
u32 resp_len, hdr_len;
u16 l2_oxid;
int frame_len;
int rc = 0;
l2_oxid = cb_arg->l2_oxid;
BNX2FC_ELS_DBG("ELS COMPL - l2_oxid = 0x%x\n", l2_oxid);
els_req = cb_arg->io_req;
if (test_and_clear_bit(BNX2FC_FLAG_ELS_TIMEOUT, &els_req->req_flags)) {
/*
Annotation
- Immediate include surface: `bnx2fc.h`.
- Detected declarations: `function bnx2fc_rrq_compl`, `function bnx2fc_send_rrq`, `function bnx2fc_l2_els_compl`, `function bnx2fc_send_adisc`, `function bnx2fc_send_logo`, `function bnx2fc_send_rls`, `function bnx2fc_srr_compl`, `function test_bit`, `function bnx2fc_rec_compl`, `function bnx2fc_send_rec`.
- 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.
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.