Lines Matching refs: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; in hermon_ioctl_loopback() local
954 _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(lstate)) in hermon_ioctl_loopback()
990 bzero(&lstate, sizeof (hermon_loopback_state_t)); in hermon_ioctl_loopback()
1031 hermon_loopback_free_state(&lstate); in hermon_ioctl_loopback()
1035 lstate.hls_port = pi.p_port_num; in hermon_ioctl_loopback()
1036 lstate.hls_lid = pi.p_base_lid; in hermon_ioctl_loopback()
1037 lstate.hls_pkey_ix = (pi.p_linkstate == HERMON_PORT_LINK_ACTIVE) ? in hermon_ioctl_loopback()
1039 lstate.hls_state = state; in hermon_ioctl_loopback()
1040 lstate.hls_retry = lb.alb_num_retry; in hermon_ioctl_loopback()
1053 lstate.hls_timeout = lb.alb_timeout; in hermon_ioctl_loopback()
1054 max_usec = (4096 * (1 << lstate.hls_timeout)) / 1000; in hermon_ioctl_loopback()
1055 max_usec = max_usec * (lstate.hls_retry + 1); in hermon_ioctl_loopback()
1070 hermon_loopback_free_state(&lstate); in hermon_ioctl_loopback()
1075 if (hermon_loopback_init(state, &lstate) != 0) { in hermon_ioctl_loopback()
1076 lb.alb_error_type = lstate.hls_err; in hermon_ioctl_loopback()
1078 hermon_loopback_free_state(&lstate); in hermon_ioctl_loopback()
1083 if (hermon_loopback_alloc_mem(&lstate, &lstate.hls_tx, in hermon_ioctl_loopback()
1088 hermon_loopback_free_state(&lstate); in hermon_ioctl_loopback()
1093 if (hermon_loopback_alloc_mem(&lstate, &lstate.hls_rx, in hermon_ioctl_loopback()
1098 hermon_loopback_free_state(&lstate); in hermon_ioctl_loopback()
1103 if (ddi_copyin((void *)lb.alb_send_buf, lstate.hls_tx.hlc_buf, in hermon_ioctl_loopback()
1107 hermon_loopback_free_state(&lstate); in hermon_ioctl_loopback()
1112 lstate.hls_err = HERMON_LOOPBACK_XMIT_SEND_CQ_ALLOC_FAIL; in hermon_ioctl_loopback()
1113 if (hermon_loopback_alloc_qps(&lstate, &lstate.hls_tx) != 0) { in hermon_ioctl_loopback()
1114 lb.alb_error_type = lstate.hls_err; in hermon_ioctl_loopback()
1116 hermon_loopback_free_state(&lstate); in hermon_ioctl_loopback()
1121 lstate.hls_err = HERMON_LOOPBACK_RECV_SEND_CQ_ALLOC_FAIL; in hermon_ioctl_loopback()
1122 if (hermon_loopback_alloc_qps(&lstate, &lstate.hls_rx) != 0) { in hermon_ioctl_loopback()
1123 lb.alb_error_type = lstate.hls_err; in hermon_ioctl_loopback()
1125 hermon_loopback_free_state(&lstate); in hermon_ioctl_loopback()
1130 lstate.hls_err = HERMON_LOOPBACK_XMIT_QP_INIT_FAIL; in hermon_ioctl_loopback()
1131 if (hermon_loopback_modify_qp(&lstate, &lstate.hls_tx, in hermon_ioctl_loopback()
1132 lstate.hls_rx.hlc_qp_num) != 0) { in hermon_ioctl_loopback()
1133 lb.alb_error_type = lstate.hls_err; in hermon_ioctl_loopback()
1135 hermon_loopback_free_state(&lstate); in hermon_ioctl_loopback()
1140 lstate.hls_err = HERMON_LOOPBACK_RECV_QP_INIT_FAIL; in hermon_ioctl_loopback()
1141 if (hermon_loopback_modify_qp(&lstate, &lstate.hls_rx, in hermon_ioctl_loopback()
1142 lstate.hls_tx.hlc_qp_num) != 0) { in hermon_ioctl_loopback()
1143 lb.alb_error_type = lstate.hls_err; in hermon_ioctl_loopback()
1145 hermon_loopback_free_state(&lstate); in hermon_ioctl_loopback()
1152 lstate.hls_err = 0; in hermon_ioctl_loopback()
1153 bzero(lstate.hls_rx.hlc_buf, lb.alb_buf_sz); in hermon_ioctl_loopback()
1156 if (hermon_loopback_post_send(&lstate, &lstate.hls_tx, in hermon_ioctl_loopback()
1157 &lstate.hls_rx) != IBT_SUCCESS) { in hermon_ioctl_loopback()
1160 hermon_loopback_free_state(&lstate); in hermon_ioctl_loopback()
1168 ret = hermon_loopback_poll_cq(&lstate, &lstate.hls_tx); in hermon_ioctl_loopback()
1173 if (ddi_copyout(lstate.hls_rx.hlc_buf, in hermon_ioctl_loopback()
1174 lb.alb_fail_buf, lstate.hls_tx.hlc_buf_sz, in hermon_ioctl_loopback()
1179 hermon_loopback_free_state(&lstate); in hermon_ioctl_loopback()
1186 if (bcmp(lstate.hls_tx.hlc_buf, lstate.hls_rx.hlc_buf, in hermon_ioctl_loopback()
1192 if (ddi_copyout(lstate.hls_rx.hlc_buf, in hermon_ioctl_loopback()
1193 lb.alb_fail_buf, lstate.hls_tx.hlc_buf_sz, in hermon_ioctl_loopback()
1198 hermon_loopback_free_state(&lstate); in hermon_ioctl_loopback()
1203 lstate.hls_err = HERMON_LOOPBACK_SUCCESS; in hermon_ioctl_loopback()
1213 hermon_loopback_free_state(&lstate); in hermon_ioctl_loopback()
2769 hermon_loopback_free_qps(hermon_loopback_state_t *lstate) in hermon_loopback_free_qps() argument
2773 _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*lstate)) in hermon_loopback_free_qps()
2775 if (lstate->hls_tx.hlc_qp_hdl != NULL) { in hermon_loopback_free_qps()
2776 (void) hermon_qp_free(lstate->hls_state, in hermon_loopback_free_qps()
2777 &lstate->hls_tx.hlc_qp_hdl, IBC_FREE_QP_AND_QPN, NULL, in hermon_loopback_free_qps()
2780 if (lstate->hls_rx.hlc_qp_hdl != NULL) { in hermon_loopback_free_qps()
2781 (void) hermon_qp_free(lstate->hls_state, in hermon_loopback_free_qps()
2782 &lstate->hls_rx.hlc_qp_hdl, IBC_FREE_QP_AND_QPN, NULL, in hermon_loopback_free_qps()
2785 lstate->hls_tx.hlc_qp_hdl = NULL; in hermon_loopback_free_qps()
2786 lstate->hls_rx.hlc_qp_hdl = NULL; in hermon_loopback_free_qps()
2788 if (lstate->hls_tx.hlc_cqhdl[i] != NULL) { in hermon_loopback_free_qps()
2789 (void) hermon_cq_free(lstate->hls_state, in hermon_loopback_free_qps()
2790 &lstate->hls_tx.hlc_cqhdl[i], HERMON_NOSLEEP); in hermon_loopback_free_qps()
2792 if (lstate->hls_rx.hlc_cqhdl[i] != NULL) { in hermon_loopback_free_qps()
2793 (void) hermon_cq_free(lstate->hls_state, in hermon_loopback_free_qps()
2794 &lstate->hls_rx.hlc_cqhdl[i], HERMON_NOSLEEP); in hermon_loopback_free_qps()
2796 lstate->hls_tx.hlc_cqhdl[i] = NULL; in hermon_loopback_free_qps()
2797 lstate->hls_rx.hlc_cqhdl[i] = NULL; in hermon_loopback_free_qps()
2805 hermon_loopback_free_state(hermon_loopback_state_t *lstate) in hermon_loopback_free_state() argument
2807 hermon_loopback_free_qps(lstate); in hermon_loopback_free_state()
2808 if (lstate->hls_tx.hlc_mrhdl != NULL) { in hermon_loopback_free_state()
2809 (void) hermon_mr_deregister(lstate->hls_state, in hermon_loopback_free_state()
2810 &lstate->hls_tx.hlc_mrhdl, HERMON_MR_DEREG_ALL, in hermon_loopback_free_state()
2813 if (lstate->hls_rx.hlc_mrhdl != NULL) { in hermon_loopback_free_state()
2814 (void) hermon_mr_deregister(lstate->hls_state, in hermon_loopback_free_state()
2815 &lstate->hls_rx.hlc_mrhdl, HERMON_MR_DEREG_ALL, in hermon_loopback_free_state()
2818 if (lstate->hls_pd_hdl != NULL) { in hermon_loopback_free_state()
2819 (void) hermon_pd_free(lstate->hls_state, &lstate->hls_pd_hdl); in hermon_loopback_free_state()
2821 if (lstate->hls_tx.hlc_buf != NULL) { in hermon_loopback_free_state()
2822 kmem_free(lstate->hls_tx.hlc_buf, lstate->hls_tx.hlc_buf_sz); in hermon_loopback_free_state()
2824 if (lstate->hls_rx.hlc_buf != NULL) { in hermon_loopback_free_state()
2825 kmem_free(lstate->hls_rx.hlc_buf, lstate->hls_rx.hlc_buf_sz); in hermon_loopback_free_state()
2827 bzero(lstate, sizeof (hermon_loopback_state_t)); in hermon_loopback_free_state()
2834 hermon_loopback_init(hermon_state_t *state, hermon_loopback_state_t *lstate) in hermon_loopback_init() argument
2836 _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*lstate)) in hermon_loopback_init()
2838 lstate->hls_hca_hdl = (ibc_hca_hdl_t)state; in hermon_loopback_init()
2839 lstate->hls_status = hermon_pd_alloc(lstate->hls_state, in hermon_loopback_init()
2840 &lstate->hls_pd_hdl, HERMON_NOSLEEP); in hermon_loopback_init()
2841 if (lstate->hls_status != IBT_SUCCESS) { in hermon_loopback_init()
2842 lstate->hls_err = HERMON_LOOPBACK_PROT_DOMAIN_ALLOC_FAIL; in hermon_loopback_init()
2853 hermon_loopback_init_qp_info(hermon_loopback_state_t *lstate, in hermon_loopback_init_qp_info() argument
2872 lstate->hls_port; in hermon_loopback_init_qp_info()
2874 lstate->hls_pkey_ix; in hermon_loopback_init_qp_info()
2876 lstate->hls_timeout; in hermon_loopback_init_qp_info()
2882 lstate->hls_lid; in hermon_loopback_init_qp_info()
2883 comm->hlc_qp_info.qp_transport.rc.rc_retry_cnt = lstate->hls_retry; in hermon_loopback_init_qp_info()
2897 hermon_loopback_alloc_mem(hermon_loopback_state_t *lstate, in hermon_loopback_alloc_mem() argument
2916 comm->hlc_status = hermon_mr_register(lstate->hls_state, in hermon_loopback_alloc_mem()
2917 lstate->hls_pd_hdl, &comm->hlc_memattr, &comm->hlc_mrhdl, in hermon_loopback_alloc_mem()
2935 hermon_loopback_alloc_qps(hermon_loopback_state_t *lstate, in hermon_loopback_alloc_qps() argument
2942 _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*lstate)) in hermon_loopback_alloc_qps()
2948 comm->hlc_status = hermon_cq_alloc(lstate->hls_state, in hermon_loopback_alloc_qps()
2952 lstate->hls_err += i; in hermon_loopback_alloc_qps()
2958 hermon_loopback_init_qp_info(lstate, comm); in hermon_loopback_alloc_qps()
2959 comm->hlc_qp_attr.qp_pd_hdl = (ibt_pd_hdl_t)lstate->hls_pd_hdl; in hermon_loopback_alloc_qps()
2969 comm->hlc_status = hermon_qp_alloc(lstate->hls_state, &qpinfo, in hermon_loopback_alloc_qps()
2976 lstate->hls_err += 2; in hermon_loopback_alloc_qps()
2986 hermon_loopback_modify_qp(hermon_loopback_state_t *lstate, in hermon_loopback_modify_qp() argument
2990 _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*lstate)) in hermon_loopback_modify_qp()
2993 hermon_loopback_init_qp_info(lstate, comm); in hermon_loopback_modify_qp()
2995 comm->hlc_status = hermon_qp_modify(lstate->hls_state, comm->hlc_qp_hdl, in hermon_loopback_modify_qp()
3007 = lstate->hls_lid; in hermon_loopback_modify_qp()
3009 comm->hlc_status = hermon_qp_modify(lstate->hls_state, comm->hlc_qp_hdl, in hermon_loopback_modify_qp()
3012 lstate->hls_err += 1; in hermon_loopback_modify_qp()
3019 comm->hlc_status = hermon_qp_modify(lstate->hls_state, comm->hlc_qp_hdl, in hermon_loopback_modify_qp()
3022 lstate->hls_err += 2; in hermon_loopback_modify_qp()
3068 hermon_loopback_post_send(hermon_loopback_state_t *lstate, in hermon_loopback_post_send() argument
3095 ret = hermon_post_send(lstate->hls_state, tx->hlc_qp_hdl, &tx->hlc_wr, in hermon_loopback_post_send()
3107 hermon_loopback_poll_cq(hermon_loopback_state_t *lstate, in hermon_loopback_poll_cq() argument
3114 comm->hlc_status = hermon_cq_poll(lstate->hls_state, in hermon_loopback_poll_cq()