drivers/scsi/bnx2fc/bnx2fc_hwi.c
Source file repositories/reference/linux-study-clean/drivers/scsi/bnx2fc/bnx2fc_hwi.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/bnx2fc/bnx2fc_hwi.c- Extension
.c- Size
- 63550 bytes
- Lines
- 2204
- 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.
- 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_send_stat_reqfunction bnx2fc_send_fw_fcoe_init_msgfunction bnx2fc_send_fw_fcoe_destroy_msgfunction bnx2fc_send_session_ofld_reqfunction bnx2fc_send_session_enable_reqfunction bnx2fc_send_session_disable_reqfunction bnx2fc_send_session_destroy_reqfunction is_valid_lportfunction bnx2fc_unsol_els_workfunction bnx2fc_process_l2_frame_complfunction bnx2fc_process_unsol_complfunction bnx2fc_process_cq_complfunction bnx2fc_arm_cqfunction bnx2fc_pending_workfunction bnx2fc_process_new_cqesfunction bnx2fc_fastpath_notificationfunction bnx2fc_process_ofld_cmplfunction bnx2fc_process_enable_conn_cmplfunction bnx2fc_process_conn_disable_cmplfunction bnx2fc_process_conn_destroy_cmplfunction bnx2fc_init_failurefunction bnx2fc_indicate_kcqefunction bnx2fc_add_2_sqfunction bnx2fc_ring_doorbellfunction bnx2fc_map_doorbellfunction bnx2fc_return_rqefunction bnx2fc_init_seq_cleanup_taskfunction bnx2fc_init_cleanup_taskfunction bnx2fc_init_mp_taskfunction bnx2fc_init_taskfunction bnx2fc_setup_task_ctxfunction bnx2fc_free_task_ctxfunction bnx2fc_free_hash_tablefunction bnx2fc_allocate_hash_tablefunction bnx2fc_setup_fw_rescfunction bnx2fc_free_fw_resc
Annotated Snippet
if (blport->lport == lport) {
spin_unlock_bh(&hba->hba_lock);
return true;
}
}
spin_unlock_bh(&hba->hba_lock);
return false;
}
static void bnx2fc_unsol_els_work(struct work_struct *work)
{
struct bnx2fc_unsol_els *unsol_els;
struct fc_lport *lport;
struct bnx2fc_hba *hba;
struct fc_frame *fp;
unsol_els = container_of(work, struct bnx2fc_unsol_els, unsol_els_work);
lport = unsol_els->lport;
fp = unsol_els->fp;
hba = unsol_els->hba;
if (is_valid_lport(hba, lport))
fc_exch_recv(lport, fp);
kfree(unsol_els);
}
void bnx2fc_process_l2_frame_compl(struct bnx2fc_rport *tgt,
unsigned char *buf,
u32 frame_len, u16 l2_oxid)
{
struct fcoe_port *port = tgt->port;
struct fc_lport *lport = port->lport;
struct bnx2fc_interface *interface = port->priv;
struct bnx2fc_unsol_els *unsol_els;
struct fc_frame_header *fh;
struct fc_frame *fp;
struct sk_buff *skb;
u32 payload_len;
u32 crc;
u8 op;
unsol_els = kzalloc_obj(*unsol_els, GFP_ATOMIC);
if (!unsol_els) {
BNX2FC_TGT_DBG(tgt, "Unable to allocate unsol_work\n");
return;
}
BNX2FC_TGT_DBG(tgt, "l2_frame_compl l2_oxid = 0x%x, frame_len = %d\n",
l2_oxid, frame_len);
payload_len = frame_len - sizeof(struct fc_frame_header);
fp = fc_frame_alloc(lport, payload_len);
if (!fp) {
printk(KERN_ERR PFX "fc_frame_alloc failure\n");
kfree(unsol_els);
return;
}
fh = (struct fc_frame_header *) fc_frame_header_get(fp);
/* Copy FC Frame header and payload into the frame */
memcpy(fh, buf, frame_len);
if (l2_oxid != FC_XID_UNKNOWN)
fh->fh_ox_id = htons(l2_oxid);
skb = fp_skb(fp);
if ((fh->fh_r_ctl == FC_RCTL_ELS_REQ) ||
(fh->fh_r_ctl == FC_RCTL_ELS_REP)) {
if (fh->fh_type == FC_TYPE_ELS) {
op = fc_frame_payload_op(fp);
if ((op == ELS_TEST) || (op == ELS_ESTC) ||
(op == ELS_FAN) || (op == ELS_CSU)) {
/*
* No need to reply for these
* ELS requests
*/
printk(KERN_ERR PFX "dropping ELS 0x%x\n", op);
kfree_skb(skb);
kfree(unsol_els);
return;
}
}
crc = fcoe_fc_crc(fp);
fc_frame_init(fp);
fr_dev(fp) = lport;
Annotation
- Immediate include surface: `bnx2fc.h`.
- Detected declarations: `function bnx2fc_send_stat_req`, `function bnx2fc_send_fw_fcoe_init_msg`, `function bnx2fc_send_fw_fcoe_destroy_msg`, `function bnx2fc_send_session_ofld_req`, `function bnx2fc_send_session_enable_req`, `function bnx2fc_send_session_disable_req`, `function bnx2fc_send_session_destroy_req`, `function is_valid_lport`, `function bnx2fc_unsol_els_work`, `function bnx2fc_process_l2_frame_compl`.
- 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.