Lines Matching refs:fcxp
98 static void hal_fcxp_rx_plog(struct bfa_s *bfa, struct bfa_fcxp_s *fcxp,
101 struct bfa_fcxp_s *fcxp, struct fchs_s *fchs);
103 static void bfa_fcxp_queue(struct bfa_fcxp_s *fcxp,
417 struct bfa_fcxp_s *fcxp; in claim_fcxps_mem() local
419 fcxp = (struct bfa_fcxp_s *) bfa_mem_kva_curp(mod); in claim_fcxps_mem()
420 memset(fcxp, 0, sizeof(struct bfa_fcxp_s) * mod->num_fcxps); in claim_fcxps_mem()
428 mod->fcxp_list = fcxp; in claim_fcxps_mem()
431 fcxp->fcxp_mod = mod; in claim_fcxps_mem()
432 fcxp->fcxp_tag = i; in claim_fcxps_mem()
435 list_add_tail(&fcxp->qe, &mod->fcxp_req_free_q); in claim_fcxps_mem()
436 fcxp->req_rsp = BFA_TRUE; in claim_fcxps_mem()
438 list_add_tail(&fcxp->qe, &mod->fcxp_rsp_free_q); in claim_fcxps_mem()
439 fcxp->req_rsp = BFA_FALSE; in claim_fcxps_mem()
442 bfa_reqq_winit(&fcxp->reqq_wqe, bfa_fcxp_qresume, fcxp); in claim_fcxps_mem()
443 fcxp->reqq_waiting = BFA_FALSE; in claim_fcxps_mem()
445 fcxp = fcxp + 1; in claim_fcxps_mem()
448 bfa_mem_kva_curp(mod) = (void *)fcxp; in claim_fcxps_mem()
515 struct bfa_fcxp_s *fcxp; in bfa_fcxp_iocdisable() local
523 fcxp = (struct bfa_fcxp_s *) qe; in bfa_fcxp_iocdisable()
524 if (fcxp->caller == NULL) { in bfa_fcxp_iocdisable()
525 fcxp->send_cbfn(fcxp->caller, fcxp, fcxp->send_cbarg, in bfa_fcxp_iocdisable()
527 bfa_fcxp_free(fcxp); in bfa_fcxp_iocdisable()
529 fcxp->rsp_status = BFA_STATUS_IOC_FAILURE; in bfa_fcxp_iocdisable()
530 bfa_cb_queue(bfa, &fcxp->hcb_qe, in bfa_fcxp_iocdisable()
531 __bfa_fcxp_send_cbfn, fcxp); in bfa_fcxp_iocdisable()
539 struct bfa_fcxp_s *fcxp; in bfa_fcxp_get() local
542 bfa_q_deq(&fm->fcxp_req_free_q, &fcxp); in bfa_fcxp_get()
544 bfa_q_deq(&fm->fcxp_rsp_free_q, &fcxp); in bfa_fcxp_get()
546 if (fcxp) in bfa_fcxp_get()
547 list_add_tail(&fcxp->qe, &fm->fcxp_active_q); in bfa_fcxp_get()
549 return fcxp; in bfa_fcxp_get()
553 bfa_fcxp_init_reqrsp(struct bfa_fcxp_s *fcxp, in bfa_fcxp_init_reqrsp() argument
567 bfa_trc(bfa, fcxp->fcxp_tag); in bfa_fcxp_init_reqrsp()
591 bfa_fcxp_init(struct bfa_fcxp_s *fcxp, in bfa_fcxp_init() argument
601 bfa_trc(bfa, fcxp->fcxp_tag); in bfa_fcxp_init()
603 fcxp->caller = caller; in bfa_fcxp_init()
605 bfa_fcxp_init_reqrsp(fcxp, bfa, in bfa_fcxp_init()
606 &fcxp->use_ireqbuf, &fcxp->nreq_sgles, &fcxp->req_sga_cbfn, in bfa_fcxp_init()
607 &fcxp->req_sglen_cbfn, &fcxp->req_sgpg_q, in bfa_fcxp_init()
610 bfa_fcxp_init_reqrsp(fcxp, bfa, in bfa_fcxp_init()
611 &fcxp->use_irspbuf, &fcxp->nrsp_sgles, &fcxp->rsp_sga_cbfn, in bfa_fcxp_init()
612 &fcxp->rsp_sglen_cbfn, &fcxp->rsp_sgpg_q, in bfa_fcxp_init()
618 bfa_fcxp_put(struct bfa_fcxp_s *fcxp) in bfa_fcxp_put() argument
620 struct bfa_fcxp_mod_s *mod = fcxp->fcxp_mod; in bfa_fcxp_put()
623 if (fcxp->req_rsp) in bfa_fcxp_put()
629 bfa_trc(mod->bfa, fcxp->fcxp_tag); in bfa_fcxp_put()
631 bfa_fcxp_init(fcxp, wqe->caller, wqe->bfa, wqe->nreq_sgles, in bfa_fcxp_put()
636 wqe->alloc_cbfn(wqe->alloc_cbarg, fcxp); in bfa_fcxp_put()
640 WARN_ON(!bfa_q_is_on_q(&mod->fcxp_active_q, fcxp)); in bfa_fcxp_put()
641 list_del(&fcxp->qe); in bfa_fcxp_put()
643 if (fcxp->req_rsp) in bfa_fcxp_put()
644 list_add_tail(&fcxp->qe, &mod->fcxp_req_free_q); in bfa_fcxp_put()
646 list_add_tail(&fcxp->qe, &mod->fcxp_rsp_free_q); in bfa_fcxp_put()
650 bfa_fcxp_null_comp(void *bfad_fcxp, struct bfa_fcxp_s *fcxp, void *cbarg, in bfa_fcxp_null_comp() argument
660 struct bfa_fcxp_s *fcxp = cbarg; in __bfa_fcxp_send_cbfn() local
663 fcxp->send_cbfn(fcxp->caller, fcxp, fcxp->send_cbarg, in __bfa_fcxp_send_cbfn()
664 fcxp->rsp_status, fcxp->rsp_len, in __bfa_fcxp_send_cbfn()
665 fcxp->residue_len, &fcxp->rsp_fchs); in __bfa_fcxp_send_cbfn()
667 bfa_fcxp_free(fcxp); in __bfa_fcxp_send_cbfn()
675 struct bfa_fcxp_s *fcxp; in hal_fcxp_send_comp() local
691 fcxp = BFA_FCXP_FROM_TAG(mod, fcxp_tag); in hal_fcxp_send_comp()
693 WARN_ON(fcxp->send_cbfn == NULL); in hal_fcxp_send_comp()
695 hal_fcxp_rx_plog(mod->bfa, fcxp, fcxp_rsp); in hal_fcxp_send_comp()
697 if (fcxp->send_cbfn != NULL) { in hal_fcxp_send_comp()
698 bfa_trc(mod->bfa, (NULL == fcxp->caller)); in hal_fcxp_send_comp()
699 if (fcxp->caller == NULL) { in hal_fcxp_send_comp()
700 fcxp->send_cbfn(fcxp->caller, fcxp, fcxp->send_cbarg, in hal_fcxp_send_comp()
706 bfa_fcxp_free(fcxp); in hal_fcxp_send_comp()
708 fcxp->rsp_status = fcxp_rsp->req_status; in hal_fcxp_send_comp()
709 fcxp->rsp_len = fcxp_rsp->rsp_len; in hal_fcxp_send_comp()
710 fcxp->residue_len = fcxp_rsp->residue_len; in hal_fcxp_send_comp()
711 fcxp->rsp_fchs = fcxp_rsp->fchs; in hal_fcxp_send_comp()
713 bfa_cb_queue(bfa, &fcxp->hcb_qe, in hal_fcxp_send_comp()
714 __bfa_fcxp_send_cbfn, fcxp); in hal_fcxp_send_comp()
717 bfa_trc(bfa, (NULL == fcxp->send_cbfn)); in hal_fcxp_send_comp()
722 hal_fcxp_tx_plog(struct bfa_s *bfa, u32 reqlen, struct bfa_fcxp_s *fcxp, in hal_fcxp_tx_plog() argument
729 if (fcxp->use_ireqbuf) { in hal_fcxp_tx_plog()
731 *((u32 *) BFA_FCXP_REQ_PLD(fcxp)); in hal_fcxp_tx_plog()
750 hal_fcxp_rx_plog(struct bfa_s *bfa, struct bfa_fcxp_s *fcxp, in hal_fcxp_rx_plog() argument
754 if (fcxp->use_irspbuf) { in hal_fcxp_rx_plog()
756 *((u32 *) BFA_FCXP_RSP_PLD(fcxp)); in hal_fcxp_rx_plog()
780 struct bfa_fcxp_s *fcxp = cbarg; in bfa_fcxp_qresume() local
781 struct bfa_s *bfa = fcxp->fcxp_mod->bfa; in bfa_fcxp_qresume()
784 fcxp->reqq_waiting = BFA_FALSE; in bfa_fcxp_qresume()
786 bfa_fcxp_queue(fcxp, send_req); in bfa_fcxp_qresume()
793 bfa_fcxp_queue(struct bfa_fcxp_s *fcxp, struct bfi_fcxp_send_req_s *send_req) in bfa_fcxp_queue() argument
795 struct bfa_s *bfa = fcxp->fcxp_mod->bfa; in bfa_fcxp_queue()
796 struct bfa_fcxp_req_info_s *reqi = &fcxp->req_info; in bfa_fcxp_queue()
797 struct bfa_fcxp_rsp_info_s *rspi = &fcxp->rsp_info; in bfa_fcxp_queue()
803 send_req->fcxp_tag = cpu_to_be16(fcxp->fcxp_tag); in bfa_fcxp_queue()
827 if (fcxp->use_ireqbuf == 1) { in bfa_fcxp_queue()
829 BFA_FCXP_REQ_PLD_PA(fcxp)); in bfa_fcxp_queue()
831 if (fcxp->nreq_sgles > 0) { in bfa_fcxp_queue()
832 WARN_ON(fcxp->nreq_sgles != 1); in bfa_fcxp_queue()
834 fcxp->req_sga_cbfn(fcxp->caller, 0)); in bfa_fcxp_queue()
844 if (fcxp->use_irspbuf == 1) { in bfa_fcxp_queue()
848 BFA_FCXP_RSP_PLD_PA(fcxp)); in bfa_fcxp_queue()
850 if (fcxp->nrsp_sgles > 0) { in bfa_fcxp_queue()
851 WARN_ON(fcxp->nrsp_sgles != 1); in bfa_fcxp_queue()
853 fcxp->rsp_sga_cbfn(fcxp->caller, 0)); in bfa_fcxp_queue()
861 hal_fcxp_tx_plog(bfa, reqi->req_tot_len, fcxp, &reqi->fchs); in bfa_fcxp_queue()
901 struct bfa_fcxp_s *fcxp = NULL; in bfa_fcxp_req_rsp_alloc() local
905 fcxp = bfa_fcxp_get(BFA_FCXP_MOD(bfa), req); in bfa_fcxp_req_rsp_alloc()
906 if (fcxp == NULL) in bfa_fcxp_req_rsp_alloc()
909 bfa_trc(bfa, fcxp->fcxp_tag); in bfa_fcxp_req_rsp_alloc()
911 bfa_fcxp_init(fcxp, caller, bfa, nreq_sgles, nrsp_sgles, req_sga_cbfn, in bfa_fcxp_req_rsp_alloc()
914 return fcxp; in bfa_fcxp_req_rsp_alloc()
925 bfa_fcxp_get_reqbuf(struct bfa_fcxp_s *fcxp) in bfa_fcxp_get_reqbuf() argument
927 struct bfa_fcxp_mod_s *mod = fcxp->fcxp_mod; in bfa_fcxp_get_reqbuf()
930 WARN_ON(fcxp->use_ireqbuf != 1); in bfa_fcxp_get_reqbuf()
931 reqbuf = bfa_mem_get_dmabuf_kva(mod, fcxp->fcxp_tag, in bfa_fcxp_get_reqbuf()
937 bfa_fcxp_get_reqbufsz(struct bfa_fcxp_s *fcxp) in bfa_fcxp_get_reqbufsz() argument
939 struct bfa_fcxp_mod_s *mod = fcxp->fcxp_mod; in bfa_fcxp_get_reqbufsz()
952 bfa_fcxp_get_rspbuf(struct bfa_fcxp_s *fcxp) in bfa_fcxp_get_rspbuf() argument
954 struct bfa_fcxp_mod_s *mod = fcxp->fcxp_mod; in bfa_fcxp_get_rspbuf()
957 WARN_ON(fcxp->use_irspbuf != 1); in bfa_fcxp_get_rspbuf()
959 fcxp_buf = bfa_mem_get_dmabuf_kva(mod, fcxp->fcxp_tag, in bfa_fcxp_get_rspbuf()
974 bfa_fcxp_free(struct bfa_fcxp_s *fcxp) in bfa_fcxp_free() argument
976 struct bfa_fcxp_mod_s *mod = fcxp->fcxp_mod; in bfa_fcxp_free()
978 WARN_ON(fcxp == NULL); in bfa_fcxp_free()
979 bfa_trc(mod->bfa, fcxp->fcxp_tag); in bfa_fcxp_free()
980 bfa_fcxp_put(fcxp); in bfa_fcxp_free()
1005 bfa_fcxp_send(struct bfa_fcxp_s *fcxp, struct bfa_rport_s *rport, in bfa_fcxp_send() argument
1010 struct bfa_s *bfa = fcxp->fcxp_mod->bfa; in bfa_fcxp_send()
1011 struct bfa_fcxp_req_info_s *reqi = &fcxp->req_info; in bfa_fcxp_send()
1012 struct bfa_fcxp_rsp_info_s *rspi = &fcxp->rsp_info; in bfa_fcxp_send()
1015 bfa_trc(bfa, fcxp->fcxp_tag); in bfa_fcxp_send()
1029 fcxp->send_cbfn = cbfn ? cbfn : bfa_fcxp_null_comp; in bfa_fcxp_send()
1030 fcxp->send_cbarg = cbarg; in bfa_fcxp_send()
1037 bfa_trc(bfa, fcxp->fcxp_tag); in bfa_fcxp_send()
1038 fcxp->reqq_waiting = BFA_TRUE; in bfa_fcxp_send()
1039 bfa_reqq_wait(bfa, BFA_REQQ_FCXP, &fcxp->reqq_wqe); in bfa_fcxp_send()
1043 bfa_fcxp_queue(fcxp, send_req); in bfa_fcxp_send()
1054 bfa_fcxp_abort(struct bfa_fcxp_s *fcxp) in bfa_fcxp_abort() argument
1056 bfa_trc(fcxp->fcxp_mod->bfa, fcxp->fcxp_tag); in bfa_fcxp_abort()
1105 bfa_fcxp_discard(struct bfa_fcxp_s *fcxp) in bfa_fcxp_discard() argument
1111 if (fcxp->reqq_waiting) { in bfa_fcxp_discard()
1112 fcxp->reqq_waiting = BFA_FALSE; in bfa_fcxp_discard()
1113 bfa_reqq_wcancel(&fcxp->reqq_wqe); in bfa_fcxp_discard()
1114 bfa_fcxp_free(fcxp); in bfa_fcxp_discard()
1118 fcxp->send_cbfn = bfa_fcxp_null_comp; in bfa_fcxp_discard()