Lines Matching +full:qe +full:- +full:firmware

1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
4 * Copyright (c) 2014- QLogic Corporation.
8 * Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
41 (bfa_ioc_is_disabled(&bfa->ioc) == BFA_TRUE))
47 if ((__rp)->bfa->fcs) \
48 bfa_cb_rport_offline((__rp)->rport_drv); \
50 bfa_cb_queue((__rp)->bfa, &(__rp)->hcb_qe, \
56 if ((__rp)->bfa->fcs) \
57 bfa_cb_rport_online((__rp)->rport_drv); \
59 bfa_cb_queue((__rp)->bfa, &(__rp)->hcb_qe, \
258 if ((pl_rec->log_type != BFA_PL_LOG_TYPE_INT) && in plkd_validate_logrec()
259 (pl_rec->log_type != BFA_PL_LOG_TYPE_STRING)) in plkd_validate_logrec()
262 if ((pl_rec->log_type != BFA_PL_LOG_TYPE_INT) && in plkd_validate_logrec()
263 (pl_rec->log_num_ints > BFA_PL_INT_LOG_SZ)) in plkd_validate_logrec()
275 if (plog->plog_enabled == 0) in bfa_plog_add()
283 tail = plog->tail; in bfa_plog_add()
285 pl_recp = &(plog->plog_recs[tail]); in bfa_plog_add()
289 pl_recp->tv = ktime_get_real_seconds(); in bfa_plog_add()
290 BFA_PL_LOG_REC_INCR(plog->tail); in bfa_plog_add()
292 if (plog->head == plog->tail) in bfa_plog_add()
293 BFA_PL_LOG_REC_INCR(plog->head); in bfa_plog_add()
301 memcpy(plog->plog_sig, BFA_PL_SIG_STR, BFA_PL_SIG_LEN); in bfa_plog_init()
302 plog->head = plog->tail = 0; in bfa_plog_init()
303 plog->plog_enabled = 1; in bfa_plog_init()
313 if (plog->plog_enabled) { in bfa_plog_str()
321 lp.log_entry.string_log[BFA_PL_STRING_LOG_SZ - 1] = '\0'; in bfa_plog_str()
337 if (plog->plog_enabled) { in bfa_plog_intarr()
361 if (plog->plog_enabled) { in bfa_plog_fchdr()
378 if (plog->plog_enabled) { in bfa_plog_fchdr_and_pl()
400 memset(fcxp, 0, sizeof(struct bfa_fcxp_s) * mod->num_fcxps); in claim_fcxps_mem()
402 INIT_LIST_HEAD(&mod->fcxp_req_free_q); in claim_fcxps_mem()
403 INIT_LIST_HEAD(&mod->fcxp_rsp_free_q); in claim_fcxps_mem()
404 INIT_LIST_HEAD(&mod->fcxp_active_q); in claim_fcxps_mem()
405 INIT_LIST_HEAD(&mod->fcxp_req_unused_q); in claim_fcxps_mem()
406 INIT_LIST_HEAD(&mod->fcxp_rsp_unused_q); in claim_fcxps_mem()
408 mod->fcxp_list = fcxp; in claim_fcxps_mem()
410 for (i = 0; i < mod->num_fcxps; i++) { in claim_fcxps_mem()
411 fcxp->fcxp_mod = mod; in claim_fcxps_mem()
412 fcxp->fcxp_tag = i; in claim_fcxps_mem()
414 if (i < (mod->num_fcxps / 2)) { in claim_fcxps_mem()
415 list_add_tail(&fcxp->qe, &mod->fcxp_req_free_q); in claim_fcxps_mem()
416 fcxp->req_rsp = BFA_TRUE; in claim_fcxps_mem()
418 list_add_tail(&fcxp->qe, &mod->fcxp_rsp_free_q); in claim_fcxps_mem()
419 fcxp->req_rsp = BFA_FALSE; in claim_fcxps_mem()
422 bfa_reqq_winit(&fcxp->reqq_wqe, bfa_fcxp_qresume, fcxp); in claim_fcxps_mem()
423 fcxp->reqq_waiting = BFA_FALSE; in claim_fcxps_mem()
439 u16 num_fcxps = cfg->fwcfg.num_fcxp_reqs; in bfa_fcxp_meminfo()
445 if (cfg->drvcfg.min_cfg) in bfa_fcxp_meminfo()
456 num_fcxps -= per_seg_fcxp; in bfa_fcxp_meminfo()
466 cfg->fwcfg.num_fcxp_reqs * sizeof(struct bfa_fcxp_s)); in bfa_fcxp_meminfo()
475 mod->bfa = bfa; in bfa_fcxp_attach()
476 mod->num_fcxps = cfg->fwcfg.num_fcxp_reqs; in bfa_fcxp_attach()
481 mod->req_pld_sz = mod->rsp_pld_sz = BFA_FCXP_MAX_IBUF_SZ; in bfa_fcxp_attach()
482 if (!cfg->drvcfg.min_cfg) in bfa_fcxp_attach()
483 mod->rsp_pld_sz = BFA_FCXP_MAX_LBUF_SZ; in bfa_fcxp_attach()
485 INIT_LIST_HEAD(&mod->req_wait_q); in bfa_fcxp_attach()
486 INIT_LIST_HEAD(&mod->rsp_wait_q); in bfa_fcxp_attach()
496 struct list_head *qe, *qen; in bfa_fcxp_iocdisable() local
499 list_splice_tail_init(&mod->fcxp_req_unused_q, &mod->fcxp_req_free_q); in bfa_fcxp_iocdisable()
500 list_splice_tail_init(&mod->fcxp_rsp_unused_q, &mod->fcxp_rsp_free_q); in bfa_fcxp_iocdisable()
502 list_for_each_safe(qe, qen, &mod->fcxp_active_q) { in bfa_fcxp_iocdisable()
503 fcxp = (struct bfa_fcxp_s *) qe; in bfa_fcxp_iocdisable()
504 if (fcxp->caller == NULL) { in bfa_fcxp_iocdisable()
505 fcxp->send_cbfn(fcxp->caller, fcxp, fcxp->send_cbarg, in bfa_fcxp_iocdisable()
509 fcxp->rsp_status = BFA_STATUS_IOC_FAILURE; in bfa_fcxp_iocdisable()
510 bfa_cb_queue(bfa, &fcxp->hcb_qe, in bfa_fcxp_iocdisable()
522 bfa_q_deq(&fm->fcxp_req_free_q, &fcxp); in bfa_fcxp_get()
524 bfa_q_deq(&fm->fcxp_rsp_free_q, &fcxp); in bfa_fcxp_get()
527 list_add_tail(&fcxp->qe, &fm->fcxp_active_q); in bfa_fcxp_get()
547 bfa_trc(bfa, fcxp->fcxp_tag); in bfa_fcxp_init_reqrsp()
581 bfa_trc(bfa, fcxp->fcxp_tag); in bfa_fcxp_init()
583 fcxp->caller = caller; in bfa_fcxp_init()
586 &fcxp->use_ireqbuf, &fcxp->nreq_sgles, &fcxp->req_sga_cbfn, in bfa_fcxp_init()
587 &fcxp->req_sglen_cbfn, &fcxp->req_sgpg_q, in bfa_fcxp_init()
591 &fcxp->use_irspbuf, &fcxp->nrsp_sgles, &fcxp->rsp_sga_cbfn, in bfa_fcxp_init()
592 &fcxp->rsp_sglen_cbfn, &fcxp->rsp_sgpg_q, in bfa_fcxp_init()
600 struct bfa_fcxp_mod_s *mod = fcxp->fcxp_mod; in bfa_fcxp_put()
603 if (fcxp->req_rsp) in bfa_fcxp_put()
604 bfa_q_deq(&mod->req_wait_q, &wqe); in bfa_fcxp_put()
606 bfa_q_deq(&mod->rsp_wait_q, &wqe); in bfa_fcxp_put()
609 bfa_trc(mod->bfa, fcxp->fcxp_tag); in bfa_fcxp_put()
611 bfa_fcxp_init(fcxp, wqe->caller, wqe->bfa, wqe->nreq_sgles, in bfa_fcxp_put()
612 wqe->nrsp_sgles, wqe->req_sga_cbfn, in bfa_fcxp_put()
613 wqe->req_sglen_cbfn, wqe->rsp_sga_cbfn, in bfa_fcxp_put()
614 wqe->rsp_sglen_cbfn); in bfa_fcxp_put()
616 wqe->alloc_cbfn(wqe->alloc_cbarg, fcxp); in bfa_fcxp_put()
620 WARN_ON(!bfa_q_is_on_q(&mod->fcxp_active_q, fcxp)); in bfa_fcxp_put()
621 list_del(&fcxp->qe); in bfa_fcxp_put()
623 if (fcxp->req_rsp) in bfa_fcxp_put()
624 list_add_tail(&fcxp->qe, &mod->fcxp_req_free_q); in bfa_fcxp_put()
626 list_add_tail(&fcxp->qe, &mod->fcxp_rsp_free_q); in bfa_fcxp_put()
643 fcxp->send_cbfn(fcxp->caller, fcxp, fcxp->send_cbarg, in __bfa_fcxp_send_cbfn()
644 fcxp->rsp_status, fcxp->rsp_len, in __bfa_fcxp_send_cbfn()
645 fcxp->residue_len, &fcxp->rsp_fchs); in __bfa_fcxp_send_cbfn()
656 u16 fcxp_tag = be16_to_cpu(fcxp_rsp->fcxp_tag); in hal_fcxp_send_comp()
660 fcxp_rsp->rsp_len = be32_to_cpu(fcxp_rsp->rsp_len); in hal_fcxp_send_comp()
663 * @todo f/w should not set residue to non-0 when everything in hal_fcxp_send_comp()
666 if (fcxp_rsp->req_status == BFA_STATUS_OK) in hal_fcxp_send_comp()
667 fcxp_rsp->residue_len = 0; in hal_fcxp_send_comp()
669 fcxp_rsp->residue_len = be32_to_cpu(fcxp_rsp->residue_len); in hal_fcxp_send_comp()
673 WARN_ON(fcxp->send_cbfn == NULL); in hal_fcxp_send_comp()
675 hal_fcxp_rx_plog(mod->bfa, fcxp, fcxp_rsp); in hal_fcxp_send_comp()
677 if (fcxp->send_cbfn != NULL) { in hal_fcxp_send_comp()
678 bfa_trc(mod->bfa, (NULL == fcxp->caller)); in hal_fcxp_send_comp()
679 if (fcxp->caller == NULL) { in hal_fcxp_send_comp()
680 fcxp->send_cbfn(fcxp->caller, fcxp, fcxp->send_cbarg, in hal_fcxp_send_comp()
681 fcxp_rsp->req_status, fcxp_rsp->rsp_len, in hal_fcxp_send_comp()
682 fcxp_rsp->residue_len, &fcxp_rsp->fchs); in hal_fcxp_send_comp()
688 fcxp->rsp_status = fcxp_rsp->req_status; in hal_fcxp_send_comp()
689 fcxp->rsp_len = fcxp_rsp->rsp_len; in hal_fcxp_send_comp()
690 fcxp->residue_len = fcxp_rsp->residue_len; in hal_fcxp_send_comp()
691 fcxp->rsp_fchs = fcxp_rsp->fchs; in hal_fcxp_send_comp()
693 bfa_cb_queue(bfa, &fcxp->hcb_qe, in hal_fcxp_send_comp()
697 bfa_trc(bfa, (NULL == fcxp->send_cbfn)); in hal_fcxp_send_comp()
709 if (fcxp->use_ireqbuf) { in hal_fcxp_tx_plog()
713 bfa_plog_fchdr_and_pl(bfa->plog, BFA_PL_MID_HAL_FCXP, in hal_fcxp_tx_plog()
718 bfa_plog_fchdr(bfa->plog, BFA_PL_MID_HAL_FCXP, in hal_fcxp_tx_plog()
724 bfa_plog_fchdr(bfa->plog, BFA_PL_MID_HAL_FCXP, BFA_PL_EID_TX, in hal_fcxp_tx_plog()
733 if (fcxp_rsp->rsp_len > 0) { in hal_fcxp_rx_plog()
734 if (fcxp->use_irspbuf) { in hal_fcxp_rx_plog()
738 bfa_plog_fchdr_and_pl(bfa->plog, BFA_PL_MID_HAL_FCXP, in hal_fcxp_rx_plog()
740 (u16) fcxp_rsp->rsp_len, in hal_fcxp_rx_plog()
741 &fcxp_rsp->fchs, pld_w0); in hal_fcxp_rx_plog()
743 bfa_plog_fchdr(bfa->plog, BFA_PL_MID_HAL_FCXP, in hal_fcxp_rx_plog()
745 (u16) fcxp_rsp->rsp_len, in hal_fcxp_rx_plog()
746 &fcxp_rsp->fchs); in hal_fcxp_rx_plog()
749 bfa_plog_fchdr(bfa->plog, BFA_PL_MID_HAL_FCXP, BFA_PL_EID_RX, in hal_fcxp_rx_plog()
750 (u16) fcxp_rsp->rsp_len, &fcxp_rsp->fchs); in hal_fcxp_rx_plog()
761 struct bfa_s *bfa = fcxp->fcxp_mod->bfa; in bfa_fcxp_qresume()
764 fcxp->reqq_waiting = BFA_FALSE; in bfa_fcxp_qresume()
775 struct bfa_s *bfa = fcxp->fcxp_mod->bfa; in bfa_fcxp_queue()
776 struct bfa_fcxp_req_info_s *reqi = &fcxp->req_info; in bfa_fcxp_queue()
777 struct bfa_fcxp_rsp_info_s *rspi = &fcxp->rsp_info; in bfa_fcxp_queue()
778 struct bfa_rport_s *rport = reqi->bfa_rport; in bfa_fcxp_queue()
780 bfi_h2i_set(send_req->mh, BFI_MC_FCXP, BFI_FCXP_H2I_SEND_REQ, in bfa_fcxp_queue()
783 send_req->fcxp_tag = cpu_to_be16(fcxp->fcxp_tag); in bfa_fcxp_queue()
785 send_req->rport_fw_hndl = rport->fw_handle; in bfa_fcxp_queue()
786 send_req->max_frmsz = cpu_to_be16(rport->rport_info.max_frmsz); in bfa_fcxp_queue()
787 if (send_req->max_frmsz == 0) in bfa_fcxp_queue()
788 send_req->max_frmsz = cpu_to_be16(FC_MAX_PDUSZ); in bfa_fcxp_queue()
790 send_req->rport_fw_hndl = 0; in bfa_fcxp_queue()
791 send_req->max_frmsz = cpu_to_be16(FC_MAX_PDUSZ); in bfa_fcxp_queue()
794 send_req->vf_id = cpu_to_be16(reqi->vf_id); in bfa_fcxp_queue()
795 send_req->lp_fwtag = bfa_lps_get_fwtag(bfa, reqi->lp_tag); in bfa_fcxp_queue()
796 send_req->class = reqi->class; in bfa_fcxp_queue()
797 send_req->rsp_timeout = rspi->rsp_timeout; in bfa_fcxp_queue()
798 send_req->cts = reqi->cts; in bfa_fcxp_queue()
799 send_req->fchs = reqi->fchs; in bfa_fcxp_queue()
801 send_req->req_len = cpu_to_be32(reqi->req_tot_len); in bfa_fcxp_queue()
802 send_req->rsp_maxlen = cpu_to_be32(rspi->rsp_maxlen); in bfa_fcxp_queue()
807 if (fcxp->use_ireqbuf == 1) { in bfa_fcxp_queue()
808 bfa_alen_set(&send_req->req_alen, reqi->req_tot_len, in bfa_fcxp_queue()
811 if (fcxp->nreq_sgles > 0) { in bfa_fcxp_queue()
812 WARN_ON(fcxp->nreq_sgles != 1); in bfa_fcxp_queue()
813 bfa_alen_set(&send_req->req_alen, reqi->req_tot_len, in bfa_fcxp_queue()
814 fcxp->req_sga_cbfn(fcxp->caller, 0)); in bfa_fcxp_queue()
816 WARN_ON(reqi->req_tot_len != 0); in bfa_fcxp_queue()
817 bfa_alen_set(&send_req->rsp_alen, 0, 0); in bfa_fcxp_queue()
824 if (fcxp->use_irspbuf == 1) { in bfa_fcxp_queue()
825 WARN_ON(rspi->rsp_maxlen > BFA_FCXP_MAX_LBUF_SZ); in bfa_fcxp_queue()
827 bfa_alen_set(&send_req->rsp_alen, rspi->rsp_maxlen, in bfa_fcxp_queue()
830 if (fcxp->nrsp_sgles > 0) { in bfa_fcxp_queue()
831 WARN_ON(fcxp->nrsp_sgles != 1); in bfa_fcxp_queue()
832 bfa_alen_set(&send_req->rsp_alen, rspi->rsp_maxlen, in bfa_fcxp_queue()
833 fcxp->rsp_sga_cbfn(fcxp->caller, 0)); in bfa_fcxp_queue()
836 WARN_ON(rspi->rsp_maxlen != 0); in bfa_fcxp_queue()
837 bfa_alen_set(&send_req->rsp_alen, 0, 0); in bfa_fcxp_queue()
841 hal_fcxp_tx_plog(bfa, reqi->req_tot_len, fcxp, &reqi->fchs); in bfa_fcxp_queue()
843 bfa_reqq_produce(bfa, BFA_REQQ_FCXP, send_req->mh); in bfa_fcxp_queue()
870 * request - BFA_TRUE, response - BFA_FALSE
889 bfa_trc(bfa, fcxp->fcxp_tag); in bfa_fcxp_req_rsp_alloc()
907 struct bfa_fcxp_mod_s *mod = fcxp->fcxp_mod; in bfa_fcxp_get_reqbuf()
910 WARN_ON(fcxp->use_ireqbuf != 1); in bfa_fcxp_get_reqbuf()
911 reqbuf = bfa_mem_get_dmabuf_kva(mod, fcxp->fcxp_tag, in bfa_fcxp_get_reqbuf()
912 mod->req_pld_sz + mod->rsp_pld_sz); in bfa_fcxp_get_reqbuf()
926 struct bfa_fcxp_mod_s *mod = fcxp->fcxp_mod; in bfa_fcxp_get_rspbuf()
929 WARN_ON(fcxp->use_irspbuf != 1); in bfa_fcxp_get_rspbuf()
931 fcxp_buf = bfa_mem_get_dmabuf_kva(mod, fcxp->fcxp_tag, in bfa_fcxp_get_rspbuf()
932 mod->req_pld_sz + mod->rsp_pld_sz); in bfa_fcxp_get_rspbuf()
934 /* fcxp_buf = req_buf + rsp_buf :- add req_buf_sz to get to rsp_buf */ in bfa_fcxp_get_rspbuf()
935 return ((u8 *) fcxp_buf) + mod->req_pld_sz; in bfa_fcxp_get_rspbuf()
948 struct bfa_fcxp_mod_s *mod = fcxp->fcxp_mod; in bfa_fcxp_free()
951 bfa_trc(mod->bfa, fcxp->fcxp_tag); in bfa_fcxp_free()
982 struct bfa_s *bfa = fcxp->fcxp_mod->bfa; in bfa_fcxp_send()
983 struct bfa_fcxp_req_info_s *reqi = &fcxp->req_info; in bfa_fcxp_send()
984 struct bfa_fcxp_rsp_info_s *rspi = &fcxp->rsp_info; in bfa_fcxp_send()
987 bfa_trc(bfa, fcxp->fcxp_tag); in bfa_fcxp_send()
992 reqi->bfa_rport = rport; in bfa_fcxp_send()
993 reqi->vf_id = vf_id; in bfa_fcxp_send()
994 reqi->lp_tag = lp_tag; in bfa_fcxp_send()
995 reqi->class = cos; in bfa_fcxp_send()
996 rspi->rsp_timeout = rsp_timeout; in bfa_fcxp_send()
997 reqi->cts = cts; in bfa_fcxp_send()
998 reqi->fchs = *fchs; in bfa_fcxp_send()
999 reqi->req_tot_len = reqlen; in bfa_fcxp_send()
1000 rspi->rsp_maxlen = rsp_maxlen; in bfa_fcxp_send()
1001 fcxp->send_cbfn = cbfn ? cbfn : bfa_fcxp_null_comp; in bfa_fcxp_send()
1002 fcxp->send_cbarg = cbarg; in bfa_fcxp_send()
1009 bfa_trc(bfa, fcxp->fcxp_tag); in bfa_fcxp_send()
1010 fcxp->reqq_waiting = BFA_TRUE; in bfa_fcxp_send()
1011 bfa_reqq_wait(bfa, BFA_REQQ_FCXP, &fcxp->reqq_wqe); in bfa_fcxp_send()
1030 WARN_ON(!list_empty(&mod->fcxp_req_free_q)); in bfa_fcxp_req_rsp_alloc_wait()
1032 WARN_ON(!list_empty(&mod->fcxp_rsp_free_q)); in bfa_fcxp_req_rsp_alloc_wait()
1034 wqe->alloc_cbfn = alloc_cbfn; in bfa_fcxp_req_rsp_alloc_wait()
1035 wqe->alloc_cbarg = alloc_cbarg; in bfa_fcxp_req_rsp_alloc_wait()
1036 wqe->caller = caller; in bfa_fcxp_req_rsp_alloc_wait()
1037 wqe->bfa = bfa; in bfa_fcxp_req_rsp_alloc_wait()
1038 wqe->nreq_sgles = nreq_sgles; in bfa_fcxp_req_rsp_alloc_wait()
1039 wqe->nrsp_sgles = nrsp_sgles; in bfa_fcxp_req_rsp_alloc_wait()
1040 wqe->req_sga_cbfn = req_sga_cbfn; in bfa_fcxp_req_rsp_alloc_wait()
1041 wqe->req_sglen_cbfn = req_sglen_cbfn; in bfa_fcxp_req_rsp_alloc_wait()
1042 wqe->rsp_sga_cbfn = rsp_sga_cbfn; in bfa_fcxp_req_rsp_alloc_wait()
1043 wqe->rsp_sglen_cbfn = rsp_sglen_cbfn; in bfa_fcxp_req_rsp_alloc_wait()
1046 list_add_tail(&wqe->qe, &mod->req_wait_q); in bfa_fcxp_req_rsp_alloc_wait()
1048 list_add_tail(&wqe->qe, &mod->rsp_wait_q); in bfa_fcxp_req_rsp_alloc_wait()
1056 WARN_ON(!bfa_q_is_on_q(&mod->req_wait_q, wqe) || in bfa_fcxp_walloc_cancel()
1057 !bfa_q_is_on_q(&mod->rsp_wait_q, wqe)); in bfa_fcxp_walloc_cancel()
1058 list_del(&wqe->qe); in bfa_fcxp_walloc_cancel()
1068 if (fcxp->reqq_waiting) { in bfa_fcxp_discard()
1069 fcxp->reqq_waiting = BFA_FALSE; in bfa_fcxp_discard()
1070 bfa_reqq_wcancel(&fcxp->reqq_wqe); in bfa_fcxp_discard()
1075 fcxp->send_cbfn = bfa_fcxp_null_comp; in bfa_fcxp_discard()
1081 switch (msg->mhdr.msg_id) { in bfa_fcxp_isr()
1087 bfa_trc(bfa, msg->mhdr.msg_id); in bfa_fcxp_isr()
1097 return mod->rsp_pld_sz; in bfa_fcxp_get_maxrsp()
1104 struct list_head *qe; in bfa_fcxp_res_recfg() local
1107 for (i = 0; i < (mod->num_fcxps - num_fcxp_fw); i++) { in bfa_fcxp_res_recfg()
1108 if (i < ((mod->num_fcxps - num_fcxp_fw) / 2)) { in bfa_fcxp_res_recfg()
1109 bfa_q_deq_tail(&mod->fcxp_req_free_q, &qe); in bfa_fcxp_res_recfg()
1110 list_add_tail(qe, &mod->fcxp_req_unused_q); in bfa_fcxp_res_recfg()
1112 bfa_q_deq_tail(&mod->fcxp_rsp_free_q, &qe); in bfa_fcxp_res_recfg()
1113 list_add_tail(qe, &mod->fcxp_rsp_unused_q); in bfa_fcxp_res_recfg()
1123 * Init state -- no login
1128 bfa_trc(lps->bfa, lps->bfa_tag); in bfa_lps_sm_init()
1129 bfa_trc(lps->bfa, event); in bfa_lps_sm_init()
1133 if (bfa_reqq_full(lps->bfa, lps->reqq)) { in bfa_lps_sm_init()
1135 bfa_reqq_wait(lps->bfa, lps->reqq, &lps->wqe); in bfa_lps_sm_init()
1141 if (lps->fdisc) in bfa_lps_sm_init()
1142 bfa_plog_str(lps->bfa->plog, BFA_PL_MID_LPS, in bfa_lps_sm_init()
1145 bfa_plog_str(lps->bfa->plog, BFA_PL_MID_LPS, in bfa_lps_sm_init()
1176 bfa_sm_fault(lps->bfa, event); in bfa_lps_sm_init()
1181 * login is in progress -- awaiting response from firmware
1186 bfa_trc(lps->bfa, lps->bfa_tag); in bfa_lps_sm_login()
1187 bfa_trc(lps->bfa, event); in bfa_lps_sm_login()
1191 if (lps->status == BFA_STATUS_OK) { in bfa_lps_sm_login()
1193 if (lps->fdisc) in bfa_lps_sm_login()
1194 bfa_plog_str(lps->bfa->plog, BFA_PL_MID_LPS, in bfa_lps_sm_login()
1197 bfa_plog_str(lps->bfa->plog, BFA_PL_MID_LPS, in bfa_lps_sm_login()
1200 bfa_trc(lps->bfa, lps->fport); in bfa_lps_sm_login()
1201 bfa_trc(lps->bfa, lps->lp_pid); in bfa_lps_sm_login()
1203 if (!lps->fport && lps->lp_pid) in bfa_lps_sm_login()
1207 if (lps->fdisc) in bfa_lps_sm_login()
1208 bfa_plog_str(lps->bfa->plog, BFA_PL_MID_LPS, in bfa_lps_sm_login()
1212 bfa_plog_str(lps->bfa->plog, BFA_PL_MID_LPS, in bfa_lps_sm_login()
1225 bfa_trc(lps->bfa, lps->fport); in bfa_lps_sm_login()
1226 bfa_trc(lps->bfa, lps->lp_pid); in bfa_lps_sm_login()
1230 bfa_sm_fault(lps->bfa, event); in bfa_lps_sm_login()
1235 * login pending - awaiting space in request queue
1240 bfa_trc(lps->bfa, lps->bfa_tag); in bfa_lps_sm_loginwait()
1241 bfa_trc(lps->bfa, event); in bfa_lps_sm_loginwait()
1252 bfa_reqq_wcancel(&lps->wqe); in bfa_lps_sm_loginwait()
1264 bfa_sm_fault(lps->bfa, event); in bfa_lps_sm_loginwait()
1274 bfa_trc(lps->bfa, lps->bfa_tag); in bfa_lps_sm_online()
1275 bfa_trc(lps->bfa, event); in bfa_lps_sm_online()
1279 if (bfa_reqq_full(lps->bfa, lps->reqq)) { in bfa_lps_sm_online()
1281 bfa_reqq_wait(lps->bfa, lps->reqq, &lps->wqe); in bfa_lps_sm_online()
1286 bfa_plog_str(lps->bfa->plog, BFA_PL_MID_LPS, in bfa_lps_sm_online()
1295 bfa_plog_str(lps->bfa->plog, BFA_PL_MID_LPS, in bfa_lps_sm_online()
1300 if (bfa_reqq_full(lps->bfa, lps->reqq)) { in bfa_lps_sm_online()
1302 bfa_reqq_wait(lps->bfa, lps->reqq, &lps->wqe); in bfa_lps_sm_online()
1313 bfa_sm_fault(lps->bfa, event); in bfa_lps_sm_online()
1323 bfa_trc(lps->bfa, lps->bfa_tag); in bfa_lps_sm_online_n2n_pid_wait()
1324 bfa_trc(lps->bfa, event); in bfa_lps_sm_online_n2n_pid_wait()
1334 bfa_plog_str(lps->bfa->plog, BFA_PL_MID_LPS, in bfa_lps_sm_online_n2n_pid_wait()
1340 bfa_reqq_wcancel(&lps->wqe); in bfa_lps_sm_online_n2n_pid_wait()
1344 bfa_plog_str(lps->bfa->plog, BFA_PL_MID_LPS, in bfa_lps_sm_online_n2n_pid_wait()
1351 bfa_reqq_wcancel(&lps->wqe); in bfa_lps_sm_online_n2n_pid_wait()
1355 bfa_sm_fault(lps->bfa, event); in bfa_lps_sm_online_n2n_pid_wait()
1360 * logout in progress - awaiting firmware response
1365 bfa_trc(lps->bfa, lps->bfa_tag); in bfa_lps_sm_logout()
1366 bfa_trc(lps->bfa, event); in bfa_lps_sm_logout()
1380 bfa_sm_fault(lps->bfa, event); in bfa_lps_sm_logout()
1385 * logout pending -- awaiting space in request queue
1390 bfa_trc(lps->bfa, lps->bfa_tag); in bfa_lps_sm_logowait()
1391 bfa_trc(lps->bfa, event); in bfa_lps_sm_logowait()
1402 bfa_reqq_wcancel(&lps->wqe); in bfa_lps_sm_logowait()
1406 bfa_sm_fault(lps->bfa, event); in bfa_lps_sm_logowait()
1425 if (cfg->drvcfg.min_cfg) in bfa_lps_meminfo()
1444 mod->num_lps = BFA_LPS_MAX_LPORTS; in bfa_lps_attach()
1445 if (cfg->drvcfg.min_cfg) in bfa_lps_attach()
1446 mod->num_lps = BFA_LPS_MIN_LPORTS; in bfa_lps_attach()
1448 mod->num_lps = BFA_LPS_MAX_LPORTS; in bfa_lps_attach()
1449 mod->lps_arr = lps = (struct bfa_lps_s *) bfa_mem_kva_curp(mod); in bfa_lps_attach()
1451 bfa_mem_kva_curp(mod) += mod->num_lps * sizeof(struct bfa_lps_s); in bfa_lps_attach()
1453 INIT_LIST_HEAD(&mod->lps_free_q); in bfa_lps_attach()
1454 INIT_LIST_HEAD(&mod->lps_active_q); in bfa_lps_attach()
1455 INIT_LIST_HEAD(&mod->lps_login_q); in bfa_lps_attach()
1457 for (i = 0; i < mod->num_lps; i++, lps++) { in bfa_lps_attach()
1458 lps->bfa = bfa; in bfa_lps_attach()
1459 lps->bfa_tag = (u8) i; in bfa_lps_attach()
1460 lps->reqq = BFA_REQQ_LPS; in bfa_lps_attach()
1461 bfa_reqq_winit(&lps->wqe, bfa_lps_reqq_resume, lps); in bfa_lps_attach()
1462 list_add_tail(&lps->qe, &mod->lps_free_q); in bfa_lps_attach()
1467 * IOC in disabled state -- consider all lps offline
1474 struct list_head *qe, *qen; in bfa_lps_iocdisable() local
1476 list_for_each_safe(qe, qen, &mod->lps_active_q) { in bfa_lps_iocdisable()
1477 lps = (struct bfa_lps_s *) qe; in bfa_lps_iocdisable()
1480 list_for_each_safe(qe, qen, &mod->lps_login_q) { in bfa_lps_iocdisable()
1481 lps = (struct bfa_lps_s *) qe; in bfa_lps_iocdisable()
1484 list_splice_tail_init(&mod->lps_login_q, &mod->lps_active_q); in bfa_lps_iocdisable()
1488 * Firmware login response
1496 WARN_ON(rsp->bfa_tag >= mod->num_lps); in bfa_lps_login_rsp()
1497 lps = BFA_LPS_FROM_TAG(mod, rsp->bfa_tag); in bfa_lps_login_rsp()
1499 lps->status = rsp->status; in bfa_lps_login_rsp()
1500 switch (rsp->status) { in bfa_lps_login_rsp()
1502 lps->fw_tag = rsp->fw_tag; in bfa_lps_login_rsp()
1503 lps->fport = rsp->f_port; in bfa_lps_login_rsp()
1504 if (lps->fport) in bfa_lps_login_rsp()
1505 lps->lp_pid = rsp->lp_pid; in bfa_lps_login_rsp()
1506 lps->npiv_en = rsp->npiv_en; in bfa_lps_login_rsp()
1507 lps->pr_bbcred = be16_to_cpu(rsp->bb_credit); in bfa_lps_login_rsp()
1508 lps->pr_pwwn = rsp->port_name; in bfa_lps_login_rsp()
1509 lps->pr_nwwn = rsp->node_name; in bfa_lps_login_rsp()
1510 lps->auth_req = rsp->auth_req; in bfa_lps_login_rsp()
1511 lps->lp_mac = rsp->lp_mac; in bfa_lps_login_rsp()
1512 lps->brcd_switch = rsp->brcd_switch; in bfa_lps_login_rsp()
1513 lps->fcf_mac = rsp->fcf_mac; in bfa_lps_login_rsp()
1518 lps->lsrjt_rsn = rsp->lsrjt_rsn; in bfa_lps_login_rsp()
1519 lps->lsrjt_expl = rsp->lsrjt_expl; in bfa_lps_login_rsp()
1524 lps->ext_status = rsp->ext_status; in bfa_lps_login_rsp()
1529 if (rsp->ext_status) in bfa_lps_login_rsp()
1530 bfa_lps_no_res(lps, rsp->ext_status); in bfa_lps_login_rsp()
1538 list_del(&lps->qe); in bfa_lps_login_rsp()
1539 list_add_tail(&lps->qe, &mod->lps_active_q); in bfa_lps_login_rsp()
1546 struct bfa_s *bfa = first_lps->bfa; in bfa_lps_no_res()
1548 struct list_head *qe, *qe_next; in bfa_lps_no_res() local
1553 qe = bfa_q_next(first_lps); in bfa_lps_no_res()
1555 while (count && qe) { in bfa_lps_no_res()
1556 qe_next = bfa_q_next(qe); in bfa_lps_no_res()
1557 lps = (struct bfa_lps_s *)qe; in bfa_lps_no_res()
1558 bfa_trc(bfa, lps->bfa_tag); in bfa_lps_no_res()
1559 lps->status = first_lps->status; in bfa_lps_no_res()
1560 list_del(&lps->qe); in bfa_lps_no_res()
1561 list_add_tail(&lps->qe, &mod->lps_active_q); in bfa_lps_no_res()
1563 qe = qe_next; in bfa_lps_no_res()
1564 count--; in bfa_lps_no_res()
1569 * Firmware logout response
1577 WARN_ON(rsp->bfa_tag >= mod->num_lps); in bfa_lps_logout_rsp()
1578 lps = BFA_LPS_FROM_TAG(mod, rsp->bfa_tag); in bfa_lps_logout_rsp()
1584 * Firmware received a Clear virtual link request (for FCoE)
1592 lps = BFA_LPS_FROM_TAG(mod, cvl->bfa_tag); in bfa_lps_rx_cvl_event()
1598 * Space is available in request queue, resume queueing request to firmware.
1609 * lps is freed -- triggered by vport delete
1614 struct bfa_lps_mod_s *mod = BFA_LPS_MOD(lps->bfa); in bfa_lps_free()
1616 lps->lp_pid = 0; in bfa_lps_free()
1617 list_del(&lps->qe); in bfa_lps_free()
1618 list_add_tail(&lps->qe, &mod->lps_free_q); in bfa_lps_free()
1622 * send login request to firmware
1627 struct bfa_lps_mod_s *mod = BFA_LPS_MOD(lps->bfa); in bfa_lps_send_login()
1630 m = bfa_reqq_next(lps->bfa, lps->reqq); in bfa_lps_send_login()
1633 bfi_h2i_set(m->mh, BFI_MC_LPS, BFI_LPS_H2I_LOGIN_REQ, in bfa_lps_send_login()
1634 bfa_fn_lpu(lps->bfa)); in bfa_lps_send_login()
1636 m->bfa_tag = lps->bfa_tag; in bfa_lps_send_login()
1637 m->alpa = lps->alpa; in bfa_lps_send_login()
1638 m->pdu_size = cpu_to_be16(lps->pdusz); in bfa_lps_send_login()
1639 m->pwwn = lps->pwwn; in bfa_lps_send_login()
1640 m->nwwn = lps->nwwn; in bfa_lps_send_login()
1641 m->fdisc = lps->fdisc; in bfa_lps_send_login()
1642 m->auth_en = lps->auth_en; in bfa_lps_send_login()
1644 bfa_reqq_produce(lps->bfa, lps->reqq, m->mh); in bfa_lps_send_login()
1645 list_del(&lps->qe); in bfa_lps_send_login()
1646 list_add_tail(&lps->qe, &mod->lps_login_q); in bfa_lps_send_login()
1650 * send logout request to firmware
1657 m = bfa_reqq_next(lps->bfa, lps->reqq); in bfa_lps_send_logout()
1660 bfi_h2i_set(m->mh, BFI_MC_LPS, BFI_LPS_H2I_LOGOUT_REQ, in bfa_lps_send_logout()
1661 bfa_fn_lpu(lps->bfa)); in bfa_lps_send_logout()
1663 m->fw_tag = lps->fw_tag; in bfa_lps_send_logout()
1664 m->port_name = lps->pwwn; in bfa_lps_send_logout()
1665 bfa_reqq_produce(lps->bfa, lps->reqq, m->mh); in bfa_lps_send_logout()
1669 * send n2n pid set request to firmware
1676 m = bfa_reqq_next(lps->bfa, lps->reqq); in bfa_lps_send_set_n2n_pid()
1679 bfi_h2i_set(m->mh, BFI_MC_LPS, BFI_LPS_H2I_N2N_PID_REQ, in bfa_lps_send_set_n2n_pid()
1680 bfa_fn_lpu(lps->bfa)); in bfa_lps_send_set_n2n_pid()
1682 m->fw_tag = lps->fw_tag; in bfa_lps_send_set_n2n_pid()
1683 m->lp_pid = lps->lp_pid; in bfa_lps_send_set_n2n_pid()
1684 bfa_reqq_produce(lps->bfa, lps->reqq, m->mh); in bfa_lps_send_set_n2n_pid()
1688 * Indirect login completion handler for non-fcs
1698 if (lps->fdisc) in bfa_lps_login_comp_cb()
1699 bfa_cb_lps_fdisc_comp(lps->bfa->bfad, lps->uarg, lps->status); in bfa_lps_login_comp_cb()
1701 bfa_cb_lps_flogi_comp(lps->bfa->bfad, lps->uarg, lps->status); in bfa_lps_login_comp_cb()
1705 * Login completion handler -- direct call for fcs, queue for others
1710 if (!lps->bfa->fcs) { in bfa_lps_login_comp()
1711 bfa_cb_queue(lps->bfa, &lps->hcb_qe, bfa_lps_login_comp_cb, in bfa_lps_login_comp()
1716 if (lps->fdisc) in bfa_lps_login_comp()
1717 bfa_cb_lps_fdisc_comp(lps->bfa->bfad, lps->uarg, lps->status); in bfa_lps_login_comp()
1719 bfa_cb_lps_flogi_comp(lps->bfa->bfad, lps->uarg, lps->status); in bfa_lps_login_comp()
1723 * Indirect logout completion handler for non-fcs
1733 if (lps->fdisc) in bfa_lps_logout_comp_cb()
1734 bfa_cb_lps_fdisclogo_comp(lps->bfa->bfad, lps->uarg); in bfa_lps_logout_comp_cb()
1736 bfa_cb_lps_flogo_comp(lps->bfa->bfad, lps->uarg); in bfa_lps_logout_comp_cb()
1740 * Logout completion handler -- direct call for fcs, queue for others
1745 if (!lps->bfa->fcs) { in bfa_lps_logout_comp()
1746 bfa_cb_queue(lps->bfa, &lps->hcb_qe, bfa_lps_logout_comp_cb, in bfa_lps_logout_comp()
1750 if (lps->fdisc) in bfa_lps_logout_comp()
1751 bfa_cb_lps_fdisclogo_comp(lps->bfa->bfad, lps->uarg); in bfa_lps_logout_comp()
1755 * Clear virtual link completion handler for non-fcs
1766 if (lps->fdisc) in bfa_lps_cvl_event_cb()
1767 bfa_cb_lps_cvl_event(lps->bfa->bfad, lps->uarg); in bfa_lps_cvl_event_cb()
1771 * Received Clear virtual link event --direct call for fcs,
1777 if (!lps->bfa->fcs) { in bfa_lps_cvl_event()
1778 bfa_cb_queue(lps->bfa, &lps->hcb_qe, bfa_lps_cvl_event_cb, in bfa_lps_cvl_event()
1784 if (lps->fdisc) in bfa_lps_cvl_event()
1785 bfa_cb_lps_cvl_event(lps->bfa->bfad, lps->uarg); in bfa_lps_cvl_event()
1797 if (bfa_ioc_devid(&bfa->ioc) == BFA_PCI_DEVICE_ID_CT) in bfa_lps_get_max_vport()
1812 bfa_q_deq(&mod->lps_free_q, &lps); in bfa_lps_alloc()
1817 list_add_tail(&lps->qe, &mod->lps_active_q); in bfa_lps_alloc()
1840 lps->uarg = uarg; in bfa_lps_flogi()
1841 lps->alpa = alpa; in bfa_lps_flogi()
1842 lps->pdusz = pdusz; in bfa_lps_flogi()
1843 lps->pwwn = pwwn; in bfa_lps_flogi()
1844 lps->nwwn = nwwn; in bfa_lps_flogi()
1845 lps->fdisc = BFA_FALSE; in bfa_lps_flogi()
1846 lps->auth_en = auth_en; in bfa_lps_flogi()
1857 lps->uarg = uarg; in bfa_lps_fdisc()
1858 lps->alpa = 0; in bfa_lps_fdisc()
1859 lps->pdusz = pdusz; in bfa_lps_fdisc()
1860 lps->pwwn = pwwn; in bfa_lps_fdisc()
1861 lps->nwwn = nwwn; in bfa_lps_fdisc()
1862 lps->fdisc = BFA_TRUE; in bfa_lps_fdisc()
1863 lps->auth_en = BFA_FALSE; in bfa_lps_fdisc()
1882 return BFA_LPS_FROM_TAG(mod, lp_tag)->fw_tag; in bfa_lps_get_fwtag()
1895 for (i = 0, lps = mod->lps_arr; i < mod->num_lps; i++, lps++) { in bfa_lps_get_tag_from_pid()
1896 if (lps->lp_pid == pid) in bfa_lps_get_tag_from_pid()
1897 return lps->bfa_tag; in bfa_lps_get_tag_from_pid()
1913 return BFA_LPS_FROM_TAG(mod, 0)->lp_pid; in bfa_lps_get_base_pid()
1922 bfa_trc(lps->bfa, lps->bfa_tag); in bfa_lps_set_n2n_pid()
1923 bfa_trc(lps->bfa, n2n_pid); in bfa_lps_set_n2n_pid()
1925 lps->lp_pid = n2n_pid; in bfa_lps_set_n2n_pid()
1930 * LPS firmware message class handler.
1937 bfa_trc(bfa, m->mhdr.msg_id); in bfa_lps_isr()
1940 switch (m->mhdr.msg_id) { in bfa_lps_isr()
1954 bfa_trc(bfa, m->mhdr.msg_id); in bfa_lps_isr()
1962 struct bfad_s *bfad = (struct bfad_s *)fcport->bfa->bfad; in bfa_fcport_aen_post()
1969 aen_entry->aen_data.port.ioc_type = bfa_get_type(fcport->bfa); in bfa_fcport_aen_post()
1970 aen_entry->aen_data.port.pwwn = fcport->pwwn; in bfa_fcport_aen_post()
1973 bfad_im_post_vendor_event(aen_entry, bfad, ++fcport->bfa->bfa_aen_seq, in bfa_fcport_aen_post()
1984 bfa_trc(fcport->bfa, event); in bfa_fcport_sm_uninit()
1991 fcport->use_flash_cfg = BFA_TRUE; in bfa_fcport_sm_uninit()
1994 bfa_trc(fcport->bfa, BFA_TRUE); in bfa_fcport_sm_uninit()
1997 bfa_trc(fcport->bfa, BFA_FALSE); in bfa_fcport_sm_uninit()
2024 bfa_sm_fault(fcport->bfa, event); in bfa_fcport_sm_uninit()
2033 struct bfad_s *bfad = (struct bfad_s *)fcport->bfa->bfad; in bfa_fcport_sm_enabling_qwait()
2034 bfa_trc(fcport->bfa, event); in bfa_fcport_sm_enabling_qwait()
2043 bfa_reqq_wcancel(&fcport->reqq_wait); in bfa_fcport_sm_enabling_qwait()
2055 * Just send disable request to firmware when room becomes in bfa_fcport_sm_enabling_qwait()
2059 bfa_reqq_wcancel(&fcport->reqq_wait); in bfa_fcport_sm_enabling_qwait()
2060 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL, in bfa_fcport_sm_enabling_qwait()
2062 wwn2str(pwwn_buf, fcport->pwwn); in bfa_fcport_sm_enabling_qwait()
2071 * Possible to get link events when doing back-to-back in bfa_fcport_sm_enabling_qwait()
2077 bfa_reqq_wcancel(&fcport->reqq_wait); in bfa_fcport_sm_enabling_qwait()
2088 bfa_sm_fault(fcport->bfa, event); in bfa_fcport_sm_enabling_qwait()
2097 struct bfad_s *bfad = (struct bfad_s *)fcport->bfa->bfad; in bfa_fcport_sm_enabling()
2098 bfa_trc(fcport->bfa, event); in bfa_fcport_sm_enabling()
2110 WARN_ON(!fcport->event_cbfn); in bfa_fcport_sm_enabling()
2127 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL, in bfa_fcport_sm_enabling()
2129 wwn2str(pwwn_buf, fcport->pwwn); in bfa_fcport_sm_enabling()
2150 bfa_sm_fault(fcport->bfa, event); in bfa_fcport_sm_enabling()
2158 struct bfi_fcport_event_s *pevent = fcport->event_arg.i2hmsg.event; in bfa_fcport_sm_linkdown()
2160 struct bfad_s *bfad = (struct bfad_s *)fcport->bfa->bfad; in bfa_fcport_sm_linkdown()
2162 bfa_trc(fcport->bfa, event); in bfa_fcport_sm_linkdown()
2168 WARN_ON(!fcport->event_cbfn); in bfa_fcport_sm_linkdown()
2169 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL, in bfa_fcport_sm_linkdown()
2171 if (!bfa_ioc_get_fcmode(&fcport->bfa->ioc)) { in bfa_fcport_sm_linkdown()
2173 bfa_trc(fcport->bfa, in bfa_fcport_sm_linkdown()
2174 pevent->link_state.attr.vc_fcf.fcf.fipenabled); in bfa_fcport_sm_linkdown()
2175 bfa_trc(fcport->bfa, in bfa_fcport_sm_linkdown()
2176 pevent->link_state.attr.vc_fcf.fcf.fipfailed); in bfa_fcport_sm_linkdown()
2178 if (pevent->link_state.attr.vc_fcf.fcf.fipfailed) in bfa_fcport_sm_linkdown()
2179 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL, in bfa_fcport_sm_linkdown()
2183 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL, in bfa_fcport_sm_linkdown()
2189 wwn2str(pwwn_buf, fcport->pwwn); in bfa_fcport_sm_linkdown()
2195 if (fcport->cfg.qos_enabled && in bfa_fcport_sm_linkdown()
2196 fcport->qos_attr.state != BFA_QOS_ONLINE) in bfa_fcport_sm_linkdown()
2219 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL, in bfa_fcport_sm_linkdown()
2221 wwn2str(pwwn_buf, fcport->pwwn); in bfa_fcport_sm_linkdown()
2242 bfa_sm_fault(fcport->bfa, event); in bfa_fcport_sm_linkdown()
2251 struct bfad_s *bfad = (struct bfad_s *)fcport->bfa->bfad; in bfa_fcport_sm_linkup()
2253 bfa_trc(fcport->bfa, event); in bfa_fcport_sm_linkup()
2271 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL, in bfa_fcport_sm_linkup()
2273 wwn2str(pwwn_buf, fcport->pwwn); in bfa_fcport_sm_linkup()
2286 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL, in bfa_fcport_sm_linkup()
2288 wwn2str(pwwn_buf, fcport->pwwn); in bfa_fcport_sm_linkup()
2289 if (BFA_PORT_IS_DISABLED(fcport->bfa)) { in bfa_fcport_sm_linkup()
2304 wwn2str(pwwn_buf, fcport->pwwn); in bfa_fcport_sm_linkup()
2305 if (BFA_PORT_IS_DISABLED(fcport->bfa)) { in bfa_fcport_sm_linkup()
2321 wwn2str(pwwn_buf, fcport->pwwn); in bfa_fcport_sm_linkup()
2322 if (BFA_PORT_IS_DISABLED(fcport->bfa)) { in bfa_fcport_sm_linkup()
2341 bfa_sm_fault(fcport->bfa, event); in bfa_fcport_sm_linkup()
2349 bfa_trc(fcport->bfa, event); in bfa_fcport_sm_disabling_qwait()
2359 bfa_reqq_wcancel(&fcport->reqq_wait); in bfa_fcport_sm_disabling_qwait()
2375 * Possible to get link events when doing back-to-back in bfa_fcport_sm_disabling_qwait()
2382 bfa_reqq_wcancel(&fcport->reqq_wait); in bfa_fcport_sm_disabling_qwait()
2392 bfa_sm_fault(fcport->bfa, event); in bfa_fcport_sm_disabling_qwait()
2400 bfa_trc(fcport->bfa, event); in bfa_fcport_sm_toggling_qwait()
2415 bfa_reqq_wcancel(&fcport->reqq_wait); in bfa_fcport_sm_toggling_qwait()
2428 * Possible to get link events when doing back-to-back in bfa_fcport_sm_toggling_qwait()
2435 bfa_reqq_wcancel(&fcport->reqq_wait); in bfa_fcport_sm_toggling_qwait()
2439 bfa_sm_fault(fcport->bfa, event); in bfa_fcport_sm_toggling_qwait()
2448 struct bfad_s *bfad = (struct bfad_s *)fcport->bfa->bfad; in bfa_fcport_sm_disabling()
2449 bfa_trc(fcport->bfa, event); in bfa_fcport_sm_disabling()
2469 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL, in bfa_fcport_sm_disabling()
2471 wwn2str(pwwn_buf, fcport->pwwn); in bfa_fcport_sm_disabling()
2484 * Possible to get link events when doing back-to-back in bfa_fcport_sm_disabling()
2494 bfa_sm_fault(fcport->bfa, event); in bfa_fcport_sm_disabling()
2503 struct bfad_s *bfad = (struct bfad_s *)fcport->bfa->bfad; in bfa_fcport_sm_disabled()
2504 bfa_trc(fcport->bfa, event); in bfa_fcport_sm_disabled()
2524 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL, in bfa_fcport_sm_disabled()
2526 wwn2str(pwwn_buf, fcport->pwwn); in bfa_fcport_sm_disabled()
2551 bfa_sm_fault(fcport->bfa, event); in bfa_fcport_sm_disabled()
2559 bfa_trc(fcport->bfa, event); in bfa_fcport_sm_stopped()
2585 bfa_trc(fcport->bfa, event); in bfa_fcport_sm_iocdown()
2611 bfa_trc(fcport->bfa, event); in bfa_fcport_sm_iocfail()
2633 bfa_trc(fcport->bfa, event); in bfa_fcport_sm_dport()
2658 bfa_sm_fault(fcport->bfa, event); in bfa_fcport_sm_dport()
2666 bfa_trc(fcport->bfa, event); in bfa_fcport_sm_ddport()
2692 bfa_sm_fault(fcport->bfa, event); in bfa_fcport_sm_ddport()
2700 bfa_trc(fcport->bfa, event); in bfa_fcport_sm_faa_misconfig()
2719 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL, in bfa_fcport_sm_faa_misconfig()
2735 bfa_sm_fault(fcport->bfa, event); in bfa_fcport_sm_faa_misconfig()
2746 bfa_trc(ln->fcport->bfa, event); in bfa_fcport_ln_sm_dn()
2755 bfa_sm_fault(ln->fcport->bfa, event); in bfa_fcport_ln_sm_dn()
2766 bfa_trc(ln->fcport->bfa, event); in bfa_fcport_ln_sm_dn_nf()
2778 bfa_sm_fault(ln->fcport->bfa, event); in bfa_fcport_ln_sm_dn_nf()
2789 bfa_trc(ln->fcport->bfa, event); in bfa_fcport_ln_sm_dn_up_nf()
2802 bfa_sm_fault(ln->fcport->bfa, event); in bfa_fcport_ln_sm_dn_up_nf()
2813 bfa_trc(ln->fcport->bfa, event); in bfa_fcport_ln_sm_up()
2822 bfa_sm_fault(ln->fcport->bfa, event); in bfa_fcport_ln_sm_up()
2833 bfa_trc(ln->fcport->bfa, event); in bfa_fcport_ln_sm_up_nf()
2845 bfa_sm_fault(ln->fcport->bfa, event); in bfa_fcport_ln_sm_up_nf()
2856 bfa_trc(ln->fcport->bfa, event); in bfa_fcport_ln_sm_up_dn_nf()
2869 bfa_sm_fault(ln->fcport->bfa, event); in bfa_fcport_ln_sm_up_dn_nf()
2880 bfa_trc(ln->fcport->bfa, event); in bfa_fcport_ln_sm_up_dn_up_nf()
2893 bfa_sm_fault(ln->fcport->bfa, event); in bfa_fcport_ln_sm_up_dn_up_nf()
2903 ln->fcport->event_cbfn(ln->fcport->event_cbarg, ln->ln_event); in __bfa_cb_fcport_event()
2910 * trunk - false if caller is fcport to ignore fcport event in trunked mode
2916 if (fcport->cfg.trunked && !trunk) in bfa_fcport_scn()
2921 bfa_sm_send_event(&fcport->ln, BFA_FCPORT_LN_SM_LINKUP); in bfa_fcport_scn()
2924 bfa_sm_send_event(&fcport->ln, BFA_FCPORT_LN_SM_LINKDOWN); in bfa_fcport_scn()
2934 struct bfa_fcport_s *fcport = ln->fcport; in bfa_fcport_queue_cb()
2936 if (fcport->bfa->fcs) { in bfa_fcport_queue_cb()
2937 fcport->event_cbfn(fcport->event_cbarg, event); in bfa_fcport_queue_cb()
2940 ln->ln_event = event; in bfa_fcport_queue_cb()
2941 bfa_cb_queue(fcport->bfa, &ln->ln_qe, in bfa_fcport_queue_cb()
2969 struct bfa_mem_dma_s *fcport_dma = &fcport->fcport_dma; in bfa_fcport_mem_claim()
2971 fcport->stats_kva = bfa_mem_dma_virt(fcport_dma); in bfa_fcport_mem_claim()
2972 fcport->stats_pa = bfa_mem_dma_phys(fcport_dma); in bfa_fcport_mem_claim()
2973 fcport->stats = (union bfa_fcport_stats_u *) in bfa_fcport_mem_claim()
2985 struct bfa_port_cfg_s *port_cfg = &fcport->cfg; in bfa_fcport_attach()
2986 struct bfa_fcport_ln_s *ln = &fcport->ln; in bfa_fcport_attach()
2988 fcport->bfa = bfa; in bfa_fcport_attach()
2989 ln->fcport = fcport; in bfa_fcport_attach()
2999 fcport->stats_reset_time = ktime_get_seconds(); in bfa_fcport_attach()
3000 fcport->stats_dma_ready = BFA_FALSE; in bfa_fcport_attach()
3005 port_cfg->topology = BFA_PORT_TOPOLOGY_P2P; in bfa_fcport_attach()
3006 port_cfg->speed = BFA_PORT_SPEED_AUTO; in bfa_fcport_attach()
3007 port_cfg->trunked = BFA_FALSE; in bfa_fcport_attach()
3008 port_cfg->maxfrsize = 0; in bfa_fcport_attach()
3010 port_cfg->trl_def_speed = BFA_PORT_SPEED_1GBPS; in bfa_fcport_attach()
3011 port_cfg->qos_bw.high = BFA_QOS_BW_HIGH; in bfa_fcport_attach()
3012 port_cfg->qos_bw.med = BFA_QOS_BW_MED; in bfa_fcport_attach()
3013 port_cfg->qos_bw.low = BFA_QOS_BW_LOW; in bfa_fcport_attach()
3015 fcport->fec_state = BFA_FEC_OFFLINE; in bfa_fcport_attach()
3017 INIT_LIST_HEAD(&fcport->stats_pending_q); in bfa_fcport_attach()
3018 INIT_LIST_HEAD(&fcport->statsclr_pending_q); in bfa_fcport_attach()
3020 bfa_reqq_winit(&fcport->reqq_wait, bfa_fcport_qresume, fcport); in bfa_fcport_attach()
3048 fcport->myalpa = loop_info->myalpa; in bfa_fcport_update_loop_info()
3049 fcport->alpabm_valid = in bfa_fcport_update_loop_info()
3050 loop_info->alpabm_val; in bfa_fcport_update_loop_info()
3051 memcpy(fcport->alpabm.alpa_bm, in bfa_fcport_update_loop_info()
3052 loop_info->alpabm.alpa_bm, in bfa_fcport_update_loop_info()
3059 struct bfi_fcport_event_s *pevent = fcport->event_arg.i2hmsg.event; in bfa_fcport_update_linkinfo()
3060 struct bfa_fcport_trunk_s *trunk = &fcport->trunk; in bfa_fcport_update_linkinfo()
3062 fcport->speed = pevent->link_state.speed; in bfa_fcport_update_linkinfo()
3063 fcport->topology = pevent->link_state.topology; in bfa_fcport_update_linkinfo()
3065 if (fcport->topology == BFA_PORT_TOPOLOGY_LOOP) { in bfa_fcport_update_linkinfo()
3067 &pevent->link_state.attr.loop_info); in bfa_fcport_update_linkinfo()
3072 fcport->qos_attr = pevent->link_state.qos_attr; in bfa_fcport_update_linkinfo()
3073 fcport->qos_vc_attr = pevent->link_state.attr.vc_fcf.qos_vc_attr; in bfa_fcport_update_linkinfo()
3075 if (fcport->cfg.bb_cr_enabled) in bfa_fcport_update_linkinfo()
3076 fcport->bbcr_attr = pevent->link_state.attr.bbcr_attr; in bfa_fcport_update_linkinfo()
3078 fcport->fec_state = pevent->link_state.fec_state; in bfa_fcport_update_linkinfo()
3083 if (!fcport->cfg.trunked) in bfa_fcport_update_linkinfo()
3084 trunk->attr.state = BFA_TRUNK_DISABLED; in bfa_fcport_update_linkinfo()
3087 fcport->fcoe_vlan = in bfa_fcport_update_linkinfo()
3088 be16_to_cpu(pevent->link_state.attr.vc_fcf.fcf.vlan); in bfa_fcport_update_linkinfo()
3090 bfa_trc(fcport->bfa, fcport->speed); in bfa_fcport_update_linkinfo()
3091 bfa_trc(fcport->bfa, fcport->topology); in bfa_fcport_update_linkinfo()
3097 fcport->speed = BFA_PORT_SPEED_UNKNOWN; in bfa_fcport_reset_linkinfo()
3098 fcport->topology = BFA_PORT_TOPOLOGY_NONE; in bfa_fcport_reset_linkinfo()
3099 fcport->fec_state = BFA_FEC_OFFLINE; in bfa_fcport_reset_linkinfo()
3103 * Send port enable message to firmware.
3114 fcport->msgtag++; in bfa_fcport_send_enable()
3119 m = bfa_reqq_next(fcport->bfa, BFA_REQQ_PORT); in bfa_fcport_send_enable()
3121 bfa_reqq_wait(fcport->bfa, BFA_REQQ_PORT, in bfa_fcport_send_enable()
3122 &fcport->reqq_wait); in bfa_fcport_send_enable()
3126 bfi_h2i_set(m->mh, BFI_MC_FCPORT, BFI_FCPORT_H2I_ENABLE_REQ, in bfa_fcport_send_enable()
3127 bfa_fn_lpu(fcport->bfa)); in bfa_fcport_send_enable()
3128 m->nwwn = fcport->nwwn; in bfa_fcport_send_enable()
3129 m->pwwn = fcport->pwwn; in bfa_fcport_send_enable()
3130 m->port_cfg = fcport->cfg; in bfa_fcport_send_enable()
3131 m->msgtag = fcport->msgtag; in bfa_fcport_send_enable()
3132 m->port_cfg.maxfrsize = cpu_to_be16(fcport->cfg.maxfrsize); in bfa_fcport_send_enable()
3133 m->use_flash_cfg = fcport->use_flash_cfg; in bfa_fcport_send_enable()
3134 bfa_dma_be_addr_set(m->stats_dma_addr, fcport->stats_pa); in bfa_fcport_send_enable()
3135 bfa_trc(fcport->bfa, m->stats_dma_addr.a32.addr_lo); in bfa_fcport_send_enable()
3136 bfa_trc(fcport->bfa, m->stats_dma_addr.a32.addr_hi); in bfa_fcport_send_enable()
3139 * queue I/O message to firmware in bfa_fcport_send_enable()
3141 bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT, m->mh); in bfa_fcport_send_enable()
3146 * Send port disable message to firmware.
3157 fcport->msgtag++; in bfa_fcport_send_disable()
3162 m = bfa_reqq_next(fcport->bfa, BFA_REQQ_PORT); in bfa_fcport_send_disable()
3164 bfa_reqq_wait(fcport->bfa, BFA_REQQ_PORT, in bfa_fcport_send_disable()
3165 &fcport->reqq_wait); in bfa_fcport_send_disable()
3169 bfi_h2i_set(m->mh, BFI_MC_FCPORT, BFI_FCPORT_H2I_DISABLE_REQ, in bfa_fcport_send_disable()
3170 bfa_fn_lpu(fcport->bfa)); in bfa_fcport_send_disable()
3171 m->msgtag = fcport->msgtag; in bfa_fcport_send_disable()
3174 * queue I/O message to firmware in bfa_fcport_send_disable()
3176 bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT, m->mh); in bfa_fcport_send_disable()
3184 fcport->pwwn = fcport->bfa->ioc.attr->pwwn; in bfa_fcport_set_wwns()
3185 fcport->nwwn = fcport->bfa->ioc.attr->nwwn; in bfa_fcport_set_wwns()
3187 bfa_trc(fcport->bfa, fcport->pwwn); in bfa_fcport_set_wwns()
3188 bfa_trc(fcport->bfa, fcport->nwwn); in bfa_fcport_set_wwns()
3229 struct list_head *qe, *qen; in __bfa_cb_fcport_stats_get() local
3235 list_for_each_safe(qe, qen, &fcport->stats_pending_q) { in __bfa_cb_fcport_stats_get()
3236 bfa_q_deq(&fcport->stats_pending_q, &qe); in __bfa_cb_fcport_stats_get()
3237 cb = (struct bfa_cb_pending_q_s *)qe; in __bfa_cb_fcport_stats_get()
3238 if (fcport->stats_status == BFA_STATUS_OK) { in __bfa_cb_fcport_stats_get()
3239 ret = (union bfa_fcport_stats_u *)cb->data; in __bfa_cb_fcport_stats_get()
3241 if (bfa_ioc_get_fcmode(&fcport->bfa->ioc)) in __bfa_cb_fcport_stats_get()
3242 bfa_fcport_qos_stats_swap(&ret->fcqos, in __bfa_cb_fcport_stats_get()
3243 &fcport->stats->fcqos); in __bfa_cb_fcport_stats_get()
3245 bfa_fcport_fcoe_stats_swap(&ret->fcoe, in __bfa_cb_fcport_stats_get()
3246 &fcport->stats->fcoe); in __bfa_cb_fcport_stats_get()
3247 ret->fcoe.secs_reset = in __bfa_cb_fcport_stats_get()
3248 time - fcport->stats_reset_time; in __bfa_cb_fcport_stats_get()
3251 bfa_cb_queue_status(fcport->bfa, &cb->hcb_qe, in __bfa_cb_fcport_stats_get()
3252 fcport->stats_status); in __bfa_cb_fcport_stats_get()
3254 fcport->stats_status = BFA_STATUS_OK; in __bfa_cb_fcport_stats_get()
3256 INIT_LIST_HEAD(&fcport->stats_pending_q); in __bfa_cb_fcport_stats_get()
3257 fcport->stats_status = BFA_STATUS_OK; in __bfa_cb_fcport_stats_get()
3266 bfa_trc(fcport->bfa, fcport->stats_qfull); in bfa_fcport_stats_get_timeout()
3268 if (fcport->stats_qfull) { in bfa_fcport_stats_get_timeout()
3269 bfa_reqq_wcancel(&fcport->stats_reqq_wait); in bfa_fcport_stats_get_timeout()
3270 fcport->stats_qfull = BFA_FALSE; in bfa_fcport_stats_get_timeout()
3273 fcport->stats_status = BFA_STATUS_ETIMER; in bfa_fcport_stats_get_timeout()
3283 msg = bfa_reqq_next(fcport->bfa, BFA_REQQ_PORT); in bfa_fcport_send_stats_get()
3286 fcport->stats_qfull = BFA_TRUE; in bfa_fcport_send_stats_get()
3287 bfa_reqq_winit(&fcport->stats_reqq_wait, in bfa_fcport_send_stats_get()
3289 bfa_reqq_wait(fcport->bfa, BFA_REQQ_PORT, in bfa_fcport_send_stats_get()
3290 &fcport->stats_reqq_wait); in bfa_fcport_send_stats_get()
3293 fcport->stats_qfull = BFA_FALSE; in bfa_fcport_send_stats_get()
3296 bfi_h2i_set(msg->mh, BFI_MC_FCPORT, BFI_FCPORT_H2I_STATS_GET_REQ, in bfa_fcport_send_stats_get()
3297 bfa_fn_lpu(fcport->bfa)); in bfa_fcport_send_stats_get()
3298 bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT, msg->mh); in bfa_fcport_send_stats_get()
3306 struct list_head *qe, *qen; in __bfa_cb_fcport_stats_clr() local
3310 * re-initialize time stamp for stats reset in __bfa_cb_fcport_stats_clr()
3312 fcport->stats_reset_time = ktime_get_seconds(); in __bfa_cb_fcport_stats_clr()
3313 list_for_each_safe(qe, qen, &fcport->statsclr_pending_q) { in __bfa_cb_fcport_stats_clr()
3314 bfa_q_deq(&fcport->statsclr_pending_q, &qe); in __bfa_cb_fcport_stats_clr()
3315 cb = (struct bfa_cb_pending_q_s *)qe; in __bfa_cb_fcport_stats_clr()
3316 bfa_cb_queue_status(fcport->bfa, &cb->hcb_qe, in __bfa_cb_fcport_stats_clr()
3317 fcport->stats_status); in __bfa_cb_fcport_stats_clr()
3319 fcport->stats_status = BFA_STATUS_OK; in __bfa_cb_fcport_stats_clr()
3321 INIT_LIST_HEAD(&fcport->statsclr_pending_q); in __bfa_cb_fcport_stats_clr()
3322 fcport->stats_status = BFA_STATUS_OK; in __bfa_cb_fcport_stats_clr()
3331 bfa_trc(fcport->bfa, fcport->stats_qfull); in bfa_fcport_stats_clr_timeout()
3333 if (fcport->stats_qfull) { in bfa_fcport_stats_clr_timeout()
3334 bfa_reqq_wcancel(&fcport->stats_reqq_wait); in bfa_fcport_stats_clr_timeout()
3335 fcport->stats_qfull = BFA_FALSE; in bfa_fcport_stats_clr_timeout()
3338 fcport->stats_status = BFA_STATUS_ETIMER; in bfa_fcport_stats_clr_timeout()
3348 msg = bfa_reqq_next(fcport->bfa, BFA_REQQ_PORT); in bfa_fcport_send_stats_clear()
3351 fcport->stats_qfull = BFA_TRUE; in bfa_fcport_send_stats_clear()
3352 bfa_reqq_winit(&fcport->stats_reqq_wait, in bfa_fcport_send_stats_clear()
3354 bfa_reqq_wait(fcport->bfa, BFA_REQQ_PORT, in bfa_fcport_send_stats_clear()
3355 &fcport->stats_reqq_wait); in bfa_fcport_send_stats_clear()
3358 fcport->stats_qfull = BFA_FALSE; in bfa_fcport_send_stats_clear()
3361 bfi_h2i_set(msg->mh, BFI_MC_FCPORT, BFI_FCPORT_H2I_STATS_CLEAR_REQ, in bfa_fcport_send_stats_clear()
3362 bfa_fn_lpu(fcport->bfa)); in bfa_fcport_send_stats_clear()
3363 bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT, msg->mh); in bfa_fcport_send_stats_clear()
3367 * Handle trunk SCN event from firmware.
3372 struct bfa_fcport_trunk_s *trunk = &fcport->trunk; in bfa_trunk_scn()
3379 bfa_trc(fcport->bfa, fcport->cfg.trunked); in bfa_trunk_scn()
3380 WARN_ON(scn->trunk_state != BFA_TRUNK_ONLINE && in bfa_trunk_scn()
3381 scn->trunk_state != BFA_TRUNK_OFFLINE); in bfa_trunk_scn()
3383 bfa_trc(fcport->bfa, trunk->attr.state); in bfa_trunk_scn()
3384 bfa_trc(fcport->bfa, scn->trunk_state); in bfa_trunk_scn()
3385 bfa_trc(fcport->bfa, scn->trunk_speed); in bfa_trunk_scn()
3390 state_prev = trunk->attr.state; in bfa_trunk_scn()
3391 if (fcport->cfg.trunked && (trunk->attr.state != BFA_TRUNK_DISABLED)) in bfa_trunk_scn()
3392 trunk->attr.state = scn->trunk_state; in bfa_trunk_scn()
3393 trunk->attr.speed = scn->trunk_speed; in bfa_trunk_scn()
3395 lattr = &trunk->attr.link_attr[i]; in bfa_trunk_scn()
3396 tlink = &scn->tlink[i]; in bfa_trunk_scn()
3398 lattr->link_state = tlink->state; in bfa_trunk_scn()
3399 lattr->trunk_wwn = tlink->trunk_wwn; in bfa_trunk_scn()
3400 lattr->fctl = tlink->fctl; in bfa_trunk_scn()
3401 lattr->speed = tlink->speed; in bfa_trunk_scn()
3402 lattr->deskew = be32_to_cpu(tlink->deskew); in bfa_trunk_scn()
3404 if (tlink->state == BFA_TRUNK_LINK_STATE_UP) { in bfa_trunk_scn()
3405 fcport->speed = tlink->speed; in bfa_trunk_scn()
3406 fcport->topology = BFA_PORT_TOPOLOGY_P2P; in bfa_trunk_scn()
3410 bfa_trc(fcport->bfa, lattr->link_state); in bfa_trunk_scn()
3411 bfa_trc(fcport->bfa, lattr->trunk_wwn); in bfa_trunk_scn()
3412 bfa_trc(fcport->bfa, lattr->fctl); in bfa_trunk_scn()
3413 bfa_trc(fcport->bfa, lattr->speed); in bfa_trunk_scn()
3414 bfa_trc(fcport->bfa, lattr->deskew); in bfa_trunk_scn()
3419 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL, in bfa_trunk_scn()
3423 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL, in bfa_trunk_scn()
3424 BFA_PL_EID_TRUNK_SCN, 0, "Trunk up(-,1)"); in bfa_trunk_scn()
3427 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL, in bfa_trunk_scn()
3428 BFA_PL_EID_TRUNK_SCN, 0, "Trunk up(0,-)"); in bfa_trunk_scn()
3431 bfa_plog_str(fcport->bfa->plog, BFA_PL_MID_HAL, in bfa_trunk_scn()
3438 if ((state_prev != trunk->attr.state) || in bfa_trunk_scn()
3439 (scn->trunk_state == BFA_TRUNK_OFFLINE)) { in bfa_trunk_scn()
3440 bfa_fcport_scn(fcport, (scn->trunk_state == BFA_TRUNK_ONLINE) ? in bfa_trunk_scn()
3454 if (fcport->cfg.trunked) { in bfa_trunk_iocdisable()
3455 if (fcport->trunk.attr.state == BFA_TRUNK_ONLINE) in bfa_trunk_iocdisable()
3458 fcport->trunk.attr.state = BFA_TRUNK_OFFLINE; in bfa_trunk_iocdisable()
3459 fcport->trunk.attr.speed = BFA_PORT_SPEED_UNKNOWN; in bfa_trunk_iocdisable()
3461 fcport->trunk.attr.link_attr[i].trunk_wwn = 0; in bfa_trunk_iocdisable()
3462 fcport->trunk.attr.link_attr[i].fctl = in bfa_trunk_iocdisable()
3464 fcport->trunk.attr.link_attr[i].link_state = in bfa_trunk_iocdisable()
3466 fcport->trunk.attr.link_attr[i].speed = in bfa_trunk_iocdisable()
3468 fcport->trunk.attr.link_attr[i].deskew = 0; in bfa_trunk_iocdisable()
3485 if (fcport->cfg.maxfrsize == 0) in bfa_fcport_init()
3486 fcport->cfg.maxfrsize = bfa_ioc_maxfrsize(&bfa->ioc); in bfa_fcport_init()
3487 fcport->cfg.rx_bbcredit = bfa_ioc_rx_bbcredit(&bfa->ioc); in bfa_fcport_init()
3488 fcport->speed_sup = bfa_ioc_speed_sup(&bfa->ioc); in bfa_fcport_init()
3491 bfa->modules.port.pbc_disabled = BFA_TRUE; in bfa_fcport_init()
3493 WARN_ON(!fcport->cfg.maxfrsize); in bfa_fcport_init()
3494 WARN_ON(!fcport->cfg.rx_bbcredit); in bfa_fcport_init()
3495 WARN_ON(!fcport->speed_sup); in bfa_fcport_init()
3499 * Firmware message handler.
3508 fcport->event_arg.i2hmsg = i2hmsg; in bfa_fcport_isr()
3510 bfa_trc(bfa, msg->mhdr.msg_id); in bfa_fcport_isr()
3511 bfa_trc(bfa, bfa_fcport_sm_to_state(hal_port_sm_table, fcport->sm)); in bfa_fcport_isr()
3513 switch (msg->mhdr.msg_id) { in bfa_fcport_isr()
3515 if (fcport->msgtag == i2hmsg.penable_rsp->msgtag) { in bfa_fcport_isr()
3517 fcport->stats_dma_ready = BFA_TRUE; in bfa_fcport_isr()
3518 if (fcport->use_flash_cfg) { in bfa_fcport_isr()
3519 fcport->cfg = i2hmsg.penable_rsp->port_cfg; in bfa_fcport_isr()
3520 fcport->cfg.maxfrsize = in bfa_fcport_isr()
3521 cpu_to_be16(fcport->cfg.maxfrsize); in bfa_fcport_isr()
3522 fcport->cfg.path_tov = in bfa_fcport_isr()
3523 cpu_to_be16(fcport->cfg.path_tov); in bfa_fcport_isr()
3524 fcport->cfg.q_depth = in bfa_fcport_isr()
3525 cpu_to_be16(fcport->cfg.q_depth); in bfa_fcport_isr()
3527 if (fcport->cfg.trunked) in bfa_fcport_isr()
3528 fcport->trunk.attr.state = in bfa_fcport_isr()
3531 fcport->trunk.attr.state = in bfa_fcport_isr()
3533 fcport->qos_attr.qos_bw = in bfa_fcport_isr()
3534 i2hmsg.penable_rsp->port_cfg.qos_bw; in bfa_fcport_isr()
3535 fcport->use_flash_cfg = BFA_FALSE; in bfa_fcport_isr()
3538 if (fcport->cfg.qos_enabled) in bfa_fcport_isr()
3539 fcport->qos_attr.state = BFA_QOS_OFFLINE; in bfa_fcport_isr()
3541 fcport->qos_attr.state = BFA_QOS_DISABLED; in bfa_fcport_isr()
3543 fcport->qos_attr.qos_bw_op = in bfa_fcport_isr()
3544 i2hmsg.penable_rsp->port_cfg.qos_bw; in bfa_fcport_isr()
3546 if (fcport->cfg.bb_cr_enabled) in bfa_fcport_isr()
3547 fcport->bbcr_attr.state = BFA_BBCR_OFFLINE; in bfa_fcport_isr()
3549 fcport->bbcr_attr.state = BFA_BBCR_DISABLED; in bfa_fcport_isr()
3556 if (fcport->msgtag == i2hmsg.penable_rsp->msgtag) in bfa_fcport_isr()
3561 if (fcport->cfg.bb_cr_enabled) in bfa_fcport_isr()
3562 fcport->bbcr_attr.state = BFA_BBCR_OFFLINE; in bfa_fcport_isr()
3564 fcport->bbcr_attr.state = BFA_BBCR_DISABLED; in bfa_fcport_isr()
3566 if (i2hmsg.event->link_state.linkstate == BFA_PORT_LINKUP) in bfa_fcport_isr()
3569 if (i2hmsg.event->link_state.linkstate_rsn == in bfa_fcport_isr()
3577 fcport->qos_attr.qos_bw_op = in bfa_fcport_isr()
3578 i2hmsg.event->link_state.qos_attr.qos_bw_op; in bfa_fcport_isr()
3589 if (list_empty(&fcport->stats_pending_q) || in bfa_fcport_isr()
3590 (fcport->stats_status == BFA_STATUS_ETIMER)) in bfa_fcport_isr()
3593 bfa_timer_stop(&fcport->timer); in bfa_fcport_isr()
3594 fcport->stats_status = i2hmsg.pstatsget_rsp->status; in bfa_fcport_isr()
3602 if (list_empty(&fcport->statsclr_pending_q) || in bfa_fcport_isr()
3603 (fcport->stats_status == BFA_STATUS_ETIMER)) in bfa_fcport_isr()
3606 bfa_timer_stop(&fcport->timer); in bfa_fcport_isr()
3607 fcport->stats_status = BFA_STATUS_OK; in bfa_fcport_isr()
3636 fcport->event_cbfn = cbfn; in bfa_fcport_event_register()
3637 fcport->event_cbarg = cbarg; in bfa_fcport_event_register()
3648 if (bfa_ioc_is_disabled(&bfa->ioc)) in bfa_fcport_enable()
3651 if (fcport->diag_busy) in bfa_fcport_enable()
3664 if (bfa_ioc_is_disabled(&bfa->ioc)) in bfa_fcport_disable()
3676 struct bfa_iocfc_s *iocfc = &bfa->iocfc; in bfa_fcport_is_pbcdisabled()
3677 struct bfi_iocfc_cfgrsp_s *cfgrsp = iocfc->cfgrsp; in bfa_fcport_is_pbcdisabled()
3679 if (cfgrsp->pbc_cfg.port_enabled == BFI_PBC_PORT_DISABLED) { in bfa_fcport_is_pbcdisabled()
3680 bfa_trc(bfa, fcport->pwwn); in bfa_fcport_is_pbcdisabled()
3696 if (fcport->cfg.trunked == BFA_TRUE) in bfa_fcport_cfg_speed()
3698 if ((fcport->cfg.topology == BFA_PORT_TOPOLOGY_LOOP) && in bfa_fcport_cfg_speed()
3701 if ((speed != BFA_PORT_SPEED_AUTO) && (speed > fcport->speed_sup)) { in bfa_fcport_cfg_speed()
3702 bfa_trc(bfa, fcport->speed_sup); in bfa_fcport_cfg_speed()
3707 if (bfa_ioc_get_type(&fcport->bfa->ioc) == BFA_IOC_TYPE_FC) { in bfa_fcport_cfg_speed()
3710 (bfa_asic_id_ct2(bfa->ioc.pcidev.device_id))) in bfa_fcport_cfg_speed()
3726 fcport->cfg.speed = speed; in bfa_fcport_cfg_speed()
3739 return fcport->speed; in bfa_fcport_get_speed()
3751 bfa_trc(bfa, fcport->cfg.topology); in bfa_fcport_cfg_topology()
3759 (fcport->qos_attr.state != BFA_QOS_DISABLED)) in bfa_fcport_cfg_topology()
3761 if (fcport->cfg.ratelimit != BFA_FALSE) in bfa_fcport_cfg_topology()
3764 (fcport->trunk.attr.state != BFA_TRUNK_DISABLED)) in bfa_fcport_cfg_topology()
3767 (fcport->cfg.speed == BFA_PORT_SPEED_16GBPS)) in bfa_fcport_cfg_topology()
3769 if (bfa_mfg_is_mezz(bfa->ioc.attr->card_type)) in bfa_fcport_cfg_topology()
3784 fcport->cfg.topology = topology; in bfa_fcport_cfg_topology()
3796 return fcport->topology; in bfa_fcport_get_topology()
3807 return fcport->cfg.topology; in bfa_fcport_get_cfg_topology()
3816 bfa_trc(bfa, fcport->cfg.cfg_hardalpa); in bfa_fcport_cfg_hardalpa()
3817 bfa_trc(bfa, fcport->cfg.hardalpa); in bfa_fcport_cfg_hardalpa()
3819 fcport->cfg.cfg_hardalpa = BFA_TRUE; in bfa_fcport_cfg_hardalpa()
3820 fcport->cfg.hardalpa = alpa; in bfa_fcport_cfg_hardalpa()
3830 bfa_trc(bfa, fcport->cfg.cfg_hardalpa); in bfa_fcport_clr_hardalpa()
3831 bfa_trc(bfa, fcport->cfg.hardalpa); in bfa_fcport_clr_hardalpa()
3833 fcport->cfg.cfg_hardalpa = BFA_FALSE; in bfa_fcport_clr_hardalpa()
3842 return fcport->myalpa; in bfa_fcport_get_myalpa()
3851 bfa_trc(bfa, fcport->cfg.maxfrsize); in bfa_fcport_cfg_maxfrsize()
3858 if ((maxfrsize != FC_MAX_PDUSZ) && (maxfrsize & (maxfrsize - 1))) in bfa_fcport_cfg_maxfrsize()
3861 fcport->cfg.maxfrsize = maxfrsize; in bfa_fcport_cfg_maxfrsize()
3870 return fcport->cfg.maxfrsize; in bfa_fcport_get_maxfrsize()
3877 return (BFA_FCPORT_MOD(bfa))->cfg.rx_bbcredit; in bfa_fcport_get_rx_bbcredit()
3888 fcport->cfg.tx_bbcredit = (u8)tx_bbcredit; in bfa_fcport_set_tx_bbcredit()
3901 attr->nwwn = fcport->nwwn; in bfa_fcport_get_attr()
3902 attr->pwwn = fcport->pwwn; in bfa_fcport_get_attr()
3904 attr->factorypwwn = bfa->ioc.attr->mfg_pwwn; in bfa_fcport_get_attr()
3905 attr->factorynwwn = bfa->ioc.attr->mfg_nwwn; in bfa_fcport_get_attr()
3907 memcpy(&attr->pport_cfg, &fcport->cfg, in bfa_fcport_get_attr()
3910 attr->pport_cfg.speed = fcport->cfg.speed; in bfa_fcport_get_attr()
3911 attr->speed_supported = fcport->speed_sup; in bfa_fcport_get_attr()
3912 attr->speed = fcport->speed; in bfa_fcport_get_attr()
3913 attr->cos_supported = FC_CLASS_3; in bfa_fcport_get_attr()
3916 attr->pport_cfg.topology = fcport->cfg.topology; in bfa_fcport_get_attr()
3917 attr->topology = fcport->topology; in bfa_fcport_get_attr()
3918 attr->pport_cfg.trunked = fcport->cfg.trunked; in bfa_fcport_get_attr()
3921 attr->beacon = fcport->beacon; in bfa_fcport_get_attr()
3922 attr->link_e2e_beacon = fcport->link_e2e_beacon; in bfa_fcport_get_attr()
3924 attr->pport_cfg.path_tov = bfa_fcpim_path_tov_get(bfa); in bfa_fcport_get_attr()
3925 attr->pport_cfg.q_depth = bfa_fcpim_qdepth_get(bfa); in bfa_fcport_get_attr()
3926 attr->port_state = bfa_fcport_sm_to_state(hal_port_sm_table, fcport->sm); in bfa_fcport_get_attr()
3928 attr->fec_state = fcport->fec_state; in bfa_fcport_get_attr()
3932 attr->port_state = BFA_PORT_ST_PREBOOT_DISABLED; in bfa_fcport_get_attr()
3934 if (bfa_ioc_is_disabled(&fcport->bfa->ioc)) in bfa_fcport_get_attr()
3935 attr->port_state = BFA_PORT_ST_IOCDIS; in bfa_fcport_get_attr()
3936 else if (bfa_ioc_fw_mismatch(&fcport->bfa->ioc)) in bfa_fcport_get_attr()
3937 attr->port_state = BFA_PORT_ST_FWMISMATCH; in bfa_fcport_get_attr()
3941 attr->fcoe_vlan = fcport->fcoe_vlan; in bfa_fcport_get_attr()
3955 !fcport->stats_dma_ready) in bfa_fcport_get_stats()
3958 if (!list_empty(&fcport->statsclr_pending_q)) in bfa_fcport_get_stats()
3961 if (list_empty(&fcport->stats_pending_q)) { in bfa_fcport_get_stats()
3962 list_add_tail(&cb->hcb_qe.qe, &fcport->stats_pending_q); in bfa_fcport_get_stats()
3964 bfa_timer_start(bfa, &fcport->timer, in bfa_fcport_get_stats()
3968 list_add_tail(&cb->hcb_qe.qe, &fcport->stats_pending_q); in bfa_fcport_get_stats()
3982 !fcport->stats_dma_ready) in bfa_fcport_clear_stats()
3985 if (!list_empty(&fcport->stats_pending_q)) in bfa_fcport_clear_stats()
3988 if (list_empty(&fcport->statsclr_pending_q)) { in bfa_fcport_clear_stats()
3989 list_add_tail(&cb->hcb_qe.qe, &fcport->statsclr_pending_q); in bfa_fcport_clear_stats()
3991 bfa_timer_start(bfa, &fcport->timer, in bfa_fcport_clear_stats()
3995 list_add_tail(&cb->hcb_qe.qe, &fcport->statsclr_pending_q); in bfa_fcport_clear_stats()
4008 return bfa_fcport_sm_to_state(hal_port_sm_table, fcport->sm) == in bfa_fcport_is_disabled()
4018 return (bfa_fcport_sm_to_state(hal_port_sm_table, fcport->sm) == in bfa_fcport_is_dport()
4027 return (bfa_fcport_sm_to_state(hal_port_sm_table, fcport->sm) == in bfa_fcport_is_ddport()
4039 if ((qos_bw->high == 0) || (qos_bw->med == 0) || (qos_bw->low == 0)) in bfa_fcport_set_qos_bw()
4042 if ((qos_bw->high + qos_bw->med + qos_bw->low) != 100) in bfa_fcport_set_qos_bw()
4045 if ((qos_bw->med > qos_bw->high) || (qos_bw->low > qos_bw->med) || in bfa_fcport_set_qos_bw()
4046 (qos_bw->low > qos_bw->high)) in bfa_fcport_set_qos_bw()
4050 (fcport->cfg.topology != BFA_PORT_TOPOLOGY_LOOP)) in bfa_fcport_set_qos_bw()
4051 fcport->cfg.qos_bw = *qos_bw; in bfa_fcport_set_qos_bw()
4061 return fcport->cfg.ratelimit ? BFA_TRUE : BFA_FALSE; in bfa_fcport_is_ratelim()
4073 bfa_trc(bfa, fcport->cfg.trl_def_speed); in bfa_fcport_get_ratelim_speed()
4074 return fcport->cfg.trl_def_speed; in bfa_fcport_get_ratelim_speed()
4087 bfa_trc(bfa, fcport->beacon); in bfa_fcport_beacon()
4088 bfa_trc(bfa, fcport->link_e2e_beacon); in bfa_fcport_beacon()
4090 fcport->beacon = beacon; in bfa_fcport_beacon()
4091 fcport->link_e2e_beacon = link_e2e_beacon; in bfa_fcport_beacon()
4099 return (!fcport->cfg.trunked && in bfa_fcport_is_linkup()
4101 (fcport->cfg.trunked && in bfa_fcport_is_linkup()
4102 fcport->trunk.attr.state == BFA_TRUNK_ONLINE); in bfa_fcport_is_linkup()
4110 return fcport->cfg.qos_enabled; in bfa_fcport_is_qos_enabled()
4118 return fcport->cfg.trunked; in bfa_fcport_is_trunk_enabled()
4128 if (bfa_ioc_get_type(&fcport->bfa->ioc) != BFA_IOC_TYPE_FC) in bfa_fcport_cfg_bbcr()
4131 if (bfa_mfg_is_mezz(bfa->ioc.attr->card_type) && in bfa_fcport_cfg_bbcr()
4132 (bfa->ioc.attr->card_type != BFA_MFG_TYPE_CHINOOK)) in bfa_fcport_cfg_bbcr()
4136 if (fcport->cfg.topology == BFA_PORT_TOPOLOGY_LOOP) in bfa_fcport_cfg_bbcr()
4139 if (fcport->cfg.qos_enabled) in bfa_fcport_cfg_bbcr()
4142 if (fcport->cfg.trunked) in bfa_fcport_cfg_bbcr()
4145 if ((fcport->cfg.speed != BFA_PORT_SPEED_AUTO) && in bfa_fcport_cfg_bbcr()
4146 (fcport->cfg.speed < bfa_ioc_speed_sup(&bfa->ioc))) in bfa_fcport_cfg_bbcr()
4149 if (bfa_ioc_speed_sup(&bfa->ioc) < BFA_PORT_SPEED_8GBPS) in bfa_fcport_cfg_bbcr()
4152 if (fcport->cfg.bb_cr_enabled) { in bfa_fcport_cfg_bbcr()
4153 if (bb_scn != fcport->cfg.bb_scn) in bfa_fcport_cfg_bbcr()
4162 fcport->cfg.bb_cr_enabled = on_off; in bfa_fcport_cfg_bbcr()
4163 fcport->cfg.bb_scn = bb_scn; in bfa_fcport_cfg_bbcr()
4165 if (!fcport->cfg.bb_cr_enabled) in bfa_fcport_cfg_bbcr()
4168 fcport->cfg.bb_cr_enabled = on_off; in bfa_fcport_cfg_bbcr()
4169 fcport->cfg.bb_scn = 0; in bfa_fcport_cfg_bbcr()
4181 if (bfa_ioc_get_type(&fcport->bfa->ioc) != BFA_IOC_TYPE_FC) in bfa_fcport_get_bbcr_attr()
4184 if (fcport->cfg.topology == BFA_PORT_TOPOLOGY_LOOP) in bfa_fcport_get_bbcr_attr()
4187 *bbcr_attr = fcport->bbcr_attr; in bfa_fcport_get_bbcr_attr()
4199 bfa_port_set_dportenabled(&bfa->modules.port, BFA_TRUE); in bfa_fcport_dportenable()
4209 bfa_port_set_dportenabled(&bfa->modules.port, BFA_FALSE); in bfa_fcport_dportdisable()
4239 bfa_trc(rp->bfa, rp->rport_tag); in bfa_rport_sm_uninit()
4240 bfa_trc(rp->bfa, event); in bfa_rport_sm_uninit()
4250 bfa_sm_fault(rp->bfa, event); in bfa_rport_sm_uninit()
4257 bfa_trc(rp->bfa, rp->rport_tag); in bfa_rport_sm_created()
4258 bfa_trc(rp->bfa, event); in bfa_rport_sm_created()
4282 bfa_sm_fault(rp->bfa, event); in bfa_rport_sm_created()
4287 * Waiting for rport create response from firmware.
4292 bfa_trc(rp->bfa, rp->rport_tag); in bfa_rport_sm_fwcreate()
4293 bfa_trc(rp->bfa, event); in bfa_rport_sm_fwcreate()
4319 bfa_sm_fault(rp->bfa, event); in bfa_rport_sm_fwcreate()
4329 bfa_trc(rp->bfa, rp->rport_tag); in bfa_rport_sm_fwcreate_qfull()
4330 bfa_trc(rp->bfa, event); in bfa_rport_sm_fwcreate_qfull()
4341 bfa_reqq_wcancel(&rp->reqq_wait); in bfa_rport_sm_fwcreate_qfull()
4348 bfa_reqq_wcancel(&rp->reqq_wait); in bfa_rport_sm_fwcreate_qfull()
4355 bfa_reqq_wcancel(&rp->reqq_wait); in bfa_rport_sm_fwcreate_qfull()
4360 bfa_sm_fault(rp->bfa, event); in bfa_rport_sm_fwcreate_qfull()
4365 * Online state - normal parking state.
4372 bfa_trc(rp->bfa, rp->rport_tag); in bfa_rport_sm_online()
4373 bfa_trc(rp->bfa, event); in bfa_rport_sm_online()
4402 qos_scn = (struct bfi_rport_qos_scn_s *) rp->event_arg.fw_msg; in bfa_rport_sm_online()
4403 rp->qos_attr = qos_scn->new_qos_attr; in bfa_rport_sm_online()
4404 bfa_trc(rp->bfa, qos_scn->old_qos_attr.qos_flow_id); in bfa_rport_sm_online()
4405 bfa_trc(rp->bfa, qos_scn->new_qos_attr.qos_flow_id); in bfa_rport_sm_online()
4406 bfa_trc(rp->bfa, qos_scn->old_qos_attr.qos_priority); in bfa_rport_sm_online()
4407 bfa_trc(rp->bfa, qos_scn->new_qos_attr.qos_priority); in bfa_rport_sm_online()
4409 qos_scn->old_qos_attr.qos_flow_id = in bfa_rport_sm_online()
4410 be32_to_cpu(qos_scn->old_qos_attr.qos_flow_id); in bfa_rport_sm_online()
4411 qos_scn->new_qos_attr.qos_flow_id = in bfa_rport_sm_online()
4412 be32_to_cpu(qos_scn->new_qos_attr.qos_flow_id); in bfa_rport_sm_online()
4414 if (qos_scn->old_qos_attr.qos_flow_id != in bfa_rport_sm_online()
4415 qos_scn->new_qos_attr.qos_flow_id) in bfa_rport_sm_online()
4416 bfa_cb_rport_qos_scn_flowid(rp->rport_drv, in bfa_rport_sm_online()
4417 qos_scn->old_qos_attr, in bfa_rport_sm_online()
4418 qos_scn->new_qos_attr); in bfa_rport_sm_online()
4419 if (qos_scn->old_qos_attr.qos_priority != in bfa_rport_sm_online()
4420 qos_scn->new_qos_attr.qos_priority) in bfa_rport_sm_online()
4421 bfa_cb_rport_qos_scn_prio(rp->rport_drv, in bfa_rport_sm_online()
4422 qos_scn->old_qos_attr, in bfa_rport_sm_online()
4423 qos_scn->new_qos_attr); in bfa_rport_sm_online()
4428 bfa_sm_fault(rp->bfa, event); in bfa_rport_sm_online()
4433 * Firmware rport is being deleted - awaiting f/w response.
4438 bfa_trc(rp->bfa, rp->rport_tag); in bfa_rport_sm_fwdelete()
4439 bfa_trc(rp->bfa, event); in bfa_rport_sm_fwdelete()
4461 bfa_sm_fault(rp->bfa, event); in bfa_rport_sm_fwdelete()
4468 bfa_trc(rp->bfa, rp->rport_tag); in bfa_rport_sm_fwdelete_qfull()
4469 bfa_trc(rp->bfa, event); in bfa_rport_sm_fwdelete_qfull()
4485 bfa_reqq_wcancel(&rp->reqq_wait); in bfa_rport_sm_fwdelete_qfull()
4491 bfa_sm_fault(rp->bfa, event); in bfa_rport_sm_fwdelete_qfull()
4501 bfa_trc(rp->bfa, rp->rport_tag); in bfa_rport_sm_offline()
4502 bfa_trc(rp->bfa, event); in bfa_rport_sm_offline()
4530 bfa_sm_fault(rp->bfa, event); in bfa_rport_sm_offline()
4535 * Rport is deleted, waiting for firmware response to delete.
4540 bfa_trc(rp->bfa, rp->rport_tag); in bfa_rport_sm_deleting()
4541 bfa_trc(rp->bfa, event); in bfa_rport_sm_deleting()
4557 bfa_sm_fault(rp->bfa, event); in bfa_rport_sm_deleting()
4564 bfa_trc(rp->bfa, rp->rport_tag); in bfa_rport_sm_deleting_qfull()
4565 bfa_trc(rp->bfa, event); in bfa_rport_sm_deleting_qfull()
4577 bfa_reqq_wcancel(&rp->reqq_wait); in bfa_rport_sm_deleting_qfull()
4582 bfa_sm_fault(rp->bfa, event); in bfa_rport_sm_deleting_qfull()
4587 * Waiting for rport create response from firmware. A delete is pending.
4593 bfa_trc(rp->bfa, rp->rport_tag); in bfa_rport_sm_delete_pending()
4594 bfa_trc(rp->bfa, event); in bfa_rport_sm_delete_pending()
4613 bfa_sm_fault(rp->bfa, event); in bfa_rport_sm_delete_pending()
4618 * Waiting for rport create response from firmware. Rport offline is pending.
4624 bfa_trc(rp->bfa, rp->rport_tag); in bfa_rport_sm_offline_pending()
4625 bfa_trc(rp->bfa, event); in bfa_rport_sm_offline_pending()
4649 bfa_sm_fault(rp->bfa, event); in bfa_rport_sm_offline_pending()
4659 bfa_trc(rp->bfa, rp->rport_tag); in bfa_rport_sm_iocdisable()
4660 bfa_trc(rp->bfa, event); in bfa_rport_sm_iocdisable()
4687 bfa_sm_fault(rp->bfa, event); in bfa_rport_sm_iocdisable()
4703 bfa_cb_rport_online(rp->rport_drv); in __bfa_cb_rport_online()
4712 bfa_cb_rport_offline(rp->rport_drv); in __bfa_cb_rport_offline()
4729 if (cfg->fwcfg.num_rports < BFA_RPORT_MIN) in bfa_rport_meminfo()
4730 cfg->fwcfg.num_rports = BFA_RPORT_MIN; in bfa_rport_meminfo()
4734 cfg->fwcfg.num_rports * sizeof(struct bfa_rport_s)); in bfa_rport_meminfo()
4745 INIT_LIST_HEAD(&mod->rp_free_q); in bfa_rport_attach()
4746 INIT_LIST_HEAD(&mod->rp_active_q); in bfa_rport_attach()
4747 INIT_LIST_HEAD(&mod->rp_unused_q); in bfa_rport_attach()
4750 mod->rps_list = rp; in bfa_rport_attach()
4751 mod->num_rports = cfg->fwcfg.num_rports; in bfa_rport_attach()
4753 WARN_ON(!mod->num_rports || in bfa_rport_attach()
4754 (mod->num_rports & (mod->num_rports - 1))); in bfa_rport_attach()
4756 for (i = 0; i < mod->num_rports; i++, rp++) { in bfa_rport_attach()
4758 rp->bfa = bfa; in bfa_rport_attach()
4759 rp->rport_tag = i; in bfa_rport_attach()
4763 * - is unused in bfa_rport_attach()
4766 list_add_tail(&rp->qe, &mod->rp_free_q); in bfa_rport_attach()
4768 bfa_reqq_winit(&rp->reqq_wait, bfa_rport_qresume, rp); in bfa_rport_attach()
4782 struct list_head *qe, *qen; in bfa_rport_iocdisable() local
4785 list_splice_tail_init(&mod->rp_unused_q, &mod->rp_free_q); in bfa_rport_iocdisable()
4787 list_for_each_safe(qe, qen, &mod->rp_active_q) { in bfa_rport_iocdisable()
4788 rport = (struct bfa_rport_s *) qe; in bfa_rport_iocdisable()
4798 bfa_q_deq(&mod->rp_free_q, &rport); in bfa_rport_alloc()
4800 list_add_tail(&rport->qe, &mod->rp_active_q); in bfa_rport_alloc()
4808 struct bfa_rport_mod_s *mod = BFA_RPORT_MOD(rport->bfa); in bfa_rport_free()
4810 WARN_ON(!bfa_q_is_on_q(&mod->rp_active_q, rport)); in bfa_rport_free()
4811 list_del(&rport->qe); in bfa_rport_free()
4812 list_add_tail(&rport->qe, &mod->rp_free_q); in bfa_rport_free()
4823 m = bfa_reqq_next(rp->bfa, BFA_REQQ_RPORT); in bfa_rport_send_fwcreate()
4825 bfa_reqq_wait(rp->bfa, BFA_REQQ_RPORT, &rp->reqq_wait); in bfa_rport_send_fwcreate()
4829 bfi_h2i_set(m->mh, BFI_MC_RPORT, BFI_RPORT_H2I_CREATE_REQ, in bfa_rport_send_fwcreate()
4830 bfa_fn_lpu(rp->bfa)); in bfa_rport_send_fwcreate()
4831 m->bfa_handle = rp->rport_tag; in bfa_rport_send_fwcreate()
4832 m->max_frmsz = cpu_to_be16(rp->rport_info.max_frmsz); in bfa_rport_send_fwcreate()
4833 m->pid = rp->rport_info.pid; in bfa_rport_send_fwcreate()
4834 m->lp_fwtag = bfa_lps_get_fwtag(rp->bfa, (u8)rp->rport_info.lp_tag); in bfa_rport_send_fwcreate()
4835 m->local_pid = rp->rport_info.local_pid; in bfa_rport_send_fwcreate()
4836 m->fc_class = rp->rport_info.fc_class; in bfa_rport_send_fwcreate()
4837 m->vf_en = rp->rport_info.vf_en; in bfa_rport_send_fwcreate()
4838 m->vf_id = rp->rport_info.vf_id; in bfa_rport_send_fwcreate()
4839 m->cisc = rp->rport_info.cisc; in bfa_rport_send_fwcreate()
4842 * queue I/O message to firmware in bfa_rport_send_fwcreate()
4844 bfa_reqq_produce(rp->bfa, BFA_REQQ_RPORT, m->mh); in bfa_rport_send_fwcreate()
4856 m = bfa_reqq_next(rp->bfa, BFA_REQQ_RPORT); in bfa_rport_send_fwdelete()
4858 bfa_reqq_wait(rp->bfa, BFA_REQQ_RPORT, &rp->reqq_wait); in bfa_rport_send_fwdelete()
4862 bfi_h2i_set(m->mh, BFI_MC_RPORT, BFI_RPORT_H2I_DELETE_REQ, in bfa_rport_send_fwdelete()
4863 bfa_fn_lpu(rp->bfa)); in bfa_rport_send_fwdelete()
4864 m->fw_handle = rp->fw_handle; in bfa_rport_send_fwdelete()
4867 * queue I/O message to firmware in bfa_rport_send_fwdelete()
4869 bfa_reqq_produce(rp->bfa, BFA_REQQ_RPORT, m->mh); in bfa_rport_send_fwdelete()
4881 m = bfa_reqq_next(rp->bfa, BFA_REQQ_RPORT); in bfa_rport_send_fwspeed()
4883 bfa_trc(rp->bfa, rp->rport_info.speed); in bfa_rport_send_fwspeed()
4887 bfi_h2i_set(m->mh, BFI_MC_RPORT, BFI_RPORT_H2I_SET_SPEED_REQ, in bfa_rport_send_fwspeed()
4888 bfa_fn_lpu(rp->bfa)); in bfa_rport_send_fwspeed()
4889 m->fw_handle = rp->fw_handle; in bfa_rport_send_fwspeed()
4890 m->speed = (u8)rp->rport_info.speed; in bfa_rport_send_fwspeed()
4893 * queue I/O message to firmware in bfa_rport_send_fwspeed()
4895 bfa_reqq_produce(rp->bfa, BFA_REQQ_RPORT, m->mh); in bfa_rport_send_fwspeed()
4914 bfa_trc(bfa, m->mhdr.msg_id); in bfa_rport_isr()
4918 switch (m->mhdr.msg_id) { in bfa_rport_isr()
4920 rp = BFA_RPORT_FROM_TAG(bfa, msg.create_rsp->bfa_handle); in bfa_rport_isr()
4921 rp->fw_handle = msg.create_rsp->fw_handle; in bfa_rport_isr()
4922 rp->qos_attr = msg.create_rsp->qos_attr; in bfa_rport_isr()
4924 WARN_ON(msg.create_rsp->status != BFA_STATUS_OK); in bfa_rport_isr()
4929 rp = BFA_RPORT_FROM_TAG(bfa, msg.delete_rsp->bfa_handle); in bfa_rport_isr()
4930 WARN_ON(msg.delete_rsp->status != BFA_STATUS_OK); in bfa_rport_isr()
4936 rp = BFA_RPORT_FROM_TAG(bfa, msg.qos_scn_evt->bfa_handle); in bfa_rport_isr()
4937 rp->event_arg.fw_msg = msg.qos_scn_evt; in bfa_rport_isr()
4943 &msg.lip_scn->loop_info); in bfa_rport_isr()
4952 rp = BFA_RPORT_FROM_TAG(bfa, msg.lip_scn->bfa_handle); in bfa_rport_isr()
4953 bfa_cb_rport_scn_no_dev(rp->rport_drv); in bfa_rport_isr()
4957 bfa_trc(bfa, m->mhdr.msg_id); in bfa_rport_isr()
4966 struct list_head *qe; in bfa_rport_res_recfg() local
4969 for (i = 0; i < (mod->num_rports - num_rport_fw); i++) { in bfa_rport_res_recfg()
4970 bfa_q_deq_tail(&mod->rp_free_q, &qe); in bfa_rport_res_recfg()
4971 list_add_tail(qe, &mod->rp_unused_q); in bfa_rport_res_recfg()
4989 rp->bfa = bfa; in bfa_rport_create()
4990 rp->rport_drv = rport_drv; in bfa_rport_create()
4991 memset(&rp->stats, 0, sizeof(rp->stats)); in bfa_rport_create()
5002 WARN_ON(rport_info->max_frmsz == 0); in bfa_rport_online()
5008 if (rport_info->max_frmsz == 0) { in bfa_rport_online()
5009 bfa_trc(rport->bfa, rport->rport_tag); in bfa_rport_online()
5010 rport_info->max_frmsz = FC_MIN_PDUSZ; in bfa_rport_online()
5013 rport->rport_info = *rport_info; in bfa_rport_online()
5024 rport->rport_info.speed = speed; in bfa_rport_speed()
5035 u8 lp_tag = (u8)rp->rport_info.lp_tag; in bfa_rport_set_lunmask()
5037 rp_wwn = ((struct bfa_fcs_rport_s *)rp->rport_drv)->pwwn; in bfa_rport_set_lunmask()
5038 lp_wwn = (BFA_LPS_FROM_TAG(lps_mod, rp->rport_info.lp_tag))->pwwn; in bfa_rport_set_lunmask()
5040 BFA_LPS_FROM_TAG(lps_mod, rp->rport_info.lp_tag)->lun_mask = in bfa_rport_set_lunmask()
5041 rp->lun_mask = BFA_TRUE; in bfa_rport_set_lunmask()
5042 bfa_fcpim_lunmask_rp_update(bfa, lp_wwn, rp_wwn, rp->rport_tag, lp_tag); in bfa_rport_set_lunmask()
5052 rp_wwn = ((struct bfa_fcs_rport_s *)rp->rport_drv)->pwwn; in bfa_rport_unset_lunmask()
5053 lp_wwn = (BFA_LPS_FROM_TAG(lps_mod, rp->rport_info.lp_tag))->pwwn; in bfa_rport_unset_lunmask()
5055 BFA_LPS_FROM_TAG(lps_mod, rp->rport_info.lp_tag)->lun_mask = in bfa_rport_unset_lunmask()
5056 rp->lun_mask = BFA_FALSE; in bfa_rport_unset_lunmask()
5078 if (cfg->drvcfg.num_sgpgs < BFA_SGPG_MIN) in bfa_sgpg_meminfo()
5079 cfg->drvcfg.num_sgpgs = BFA_SGPG_MIN; in bfa_sgpg_meminfo()
5080 else if (cfg->drvcfg.num_sgpgs > BFA_SGPG_MAX) in bfa_sgpg_meminfo()
5081 cfg->drvcfg.num_sgpgs = BFA_SGPG_MAX; in bfa_sgpg_meminfo()
5083 num_sgpg = cfg->drvcfg.num_sgpgs; in bfa_sgpg_meminfo()
5090 num_sgpg -= per_seg_sgpg; in bfa_sgpg_meminfo()
5100 cfg->drvcfg.num_sgpgs * sizeof(struct bfa_sgpg_s)); in bfa_sgpg_meminfo()
5120 INIT_LIST_HEAD(&mod->sgpg_q); in bfa_sgpg_attach()
5121 INIT_LIST_HEAD(&mod->sgpg_wait_q); in bfa_sgpg_attach()
5123 bfa_trc(bfa, cfg->drvcfg.num_sgpgs); in bfa_sgpg_attach()
5125 mod->free_sgpgs = mod->num_sgpgs = cfg->drvcfg.num_sgpgs; in bfa_sgpg_attach()
5127 num_sgpg = cfg->drvcfg.num_sgpgs; in bfa_sgpg_attach()
5138 align_len = BFA_SGPG_ROUNDUP(bfa_mem_dma_phys(seg_ptr)) - in bfa_sgpg_attach()
5144 WARN_ON(sgpg_pa.pa & (sgpg_sz - 1)); in bfa_sgpg_attach()
5146 per_seg_sgpg = (seg_ptr->mem_len - (u32)align_len) / sgpg_sz; in bfa_sgpg_attach()
5148 for (i = 0; num_sgpg > 0 && i < per_seg_sgpg; i++, num_sgpg--) { in bfa_sgpg_attach()
5152 hsgpg->sgpg = sgpg; in bfa_sgpg_attach()
5154 hsgpg->sgpg_pa = sgpg_pa_tmp.addr; in bfa_sgpg_attach()
5155 list_add_tail(&hsgpg->qe, &mod->sgpg_q); in bfa_sgpg_attach()
5173 if (mod->free_sgpgs < nsgpgs) in bfa_sgpg_malloc()
5177 bfa_q_deq(&mod->sgpg_q, &hsgpg); in bfa_sgpg_malloc()
5179 list_add_tail(&hsgpg->qe, sgpg_q); in bfa_sgpg_malloc()
5182 mod->free_sgpgs -= nsgpgs; in bfa_sgpg_malloc()
5192 mod->free_sgpgs += nsgpg; in bfa_sgpg_mfree()
5193 WARN_ON(mod->free_sgpgs > mod->num_sgpgs); in bfa_sgpg_mfree()
5195 list_splice_tail_init(sgpg_q, &mod->sgpg_q); in bfa_sgpg_mfree()
5197 if (list_empty(&mod->sgpg_wait_q)) in bfa_sgpg_mfree()
5204 wqe = bfa_q_first(&mod->sgpg_wait_q); in bfa_sgpg_mfree()
5205 if (mod->free_sgpgs < wqe->nsgpg) in bfa_sgpg_mfree()
5206 nsgpg = mod->free_sgpgs; in bfa_sgpg_mfree()
5208 nsgpg = wqe->nsgpg; in bfa_sgpg_mfree()
5209 bfa_sgpg_malloc(bfa, &wqe->sgpg_q, nsgpg); in bfa_sgpg_mfree()
5210 wqe->nsgpg -= nsgpg; in bfa_sgpg_mfree()
5211 if (wqe->nsgpg == 0) { in bfa_sgpg_mfree()
5212 list_del(&wqe->qe); in bfa_sgpg_mfree()
5213 wqe->cbfn(wqe->cbarg); in bfa_sgpg_mfree()
5215 } while (mod->free_sgpgs && !list_empty(&mod->sgpg_wait_q)); in bfa_sgpg_mfree()
5224 WARN_ON(nsgpg <= mod->free_sgpgs); in bfa_sgpg_wait()
5226 wqe->nsgpg_total = wqe->nsgpg = nsgpg; in bfa_sgpg_wait()
5231 if (mod->free_sgpgs) { in bfa_sgpg_wait()
5235 WARN_ON(!list_empty(&mod->sgpg_wait_q)); in bfa_sgpg_wait()
5236 list_splice_tail_init(&mod->sgpg_q, &wqe->sgpg_q); in bfa_sgpg_wait()
5237 wqe->nsgpg -= mod->free_sgpgs; in bfa_sgpg_wait()
5238 mod->free_sgpgs = 0; in bfa_sgpg_wait()
5241 list_add_tail(&wqe->qe, &mod->sgpg_wait_q); in bfa_sgpg_wait()
5249 WARN_ON(!bfa_q_is_on_q(&mod->sgpg_wait_q, wqe)); in bfa_sgpg_wcancel()
5250 list_del(&wqe->qe); in bfa_sgpg_wcancel()
5252 if (wqe->nsgpg_total != wqe->nsgpg) in bfa_sgpg_wcancel()
5253 bfa_sgpg_mfree(bfa, &wqe->sgpg_q, in bfa_sgpg_wcancel()
5254 wqe->nsgpg_total - wqe->nsgpg); in bfa_sgpg_wcancel()
5261 INIT_LIST_HEAD(&wqe->sgpg_q); in bfa_sgpg_winit()
5262 wqe->cbfn = cbfn; in bfa_sgpg_winit()
5263 wqe->cbarg = cbarg; in bfa_sgpg_winit()
5278 struct bfa_uf_mod_s *ufm = BFA_UF_MOD(uf->bfa); in __bfa_cb_uf_recv()
5281 ufm->ufrecv(ufm->cbarg, uf); in __bfa_cb_uf_recv()
5291 ufm->uf_buf_posts = (struct bfi_uf_buf_post_s *) bfa_mem_kva_curp(ufm); in claim_uf_post_msgs()
5292 uf_bp_msg = ufm->uf_buf_posts; in claim_uf_post_msgs()
5294 for (i = 0, uf_bp_msg = ufm->uf_buf_posts; i < ufm->num_ufs; in claim_uf_post_msgs()
5298 uf_bp_msg->buf_tag = i; in claim_uf_post_msgs()
5300 uf_bp_msg->buf_len = cpu_to_be16(buf_len); in claim_uf_post_msgs()
5301 bfi_h2i_set(uf_bp_msg->mh, BFI_MC_UF, BFI_UF_H2I_BUF_POST, in claim_uf_post_msgs()
5302 bfa_fn_lpu(ufm->bfa)); in claim_uf_post_msgs()
5303 bfa_alen_set(&uf_bp_msg->alen, buf_len, ufm_pbs_pa(ufm, i)); in claim_uf_post_msgs()
5321 ufm->uf_list = (struct bfa_uf_s *) bfa_mem_kva_curp(ufm); in claim_ufs()
5326 for (i = 0, uf = ufm->uf_list; i < ufm->num_ufs; i++, uf++) { in claim_ufs()
5328 uf->bfa = ufm->bfa; in claim_ufs()
5329 uf->uf_tag = i; in claim_ufs()
5330 uf->pb_len = BFA_PER_UF_DMA_SZ; in claim_ufs()
5331 uf->buf_kva = bfa_mem_get_dmabuf_kva(ufm, i, BFA_PER_UF_DMA_SZ); in claim_ufs()
5332 uf->buf_pa = ufm_pbs_pa(ufm, i); in claim_ufs()
5333 list_add_tail(&uf->qe, &ufm->uf_free_q); in claim_ufs()
5355 u32 num_ufs = cfg->fwcfg.num_uf_bufs; in bfa_uf_meminfo()
5364 num_ufs -= per_seg_uf; in bfa_uf_meminfo()
5373 bfa_mem_kva_setup(minfo, uf_kva, cfg->fwcfg.num_uf_bufs * in bfa_uf_meminfo()
5383 ufm->bfa = bfa; in bfa_uf_attach()
5384 ufm->num_ufs = cfg->fwcfg.num_uf_bufs; in bfa_uf_attach()
5385 INIT_LIST_HEAD(&ufm->uf_free_q); in bfa_uf_attach()
5386 INIT_LIST_HEAD(&ufm->uf_posted_q); in bfa_uf_attach()
5387 INIT_LIST_HEAD(&ufm->uf_unused_q); in bfa_uf_attach()
5397 bfa_q_deq(&uf_mod->uf_free_q, &uf); in bfa_uf_get()
5404 list_add_tail(&uf->qe, &uf_mod->uf_free_q); in bfa_uf_put()
5412 uf_post_msg = bfa_reqq_next(ufm->bfa, BFA_REQQ_FCXP); in bfa_uf_post()
5416 memcpy(uf_post_msg, &ufm->uf_buf_posts[uf->uf_tag], in bfa_uf_post()
5418 bfa_reqq_produce(ufm->bfa, BFA_REQQ_FCXP, uf_post_msg->mh); in bfa_uf_post()
5420 bfa_trc(ufm->bfa, uf->uf_tag); in bfa_uf_post()
5422 list_add_tail(&uf->qe, &ufm->uf_posted_q); in bfa_uf_post()
5441 u16 uf_tag = m->buf_tag; in uf_recv()
5442 struct bfa_uf_s *uf = &ufm->uf_list[uf_tag]; in uf_recv()
5447 bfa_mem_get_dmabuf_kva(ufm, uf_tag, uf->pb_len); in uf_recv()
5448 buf = &uf_buf->d[0]; in uf_recv()
5450 m->frm_len = be16_to_cpu(m->frm_len); in uf_recv()
5451 m->xfr_len = be16_to_cpu(m->xfr_len); in uf_recv()
5453 list_del(&uf->qe); /* dequeue from posted queue */ in uf_recv()
5455 uf->data_ptr = buf; in uf_recv()
5456 uf->data_len = m->xfr_len; in uf_recv()
5458 WARN_ON(uf->data_len < sizeof(struct fchs_s)); in uf_recv()
5460 if (uf->data_len == sizeof(struct fchs_s)) { in uf_recv()
5461 bfa_plog_fchdr(bfa->plog, BFA_PL_MID_HAL_UF, BFA_PL_EID_RX, in uf_recv()
5462 uf->data_len, (struct fchs_s *)buf); in uf_recv()
5465 bfa_plog_fchdr_and_pl(bfa->plog, BFA_PL_MID_HAL_UF, in uf_recv()
5466 BFA_PL_EID_RX, uf->data_len, in uf_recv()
5470 if (bfa->fcs) in uf_recv()
5473 bfa_cb_queue(bfa, &uf->hcb_qe, __bfa_cb_uf_recv, uf); in uf_recv()
5494 ufm->ufrecv = ufrecv; in bfa_uf_recv_register()
5495 ufm->cbarg = cbarg; in bfa_uf_recv_register()
5508 bfa_uf_put(BFA_UF_MOD(uf->bfa), uf); in bfa_uf_free()
5509 bfa_uf_post_all(BFA_UF_MOD(uf->bfa)); in bfa_uf_free()
5520 bfa_trc(bfa, msg->mhdr.msg_id); in bfa_uf_isr()
5522 switch (msg->mhdr.msg_id) { in bfa_uf_isr()
5528 bfa_trc(bfa, msg->mhdr.msg_id); in bfa_uf_isr()
5537 struct list_head *qe; in bfa_uf_res_recfg() local
5540 for (i = 0; i < (mod->num_ufs - num_uf_fw); i++) { in bfa_uf_res_recfg()
5541 bfa_q_deq_tail(&mod->uf_free_q, &qe); in bfa_uf_res_recfg()
5542 list_add_tail(qe, &mod->uf_unused_q); in bfa_uf_res_recfg()
5595 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(fcdiag->bfa); in bfa_fcdiag_set_busy_status()
5597 if (fcdiag->lb.lock) in bfa_fcdiag_set_busy_status()
5598 fcport->diag_busy = BFA_TRUE; in bfa_fcdiag_set_busy_status()
5600 fcport->diag_busy = BFA_FALSE; in bfa_fcdiag_set_busy_status()
5608 struct bfa_dport_s *dport = &fcdiag->dport; in bfa_fcdiag_attach()
5610 fcdiag->bfa = bfa; in bfa_fcdiag_attach()
5611 fcdiag->trcmod = bfa->trcmod; in bfa_fcdiag_attach()
5613 dport->bfa = bfa; in bfa_fcdiag_attach()
5615 bfa_reqq_winit(&dport->reqq_wait, bfa_dport_qresume, dport); in bfa_fcdiag_attach()
5616 dport->cbfn = NULL; in bfa_fcdiag_attach()
5617 dport->cbarg = NULL; in bfa_fcdiag_attach()
5618 dport->test_state = BFA_DPORT_ST_DISABLED; in bfa_fcdiag_attach()
5619 memset(&dport->result, 0, sizeof(struct bfa_diag_dport_result_s)); in bfa_fcdiag_attach()
5626 struct bfa_dport_s *dport = &fcdiag->dport; in bfa_fcdiag_iocdisable()
5628 bfa_trc(fcdiag, fcdiag->lb.lock); in bfa_fcdiag_iocdisable()
5629 if (fcdiag->lb.lock) { in bfa_fcdiag_iocdisable()
5630 fcdiag->lb.status = BFA_STATUS_IOC_FAILURE; in bfa_fcdiag_iocdisable()
5631 fcdiag->lb.cbfn(fcdiag->lb.cbarg, fcdiag->lb.status); in bfa_fcdiag_iocdisable()
5632 fcdiag->lb.lock = 0; in bfa_fcdiag_iocdisable()
5643 struct bfa_diag_qtest_result_s *res = fcdiag->qtest.result; in bfa_fcdiag_queuetest_timeout()
5645 bfa_trc(fcdiag, fcdiag->qtest.all); in bfa_fcdiag_queuetest_timeout()
5646 bfa_trc(fcdiag, fcdiag->qtest.count); in bfa_fcdiag_queuetest_timeout()
5648 fcdiag->qtest.timer_active = 0; in bfa_fcdiag_queuetest_timeout()
5650 res->status = BFA_STATUS_ETIMER; in bfa_fcdiag_queuetest_timeout()
5651 res->count = QTEST_CNT_DEFAULT - fcdiag->qtest.count; in bfa_fcdiag_queuetest_timeout()
5652 if (fcdiag->qtest.all) in bfa_fcdiag_queuetest_timeout()
5653 res->queue = fcdiag->qtest.all; in bfa_fcdiag_queuetest_timeout()
5656 fcdiag->qtest.status = BFA_STATUS_ETIMER; in bfa_fcdiag_queuetest_timeout()
5657 fcdiag->qtest.cbfn(fcdiag->qtest.cbarg, fcdiag->qtest.status); in bfa_fcdiag_queuetest_timeout()
5658 fcdiag->qtest.lock = 0; in bfa_fcdiag_queuetest_timeout()
5667 req = bfa_reqq_next(fcdiag->bfa, fcdiag->qtest.queue); in bfa_fcdiag_queuetest_send()
5672 bfi_h2i_set(req->mh, BFI_MC_DIAG, BFI_DIAG_H2I_QTEST, in bfa_fcdiag_queuetest_send()
5673 bfa_fn_lpu(fcdiag->bfa)); in bfa_fcdiag_queuetest_send()
5676 req->data[i] = QTEST_PAT_DEFAULT; in bfa_fcdiag_queuetest_send()
5678 bfa_trc(fcdiag, fcdiag->qtest.queue); in bfa_fcdiag_queuetest_send()
5680 bfa_reqq_produce(fcdiag->bfa, fcdiag->qtest.queue, req->mh); in bfa_fcdiag_queuetest_send()
5688 struct bfa_diag_qtest_result_s *res = fcdiag->qtest.result; in bfa_fcdiag_queuetest_comp()
5693 if (!fcdiag->qtest.timer_active) { in bfa_fcdiag_queuetest_comp()
5694 bfa_trc(fcdiag, fcdiag->qtest.timer_active); in bfa_fcdiag_queuetest_comp()
5699 fcdiag->qtest.count--; in bfa_fcdiag_queuetest_comp()
5703 if (rsp->data[i] != ~(QTEST_PAT_DEFAULT)) { in bfa_fcdiag_queuetest_comp()
5704 res->status = BFA_STATUS_DATACORRUPTED; in bfa_fcdiag_queuetest_comp()
5709 if (res->status == BFA_STATUS_OK) { in bfa_fcdiag_queuetest_comp()
5710 if (fcdiag->qtest.count > 0) { in bfa_fcdiag_queuetest_comp()
5715 res->status = status; in bfa_fcdiag_queuetest_comp()
5716 } else if (fcdiag->qtest.all > 0 && in bfa_fcdiag_queuetest_comp()
5717 fcdiag->qtest.queue < (BFI_IOC_MAX_CQS - 1)) { in bfa_fcdiag_queuetest_comp()
5718 fcdiag->qtest.count = QTEST_CNT_DEFAULT; in bfa_fcdiag_queuetest_comp()
5719 fcdiag->qtest.queue++; in bfa_fcdiag_queuetest_comp()
5724 res->status = status; in bfa_fcdiag_queuetest_comp()
5729 if (fcdiag->qtest.timer_active) { in bfa_fcdiag_queuetest_comp()
5730 bfa_timer_stop(&fcdiag->qtest.timer); in bfa_fcdiag_queuetest_comp()
5731 fcdiag->qtest.timer_active = 0; in bfa_fcdiag_queuetest_comp()
5733 res->queue = fcdiag->qtest.queue; in bfa_fcdiag_queuetest_comp()
5734 res->count = QTEST_CNT_DEFAULT - fcdiag->qtest.count; in bfa_fcdiag_queuetest_comp()
5735 bfa_trc(fcdiag, res->count); in bfa_fcdiag_queuetest_comp()
5736 bfa_trc(fcdiag, res->status); in bfa_fcdiag_queuetest_comp()
5737 fcdiag->qtest.status = res->status; in bfa_fcdiag_queuetest_comp()
5738 fcdiag->qtest.cbfn(fcdiag->qtest.cbarg, fcdiag->qtest.status); in bfa_fcdiag_queuetest_comp()
5739 fcdiag->qtest.lock = 0; in bfa_fcdiag_queuetest_comp()
5746 struct bfa_diag_loopback_result_s *res = fcdiag->lb.result; in bfa_fcdiag_loopback_comp()
5748 res->numtxmfrm = be32_to_cpu(rsp->res.numtxmfrm); in bfa_fcdiag_loopback_comp()
5749 res->numosffrm = be32_to_cpu(rsp->res.numosffrm); in bfa_fcdiag_loopback_comp()
5750 res->numrcvfrm = be32_to_cpu(rsp->res.numrcvfrm); in bfa_fcdiag_loopback_comp()
5751 res->badfrminf = be32_to_cpu(rsp->res.badfrminf); in bfa_fcdiag_loopback_comp()
5752 res->badfrmnum = be32_to_cpu(rsp->res.badfrmnum); in bfa_fcdiag_loopback_comp()
5753 res->status = rsp->res.status; in bfa_fcdiag_loopback_comp()
5754 fcdiag->lb.status = rsp->res.status; in bfa_fcdiag_loopback_comp()
5755 bfa_trc(fcdiag, fcdiag->lb.status); in bfa_fcdiag_loopback_comp()
5756 fcdiag->lb.cbfn(fcdiag->lb.cbarg, fcdiag->lb.status); in bfa_fcdiag_loopback_comp()
5757 fcdiag->lb.lock = 0; in bfa_fcdiag_loopback_comp()
5767 lb_req = bfa_reqq_next(fcdiag->bfa, BFA_REQQ_DIAG); in bfa_fcdiag_loopback_send()
5772 bfi_h2i_set(lb_req->mh, BFI_MC_DIAG, BFI_DIAG_H2I_LOOPBACK, in bfa_fcdiag_loopback_send()
5773 bfa_fn_lpu(fcdiag->bfa)); in bfa_fcdiag_loopback_send()
5775 lb_req->lb_mode = loopback->lb_mode; in bfa_fcdiag_loopback_send()
5776 lb_req->speed = loopback->speed; in bfa_fcdiag_loopback_send()
5777 lb_req->loopcnt = loopback->loopcnt; in bfa_fcdiag_loopback_send()
5778 lb_req->pattern = loopback->pattern; in bfa_fcdiag_loopback_send()
5781 bfa_reqq_produce(fcdiag->bfa, BFA_REQQ_DIAG, lb_req->mh); in bfa_fcdiag_loopback_send()
5783 bfa_trc(fcdiag, loopback->lb_mode); in bfa_fcdiag_loopback_send()
5784 bfa_trc(fcdiag, loopback->speed); in bfa_fcdiag_loopback_send()
5785 bfa_trc(fcdiag, loopback->loopcnt); in bfa_fcdiag_loopback_send()
5786 bfa_trc(fcdiag, loopback->pattern); in bfa_fcdiag_loopback_send()
5798 switch (msg->mhdr.msg_id) { in bfa_fcdiag_intr()
5807 bfa_dport_req_comp(&fcdiag->dport, in bfa_fcdiag_intr()
5811 bfa_dport_scn(&fcdiag->dport, in bfa_fcdiag_intr()
5815 bfa_trc(fcdiag, msg->mhdr.msg_id); in bfa_fcdiag_intr()
5823 * @param[in] *bfa - bfa data struct
5824 * @param[in] opmode - port operation mode
5825 * @param[in] speed - port speed
5826 * @param[in] lpcnt - loop count
5827 * @param[in] pat - pattern to build packet
5828 * @param[in] *result - pt to bfa_diag_loopback_result_t data struct
5829 * @param[in] cbfn - callback function
5830 * @param[in] cbarg - callback functioin arg
5862 if (bfa_ioc_get_type(&bfa->ioc) == BFA_IOC_TYPE_FC) { in bfa_fcdiag_loopback()
5887 (bfa_asic_id_ct2(bfa->ioc.pcidev.device_id))) { in bfa_fcdiag_loopback()
5893 if (bfa_mfg_is_mezz(bfa->ioc.attr->card_type)) { in bfa_fcdiag_loopback()
5894 if (bfa_ioc_get_type(&bfa->ioc) == BFA_IOC_TYPE_FC) { in bfa_fcdiag_loopback()
5909 bfa_trc(fcdiag, fcdiag->lb.lock); in bfa_fcdiag_loopback()
5913 if (fcdiag->lb.lock) { in bfa_fcdiag_loopback()
5914 bfa_trc(fcdiag, fcdiag->lb.lock); in bfa_fcdiag_loopback()
5918 fcdiag->lb.lock = 1; in bfa_fcdiag_loopback()
5923 fcdiag->lb.result = result; in bfa_fcdiag_loopback()
5924 fcdiag->lb.cbfn = cbfn; in bfa_fcdiag_loopback()
5925 fcdiag->lb.cbarg = cbarg; in bfa_fcdiag_loopback()
5937 * @param[in] *bfa - bfa data struct
5938 * @param[in] force - 1: don't do ioc op checking
5939 * @param[in] queue - queue no. to test
5940 * @param[in] *result - pt to bfa_diag_qtest_result_t data struct
5941 * @param[in] cbfn - callback function
5942 * @param[in] *cbarg - callback functioin arg
5960 if (fcdiag->qtest.lock) { in bfa_fcdiag_queuetest()
5961 bfa_trc(fcdiag, fcdiag->qtest.lock); in bfa_fcdiag_queuetest()
5966 fcdiag->qtest.lock = 1; in bfa_fcdiag_queuetest()
5967 fcdiag->qtest.cbfn = cbfn; in bfa_fcdiag_queuetest()
5968 fcdiag->qtest.cbarg = cbarg; in bfa_fcdiag_queuetest()
5969 fcdiag->qtest.result = result; in bfa_fcdiag_queuetest()
5970 fcdiag->qtest.count = QTEST_CNT_DEFAULT; in bfa_fcdiag_queuetest()
5973 fcdiag->qtest.result->status = BFA_STATUS_OK; in bfa_fcdiag_queuetest()
5974 fcdiag->qtest.result->count = 0; in bfa_fcdiag_queuetest()
5978 fcdiag->qtest.result->queue = (u8)queue; in bfa_fcdiag_queuetest()
5979 fcdiag->qtest.queue = (u8)queue; in bfa_fcdiag_queuetest()
5980 fcdiag->qtest.all = 0; in bfa_fcdiag_queuetest()
5982 fcdiag->qtest.result->queue = 0; in bfa_fcdiag_queuetest()
5983 fcdiag->qtest.queue = 0; in bfa_fcdiag_queuetest()
5984 fcdiag->qtest.all = 1; in bfa_fcdiag_queuetest()
5990 bfa_timer_start(bfa, &fcdiag->qtest.timer, in bfa_fcdiag_queuetest()
5993 fcdiag->qtest.timer_active = 1; in bfa_fcdiag_queuetest()
6001 * @param[in] *bfa - bfa data struct
6009 return fcdiag->lb.lock ? BFA_STATUS_DIAG_BUSY : BFA_STATUS_OK; in bfa_fcdiag_lb_is_running()
6013 * D-port
6016 (__dport)->result.start_time = ktime_get_real_seconds(); \
6017 (__dport)->result.status = DPORT_TEST_ST_INPRG; \
6018 (__dport)->result.mode = (__mode); \
6019 (__dport)->result.rp_pwwn = (__dport)->rp_pwwn; \
6020 (__dport)->result.rp_nwwn = (__dport)->rp_nwwn; \
6021 (__dport)->result.lpcnt = (__dport)->lpcnt; \
6029 if (dport->cbfn != NULL) { in bfa_cb_fcdiag_dport()
6030 dport->cbfn(dport->cbarg, bfa_status); in bfa_cb_fcdiag_dport()
6031 dport->cbfn = NULL; in bfa_cb_fcdiag_dport()
6032 dport->cbarg = NULL; in bfa_cb_fcdiag_dport()
6039 bfa_trc(dport->bfa, event); in bfa_dport_sm_disabled()
6043 bfa_fcport_dportenable(dport->bfa); in bfa_dport_sm_disabled()
6059 if (dport->i2hmsg.scn.state == BFI_DPORT_SCN_DDPORT_ENABLE) { in bfa_dport_sm_disabled()
6060 bfa_fcport_ddportenable(dport->bfa); in bfa_dport_sm_disabled()
6061 dport->dynamic = BFA_TRUE; in bfa_dport_sm_disabled()
6062 dport->test_state = BFA_DPORT_ST_NOTSTART; in bfa_dport_sm_disabled()
6065 bfa_trc(dport->bfa, dport->i2hmsg.scn.state); in bfa_dport_sm_disabled()
6071 bfa_sm_fault(dport->bfa, event); in bfa_dport_sm_disabled()
6079 bfa_trc(dport->bfa, event); in bfa_dport_sm_enabling_qwait()
6088 bfa_reqq_wcancel(&dport->reqq_wait); in bfa_dport_sm_enabling_qwait()
6094 bfa_sm_fault(dport->bfa, event); in bfa_dport_sm_enabling_qwait()
6101 bfa_trc(dport->bfa, event); in bfa_dport_sm_enabling()
6105 memset(&dport->result, 0, in bfa_dport_sm_enabling()
6107 if (dport->i2hmsg.rsp.status == BFA_STATUS_DPORT_INV_SFP) { in bfa_dport_sm_enabling()
6108 dport->test_state = BFA_DPORT_ST_NO_SFP; in bfa_dport_sm_enabling()
6110 dport->test_state = BFA_DPORT_ST_INP; in bfa_dport_sm_enabling()
6117 dport->test_state = BFA_DPORT_ST_DISABLED; in bfa_dport_sm_enabling()
6118 bfa_fcport_dportdisable(dport->bfa); in bfa_dport_sm_enabling()
6128 bfa_sm_fault(dport->bfa, event); in bfa_dport_sm_enabling()
6135 bfa_trc(dport->bfa, event); in bfa_dport_sm_enabled()
6146 bfa_fcport_dportdisable(dport->bfa); in bfa_dport_sm_enabled()
6158 switch (dport->i2hmsg.scn.state) { in bfa_dport_sm_enabled()
6160 dport->test_state = BFA_DPORT_ST_COMP; in bfa_dport_sm_enabled()
6164 dport->test_state = BFA_DPORT_ST_INP; in bfa_dport_sm_enabled()
6173 dport->test_state = BFA_DPORT_ST_NO_SFP; in bfa_dport_sm_enabled()
6177 bfa_fcport_ddportdisable(dport->bfa); in bfa_dport_sm_enabled()
6188 bfa_fcport_ddportdisable(dport->bfa); in bfa_dport_sm_enabled()
6191 dport->dynamic = BFA_FALSE; in bfa_dport_sm_enabled()
6195 bfa_trc(dport->bfa, dport->i2hmsg.scn.state); in bfa_dport_sm_enabled()
6196 bfa_sm_fault(dport->bfa, event); in bfa_dport_sm_enabled()
6200 bfa_sm_fault(dport->bfa, event); in bfa_dport_sm_enabled()
6208 bfa_trc(dport->bfa, event); in bfa_dport_sm_disabling_qwait()
6218 bfa_reqq_wcancel(&dport->reqq_wait); in bfa_dport_sm_disabling_qwait()
6227 bfa_sm_fault(dport->bfa, event); in bfa_dport_sm_disabling_qwait()
6234 bfa_trc(dport->bfa, event); in bfa_dport_sm_disabling()
6238 dport->test_state = BFA_DPORT_ST_DISABLED; in bfa_dport_sm_disabling()
6252 bfa_sm_fault(dport->bfa, event); in bfa_dport_sm_disabling()
6260 bfa_trc(dport->bfa, event); in bfa_dport_sm_starting_qwait()
6269 bfa_reqq_wcancel(&dport->reqq_wait); in bfa_dport_sm_starting_qwait()
6275 bfa_sm_fault(dport->bfa, event); in bfa_dport_sm_starting_qwait()
6282 bfa_trc(dport->bfa, event); in bfa_dport_sm_starting()
6286 memset(&dport->result, 0, in bfa_dport_sm_starting()
6288 if (dport->i2hmsg.rsp.status == BFA_STATUS_DPORT_INV_SFP) { in bfa_dport_sm_starting()
6289 dport->test_state = BFA_DPORT_ST_NO_SFP; in bfa_dport_sm_starting()
6291 dport->test_state = BFA_DPORT_ST_INP; in bfa_dport_sm_starting()
6306 bfa_sm_fault(dport->bfa, event); in bfa_dport_sm_starting()
6314 bfa_trc(dport->bfa, event); in bfa_dport_sm_dynamic_disabling()
6318 switch (dport->i2hmsg.scn.state) { in bfa_dport_sm_dynamic_disabling()
6321 dport->dynamic = BFA_FALSE; in bfa_dport_sm_dynamic_disabling()
6322 bfa_fcport_enable(dport->bfa); in bfa_dport_sm_dynamic_disabling()
6326 bfa_trc(dport->bfa, dport->i2hmsg.scn.state); in bfa_dport_sm_dynamic_disabling()
6327 bfa_sm_fault(dport->bfa, event); in bfa_dport_sm_dynamic_disabling()
6338 bfa_sm_fault(dport->bfa, event); in bfa_dport_sm_dynamic_disabling()
6346 bfa_trc(dport->bfa, event); in bfa_dport_sm_dynamic_disabling_qwait()
6356 bfa_reqq_wcancel(&dport->reqq_wait); in bfa_dport_sm_dynamic_disabling_qwait()
6365 bfa_sm_fault(dport->bfa, event); in bfa_dport_sm_dynamic_disabling_qwait()
6377 m = bfa_reqq_next(dport->bfa, BFA_REQQ_DIAG); in bfa_dport_send_req()
6379 bfa_reqq_wait(dport->bfa, BFA_REQQ_PORT, &dport->reqq_wait); in bfa_dport_send_req()
6383 bfi_h2i_set(m->mh, BFI_MC_DIAG, BFI_DIAG_H2I_DPORT, in bfa_dport_send_req()
6384 bfa_fn_lpu(dport->bfa)); in bfa_dport_send_req()
6385 m->req = req; in bfa_dport_send_req()
6387 m->lpcnt = cpu_to_be32(dport->lpcnt); in bfa_dport_send_req()
6388 m->payload = cpu_to_be32(dport->payload); in bfa_dport_send_req()
6392 * queue I/O message to firmware in bfa_dport_send_req()
6394 bfa_reqq_produce(dport->bfa, BFA_REQQ_DIAG, m->mh); in bfa_dport_send_req()
6410 msg->status = cpu_to_be32(msg->status); in bfa_dport_req_comp()
6411 dport->i2hmsg.rsp.status = msg->status; in bfa_dport_req_comp()
6412 dport->rp_pwwn = msg->pwwn; in bfa_dport_req_comp()
6413 dport->rp_nwwn = msg->nwwn; in bfa_dport_req_comp()
6415 if ((msg->status == BFA_STATUS_OK) || in bfa_dport_req_comp()
6416 (msg->status == BFA_STATUS_DPORT_NO_SFP)) { in bfa_dport_req_comp()
6417 bfa_trc(dport->bfa, msg->status); in bfa_dport_req_comp()
6418 bfa_trc(dport->bfa, dport->rp_pwwn); in bfa_dport_req_comp()
6419 bfa_trc(dport->bfa, dport->rp_nwwn); in bfa_dport_req_comp()
6423 bfa_trc(dport->bfa, msg->status); in bfa_dport_req_comp()
6426 bfa_cb_fcdiag_dport(dport, msg->status); in bfa_dport_req_comp()
6450 bfa_trc(dport->bfa, msg->state); in bfa_dport_scn()
6451 dport->i2hmsg.scn.state = msg->state; in bfa_dport_scn()
6453 switch (dport->i2hmsg.scn.state) { in bfa_dport_scn()
6455 dport->result.end_time = ktime_get_real_seconds(); in bfa_dport_scn()
6456 bfa_trc(dport->bfa, dport->result.end_time); in bfa_dport_scn()
6458 dport->result.status = msg->info.testcomp.status; in bfa_dport_scn()
6459 bfa_trc(dport->bfa, dport->result.status); in bfa_dport_scn()
6461 dport->result.roundtrip_latency = in bfa_dport_scn()
6462 cpu_to_be32(msg->info.testcomp.latency); in bfa_dport_scn()
6463 dport->result.est_cable_distance = in bfa_dport_scn()
6464 cpu_to_be32(msg->info.testcomp.distance); in bfa_dport_scn()
6465 dport->result.buffer_required = in bfa_dport_scn()
6466 be16_to_cpu(msg->info.testcomp.numbuffer); in bfa_dport_scn()
6468 dport->result.frmsz = be16_to_cpu(msg->info.testcomp.frm_sz); in bfa_dport_scn()
6469 dport->result.speed = msg->info.testcomp.speed; in bfa_dport_scn()
6471 bfa_trc(dport->bfa, dport->result.roundtrip_latency); in bfa_dport_scn()
6472 bfa_trc(dport->bfa, dport->result.est_cable_distance); in bfa_dport_scn()
6473 bfa_trc(dport->bfa, dport->result.buffer_required); in bfa_dport_scn()
6474 bfa_trc(dport->bfa, dport->result.frmsz); in bfa_dport_scn()
6475 bfa_trc(dport->bfa, dport->result.speed); in bfa_dport_scn()
6478 dport->result.subtest[i].status = in bfa_dport_scn()
6479 msg->info.testcomp.subtest_status[i]; in bfa_dport_scn()
6480 bfa_trc(dport->bfa, dport->result.subtest[i].status); in bfa_dport_scn()
6486 memset(&dport->result, 0, in bfa_dport_scn()
6491 memset(&dport->result, 0, in bfa_dport_scn()
6493 dport->rp_pwwn = msg->info.teststart.pwwn; in bfa_dport_scn()
6494 dport->rp_nwwn = msg->info.teststart.nwwn; in bfa_dport_scn()
6495 dport->lpcnt = cpu_to_be32(msg->info.teststart.numfrm); in bfa_dport_scn()
6496 bfa_dport_result_start(dport, msg->info.teststart.mode); in bfa_dport_scn()
6500 subtesttype = msg->info.teststart.type; in bfa_dport_scn()
6501 dport->result.subtest[subtesttype].start_time = in bfa_dport_scn()
6503 dport->result.subtest[subtesttype].status = in bfa_dport_scn()
6506 bfa_trc(dport->bfa, subtesttype); in bfa_dport_scn()
6507 bfa_trc(dport->bfa, in bfa_dport_scn()
6508 dport->result.subtest[subtesttype].start_time); in bfa_dport_scn()
6515 dport->result.status = DPORT_TEST_ST_IDLE; in bfa_dport_scn()
6519 bfa_sm_fault(dport->bfa, msg->state); in bfa_dport_scn()
6528 * @param[in] *bfa - bfa data struct
6535 struct bfa_dport_s *dport = &fcdiag->dport; in bfa_dport_enable()
6540 if (bfa_mfg_is_mezz(dport->bfa->ioc.attr->card_type)) { in bfa_dport_enable()
6541 bfa_trc(dport->bfa, BFA_STATUS_PBC); in bfa_dport_enable()
6548 if (!(bfa_asic_id_ct2(dport->bfa->ioc.pcidev.device_id))) { in bfa_dport_enable()
6549 bfa_trc(dport->bfa, dport->bfa->ioc.pcidev.device_id); in bfa_dport_enable()
6561 bfa_trc(dport->bfa, BFA_STATUS_PBC); in bfa_dport_enable()
6568 if (bfa_ioc_get_type(&bfa->ioc) != BFA_IOC_TYPE_FC) { in bfa_dport_enable()
6569 bfa_trc(dport->bfa, bfa_ioc_get_type(&bfa->ioc)); in bfa_dport_enable()
6578 bfa_trc(dport->bfa, 0); in bfa_dport_enable()
6586 bfa_trc(dport->bfa, 0); in bfa_dport_enable()
6594 bfa_trc(dport->bfa, 0); in bfa_dport_enable()
6603 bfa_trc(dport->bfa, 0); in bfa_dport_enable()
6610 if (dport->dynamic) in bfa_dport_enable()
6623 bfa_trc(dport->bfa, 0); in bfa_dport_enable()
6627 bfa_trc(dport->bfa, lpcnt); in bfa_dport_enable()
6628 bfa_trc(dport->bfa, pat); in bfa_dport_enable()
6629 dport->lpcnt = (lpcnt) ? lpcnt : DPORT_ENABLE_LOOPCNT_DEFAULT; in bfa_dport_enable()
6630 dport->payload = (pat) ? pat : LB_PATTERN_DEFAULT; in bfa_dport_enable()
6631 dport->cbfn = cbfn; in bfa_dport_enable()
6632 dport->cbarg = cbarg; in bfa_dport_enable()
6641 * @param[in] *bfa - bfa data struct
6647 struct bfa_dport_s *dport = &fcdiag->dport; in bfa_dport_disable()
6649 if (bfa_ioc_is_disabled(&bfa->ioc)) in bfa_dport_disable()
6654 bfa_trc(dport->bfa, BFA_STATUS_PBC); in bfa_dport_disable()
6661 if (dport->dynamic) { in bfa_dport_disable()
6670 bfa_trc(dport->bfa, 0); in bfa_dport_disable()
6684 bfa_trc(dport->bfa, 0); in bfa_dport_disable()
6688 dport->cbfn = cbfn; in bfa_dport_disable()
6689 dport->cbarg = cbarg; in bfa_dport_disable()
6696 * Dport start -- restart dport test
6698 * @param[in] *bfa - bfa data struct
6705 struct bfa_dport_s *dport = &fcdiag->dport; in bfa_dport_start()
6716 if (dport->dynamic) in bfa_dport_start()
6730 bfa_trc(dport->bfa, 0); in bfa_dport_start()
6734 if (dport->test_state == BFA_DPORT_ST_NO_SFP) in bfa_dport_start()
6737 if (dport->test_state == BFA_DPORT_ST_INP) in bfa_dport_start()
6740 WARN_ON(dport->test_state != BFA_DPORT_ST_COMP); in bfa_dport_start()
6743 bfa_trc(dport->bfa, lpcnt); in bfa_dport_start()
6744 bfa_trc(dport->bfa, pat); in bfa_dport_start()
6746 dport->lpcnt = (lpcnt) ? lpcnt : DPORT_ENABLE_LOOPCNT_DEFAULT; in bfa_dport_start()
6747 dport->payload = (pat) ? pat : LB_PATTERN_DEFAULT; in bfa_dport_start()
6749 dport->cbfn = cbfn; in bfa_dport_start()
6750 dport->cbarg = cbarg; in bfa_dport_start()
6757 * Dport show -- return dport test result
6759 * @param[in] *bfa - bfa data struct
6765 struct bfa_dport_s *dport = &fcdiag->dport; in bfa_dport_show()
6783 bfa_trc(dport->bfa, 0); in bfa_dport_show()
6791 if (dport->test_state == BFA_DPORT_ST_NO_SFP) in bfa_dport_show()
6794 memcpy(result, &dport->result, sizeof(struct bfa_diag_dport_result_s)); in bfa_dport_show()