Lines Matching defs:lstate

123 static void hermon_loopback_free_qps(hermon_loopback_state_t *lstate);
124 static void hermon_loopback_free_state(hermon_loopback_state_t *lstate);
126 hermon_loopback_state_t *lstate);
127 static void hermon_loopback_init_qp_info(hermon_loopback_state_t *lstate,
129 static int hermon_loopback_alloc_mem(hermon_loopback_state_t *lstate,
131 static int hermon_loopback_alloc_qps(hermon_loopback_state_t *lstate,
133 static int hermon_loopback_modify_qp(hermon_loopback_state_t *lstate,
137 static int hermon_loopback_post_send(hermon_loopback_state_t *lstate,
139 static int hermon_loopback_poll_cq(hermon_loopback_state_t *lstate,
947 hermon_loopback_state_t lstate;
954 _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(lstate))
990 bzero(&lstate, sizeof (hermon_loopback_state_t));
1031 hermon_loopback_free_state(&lstate);
1035 lstate.hls_port = pi.p_port_num;
1036 lstate.hls_lid = pi.p_base_lid;
1037 lstate.hls_pkey_ix = (pi.p_linkstate == HERMON_PORT_LINK_ACTIVE) ?
1039 lstate.hls_state = state;
1040 lstate.hls_retry = lb.alb_num_retry;
1053 lstate.hls_timeout = lb.alb_timeout;
1054 max_usec = (4096 * (1 << lstate.hls_timeout)) / 1000;
1055 max_usec = max_usec * (lstate.hls_retry + 1);
1070 hermon_loopback_free_state(&lstate);
1075 if (hermon_loopback_init(state, &lstate) != 0) {
1076 lb.alb_error_type = lstate.hls_err;
1078 hermon_loopback_free_state(&lstate);
1083 if (hermon_loopback_alloc_mem(&lstate, &lstate.hls_tx,
1088 hermon_loopback_free_state(&lstate);
1093 if (hermon_loopback_alloc_mem(&lstate, &lstate.hls_rx,
1098 hermon_loopback_free_state(&lstate);
1103 if (ddi_copyin((void *)lb.alb_send_buf, lstate.hls_tx.hlc_buf,
1107 hermon_loopback_free_state(&lstate);
1112 lstate.hls_err = HERMON_LOOPBACK_XMIT_SEND_CQ_ALLOC_FAIL;
1113 if (hermon_loopback_alloc_qps(&lstate, &lstate.hls_tx) != 0) {
1114 lb.alb_error_type = lstate.hls_err;
1116 hermon_loopback_free_state(&lstate);
1121 lstate.hls_err = HERMON_LOOPBACK_RECV_SEND_CQ_ALLOC_FAIL;
1122 if (hermon_loopback_alloc_qps(&lstate, &lstate.hls_rx) != 0) {
1123 lb.alb_error_type = lstate.hls_err;
1125 hermon_loopback_free_state(&lstate);
1130 lstate.hls_err = HERMON_LOOPBACK_XMIT_QP_INIT_FAIL;
1131 if (hermon_loopback_modify_qp(&lstate, &lstate.hls_tx,
1132 lstate.hls_rx.hlc_qp_num) != 0) {
1133 lb.alb_error_type = lstate.hls_err;
1135 hermon_loopback_free_state(&lstate);
1140 lstate.hls_err = HERMON_LOOPBACK_RECV_QP_INIT_FAIL;
1141 if (hermon_loopback_modify_qp(&lstate, &lstate.hls_rx,
1142 lstate.hls_tx.hlc_qp_num) != 0) {
1143 lb.alb_error_type = lstate.hls_err;
1145 hermon_loopback_free_state(&lstate);
1152 lstate.hls_err = 0;
1153 bzero(lstate.hls_rx.hlc_buf, lb.alb_buf_sz);
1156 if (hermon_loopback_post_send(&lstate, &lstate.hls_tx,
1157 &lstate.hls_rx) != IBT_SUCCESS) {
1160 hermon_loopback_free_state(&lstate);
1168 ret = hermon_loopback_poll_cq(&lstate, &lstate.hls_tx);
1173 if (ddi_copyout(lstate.hls_rx.hlc_buf,
1174 lb.alb_fail_buf, lstate.hls_tx.hlc_buf_sz,
1179 hermon_loopback_free_state(&lstate);
1186 if (bcmp(lstate.hls_tx.hlc_buf, lstate.hls_rx.hlc_buf,
1192 if (ddi_copyout(lstate.hls_rx.hlc_buf,
1193 lb.alb_fail_buf, lstate.hls_tx.hlc_buf_sz,
1198 hermon_loopback_free_state(&lstate);
1203 lstate.hls_err = HERMON_LOOPBACK_SUCCESS;
1213 hermon_loopback_free_state(&lstate);
2771 hermon_loopback_free_qps(hermon_loopback_state_t *lstate)
2775 _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*lstate))
2777 if (lstate->hls_tx.hlc_qp_hdl != NULL) {
2778 (void) hermon_qp_free(lstate->hls_state,
2779 &lstate->hls_tx.hlc_qp_hdl, IBC_FREE_QP_AND_QPN, NULL,
2782 if (lstate->hls_rx.hlc_qp_hdl != NULL) {
2783 (void) hermon_qp_free(lstate->hls_state,
2784 &lstate->hls_rx.hlc_qp_hdl, IBC_FREE_QP_AND_QPN, NULL,
2787 lstate->hls_tx.hlc_qp_hdl = NULL;
2788 lstate->hls_rx.hlc_qp_hdl = NULL;
2790 if (lstate->hls_tx.hlc_cqhdl[i] != NULL) {
2791 (void) hermon_cq_free(lstate->hls_state,
2792 &lstate->hls_tx.hlc_cqhdl[i], HERMON_NOSLEEP);
2794 if (lstate->hls_rx.hlc_cqhdl[i] != NULL) {
2795 (void) hermon_cq_free(lstate->hls_state,
2796 &lstate->hls_rx.hlc_cqhdl[i], HERMON_NOSLEEP);
2798 lstate->hls_tx.hlc_cqhdl[i] = NULL;
2799 lstate->hls_rx.hlc_cqhdl[i] = NULL;
2807 hermon_loopback_free_state(hermon_loopback_state_t *lstate)
2809 hermon_loopback_free_qps(lstate);
2810 if (lstate->hls_tx.hlc_mrhdl != NULL) {
2811 (void) hermon_mr_deregister(lstate->hls_state,
2812 &lstate->hls_tx.hlc_mrhdl, HERMON_MR_DEREG_ALL,
2815 if (lstate->hls_rx.hlc_mrhdl != NULL) {
2816 (void) hermon_mr_deregister(lstate->hls_state,
2817 &lstate->hls_rx.hlc_mrhdl, HERMON_MR_DEREG_ALL,
2820 if (lstate->hls_pd_hdl != NULL) {
2821 (void) hermon_pd_free(lstate->hls_state, &lstate->hls_pd_hdl);
2823 if (lstate->hls_tx.hlc_buf != NULL) {
2824 kmem_free(lstate->hls_tx.hlc_buf, lstate->hls_tx.hlc_buf_sz);
2826 if (lstate->hls_rx.hlc_buf != NULL) {
2827 kmem_free(lstate->hls_rx.hlc_buf, lstate->hls_rx.hlc_buf_sz);
2829 bzero(lstate, sizeof (hermon_loopback_state_t));
2836 hermon_loopback_init(hermon_state_t *state, hermon_loopback_state_t *lstate)
2838 _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*lstate))
2840 lstate->hls_hca_hdl = (ibc_hca_hdl_t)state;
2841 lstate->hls_status = hermon_pd_alloc(lstate->hls_state,
2842 &lstate->hls_pd_hdl, HERMON_NOSLEEP);
2843 if (lstate->hls_status != IBT_SUCCESS) {
2844 lstate->hls_err = HERMON_LOOPBACK_PROT_DOMAIN_ALLOC_FAIL;
2855 hermon_loopback_init_qp_info(hermon_loopback_state_t *lstate,
2874 lstate->hls_port;
2876 lstate->hls_pkey_ix;
2878 lstate->hls_timeout;
2884 lstate->hls_lid;
2885 comm->hlc_qp_info.qp_transport.rc.rc_retry_cnt = lstate->hls_retry;
2899 hermon_loopback_alloc_mem(hermon_loopback_state_t *lstate,
2918 comm->hlc_status = hermon_mr_register(lstate->hls_state,
2919 lstate->hls_pd_hdl, &comm->hlc_memattr, &comm->hlc_mrhdl,
2937 hermon_loopback_alloc_qps(hermon_loopback_state_t *lstate,
2944 _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*lstate))
2950 comm->hlc_status = hermon_cq_alloc(lstate->hls_state,
2954 lstate->hls_err += i;
2960 hermon_loopback_init_qp_info(lstate, comm);
2961 comm->hlc_qp_attr.qp_pd_hdl = (ibt_pd_hdl_t)lstate->hls_pd_hdl;
2971 comm->hlc_status = hermon_qp_alloc(lstate->hls_state, &qpinfo,
2978 lstate->hls_err += 2;
2988 hermon_loopback_modify_qp(hermon_loopback_state_t *lstate,
2992 _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*lstate))
2995 hermon_loopback_init_qp_info(lstate, comm);
2997 comm->hlc_status = hermon_qp_modify(lstate->hls_state, comm->hlc_qp_hdl,
3009 = lstate->hls_lid;
3011 comm->hlc_status = hermon_qp_modify(lstate->hls_state, comm->hlc_qp_hdl,
3014 lstate->hls_err += 1;
3021 comm->hlc_status = hermon_qp_modify(lstate->hls_state, comm->hlc_qp_hdl,
3024 lstate->hls_err += 2;
3070 hermon_loopback_post_send(hermon_loopback_state_t *lstate,
3097 ret = hermon_post_send(lstate->hls_state, tx->hlc_qp_hdl, &tx->hlc_wr,
3109 hermon_loopback_poll_cq(hermon_loopback_state_t *lstate,
3116 comm->hlc_status = hermon_cq_poll(lstate->hls_state,