Browse Source

[arbel] Allow for multiple calls to ib_modify_qp()

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 14 years ago
parent
commit
f7a49e23e9
2 changed files with 44 additions and 22 deletions
  1. 34
    22
      src/drivers/infiniband/arbel.c
  2. 10
    0
      src/drivers/infiniband/arbel.h

+ 34
- 22
src/drivers/infiniband/arbel.c View File

953
 		     res, ARBEL_UAR_RES_RQ,
953
 		     res, ARBEL_UAR_RES_RQ,
954
 		     qp_number, qp->qpn );
954
 		     qp_number, qp->qpn );
955
 
955
 
956
-	/* Hand queue over to hardware */
956
+	/* Transition queue to INIT state */
957
 	memset ( &qpctx, 0, sizeof ( qpctx ) );
957
 	memset ( &qpctx, 0, sizeof ( qpctx ) );
958
 	MLX_FILL_3 ( &qpctx, 2,
958
 	MLX_FILL_3 ( &qpctx, 2,
959
 		     qpc_eec_data.de, 1,
959
 		     qpc_eec_data.de, 1,
961
 		     qpc_eec_data.st,
961
 		     qpc_eec_data.st,
962
 		     ( ( qp->type == IB_QPT_UD ) ?
962
 		     ( ( qp->type == IB_QPT_UD ) ?
963
 		       ARBEL_ST_UD : ARBEL_ST_MLX ) );
963
 		       ARBEL_ST_UD : ARBEL_ST_MLX ) );
964
-	MLX_FILL_6 ( &qpctx, 4,
965
-		     qpc_eec_data.mtu, ARBEL_MTU_2048,
966
-		     qpc_eec_data.msg_max, 11 /* 2^11 = 2048 */,
964
+	MLX_FILL_4 ( &qpctx, 4,
967
 		     qpc_eec_data.log_rq_size, fls ( qp->recv.num_wqes - 1 ),
965
 		     qpc_eec_data.log_rq_size, fls ( qp->recv.num_wqes - 1 ),
968
 		     qpc_eec_data.log_rq_stride,
966
 		     qpc_eec_data.log_rq_stride,
969
 		     ( fls ( sizeof ( arbel_qp->recv.wqe[0] ) - 1 ) - 4 ),
967
 		     ( fls ( sizeof ( arbel_qp->recv.wqe[0] ) - 1 ) - 4 ),
993
 		       arbel, qp->qpn, strerror ( rc ) );
991
 		       arbel, qp->qpn, strerror ( rc ) );
994
 		goto err_rst2init_qpee;
992
 		goto err_rst2init_qpee;
995
 	}
993
 	}
996
-	memset ( &qpctx, 0, sizeof ( qpctx ) );
997
-	MLX_FILL_2 ( &qpctx, 4,
998
-		     qpc_eec_data.mtu, ARBEL_MTU_2048,
999
-		     qpc_eec_data.msg_max, 11 /* 2^11 = 2048 */ );
1000
-	if ( ( rc = arbel_cmd_init2rtr_qpee ( arbel, qp->qpn, &qpctx )) != 0 ){
1001
-		DBGC ( arbel, "Arbel %p QPN %#lx INIT2RTR_QPEE failed: %s\n",
1002
-		       arbel, qp->qpn, strerror ( rc ) );
1003
-		goto err_init2rtr_qpee;
1004
-	}
1005
-	memset ( &qpctx, 0, sizeof ( qpctx ) );
1006
-	if ( ( rc = arbel_cmd_rtr2rts_qpee ( arbel, qp->qpn, &qpctx ) ) != 0 ){
1007
-		DBGC ( arbel, "Arbel %p QPN %#lx RTR2RTS_QPEE failed: %s\n",
1008
-		       arbel, qp->qpn, strerror ( rc ) );
1009
-		goto err_rtr2rts_qpee;
1010
-	}
994
+	arbel_qp->state = ARBEL_QP_ST_INIT;
1011
 
995
 
1012
 	DBGC ( arbel, "Arbel %p QPN %#lx send ring [%08lx,%08lx), doorbell "
996
 	DBGC ( arbel, "Arbel %p QPN %#lx send ring [%08lx,%08lx), doorbell "
1013
 	       "%08lx\n", arbel, qp->qpn, virt_to_phys ( arbel_qp->send.wqe ),
997
 	       "%08lx\n", arbel, qp->qpn, virt_to_phys ( arbel_qp->send.wqe ),
1024
 	ib_qp_set_drvdata ( qp, arbel_qp );
1008
 	ib_qp_set_drvdata ( qp, arbel_qp );
1025
 	return 0;
1009
 	return 0;
1026
 
1010
 
1027
- err_rtr2rts_qpee:
1028
- err_init2rtr_qpee:
1029
 	arbel_cmd_2rst_qpee ( arbel, qp->qpn );
1011
 	arbel_cmd_2rst_qpee ( arbel, qp->qpn );
1030
  err_rst2init_qpee:
1012
  err_rst2init_qpee:
1031
 	MLX_FILL_1 ( send_db_rec, 1, res, ARBEL_UAR_RES_NONE );
1013
 	MLX_FILL_1 ( send_db_rec, 1, res, ARBEL_UAR_RES_NONE );
1051
 static int arbel_modify_qp ( struct ib_device *ibdev,
1033
 static int arbel_modify_qp ( struct ib_device *ibdev,
1052
 			     struct ib_queue_pair *qp ) {
1034
 			     struct ib_queue_pair *qp ) {
1053
 	struct arbel *arbel = ib_get_drvdata ( ibdev );
1035
 	struct arbel *arbel = ib_get_drvdata ( ibdev );
1036
+	struct arbel_queue_pair *arbel_qp = ib_qp_get_drvdata ( qp );
1054
 	struct arbelprm_qp_ee_state_transitions qpctx;
1037
 	struct arbelprm_qp_ee_state_transitions qpctx;
1055
 	int rc;
1038
 	int rc;
1056
 
1039
 
1057
-	/* Issue RTS2RTS_QPEE */
1040
+	/* Transition queue to RTR state, if applicable */
1041
+	if ( arbel_qp->state < ARBEL_QP_ST_RTR ) {
1042
+		memset ( &qpctx, 0, sizeof ( qpctx ) );
1043
+		MLX_FILL_2 ( &qpctx, 4,
1044
+			     qpc_eec_data.mtu, ARBEL_MTU_2048,
1045
+			     qpc_eec_data.msg_max, 11 /* 2^11 = 2048 */ );
1046
+		if ( ( rc = arbel_cmd_init2rtr_qpee ( arbel, qp->qpn,
1047
+						      &qpctx ) ) != 0 ) {
1048
+			DBGC ( arbel, "Arbel %p QPN %#lx INIT2RTR_QPEE failed:"
1049
+			       " %s\n", arbel, qp->qpn, strerror ( rc ) );
1050
+			return rc;
1051
+		}
1052
+		arbel_qp->state = ARBEL_QP_ST_RTR;
1053
+	}
1054
+
1055
+	/* Transition queue to RTS state, if applicable */
1056
+	if ( arbel_qp->state < ARBEL_QP_ST_RTS ) {
1057
+		memset ( &qpctx, 0, sizeof ( qpctx ) );
1058
+		MLX_FILL_1 ( &qpctx, 32,
1059
+			     qpc_eec_data.next_send_psn, qp->send.psn );
1060
+		if ( ( rc = arbel_cmd_rtr2rts_qpee ( arbel, qp->qpn,
1061
+						     &qpctx ) ) != 0 ) {
1062
+			DBGC ( arbel, "Arbel %p QPN %#lx RTR2RTS_QPEE failed: "
1063
+			       "%s\n", arbel, qp->qpn, strerror ( rc ) );
1064
+			return rc;
1065
+		}
1066
+		arbel_qp->state = ARBEL_QP_ST_RTS;
1067
+	}
1068
+
1069
+	/* Update parameters in RTS state */
1058
 	memset ( &qpctx, 0, sizeof ( qpctx ) );
1070
 	memset ( &qpctx, 0, sizeof ( qpctx ) );
1059
 	MLX_FILL_1 ( &qpctx, 0, opt_param_mask, ARBEL_QPEE_OPT_PARAM_QKEY );
1071
 	MLX_FILL_1 ( &qpctx, 0, opt_param_mask, ARBEL_QPEE_OPT_PARAM_QKEY );
1060
 	MLX_FILL_1 ( &qpctx, 44, qpc_eec_data.q_key, qp->qkey );
1072
 	MLX_FILL_1 ( &qpctx, 44, qpc_eec_data.q_key, qp->qkey );

+ 10
- 0
src/drivers/infiniband/arbel.h View File

365
 /** Queue pair number randomisation mask */
365
 /** Queue pair number randomisation mask */
366
 #define ARBEL_QPN_RANDOM_MASK 0xfff000
366
 #define ARBEL_QPN_RANDOM_MASK 0xfff000
367
 
367
 
368
+/** Arbel queue pair state */
369
+enum arbel_queue_pair_state {
370
+	ARBEL_QP_ST_RST = 0,
371
+	ARBEL_QP_ST_INIT,
372
+	ARBEL_QP_ST_RTR,
373
+	ARBEL_QP_ST_RTS,
374
+};
375
+
368
 /** An Arbel queue pair */
376
 /** An Arbel queue pair */
369
 struct arbel_queue_pair {
377
 struct arbel_queue_pair {
370
 	/** Send work queue */
378
 	/** Send work queue */
371
 	struct arbel_send_work_queue send;
379
 	struct arbel_send_work_queue send;
372
 	/** Receive work queue */
380
 	/** Receive work queue */
373
 	struct arbel_recv_work_queue recv;
381
 	struct arbel_recv_work_queue recv;
382
+	/** Queue state */
383
+	enum arbel_queue_pair_state state;
374
 };
384
 };
375
 
385
 
376
 /** Maximum number of allocatable completion queues
386
 /** Maximum number of allocatable completion queues

Loading…
Cancel
Save