bfa_status_t bfa_fcport_enable(struct bfa_s *bfa) { struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); struct bfa_iocfc_s *iocfc = &bfa->iocfc; struct bfi_iocfc_cfgrsp_s *cfgrsp = iocfc->cfgrsp; /* if port is PBC disabled, return error */ if (cfgrsp->pbc_cfg.port_enabled == BFI_PBC_PORT_DISABLED) { bfa_trc(bfa, fcport->pwwn); return BFA_STATUS_PBC; } if (bfa_ioc_is_disabled(&bfa->ioc)) return BFA_STATUS_IOC_DISABLED; if (fcport->diag_busy) return BFA_STATUS_DIAG_BUSY; else if (bfa_sm_cmp_state (BFA_FCPORT_MOD(bfa), bfa_fcport_sm_disabling_qwait)) return BFA_STATUS_DEVBUSY; bfa_sm_send_event(BFA_FCPORT_MOD(bfa), BFA_FCPORT_SM_ENABLE); return BFA_STATUS_OK; }
void bfa_fcs_port_ms_fabric_rscn(struct bfa_fcs_port_s *port) { struct bfa_fcs_port_ms_s *ms = BFA_FCS_GET_MS_FROM_PORT(port); /* todo. Handle this only when in Online state */ if (bfa_sm_cmp_state(ms, bfa_fcs_port_ms_sm_online)) bfa_sm_send_event(ms, MSSM_EVENT_PORT_FABRIC_RSCN); }
bfa_status_t bfa_fcport_enable(struct bfa_s *bfa) { struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); if (fcport->diag_busy) return BFA_STATUS_DIAG_BUSY; else if (bfa_sm_cmp_state(BFA_FCPORT_MOD(bfa), bfa_fcport_sm_disabling_qwait)) return BFA_STATUS_DEVBUSY; bfa_sm_send_event(BFA_FCPORT_MOD(bfa), BFA_FCPORT_SM_ENABLE); return BFA_STATUS_OK; }
void bfa_ioim_free(struct bfa_ioim_s *ioim) { struct bfa_fcpim_mod_s *fcpim = ioim->fcpim; bfa_trc_fp(ioim->bfa, ioim->iotag); bfa_assert_fp(bfa_sm_cmp_state(ioim, bfa_ioim_sm_uninit)); bfa_assert_fp(list_empty(&ioim->sgpg_q) || (ioim->nsges > BFI_SGE_INLINE)); if (ioim->nsgpgs > 0) bfa_sgpg_mfree(ioim->bfa, &ioim->sgpg_q, ioim->nsgpgs); bfa_stats(ioim->itnim, io_comps); fcpim->ios_active--; list_del(&ioim->qe); list_add_tail(&ioim->qe, &fcpim->ioim_free_q); }
void bfa_ioim_isr(struct bfa_s *bfa, struct bfi_msg_s *m) { struct bfa_fcpim_mod_s *fcpim = BFA_FCPIM_MOD(bfa); struct bfi_ioim_rsp_s *rsp = (struct bfi_ioim_rsp_s *) m; struct bfa_ioim_s *ioim; u16 iotag; enum bfa_ioim_event evt = BFA_IOIM_SM_COMP; iotag = bfa_os_ntohs(rsp->io_tag); ioim = BFA_IOIM_FROM_TAG(fcpim, iotag); bfa_assert(ioim->iotag == iotag); bfa_trc(ioim->bfa, ioim->iotag); bfa_trc(ioim->bfa, rsp->io_status); bfa_trc(ioim->bfa, rsp->reuse_io_tag); if (bfa_sm_cmp_state(ioim, bfa_ioim_sm_active)) bfa_os_assign(ioim->iosp->comp_rspmsg, *m); switch (rsp->io_status) { case BFI_IOIM_STS_OK: bfa_fcpim_stats(fcpim, iocomp_ok); if (rsp->reuse_io_tag == 0) evt = BFA_IOIM_SM_DONE; else evt = BFA_IOIM_SM_COMP; break; case BFI_IOIM_STS_TIMEDOUT: case BFI_IOIM_STS_ABORTED: rsp->io_status = BFI_IOIM_STS_ABORTED; bfa_fcpim_stats(fcpim, iocomp_aborted); if (rsp->reuse_io_tag == 0) evt = BFA_IOIM_SM_DONE; else evt = BFA_IOIM_SM_COMP; break; case BFI_IOIM_STS_PROTO_ERR: bfa_fcpim_stats(fcpim, iocom_proto_err); bfa_assert(rsp->reuse_io_tag); evt = BFA_IOIM_SM_COMP; break; case BFI_IOIM_STS_SQER_NEEDED: bfa_fcpim_stats(fcpim, iocom_sqer_needed); bfa_assert(rsp->reuse_io_tag == 0); evt = BFA_IOIM_SM_SQRETRY; break; case BFI_IOIM_STS_RES_FREE: bfa_fcpim_stats(fcpim, iocom_res_free); evt = BFA_IOIM_SM_FREE; break; case BFI_IOIM_STS_HOST_ABORTED: bfa_fcpim_stats(fcpim, iocom_hostabrts); if (rsp->abort_tag != ioim->abort_tag) { bfa_trc(ioim->bfa, rsp->abort_tag); bfa_trc(ioim->bfa, ioim->abort_tag); return; } if (rsp->reuse_io_tag) evt = BFA_IOIM_SM_ABORT_COMP; else evt = BFA_IOIM_SM_ABORT_DONE; break; case BFI_IOIM_STS_UTAG: bfa_fcpim_stats(fcpim, iocom_utags); evt = BFA_IOIM_SM_COMP_UTAG; break; default: bfa_assert(0); } bfa_sm_send_event(ioim, evt); }
bfa_boolean_t bfa_fcport_is_linkup(struct bfa_s *bfa) { return bfa_sm_cmp_state(BFA_FCPORT_MOD(bfa), bfa_fcport_sm_linkup); }