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; }
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; }
/** * Get current speed. */ enum bfa_pport_speed bfa_fcport_get_speed(struct bfa_s *bfa) { struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); return fcport->speed; }
void bfa_fcport_get_attr(struct bfa_s *bfa, struct bfa_pport_attr_s *attr) { struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); bfa_os_memset(attr, 0, sizeof(struct bfa_pport_attr_s)); attr->nwwn = fcport->nwwn; attr->pwwn = fcport->pwwn; bfa_os_memcpy(&attr->pport_cfg, &fcport->cfg, sizeof(struct bfa_pport_cfg_s)); /* speed attributes */ attr->pport_cfg.speed = fcport->cfg.speed; attr->speed_supported = fcport->speed_sup; attr->speed = fcport->speed; attr->cos_supported = FC_CLASS_3; /* topology attributes */ attr->pport_cfg.topology = fcport->cfg.topology; attr->topology = fcport->topology; /* beacon attributes */ attr->beacon = fcport->beacon; attr->link_e2e_beacon = fcport->link_e2e_beacon; attr->plog_enabled = bfa_plog_get_setting(fcport->bfa->plog); attr->pport_cfg.path_tov = bfa_fcpim_path_tov_get(bfa); attr->pport_cfg.q_depth = bfa_fcpim_qdepth_get(bfa); attr->port_state = bfa_sm_to_state(hal_pport_sm_table, fcport->sm); if (bfa_ioc_is_disabled(&fcport->bfa->ioc)) attr->port_state = BFA_PPORT_ST_IOCDIS; else if (bfa_ioc_fw_mismatch(&fcport->bfa->ioc)) attr->port_state = BFA_PPORT_ST_FWMISMATCH; }
u8 bfa_fcport_get_myalpa(struct bfa_s *bfa) { struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); return fcport->myalpa; }
/** * Get current topology. */ enum bfa_pport_topology bfa_fcport_get_topology(struct bfa_s *bfa) { struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); return fcport->topology; }
u32 bfa_fcport_mypid(struct bfa_s *bfa) { struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); return fcport->mypid; }
u16 bfa_fcport_get_maxfrsize(struct bfa_s *bfa) { struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); return fcport->cfg.maxfrsize; }
u8 bfa_fcport_get_rx_bbcredit(struct bfa_s *bfa) { struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); return fcport->cfg.rx_bbcredit; }
/** * Memory initialization. */ static void bfa_fcport_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg, struct bfa_meminfo_s *meminfo, struct bfa_pcidev_s *pcidev) { struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); struct bfa_pport_cfg_s *port_cfg = &fcport->cfg; struct bfa_fcport_ln_s *ln = &fcport->ln; bfa_os_memset(fcport, 0, sizeof(struct bfa_fcport_s)); fcport->bfa = bfa; ln->fcport = fcport; bfa_fcport_mem_claim(fcport, meminfo); bfa_sm_set_state(fcport, bfa_fcport_sm_uninit); bfa_sm_set_state(ln, bfa_fcport_ln_sm_dn); /** * initialize and set default configuration */ port_cfg->topology = BFA_PPORT_TOPOLOGY_P2P; port_cfg->speed = BFA_PPORT_SPEED_AUTO; port_cfg->trunked = BFA_FALSE; port_cfg->maxfrsize = 0; port_cfg->trl_def_speed = BFA_PPORT_SPEED_1GBPS; bfa_reqq_winit(&fcport->reqq_wait, bfa_fcport_qresume, fcport); }
bfa_status_t bfa_fcport_disable(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; } bfa_sm_send_event(BFA_FCPORT_MOD(bfa), BFA_FCPORT_SM_DISABLE); return BFA_STATUS_OK; }
bfa_boolean_t bfa_fcport_is_ratelim(struct bfa_s *bfa) { struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); return fcport->cfg.ratelimit ? BFA_TRUE : BFA_FALSE; }
bfa_boolean_t bfa_fcport_trunk_query(struct bfa_s *bfa, u32 *bitmap) { struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); *bitmap = fcport->cfg.trunk_ports; return fcport->cfg.trunked; }
/** * Reset port statistics (FCQoS or FCoE). */ bfa_status_t bfa_fcport_clear_stats(struct bfa_s *bfa, bfa_cb_pport_t cbfn, void *cbarg) { struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); if (fcport->stats_busy) { bfa_trc(bfa, fcport->stats_busy); return BFA_STATUS_D
bfa_boolean_t bfa_fcport_get_hardalpa(struct bfa_s *bfa, u8 *alpa) { struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); *alpa = fcport->cfg.hardalpa; return fcport->cfg.cfg_hardalpa; }
void bfa_fcport_set_tx_bbcredit(struct bfa_s *bfa, u16 tx_bbcredit) { struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); fcport->cfg.tx_bbcredit = (u8) tx_bbcredit; bfa_fcport_send_txcredit(fcport); }
void bfa_fcport_qos_get_attr(struct bfa_s *bfa, struct bfa_qos_attr_s *qos_attr) { struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); qos_attr->state = bfa_os_ntohl(fcport->qos_attr.state); qos_attr->total_bb_cr = bfa_os_ntohl(fcport->qos_attr.total_bb_cr); }
wwn_t bfa_fcport_get_wwn(struct bfa_s *bfa, bfa_boolean_t node) { struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); if (node) return fcport->nwwn; else return fcport->pwwn; }
bfa_boolean_t bfa_fcport_is_disabled(struct bfa_s *bfa) { struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); return bfa_sm_to_state(hal_pport_sm_table, fcport->sm) == BFA_PPORT_ST_DISABLED; }
/** * Get default minimum ratelim speed */ enum bfa_pport_speed bfa_fcport_get_ratelim_speed(struct bfa_s *bfa) { struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); bfa_trc(bfa, fcport->cfg.trl_def_speed); return fcport->cfg.trl_def_speed; }
void bfa_fcport_busy(struct bfa_s *bfa, bfa_boolean_t status) { struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); bfa_trc(bfa, status); bfa_trc(bfa, fcport->diag_busy); fcport->diag_busy = status; }
/** * Registered callback for port events. */ void bfa_fcport_event_register(struct bfa_s *bfa, void (*cbfn) (void *cbarg, bfa_pport_event_t event), void *cbarg) { struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); fcport->event_cbfn = cbfn; fcport->event_cbarg = cbarg; }
bfa_status_t bfa_fcport_clr_hardalpa(struct bfa_s *bfa) { struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); bfa_trc(bfa, fcport->cfg.cfg_hardalpa); bfa_trc(bfa, fcport->cfg.hardalpa); fcport->cfg.cfg_hardalpa = BFA_FALSE; return BFA_STATUS_OK; }
void bfa_fcport_get_attr(struct bfa_s *bfa, struct bfa_pport_attr_s *attr) { struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); struct bfa_iocfc_s *iocfc = &bfa->iocfc; struct bfi_iocfc_cfgrsp_s *cfgrsp = iocfc->cfgrsp; bfa_os_memset(attr, 0, sizeof(struct bfa_pport_attr_s)); attr->nwwn = fcport->nwwn; attr->pwwn = fcport->pwwn; attr->factorypwwn = bfa_ioc_get_mfg_pwwn(&bfa->ioc); attr->factorynwwn = bfa_ioc_get_mfg_nwwn(&bfa->ioc); bfa_os_memcpy(&attr->pport_cfg, &fcport->cfg, sizeof(struct bfa_pport_cfg_s)); /* * speed attributes */ attr->pport_cfg.speed = fcport->cfg.speed; attr->speed_supported = fcport->speed_sup; attr->speed = fcport->speed; attr->cos_supported = FC_CLASS_3; /* * topology attributes */ attr->pport_cfg.topology = fcport->cfg.topology; attr->topology = fcport->topology; /* * beacon attributes */ attr->beacon = fcport->beacon; attr->link_e2e_beacon = fcport->link_e2e_beacon; attr->plog_enabled = bfa_plog_get_setting(fcport->bfa->plog); attr->pport_cfg.path_tov = bfa_fcpim_path_tov_get(bfa); attr->pport_cfg.q_depth = bfa_fcpim_qdepth_get(bfa); /* PBC Disabled State */ if (cfgrsp->pbc_cfg.port_enabled == BFI_PBC_PORT_DISABLED) attr->port_state = BFA_PPORT_ST_PREBOOT_DISABLED; else { attr->port_state = bfa_sm_to_state( hal_pport_sm_table, fcport->sm); if (bfa_ioc_is_disabled(&fcport->bfa->ioc)) attr->port_state = BFA_PPORT_ST_IOCDIS; else if (bfa_ioc_fw_mismatch(&fcport->bfa->ioc)) attr->port_state = BFA_PPORT_ST_FWMISMATCH; } }
void bfa_fcport_cfg_ratelim(struct bfa_s *bfa, bfa_boolean_t on_off) { struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); bfa_trc(bfa, on_off); bfa_trc(bfa, fcport->cfg.ratelimit); fcport->cfg.ratelimit = on_off; if (fcport->cfg.trl_def_speed == BFA_PPORT_SPEED_UNKNOWN) fcport->cfg.trl_def_speed = BFA_PPORT_SPEED_1GBPS; }
void bfa_fcport_cfg_qos(struct bfa_s *bfa, bfa_boolean_t on_off) { struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); enum bfa_ioc_type_e ioc_type = bfa_get_type(bfa); bfa_trc(bfa, on_off); bfa_trc(bfa, fcport->cfg.qos_enabled); bfa_trc(bfa, ioc_type); if (ioc_type == BFA_IOC_TYPE_FC) fcport->cfg.qos_enabled = on_off; }
void bfa_fcport_beacon(struct bfa_s *bfa, bfa_boolean_t beacon, bfa_boolean_t link_e2e_beacon) { struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); bfa_trc(bfa, beacon); bfa_trc(bfa, link_e2e_beacon); bfa_trc(bfa, fcport->beacon); bfa_trc(bfa, fcport->link_e2e_beacon); fcport->beacon = beacon; fcport->link_e2e_beacon = link_e2e_beacon; }
/** * Configure port speed. */ bfa_status_t bfa_fcport_cfg_speed(struct bfa_s *bfa, enum bfa_pport_speed speed) { struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); bfa_trc(bfa, speed); if ((speed != BFA_PPORT_SPEED_AUTO) && (speed > fcport->speed_sup)) { bfa_trc(bfa, fcport->speed_sup); return BFA_STATUS_UNSUPP_SPEED; } fcport->cfg.speed = speed; return BFA_STATUS_OK; }
bfa_status_t bfa_fcport_trunk_enable(struct bfa_s *bfa, u8 bitmap) { struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); bfa_trc(bfa, bitmap); bfa_trc(bfa, fcport->cfg.trunked); bfa_trc(bfa, fcport->cfg.trunk_ports); if (!bitmap || (bitmap & (bitmap - 1))) return BFA_STATUS_EINVAL; fcport->cfg.trunked = BFA_TRUE; fcport->cfg.trunk_ports = bitmap; return BFA_STATUS_OK; }
/** * Configure default minimum ratelim speed */ bfa_status_t bfa_fcport_cfg_ratelim_speed(struct bfa_s *bfa, enum bfa_pport_speed speed) { struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); bfa_trc(bfa, speed); /* Auto and speeds greater than the supported speed, are invalid */ if ((speed == BFA_PPORT_SPEED_AUTO) || (speed > fcport->speed_sup)) { bfa_trc(bfa, fcport->speed_sup); return BFA_STATUS_UNSUPP_SPEED; } fcport->cfg.trl_def_speed = speed; return BFA_STATUS_OK; }