drivers/scsi/bfa/bfa_fcs_lport.c
Source file repositories/reference/linux-study-clean/drivers/scsi/bfa/bfa_fcs_lport.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/bfa/bfa_fcs_lport.c- Extension
.c- Size
- 175647 bytes
- Lines
- 6765
- 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.
- 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
bfad_drv.hbfad_im.hbfa_fcs.hbfa_fcbuild.hbfa_fc.h
Detected Declarations
struct bfa_fcs_vport_sm_table_sfunction bfa_fcs_lport_sm_uninitfunction bfa_fcs_lport_sm_initfunction bfa_fcs_lport_sm_onlinefunction list_for_each_safefunction list_for_each_safefunction bfa_fcs_lport_sm_offlinefunction list_for_each_safefunction list_for_each_safefunction bfa_fcs_lport_sm_stoppingfunction bfa_fcs_lport_sm_deletingfunction bfa_fcs_lport_aen_postfunction bfa_fcs_lport_send_ls_rjtfunction bfa_fcs_lport_send_fcgs_rjtfunction bfa_fcs_lport_plogifunction bfa_fcs_lport_echofunction bfa_fcs_lport_rnidfunction bfa_fs_port_get_gen_topo_datafunction bfa_fcs_lport_online_actionsfunction bfa_fcs_lport_offline_actionsfunction list_for_each_safefunction bfa_fcs_lport_unknown_initfunction bfa_fcs_lport_unknown_onlinefunction bfa_fcs_lport_unknown_offlinefunction bfa_fcs_lport_abts_accfunction bfa_fcs_lport_deletedfunction bfa_fcs_lport_uf_recvfunction bfa_fcs_lport_get_rport_by_pidfunction list_for_eachfunction bfa_fcs_lport_get_rport_by_old_pidfunction list_for_eachfunction bfa_fcs_lport_get_rport_by_pwwnfunction list_for_eachfunction bfa_fcs_lport_get_rport_by_qualifierfunction list_for_eachfunction bfa_fcs_lport_add_rportfunction bfa_fcs_lport_del_rportfunction bfa_fcs_lport_onlinefunction bfa_fcs_lport_offlinefunction bfa_fcs_lport_stopfunction bfa_fcs_vport_delete_compfunction bfa_fcs_lport_is_onlinefunction bfa_fcs_lport_attachfunction bfa_fcs_lport_initfunction bfa_fcs_lport_set_symnamefunction bfa_fcs_lport_get_attrfunction bfa_fcs_lport_fab_initfunction bfa_fcs_lport_fab_online
Annotated Snippet
struct bfa_fcs_vport_sm_table_s {
bfa_fcs_vport_sm_t sm; /* state machine function */
enum bfa_vport_state state; /* state machine encoding */
char *name; /* state name for display */
};
static inline enum bfa_vport_state
bfa_vport_sm_to_state(struct bfa_fcs_vport_sm_table_s *smt, bfa_fcs_vport_sm_t sm)
{
int i = 0;
while (smt[i].sm && smt[i].sm != sm)
i++;
return smt[i].state;
}
static struct bfa_fcs_vport_sm_table_s vport_sm_table[] = {
{BFA_SM(bfa_fcs_vport_sm_uninit), BFA_FCS_VPORT_UNINIT},
{BFA_SM(bfa_fcs_vport_sm_created), BFA_FCS_VPORT_CREATED},
{BFA_SM(bfa_fcs_vport_sm_offline), BFA_FCS_VPORT_OFFLINE},
{BFA_SM(bfa_fcs_vport_sm_fdisc), BFA_FCS_VPORT_FDISC},
{BFA_SM(bfa_fcs_vport_sm_fdisc_retry), BFA_FCS_VPORT_FDISC_RETRY},
{BFA_SM(bfa_fcs_vport_sm_fdisc_rsp_wait), BFA_FCS_VPORT_FDISC_RSP_WAIT},
{BFA_SM(bfa_fcs_vport_sm_online), BFA_FCS_VPORT_ONLINE},
{BFA_SM(bfa_fcs_vport_sm_deleting), BFA_FCS_VPORT_DELETING},
{BFA_SM(bfa_fcs_vport_sm_cleanup), BFA_FCS_VPORT_CLEANUP},
{BFA_SM(bfa_fcs_vport_sm_logo), BFA_FCS_VPORT_LOGO},
{BFA_SM(bfa_fcs_vport_sm_error), BFA_FCS_VPORT_ERROR}
};
/*
* Beginning state.
*/
static void
bfa_fcs_vport_sm_uninit(struct bfa_fcs_vport_s *vport,
enum bfa_fcs_vport_event event)
{
bfa_trc(__vport_fcs(vport), __vport_pwwn(vport));
bfa_trc(__vport_fcs(vport), event);
switch (event) {
case BFA_FCS_VPORT_SM_CREATE:
bfa_sm_set_state(vport, bfa_fcs_vport_sm_created);
bfa_fcs_fabric_addvport(__vport_fabric(vport), vport);
break;
default:
bfa_sm_fault(__vport_fcs(vport), event);
}
}
/*
* Created state - a start event is required to start up the state machine.
*/
static void
bfa_fcs_vport_sm_created(struct bfa_fcs_vport_s *vport,
enum bfa_fcs_vport_event event)
{
bfa_trc(__vport_fcs(vport), __vport_pwwn(vport));
bfa_trc(__vport_fcs(vport), event);
switch (event) {
case BFA_FCS_VPORT_SM_START:
if (bfa_sm_cmp_state(__vport_fabric(vport),
bfa_fcs_fabric_sm_online)
&& bfa_fcs_fabric_npiv_capable(__vport_fabric(vport))) {
bfa_sm_set_state(vport, bfa_fcs_vport_sm_fdisc);
bfa_fcs_vport_do_fdisc(vport);
} else {
/*
* Fabric is offline or not NPIV capable, stay in
* offline state.
*/
vport->vport_stats.fab_no_npiv++;
bfa_sm_set_state(vport, bfa_fcs_vport_sm_offline);
}
break;
case BFA_FCS_VPORT_SM_DELETE:
bfa_sm_set_state(vport, bfa_fcs_vport_sm_cleanup);
bfa_fcs_lport_delete(&vport->lport);
break;
case BFA_FCS_VPORT_SM_ONLINE:
case BFA_FCS_VPORT_SM_OFFLINE:
/*
* Ignore ONLINE/OFFLINE events from fabric
* till vport is started.
*/
break;
Annotation
- Immediate include surface: `bfad_drv.h`, `bfad_im.h`, `bfa_fcs.h`, `bfa_fcbuild.h`, `bfa_fc.h`.
- Detected declarations: `struct bfa_fcs_vport_sm_table_s`, `function bfa_fcs_lport_sm_uninit`, `function bfa_fcs_lport_sm_init`, `function bfa_fcs_lport_sm_online`, `function list_for_each_safe`, `function list_for_each_safe`, `function bfa_fcs_lport_sm_offline`, `function list_for_each_safe`, `function list_for_each_safe`, `function bfa_fcs_lport_sm_stopping`.
- Atlas domain: Driver Families / drivers/scsi.
- Implementation status: source implementation candidate.
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.