drivers/scsi/fnic/fip.c
Source file repositories/reference/linux-study-clean/drivers/scsi/fnic/fip.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/fnic/fip.c- Extension
.c- Size
- 30258 bytes
- Lines
- 1006
- 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
fnic.hfip.hlinux/etherdevice.h
Detected Declarations
function fnic_fcoe_reset_vlansfunction list_for_each_entry_safefunction fnic_fcoe_send_vlan_reqfunction fnic_fcoe_process_vlan_respfunction fnic_fcoe_start_fcf_discoveryfunction fnic_fcoe_fip_discovery_respfunction fnic_fcoe_start_flogifunction fnic_fcoe_process_flogi_respfunction fnic_common_fip_cleanupfunction fnic_fcoe_process_cvlfunction fdls_fip_recv_framefunction fnic_work_on_fip_timerfunction fnic_handle_fip_timerfunction fnic_handle_enode_ka_timerfunction fnic_handle_vn_ka_timerfunction fnic_vlan_discovery_timeoutfunction fnic_work_on_fcs_ka_timerfunction fnic_handle_fcs_ka_timer
Annotated Snippet
list_for_each_entry_safe(vlan, next, &fnic->vlan_list, list) {
list_del(&vlan->list);
kfree(vlan);
}
}
spin_unlock_irqrestore(&fnic->vlans_lock, flags);
FNIC_FIP_DBG(KERN_INFO, fnic->host, fnic->fnic_num,
"Reset vlan complete\n");
}
/**
* fnic_fcoe_send_vlan_req - Send FIP vlan request to all FCFs MAC
* @fnic: Handle to fnic driver instance
*/
void fnic_fcoe_send_vlan_req(struct fnic *fnic)
{
uint8_t *frame;
struct fnic_iport_s *iport = &fnic->iport;
struct fnic_stats *fnic_stats = &fnic->fnic_stats;
u64 vlan_tov;
struct fip_vlan_req *pvlan_req;
uint16_t frame_size = sizeof(struct fip_vlan_req);
frame = fdls_alloc_frame(iport);
if (frame == NULL) {
FNIC_FIP_DBG(KERN_ERR, fnic->host, fnic->fnic_num,
"Failed to allocate frame to send VLAN req");
return;
}
fnic_fcoe_reset_vlans(fnic);
fnic->set_vlan(fnic, 0);
FNIC_FIP_DBG(KERN_INFO, fnic->host, fnic->fnic_num,
"set vlan done\n");
FNIC_FIP_DBG(KERN_INFO, fnic->host, fnic->fnic_num,
"got MAC 0x%x:%x:%x:%x:%x:%x\n", iport->hwmac[0],
iport->hwmac[1], iport->hwmac[2], iport->hwmac[3],
iport->hwmac[4], iport->hwmac[5]);
pvlan_req = (struct fip_vlan_req *) frame;
*pvlan_req = (struct fip_vlan_req) {
.eth = {.h_dest = FCOE_ALL_FCFS_MAC,
.h_proto = cpu_to_be16(ETH_P_FIP)},
.fip = {.fip_ver = FIP_VER_ENCAPS(FIP_VER),
.fip_op = cpu_to_be16(FIP_OP_VLAN),
.fip_subcode = FIP_SC_REQ,
.fip_dl_len = cpu_to_be16(FIP_VLAN_REQ_LEN)},
.mac_desc = {.fd_desc = {.fip_dtype = FIP_DT_MAC,
.fip_dlen = 2}}
};
memcpy(pvlan_req->eth.h_source, iport->hwmac, ETH_ALEN);
memcpy(pvlan_req->mac_desc.fd_mac, iport->hwmac, ETH_ALEN);
atomic64_inc(&fnic_stats->vlan_stats.vlan_disc_reqs);
iport->fip.state = FDLS_FIP_VLAN_DISCOVERY_STARTED;
FNIC_FIP_DBG(KERN_INFO, fnic->host, fnic->fnic_num,
"Send VLAN req\n");
fnic_send_fip_frame(iport, frame, frame_size);
vlan_tov = jiffies + msecs_to_jiffies(FCOE_CTLR_FIPVLAN_TOV);
mod_timer(&fnic->retry_fip_timer, round_jiffies(vlan_tov));
FNIC_FIP_DBG(KERN_INFO, fnic->host, fnic->fnic_num,
"fip timer set\n");
}
/**
* fnic_fcoe_process_vlan_resp - Processes the vlan response from one FCF and
* populates VLAN list.
* @fnic: Handle to fnic driver instance
* @fiph: Received FIP frame
*
* Will wait for responses from multiple FCFs until timeout.
*/
void fnic_fcoe_process_vlan_resp(struct fnic *fnic, struct fip_header *fiph)
{
struct fip_vlan_notif *vlan_notif = (struct fip_vlan_notif *)fiph;
struct fnic_stats *fnic_stats = &fnic->fnic_stats;
u16 vid;
int num_vlan = 0;
int cur_desc, desc_len;
struct fcoe_vlan *vlan;
struct fip_vlan_desc *vlan_desc;
unsigned long flags;
Annotation
- Immediate include surface: `fnic.h`, `fip.h`, `linux/etherdevice.h`.
- Detected declarations: `function fnic_fcoe_reset_vlans`, `function list_for_each_entry_safe`, `function fnic_fcoe_send_vlan_req`, `function fnic_fcoe_process_vlan_resp`, `function fnic_fcoe_start_fcf_discovery`, `function fnic_fcoe_fip_discovery_resp`, `function fnic_fcoe_start_flogi`, `function fnic_fcoe_process_flogi_resp`, `function fnic_common_fip_cleanup`, `function fnic_fcoe_process_cvl`.
- 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.