Lines Matching defs:fcport

110 static bfa_boolean_t bfa_fcport_send_enable(struct bfa_fcport_s *fcport);
111 static bfa_boolean_t bfa_fcport_send_disable(struct bfa_fcport_s *fcport);
112 static void bfa_fcport_update_linkinfo(struct bfa_fcport_s *fcport);
113 static void bfa_fcport_reset_linkinfo(struct bfa_fcport_s *fcport);
114 static void bfa_fcport_set_wwns(struct bfa_fcport_s *fcport);
116 static void bfa_fcport_scn(struct bfa_fcport_s *fcport,
128 static void bfa_fcport_sm_uninit(struct bfa_fcport_s *fcport,
130 static void bfa_fcport_sm_enabling_qwait(struct bfa_fcport_s *fcport,
132 static void bfa_fcport_sm_enabling(struct bfa_fcport_s *fcport,
134 static void bfa_fcport_sm_linkdown(struct bfa_fcport_s *fcport,
136 static void bfa_fcport_sm_linkup(struct bfa_fcport_s *fcport,
138 static void bfa_fcport_sm_disabling(struct bfa_fcport_s *fcport,
140 static void bfa_fcport_sm_disabling_qwait(struct bfa_fcport_s *fcport,
142 static void bfa_fcport_sm_toggling_qwait(struct bfa_fcport_s *fcport,
144 static void bfa_fcport_sm_disabled(struct bfa_fcport_s *fcport,
146 static void bfa_fcport_sm_stopped(struct bfa_fcport_s *fcport,
148 static void bfa_fcport_sm_iocdown(struct bfa_fcport_s *fcport,
150 static void bfa_fcport_sm_iocfail(struct bfa_fcport_s *fcport,
152 static void bfa_fcport_sm_dport(struct bfa_fcport_s *fcport,
154 static void bfa_fcport_sm_ddport(struct bfa_fcport_s *fcport,
156 static void bfa_fcport_sm_faa_misconfig(struct bfa_fcport_s *fcport,
1983 bfa_fcport_aen_post(struct bfa_fcport_s *fcport, enum bfa_port_aen_event event)
1985 struct bfad_s *bfad = (struct bfad_s *)fcport->bfa->bfad;
1992 aen_entry->aen_data.port.ioc_type = bfa_get_type(fcport->bfa);
1993 aen_entry->aen_data.port.pwwn = fcport->pwwn;
1996 bfad_im_post_vendor_event(aen_entry, bfad, ++fcport->bfa->bfa_aen_seq,
2004 bfa_fcport_sm_uninit(struct bfa_fcport_s *fcport,
2007 bfa_trc(fcport->bfa, event);
2014 fcport->use_flash_cfg = BFA_TRUE;
2016 if (bfa_fcport_send_enable(fcport)) {
2017 bfa_trc(fcport->bfa, BFA_TRUE);
2018 bfa_sm_set_state(fcport, bfa_fcport_sm_enabling);
2020 bfa_trc(fcport->bfa, BFA_FALSE);
2021 bfa_sm_set_state(fcport,
2039 bfa_sm_set_state(fcport, bfa_fcport_sm_disabled);
2043 bfa_sm_set_state(fcport, bfa_fcport_sm_iocdown);
2047 bfa_sm_fault(fcport->bfa, event);
2052 bfa_fcport_sm_enabling_qwait(struct bfa_fcport_s *fcport,
2056 struct bfad_s *bfad = (struct bfad_s *)fcport->bfa->bfad;
2057 bfa_trc(fcport->bfa, event);
2061 bfa_sm_set_state(fcport, bfa_fcport_sm_enabling);
2062 bfa_fcport_send_enable(fcport);
2066 bfa_reqq_wcancel(&fcport->reqq_wait);
2067 bfa_sm_set_state(fcport, bfa_fcport_sm_stopped);
2081 bfa_sm_set_state(fcport, bfa_fcport_sm_disabled);
2082 bfa_reqq_wcancel(&fcport->reqq_wait);
2083 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL,
2085 wwn2str(pwwn_buf, fcport->pwwn);
2088 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISABLE);
2100 bfa_reqq_wcancel(&fcport->reqq_wait);
2101 bfa_sm_set_state(fcport, bfa_fcport_sm_iocdown);
2105 bfa_fcport_reset_linkinfo(fcport);
2106 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISCONNECT);
2107 bfa_sm_set_state(fcport, bfa_fcport_sm_faa_misconfig);
2111 bfa_sm_fault(fcport->bfa, event);
2116 bfa_fcport_sm_enabling(struct bfa_fcport_s *fcport,
2120 struct bfad_s *bfad = (struct bfad_s *)fcport->bfa->bfad;
2121 bfa_trc(fcport->bfa, event);
2126 bfa_sm_set_state(fcport, bfa_fcport_sm_linkdown);
2130 bfa_fcport_update_linkinfo(fcport);
2131 bfa_sm_set_state(fcport, bfa_fcport_sm_linkup);
2133 WARN_ON(!fcport->event_cbfn);
2134 bfa_fcport_scn(fcport, BFA_PORT_LINKUP, BFA_FALSE);
2144 if (bfa_fcport_send_disable(fcport))
2145 bfa_sm_set_state(fcport, bfa_fcport_sm_disabling);
2147 bfa_sm_set_state(fcport,
2150 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL,
2152 wwn2str(pwwn_buf, fcport->pwwn);
2155 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISABLE);
2159 bfa_sm_set_state(fcport, bfa_fcport_sm_stopped);
2163 bfa_sm_set_state(fcport, bfa_fcport_sm_iocdown);
2167 bfa_fcport_reset_linkinfo(fcport);
2168 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISCONNECT);
2169 bfa_sm_set_state(fcport, bfa_fcport_sm_faa_misconfig);
2173 bfa_sm_fault(fcport->bfa, event);
2178 bfa_fcport_sm_linkdown(struct bfa_fcport_s *fcport,
2181 struct bfi_fcport_event_s *pevent = fcport->event_arg.i2hmsg.event;
2183 struct bfad_s *bfad = (struct bfad_s *)fcport->bfa->bfad;
2185 bfa_trc(fcport->bfa, event);
2189 bfa_fcport_update_linkinfo(fcport);
2190 bfa_sm_set_state(fcport, bfa_fcport_sm_linkup);
2191 WARN_ON(!fcport->event_cbfn);
2192 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL,
2194 if (!bfa_ioc_get_fcmode(&fcport->bfa->ioc)) {
2196 bfa_trc(fcport->bfa,
2198 bfa_trc(fcport->bfa,
2202 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL,
2206 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL,
2211 bfa_fcport_scn(fcport, BFA_PORT_LINKUP, BFA_FALSE);
2212 wwn2str(pwwn_buf, fcport->pwwn);
2215 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_ONLINE);
2218 if (fcport->cfg.qos_enabled &&
2219 fcport->qos_attr.state != BFA_QOS_ONLINE)
2220 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_QOS_NEG);
2236 if (bfa_fcport_send_disable(fcport))
2237 bfa_sm_set_state(fcport, bfa_fcport_sm_disabling);
2239 bfa_sm_set_state(fcport,
2242 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL,
2244 wwn2str(pwwn_buf, fcport->pwwn);
2247 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISABLE);
2251 bfa_sm_set_state(fcport, bfa_fcport_sm_stopped);
2255 bfa_sm_set_state(fcport, bfa_fcport_sm_iocdown);
2259 bfa_fcport_reset_linkinfo(fcport);
2260 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISCONNECT);
2261 bfa_sm_set_state(fcport, bfa_fcport_sm_faa_misconfig);
2265 bfa_sm_fault(fcport->bfa, event);
2270 bfa_fcport_sm_linkup(struct bfa_fcport_s *fcport,
2274 struct bfad_s *bfad = (struct bfad_s *)fcport->bfa->bfad;
2276 bfa_trc(fcport->bfa, event);
2286 if (bfa_fcport_send_disable(fcport))
2287 bfa_sm_set_state(fcport, bfa_fcport_sm_disabling);
2289 bfa_sm_set_state(fcport,
2292 bfa_fcport_reset_linkinfo(fcport);
2293 bfa_fcport_scn(fcport, BFA_PORT_LINKDOWN, BFA_FALSE);
2294 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL,
2296 wwn2str(pwwn_buf, fcport->pwwn);
2299 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_OFFLINE);
2302 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISABLE);
2306 bfa_sm_set_state(fcport, bfa_fcport_sm_linkdown);
2307 bfa_fcport_reset_linkinfo(fcport);
2308 bfa_fcport_scn(fcport, BFA_PORT_LINKDOWN, BFA_FALSE);
2309 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL,
2311 wwn2str(pwwn_buf, fcport->pwwn);
2312 if (BFA_PORT_IS_DISABLED(fcport->bfa)) {
2315 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_OFFLINE);
2320 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISCONNECT);
2325 bfa_sm_set_state(fcport, bfa_fcport_sm_stopped);
2326 bfa_fcport_reset_linkinfo(fcport);
2327 wwn2str(pwwn_buf, fcport->pwwn);
2328 if (BFA_PORT_IS_DISABLED(fcport->bfa)) {
2331 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_OFFLINE);
2336 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISCONNECT);
2341 bfa_sm_set_state(fcport, bfa_fcport_sm_iocdown);
2342 bfa_fcport_reset_linkinfo(fcport);
2343 bfa_fcport_scn(fcport, BFA_PORT_LINKDOWN, BFA_FALSE);
2344 wwn2str(pwwn_buf, fcport->pwwn);
2345 if (BFA_PORT_IS_DISABLED(fcport->bfa)) {
2348 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_OFFLINE);
2353 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISCONNECT);
2358 bfa_fcport_reset_linkinfo(fcport);
2359 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISCONNECT);
2360 bfa_sm_set_state(fcport, bfa_fcport_sm_faa_misconfig);
2364 bfa_sm_fault(fcport->bfa, event);
2369 bfa_fcport_sm_disabling_qwait(struct bfa_fcport_s *fcport,
2372 bfa_trc(fcport->bfa, event);
2376 bfa_sm_set_state(fcport, bfa_fcport_sm_disabling);
2377 bfa_fcport_send_disable(fcport);
2381 bfa_sm_set_state(fcport, bfa_fcport_sm_stopped);
2382 bfa_reqq_wcancel(&fcport->reqq_wait);
2386 bfa_sm_set_state(fcport, bfa_fcport_sm_toggling_qwait);
2404 bfa_sm_set_state(fcport, bfa_fcport_sm_iocfail);
2405 bfa_reqq_wcancel(&fcport->reqq_wait);
2409 bfa_fcport_reset_linkinfo(fcport);
2410 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISCONNECT);
2411 bfa_sm_set_state(fcport, bfa_fcport_sm_faa_misconfig);
2415 bfa_sm_fault(fcport->bfa, event);
2420 bfa_fcport_sm_toggling_qwait(struct bfa_fcport_s *fcport,
2423 bfa_trc(fcport->bfa, event);
2427 bfa_sm_set_state(fcport, bfa_fcport_sm_disabling);
2428 bfa_fcport_send_disable(fcport);
2429 if (bfa_fcport_send_enable(fcport))
2430 bfa_sm_set_state(fcport, bfa_fcport_sm_enabling);
2432 bfa_sm_set_state(fcport,
2437 bfa_sm_set_state(fcport, bfa_fcport_sm_stopped);
2438 bfa_reqq_wcancel(&fcport->reqq_wait);
2445 bfa_sm_set_state(fcport, bfa_fcport_sm_disabling_qwait);
2457 bfa_sm_set_state(fcport, bfa_fcport_sm_iocfail);
2458 bfa_reqq_wcancel(&fcport->reqq_wait);
2462 bfa_sm_fault(fcport->bfa, event);
2467 bfa_fcport_sm_disabling(struct bfa_fcport_s *fcport,
2471 struct bfad_s *bfad = (struct bfad_s *)fcport->bfa->bfad;
2472 bfa_trc(fcport->bfa, event);
2476 bfa_sm_set_state(fcport, bfa_fcport_sm_disabled);
2486 if (bfa_fcport_send_enable(fcport))
2487 bfa_sm_set_state(fcport, bfa_fcport_sm_enabling);
2489 bfa_sm_set_state(fcport,
2492 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL,
2494 wwn2str(pwwn_buf, fcport->pwwn);
2497 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_ENABLE);
2501 bfa_sm_set_state(fcport, bfa_fcport_sm_stopped);
2513 bfa_sm_set_state(fcport, bfa_fcport_sm_iocfail);
2517 bfa_sm_fault(fcport->bfa, event);
2522 bfa_fcport_sm_disabled(struct bfa_fcport_s *fcport,
2526 struct bfad_s *bfad = (struct bfad_s *)fcport->bfa->bfad;
2527 bfa_trc(fcport->bfa, event);
2537 bfa_sm_set_state(fcport, bfa_fcport_sm_stopped);
2541 if (bfa_fcport_send_enable(fcport))
2542 bfa_sm_set_state(fcport, bfa_fcport_sm_enabling);
2544 bfa_sm_set_state(fcport,
2547 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL,
2549 wwn2str(pwwn_buf, fcport->pwwn);
2552 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_ENABLE);
2562 bfa_sm_set_state(fcport, bfa_fcport_sm_iocfail);
2566 bfa_sm_set_state(fcport, bfa_fcport_sm_dport);
2570 bfa_sm_set_state(fcport, bfa_fcport_sm_ddport);
2574 bfa_sm_fault(fcport->bfa, event);
2579 bfa_fcport_sm_stopped(struct bfa_fcport_s *fcport,
2582 bfa_trc(fcport->bfa, event);
2586 if (bfa_fcport_send_enable(fcport))
2587 bfa_sm_set_state(fcport, bfa_fcport_sm_enabling);
2589 bfa_sm_set_state(fcport,
2605 bfa_fcport_sm_iocdown(struct bfa_fcport_s *fcport,
2608 bfa_trc(fcport->bfa, event);
2612 if (bfa_fcport_send_enable(fcport))
2613 bfa_sm_set_state(fcport, bfa_fcport_sm_enabling);
2615 bfa_sm_set_state(fcport,
2631 bfa_fcport_sm_iocfail(struct bfa_fcport_s *fcport,
2634 bfa_trc(fcport->bfa, event);
2638 bfa_sm_set_state(fcport, bfa_fcport_sm_disabled);
2642 bfa_sm_set_state(fcport, bfa_fcport_sm_iocdown);
2654 bfa_fcport_sm_dport(struct bfa_fcport_s *fcport, enum bfa_fcport_sm_event event)
2656 bfa_trc(fcport->bfa, event);
2669 bfa_sm_set_state(fcport, bfa_fcport_sm_stopped);
2673 bfa_sm_set_state(fcport, bfa_fcport_sm_iocfail);
2677 bfa_sm_set_state(fcport, bfa_fcport_sm_disabled);
2681 bfa_sm_fault(fcport->bfa, event);
2686 bfa_fcport_sm_ddport(struct bfa_fcport_s *fcport,
2689 bfa_trc(fcport->bfa, event);
2694 bfa_sm_set_state(fcport, bfa_fcport_sm_disabled);
2707 bfa_sm_set_state(fcport, bfa_fcport_sm_stopped);
2711 bfa_sm_set_state(fcport, bfa_fcport_sm_iocfail);
2715 bfa_sm_fault(fcport->bfa, event);
2720 bfa_fcport_sm_faa_misconfig(struct bfa_fcport_s *fcport,
2723 bfa_trc(fcport->bfa, event);
2735 if (bfa_fcport_send_disable(fcport))
2736 bfa_sm_set_state(fcport, bfa_fcport_sm_disabling);
2738 bfa_sm_set_state(fcport, bfa_fcport_sm_disabling_qwait);
2740 bfa_fcport_reset_linkinfo(fcport);
2741 bfa_fcport_scn(fcport, BFA_PORT_LINKDOWN, BFA_FALSE);
2742 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL,
2744 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISABLE);
2748 bfa_sm_set_state(fcport, bfa_fcport_sm_stopped);
2752 bfa_fcport_reset_linkinfo(fcport);
2753 bfa_fcport_scn(fcport, BFA_PORT_LINKDOWN, BFA_FALSE);
2754 bfa_sm_set_state(fcport, bfa_fcport_sm_iocdown);
2758 bfa_sm_fault(fcport->bfa, event);
2769 bfa_trc(ln->fcport->bfa, event);
2778 bfa_sm_fault(ln->fcport->bfa, event);
2789 bfa_trc(ln->fcport->bfa, event);
2801 bfa_sm_fault(ln->fcport->bfa, event);
2812 bfa_trc(ln->fcport->bfa, event);
2825 bfa_sm_fault(ln->fcport->bfa, event);
2836 bfa_trc(ln->fcport->bfa, event);
2845 bfa_sm_fault(ln->fcport->bfa, event);
2856 bfa_trc(ln->fcport->bfa, event);
2868 bfa_sm_fault(ln->fcport->bfa, event);
2879 bfa_trc(ln->fcport->bfa, event);
2892 bfa_sm_fault(ln->fcport->bfa, event);
2903 bfa_trc(ln->fcport->bfa, event);
2916 bfa_sm_fault(ln->fcport->bfa, event);
2926 ln->fcport->event_cbfn(ln->fcport->event_cbarg, ln->ln_event);
2933 * trunk - false if caller is fcport to ignore fcport event in trunked mode
2936 bfa_fcport_scn(struct bfa_fcport_s *fcport, enum bfa_port_linkstate event,
2939 if (fcport->cfg.trunked && !trunk)
2944 bfa_sm_send_event(&fcport->ln, BFA_FCPORT_LN_SM_LINKUP);
2947 bfa_sm_send_event(&fcport->ln, BFA_FCPORT_LN_SM_LINKDOWN);
2957 struct bfa_fcport_s *fcport = ln->fcport;
2959 if (fcport->bfa->fcs) {
2960 fcport->event_cbfn(fcport->event_cbarg, event);
2964 bfa_cb_queue(fcport->bfa, &ln->ln_qe,
2984 struct bfa_fcport_s *fcport = cbarg;
2986 bfa_sm_send_event(fcport, BFA_FCPORT_SM_QRESUME);
2990 bfa_fcport_mem_claim(struct bfa_fcport_s *fcport)
2992 struct bfa_mem_dma_s *fcport_dma = &fcport->fcport_dma;
2994 fcport->stats_kva = bfa_mem_dma_virt(fcport_dma);
2995 fcport->stats_pa = bfa_mem_dma_phys(fcport_dma);
2996 fcport->stats = (union bfa_fcport_stats_u *)
3007 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3008 struct bfa_port_cfg_s *port_cfg = &fcport->cfg;
3009 struct bfa_fcport_ln_s *ln = &fcport->ln;
3011 fcport->bfa = bfa;
3012 ln->fcport = fcport;
3014 bfa_fcport_mem_claim(fcport);
3016 bfa_sm_set_state(fcport, bfa_fcport_sm_uninit);
3022 fcport->stats_reset_time = ktime_get_seconds();
3023 fcport->stats_dma_ready = BFA_FALSE;
3038 fcport->fec_state = BFA_FEC_OFFLINE;
3040 INIT_LIST_HEAD(&fcport->stats_pending_q);
3041 INIT_LIST_HEAD(&fcport->statsclr_pending_q);
3043 bfa_reqq_winit(&fcport->reqq_wait, bfa_fcport_qresume, fcport);
3058 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3060 bfa_sm_send_event(fcport, BFA_FCPORT_SM_HWFAIL);
3065 * Update loop info in fcport for SCN online
3068 bfa_fcport_update_loop_info(struct bfa_fcport_s *fcport,
3071 fcport->myalpa = loop_info->myalpa;
3072 fcport->alpabm_valid =
3074 memcpy(fcport->alpabm.alpa_bm,
3080 bfa_fcport_update_linkinfo(struct bfa_fcport_s *fcport)
3082 struct bfi_fcport_event_s *pevent = fcport->event_arg.i2hmsg.event;
3083 struct bfa_fcport_trunk_s *trunk = &fcport->trunk;
3085 fcport->speed = pevent->link_state.speed;
3086 fcport->topology = pevent->link_state.topology;
3088 if (fcport->topology == BFA_PORT_TOPOLOGY_LOOP) {
3089 bfa_fcport_update_loop_info(fcport,
3095 fcport->qos_attr = pevent->link_state.qos_attr;
3096 fcport->qos_vc_attr = pevent->link_state.attr.vc_fcf.qos_vc_attr;
3098 if (fcport->cfg.bb_cr_enabled)
3099 fcport->bbcr_attr = pevent->link_state.attr.bbcr_attr;
3101 fcport->fec_state = pevent->link_state.fec_state;
3106 if (!fcport->cfg.trunked)
3110 fcport->fcoe_vlan =
3113 bfa_trc(fcport->bfa, fcport->speed);
3114 bfa_trc(fcport->bfa, fcport->topology);
3118 bfa_fcport_reset_linkinfo(struct bfa_fcport_s *fcport)
3120 fcport->speed = BFA_PORT_SPEED_UNKNOWN;
3121 fcport->topology = BFA_PORT_TOPOLOGY_NONE;
3122 fcport->fec_state = BFA_FEC_OFFLINE;
3129 bfa_fcport_send_enable(struct bfa_fcport_s *fcport)
3137 fcport->msgtag++;
3142 m = bfa_reqq_next(fcport->bfa, BFA_REQQ_PORT);
3144 bfa_reqq_wait(fcport->bfa, BFA_REQQ_PORT,
3145 &fcport->reqq_wait);
3150 bfa_fn_lpu(fcport->bfa));
3151 m->nwwn = fcport->nwwn;
3152 m->pwwn = fcport->pwwn;
3153 m->port_cfg = fcport->cfg;
3154 m->msgtag = fcport->msgtag;
3155 m->port_cfg.maxfrsize = cpu_to_be16(fcport->cfg.maxfrsize);
3156 m->use_flash_cfg = fcport->use_flash_cfg;
3157 bfa_dma_be_addr_set(m->stats_dma_addr, fcport->stats_pa);
3158 bfa_trc(fcport->bfa, m->stats_dma_addr.a32.addr_lo);
3159 bfa_trc(fcport->bfa, m->stats_dma_addr.a32.addr_hi);
3164 bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT, m->mh);
3172 bfa_fcport_send_disable(struct bfa_fcport_s *fcport)
3180 fcport->msgtag++;
3185 m = bfa_reqq_next(fcport->bfa, BFA_REQQ_PORT);
3187 bfa_reqq_wait(fcport->bfa, BFA_REQQ_PORT,
3188 &fcport->reqq_wait);
3193 bfa_fn_lpu(fcport->bfa));
3194 m->msgtag = fcport->msgtag;
3199 bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT, m->mh);
3205 bfa_fcport_set_wwns(struct bfa_fcport_s *fcport)
3207 fcport->pwwn = fcport->bfa->ioc.attr->pwwn;
3208 fcport->nwwn = fcport->bfa->ioc.attr->nwwn;
3210 bfa_trc(fcport->bfa, fcport->pwwn);
3211 bfa_trc(fcport->bfa, fcport->nwwn);
3250 struct bfa_fcport_s *fcport = (struct bfa_fcport_s *)cbarg;
3258 list_for_each_safe(qe, qen, &fcport->stats_pending_q) {
3259 bfa_q_deq(&fcport->stats_pending_q, &qe);
3261 if (fcport->stats_status == BFA_STATUS_OK) {
3264 if (bfa_ioc_get_fcmode(&fcport->bfa->ioc))
3266 &fcport->stats->fcqos);
3269 &fcport->stats->fcoe);
3271 time - fcport->stats_reset_time;
3274 bfa_cb_queue_status(fcport->bfa, &cb->hcb_qe,
3275 fcport->stats_status);
3277 fcport->stats_status = BFA_STATUS_OK;
3279 INIT_LIST_HEAD(&fcport->stats_pending_q);
3280 fcport->stats_status = BFA_STATUS_OK;
3287 struct bfa_fcport_s *fcport = (struct bfa_fcport_s *) cbarg;
3289 bfa_trc(fcport->bfa, fcport->stats_qfull);
3291 if (fcport->stats_qfull) {
3292 bfa_reqq_wcancel(&fcport->stats_reqq_wait);
3293 fcport->stats_qfull = BFA_FALSE;
3296 fcport->stats_status = BFA_STATUS_ETIMER;
3297 __bfa_cb_fcport_stats_get(fcport, BFA_TRUE);
3303 struct bfa_fcport_s *fcport = (struct bfa_fcport_s *) cbarg;
3306 msg = bfa_reqq_next(fcport->bfa, BFA_REQQ_PORT);
3309 fcport->stats_qfull = BFA_TRUE;
3310 bfa_reqq_winit(&fcport->stats_reqq_wait,
3311 bfa_fcport_send_stats_get, fcport);
3312 bfa_reqq_wait(fcport->bfa, BFA_REQQ_PORT,
3313 &fcport->stats_reqq_wait);
3316 fcport->stats_qfull = BFA_FALSE;
3320 bfa_fn_lpu(fcport->bfa));
3321 bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT, msg->mh);
3327 struct bfa_fcport_s *fcport = (struct bfa_fcport_s *) cbarg;
3335 fcport->stats_reset_time = ktime_get_seconds();
3336 list_for_each_safe(qe, qen, &fcport->statsclr_pending_q) {
3337 bfa_q_deq(&fcport->statsclr_pending_q, &qe);
3339 bfa_cb_queue_status(fcport->bfa, &cb->hcb_qe,
3340 fcport->stats_status);
3342 fcport->stats_status = BFA_STATUS_OK;
3344 INIT_LIST_HEAD(&fcport->statsclr_pending_q);
3345 fcport->stats_status = BFA_STATUS_OK;
3352 struct bfa_fcport_s *fcport = (struct bfa_fcport_s *) cbarg;
3354 bfa_trc(fcport->bfa, fcport->stats_qfull);
3356 if (fcport->stats_qfull) {
3357 bfa_reqq_wcancel(&fcport->stats_reqq_wait);
3358 fcport->stats_qfull = BFA_FALSE;
3361 fcport->stats_status = BFA_STATUS_ETIMER;
3362 __bfa_cb_fcport_stats_clr(fcport, BFA_TRUE);
3368 struct bfa_fcport_s *fcport = (struct bfa_fcport_s *) cbarg;
3371 msg = bfa_reqq_next(fcport->bfa, BFA_REQQ_PORT);
3374 fcport->stats_qfull = BFA_TRUE;
3375 bfa_reqq_winit(&fcport->stats_reqq_wait,
3376 bfa_fcport_send_stats_clear, fcport);
3377 bfa_reqq_wait(fcport->bfa, BFA_REQQ_PORT,
3378 &fcport->stats_reqq_wait);
3381 fcport->stats_qfull = BFA_FALSE;
3385 bfa_fn_lpu(fcport->bfa));
3386 bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT, msg->mh);
3393 bfa_trunk_scn(struct bfa_fcport_s *fcport, struct bfi_fcport_trunk_scn_s *scn)
3395 struct bfa_fcport_trunk_s *trunk = &fcport->trunk;
3402 bfa_trc(fcport->bfa, fcport->cfg.trunked);
3406 bfa_trc(fcport->bfa, trunk->attr.state);
3407 bfa_trc(fcport->bfa, scn->trunk_state);
3408 bfa_trc(fcport->bfa, scn->trunk_speed);
3414 if (fcport->cfg.trunked && (trunk->attr.state != BFA_TRUNK_DISABLED))
3428 fcport->speed = tlink->speed;
3429 fcport->topology = BFA_PORT_TOPOLOGY_P2P;
3433 bfa_trc(fcport->bfa, lattr->link_state);
3434 bfa_trc(fcport->bfa, lattr->trunk_wwn);
3435 bfa_trc(fcport->bfa, lattr->fctl);
3436 bfa_trc(fcport->bfa, lattr->speed);
3437 bfa_trc(fcport->bfa, lattr->deskew);
3442 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL,
3446 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL,
3450 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL,
3454 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL,
3463 bfa_fcport_scn(fcport, (scn->trunk_state == BFA_TRUNK_ONLINE) ?
3471 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3477 if (fcport->cfg.trunked) {
3478 if (fcport->trunk.attr.state == BFA_TRUNK_ONLINE)
3479 bfa_fcport_scn(fcport, BFA_PORT_LINKDOWN, BFA_TRUE);
3481 fcport->trunk.attr.state = BFA_TRUNK_OFFLINE;
3482 fcport->trunk.attr.speed = BFA_PORT_SPEED_UNKNOWN;
3484 fcport->trunk.attr.link_attr[i].trunk_wwn = 0;
3485 fcport->trunk.attr.link_attr[i].fctl =
3487 fcport->trunk.attr.link_attr[i].link_state =
3489 fcport->trunk.attr.link_attr[i].speed =
3491 fcport->trunk.attr.link_attr[i].deskew = 0;
3502 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3507 bfa_fcport_set_wwns(fcport);
3508 if (fcport->cfg.maxfrsize == 0)
3509 fcport->cfg.maxfrsize = bfa_ioc_maxfrsize(&bfa->ioc);
3510 fcport->cfg.rx_bbcredit = bfa_ioc_rx_bbcredit(&bfa->ioc);
3511 fcport->speed_sup = bfa_ioc_speed_sup(&bfa->ioc);
3516 WARN_ON(!fcport->cfg.maxfrsize);
3517 WARN_ON(!fcport->cfg.rx_bbcredit);
3518 WARN_ON(!fcport->speed_sup);
3527 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3531 fcport->event_arg.i2hmsg = i2hmsg;
3534 bfa_trc(bfa, bfa_fcport_sm_to_state(hal_port_sm_table, fcport->sm));
3538 if (fcport->msgtag == i2hmsg.penable_rsp->msgtag) {
3540 fcport->stats_dma_ready = BFA_TRUE;
3541 if (fcport->use_flash_cfg) {
3542 fcport->cfg = i2hmsg.penable_rsp->port_cfg;
3543 fcport->cfg.maxfrsize =
3544 cpu_to_be16(fcport->cfg.maxfrsize);
3545 fcport->cfg.path_tov =
3546 cpu_to_be16(fcport->cfg.path_tov);
3547 fcport->cfg.q_depth =
3548 cpu_to_be16(fcport->cfg.q_depth);
3550 if (fcport->cfg.trunked)
3551 fcport->trunk.attr.state =
3554 fcport->trunk.attr.state =
3556 fcport->qos_attr.qos_bw =
3558 fcport->use_flash_cfg = BFA_FALSE;
3561 if (fcport->cfg.qos_enabled)
3562 fcport->qos_attr.state = BFA_QOS_OFFLINE;
3564 fcport->qos_attr.state = BFA_QOS_DISABLED;
3566 fcport->qos_attr.qos_bw_op =
3569 if (fcport->cfg.bb_cr_enabled)
3570 fcport->bbcr_attr.state = BFA_BBCR_OFFLINE;
3572 fcport->bbcr_attr.state = BFA_BBCR_DISABLED;
3574 bfa_sm_send_event(fcport, BFA_FCPORT_SM_FWRSP);
3579 if (fcport->msgtag == i2hmsg.penable_rsp->msgtag)
3580 bfa_sm_send_event(fcport, BFA_FCPORT_SM_FWRSP);
3584 if (fcport->cfg.bb_cr_enabled)
3585 fcport->bbcr_attr.state = BFA_BBCR_OFFLINE;
3587 fcport->bbcr_attr.state = BFA_BBCR_DISABLED;
3590 bfa_sm_send_event(fcport, BFA_FCPORT_SM_LINKUP);
3594 bfa_sm_send_event(fcport,
3597 bfa_sm_send_event(fcport,
3600 fcport->qos_attr.qos_bw_op =
3605 bfa_trunk_scn(fcport, i2hmsg.trunk_scn);
3612 if (list_empty(&fcport->stats_pending_q) ||
3613 (fcport->stats_status == BFA_STATUS_ETIMER))
3616 bfa_timer_stop(&fcport->timer);
3617 fcport->stats_status = i2hmsg.pstatsget_rsp->status;
3618 __bfa_cb_fcport_stats_get(fcport, BFA_TRUE);
3625 if (list_empty(&fcport->statsclr_pending_q) ||
3626 (fcport->stats_status == BFA_STATUS_ETIMER))
3629 bfa_timer_stop(&fcport->timer);
3630 fcport->stats_status = BFA_STATUS_OK;
3631 __bfa_cb_fcport_stats_clr(fcport, BFA_TRUE);
3635 bfa_sm_send_event(fcport, BFA_FCPORT_SM_ENABLE);
3639 bfa_sm_send_event(fcport, BFA_FCPORT_SM_DISABLE);
3657 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3659 fcport->event_cbfn = cbfn;
3660 fcport->event_cbarg = cbarg;
3666 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3674 if (fcport->diag_busy)
3698 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3703 bfa_trc(bfa, fcport->pwwn);
3715 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3719 if (fcport->cfg.trunked == BFA_TRUE)
3721 if ((fcport->cfg.topology == BFA_PORT_TOPOLOGY_LOOP) &&
3724 if ((speed != BFA_PORT_SPEED_AUTO) && (speed > fcport->speed_sup)) {
3725 bfa_trc(bfa, fcport->speed_sup);
3730 if (bfa_ioc_get_type(&fcport->bfa->ioc) == BFA_IOC_TYPE_FC) {
3749 fcport->cfg.speed = speed;
3760 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3762 return fcport->speed;
3771 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3774 bfa_trc(bfa, fcport->cfg.topology);
3782 (fcport->qos_attr.state != BFA_QOS_DISABLED))
3784 if (fcport->cfg.ratelimit != BFA_FALSE)
3787 (fcport->trunk.attr.state != BFA_TRUNK_DISABLED))
3790 (fcport->cfg.speed == BFA_PORT_SPEED_16GBPS))
3807 fcport->cfg.topology = topology;
3817 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3819 return fcport->topology;
3828 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3830 return fcport->cfg.topology;
3836 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3839 bfa_trc(bfa, fcport->cfg.cfg_hardalpa);
3840 bfa_trc(bfa, fcport->cfg.hardalpa);
3842 fcport->cfg.cfg_hardalpa = BFA_TRUE;
3843 fcport->cfg.hardalpa = alpa;
3851 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3853 bfa_trc(bfa, fcport->cfg.cfg_hardalpa);
3854 bfa_trc(bfa, fcport->cfg.hardalpa);
3856 fcport->cfg.cfg_hardalpa = BFA_FALSE;
3863 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3865 *alpa = fcport->cfg.hardalpa;
3866 return fcport->cfg.cfg_hardalpa;
3872 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3874 return fcport->myalpa;
3880 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3883 bfa_trc(bfa, fcport->cfg.maxfrsize);
3893 fcport->cfg.maxfrsize = maxfrsize;
3900 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3902 return fcport->cfg.maxfrsize;
3918 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3920 fcport->cfg.tx_bbcredit = (u8)tx_bbcredit;
3930 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3932 return fcport->nwwn;
3934 return fcport->pwwn;
3940 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3944 attr->nwwn = fcport->nwwn;
3945 attr->pwwn = fcport->pwwn;
3950 memcpy(&attr->pport_cfg, &fcport->cfg,
3953 attr->pport_cfg.speed = fcport->cfg.speed;
3954 attr->speed_supported = fcport->speed_sup;
3955 attr->speed = fcport->speed;
3959 attr->pport_cfg.topology = fcport->cfg.topology;
3960 attr->topology = fcport->topology;
3961 attr->pport_cfg.trunked = fcport->cfg.trunked;
3964 attr->beacon = fcport->beacon;
3965 attr->link_e2e_beacon = fcport->link_e2e_beacon;
3969 attr->port_state = bfa_fcport_sm_to_state(hal_port_sm_table, fcport->sm);
3971 attr->fec_state = fcport->fec_state;
3977 if (bfa_ioc_is_disabled(&fcport->bfa->ioc))
3979 else if (bfa_ioc_fw_mismatch(&fcport->bfa->ioc))
3984 attr->fcoe_vlan = fcport->fcoe_vlan;
3995 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3998 !fcport->stats_dma_ready)
4001 if (!list_empty(&fcport->statsclr_pending_q))
4004 if (list_empty(&fcport->stats_pending_q)) {
4005 list_add_tail(&cb->hcb_qe.qe, &fcport->stats_pending_q);
4006 bfa_fcport_send_stats_get(fcport);
4007 bfa_timer_start(bfa, &fcport->timer,
4009 fcport, BFA_FCPORT_STATS_TOV);
4011 list_add_tail(&cb->hcb_qe.qe, &fcport->stats_pending_q);
4022 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
4025 !fcport->stats_dma_ready)
4028 if (!list_empty(&fcport->stats_pending_q))
4031 if (list_empty(&fcport->statsclr_pending_q)) {
4032 list_add_tail(&cb->hcb_qe.qe, &fcport->statsclr_pending_q);
4033 bfa_fcport_send_stats_clear(fcport);
4034 bfa_timer_start(bfa, &fcport->timer,
4036 fcport, BFA_FCPORT_STATS_TOV);
4038 list_add_tail(&cb->hcb_qe.qe, &fcport->statsclr_pending_q);
4049 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
4051 return bfa_fcport_sm_to_state(hal_port_sm_table, fcport->sm) ==
4059 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
4061 return (bfa_fcport_sm_to_state(hal_port_sm_table, fcport->sm) ==
4068 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
4070 return (bfa_fcport_sm_to_state(hal_port_sm_table, fcport->sm) ==
4077 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
4093 (fcport->cfg.topology != BFA_PORT_TOPOLOGY_LOOP))
4094 fcport->cfg.qos_bw = *qos_bw;
4102 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
4104 return fcport->cfg.ratelimit ? BFA_TRUE : BFA_FALSE;
4114 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
4117 fcport->cfg.faa_state = state;
4126 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
4128 bfa_trc(bfa, fcport->cfg.trl_def_speed);
4129 return fcport->cfg.trl_def_speed;
4138 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
4142 bfa_trc(bfa, fcport->beacon);
4143 bfa_trc(bfa, fcport->link_e2e_beacon);
4145 fcport->beacon = beacon;
4146 fcport->link_e2e_beacon = link_e2e_beacon;
4152 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
4154 return (!fcport->cfg.trunked &&
4155 bfa_sm_cmp_state(fcport, bfa_fcport_sm_linkup)) ||
4156 (fcport->cfg.trunked &&
4157 fcport->trunk.attr.state == BFA_TRUNK_ONLINE);
4163 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
4165 return fcport->cfg.qos_enabled;
4171 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
4173 return fcport->cfg.trunked;
4179 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
4183 if (bfa_ioc_get_type(&fcport->bfa->ioc) != BFA_IOC_TYPE_FC)
4191 if (fcport->cfg.topology == BFA_PORT_TOPOLOGY_LOOP)
4194 if (fcport->cfg.qos_enabled)
4197 if (fcport->cfg.trunked)
4200 if ((fcport->cfg.speed != BFA_PORT_SPEED_AUTO) &&
4201 (fcport->cfg.speed < bfa_ioc_speed_sup(&bfa->ioc)))
4207 if (fcport->cfg.bb_cr_enabled) {
4208 if (bb_scn != fcport->cfg.bb_scn)
4217 fcport->cfg.bb_cr_enabled = on_off;
4218 fcport->cfg.bb_scn = bb_scn;
4220 if (!fcport->cfg.bb_cr_enabled)
4223 fcport->cfg.bb_cr_enabled = on_off;
4224 fcport->cfg.bb_scn = 0;
4234 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
4236 if (bfa_ioc_get_type(&fcport->bfa->ioc) != BFA_IOC_TYPE_FC)
4239 if (fcport->cfg.topology == BFA_PORT_TOPOLOGY_LOOP)
4242 *bbcr_attr = fcport->bbcr_attr;
5667 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(fcdiag->bfa);
5670 fcport->diag_busy = BFA_TRUE;
5672 fcport->diag_busy = BFA_FALSE;
5979 /* check to see if fcport is dport */