static void bfa_fcs_itnim_aen_post(struct bfa_fcs_itnim_s *itnim, enum bfa_itnim_aen_event event) { struct bfa_fcs_rport_s *rport = itnim->rport; struct bfad_s *bfad = (struct bfad_s *)itnim->fcs->bfad; struct bfa_aen_entry_s *aen_entry; /* Don't post events for well known addresses */ if (BFA_FCS_PID_IS_WKA(rport->pid)) return; bfad_get_aen_entry(bfad, aen_entry); if (!aen_entry) return; aen_entry->aen_data.itnim.vf_id = rport->port->fabric->vf_id; aen_entry->aen_data.itnim.ppwwn = bfa_fcs_lport_get_pwwn( bfa_fcs_get_base_port(itnim->fcs)); aen_entry->aen_data.itnim.lpwwn = bfa_fcs_lport_get_pwwn(rport->port); aen_entry->aen_data.itnim.rpwwn = rport->pwwn; /* Send the AEN notification */ bfad_im_post_vendor_event(aen_entry, bfad, ++rport->fcs->fcs_aen_seq, BFA_AEN_CAT_ITNIM, event); }
static void bfa_fcs_rpf_sm_uninit(struct bfa_fcs_rpf_s *rpf, enum rpf_event event) { struct bfa_fcs_rport_s *rport = rpf->rport; bfa_trc(rport->fcs, rport->pwwn); bfa_trc(rport->fcs, rport->pid); bfa_trc(rport->fcs, event); switch (event) { case RPFSM_EVENT_RPORT_ONLINE: if (!BFA_FCS_PID_IS_WKA(rport->pid)) { bfa_sm_set_state(rpf, bfa_fcs_rpf_sm_rpsc_sending); rpf->rpsc_retries = 0; bfa_fcs_rpf_send_rpsc2(rpf, NULL); break; }; case RPFSM_EVENT_RPORT_OFFLINE: break; default: bfa_sm_fault(rport->fcs, event); } }
/* * Notification from rport that PLOGI is complete to initiate FC-4 session. */ void bfa_fcs_itnim_brp_online(struct bfa_fcs_itnim_s *itnim) { itnim->stats.onlines++; if (!BFA_FCS_PID_IS_WKA(itnim->rport->pid)) bfa_sm_send_event(itnim, BFA_FCS_ITNIM_SM_HAL_ONLINE); }
/** * Notification from rport that PLOGI is complete to initiate FC-4 session. */ void bfa_fcs_itnim_rport_online(struct bfa_fcs_itnim_s *itnim) { itnim->stats.onlines++; if (!BFA_FCS_PID_IS_WKA(itnim->rport->pid)) { bfa_sm_send_event(itnim, BFA_FCS_ITNIM_SM_ONLINE); } else { /* * For well known addresses, we set the itnim to initiator * state */ itnim->stats.initiator++; bfa_sm_send_event(itnim, BFA_FCS_ITNIM_SM_INITIATOR); } }
static void bfa_fcs_itnim_aen_post(struct bfa_fcs_itnim_s *itnim, enum bfa_itnim_aen_event event) { struct bfa_fcs_rport_s *rport = itnim->rport; union bfa_aen_data_u aen_data; struct bfa_log_mod_s *logmod = rport->fcs->logm; wwn_t lpwwn = bfa_fcs_port_get_pwwn(rport->port); wwn_t rpwwn = rport->pwwn; char lpwwn_ptr[BFA_STRING_32]; char rpwwn_ptr[BFA_STRING_32]; /* * Don't post events for well known addresses */ if (BFA_FCS_PID_IS_WKA(rport->pid)) return; wwn2str(lpwwn_ptr, lpwwn); wwn2str(rpwwn_ptr, rpwwn); switch (event) { case BFA_ITNIM_AEN_ONLINE: bfa_log(logmod, BFA_AEN_ITNIM_ONLINE, rpwwn_ptr, lpwwn_ptr); break; case BFA_ITNIM_AEN_OFFLINE: bfa_log(logmod, BFA_AEN_ITNIM_OFFLINE, rpwwn_ptr, lpwwn_ptr); break; case BFA_ITNIM_AEN_DISCONNECT: bfa_log(logmod, BFA_AEN_ITNIM_DISCONNECT, rpwwn_ptr, lpwwn_ptr); break; default: break; } aen_data.itnim.vf_id = rport->port->fabric->vf_id; aen_data.itnim.ppwwn = bfa_fcs_port_get_pwwn(bfa_fcs_get_base_port(itnim->fcs)); aen_data.itnim.lpwwn = lpwwn; aen_data.itnim.rpwwn = rpwwn; }
/* * PLOGI is done. Await bfa_fcs_itnim to ascertain the scsi function */ static void bfa_fcs_rport_sm_fc4_fcs_online(struct bfa_fcs_rport_s *rport, enum rport_event event) { bfa_trc(rport->fcs, rport->pwwn); bfa_trc(rport->fcs, rport->pid); bfa_trc(rport->fcs, event); switch (event) { case RPSM_EVENT_FC4_FCS_ONLINE: if (rport->scsi_function == BFA_RPORT_INITIATOR) { if (!BFA_FCS_PID_IS_WKA(rport->pid)) bfa_fcs_rpf_rport_online(rport); bfa_sm_set_state(rport, bfa_fcs_rport_sm_online); break; } if (!rport->bfa_rport) rport->bfa_rport = bfa_rport_create(rport->fcs->bfa, rport); if (rport->bfa_rport) { bfa_sm_set_state(rport, bfa_fcs_rport_sm_hal_online); bfa_fcs_rport_hal_online(rport); } else { bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_logosend); bfa_fcs_rport_fcs_offline_action(rport); } break; case RPSM_EVENT_PLOGI_RCVD: bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_offline); rport->plogi_pending = BFA_TRUE; bfa_fcs_rport_fcs_offline_action(rport); break; case RPSM_EVENT_PLOGI_COMP: case RPSM_EVENT_LOGO_IMP: case RPSM_EVENT_ADDRESS_CHANGE: case RPSM_EVENT_FAB_SCN: case RPSM_EVENT_SCN_OFFLINE: bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_offline); bfa_fcs_rport_fcs_offline_action(rport); break; case RPSM_EVENT_LOGO_RCVD: case RPSM_EVENT_PRLO_RCVD: bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_logorcv); bfa_fcs_rport_fcs_offline_action(rport); break; case RPSM_EVENT_DELETE: bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_logosend); bfa_fcs_rport_fcs_offline_action(rport); break; default: bfa_sm_fault(rport->fcs, event); break; } }
/* * Rport is offline. FC-4s are offline. Awaiting BFA rport offline * callback to send LOGO accept. */ static void bfa_fcs_rport_sm_hcb_logorcv(struct bfa_fcs_rport_s *rport, enum rport_event event) { bfa_trc(rport->fcs, rport->pwwn); bfa_trc(rport->fcs, rport->pid); bfa_trc(rport->fcs, event); switch (event) { case RPSM_EVENT_HCB_OFFLINE: case RPSM_EVENT_ADDRESS_CHANGE: if (rport->pid && (rport->prlo == BFA_TRUE)) bfa_fcs_rport_send_prlo_acc(rport); if (rport->pid && (rport->prlo == BFA_FALSE)) bfa_fcs_rport_send_logo_acc(rport); /* * If the lport is online and if the rport is not a well * known address port, * we try to re-discover the r-port. */ if (bfa_fcs_lport_is_online(rport->port) && (!BFA_FCS_PID_IS_WKA(rport->pid))) { if (bfa_fcs_fabric_is_switched(rport->port->fabric)) { bfa_sm_set_state(rport, bfa_fcs_rport_sm_nsdisc_sending); rport->ns_retries = 0; bfa_fcs_rport_send_nsdisc(rport, NULL); } else { /* For N2N Direct Attach, try to re-login */ bfa_sm_set_state(rport, bfa_fcs_rport_sm_plogi_sending); rport->plogi_retries = 0; bfa_fcs_rport_send_plogi(rport, NULL); } } else { /* * if it is not a well known address, reset the * pid to 0. */ if (!BFA_FCS_PID_IS_WKA(rport->pid)) rport->pid = 0; bfa_sm_set_state(rport, bfa_fcs_rport_sm_offline); bfa_timer_start(rport->fcs->bfa, &rport->timer, bfa_fcs_rport_timeout, rport, bfa_fcs_rport_del_timeout); } break; case RPSM_EVENT_DELETE: bfa_sm_set_state(rport, bfa_fcs_rport_sm_delete_pending); if (rport->pid && (rport->prlo == BFA_TRUE)) bfa_fcs_rport_send_prlo_acc(rport); if (rport->pid && (rport->prlo == BFA_FALSE)) bfa_fcs_rport_send_logo_acc(rport); break; case RPSM_EVENT_LOGO_IMP: bfa_sm_set_state(rport, bfa_fcs_rport_sm_hcb_offline); break; case RPSM_EVENT_SCN_ONLINE: case RPSM_EVENT_SCN_OFFLINE: case RPSM_EVENT_LOGO_RCVD: case RPSM_EVENT_PRLO_RCVD: /* * Ignore - already processing a LOGO. */ break; default: bfa_sm_fault(rport->fcs, event); } }