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,
1997 bfa_fcport_aen_post(struct bfa_fcport_s *fcport, enum bfa_port_aen_event event)
1999 struct bfad_s *bfad = (struct bfad_s *)fcport->bfa->bfad;
2006 aen_entry->aen_data.port.ioc_type = bfa_get_type(fcport->bfa);
2007 aen_entry->aen_data.port.pwwn = fcport->pwwn;
2010 bfad_im_post_vendor_event(aen_entry, bfad, ++fcport->bfa->bfa_aen_seq,
2018 bfa_fcport_sm_uninit(struct bfa_fcport_s *fcport,
2021 bfa_trc(fcport->bfa, event);
2028 fcport->use_flash_cfg = BFA_TRUE;
2030 if (bfa_fcport_send_enable(fcport)) {
2031 bfa_trc(fcport->bfa, BFA_TRUE);
2032 bfa_sm_set_state(fcport, bfa_fcport_sm_enabling);
2034 bfa_trc(fcport->bfa, BFA_FALSE);
2035 bfa_sm_set_state(fcport,
2053 bfa_sm_set_state(fcport, bfa_fcport_sm_disabled);
2057 bfa_sm_set_state(fcport, bfa_fcport_sm_iocdown);
2061 bfa_sm_fault(fcport->bfa, event);
2066 bfa_fcport_sm_enabling_qwait(struct bfa_fcport_s *fcport,
2070 struct bfad_s *bfad = (struct bfad_s *)fcport->bfa->bfad;
2071 bfa_trc(fcport->bfa, event);
2075 bfa_sm_set_state(fcport, bfa_fcport_sm_enabling);
2076 bfa_fcport_send_enable(fcport);
2080 bfa_reqq_wcancel(&fcport->reqq_wait);
2081 bfa_sm_set_state(fcport, bfa_fcport_sm_stopped);
2095 bfa_sm_set_state(fcport, bfa_fcport_sm_disabled);
2096 bfa_reqq_wcancel(&fcport->reqq_wait);
2097 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL,
2099 wwn2str(pwwn_buf, fcport->pwwn);
2102 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISABLE);
2114 bfa_reqq_wcancel(&fcport->reqq_wait);
2115 bfa_sm_set_state(fcport, bfa_fcport_sm_iocdown);
2119 bfa_fcport_reset_linkinfo(fcport);
2120 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISCONNECT);
2121 bfa_sm_set_state(fcport, bfa_fcport_sm_faa_misconfig);
2125 bfa_sm_fault(fcport->bfa, event);
2130 bfa_fcport_sm_enabling(struct bfa_fcport_s *fcport,
2134 struct bfad_s *bfad = (struct bfad_s *)fcport->bfa->bfad;
2135 bfa_trc(fcport->bfa, event);
2140 bfa_sm_set_state(fcport, bfa_fcport_sm_linkdown);
2144 bfa_fcport_update_linkinfo(fcport);
2145 bfa_sm_set_state(fcport, bfa_fcport_sm_linkup);
2147 WARN_ON(!fcport->event_cbfn);
2148 bfa_fcport_scn(fcport, BFA_PORT_LINKUP, BFA_FALSE);
2158 if (bfa_fcport_send_disable(fcport))
2159 bfa_sm_set_state(fcport, bfa_fcport_sm_disabling);
2161 bfa_sm_set_state(fcport,
2164 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL,
2166 wwn2str(pwwn_buf, fcport->pwwn);
2169 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISABLE);
2173 bfa_sm_set_state(fcport, bfa_fcport_sm_stopped);
2177 bfa_sm_set_state(fcport, bfa_fcport_sm_iocdown);
2181 bfa_fcport_reset_linkinfo(fcport);
2182 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISCONNECT);
2183 bfa_sm_set_state(fcport, bfa_fcport_sm_faa_misconfig);
2187 bfa_sm_fault(fcport->bfa, event);
2192 bfa_fcport_sm_linkdown(struct bfa_fcport_s *fcport,
2195 struct bfi_fcport_event_s *pevent = fcport->event_arg.i2hmsg.event;
2197 struct bfad_s *bfad = (struct bfad_s *)fcport->bfa->bfad;
2199 bfa_trc(fcport->bfa, event);
2203 bfa_fcport_update_linkinfo(fcport);
2204 bfa_sm_set_state(fcport, bfa_fcport_sm_linkup);
2205 WARN_ON(!fcport->event_cbfn);
2206 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL,
2208 if (!bfa_ioc_get_fcmode(&fcport->bfa->ioc)) {
2210 bfa_trc(fcport->bfa,
2212 bfa_trc(fcport->bfa,
2216 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL,
2220 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL,
2225 bfa_fcport_scn(fcport, BFA_PORT_LINKUP, BFA_FALSE);
2226 wwn2str(pwwn_buf, fcport->pwwn);
2229 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_ONLINE);
2232 if (fcport->cfg.qos_enabled &&
2233 fcport->qos_attr.state != BFA_QOS_ONLINE)
2234 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_QOS_NEG);
2250 if (bfa_fcport_send_disable(fcport))
2251 bfa_sm_set_state(fcport, bfa_fcport_sm_disabling);
2253 bfa_sm_set_state(fcport,
2256 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL,
2258 wwn2str(pwwn_buf, fcport->pwwn);
2261 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISABLE);
2265 bfa_sm_set_state(fcport, bfa_fcport_sm_stopped);
2269 bfa_sm_set_state(fcport, bfa_fcport_sm_iocdown);
2273 bfa_fcport_reset_linkinfo(fcport);
2274 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISCONNECT);
2275 bfa_sm_set_state(fcport, bfa_fcport_sm_faa_misconfig);
2279 bfa_sm_fault(fcport->bfa, event);
2284 bfa_fcport_sm_linkup(struct bfa_fcport_s *fcport,
2288 struct bfad_s *bfad = (struct bfad_s *)fcport->bfa->bfad;
2290 bfa_trc(fcport->bfa, event);
2300 if (bfa_fcport_send_disable(fcport))
2301 bfa_sm_set_state(fcport, bfa_fcport_sm_disabling);
2303 bfa_sm_set_state(fcport,
2306 bfa_fcport_reset_linkinfo(fcport);
2307 bfa_fcport_scn(fcport, BFA_PORT_LINKDOWN, BFA_FALSE);
2308 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL,
2310 wwn2str(pwwn_buf, fcport->pwwn);
2313 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_OFFLINE);
2316 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISABLE);
2320 bfa_sm_set_state(fcport, bfa_fcport_sm_linkdown);
2321 bfa_fcport_reset_linkinfo(fcport);
2322 bfa_fcport_scn(fcport, BFA_PORT_LINKDOWN, BFA_FALSE);
2323 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL,
2325 wwn2str(pwwn_buf, fcport->pwwn);
2326 if (BFA_PORT_IS_DISABLED(fcport->bfa)) {
2329 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_OFFLINE);
2334 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISCONNECT);
2339 bfa_sm_set_state(fcport, bfa_fcport_sm_stopped);
2340 bfa_fcport_reset_linkinfo(fcport);
2341 wwn2str(pwwn_buf, fcport->pwwn);
2342 if (BFA_PORT_IS_DISABLED(fcport->bfa)) {
2345 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_OFFLINE);
2350 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISCONNECT);
2355 bfa_sm_set_state(fcport, bfa_fcport_sm_iocdown);
2356 bfa_fcport_reset_linkinfo(fcport);
2357 bfa_fcport_scn(fcport, BFA_PORT_LINKDOWN, BFA_FALSE);
2358 wwn2str(pwwn_buf, fcport->pwwn);
2359 if (BFA_PORT_IS_DISABLED(fcport->bfa)) {
2362 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_OFFLINE);
2367 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISCONNECT);
2372 bfa_fcport_reset_linkinfo(fcport);
2373 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISCONNECT);
2374 bfa_sm_set_state(fcport, bfa_fcport_sm_faa_misconfig);
2378 bfa_sm_fault(fcport->bfa, event);
2383 bfa_fcport_sm_disabling_qwait(struct bfa_fcport_s *fcport,
2386 bfa_trc(fcport->bfa, event);
2390 bfa_sm_set_state(fcport, bfa_fcport_sm_disabling);
2391 bfa_fcport_send_disable(fcport);
2395 bfa_sm_set_state(fcport, bfa_fcport_sm_stopped);
2396 bfa_reqq_wcancel(&fcport->reqq_wait);
2400 bfa_sm_set_state(fcport, bfa_fcport_sm_toggling_qwait);
2418 bfa_sm_set_state(fcport, bfa_fcport_sm_iocfail);
2419 bfa_reqq_wcancel(&fcport->reqq_wait);
2423 bfa_fcport_reset_linkinfo(fcport);
2424 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISCONNECT);
2425 bfa_sm_set_state(fcport, bfa_fcport_sm_faa_misconfig);
2429 bfa_sm_fault(fcport->bfa, event);
2434 bfa_fcport_sm_toggling_qwait(struct bfa_fcport_s *fcport,
2437 bfa_trc(fcport->bfa, event);
2441 bfa_sm_set_state(fcport, bfa_fcport_sm_disabling);
2442 bfa_fcport_send_disable(fcport);
2443 if (bfa_fcport_send_enable(fcport))
2444 bfa_sm_set_state(fcport, bfa_fcport_sm_enabling);
2446 bfa_sm_set_state(fcport,
2451 bfa_sm_set_state(fcport, bfa_fcport_sm_stopped);
2452 bfa_reqq_wcancel(&fcport->reqq_wait);
2459 bfa_sm_set_state(fcport, bfa_fcport_sm_disabling_qwait);
2471 bfa_sm_set_state(fcport, bfa_fcport_sm_iocfail);
2472 bfa_reqq_wcancel(&fcport->reqq_wait);
2476 bfa_sm_fault(fcport->bfa, event);
2481 bfa_fcport_sm_disabling(struct bfa_fcport_s *fcport,
2485 struct bfad_s *bfad = (struct bfad_s *)fcport->bfa->bfad;
2486 bfa_trc(fcport->bfa, event);
2490 bfa_sm_set_state(fcport, bfa_fcport_sm_disabled);
2500 if (bfa_fcport_send_enable(fcport))
2501 bfa_sm_set_state(fcport, bfa_fcport_sm_enabling);
2503 bfa_sm_set_state(fcport,
2506 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL,
2508 wwn2str(pwwn_buf, fcport->pwwn);
2511 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_ENABLE);
2515 bfa_sm_set_state(fcport, bfa_fcport_sm_stopped);
2527 bfa_sm_set_state(fcport, bfa_fcport_sm_iocfail);
2531 bfa_sm_fault(fcport->bfa, event);
2536 bfa_fcport_sm_disabled(struct bfa_fcport_s *fcport,
2540 struct bfad_s *bfad = (struct bfad_s *)fcport->bfa->bfad;
2541 bfa_trc(fcport->bfa, event);
2551 bfa_sm_set_state(fcport, bfa_fcport_sm_stopped);
2555 if (bfa_fcport_send_enable(fcport))
2556 bfa_sm_set_state(fcport, bfa_fcport_sm_enabling);
2558 bfa_sm_set_state(fcport,
2561 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL,
2563 wwn2str(pwwn_buf, fcport->pwwn);
2566 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_ENABLE);
2576 bfa_sm_set_state(fcport, bfa_fcport_sm_iocfail);
2580 bfa_sm_set_state(fcport, bfa_fcport_sm_dport);
2584 bfa_sm_set_state(fcport, bfa_fcport_sm_ddport);
2588 bfa_sm_fault(fcport->bfa, event);
2593 bfa_fcport_sm_stopped(struct bfa_fcport_s *fcport,
2596 bfa_trc(fcport->bfa, event);
2600 if (bfa_fcport_send_enable(fcport))
2601 bfa_sm_set_state(fcport, bfa_fcport_sm_enabling);
2603 bfa_sm_set_state(fcport,
2619 bfa_fcport_sm_iocdown(struct bfa_fcport_s *fcport,
2622 bfa_trc(fcport->bfa, event);
2626 if (bfa_fcport_send_enable(fcport))
2627 bfa_sm_set_state(fcport, bfa_fcport_sm_enabling);
2629 bfa_sm_set_state(fcport,
2645 bfa_fcport_sm_iocfail(struct bfa_fcport_s *fcport,
2648 bfa_trc(fcport->bfa, event);
2652 bfa_sm_set_state(fcport, bfa_fcport_sm_disabled);
2656 bfa_sm_set_state(fcport, bfa_fcport_sm_iocdown);
2668 bfa_fcport_sm_dport(struct bfa_fcport_s *fcport, enum bfa_fcport_sm_event event)
2670 bfa_trc(fcport->bfa, event);
2683 bfa_sm_set_state(fcport, bfa_fcport_sm_stopped);
2687 bfa_sm_set_state(fcport, bfa_fcport_sm_iocfail);
2691 bfa_sm_set_state(fcport, bfa_fcport_sm_disabled);
2695 bfa_sm_fault(fcport->bfa, event);
2700 bfa_fcport_sm_ddport(struct bfa_fcport_s *fcport,
2703 bfa_trc(fcport->bfa, event);
2708 bfa_sm_set_state(fcport, bfa_fcport_sm_disabled);
2721 bfa_sm_set_state(fcport, bfa_fcport_sm_stopped);
2725 bfa_sm_set_state(fcport, bfa_fcport_sm_iocfail);
2729 bfa_sm_fault(fcport->bfa, event);
2734 bfa_fcport_sm_faa_misconfig(struct bfa_fcport_s *fcport,
2737 bfa_trc(fcport->bfa, event);
2749 if (bfa_fcport_send_disable(fcport))
2750 bfa_sm_set_state(fcport, bfa_fcport_sm_disabling);
2752 bfa_sm_set_state(fcport, bfa_fcport_sm_disabling_qwait);
2754 bfa_fcport_reset_linkinfo(fcport);
2755 bfa_fcport_scn(fcport, BFA_PORT_LINKDOWN, BFA_FALSE);
2756 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL,
2758 bfa_fcport_aen_post(fcport, BFA_PORT_AEN_DISABLE);
2762 bfa_sm_set_state(fcport, bfa_fcport_sm_stopped);
2766 bfa_fcport_reset_linkinfo(fcport);
2767 bfa_fcport_scn(fcport, BFA_PORT_LINKDOWN, BFA_FALSE);
2768 bfa_sm_set_state(fcport, bfa_fcport_sm_iocdown);
2772 bfa_sm_fault(fcport->bfa, event);
2783 bfa_trc(ln->fcport->bfa, event);
2792 bfa_sm_fault(ln->fcport->bfa, event);
2803 bfa_trc(ln->fcport->bfa, event);
2815 bfa_sm_fault(ln->fcport->bfa, event);
2826 bfa_trc(ln->fcport->bfa, event);
2839 bfa_sm_fault(ln->fcport->bfa, event);
2850 bfa_trc(ln->fcport->bfa, event);
2859 bfa_sm_fault(ln->fcport->bfa, event);
2870 bfa_trc(ln->fcport->bfa, event);
2882 bfa_sm_fault(ln->fcport->bfa, event);
2893 bfa_trc(ln->fcport->bfa, event);
2906 bfa_sm_fault(ln->fcport->bfa, event);
2917 bfa_trc(ln->fcport->bfa, event);
2930 bfa_sm_fault(ln->fcport->bfa, event);
2940 ln->fcport->event_cbfn(ln->fcport->event_cbarg, ln->ln_event);
2947 * trunk - false if caller is fcport to ignore fcport event in trunked mode
2950 bfa_fcport_scn(struct bfa_fcport_s *fcport, enum bfa_port_linkstate event,
2953 if (fcport->cfg.trunked && !trunk)
2958 bfa_sm_send_event(&fcport->ln, BFA_FCPORT_LN_SM_LINKUP);
2961 bfa_sm_send_event(&fcport->ln, BFA_FCPORT_LN_SM_LINKDOWN);
2971 struct bfa_fcport_s *fcport = ln->fcport;
2973 if (fcport->bfa->fcs) {
2974 fcport->event_cbfn(fcport->event_cbarg, event);
2978 bfa_cb_queue(fcport->bfa, &ln->ln_qe,
2998 struct bfa_fcport_s *fcport = cbarg;
3000 bfa_sm_send_event(fcport, BFA_FCPORT_SM_QRESUME);
3004 bfa_fcport_mem_claim(struct bfa_fcport_s *fcport)
3006 struct bfa_mem_dma_s *fcport_dma = &fcport->fcport_dma;
3008 fcport->stats_kva = bfa_mem_dma_virt(fcport_dma);
3009 fcport->stats_pa = bfa_mem_dma_phys(fcport_dma);
3010 fcport->stats = (union bfa_fcport_stats_u *)
3021 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3022 struct bfa_port_cfg_s *port_cfg = &fcport->cfg;
3023 struct bfa_fcport_ln_s *ln = &fcport->ln;
3025 fcport->bfa = bfa;
3026 ln->fcport = fcport;
3028 bfa_fcport_mem_claim(fcport);
3030 bfa_sm_set_state(fcport, bfa_fcport_sm_uninit);
3036 fcport->stats_reset_time = ktime_get_seconds();
3037 fcport->stats_dma_ready = BFA_FALSE;
3052 fcport->fec_state = BFA_FEC_OFFLINE;
3054 INIT_LIST_HEAD(&fcport->stats_pending_q);
3055 INIT_LIST_HEAD(&fcport->statsclr_pending_q);
3057 bfa_reqq_winit(&fcport->reqq_wait, bfa_fcport_qresume, fcport);
3072 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3074 bfa_sm_send_event(fcport, BFA_FCPORT_SM_HWFAIL);
3079 * Update loop info in fcport for SCN online
3082 bfa_fcport_update_loop_info(struct bfa_fcport_s *fcport,
3085 fcport->myalpa = loop_info->myalpa;
3086 fcport->alpabm_valid =
3088 memcpy(fcport->alpabm.alpa_bm,
3094 bfa_fcport_update_linkinfo(struct bfa_fcport_s *fcport)
3096 struct bfi_fcport_event_s *pevent = fcport->event_arg.i2hmsg.event;
3097 struct bfa_fcport_trunk_s *trunk = &fcport->trunk;
3099 fcport->speed = pevent->link_state.speed;
3100 fcport->topology = pevent->link_state.topology;
3102 if (fcport->topology == BFA_PORT_TOPOLOGY_LOOP) {
3103 bfa_fcport_update_loop_info(fcport,
3109 fcport->qos_attr = pevent->link_state.qos_attr;
3110 fcport->qos_vc_attr = pevent->link_state.attr.vc_fcf.qos_vc_attr;
3112 if (fcport->cfg.bb_cr_enabled)
3113 fcport->bbcr_attr = pevent->link_state.attr.bbcr_attr;
3115 fcport->fec_state = pevent->link_state.fec_state;
3120 if (!fcport->cfg.trunked)
3124 fcport->fcoe_vlan =
3127 bfa_trc(fcport->bfa, fcport->speed);
3128 bfa_trc(fcport->bfa, fcport->topology);
3132 bfa_fcport_reset_linkinfo(struct bfa_fcport_s *fcport)
3134 fcport->speed = BFA_PORT_SPEED_UNKNOWN;
3135 fcport->topology = BFA_PORT_TOPOLOGY_NONE;
3136 fcport->fec_state = BFA_FEC_OFFLINE;
3143 bfa_fcport_send_enable(struct bfa_fcport_s *fcport)
3151 fcport->msgtag++;
3156 m = bfa_reqq_next(fcport->bfa, BFA_REQQ_PORT);
3158 bfa_reqq_wait(fcport->bfa, BFA_REQQ_PORT,
3159 &fcport->reqq_wait);
3164 bfa_fn_lpu(fcport->bfa));
3165 m->nwwn = fcport->nwwn;
3166 m->pwwn = fcport->pwwn;
3167 m->port_cfg = fcport->cfg;
3168 m->msgtag = fcport->msgtag;
3169 m->port_cfg.maxfrsize = cpu_to_be16(fcport->cfg.maxfrsize);
3170 m->use_flash_cfg = fcport->use_flash_cfg;
3171 bfa_dma_be_addr_set(m->stats_dma_addr, fcport->stats_pa);
3172 bfa_trc(fcport->bfa, m->stats_dma_addr.a32.addr_lo);
3173 bfa_trc(fcport->bfa, m->stats_dma_addr.a32.addr_hi);
3178 bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT, m->mh);
3186 bfa_fcport_send_disable(struct bfa_fcport_s *fcport)
3194 fcport->msgtag++;
3199 m = bfa_reqq_next(fcport->bfa, BFA_REQQ_PORT);
3201 bfa_reqq_wait(fcport->bfa, BFA_REQQ_PORT,
3202 &fcport->reqq_wait);
3207 bfa_fn_lpu(fcport->bfa));
3208 m->msgtag = fcport->msgtag;
3213 bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT, m->mh);
3219 bfa_fcport_set_wwns(struct bfa_fcport_s *fcport)
3221 fcport->pwwn = fcport->bfa->ioc.attr->pwwn;
3222 fcport->nwwn = fcport->bfa->ioc.attr->nwwn;
3224 bfa_trc(fcport->bfa, fcport->pwwn);
3225 bfa_trc(fcport->bfa, fcport->nwwn);
3264 struct bfa_fcport_s *fcport = (struct bfa_fcport_s *)cbarg;
3272 list_for_each_safe(qe, qen, &fcport->stats_pending_q) {
3273 bfa_q_deq(&fcport->stats_pending_q, &qe);
3275 if (fcport->stats_status == BFA_STATUS_OK) {
3278 if (bfa_ioc_get_fcmode(&fcport->bfa->ioc))
3280 &fcport->stats->fcqos);
3283 &fcport->stats->fcoe);
3285 time - fcport->stats_reset_time;
3288 bfa_cb_queue_status(fcport->bfa, &cb->hcb_qe,
3289 fcport->stats_status);
3291 fcport->stats_status = BFA_STATUS_OK;
3293 INIT_LIST_HEAD(&fcport->stats_pending_q);
3294 fcport->stats_status = BFA_STATUS_OK;
3301 struct bfa_fcport_s *fcport = (struct bfa_fcport_s *) cbarg;
3303 bfa_trc(fcport->bfa, fcport->stats_qfull);
3305 if (fcport->stats_qfull) {
3306 bfa_reqq_wcancel(&fcport->stats_reqq_wait);
3307 fcport->stats_qfull = BFA_FALSE;
3310 fcport->stats_status = BFA_STATUS_ETIMER;
3311 __bfa_cb_fcport_stats_get(fcport, BFA_TRUE);
3317 struct bfa_fcport_s *fcport = (struct bfa_fcport_s *) cbarg;
3320 msg = bfa_reqq_next(fcport->bfa, BFA_REQQ_PORT);
3323 fcport->stats_qfull = BFA_TRUE;
3324 bfa_reqq_winit(&fcport->stats_reqq_wait,
3325 bfa_fcport_send_stats_get, fcport);
3326 bfa_reqq_wait(fcport->bfa, BFA_REQQ_PORT,
3327 &fcport->stats_reqq_wait);
3330 fcport->stats_qfull = BFA_FALSE;
3334 bfa_fn_lpu(fcport->bfa));
3335 bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT, msg->mh);
3341 struct bfa_fcport_s *fcport = (struct bfa_fcport_s *) cbarg;
3349 fcport->stats_reset_time = ktime_get_seconds();
3350 list_for_each_safe(qe, qen, &fcport->statsclr_pending_q) {
3351 bfa_q_deq(&fcport->statsclr_pending_q, &qe);
3353 bfa_cb_queue_status(fcport->bfa, &cb->hcb_qe,
3354 fcport->stats_status);
3356 fcport->stats_status = BFA_STATUS_OK;
3358 INIT_LIST_HEAD(&fcport->statsclr_pending_q);
3359 fcport->stats_status = BFA_STATUS_OK;
3366 struct bfa_fcport_s *fcport = (struct bfa_fcport_s *) cbarg;
3368 bfa_trc(fcport->bfa, fcport->stats_qfull);
3370 if (fcport->stats_qfull) {
3371 bfa_reqq_wcancel(&fcport->stats_reqq_wait);
3372 fcport->stats_qfull = BFA_FALSE;
3375 fcport->stats_status = BFA_STATUS_ETIMER;
3376 __bfa_cb_fcport_stats_clr(fcport, BFA_TRUE);
3382 struct bfa_fcport_s *fcport = (struct bfa_fcport_s *) cbarg;
3385 msg = bfa_reqq_next(fcport->bfa, BFA_REQQ_PORT);
3388 fcport->stats_qfull = BFA_TRUE;
3389 bfa_reqq_winit(&fcport->stats_reqq_wait,
3390 bfa_fcport_send_stats_clear, fcport);
3391 bfa_reqq_wait(fcport->bfa, BFA_REQQ_PORT,
3392 &fcport->stats_reqq_wait);
3395 fcport->stats_qfull = BFA_FALSE;
3399 bfa_fn_lpu(fcport->bfa));
3400 bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT, msg->mh);
3407 bfa_trunk_scn(struct bfa_fcport_s *fcport, struct bfi_fcport_trunk_scn_s *scn)
3409 struct bfa_fcport_trunk_s *trunk = &fcport->trunk;
3416 bfa_trc(fcport->bfa, fcport->cfg.trunked);
3420 bfa_trc(fcport->bfa, trunk->attr.state);
3421 bfa_trc(fcport->bfa, scn->trunk_state);
3422 bfa_trc(fcport->bfa, scn->trunk_speed);
3428 if (fcport->cfg.trunked && (trunk->attr.state != BFA_TRUNK_DISABLED))
3442 fcport->speed = tlink->speed;
3443 fcport->topology = BFA_PORT_TOPOLOGY_P2P;
3447 bfa_trc(fcport->bfa, lattr->link_state);
3448 bfa_trc(fcport->bfa, lattr->trunk_wwn);
3449 bfa_trc(fcport->bfa, lattr->fctl);
3450 bfa_trc(fcport->bfa, lattr->speed);
3451 bfa_trc(fcport->bfa, lattr->deskew);
3456 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL,
3460 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL,
3464 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL,
3468 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL,
3477 bfa_fcport_scn(fcport, (scn->trunk_state == BFA_TRUNK_ONLINE) ?
3485 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3491 if (fcport->cfg.trunked) {
3492 if (fcport->trunk.attr.state == BFA_TRUNK_ONLINE)
3493 bfa_fcport_scn(fcport, BFA_PORT_LINKDOWN, BFA_TRUE);
3495 fcport->trunk.attr.state = BFA_TRUNK_OFFLINE;
3496 fcport->trunk.attr.speed = BFA_PORT_SPEED_UNKNOWN;
3498 fcport->trunk.attr.link_attr[i].trunk_wwn = 0;
3499 fcport->trunk.attr.link_attr[i].fctl =
3501 fcport->trunk.attr.link_attr[i].link_state =
3503 fcport->trunk.attr.link_attr[i].speed =
3505 fcport->trunk.attr.link_attr[i].deskew = 0;
3516 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3521 bfa_fcport_set_wwns(fcport);
3522 if (fcport->cfg.maxfrsize == 0)
3523 fcport->cfg.maxfrsize = bfa_ioc_maxfrsize(&bfa->ioc);
3524 fcport->cfg.rx_bbcredit = bfa_ioc_rx_bbcredit(&bfa->ioc);
3525 fcport->speed_sup = bfa_ioc_speed_sup(&bfa->ioc);
3530 WARN_ON(!fcport->cfg.maxfrsize);
3531 WARN_ON(!fcport->cfg.rx_bbcredit);
3532 WARN_ON(!fcport->speed_sup);
3541 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3545 fcport->event_arg.i2hmsg = i2hmsg;
3548 bfa_trc(bfa, bfa_sm_to_state(hal_port_sm_table, fcport->sm));
3552 if (fcport->msgtag == i2hmsg.penable_rsp->msgtag) {
3554 fcport->stats_dma_ready = BFA_TRUE;
3555 if (fcport->use_flash_cfg) {
3556 fcport->cfg = i2hmsg.penable_rsp->port_cfg;
3557 fcport->cfg.maxfrsize =
3558 cpu_to_be16(fcport->cfg.maxfrsize);
3559 fcport->cfg.path_tov =
3560 cpu_to_be16(fcport->cfg.path_tov);
3561 fcport->cfg.q_depth =
3562 cpu_to_be16(fcport->cfg.q_depth);
3564 if (fcport->cfg.trunked)
3565 fcport->trunk.attr.state =
3568 fcport->trunk.attr.state =
3570 fcport->qos_attr.qos_bw =
3572 fcport->use_flash_cfg = BFA_FALSE;
3575 if (fcport->cfg.qos_enabled)
3576 fcport->qos_attr.state = BFA_QOS_OFFLINE;
3578 fcport->qos_attr.state = BFA_QOS_DISABLED;
3580 fcport->qos_attr.qos_bw_op =
3583 if (fcport->cfg.bb_cr_enabled)
3584 fcport->bbcr_attr.state = BFA_BBCR_OFFLINE;
3586 fcport->bbcr_attr.state = BFA_BBCR_DISABLED;
3588 bfa_sm_send_event(fcport, BFA_FCPORT_SM_FWRSP);
3593 if (fcport->msgtag == i2hmsg.penable_rsp->msgtag)
3594 bfa_sm_send_event(fcport, BFA_FCPORT_SM_FWRSP);
3598 if (fcport->cfg.bb_cr_enabled)
3599 fcport->bbcr_attr.state = BFA_BBCR_OFFLINE;
3601 fcport->bbcr_attr.state = BFA_BBCR_DISABLED;
3604 bfa_sm_send_event(fcport, BFA_FCPORT_SM_LINKUP);
3608 bfa_sm_send_event(fcport,
3611 bfa_sm_send_event(fcport,
3614 fcport->qos_attr.qos_bw_op =
3619 bfa_trunk_scn(fcport, i2hmsg.trunk_scn);
3626 if (list_empty(&fcport->stats_pending_q) ||
3627 (fcport->stats_status == BFA_STATUS_ETIMER))
3630 bfa_timer_stop(&fcport->timer);
3631 fcport->stats_status = i2hmsg.pstatsget_rsp->status;
3632 __bfa_cb_fcport_stats_get(fcport, BFA_TRUE);
3639 if (list_empty(&fcport->statsclr_pending_q) ||
3640 (fcport->stats_status == BFA_STATUS_ETIMER))
3643 bfa_timer_stop(&fcport->timer);
3644 fcport->stats_status = BFA_STATUS_OK;
3645 __bfa_cb_fcport_stats_clr(fcport, BFA_TRUE);
3649 bfa_sm_send_event(fcport, BFA_FCPORT_SM_ENABLE);
3653 bfa_sm_send_event(fcport, BFA_FCPORT_SM_DISABLE);
3671 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3673 fcport->event_cbfn = cbfn;
3674 fcport->event_cbarg = cbarg;
3680 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3688 if (fcport->diag_busy)
3712 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3717 bfa_trc(bfa, fcport->pwwn);
3729 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3733 if (fcport->cfg.trunked == BFA_TRUE)
3735 if ((fcport->cfg.topology == BFA_PORT_TOPOLOGY_LOOP) &&
3738 if ((speed != BFA_PORT_SPEED_AUTO) && (speed > fcport->speed_sup)) {
3739 bfa_trc(bfa, fcport->speed_sup);
3744 if (bfa_ioc_get_type(&fcport->bfa->ioc) == BFA_IOC_TYPE_FC) {
3763 fcport->cfg.speed = speed;
3774 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3776 return fcport->speed;
3785 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3788 bfa_trc(bfa, fcport->cfg.topology);
3796 (fcport->qos_attr.state != BFA_QOS_DISABLED))
3798 if (fcport->cfg.ratelimit != BFA_FALSE)
3801 (fcport->trunk.attr.state != BFA_TRUNK_DISABLED))
3804 (fcport->cfg.speed == BFA_PORT_SPEED_16GBPS))
3821 fcport->cfg.topology = topology;
3831 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3833 return fcport->topology;
3842 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3844 return fcport->cfg.topology;
3850 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_TRUE;
3857 fcport->cfg.hardalpa = alpa;
3865 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3867 bfa_trc(bfa, fcport->cfg.cfg_hardalpa);
3868 bfa_trc(bfa, fcport->cfg.hardalpa);
3870 fcport->cfg.cfg_hardalpa = BFA_FALSE;
3877 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3879 *alpa = fcport->cfg.hardalpa;
3880 return fcport->cfg.cfg_hardalpa;
3886 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3888 return fcport->myalpa;
3894 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3897 bfa_trc(bfa, fcport->cfg.maxfrsize);
3907 fcport->cfg.maxfrsize = maxfrsize;
3914 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3916 return fcport->cfg.maxfrsize;
3932 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3934 fcport->cfg.tx_bbcredit = (u8)tx_bbcredit;
3944 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3946 return fcport->nwwn;
3948 return fcport->pwwn;
3954 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
3958 attr->nwwn = fcport->nwwn;
3959 attr->pwwn = fcport->pwwn;
3964 memcpy(&attr->pport_cfg, &fcport->cfg,
3967 attr->pport_cfg.speed = fcport->cfg.speed;
3968 attr->speed_supported = fcport->speed_sup;
3969 attr->speed = fcport->speed;
3973 attr->pport_cfg.topology = fcport->cfg.topology;
3974 attr->topology = fcport->topology;
3975 attr->pport_cfg.trunked = fcport->cfg.trunked;
3978 attr->beacon = fcport->beacon;
3979 attr->link_e2e_beacon = fcport->link_e2e_beacon;
3983 attr->port_state = bfa_sm_to_state(hal_port_sm_table, fcport->sm);
3985 attr->fec_state = fcport->fec_state;
3991 if (bfa_ioc_is_disabled(&fcport->bfa->ioc))
3993 else if (bfa_ioc_fw_mismatch(&fcport->bfa->ioc))
3998 attr->fcoe_vlan = fcport->fcoe_vlan;
4009 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
4012 !fcport->stats_dma_ready)
4015 if (!list_empty(&fcport->statsclr_pending_q))
4018 if (list_empty(&fcport->stats_pending_q)) {
4019 list_add_tail(&cb->hcb_qe.qe, &fcport->stats_pending_q);
4020 bfa_fcport_send_stats_get(fcport);
4021 bfa_timer_start(bfa, &fcport->timer,
4023 fcport, BFA_FCPORT_STATS_TOV);
4025 list_add_tail(&cb->hcb_qe.qe, &fcport->stats_pending_q);
4036 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
4039 !fcport->stats_dma_ready)
4042 if (!list_empty(&fcport->stats_pending_q))
4045 if (list_empty(&fcport->statsclr_pending_q)) {
4046 list_add_tail(&cb->hcb_qe.qe, &fcport->statsclr_pending_q);
4047 bfa_fcport_send_stats_clear(fcport);
4048 bfa_timer_start(bfa, &fcport->timer,
4050 fcport, BFA_FCPORT_STATS_TOV);
4052 list_add_tail(&cb->hcb_qe.qe, &fcport->statsclr_pending_q);
4063 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
4065 return bfa_sm_to_state(hal_port_sm_table, fcport->sm) ==
4073 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
4075 return (bfa_sm_to_state(hal_port_sm_table, fcport->sm) ==
4082 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
4084 return (bfa_sm_to_state(hal_port_sm_table, fcport->sm) ==
4091 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
4107 (fcport->cfg.topology != BFA_PORT_TOPOLOGY_LOOP))
4108 fcport->cfg.qos_bw = *qos_bw;
4116 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
4118 return fcport->cfg.ratelimit ? BFA_TRUE : BFA_FALSE;
4128 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
4131 fcport->cfg.faa_state = state;
4140 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
4142 bfa_trc(bfa, fcport->cfg.trl_def_speed);
4143 return fcport->cfg.trl_def_speed;
4152 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
4156 bfa_trc(bfa, fcport->beacon);
4157 bfa_trc(bfa, fcport->link_e2e_beacon);
4159 fcport->beacon = beacon;
4160 fcport->link_e2e_beacon = link_e2e_beacon;
4166 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
4168 return (!fcport->cfg.trunked &&
4169 bfa_sm_cmp_state(fcport, bfa_fcport_sm_linkup)) ||
4170 (fcport->cfg.trunked &&
4171 fcport->trunk.attr.state == BFA_TRUNK_ONLINE);
4177 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
4179 return fcport->cfg.qos_enabled;
4185 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
4187 return fcport->cfg.trunked;
4193 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
4197 if (bfa_ioc_get_type(&fcport->bfa->ioc) != BFA_IOC_TYPE_FC)
4205 if (fcport->cfg.topology == BFA_PORT_TOPOLOGY_LOOP)
4208 if (fcport->cfg.qos_enabled)
4211 if (fcport->cfg.trunked)
4214 if ((fcport->cfg.speed != BFA_PORT_SPEED_AUTO) &&
4215 (fcport->cfg.speed < bfa_ioc_speed_sup(&bfa->ioc)))
4221 if (fcport->cfg.bb_cr_enabled) {
4222 if (bb_scn != fcport->cfg.bb_scn)
4231 fcport->cfg.bb_cr_enabled = on_off;
4232 fcport->cfg.bb_scn = bb_scn;
4234 if (!fcport->cfg.bb_cr_enabled)
4237 fcport->cfg.bb_cr_enabled = on_off;
4238 fcport->cfg.bb_scn = 0;
4248 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
4250 if (bfa_ioc_get_type(&fcport->bfa->ioc) != BFA_IOC_TYPE_FC)
4253 if (fcport->cfg.topology == BFA_PORT_TOPOLOGY_LOOP)
4256 *bbcr_attr = fcport->bbcr_attr;
5695 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(fcdiag->bfa);
5698 fcport->diag_busy = BFA_TRUE;
5700 fcport->diag_busy = BFA_FALSE;
6007 /* check to see if fcport is dport */