Explorar el Código

[hermon] Allow for multiple calls to ib_modify_qp()

tags/v0.9.8
Michael Brown hace 15 años
padre
commit
18bcdfb1cc
Se han modificado 2 ficheros con 64 adiciones y 31 borrados
  1. 54
    31
      src/drivers/infiniband/hermon.c
  2. 10
    0
      src/drivers/infiniband/hermon.h

+ 54
- 31
src/drivers/infiniband/hermon.c Ver fichero

1033
 		       hermon, strerror ( rc ) );
1033
 		       hermon, strerror ( rc ) );
1034
 		goto err_rst2init_qp;
1034
 		goto err_rst2init_qp;
1035
 	}
1035
 	}
1036
+	hermon_qp->state = HERMON_QP_ST_INIT;
1036
 
1037
 
1037
 	DBGC ( hermon, "Hermon %p QPN %#lx send ring at [%p,%p)\n",
1038
 	DBGC ( hermon, "Hermon %p QPN %#lx send ring at [%p,%p)\n",
1038
 	       hermon, qp->qpn, hermon_qp->send.wqe,
1039
 	       hermon, qp->qpn, hermon_qp->send.wqe,
1066
 static int hermon_modify_qp ( struct ib_device *ibdev,
1067
 static int hermon_modify_qp ( struct ib_device *ibdev,
1067
 			      struct ib_queue_pair *qp ) {
1068
 			      struct ib_queue_pair *qp ) {
1068
 	struct hermon *hermon = ib_get_drvdata ( ibdev );
1069
 	struct hermon *hermon = ib_get_drvdata ( ibdev );
1070
+	struct hermon_queue_pair *hermon_qp = ib_qp_get_drvdata ( qp );
1069
 	struct hermonprm_qp_ee_state_transitions qpctx;
1071
 	struct hermonprm_qp_ee_state_transitions qpctx;
1070
 	int rc;
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
 	/* Transition queue to RTS state */
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
 	memset ( &qpctx, 0, sizeof ( qpctx ) );
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
 		       hermon, strerror ( rc ) );
1130
 		       hermon, strerror ( rc ) );
1108
 		return rc;
1131
 		return rc;
1109
 	}
1132
 	}

+ 10
- 0
src/drivers/infiniband/hermon.h Ver fichero

425
 /** Base queue pair number */
425
 /** Base queue pair number */
426
 #define HERMON_QPN_BASE 0x550000
426
 #define HERMON_QPN_BASE 0x550000
427
 
427
 
428
+/** Hermon queue pair state */
429
+enum hermon_queue_pair_state {
430
+	HERMON_QP_ST_RST = 0,
431
+	HERMON_QP_ST_INIT,
432
+	HERMON_QP_ST_RTR,
433
+	HERMON_QP_ST_RTS,
434
+};
435
+
428
 /** A Hermon queue pair */
436
 /** A Hermon queue pair */
429
 struct hermon_queue_pair {
437
 struct hermon_queue_pair {
430
 	/** Work queue buffer */
438
 	/** Work queue buffer */
437
 	struct hermon_send_work_queue send;
445
 	struct hermon_send_work_queue send;
438
 	/** Receive work queue */
446
 	/** Receive work queue */
439
 	struct hermon_recv_work_queue recv;
447
 	struct hermon_recv_work_queue recv;
448
+	/** Queue state */
449
+	enum hermon_queue_pair_state state;
440
 };
450
 };
441
 
451
 
442
 /** Maximum number of allocatable completion queues
452
 /** Maximum number of allocatable completion queues

Loading…
Cancelar
Guardar