Lines Matching refs:fcxp
106 static void hal_fcxp_rx_plog(struct bfa_s *bfa, struct bfa_fcxp_s *fcxp,
109 struct bfa_fcxp_s *fcxp, struct fchs_s *fchs);
111 static void bfa_fcxp_queue(struct bfa_fcxp_s *fcxp,
425 struct bfa_fcxp_s *fcxp; in claim_fcxps_mem() local
427 fcxp = (struct bfa_fcxp_s *) bfa_mem_kva_curp(mod); in claim_fcxps_mem()
428 memset(fcxp, 0, sizeof(struct bfa_fcxp_s) * mod->num_fcxps); in claim_fcxps_mem()
436 mod->fcxp_list = fcxp; in claim_fcxps_mem()
439 fcxp->fcxp_mod = mod; in claim_fcxps_mem()
440 fcxp->fcxp_tag = i; in claim_fcxps_mem()
443 list_add_tail(&fcxp->qe, &mod->fcxp_req_free_q); in claim_fcxps_mem()
444 fcxp->req_rsp = BFA_TRUE; in claim_fcxps_mem()
446 list_add_tail(&fcxp->qe, &mod->fcxp_rsp_free_q); in claim_fcxps_mem()
447 fcxp->req_rsp = BFA_FALSE; in claim_fcxps_mem()
450 bfa_reqq_winit(&fcxp->reqq_wqe, bfa_fcxp_qresume, fcxp); in claim_fcxps_mem()
451 fcxp->reqq_waiting = BFA_FALSE; in claim_fcxps_mem()
453 fcxp = fcxp + 1; in claim_fcxps_mem()
456 bfa_mem_kva_curp(mod) = (void *)fcxp; in claim_fcxps_mem()
523 struct bfa_fcxp_s *fcxp; in bfa_fcxp_iocdisable() local
531 fcxp = (struct bfa_fcxp_s *) qe; in bfa_fcxp_iocdisable()
532 if (fcxp->caller == NULL) { in bfa_fcxp_iocdisable()
533 fcxp->send_cbfn(fcxp->caller, fcxp, fcxp->send_cbarg, in bfa_fcxp_iocdisable()
535 bfa_fcxp_free(fcxp); in bfa_fcxp_iocdisable()
537 fcxp->rsp_status = BFA_STATUS_IOC_FAILURE; in bfa_fcxp_iocdisable()
538 bfa_cb_queue(bfa, &fcxp->hcb_qe, in bfa_fcxp_iocdisable()
539 __bfa_fcxp_send_cbfn, fcxp); in bfa_fcxp_iocdisable()
547 struct bfa_fcxp_s *fcxp; in bfa_fcxp_get() local
550 bfa_q_deq(&fm->fcxp_req_free_q, &fcxp); in bfa_fcxp_get()
552 bfa_q_deq(&fm->fcxp_rsp_free_q, &fcxp); in bfa_fcxp_get()
554 if (fcxp) in bfa_fcxp_get()
555 list_add_tail(&fcxp->qe, &fm->fcxp_active_q); in bfa_fcxp_get()
557 return fcxp; in bfa_fcxp_get()
561 bfa_fcxp_init_reqrsp(struct bfa_fcxp_s *fcxp, in bfa_fcxp_init_reqrsp() argument
575 bfa_trc(bfa, fcxp->fcxp_tag); in bfa_fcxp_init_reqrsp()
599 bfa_fcxp_init(struct bfa_fcxp_s *fcxp, in bfa_fcxp_init() argument
609 bfa_trc(bfa, fcxp->fcxp_tag); in bfa_fcxp_init()
611 fcxp->caller = caller; in bfa_fcxp_init()
613 bfa_fcxp_init_reqrsp(fcxp, bfa, in bfa_fcxp_init()
614 &fcxp->use_ireqbuf, &fcxp->nreq_sgles, &fcxp->req_sga_cbfn, in bfa_fcxp_init()
615 &fcxp->req_sglen_cbfn, &fcxp->req_sgpg_q, in bfa_fcxp_init()
618 bfa_fcxp_init_reqrsp(fcxp, bfa, in bfa_fcxp_init()
619 &fcxp->use_irspbuf, &fcxp->nrsp_sgles, &fcxp->rsp_sga_cbfn, in bfa_fcxp_init()
620 &fcxp->rsp_sglen_cbfn, &fcxp->rsp_sgpg_q, in bfa_fcxp_init()
626 bfa_fcxp_put(struct bfa_fcxp_s *fcxp) in bfa_fcxp_put() argument
628 struct bfa_fcxp_mod_s *mod = fcxp->fcxp_mod; in bfa_fcxp_put()
631 if (fcxp->req_rsp) in bfa_fcxp_put()
637 bfa_trc(mod->bfa, fcxp->fcxp_tag); in bfa_fcxp_put()
639 bfa_fcxp_init(fcxp, wqe->caller, wqe->bfa, wqe->nreq_sgles, in bfa_fcxp_put()
644 wqe->alloc_cbfn(wqe->alloc_cbarg, fcxp); in bfa_fcxp_put()
648 WARN_ON(!bfa_q_is_on_q(&mod->fcxp_active_q, fcxp)); in bfa_fcxp_put()
649 list_del(&fcxp->qe); in bfa_fcxp_put()
651 if (fcxp->req_rsp) in bfa_fcxp_put()
652 list_add_tail(&fcxp->qe, &mod->fcxp_req_free_q); in bfa_fcxp_put()
654 list_add_tail(&fcxp->qe, &mod->fcxp_rsp_free_q); in bfa_fcxp_put()
658 bfa_fcxp_null_comp(void *bfad_fcxp, struct bfa_fcxp_s *fcxp, void *cbarg, in bfa_fcxp_null_comp() argument
668 struct bfa_fcxp_s *fcxp = cbarg; in __bfa_fcxp_send_cbfn() local
671 fcxp->send_cbfn(fcxp->caller, fcxp, fcxp->send_cbarg, in __bfa_fcxp_send_cbfn()
672 fcxp->rsp_status, fcxp->rsp_len, in __bfa_fcxp_send_cbfn()
673 fcxp->residue_len, &fcxp->rsp_fchs); in __bfa_fcxp_send_cbfn()
675 bfa_fcxp_free(fcxp); in __bfa_fcxp_send_cbfn()
683 struct bfa_fcxp_s *fcxp; in hal_fcxp_send_comp() local
699 fcxp = BFA_FCXP_FROM_TAG(mod, fcxp_tag); in hal_fcxp_send_comp()
701 WARN_ON(fcxp->send_cbfn == NULL); in hal_fcxp_send_comp()
703 hal_fcxp_rx_plog(mod->bfa, fcxp, fcxp_rsp); in hal_fcxp_send_comp()
705 if (fcxp->send_cbfn != NULL) { in hal_fcxp_send_comp()
706 bfa_trc(mod->bfa, (NULL == fcxp->caller)); in hal_fcxp_send_comp()
707 if (fcxp->caller == NULL) { in hal_fcxp_send_comp()
708 fcxp->send_cbfn(fcxp->caller, fcxp, fcxp->send_cbarg, in hal_fcxp_send_comp()
714 bfa_fcxp_free(fcxp); in hal_fcxp_send_comp()
716 fcxp->rsp_status = fcxp_rsp->req_status; in hal_fcxp_send_comp()
717 fcxp->rsp_len = fcxp_rsp->rsp_len; in hal_fcxp_send_comp()
718 fcxp->residue_len = fcxp_rsp->residue_len; in hal_fcxp_send_comp()
719 fcxp->rsp_fchs = fcxp_rsp->fchs; in hal_fcxp_send_comp()
721 bfa_cb_queue(bfa, &fcxp->hcb_qe, in hal_fcxp_send_comp()
722 __bfa_fcxp_send_cbfn, fcxp); in hal_fcxp_send_comp()
725 bfa_trc(bfa, (NULL == fcxp->send_cbfn)); in hal_fcxp_send_comp()
730 hal_fcxp_tx_plog(struct bfa_s *bfa, u32 reqlen, struct bfa_fcxp_s *fcxp, in hal_fcxp_tx_plog() argument
737 if (fcxp->use_ireqbuf) { in hal_fcxp_tx_plog()
739 *((u32 *) BFA_FCXP_REQ_PLD(fcxp)); in hal_fcxp_tx_plog()
758 hal_fcxp_rx_plog(struct bfa_s *bfa, struct bfa_fcxp_s *fcxp, in hal_fcxp_rx_plog() argument
762 if (fcxp->use_irspbuf) { in hal_fcxp_rx_plog()
764 *((u32 *) BFA_FCXP_RSP_PLD(fcxp)); in hal_fcxp_rx_plog()
788 struct bfa_fcxp_s *fcxp = cbarg; in bfa_fcxp_qresume() local
789 struct bfa_s *bfa = fcxp->fcxp_mod->bfa; in bfa_fcxp_qresume()
792 fcxp->reqq_waiting = BFA_FALSE; in bfa_fcxp_qresume()
794 bfa_fcxp_queue(fcxp, send_req); in bfa_fcxp_qresume()
801 bfa_fcxp_queue(struct bfa_fcxp_s *fcxp, struct bfi_fcxp_send_req_s *send_req) in bfa_fcxp_queue() argument
803 struct bfa_s *bfa = fcxp->fcxp_mod->bfa; in bfa_fcxp_queue()
804 struct bfa_fcxp_req_info_s *reqi = &fcxp->req_info; in bfa_fcxp_queue()
805 struct bfa_fcxp_rsp_info_s *rspi = &fcxp->rsp_info; in bfa_fcxp_queue()
811 send_req->fcxp_tag = cpu_to_be16(fcxp->fcxp_tag); in bfa_fcxp_queue()
835 if (fcxp->use_ireqbuf == 1) { in bfa_fcxp_queue()
837 BFA_FCXP_REQ_PLD_PA(fcxp)); in bfa_fcxp_queue()
839 if (fcxp->nreq_sgles > 0) { in bfa_fcxp_queue()
840 WARN_ON(fcxp->nreq_sgles != 1); in bfa_fcxp_queue()
842 fcxp->req_sga_cbfn(fcxp->caller, 0)); in bfa_fcxp_queue()
852 if (fcxp->use_irspbuf == 1) { in bfa_fcxp_queue()
856 BFA_FCXP_RSP_PLD_PA(fcxp)); in bfa_fcxp_queue()
858 if (fcxp->nrsp_sgles > 0) { in bfa_fcxp_queue()
859 WARN_ON(fcxp->nrsp_sgles != 1); in bfa_fcxp_queue()
861 fcxp->rsp_sga_cbfn(fcxp->caller, 0)); in bfa_fcxp_queue()
869 hal_fcxp_tx_plog(bfa, reqi->req_tot_len, fcxp, &reqi->fchs); in bfa_fcxp_queue()
909 struct bfa_fcxp_s *fcxp = NULL; in bfa_fcxp_req_rsp_alloc() local
913 fcxp = bfa_fcxp_get(BFA_FCXP_MOD(bfa), req); in bfa_fcxp_req_rsp_alloc()
914 if (fcxp == NULL) in bfa_fcxp_req_rsp_alloc()
917 bfa_trc(bfa, fcxp->fcxp_tag); in bfa_fcxp_req_rsp_alloc()
919 bfa_fcxp_init(fcxp, caller, bfa, nreq_sgles, nrsp_sgles, req_sga_cbfn, in bfa_fcxp_req_rsp_alloc()
922 return fcxp; in bfa_fcxp_req_rsp_alloc()
933 bfa_fcxp_get_reqbuf(struct bfa_fcxp_s *fcxp) in bfa_fcxp_get_reqbuf() argument
935 struct bfa_fcxp_mod_s *mod = fcxp->fcxp_mod; in bfa_fcxp_get_reqbuf()
938 WARN_ON(fcxp->use_ireqbuf != 1); in bfa_fcxp_get_reqbuf()
939 reqbuf = bfa_mem_get_dmabuf_kva(mod, fcxp->fcxp_tag, in bfa_fcxp_get_reqbuf()
945 bfa_fcxp_get_reqbufsz(struct bfa_fcxp_s *fcxp) in bfa_fcxp_get_reqbufsz() argument
947 struct bfa_fcxp_mod_s *mod = fcxp->fcxp_mod; in bfa_fcxp_get_reqbufsz()
960 bfa_fcxp_get_rspbuf(struct bfa_fcxp_s *fcxp) in bfa_fcxp_get_rspbuf() argument
962 struct bfa_fcxp_mod_s *mod = fcxp->fcxp_mod; in bfa_fcxp_get_rspbuf()
965 WARN_ON(fcxp->use_irspbuf != 1); in bfa_fcxp_get_rspbuf()
967 fcxp_buf = bfa_mem_get_dmabuf_kva(mod, fcxp->fcxp_tag, in bfa_fcxp_get_rspbuf()
982 bfa_fcxp_free(struct bfa_fcxp_s *fcxp) in bfa_fcxp_free() argument
984 struct bfa_fcxp_mod_s *mod = fcxp->fcxp_mod; in bfa_fcxp_free()
986 WARN_ON(fcxp == NULL); in bfa_fcxp_free()
987 bfa_trc(mod->bfa, fcxp->fcxp_tag); in bfa_fcxp_free()
988 bfa_fcxp_put(fcxp); in bfa_fcxp_free()
1013 bfa_fcxp_send(struct bfa_fcxp_s *fcxp, struct bfa_rport_s *rport, in bfa_fcxp_send() argument
1018 struct bfa_s *bfa = fcxp->fcxp_mod->bfa; in bfa_fcxp_send()
1019 struct bfa_fcxp_req_info_s *reqi = &fcxp->req_info; in bfa_fcxp_send()
1020 struct bfa_fcxp_rsp_info_s *rspi = &fcxp->rsp_info; in bfa_fcxp_send()
1023 bfa_trc(bfa, fcxp->fcxp_tag); in bfa_fcxp_send()
1037 fcxp->send_cbfn = cbfn ? cbfn : bfa_fcxp_null_comp; in bfa_fcxp_send()
1038 fcxp->send_cbarg = cbarg; in bfa_fcxp_send()
1045 bfa_trc(bfa, fcxp->fcxp_tag); in bfa_fcxp_send()
1046 fcxp->reqq_waiting = BFA_TRUE; in bfa_fcxp_send()
1047 bfa_reqq_wait(bfa, BFA_REQQ_FCXP, &fcxp->reqq_wqe); in bfa_fcxp_send()
1051 bfa_fcxp_queue(fcxp, send_req); in bfa_fcxp_send()
1062 bfa_fcxp_abort(struct bfa_fcxp_s *fcxp) in bfa_fcxp_abort() argument
1064 bfa_trc(fcxp->fcxp_mod->bfa, fcxp->fcxp_tag); in bfa_fcxp_abort()
1113 bfa_fcxp_discard(struct bfa_fcxp_s *fcxp) in bfa_fcxp_discard() argument
1119 if (fcxp->reqq_waiting) { in bfa_fcxp_discard()
1120 fcxp->reqq_waiting = BFA_FALSE; in bfa_fcxp_discard()
1121 bfa_reqq_wcancel(&fcxp->reqq_wqe); in bfa_fcxp_discard()
1122 bfa_fcxp_free(fcxp); in bfa_fcxp_discard()
1126 fcxp->send_cbfn = bfa_fcxp_null_comp; in bfa_fcxp_discard()