Lines Matching refs:fcport

140 static bfa_boolean_t bfa_fcport_send_enable(struct bfa_fcport_s *fcport);
141 static bfa_boolean_t bfa_fcport_send_disable(struct bfa_fcport_s *fcport);
142 static void bfa_fcport_update_linkinfo(struct bfa_fcport_s *fcport);
143 static void bfa_fcport_reset_linkinfo(struct bfa_fcport_s *fcport);
144 static void bfa_fcport_set_wwns(struct bfa_fcport_s *fcport);
146 static void bfa_fcport_scn(struct bfa_fcport_s *fcport,
158 static void bfa_fcport_sm_uninit(struct bfa_fcport_s *fcport,
160 static void bfa_fcport_sm_enabling_qwait(struct bfa_fcport_s *fcport,
162 static void bfa_fcport_sm_enabling(struct bfa_fcport_s *fcport,
164 static void bfa_fcport_sm_linkdown(struct bfa_fcport_s *fcport,
166 static void bfa_fcport_sm_linkup(struct bfa_fcport_s *fcport,
168 static void bfa_fcport_sm_disabling(struct bfa_fcport_s *fcport,
170 static void bfa_fcport_sm_disabling_qwait(struct bfa_fcport_s *fcport,
172 static void bfa_fcport_sm_toggling_qwait(struct bfa_fcport_s *fcport,
174 static void bfa_fcport_sm_disabled(struct bfa_fcport_s *fcport,
176 static void bfa_fcport_sm_stopped(struct bfa_fcport_s *fcport,
178 static void bfa_fcport_sm_iocdown(struct bfa_fcport_s *fcport,
180 static void bfa_fcport_sm_iocfail(struct bfa_fcport_s *fcport,
182 static void bfa_fcport_sm_dport(struct bfa_fcport_s *fcport,
184 static void bfa_fcport_sm_ddport(struct bfa_fcport_s *fcport,
186 static void bfa_fcport_sm_faa_misconfig(struct bfa_fcport_s *fcport,
2003 bfa_fcport_aen_post(struct bfa_fcport_s *fcport, enum bfa_port_aen_event event)
2005 struct bfad_s *bfad = (struct bfad_s *)fcport->bfa->bfad;
2012 aen_entry->aen_data.port.ioc_type = bfa_get_type(fcport->bfa);
2013 aen_entry->aen_data.port.pwwn = fcport->pwwn;
2016 bfad_im_post_vendor_event(aen_entry, bfad, ++fcport->bfa->bfa_aen_seq,
2024 bfa_fcport_sm_uninit(struct bfa_fcport_s *fcport,
2027 bfa_trc(fcport->bfa, event);
2034 fcport->use_flash_cfg = BFA_TRUE;
2036 if (bfa_fcport_send_enable(fcport)) {
2037 bfa_trc(fcport->bfa, BFA_TRUE);
2038 bfa_sm_set_state(fcport, bfa_fcport_sm_enabling);
2040 bfa_trc(fcport->bfa, BFA_FALSE);
2041 bfa_sm_set_state(fcport,
2059 bfa_sm_set_state(fcport, bfa_fcport_sm_disabled);
2063 bfa_sm_set_state(fcport, bfa_fcport_sm_iocdown);
2067 bfa_sm_fault(fcport->bfa, event);
2072 bfa_fcport_sm_enabling_qwait(struct bfa_fcport_s *fcport,
2076 struct bfad_s *bfad = (struct bfad_s *)fcport->bfa->bfad;
2077 bfa_trc(fcport->bfa, event);
2081 bfa_sm_set_state(fcport, bfa_fcport_sm_enabling);
2082 bfa_fcport_send_enable(fcport);
2086 bfa_reqq_wcancel(&fcport->reqq_wait);
2087 bfa_sm_set_state(fcport, bfa_fcport_sm_stopped);
2101 bfa_sm_set_state(fcport, bfa_fcport_sm_disabled);
2102 bfa_reqq_wcancel(&fcport->reqq_wait);
2103 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL,
2105 wwn2str(pwwn_buf, fcport->pwwn);
2108 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISABLE);
2120 bfa_reqq_wcancel(&fcport->reqq_wait);
2121 bfa_sm_set_state(fcport, bfa_fcport_sm_iocdown);
2125 bfa_fcport_reset_linkinfo(fcport);
2126 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISCONNECT);
2127 bfa_sm_set_state(fcport, bfa_fcport_sm_faa_misconfig);
2131 bfa_sm_fault(fcport->bfa, event);
2136 bfa_fcport_sm_enabling(struct bfa_fcport_s *fcport,
2140 struct bfad_s *bfad = (struct bfad_s *)fcport->bfa->bfad;
2141 bfa_trc(fcport->bfa, event);
2146 bfa_sm_set_state(fcport, bfa_fcport_sm_linkdown);
2150 bfa_fcport_update_linkinfo(fcport);
2151 bfa_sm_set_state(fcport, bfa_fcport_sm_linkup);
2153 WARN_ON(!fcport->event_cbfn);
2154 bfa_fcport_scn(fcport, BFA_PORT_LINKUP, BFA_FALSE);
2164 if (bfa_fcport_send_disable(fcport))
2165 bfa_sm_set_state(fcport, bfa_fcport_sm_disabling);
2167 bfa_sm_set_state(fcport,
2170 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL,
2172 wwn2str(pwwn_buf, fcport->pwwn);
2175 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISABLE);
2179 bfa_sm_set_state(fcport, bfa_fcport_sm_stopped);
2183 bfa_sm_set_state(fcport, bfa_fcport_sm_iocdown);
2187 bfa_fcport_reset_linkinfo(fcport);
2188 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISCONNECT);
2189 bfa_sm_set_state(fcport, bfa_fcport_sm_faa_misconfig);
2193 bfa_sm_fault(fcport->bfa, event);
2198 bfa_fcport_sm_linkdown(struct bfa_fcport_s *fcport,
2201 struct bfi_fcport_event_s *pevent = fcport->event_arg.i2hmsg.event;
2203 struct bfad_s *bfad = (struct bfad_s *)fcport->bfa->bfad;
2205 bfa_trc(fcport->bfa, event);
2209 bfa_fcport_update_linkinfo(fcport);
2210 bfa_sm_set_state(fcport, bfa_fcport_sm_linkup);
2211 WARN_ON(!fcport->event_cbfn);
2212 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL,
2214 if (!bfa_ioc_get_fcmode(&fcport->bfa->ioc)) {
2216 bfa_trc(fcport->bfa,
2218 bfa_trc(fcport->bfa,
2222 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL,
2226 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL,
2231 bfa_fcport_scn(fcport, BFA_PORT_LINKUP, BFA_FALSE);
2232 wwn2str(pwwn_buf, fcport->pwwn);
2235 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_ONLINE);
2238 if (fcport->cfg.qos_enabled &&
2239 fcport->qos_attr.state != BFA_QOS_ONLINE)
2240 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_QOS_NEG);
2256 if (bfa_fcport_send_disable(fcport))
2257 bfa_sm_set_state(fcport, bfa_fcport_sm_disabling);
2259 bfa_sm_set_state(fcport,
2262 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL,
2264 wwn2str(pwwn_buf, fcport->pwwn);
2267 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISABLE);
2271 bfa_sm_set_state(fcport, bfa_fcport_sm_stopped);
2275 bfa_sm_set_state(fcport, bfa_fcport_sm_iocdown);
2279 bfa_fcport_reset_linkinfo(fcport);
2280 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISCONNECT);
2281 bfa_sm_set_state(fcport, bfa_fcport_sm_faa_misconfig);
2285 bfa_sm_fault(fcport->bfa, event);
2290 bfa_fcport_sm_linkup(struct bfa_fcport_s *fcport,
2294 struct bfad_s *bfad = (struct bfad_s *)fcport->bfa->bfad;
2296 bfa_trc(fcport->bfa, event);
2306 if (bfa_fcport_send_disable(fcport))
2307 bfa_sm_set_state(fcport, bfa_fcport_sm_disabling);
2309 bfa_sm_set_state(fcport,
2312 bfa_fcport_reset_linkinfo(fcport);
2313 bfa_fcport_scn(fcport, BFA_PORT_LINKDOWN, BFA_FALSE);
2314 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL,
2316 wwn2str(pwwn_buf, fcport->pwwn);
2319 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_OFFLINE);
2322 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISABLE);
2326 bfa_sm_set_state(fcport, bfa_fcport_sm_linkdown);
2327 bfa_fcport_reset_linkinfo(fcport);
2328 bfa_fcport_scn(fcport, BFA_PORT_LINKDOWN, BFA_FALSE);
2329 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL,
2331 wwn2str(pwwn_buf, fcport->pwwn);
2332 if (BFA_PORT_IS_DISABLED(fcport->bfa)) {
2335 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_OFFLINE);
2340 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISCONNECT);
2345 bfa_sm_set_state(fcport, bfa_fcport_sm_stopped);
2346 bfa_fcport_reset_linkinfo(fcport);
2347 wwn2str(pwwn_buf, fcport->pwwn);
2348 if (BFA_PORT_IS_DISABLED(fcport->bfa)) {
2351 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_OFFLINE);
2356 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISCONNECT);
2361 bfa_sm_set_state(fcport, bfa_fcport_sm_iocdown);
2362 bfa_fcport_reset_linkinfo(fcport);
2363 bfa_fcport_scn(fcport, BFA_PORT_LINKDOWN, BFA_FALSE);
2364 wwn2str(pwwn_buf, fcport->pwwn);
2365 if (BFA_PORT_IS_DISABLED(fcport->bfa)) {
2368 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_OFFLINE);
2373 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISCONNECT);
2378 bfa_fcport_reset_linkinfo(fcport);
2379 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISCONNECT);
2380 bfa_sm_set_state(fcport, bfa_fcport_sm_faa_misconfig);
2384 bfa_sm_fault(fcport->bfa, event);
2389 bfa_fcport_sm_disabling_qwait(struct bfa_fcport_s *fcport,
2392 bfa_trc(fcport->bfa, event);
2396 bfa_sm_set_state(fcport, bfa_fcport_sm_disabling);
2397 bfa_fcport_send_disable(fcport);
2401 bfa_sm_set_state(fcport, bfa_fcport_sm_stopped);
2402 bfa_reqq_wcancel(&fcport->reqq_wait);
2406 bfa_sm_set_state(fcport, bfa_fcport_sm_toggling_qwait);
2424 bfa_sm_set_state(fcport, bfa_fcport_sm_iocfail);
2425 bfa_reqq_wcancel(&fcport->reqq_wait);
2429 bfa_fcport_reset_linkinfo(fcport);
2430 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISCONNECT);
2431 bfa_sm_set_state(fcport, bfa_fcport_sm_faa_misconfig);
2435 bfa_sm_fault(fcport->bfa, event);
2440 bfa_fcport_sm_toggling_qwait(struct bfa_fcport_s *fcport,
2443 bfa_trc(fcport->bfa, event);
2447 bfa_sm_set_state(fcport, bfa_fcport_sm_disabling);
2448 bfa_fcport_send_disable(fcport);
2449 if (bfa_fcport_send_enable(fcport))
2450 bfa_sm_set_state(fcport, bfa_fcport_sm_enabling);
2452 bfa_sm_set_state(fcport,
2457 bfa_sm_set_state(fcport, bfa_fcport_sm_stopped);
2458 bfa_reqq_wcancel(&fcport->reqq_wait);
2465 bfa_sm_set_state(fcport, bfa_fcport_sm_disabling_qwait);
2477 bfa_sm_set_state(fcport, bfa_fcport_sm_iocfail);
2478 bfa_reqq_wcancel(&fcport->reqq_wait);
2482 bfa_sm_fault(fcport->bfa, event);
2487 bfa_fcport_sm_disabling(struct bfa_fcport_s *fcport,
2491 struct bfad_s *bfad = (struct bfad_s *)fcport->bfa->bfad;
2492 bfa_trc(fcport->bfa, event);
2496 bfa_sm_set_state(fcport, bfa_fcport_sm_disabled);
2506 if (bfa_fcport_send_enable(fcport))
2507 bfa_sm_set_state(fcport, bfa_fcport_sm_enabling);
2509 bfa_sm_set_state(fcport,
2512 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL,
2514 wwn2str(pwwn_buf, fcport->pwwn);
2517 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_ENABLE);
2521 bfa_sm_set_state(fcport, bfa_fcport_sm_stopped);
2533 bfa_sm_set_state(fcport, bfa_fcport_sm_iocfail);
2537 bfa_sm_fault(fcport->bfa, event);
2542 bfa_fcport_sm_disabled(struct bfa_fcport_s *fcport,
2546 struct bfad_s *bfad = (struct bfad_s *)fcport->bfa->bfad;
2547 bfa_trc(fcport->bfa, event);
2557 bfa_sm_set_state(fcport, bfa_fcport_sm_stopped);
2561 if (bfa_fcport_send_enable(fcport))
2562 bfa_sm_set_state(fcport, bfa_fcport_sm_enabling);
2564 bfa_sm_set_state(fcport,
2567 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL,
2569 wwn2str(pwwn_buf, fcport->pwwn);
2572 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_ENABLE);
2582 bfa_sm_set_state(fcport, bfa_fcport_sm_iocfail);
2586 bfa_sm_set_state(fcport, bfa_fcport_sm_dport);
2590 bfa_sm_set_state(fcport, bfa_fcport_sm_ddport);
2594 bfa_sm_fault(fcport->bfa, event);
2599 bfa_fcport_sm_stopped(struct bfa_fcport_s *fcport,
2602 bfa_trc(fcport->bfa, event);
2606 if (bfa_fcport_send_enable(fcport))
2607 bfa_sm_set_state(fcport, bfa_fcport_sm_enabling);
2609 bfa_sm_set_state(fcport,
2625 bfa_fcport_sm_iocdown(struct bfa_fcport_s *fcport,
2628 bfa_trc(fcport->bfa, event);
2632 if (bfa_fcport_send_enable(fcport))
2633 bfa_sm_set_state(fcport, bfa_fcport_sm_enabling);
2635 bfa_sm_set_state(fcport,
2651 bfa_fcport_sm_iocfail(struct bfa_fcport_s *fcport,
2654 bfa_trc(fcport->bfa, event);
2658 bfa_sm_set_state(fcport, bfa_fcport_sm_disabled);
2662 bfa_sm_set_state(fcport, bfa_fcport_sm_iocdown);
2674 bfa_fcport_sm_dport(struct bfa_fcport_s *fcport, enum bfa_fcport_sm_event event)
2676 bfa_trc(fcport->bfa, event);
2689 bfa_sm_set_state(fcport, bfa_fcport_sm_stopped);
2693 bfa_sm_set_state(fcport, bfa_fcport_sm_iocfail);
2697 bfa_sm_set_state(fcport, bfa_fcport_sm_disabled);
2701 bfa_sm_fault(fcport->bfa, event);
2706 bfa_fcport_sm_ddport(struct bfa_fcport_s *fcport,
2709 bfa_trc(fcport->bfa, event);
2714 bfa_sm_set_state(fcport, bfa_fcport_sm_disabled);
2727 bfa_sm_set_state(fcport, bfa_fcport_sm_stopped);
2731 bfa_sm_set_state(fcport, bfa_fcport_sm_iocfail);
2735 bfa_sm_fault(fcport->bfa, event);
2740 bfa_fcport_sm_faa_misconfig(struct bfa_fcport_s *fcport,
2743 bfa_trc(fcport->bfa, event);
2755 if (bfa_fcport_send_disable(fcport))
2756 bfa_sm_set_state(fcport, bfa_fcport_sm_disabling);
2758 bfa_sm_set_state(fcport, bfa_fcport_sm_disabling_qwait);
2760 bfa_fcport_reset_linkinfo(fcport);
2761 bfa_fcport_scn(fcport, BFA_PORT_LINKDOWN, BFA_FALSE);
2762 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL,
2764 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISABLE);
2768 bfa_sm_set_state(fcport, bfa_fcport_sm_stopped);
2772 bfa_fcport_reset_linkinfo(fcport);
2773 bfa_fcport_scn(fcport, BFA_PORT_LINKDOWN, BFA_FALSE);
2774 bfa_sm_set_state(fcport, bfa_fcport_sm_iocdown);
2778 bfa_sm_fault(fcport->bfa, event);
2789 bfa_trc(ln->fcport->bfa, event);
2798 bfa_sm_fault(ln->fcport->bfa, event);
2809 bfa_trc(ln->fcport->bfa, event);
2821 bfa_sm_fault(ln->fcport->bfa, event);
2832 bfa_trc(ln->fcport->bfa, event);
2845 bfa_sm_fault(ln->fcport->bfa, event);
2856 bfa_trc(ln->fcport->bfa, event);
2865 bfa_sm_fault(ln->fcport->bfa, event);
2876 bfa_trc(ln->fcport->bfa, event);
2888 bfa_sm_fault(ln->fcport->bfa, event);
2899 bfa_trc(ln->fcport->bfa, event);
2912 bfa_sm_fault(ln->fcport->bfa, event);
2923 bfa_trc(ln->fcport->bfa, event);
2936 bfa_sm_fault(ln->fcport->bfa, event);
2946 ln->fcport->event_cbfn(ln->fcport->event_cbarg, ln->ln_event);
2953 * trunk - false if caller is fcport to ignore fcport event in trunked mode
2956 bfa_fcport_scn(struct bfa_fcport_s *fcport, enum bfa_port_linkstate event,
2959 if (fcport->cfg.trunked && !trunk)
2964 bfa_sm_send_event(&fcport->ln, BFA_FCPORT_LN_SM_LINKUP);
2967 bfa_sm_send_event(&fcport->ln, BFA_FCPORT_LN_SM_LINKDOWN);
2977 struct bfa_fcport_s *fcport = ln->fcport;
2979 if (fcport->bfa->fcs) {
2980 fcport->event_cbfn(fcport->event_cbarg, event);
2984 bfa_cb_queue(fcport->bfa, &ln->ln_qe,
3004 struct bfa_fcport_s *fcport = cbarg;
3006 bfa_sm_send_event(fcport, BFA_FCPORT_SM_QRESUME);
3010 bfa_fcport_mem_claim(struct bfa_fcport_s *fcport)
3012 struct bfa_mem_dma_s *fcport_dma = &fcport->fcport_dma;
3014 fcport->stats_kva = bfa_mem_dma_virt(fcport_dma);
3015 fcport->stats_pa = bfa_mem_dma_phys(fcport_dma);
3016 fcport->stats = (union bfa_fcport_stats_u *)
3027 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3028 struct bfa_port_cfg_s *port_cfg = &fcport->cfg;
3029 struct bfa_fcport_ln_s *ln = &fcport->ln;
3031 fcport->bfa = bfa;
3032 ln->fcport = fcport;
3034 bfa_fcport_mem_claim(fcport);
3036 bfa_sm_set_state(fcport, bfa_fcport_sm_uninit);
3042 fcport->stats_reset_time = ktime_get_seconds();
3043 fcport->stats_dma_ready = BFA_FALSE;
3058 fcport->fec_state = BFA_FEC_OFFLINE;
3060 INIT_LIST_HEAD(&fcport->stats_pending_q);
3061 INIT_LIST_HEAD(&fcport->statsclr_pending_q);
3063 bfa_reqq_winit(&fcport->reqq_wait, bfa_fcport_qresume, fcport);
3078 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3080 bfa_sm_send_event(fcport, BFA_FCPORT_SM_HWFAIL);
3085 * Update loop info in fcport for SCN online
3088 bfa_fcport_update_loop_info(struct bfa_fcport_s *fcport,
3091 fcport->myalpa = loop_info->myalpa;
3092 fcport->alpabm_valid =
3094 memcpy(fcport->alpabm.alpa_bm,
3100 bfa_fcport_update_linkinfo(struct bfa_fcport_s *fcport)
3102 struct bfi_fcport_event_s *pevent = fcport->event_arg.i2hmsg.event;
3103 struct bfa_fcport_trunk_s *trunk = &fcport->trunk;
3105 fcport->speed = pevent->link_state.speed;
3106 fcport->topology = pevent->link_state.topology;
3108 if (fcport->topology == BFA_PORT_TOPOLOGY_LOOP) {
3109 bfa_fcport_update_loop_info(fcport,
3115 fcport->qos_attr = pevent->link_state.qos_attr;
3116 fcport->qos_vc_attr = pevent->link_state.attr.vc_fcf.qos_vc_attr;
3118 if (fcport->cfg.bb_cr_enabled)
3119 fcport->bbcr_attr = pevent->link_state.attr.bbcr_attr;
3121 fcport->fec_state = pevent->link_state.fec_state;
3126 if (!fcport->cfg.trunked)
3130 fcport->fcoe_vlan =
3133 bfa_trc(fcport->bfa, fcport->speed);
3134 bfa_trc(fcport->bfa, fcport->topology);
3138 bfa_fcport_reset_linkinfo(struct bfa_fcport_s *fcport)
3140 fcport->speed = BFA_PORT_SPEED_UNKNOWN;
3141 fcport->topology = BFA_PORT_TOPOLOGY_NONE;
3142 fcport->fec_state = BFA_FEC_OFFLINE;
3149 bfa_fcport_send_enable(struct bfa_fcport_s *fcport)
3157 fcport->msgtag++;
3162 m = bfa_reqq_next(fcport->bfa, BFA_REQQ_PORT);
3164 bfa_reqq_wait(fcport->bfa, BFA_REQQ_PORT,
3165 &fcport->reqq_wait);
3170 bfa_fn_lpu(fcport->bfa));
3171 m->nwwn = fcport->nwwn;
3172 m->pwwn = fcport->pwwn;
3173 m->port_cfg = fcport->cfg;
3174 m->msgtag = fcport->msgtag;
3175 m->port_cfg.maxfrsize = cpu_to_be16(fcport->cfg.maxfrsize);
3176 m->use_flash_cfg = fcport->use_flash_cfg;
3177 bfa_dma_be_addr_set(m->stats_dma_addr, fcport->stats_pa);
3178 bfa_trc(fcport->bfa, m->stats_dma_addr.a32.addr_lo);
3179 bfa_trc(fcport->bfa, m->stats_dma_addr.a32.addr_hi);
3184 bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT, m->mh);
3192 bfa_fcport_send_disable(struct bfa_fcport_s *fcport)
3200 fcport->msgtag++;
3205 m = bfa_reqq_next(fcport->bfa, BFA_REQQ_PORT);
3207 bfa_reqq_wait(fcport->bfa, BFA_REQQ_PORT,
3208 &fcport->reqq_wait);
3213 bfa_fn_lpu(fcport->bfa));
3214 m->msgtag = fcport->msgtag;
3219 bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT, m->mh);
3225 bfa_fcport_set_wwns(struct bfa_fcport_s *fcport)
3227 fcport->pwwn = fcport->bfa->ioc.attr->pwwn;
3228 fcport->nwwn = fcport->bfa->ioc.attr->nwwn;
3230 bfa_trc(fcport->bfa, fcport->pwwn);
3231 bfa_trc(fcport->bfa, fcport->nwwn);
3270 struct bfa_fcport_s *fcport = (struct bfa_fcport_s *)cbarg;
3278 list_for_each_safe(qe, qen, &fcport->stats_pending_q) {
3279 bfa_q_deq(&fcport->stats_pending_q, &qe);
3281 if (fcport->stats_status == BFA_STATUS_OK) {
3284 if (bfa_ioc_get_fcmode(&fcport->bfa->ioc))
3286 &fcport->stats->fcqos);
3289 &fcport->stats->fcoe);
3291 time - fcport->stats_reset_time;
3294 bfa_cb_queue_status(fcport->bfa, &cb->hcb_qe,
3295 fcport->stats_status);
3297 fcport->stats_status = BFA_STATUS_OK;
3299 INIT_LIST_HEAD(&fcport->stats_pending_q);
3300 fcport->stats_status = BFA_STATUS_OK;
3307 struct bfa_fcport_s *fcport = (struct bfa_fcport_s *) cbarg;
3309 bfa_trc(fcport->bfa, fcport->stats_qfull);
3311 if (fcport->stats_qfull) {
3312 bfa_reqq_wcancel(&fcport->stats_reqq_wait);
3313 fcport->stats_qfull = BFA_FALSE;
3316 fcport->stats_status = BFA_STATUS_ETIMER;
3317 __bfa_cb_fcport_stats_get(fcport, BFA_TRUE);
3323 struct bfa_fcport_s *fcport = (struct bfa_fcport_s *) cbarg;
3326 msg = bfa_reqq_next(fcport->bfa, BFA_REQQ_PORT);
3329 fcport->stats_qfull = BFA_TRUE;
3330 bfa_reqq_winit(&fcport->stats_reqq_wait,
3331 bfa_fcport_send_stats_get, fcport);
3332 bfa_reqq_wait(fcport->bfa, BFA_REQQ_PORT,
3333 &fcport->stats_reqq_wait);
3336 fcport->stats_qfull = BFA_FALSE;
3340 bfa_fn_lpu(fcport->bfa));
3341 bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT, msg->mh);
3347 struct bfa_fcport_s *fcport = (struct bfa_fcport_s *) cbarg;
3355 fcport->stats_reset_time = ktime_get_seconds();
3356 list_for_each_safe(qe, qen, &fcport->statsclr_pending_q) {
3357 bfa_q_deq(&fcport->statsclr_pending_q, &qe);
3359 bfa_cb_queue_status(fcport->bfa, &cb->hcb_qe,
3360 fcport->stats_status);
3362 fcport->stats_status = BFA_STATUS_OK;
3364 INIT_LIST_HEAD(&fcport->statsclr_pending_q);
3365 fcport->stats_status = BFA_STATUS_OK;
3372 struct bfa_fcport_s *fcport = (struct bfa_fcport_s *) cbarg;
3374 bfa_trc(fcport->bfa, fcport->stats_qfull);
3376 if (fcport->stats_qfull) {
3377 bfa_reqq_wcancel(&fcport->stats_reqq_wait);
3378 fcport->stats_qfull = BFA_FALSE;
3381 fcport->stats_status = BFA_STATUS_ETIMER;
3382 __bfa_cb_fcport_stats_clr(fcport, BFA_TRUE);
3388 struct bfa_fcport_s *fcport = (struct bfa_fcport_s *) cbarg;
3391 msg = bfa_reqq_next(fcport->bfa, BFA_REQQ_PORT);
3394 fcport->stats_qfull = BFA_TRUE;
3395 bfa_reqq_winit(&fcport->stats_reqq_wait,
3396 bfa_fcport_send_stats_clear, fcport);
3397 bfa_reqq_wait(fcport->bfa, BFA_REQQ_PORT,
3398 &fcport->stats_reqq_wait);
3401 fcport->stats_qfull = BFA_FALSE;
3405 bfa_fn_lpu(fcport->bfa));
3406 bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT, msg->mh);
3413 bfa_trunk_scn(struct bfa_fcport_s *fcport, struct bfi_fcport_trunk_scn_s *scn)
3415 struct bfa_fcport_trunk_s *trunk = &fcport->trunk;
3422 bfa_trc(fcport->bfa, fcport->cfg.trunked);
3426 bfa_trc(fcport->bfa, trunk->attr.state);
3427 bfa_trc(fcport->bfa, scn->trunk_state);
3428 bfa_trc(fcport->bfa, scn->trunk_speed);
3434 if (fcport->cfg.trunked && (trunk->attr.state != BFA_TRUNK_DISABLED))
3448 fcport->speed = tlink->speed;
3449 fcport->topology = BFA_PORT_TOPOLOGY_P2P;
3453 bfa_trc(fcport->bfa, lattr->link_state);
3454 bfa_trc(fcport->bfa, lattr->trunk_wwn);
3455 bfa_trc(fcport->bfa, lattr->fctl);
3456 bfa_trc(fcport->bfa, lattr->speed);
3457 bfa_trc(fcport->bfa, lattr->deskew);
3462 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL,
3466 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL,
3470 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL,
3474 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL,
3483 bfa_fcport_scn(fcport, (scn->trunk_state == BFA_TRUNK_ONLINE) ?
3491 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3497 if (fcport->cfg.trunked) {
3498 if (fcport->trunk.attr.state == BFA_TRUNK_ONLINE)
3499 bfa_fcport_scn(fcport, BFA_PORT_LINKDOWN, BFA_TRUE);
3501 fcport->trunk.attr.state = BFA_TRUNK_OFFLINE;
3502 fcport->trunk.attr.speed = BFA_PORT_SPEED_UNKNOWN;
3504 fcport->trunk.attr.link_attr[i].trunk_wwn = 0;
3505 fcport->trunk.attr.link_attr[i].fctl =
3507 fcport->trunk.attr.link_attr[i].link_state =
3509 fcport->trunk.attr.link_attr[i].speed =
3511 fcport->trunk.attr.link_attr[i].deskew = 0;
3522 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3527 bfa_fcport_set_wwns(fcport);
3528 if (fcport->cfg.maxfrsize == 0)
3529 fcport->cfg.maxfrsize = bfa_ioc_maxfrsize(&bfa->ioc);
3530 fcport->cfg.rx_bbcredit = bfa_ioc_rx_bbcredit(&bfa->ioc);
3531 fcport->speed_sup = bfa_ioc_speed_sup(&bfa->ioc);
3536 WARN_ON(!fcport->cfg.maxfrsize);
3537 WARN_ON(!fcport->cfg.rx_bbcredit);
3538 WARN_ON(!fcport->speed_sup);
3547 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3551 fcport->event_arg.i2hmsg = i2hmsg;
3554 bfa_trc(bfa, bfa_sm_to_state(hal_port_sm_table, fcport->sm));
3558 if (fcport->msgtag == i2hmsg.penable_rsp->msgtag) {
3560 fcport->stats_dma_ready = BFA_TRUE;
3561 if (fcport->use_flash_cfg) {
3562 fcport->cfg = i2hmsg.penable_rsp->port_cfg;
3563 fcport->cfg.maxfrsize =
3564 cpu_to_be16(fcport->cfg.maxfrsize);
3565 fcport->cfg.path_tov =
3566 cpu_to_be16(fcport->cfg.path_tov);
3567 fcport->cfg.q_depth =
3568 cpu_to_be16(fcport->cfg.q_depth);
3570 if (fcport->cfg.trunked)
3571 fcport->trunk.attr.state =
3574 fcport->trunk.attr.state =
3576 fcport->qos_attr.qos_bw =
3578 fcport->use_flash_cfg = BFA_FALSE;
3581 if (fcport->cfg.qos_enabled)
3582 fcport->qos_attr.state = BFA_QOS_OFFLINE;
3584 fcport->qos_attr.state = BFA_QOS_DISABLED;
3586 fcport->qos_attr.qos_bw_op =
3589 if (fcport->cfg.bb_cr_enabled)
3590 fcport->bbcr_attr.state = BFA_BBCR_OFFLINE;
3592 fcport->bbcr_attr.state = BFA_BBCR_DISABLED;
3594 bfa_sm_send_event(fcport, BFA_FCPORT_SM_FWRSP);
3599 if (fcport->msgtag == i2hmsg.penable_rsp->msgtag)
3600 bfa_sm_send_event(fcport, BFA_FCPORT_SM_FWRSP);
3604 if (fcport->cfg.bb_cr_enabled)
3605 fcport->bbcr_attr.state = BFA_BBCR_OFFLINE;
3607 fcport->bbcr_attr.state = BFA_BBCR_DISABLED;
3610 bfa_sm_send_event(fcport, BFA_FCPORT_SM_LINKUP);
3614 bfa_sm_send_event(fcport,
3617 bfa_sm_send_event(fcport,
3620 fcport->qos_attr.qos_bw_op =
3625 bfa_trunk_scn(fcport, i2hmsg.trunk_scn);
3632 if (list_empty(&fcport->stats_pending_q) ||
3633 (fcport->stats_status == BFA_STATUS_ETIMER))
3636 bfa_timer_stop(&fcport->timer);
3637 fcport->stats_status = i2hmsg.pstatsget_rsp->status;
3638 __bfa_cb_fcport_stats_get(fcport, BFA_TRUE);
3645 if (list_empty(&fcport->statsclr_pending_q) ||
3646 (fcport->stats_status == BFA_STATUS_ETIMER))
3649 bfa_timer_stop(&fcport->timer);
3650 fcport->stats_status = BFA_STATUS_OK;
3651 __bfa_cb_fcport_stats_clr(fcport, BFA_TRUE);
3655 bfa_sm_send_event(fcport, BFA_FCPORT_SM_ENABLE);
3659 bfa_sm_send_event(fcport, BFA_FCPORT_SM_DISABLE);
3677 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3679 fcport->event_cbfn = cbfn;
3680 fcport->event_cbarg = cbarg;
3686 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3694 if (fcport->diag_busy)
3718 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3723 bfa_trc(bfa, fcport->pwwn);
3735 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3739 if (fcport->cfg.trunked == BFA_TRUE)
3741 if ((fcport->cfg.topology == BFA_PORT_TOPOLOGY_LOOP) &&
3744 if ((speed != BFA_PORT_SPEED_AUTO) && (speed > fcport->speed_sup)) {
3745 bfa_trc(bfa, fcport->speed_sup);
3750 if (bfa_ioc_get_type(&fcport->bfa->ioc) == BFA_IOC_TYPE_FC) {
3769 fcport->cfg.speed = speed;
3780 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3782 return fcport->speed;
3791 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3794 bfa_trc(bfa, fcport->cfg.topology);
3802 (fcport->qos_attr.state != BFA_QOS_DISABLED))
3804 if (fcport->cfg.ratelimit != BFA_FALSE)
3807 (fcport->trunk.attr.state != BFA_TRUNK_DISABLED))
3810 (fcport->cfg.speed == BFA_PORT_SPEED_16GBPS))
3827 fcport->cfg.topology = topology;
3837 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3839 return fcport->topology;
3848 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3850 return fcport->cfg.topology;
3856 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3859 bfa_trc(bfa, fcport->cfg.cfg_hardalpa);
3860 bfa_trc(bfa, fcport->cfg.hardalpa);
3862 fcport->cfg.cfg_hardalpa = BFA_TRUE;
3863 fcport->cfg.hardalpa = alpa;
3871 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3873 bfa_trc(bfa, fcport->cfg.cfg_hardalpa);
3874 bfa_trc(bfa, fcport->cfg.hardalpa);
3876 fcport->cfg.cfg_hardalpa = BFA_FALSE;
3883 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3885 *alpa = fcport->cfg.hardalpa;
3886 return fcport->cfg.cfg_hardalpa;
3892 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3894 return fcport->myalpa;
3900 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3903 bfa_trc(bfa, fcport->cfg.maxfrsize);
3913 fcport->cfg.maxfrsize = maxfrsize;
3920 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3922 return fcport->cfg.maxfrsize;
3938 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3940 fcport->cfg.tx_bbcredit = (u8)tx_bbcredit;
3950 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3952 return fcport->nwwn;
3954 return fcport->pwwn;
3960 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3964 attr->nwwn = fcport->nwwn;
3965 attr->pwwn = fcport->pwwn;
3970 memcpy(&attr->pport_cfg, &fcport->cfg,
3973 attr->pport_cfg.speed = fcport->cfg.speed;
3974 attr->speed_supported = fcport->speed_sup;
3975 attr->speed = fcport->speed;
3979 attr->pport_cfg.topology = fcport->cfg.topology;
3980 attr->topology = fcport->topology;
3981 attr->pport_cfg.trunked = fcport->cfg.trunked;
3984 attr->beacon = fcport->beacon;
3985 attr->link_e2e_beacon = fcport->link_e2e_beacon;
3989 attr->port_state = bfa_sm_to_state(hal_port_sm_table, fcport->sm);
3991 attr->fec_state = fcport->fec_state;
3997 if (bfa_ioc_is_disabled(&fcport->bfa->ioc))
3999 else if (bfa_ioc_fw_mismatch(&fcport->bfa->ioc))
4004 attr->fcoe_vlan = fcport->fcoe_vlan;
4015 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
4018 !fcport->stats_dma_ready)
4021 if (!list_empty(&fcport->statsclr_pending_q))
4024 if (list_empty(&fcport->stats_pending_q)) {
4025 list_add_tail(&cb->hcb_qe.qe, &fcport->stats_pending_q);
4026 bfa_fcport_send_stats_get(fcport);
4027 bfa_timer_start(bfa, &fcport->timer,
4029 fcport, BFA_FCPORT_STATS_TOV);
4031 list_add_tail(&cb->hcb_qe.qe, &fcport->stats_pending_q);
4042 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
4045 !fcport->stats_dma_ready)
4048 if (!list_empty(&fcport->stats_pending_q))
4051 if (list_empty(&fcport->statsclr_pending_q)) {
4052 list_add_tail(&cb->hcb_qe.qe, &fcport->statsclr_pending_q);
4053 bfa_fcport_send_stats_clear(fcport);
4054 bfa_timer_start(bfa, &fcport->timer,
4056 fcport, BFA_FCPORT_STATS_TOV);
4058 list_add_tail(&cb->hcb_qe.qe, &fcport->statsclr_pending_q);
4069 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
4071 return bfa_sm_to_state(hal_port_sm_table, fcport->sm) ==
4079 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
4081 return (bfa_sm_to_state(hal_port_sm_table, fcport->sm) ==
4088 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
4090 return (bfa_sm_to_state(hal_port_sm_table, fcport->sm) ==
4097 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
4113 (fcport->cfg.topology != BFA_PORT_TOPOLOGY_LOOP))
4114 fcport->cfg.qos_bw = *qos_bw;
4122 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
4124 return fcport->cfg.ratelimit ? BFA_TRUE : BFA_FALSE;
4134 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
4137 fcport->cfg.faa_state = state;
4146 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
4148 bfa_trc(bfa, fcport->cfg.trl_def_speed);
4149 return fcport->cfg.trl_def_speed;
4158 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
4162 bfa_trc(bfa, fcport->beacon);
4163 bfa_trc(bfa, fcport->link_e2e_beacon);
4165 fcport->beacon = beacon;
4166 fcport->link_e2e_beacon = link_e2e_beacon;
4172 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
4174 return (!fcport->cfg.trunked &&
4175 bfa_sm_cmp_state(fcport, bfa_fcport_sm_linkup)) ||
4176 (fcport->cfg.trunked &&
4177 fcport->trunk.attr.state == BFA_TRUNK_ONLINE);
4183 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
4185 return fcport->cfg.qos_enabled;
4191 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
4193 return fcport->cfg.trunked;
4199 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
4203 if (bfa_ioc_get_type(&fcport->bfa->ioc) != BFA_IOC_TYPE_FC)
4211 if (fcport->cfg.topology == BFA_PORT_TOPOLOGY_LOOP)
4214 if (fcport->cfg.qos_enabled)
4217 if (fcport->cfg.trunked)
4220 if ((fcport->cfg.speed != BFA_PORT_SPEED_AUTO) &&
4221 (fcport->cfg.speed < bfa_ioc_speed_sup(&bfa->ioc)))
4227 if (fcport->cfg.bb_cr_enabled) {
4228 if (bb_scn != fcport->cfg.bb_scn)
4237 fcport->cfg.bb_cr_enabled = on_off;
4238 fcport->cfg.bb_scn = bb_scn;
4240 if (!fcport->cfg.bb_cr_enabled)
4243 fcport->cfg.bb_cr_enabled = on_off;
4244 fcport->cfg.bb_scn = 0;
4254 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
4256 if (bfa_ioc_get_type(&fcport->bfa->ioc) != BFA_IOC_TYPE_FC)
4259 if (fcport->cfg.topology == BFA_PORT_TOPOLOGY_LOOP)
4262 *bbcr_attr = fcport->bbcr_attr;
5701 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(fcdiag->bfa);
5704 fcport->diag_busy = BFA_TRUE;
5706 fcport->diag_busy = BFA_FALSE;
6013 /* check to see if fcport is dport */