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,
411 struct bfa_fcxp_s *fcxp; in claim_fcxps_mem() local
413 fcxp = (struct bfa_fcxp_s *) bfa_mem_kva_curp(mod); in claim_fcxps_mem()
414 memset(fcxp, 0, sizeof(struct bfa_fcxp_s) * mod->num_fcxps); in claim_fcxps_mem()
422 mod->fcxp_list = fcxp; in claim_fcxps_mem()
425 fcxp->fcxp_mod = mod; in claim_fcxps_mem()
426 fcxp->fcxp_tag = i; in claim_fcxps_mem()
429 list_add_tail(&fcxp->qe, &mod->fcxp_req_free_q); in claim_fcxps_mem()
430 fcxp->req_rsp = BFA_TRUE; in claim_fcxps_mem()
432 list_add_tail(&fcxp->qe, &mod->fcxp_rsp_free_q); in claim_fcxps_mem()
433 fcxp->req_rsp = BFA_FALSE; in claim_fcxps_mem()
436 bfa_reqq_winit(&fcxp->reqq_wqe, bfa_fcxp_qresume, fcxp); in claim_fcxps_mem()
437 fcxp->reqq_waiting = BFA_FALSE; in claim_fcxps_mem()
439 fcxp = fcxp + 1; in claim_fcxps_mem()
442 bfa_mem_kva_curp(mod) = (void *)fcxp; in claim_fcxps_mem()
509 struct bfa_fcxp_s *fcxp; in bfa_fcxp_iocdisable() local
517 fcxp = (struct bfa_fcxp_s *) qe; in bfa_fcxp_iocdisable()
518 if (fcxp->caller == NULL) { in bfa_fcxp_iocdisable()
519 fcxp->send_cbfn(fcxp->caller, fcxp, fcxp->send_cbarg, in bfa_fcxp_iocdisable()
521 bfa_fcxp_free(fcxp); in bfa_fcxp_iocdisable()
523 fcxp->rsp_status = BFA_STATUS_IOC_FAILURE; in bfa_fcxp_iocdisable()
524 bfa_cb_queue(bfa, &fcxp->hcb_qe, in bfa_fcxp_iocdisable()
525 __bfa_fcxp_send_cbfn, fcxp); in bfa_fcxp_iocdisable()
533 struct bfa_fcxp_s *fcxp; in bfa_fcxp_get() local
536 bfa_q_deq(&fm->fcxp_req_free_q, &fcxp); in bfa_fcxp_get()
538 bfa_q_deq(&fm->fcxp_rsp_free_q, &fcxp); in bfa_fcxp_get()
540 if (fcxp) in bfa_fcxp_get()
541 list_add_tail(&fcxp->qe, &fm->fcxp_active_q); in bfa_fcxp_get()
543 return fcxp; in bfa_fcxp_get()
547 bfa_fcxp_init_reqrsp(struct bfa_fcxp_s *fcxp, in bfa_fcxp_init_reqrsp() argument
561 bfa_trc(bfa, fcxp->fcxp_tag); in bfa_fcxp_init_reqrsp()
585 bfa_fcxp_init(struct bfa_fcxp_s *fcxp, in bfa_fcxp_init() argument
595 bfa_trc(bfa, fcxp->fcxp_tag); in bfa_fcxp_init()
597 fcxp->caller = caller; in bfa_fcxp_init()
599 bfa_fcxp_init_reqrsp(fcxp, bfa, in bfa_fcxp_init()
600 &fcxp->use_ireqbuf, &fcxp->nreq_sgles, &fcxp->req_sga_cbfn, in bfa_fcxp_init()
601 &fcxp->req_sglen_cbfn, &fcxp->req_sgpg_q, in bfa_fcxp_init()
604 bfa_fcxp_init_reqrsp(fcxp, bfa, in bfa_fcxp_init()
605 &fcxp->use_irspbuf, &fcxp->nrsp_sgles, &fcxp->rsp_sga_cbfn, in bfa_fcxp_init()
606 &fcxp->rsp_sglen_cbfn, &fcxp->rsp_sgpg_q, in bfa_fcxp_init()
612 bfa_fcxp_put(struct bfa_fcxp_s *fcxp) in bfa_fcxp_put() argument
614 struct bfa_fcxp_mod_s *mod = fcxp->fcxp_mod; in bfa_fcxp_put()
617 if (fcxp->req_rsp) in bfa_fcxp_put()
623 bfa_trc(mod->bfa, fcxp->fcxp_tag); in bfa_fcxp_put()
625 bfa_fcxp_init(fcxp, wqe->caller, wqe->bfa, wqe->nreq_sgles, in bfa_fcxp_put()
630 wqe->alloc_cbfn(wqe->alloc_cbarg, fcxp); in bfa_fcxp_put()
634 WARN_ON(!bfa_q_is_on_q(&mod->fcxp_active_q, fcxp)); in bfa_fcxp_put()
635 list_del(&fcxp->qe); in bfa_fcxp_put()
637 if (fcxp->req_rsp) in bfa_fcxp_put()
638 list_add_tail(&fcxp->qe, &mod->fcxp_req_free_q); in bfa_fcxp_put()
640 list_add_tail(&fcxp->qe, &mod->fcxp_rsp_free_q); in bfa_fcxp_put()
644 bfa_fcxp_null_comp(void *bfad_fcxp, struct bfa_fcxp_s *fcxp, void *cbarg, in bfa_fcxp_null_comp() argument
654 struct bfa_fcxp_s *fcxp = cbarg; in __bfa_fcxp_send_cbfn() local
657 fcxp->send_cbfn(fcxp->caller, fcxp, fcxp->send_cbarg, in __bfa_fcxp_send_cbfn()
658 fcxp->rsp_status, fcxp->rsp_len, in __bfa_fcxp_send_cbfn()
659 fcxp->residue_len, &fcxp->rsp_fchs); in __bfa_fcxp_send_cbfn()
661 bfa_fcxp_free(fcxp); in __bfa_fcxp_send_cbfn()
669 struct bfa_fcxp_s *fcxp; in hal_fcxp_send_comp() local
685 fcxp = BFA_FCXP_FROM_TAG(mod, fcxp_tag); in hal_fcxp_send_comp()
687 WARN_ON(fcxp->send_cbfn == NULL); in hal_fcxp_send_comp()
689 hal_fcxp_rx_plog(mod->bfa, fcxp, fcxp_rsp); in hal_fcxp_send_comp()
691 if (fcxp->send_cbfn != NULL) { in hal_fcxp_send_comp()
692 bfa_trc(mod->bfa, (NULL == fcxp->caller)); in hal_fcxp_send_comp()
693 if (fcxp->caller == NULL) { in hal_fcxp_send_comp()
694 fcxp->send_cbfn(fcxp->caller, fcxp, fcxp->send_cbarg, in hal_fcxp_send_comp()
700 bfa_fcxp_free(fcxp); in hal_fcxp_send_comp()
702 fcxp->rsp_status = fcxp_rsp->req_status; in hal_fcxp_send_comp()
703 fcxp->rsp_len = fcxp_rsp->rsp_len; in hal_fcxp_send_comp()
704 fcxp->residue_len = fcxp_rsp->residue_len; in hal_fcxp_send_comp()
705 fcxp->rsp_fchs = fcxp_rsp->fchs; in hal_fcxp_send_comp()
707 bfa_cb_queue(bfa, &fcxp->hcb_qe, in hal_fcxp_send_comp()
708 __bfa_fcxp_send_cbfn, fcxp); in hal_fcxp_send_comp()
711 bfa_trc(bfa, (NULL == fcxp->send_cbfn)); in hal_fcxp_send_comp()
716 hal_fcxp_tx_plog(struct bfa_s *bfa, u32 reqlen, struct bfa_fcxp_s *fcxp, in hal_fcxp_tx_plog() argument
723 if (fcxp->use_ireqbuf) { in hal_fcxp_tx_plog()
725 *((u32 *) BFA_FCXP_REQ_PLD(fcxp)); in hal_fcxp_tx_plog()
744 hal_fcxp_rx_plog(struct bfa_s *bfa, struct bfa_fcxp_s *fcxp, in hal_fcxp_rx_plog() argument
748 if (fcxp->use_irspbuf) { in hal_fcxp_rx_plog()
750 *((u32 *) BFA_FCXP_RSP_PLD(fcxp)); in hal_fcxp_rx_plog()
774 struct bfa_fcxp_s *fcxp = cbarg; in bfa_fcxp_qresume() local
775 struct bfa_s *bfa = fcxp->fcxp_mod->bfa; in bfa_fcxp_qresume()
778 fcxp->reqq_waiting = BFA_FALSE; in bfa_fcxp_qresume()
780 bfa_fcxp_queue(fcxp, send_req); in bfa_fcxp_qresume()
787 bfa_fcxp_queue(struct bfa_fcxp_s *fcxp, struct bfi_fcxp_send_req_s *send_req) in bfa_fcxp_queue() argument
789 struct bfa_s *bfa = fcxp->fcxp_mod->bfa; in bfa_fcxp_queue()
790 struct bfa_fcxp_req_info_s *reqi = &fcxp->req_info; in bfa_fcxp_queue()
791 struct bfa_fcxp_rsp_info_s *rspi = &fcxp->rsp_info; in bfa_fcxp_queue()
797 send_req->fcxp_tag = cpu_to_be16(fcxp->fcxp_tag); in bfa_fcxp_queue()
821 if (fcxp->use_ireqbuf == 1) { in bfa_fcxp_queue()
823 BFA_FCXP_REQ_PLD_PA(fcxp)); in bfa_fcxp_queue()
825 if (fcxp->nreq_sgles > 0) { in bfa_fcxp_queue()
826 WARN_ON(fcxp->nreq_sgles != 1); in bfa_fcxp_queue()
828 fcxp->req_sga_cbfn(fcxp->caller, 0)); in bfa_fcxp_queue()
838 if (fcxp->use_irspbuf == 1) { in bfa_fcxp_queue()
842 BFA_FCXP_RSP_PLD_PA(fcxp)); in bfa_fcxp_queue()
844 if (fcxp->nrsp_sgles > 0) { in bfa_fcxp_queue()
845 WARN_ON(fcxp->nrsp_sgles != 1); in bfa_fcxp_queue()
847 fcxp->rsp_sga_cbfn(fcxp->caller, 0)); in bfa_fcxp_queue()
855 hal_fcxp_tx_plog(bfa, reqi->req_tot_len, fcxp, &reqi->fchs); in bfa_fcxp_queue()
895 struct bfa_fcxp_s *fcxp = NULL; in bfa_fcxp_req_rsp_alloc() local
899 fcxp = bfa_fcxp_get(BFA_FCXP_MOD(bfa), req); in bfa_fcxp_req_rsp_alloc()
900 if (fcxp == NULL) in bfa_fcxp_req_rsp_alloc()
903 bfa_trc(bfa, fcxp->fcxp_tag); in bfa_fcxp_req_rsp_alloc()
905 bfa_fcxp_init(fcxp, caller, bfa, nreq_sgles, nrsp_sgles, req_sga_cbfn, in bfa_fcxp_req_rsp_alloc()
908 return fcxp; in bfa_fcxp_req_rsp_alloc()
919 bfa_fcxp_get_reqbuf(struct bfa_fcxp_s *fcxp) in bfa_fcxp_get_reqbuf() argument
921 struct bfa_fcxp_mod_s *mod = fcxp->fcxp_mod; in bfa_fcxp_get_reqbuf()
924 WARN_ON(fcxp->use_ireqbuf != 1); in bfa_fcxp_get_reqbuf()
925 reqbuf = bfa_mem_get_dmabuf_kva(mod, fcxp->fcxp_tag, in bfa_fcxp_get_reqbuf()
931 bfa_fcxp_get_reqbufsz(struct bfa_fcxp_s *fcxp) in bfa_fcxp_get_reqbufsz() argument
933 struct bfa_fcxp_mod_s *mod = fcxp->fcxp_mod; in bfa_fcxp_get_reqbufsz()
946 bfa_fcxp_get_rspbuf(struct bfa_fcxp_s *fcxp) in bfa_fcxp_get_rspbuf() argument
948 struct bfa_fcxp_mod_s *mod = fcxp->fcxp_mod; in bfa_fcxp_get_rspbuf()
951 WARN_ON(fcxp->use_irspbuf != 1); in bfa_fcxp_get_rspbuf()
953 fcxp_buf = bfa_mem_get_dmabuf_kva(mod, fcxp->fcxp_tag, in bfa_fcxp_get_rspbuf()
968 bfa_fcxp_free(struct bfa_fcxp_s *fcxp) in bfa_fcxp_free() argument
970 struct bfa_fcxp_mod_s *mod = fcxp->fcxp_mod; in bfa_fcxp_free()
972 WARN_ON(fcxp == NULL); in bfa_fcxp_free()
973 bfa_trc(mod->bfa, fcxp->fcxp_tag); in bfa_fcxp_free()
974 bfa_fcxp_put(fcxp); in bfa_fcxp_free()
999 bfa_fcxp_send(struct bfa_fcxp_s *fcxp, struct bfa_rport_s *rport, in bfa_fcxp_send() argument
1004 struct bfa_s *bfa = fcxp->fcxp_mod->bfa; in bfa_fcxp_send()
1005 struct bfa_fcxp_req_info_s *reqi = &fcxp->req_info; in bfa_fcxp_send()
1006 struct bfa_fcxp_rsp_info_s *rspi = &fcxp->rsp_info; in bfa_fcxp_send()
1009 bfa_trc(bfa, fcxp->fcxp_tag); in bfa_fcxp_send()
1023 fcxp->send_cbfn = cbfn ? cbfn : bfa_fcxp_null_comp; in bfa_fcxp_send()
1024 fcxp->send_cbarg = cbarg; in bfa_fcxp_send()
1031 bfa_trc(bfa, fcxp->fcxp_tag); in bfa_fcxp_send()
1032 fcxp->reqq_waiting = BFA_TRUE; in bfa_fcxp_send()
1033 bfa_reqq_wait(bfa, BFA_REQQ_FCXP, &fcxp->reqq_wqe); in bfa_fcxp_send()
1037 bfa_fcxp_queue(fcxp, send_req); in bfa_fcxp_send()
1048 bfa_fcxp_abort(struct bfa_fcxp_s *fcxp) in bfa_fcxp_abort() argument
1050 bfa_trc(fcxp->fcxp_mod->bfa, fcxp->fcxp_tag); in bfa_fcxp_abort()
1099 bfa_fcxp_discard(struct bfa_fcxp_s *fcxp) in bfa_fcxp_discard() argument
1105 if (fcxp->reqq_waiting) { in bfa_fcxp_discard()
1106 fcxp->reqq_waiting = BFA_FALSE; in bfa_fcxp_discard()
1107 bfa_reqq_wcancel(&fcxp->reqq_wqe); in bfa_fcxp_discard()
1108 bfa_fcxp_free(fcxp); in bfa_fcxp_discard()
1112 fcxp->send_cbfn = bfa_fcxp_null_comp; in bfa_fcxp_discard()