Lines Matching defs:qp

47 static int hermon_qp_reset2init(hermon_state_t *state, hermon_qphdl_t qp,
49 static int hermon_qp_init2init(hermon_state_t *state, hermon_qphdl_t qp,
51 static int hermon_qp_init2rtr(hermon_state_t *state, hermon_qphdl_t qp,
53 static int hermon_qp_rtr2rts(hermon_state_t *state, hermon_qphdl_t qp,
55 static int hermon_qp_rts2rts(hermon_state_t *state, hermon_qphdl_t qp,
58 static int hermon_qp_rts2sqd(hermon_state_t *state, hermon_qphdl_t qp,
61 static int hermon_qp_sqd2rts(hermon_state_t *state, hermon_qphdl_t qp,
63 static int hermon_qp_sqd2sqd(hermon_state_t *state, hermon_qphdl_t qp,
65 static int hermon_qp_sqerr2rts(hermon_state_t *state, hermon_qphdl_t qp,
67 static int hermon_qp_to_error(hermon_state_t *state, hermon_qphdl_t qp);
68 static int hermon_qp_reset2err(hermon_state_t *state, hermon_qphdl_t qp);
84 hermon_qp_modify(hermon_state_t *state, hermon_qphdl_t qp,
109 mutex_enter(&qp->qp_lock);
123 if (!(HERMON_QP_TYPE_VALID(info_p->qp_trans, qp->qp_serv_type))) {
124 mutex_exit(&qp->qp_lock);
134 * last modified to or queried as - in "qp->qp_state").
159 mutex_exit(&qp->qp_lock);
163 cur_state = qp->qp_state;
178 mutex_exit(&qp->qp_lock);
191 mutex_exit(&qp->qp_lock);
201 status = hermon_qp_reset2init(state, qp, info_p);
203 mutex_exit(&qp->qp_lock);
206 qp->qp_state = HERMON_QP_INIT;
207 HERMON_SET_QP_POST_SEND_STATE(qp, HERMON_QP_INIT);
214 * and return success. The qp->qp_state should
222 mutex_exit(&qp->qp_lock);
230 status = hermon_qp_reset2err(state, qp);
232 mutex_exit(&qp->qp_lock);
235 qp->qp_state = HERMON_QP_ERR;
236 HERMON_SET_QP_POST_SEND_STATE(qp, HERMON_QP_ERR);
240 mutex_exit(&qp->qp_lock);
254 status = hermon_wrid_from_reset_handling(state, qp);
256 if (hermon_qp_to_reset(state, qp) != DDI_SUCCESS) {
259 qp->qp_state = HERMON_QP_RESET;
260 HERMON_SET_QP_POST_SEND_STATE(qp, HERMON_QP_RESET);
262 mutex_exit(&qp->qp_lock);
280 mutex_exit(&qp->qp_lock);
293 mutex_exit(&qp->qp_lock);
303 status = hermon_qp_init2rtr(state, qp, flags, info_p);
305 mutex_exit(&qp->qp_lock);
308 qp->qp_state = HERMON_QP_RTR;
309 HERMON_SET_QP_POST_SEND_STATE(qp, HERMON_QP_RTR);
316 status = hermon_qp_init2init(state, qp, flags, info_p);
318 mutex_exit(&qp->qp_lock);
321 qp->qp_state = HERMON_QP_INIT;
322 HERMON_SET_QP_POST_SEND_STATE(qp, HERMON_QP_INIT);
329 status = hermon_qp_to_reset(state, qp);
331 mutex_exit(&qp->qp_lock);
334 qp->qp_state = HERMON_QP_RESET;
335 HERMON_SET_QP_POST_SEND_STATE(qp, HERMON_QP_RESET);
342 status = hermon_wrid_to_reset_handling(state, qp);
344 mutex_exit(&qp->qp_lock);
353 status = hermon_qp_to_error(state, qp);
355 mutex_exit(&qp->qp_lock);
358 qp->qp_state = HERMON_QP_ERR;
359 HERMON_SET_QP_POST_SEND_STATE(qp, HERMON_QP_ERR);
363 mutex_exit(&qp->qp_lock);
383 mutex_exit(&qp->qp_lock);
396 mutex_exit(&qp->qp_lock);
406 status = hermon_qp_rtr2rts(state, qp, flags, info_p);
408 mutex_exit(&qp->qp_lock);
411 qp->qp_state = HERMON_QP_RTS;
412 HERMON_SET_QP_POST_SEND_STATE(qp, HERMON_QP_RTS);
419 status = hermon_qp_to_reset(state, qp);
421 mutex_exit(&qp->qp_lock);
424 qp->qp_state = HERMON_QP_RESET;
425 HERMON_SET_QP_POST_SEND_STATE(qp, HERMON_QP_RESET);
432 status = hermon_wrid_to_reset_handling(state, qp);
434 mutex_exit(&qp->qp_lock);
443 status = hermon_qp_to_error(state, qp);
445 mutex_exit(&qp->qp_lock);
448 qp->qp_state = HERMON_QP_ERR;
449 HERMON_SET_QP_POST_SEND_STATE(qp, HERMON_QP_ERR);
453 mutex_exit(&qp->qp_lock);
471 mutex_exit(&qp->qp_lock);
485 status = hermon_qp_rts2rts(state, qp, flags, info_p);
487 mutex_exit(&qp->qp_lock);
490 qp->qp_state = HERMON_QP_RTS;
491 HERMON_SET_QP_POST_SEND_STATE(qp, HERMON_QP_RTS);
499 status = hermon_qp_rts2sqd(state, qp, flags);
501 mutex_exit(&qp->qp_lock);
504 qp->qp_state = HERMON_QP_SQD;
505 HERMON_SET_QP_POST_SEND_STATE(qp, HERMON_QP_SQD);
508 mutex_exit(&qp->qp_lock);
518 status = hermon_qp_to_reset(state, qp);
520 mutex_exit(&qp->qp_lock);
523 qp->qp_state = HERMON_QP_RESET;
524 HERMON_SET_QP_POST_SEND_STATE(qp, HERMON_QP_RESET);
531 status = hermon_wrid_to_reset_handling(state, qp);
533 mutex_exit(&qp->qp_lock);
542 status = hermon_qp_to_error(state, qp);
544 mutex_exit(&qp->qp_lock);
547 qp->qp_state = HERMON_QP_ERR;
548 HERMON_SET_QP_POST_SEND_STATE(qp, HERMON_QP_ERR);
552 mutex_exit(&qp->qp_lock);
568 mutex_exit(&qp->qp_lock);
582 status = hermon_qp_sqerr2rts(state, qp, flags, info_p);
584 mutex_exit(&qp->qp_lock);
587 qp->qp_state = HERMON_QP_RTS;
588 HERMON_SET_QP_POST_SEND_STATE(qp, HERMON_QP_RTS);
595 status = hermon_qp_to_reset(state, qp);
597 mutex_exit(&qp->qp_lock);
600 qp->qp_state = HERMON_QP_RESET;
601 HERMON_SET_QP_POST_SEND_STATE(qp, HERMON_QP_RESET);
608 status = hermon_wrid_to_reset_handling(state, qp);
610 mutex_exit(&qp->qp_lock);
619 status = hermon_qp_to_error(state, qp);
621 mutex_exit(&qp->qp_lock);
624 qp->qp_state = HERMON_QP_ERR;
625 HERMON_SET_QP_POST_SEND_STATE(qp, HERMON_QP_ERR);
629 mutex_exit(&qp->qp_lock);
650 mutex_exit(&qp->qp_lock);
665 status = hermon_qp_sqd2sqd(state, qp, flags, info_p);
667 mutex_exit(&qp->qp_lock);
670 qp->qp_state = HERMON_QP_SQD;
671 HERMON_SET_QP_POST_SEND_STATE(qp, HERMON_QP_SQD);
681 if (qp->qp_sqd_still_draining) {
682 mutex_exit(&qp->qp_lock);
693 status = hermon_qp_sqd2sqd(state, qp, flags, info_p);
695 mutex_exit(&qp->qp_lock);
698 qp->qp_state = HERMON_QP_SQD;
699 HERMON_SET_QP_POST_SEND_STATE(qp, HERMON_QP_SQD);
706 status = hermon_qp_sqd2rts(state, qp,
709 mutex_exit(&qp->qp_lock);
712 qp->qp_state = HERMON_QP_RTS;
713 HERMON_SET_QP_POST_SEND_STATE(qp, HERMON_QP_RTS);
720 status = hermon_qp_to_reset(state, qp);
722 mutex_exit(&qp->qp_lock);
725 qp->qp_state = HERMON_QP_RESET;
726 HERMON_SET_QP_POST_SEND_STATE(qp, HERMON_QP_RESET);
733 status = hermon_wrid_to_reset_handling(state, qp);
735 mutex_exit(&qp->qp_lock);
744 status = hermon_qp_to_error(state, qp);
746 mutex_exit(&qp->qp_lock);
749 qp->qp_state = HERMON_QP_ERR;
750 HERMON_SET_QP_POST_SEND_STATE(qp, HERMON_QP_ERR);
754 mutex_exit(&qp->qp_lock);
770 status = hermon_qp_to_reset(state, qp);
772 mutex_exit(&qp->qp_lock);
775 qp->qp_state = HERMON_QP_RESET;
776 HERMON_SET_QP_POST_SEND_STATE(qp, HERMON_QP_RESET);
783 status = hermon_wrid_to_reset_handling(state, qp);
785 mutex_exit(&qp->qp_lock);
794 * and return success. The qp->qp_state should
798 mutex_exit(&qp->qp_lock);
803 mutex_exit(&qp->qp_lock);
815 mutex_exit(&qp->qp_lock);
821 mutex_exit(&qp->qp_lock);
834 hermon_qp_reset2init(hermon_state_t *state, hermon_qphdl_t qp,
846 ASSERT(MUTEX_HELD(&qp->qp_lock));
851 qpc = &qp->qpc;
857 if (qp->qp_is_special) {
860 qpc->serv_type = qp->qp_serv_type;
864 qpc->pd = qp->qp_pdhdl->pd_pdnum;
866 qpc->log_sq_stride = qp->qp_sq_log_wqesz - 4;
867 qpc->log_rq_stride = qp->qp_rq_log_wqesz - 4;
868 qpc->sq_no_prefetch = qp->qp_no_prefetch;
869 qpc->log_sq_size = highbit(qp->qp_sq_bufsz) - 1;
870 qpc->log_rq_size = highbit(qp->qp_rq_bufsz) - 1;
872 qpc->usr_page = qp->qp_uarpg;
876 (qp->qp_sq_cqhdl == NULL) ? 0 : qp->qp_sq_cqhdl->cq_cqnum & cqnmask;
877 qpc->page_offs = qp->qp_wqinfo.qa_pgoffs >> 6;
879 (qp->qp_rq_cqhdl == NULL) ? 0 : qp->qp_rq_cqhdl->cq_cqnum & cqnmask;
882 qpc->dbr_addrh = ((uint64_t)qp->qp_rq_pdbr >> 32);
883 qpc->dbr_addrl = ((uint64_t)qp->qp_rq_pdbr & 0xFFFFFFFC) >> 2;
894 qpc->log2_pgsz = qp->qp_mrhdl->mr_log2_pgsz;
895 qpc->mtt_base_addrl = (qp->qp_mrhdl->mr_mttaddr) >> 3;
896 qpc->mtt_base_addrh = (uint32_t)((qp->qp_mrhdl->mr_mttaddr >> 32) &
898 qp_srq_en = (qp->qp_alloc_flags & IBT_QP_USES_SRQ) != 0;
902 qpc->srq_number = qp->qp_srqhdl->srq_srqnum;
911 qpc->fre = qp->qp_rlky;
912 qpc->rlky = qp->qp_rlky;
916 qpc->rss = qp->qp_alloc_flags & IBT_QP_USES_RSS ? 1 : 0;
922 if (qp->qp_type == IBT_UD_RQP) {
936 if (qp->qp_uses_lso)
938 else if (qp->qp_is_special)
946 qp->qp_portnum = portnum - 1;
949 0, qp->qp_is_special);
959 qp->qp_pkeyindx = pkeyindx;
984 } else if (qp->qp_serv_type == HERMON_QP_RFCI) {
986 qp->qp_qpnum, ud->ud_fc.fc_src_id);
989 qp->qp_fc_attr = ud->ud_fc;
990 } else if (qp->qp_serv_type == HERMON_QP_FEXCH) {
998 qp->qp_pdhdl, ud->ud_fc.fc_hca_port,
999 qp->qp_qpnum, HERMON_CMD_NOSLEEP_SPIN);
1002 qp->qp_fc_attr = ud->ud_fc;
1003 } else if (qp->qp_serv_type == HERMON_QP_FCMND) {
1015 qp->qp_fc_attr = ud->ud_fc;
1018 } else if (qp->qp_serv_type == HERMON_QP_RC) {
1029 qp->qp_portnum = portnum - 1;
1032 0, qp->qp_is_special);
1045 } else if (qp->qp_serv_type == HERMON_QP_UC) {
1057 qp->qp_portnum = portnum - 1;
1060 0, qp->qp_is_special);
1091 status = hermon_cmn_qp_cmd_post(state, RST2INIT_QP, qpc, qp->qp_qpnum,
1111 hermon_qp_init2init(hermon_state_t *state, hermon_qphdl_t qp,
1122 ASSERT(MUTEX_HELD(&qp->qp_lock));
1127 qpc = &qp->qpc;
1133 if (qp->qp_type == IBT_UD_RQP) {
1150 qp->qp_portnum = portnum - 1; /* save it away */
1153 0, qp->qp_is_special);
1169 qp->qp_pkeyindx = pkeyindx;
1185 } else if (qp->qp_serv_type == HERMON_QP_RC) {
1196 qp->qp_portnum = portnum - 1;
1199 0, qp->qp_is_special);
1228 } else if (qp->qp_serv_type == HERMON_QP_UC) {
1239 qp->qp_portnum = portnum - 1;
1242 0, qp->qp_is_special);
1292 status = hermon_cmn_qp_cmd_post(state, INIT2INIT_QP, qpc, qp->qp_qpnum,
1317 hermon_qp_init2rtr(hermon_state_t *state, hermon_qphdl_t qp,
1331 ASSERT(MUTEX_HELD(&qp->qp_lock));
1336 qpc = &qp->qpc;
1342 if (qp->qp_type == IBT_UD_RQP) {
1352 if (qp->qp_uses_lso)
1362 qp->qp_save_mtu = qpc->mtu;
1374 qp->qp_pkeyindx = pkeyindx;
1390 } else if (qp->qp_serv_type == HERMON_QP_RC) {
1404 portnum = qp->qp_portnum + 1;
1407 HERMON_QP_SCHEDQ_GET(qp->qp_portnum,
1408 adds_vect->av_srvl, qp->qp_is_special);
1446 qp->qp_save_mtu = qpc->mtu;
1513 qp->qp_portnum_alt = portnum - 1;
1516 adds_vect->av_srvl, qp->qp_is_special);
1533 } else if (qp->qp_serv_type == HERMON_QP_UC) {
1548 portnum = qp->qp_portnum + 1;
1551 HERMON_QP_SCHEDQ_GET(qp->qp_portnum,
1552 adds_vect->av_srvl, qp->qp_is_special);
1577 qp->qp_save_mtu = qpc->mtu;
1628 qp->qp_portnum_alt = portnum - 1;
1631 adds_vect->av_srvl, qp->qp_is_special);
1666 status = hermon_cmn_qp_cmd_post(state, INIT2RTR_QP, qpc, qp->qp_qpnum,
1691 hermon_qp_rtr2rts(hermon_state_t *state, hermon_qphdl_t qp,
1704 ASSERT(MUTEX_HELD(&qp->qp_lock));
1709 qpc = &qp->qpc;
1714 if (qp->qp_type == IBT_UD_RQP) {
1730 } else if (qp->qp_serv_type == HERMON_QP_RC) {
1816 qp->qp_portnum_alt = portnum - 1;
1819 adds_vect->av_srvl, qp->qp_is_special);
1837 } else if (qp->qp_serv_type == HERMON_QP_UC) {
1900 adds_vect->av_srvl, qp->qp_is_special);
1935 status = hermon_cmn_qp_cmd_post(state, RTR2RTS_QP, qpc, qp->qp_qpnum,
1960 hermon_qp_rts2rts(hermon_state_t *state, hermon_qphdl_t qp,
1973 ASSERT(MUTEX_HELD(&qp->qp_lock));
1979 qpc = &qp->qpc;
1985 if (qp->qp_type == IBT_UD_RQP) {
1998 } else if (qp->qp_serv_type == HERMON_QP_RC) {
2056 qp->qp_portnum_alt = portnum - 1;
2059 adds_vect->av_srvl, qp->qp_is_special);
2077 } else if (qp->qp_serv_type == HERMON_QP_UC) {
2128 qp->qp_portnum_alt = portnum - 1;
2131 adds_vect->av_srvl, qp->qp_is_special);
2166 status = hermon_cmn_qp_cmd_post(state, RTS2RTS_QP, qpc, qp->qp_qpnum,
2192 hermon_qp_rts2sqd(hermon_state_t *state, hermon_qphdl_t qp,
2197 ASSERT(MUTEX_HELD(&qp->qp_lock));
2206 qp->qp_forward_sqd_event = (flags & IBT_CEP_SET_SQD_EVENT) ? 1 : 0;
2216 status = hermon_cmn_qp_cmd_post(state, RTS2SQD_QP, NULL, qp->qp_qpnum,
2237 qp->qp_sqd_still_draining = 1;
2249 hermon_qp_sqd2rts(hermon_state_t *state, hermon_qphdl_t qp,
2263 ASSERT(MUTEX_HELD(&qp->qp_lock));
2268 qpc = &qp->qpc;
2277 if (qp->qp_type == IBT_UD_RQP) {
2288 qp->qp_portnum = portnum - 1;
2291 0, qp->qp_is_special);
2308 qp->qp_pkeyindx = pkeyindx;
2324 } else if (qp->qp_serv_type == HERMON_QP_RC) {
2373 qp->qp_portnum_alt = portnum - 1;
2376 adds_vect->av_srvl, qp->qp_is_special);
2436 } else if (qp->qp_serv_type == HERMON_QP_UC) {
2487 qp->qp_portnum_alt = portnum - 1;
2490 adds_vect->av_srvl, qp->qp_is_special);
2525 status = hermon_cmn_qp_cmd_post(state, SQD2RTS_QP, qpc, qp->qp_qpnum,
2550 hermon_qp_sqd2sqd(hermon_state_t *state, hermon_qphdl_t qp,
2564 ASSERT(MUTEX_HELD(&qp->qp_lock));
2569 qpc = &qp->qpc;
2578 if (qp->qp_type == IBT_UD_RQP) {
2589 qp->qp_portnum = portnum - 1;
2592 0, qp->qp_is_special);
2609 qp->qp_pkeyindx = pkeyindx;
2625 } else if (qp->qp_serv_type == HERMON_QP_RC) {
2653 portnum = qp->qp_portnum + 1;
2656 HERMON_QP_SCHEDQ_GET(qp->qp_portnum,
2657 adds_vect->av_srvl, qp->qp_is_special);
2667 qpc->mtu = qp->qp_save_mtu;
2713 qp->qp_portnum = portnum - 1;
2716 adds_vect->av_srvl, qp->qp_is_special);
2745 qp->qp_portnum_alt = portnum - 1;
2748 adds_vect->av_srvl, qp->qp_is_special);
2839 } else if (qp->qp_serv_type == HERMON_QP_UC) {
2867 portnum = qp->qp_portnum + 1;
2870 HERMON_QP_SCHEDQ_GET(qp->qp_portnum,
2871 adds_vect->av_srvl, qp->qp_is_special);
2881 qpc->mtu = qp->qp_save_mtu;
2938 qp->qp_portnum_alt = portnum - 1;
2941 adds_vect->av_srvl, qp->qp_is_special);
2976 status = hermon_cmn_qp_cmd_post(state, SQD2SQD_QP, qpc, qp->qp_qpnum,
3001 hermon_qp_sqerr2rts(hermon_state_t *state, hermon_qphdl_t qp,
3009 ASSERT(MUTEX_HELD(&qp->qp_lock));
3014 qpc = &qp->qpc;
3020 if (qp->qp_type == IBT_UD_RQP) {
3033 } else if (qp->qp_serv_type == HERMON_QP_UC) {
3063 status = hermon_cmn_qp_cmd_post(state, SQERR2RTS_QP, qpc, qp->qp_qpnum,
3088 hermon_qp_to_error(hermon_state_t *state, hermon_qphdl_t qp)
3092 ASSERT(MUTEX_HELD(&qp->qp_lock));
3102 status = hermon_cmn_qp_cmd_post(state, TOERR_QP, NULL, qp->qp_qpnum,
3122 hermon_qp_to_reset(hermon_state_t *state, hermon_qphdl_t qp)
3127 ASSERT(MUTEX_HELD(&qp->qp_lock));
3132 qpc = &qp->qpc;
3142 status = hermon_cmn_qp_cmd_post(state, TORST_QP, qpc, qp->qp_qpnum,
3152 if (qp->qp_serv_type == HERMON_QP_FEXCH) {
3153 status = hermon_fcoib_fexch_mkey_fini(state, qp->qp_pdhdl,
3154 qp->qp_qpnum, HERMON_CMD_NOSLEEP_SPIN);
3168 hermon_qp_reset2err(hermon_state_t *state, hermon_qphdl_t qp)
3174 ASSERT(MUTEX_HELD(&qp->qp_lock));
3190 qpc = &qp->qpc;
3195 if (qp->qp_is_special) {
3198 qpc->serv_type = qp->qp_serv_type;
3201 qpc->usr_page = qp->qp_uarpg;
3203 qpc->dbr_addrh = ((uint64_t)qp->qp_rq_pdbr >> 32);
3204 qpc->dbr_addrl = ((uint64_t)qp->qp_rq_pdbr & 0xFFFFFFFC) >> 2;
3205 qpc->pd = qp->qp_pdhdl->pd_pdnum;
3214 qpc->log2_pgsz = qp->qp_mrhdl->mr_log2_pgsz;
3215 qpc->mtt_base_addrh = (qp->qp_mrhdl->mr_mttaddr) >> 32 & 0xFF;
3216 qpc->mtt_base_addrl = (qp->qp_mrhdl->mr_mttaddr) >> 3 & 0xFFFFFFFF;
3219 (qp->qp_sq_cqhdl == NULL) ? 0 : qp->qp_sq_cqhdl->cq_cqnum & cqnmask;
3220 qpc->page_offs = qp->qp_wqinfo.qa_pgoffs >> 6;
3222 (qp->qp_rq_cqhdl == NULL) ? 0 : qp->qp_rq_cqhdl->cq_cqnum & cqnmask;
3226 qpc->log_sq_stride = qp->qp_sq_log_wqesz - 4;
3227 qpc->log_rq_stride = qp->qp_rq_log_wqesz - 4;
3228 qpc->log_sq_size = highbit(qp->qp_sq_bufsz) - 1;
3229 qpc->log_rq_size = highbit(qp->qp_rq_bufsz) - 1;
3230 qpc->srq_en = (qp->qp_alloc_flags & IBT_QP_USES_SRQ) != 0;
3231 qpc->sq_no_prefetch = qp->qp_no_prefetch;
3233 if (qp->qp_alloc_flags & IBT_QP_USES_SRQ) {
3234 qpc->srq_number = qp->qp_srqhdl->srq_srqnum;
3245 if (qp->qp_type == IBT_UD_RQP) {
3249 HERMON_QP_SCHEDQ_GET(0, 0, qp->qp_is_special);
3252 } else if (qp->qp_serv_type == HERMON_QP_RC) {
3258 HERMON_QP_SCHEDQ_GET(0, 0, qp->qp_is_special);
3261 } else if (qp->qp_serv_type == HERMON_QP_UC) {
3265 HERMON_QP_SCHEDQ_GET(0, 0, qp->qp_is_special);
3286 status = hermon_cmn_qp_cmd_post(state, RST2INIT_QP, qpc, qp->qp_qpnum,
3306 status = hermon_cmn_qp_cmd_post(state, TOERR_QP, NULL, qp->qp_qpnum,
3314 if (hermon_qp_to_reset(state, qp) != DDI_SUCCESS) {