drivers/scsi/fcoe/fcoe_ctlr.c
Source file repositories/reference/linux-study-clean/drivers/scsi/fcoe/fcoe_ctlr.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/fcoe/fcoe_ctlr.c- Extension
.c- Size
- 89674 bytes
- Lines
- 3254
- Domain
- Driver Families
- Bucket
- drivers/scsi
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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/module.hlinux/kernel.hlinux/list.hlinux/spinlock.hlinux/timer.hlinux/netdevice.hlinux/etherdevice.hlinux/ethtool.hlinux/if_ether.hlinux/if_vlan.hlinux/errno.hlinux/bitops.hlinux/slab.hnet/rtnetlink.hscsi/fc/fc_els.hscsi/fc/fc_fs.hscsi/fc/fc_fip.hscsi/fc/fc_encaps.hscsi/fc/fc_fcoe.hscsi/fc/fc_fcp.hscsi/libfc.hscsi/libfcoe.hlibfcoe.h
Detected Declarations
struct fip_solstruct fip_kalstruct fip_encaps_headstruct fip_vn2vn_probe_framestruct fip_vlan_notify_framefunction fcoe_ctlr_set_statefunction fcoe_ctlr_mtu_validfunction fcoe_ctlr_fcf_usablefunction fcoe_ctlr_map_destfunction fcoe_ctlr_initfunction fcoe_sysfs_fcf_addfunction fcoe_sysfs_fcf_delfunction fcoe_ctlr_reset_fcfsfunction fcoe_ctlr_destroyfunction fcoe_ctlr_announcefunction fcoe_ctlr_fcoe_sizefunction fcoe_ctlr_solicitfunction fcoe_ctlr_link_upfunction fcoe_ctlr_resetfunction fcoe_ctlr_link_downfunction fcoe_ctlr_send_keep_alivefunction fcoe_ctlr_encapsfunction fcoe_ctlr_els_sendfunction fcoe_ctlr_age_fcfsfunction list_for_each_entry_safefunction list_for_each_entry_safefunction fcoe_ctlr_parse_advfunction fcoe_ctlr_recv_advfunction fcoe_ctlr_fcf_usablefunction fcoe_ctlr_recv_elsfunction fcoe_ctlr_recv_clr_vlinkfunction fcoe_ctlr_recvfunction fcoe_ctlr_recv_handlerfunction fcoe_ctlr_selectfunction list_for_each_entryfunction fcoe_ctlr_flogi_send_lockedfunction fcoe_ctlr_flogi_retryfunction fcoe_ctlr_flogi_sendfunction fcoe_ctlr_timeoutfunction fcoe_ctlr_timer_workfunction list_for_each_entryfunction fcoe_ctlr_recv_workfunction fcoe_ctlr_recv_flogifunction fcoe_wwn_from_macfunction fcoe_ctlr_rportfunction fcoe_ctlr_vn_sendfunction fcoe_ctlr_vn_rport_callbackfunction fcoe_ctlr_disc_stop_locked
Annotated Snippet
struct fip_sol {
struct ethhdr eth;
struct fip_header fip;
struct {
struct fip_mac_desc mac;
struct fip_wwn_desc wwnn;
struct fip_size_desc size;
} __packed desc;
} __packed * sol;
u32 fcoe_size;
skb = dev_alloc_skb(sizeof(*sol));
if (!skb)
return;
sol = (struct fip_sol *)skb->data;
memset(sol, 0, sizeof(*sol));
memcpy(sol->eth.h_dest, fcf ? fcf->fcf_mac : fcoe_all_fcfs, ETH_ALEN);
memcpy(sol->eth.h_source, fip->ctl_src_addr, ETH_ALEN);
sol->eth.h_proto = htons(ETH_P_FIP);
sol->fip.fip_ver = FIP_VER_ENCAPS(FIP_VER);
sol->fip.fip_op = htons(FIP_OP_DISC);
sol->fip.fip_subcode = FIP_SC_SOL;
sol->fip.fip_dl_len = htons(sizeof(sol->desc) / FIP_BPW);
sol->fip.fip_flags = htons(FIP_FL_FPMA);
if (fip->spma)
sol->fip.fip_flags |= htons(FIP_FL_SPMA);
sol->desc.mac.fd_desc.fip_dtype = FIP_DT_MAC;
sol->desc.mac.fd_desc.fip_dlen = sizeof(sol->desc.mac) / FIP_BPW;
memcpy(sol->desc.mac.fd_mac, fip->ctl_src_addr, ETH_ALEN);
sol->desc.wwnn.fd_desc.fip_dtype = FIP_DT_NAME;
sol->desc.wwnn.fd_desc.fip_dlen = sizeof(sol->desc.wwnn) / FIP_BPW;
put_unaligned_be64(fip->lp->wwnn, &sol->desc.wwnn.fd_wwn);
fcoe_size = fcoe_ctlr_fcoe_size(fip);
sol->desc.size.fd_desc.fip_dtype = FIP_DT_FCOE_SIZE;
sol->desc.size.fd_desc.fip_dlen = sizeof(sol->desc.size) / FIP_BPW;
sol->desc.size.fd_size = htons(fcoe_size);
skb_put(skb, sizeof(*sol));
skb->protocol = htons(ETH_P_FIP);
skb->priority = fip->priority;
skb_reset_mac_header(skb);
skb_reset_network_header(skb);
fip->send(fip, skb);
if (!fcf)
fip->sol_time = jiffies;
}
/**
* fcoe_ctlr_link_up() - Start FCoE controller
* @fip: The FCoE controller to start
*
* Called from the LLD when the network link is ready.
*/
void fcoe_ctlr_link_up(struct fcoe_ctlr *fip)
{
mutex_lock(&fip->ctlr_mutex);
if (fip->state == FIP_ST_NON_FIP || fip->state == FIP_ST_AUTO) {
mutex_unlock(&fip->ctlr_mutex);
fc_linkup(fip->lp);
} else if (fip->state == FIP_ST_LINK_WAIT) {
if (fip->mode == FIP_MODE_NON_FIP)
fcoe_ctlr_set_state(fip, FIP_ST_NON_FIP);
else
fcoe_ctlr_set_state(fip, FIP_ST_AUTO);
switch (fip->mode) {
default:
LIBFCOE_FIP_DBG(fip, "invalid mode %d\n", fip->mode);
fallthrough;
case FIP_MODE_AUTO:
LIBFCOE_FIP_DBG(fip, "%s", "setting AUTO mode.\n");
fallthrough;
case FIP_MODE_FABRIC:
case FIP_MODE_NON_FIP:
mutex_unlock(&fip->ctlr_mutex);
fc_linkup(fip->lp);
fcoe_ctlr_solicit(fip, NULL);
break;
case FIP_MODE_VN2VN:
fcoe_ctlr_vn_start(fip);
mutex_unlock(&fip->ctlr_mutex);
fc_linkup(fip->lp);
break;
}
Annotation
- Immediate include surface: `linux/types.h`, `linux/module.h`, `linux/kernel.h`, `linux/list.h`, `linux/spinlock.h`, `linux/timer.h`, `linux/netdevice.h`, `linux/etherdevice.h`.
- Detected declarations: `struct fip_sol`, `struct fip_kal`, `struct fip_encaps_head`, `struct fip_vn2vn_probe_frame`, `struct fip_vlan_notify_frame`, `function fcoe_ctlr_set_state`, `function fcoe_ctlr_mtu_valid`, `function fcoe_ctlr_fcf_usable`, `function fcoe_ctlr_map_dest`, `function fcoe_ctlr_init`.
- Atlas domain: Driver Families / drivers/scsi.
- Implementation status: integration 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.