Lines Matching refs:fcxp
68 static void hal_fcxp_rx_plog(struct bfa_s *bfa, struct bfa_fcxp_s *fcxp,
71 struct bfa_fcxp_s *fcxp, struct fchs_s *fchs);
73 static void bfa_fcxp_queue(struct bfa_fcxp_s *fcxp,
397 struct bfa_fcxp_s *fcxp; in claim_fcxps_mem() local
399 fcxp = (struct bfa_fcxp_s *) bfa_mem_kva_curp(mod); in claim_fcxps_mem()
400 memset(fcxp, 0, sizeof(struct bfa_fcxp_s) * mod->num_fcxps); in claim_fcxps_mem()
408 mod->fcxp_list = fcxp; in claim_fcxps_mem()
411 fcxp->fcxp_mod = mod; in claim_fcxps_mem()
412 fcxp->fcxp_tag = i; 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()
425 fcxp = fcxp + 1; in claim_fcxps_mem()
428 bfa_mem_kva_curp(mod) = (void *)fcxp; in claim_fcxps_mem()
495 struct bfa_fcxp_s *fcxp; in bfa_fcxp_iocdisable() local
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()
507 bfa_fcxp_free(fcxp); 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()
511 __bfa_fcxp_send_cbfn, fcxp); in bfa_fcxp_iocdisable()
519 struct bfa_fcxp_s *fcxp; in bfa_fcxp_get() local
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()
526 if (fcxp) in bfa_fcxp_get()
527 list_add_tail(&fcxp->qe, &fm->fcxp_active_q); in bfa_fcxp_get()
529 return fcxp; in bfa_fcxp_get()
533 bfa_fcxp_init_reqrsp(struct bfa_fcxp_s *fcxp, in bfa_fcxp_init_reqrsp() argument
547 bfa_trc(bfa, fcxp->fcxp_tag); in bfa_fcxp_init_reqrsp()
571 bfa_fcxp_init(struct bfa_fcxp_s *fcxp, in bfa_fcxp_init() argument
581 bfa_trc(bfa, fcxp->fcxp_tag); in bfa_fcxp_init()
583 fcxp->caller = caller; in bfa_fcxp_init()
585 bfa_fcxp_init_reqrsp(fcxp, bfa, 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()
590 bfa_fcxp_init_reqrsp(fcxp, bfa, 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()
598 bfa_fcxp_put(struct bfa_fcxp_s *fcxp) in bfa_fcxp_put() argument
600 struct bfa_fcxp_mod_s *mod = fcxp->fcxp_mod; in bfa_fcxp_put()
603 if (fcxp->req_rsp) 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()
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()
630 bfa_fcxp_null_comp(void *bfad_fcxp, struct bfa_fcxp_s *fcxp, void *cbarg, in bfa_fcxp_null_comp() argument
640 struct bfa_fcxp_s *fcxp = cbarg; in __bfa_fcxp_send_cbfn() local
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()
647 bfa_fcxp_free(fcxp); in __bfa_fcxp_send_cbfn()
655 struct bfa_fcxp_s *fcxp; in hal_fcxp_send_comp() local
671 fcxp = BFA_FCXP_FROM_TAG(mod, fcxp_tag); 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()
686 bfa_fcxp_free(fcxp); 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()
694 __bfa_fcxp_send_cbfn, fcxp); in hal_fcxp_send_comp()
697 bfa_trc(bfa, (NULL == fcxp->send_cbfn)); in hal_fcxp_send_comp()
702 hal_fcxp_tx_plog(struct bfa_s *bfa, u32 reqlen, struct bfa_fcxp_s *fcxp, in hal_fcxp_tx_plog() argument
709 if (fcxp->use_ireqbuf) { in hal_fcxp_tx_plog()
711 *((u32 *) BFA_FCXP_REQ_PLD(fcxp)); in hal_fcxp_tx_plog()
730 hal_fcxp_rx_plog(struct bfa_s *bfa, struct bfa_fcxp_s *fcxp, in hal_fcxp_rx_plog() argument
734 if (fcxp->use_irspbuf) { in hal_fcxp_rx_plog()
736 *((u32 *) BFA_FCXP_RSP_PLD(fcxp)); in hal_fcxp_rx_plog()
760 struct bfa_fcxp_s *fcxp = cbarg; in bfa_fcxp_qresume() local
761 struct bfa_s *bfa = fcxp->fcxp_mod->bfa; in bfa_fcxp_qresume()
764 fcxp->reqq_waiting = BFA_FALSE; in bfa_fcxp_qresume()
766 bfa_fcxp_queue(fcxp, send_req); in bfa_fcxp_qresume()
773 bfa_fcxp_queue(struct bfa_fcxp_s *fcxp, struct bfi_fcxp_send_req_s *send_req) in bfa_fcxp_queue() argument
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()
783 send_req->fcxp_tag = cpu_to_be16(fcxp->fcxp_tag); in bfa_fcxp_queue()
807 if (fcxp->use_ireqbuf == 1) { in bfa_fcxp_queue()
809 BFA_FCXP_REQ_PLD_PA(fcxp)); 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()
814 fcxp->req_sga_cbfn(fcxp->caller, 0)); in bfa_fcxp_queue()
824 if (fcxp->use_irspbuf == 1) { in bfa_fcxp_queue()
828 BFA_FCXP_RSP_PLD_PA(fcxp)); 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()
833 fcxp->rsp_sga_cbfn(fcxp->caller, 0)); in bfa_fcxp_queue()
841 hal_fcxp_tx_plog(bfa, reqi->req_tot_len, fcxp, &reqi->fchs); in bfa_fcxp_queue()
881 struct bfa_fcxp_s *fcxp = NULL; in bfa_fcxp_req_rsp_alloc() local
885 fcxp = bfa_fcxp_get(BFA_FCXP_MOD(bfa), req); in bfa_fcxp_req_rsp_alloc()
886 if (fcxp == NULL) in bfa_fcxp_req_rsp_alloc()
889 bfa_trc(bfa, fcxp->fcxp_tag); in bfa_fcxp_req_rsp_alloc()
891 bfa_fcxp_init(fcxp, caller, bfa, nreq_sgles, nrsp_sgles, req_sga_cbfn, in bfa_fcxp_req_rsp_alloc()
894 return fcxp; in bfa_fcxp_req_rsp_alloc()
905 bfa_fcxp_get_reqbuf(struct bfa_fcxp_s *fcxp) in bfa_fcxp_get_reqbuf() argument
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()
924 bfa_fcxp_get_rspbuf(struct bfa_fcxp_s *fcxp) in bfa_fcxp_get_rspbuf() argument
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()
946 bfa_fcxp_free(struct bfa_fcxp_s *fcxp) in bfa_fcxp_free() argument
948 struct bfa_fcxp_mod_s *mod = fcxp->fcxp_mod; in bfa_fcxp_free()
950 WARN_ON(fcxp == NULL); in bfa_fcxp_free()
951 bfa_trc(mod->bfa, fcxp->fcxp_tag); in bfa_fcxp_free()
952 bfa_fcxp_put(fcxp); in bfa_fcxp_free()
977 bfa_fcxp_send(struct bfa_fcxp_s *fcxp, struct bfa_rport_s *rport, in bfa_fcxp_send() argument
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()
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()
1015 bfa_fcxp_queue(fcxp, send_req); in bfa_fcxp_send()
1062 bfa_fcxp_discard(struct bfa_fcxp_s *fcxp) in bfa_fcxp_discard() argument
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()
1071 bfa_fcxp_free(fcxp); in bfa_fcxp_discard()
1075 fcxp->send_cbfn = bfa_fcxp_null_comp; in bfa_fcxp_discard()