|
@@ -1033,6 +1033,7 @@ static int hermon_create_qp ( struct ib_device *ibdev,
|
1033
|
1033
|
hermon, strerror ( rc ) );
|
1034
|
1034
|
goto err_rst2init_qp;
|
1035
|
1035
|
}
|
|
1036
|
+ hermon_qp->state = HERMON_QP_ST_INIT;
|
1036
|
1037
|
|
1037
|
1038
|
DBGC ( hermon, "Hermon %p QPN %#lx send ring at [%p,%p)\n",
|
1038
|
1039
|
hermon, qp->qpn, hermon_qp->send.wqe,
|
|
@@ -1066,44 +1067,66 @@ static int hermon_create_qp ( struct ib_device *ibdev,
|
1066
|
1067
|
static int hermon_modify_qp ( struct ib_device *ibdev,
|
1067
|
1068
|
struct ib_queue_pair *qp ) {
|
1068
|
1069
|
struct hermon *hermon = ib_get_drvdata ( ibdev );
|
|
1070
|
+ struct hermon_queue_pair *hermon_qp = ib_qp_get_drvdata ( qp );
|
1069
|
1071
|
struct hermonprm_qp_ee_state_transitions qpctx;
|
1070
|
1072
|
int rc;
|
1071
|
1073
|
|
1072
|
|
- /* Transition queue to RTR state */
|
1073
|
|
- memset ( &qpctx, 0, sizeof ( qpctx ) );
|
1074
|
|
- MLX_FILL_1 ( &qpctx, 0, opt_param_mask, HERMON_QP_OPT_PARAM_QKEY );
|
1075
|
|
- MLX_FILL_2 ( &qpctx, 4,
|
1076
|
|
- qpc_eec_data.mtu, HERMON_MTU_2048,
|
1077
|
|
- qpc_eec_data.msg_max, 31 );// 11 /* 2^11 = 2048 */ );
|
1078
|
|
- MLX_FILL_1 ( &qpctx, 7, qpc_eec_data.remote_qpn_een, qp->av.qpn );
|
1079
|
|
- MLX_FILL_1 ( &qpctx, 9,
|
1080
|
|
- qpc_eec_data.primary_address_path.rlid, qp->av.lid );
|
1081
|
|
- MLX_FILL_1 ( &qpctx, 10,
|
1082
|
|
- qpc_eec_data.primary_address_path.max_stat_rate,
|
1083
|
|
- hermon_rate ( &qp->av ) );
|
1084
|
|
- memcpy ( &qpctx.u.dwords[12], &qp->av.gid, sizeof ( qp->av.gid ) );
|
1085
|
|
- MLX_FILL_1 ( &qpctx, 16,
|
1086
|
|
- qpc_eec_data.primary_address_path.sched_queue,
|
1087
|
|
- hermon_sched_queue ( ibdev, qp ) );
|
1088
|
|
- MLX_FILL_1 ( &qpctx, 39, qpc_eec_data.next_rcv_psn, qp->recv.psn );
|
1089
|
|
- MLX_FILL_1 ( &qpctx, 44, qpc_eec_data.q_key, qp->qkey );
|
1090
|
|
- if ( ( rc = hermon_cmd_init2rtr_qp ( hermon, qp->qpn,
|
1091
|
|
- &qpctx ) ) != 0 ) {
|
1092
|
|
- DBGC ( hermon, "Hermon %p INIT2RTR_QP failed: %s\n",
|
1093
|
|
- hermon, strerror ( rc ) );
|
1094
|
|
- return rc;
|
|
1074
|
+ /* Transition queue to RTR state, if applicable */
|
|
1075
|
+ if ( hermon_qp->state < HERMON_QP_ST_RTR ) {
|
|
1076
|
+ memset ( &qpctx, 0, sizeof ( qpctx ) );
|
|
1077
|
+ MLX_FILL_2 ( &qpctx, 4,
|
|
1078
|
+ qpc_eec_data.mtu, HERMON_MTU_2048,
|
|
1079
|
+ qpc_eec_data.msg_max, 31 );
|
|
1080
|
+ MLX_FILL_1 ( &qpctx, 7,
|
|
1081
|
+ qpc_eec_data.remote_qpn_een, qp->av.qpn );
|
|
1082
|
+ MLX_FILL_1 ( &qpctx, 9,
|
|
1083
|
+ qpc_eec_data.primary_address_path.rlid,
|
|
1084
|
+ qp->av.lid );
|
|
1085
|
+ MLX_FILL_1 ( &qpctx, 10,
|
|
1086
|
+ qpc_eec_data.primary_address_path.max_stat_rate,
|
|
1087
|
+ hermon_rate ( &qp->av ) );
|
|
1088
|
+ memcpy ( &qpctx.u.dwords[12], &qp->av.gid,
|
|
1089
|
+ sizeof ( qp->av.gid ) );
|
|
1090
|
+ MLX_FILL_1 ( &qpctx, 16,
|
|
1091
|
+ qpc_eec_data.primary_address_path.sched_queue,
|
|
1092
|
+ hermon_sched_queue ( ibdev, qp ) );
|
|
1093
|
+ MLX_FILL_1 ( &qpctx, 39,
|
|
1094
|
+ qpc_eec_data.next_rcv_psn, qp->recv.psn );
|
|
1095
|
+ if ( ( rc = hermon_cmd_init2rtr_qp ( hermon, qp->qpn,
|
|
1096
|
+ &qpctx ) ) != 0 ) {
|
|
1097
|
+ DBGC ( hermon, "Hermon %p INIT2RTR_QP failed: %s\n",
|
|
1098
|
+ hermon, strerror ( rc ) );
|
|
1099
|
+ return rc;
|
|
1100
|
+ }
|
|
1101
|
+ hermon_qp->state = HERMON_QP_ST_RTR;
|
1095
|
1102
|
}
|
1096
|
1103
|
|
1097
|
1104
|
/* Transition queue to RTS state */
|
|
1105
|
+ if ( hermon_qp->state < HERMON_QP_ST_RTS ) {
|
|
1106
|
+ memset ( &qpctx, 0, sizeof ( qpctx ) );
|
|
1107
|
+ MLX_FILL_1 ( &qpctx, 10,
|
|
1108
|
+ qpc_eec_data.primary_address_path.ack_timeout,
|
|
1109
|
+ 0x13 );
|
|
1110
|
+ MLX_FILL_2 ( &qpctx, 30,
|
|
1111
|
+ qpc_eec_data.retry_count, HERMON_RETRY_MAX,
|
|
1112
|
+ qpc_eec_data.rnr_retry, HERMON_RETRY_MAX );
|
|
1113
|
+ MLX_FILL_1 ( &qpctx, 32,
|
|
1114
|
+ qpc_eec_data.next_send_psn, qp->send.psn );
|
|
1115
|
+ if ( ( rc = hermon_cmd_rtr2rts_qp ( hermon, qp->qpn,
|
|
1116
|
+ &qpctx ) ) != 0 ) {
|
|
1117
|
+ DBGC ( hermon, "Hermon %p RTR2RTS_QP failed: %s\n",
|
|
1118
|
+ hermon, strerror ( rc ) );
|
|
1119
|
+ return rc;
|
|
1120
|
+ }
|
|
1121
|
+ hermon_qp->state = HERMON_QP_ST_RTS;
|
|
1122
|
+ }
|
|
1123
|
+
|
|
1124
|
+ /* Update parameters in RTS state */
|
1098
|
1125
|
memset ( &qpctx, 0, sizeof ( qpctx ) );
|
1099
|
|
- MLX_FILL_1 ( &qpctx, 10,
|
1100
|
|
- qpc_eec_data.primary_address_path.ack_timeout, 0x13 );
|
1101
|
|
- MLX_FILL_2 ( &qpctx, 30,
|
1102
|
|
- qpc_eec_data.retry_count, HERMON_RETRY_MAX,
|
1103
|
|
- qpc_eec_data.rnr_retry, HERMON_RETRY_MAX );
|
1104
|
|
- MLX_FILL_1 ( &qpctx, 32, qpc_eec_data.next_send_psn, qp->send.psn );
|
1105
|
|
- if ( ( rc = hermon_cmd_rtr2rts_qp ( hermon, qp->qpn, &qpctx ) ) != 0 ){
|
1106
|
|
- DBGC ( hermon, "Hermon %p RTR2RTS_QP failed: %s\n",
|
|
1126
|
+ MLX_FILL_1 ( &qpctx, 0, opt_param_mask, HERMON_QP_OPT_PARAM_QKEY );
|
|
1127
|
+ MLX_FILL_1 ( &qpctx, 44, qpc_eec_data.q_key, qp->qkey );
|
|
1128
|
+ if ( ( rc = hermon_cmd_rts2rts_qp ( hermon, qp->qpn, &qpctx ) ) != 0 ){
|
|
1129
|
+ DBGC ( hermon, "Hermon %p RTS2RTS_QP failed: %s\n",
|
1107
|
1130
|
hermon, strerror ( rc ) );
|
1108
|
1131
|
return rc;
|
1109
|
1132
|
}
|