|  | @@ -953,7 +953,7 @@ static int arbel_create_qp ( struct ib_device *ibdev,
 | 
		
	
		
			
			| 953 | 953 |  		     res, ARBEL_UAR_RES_RQ,
 | 
		
	
		
			
			| 954 | 954 |  		     qp_number, qp->qpn );
 | 
		
	
		
			
			| 955 | 955 |  
 | 
		
	
		
			
			| 956 |  | -	/* Hand queue over to hardware */
 | 
		
	
		
			
			|  | 956 | +	/* Transition queue to INIT state */
 | 
		
	
		
			
			| 957 | 957 |  	memset ( &qpctx, 0, sizeof ( qpctx ) );
 | 
		
	
		
			
			| 958 | 958 |  	MLX_FILL_3 ( &qpctx, 2,
 | 
		
	
		
			
			| 959 | 959 |  		     qpc_eec_data.de, 1,
 | 
		
	
	
		
			
			|  | @@ -961,9 +961,7 @@ static int arbel_create_qp ( struct ib_device *ibdev,
 | 
		
	
		
			
			| 961 | 961 |  		     qpc_eec_data.st,
 | 
		
	
		
			
			| 962 | 962 |  		     ( ( qp->type == IB_QPT_UD ) ?
 | 
		
	
		
			
			| 963 | 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 | 965 |  		     qpc_eec_data.log_rq_size, fls ( qp->recv.num_wqes - 1 ),
 | 
		
	
		
			
			| 968 | 966 |  		     qpc_eec_data.log_rq_stride,
 | 
		
	
		
			
			| 969 | 967 |  		     ( fls ( sizeof ( arbel_qp->recv.wqe[0] ) - 1 ) - 4 ),
 | 
		
	
	
		
			
			|  | @@ -993,21 +991,7 @@ static int arbel_create_qp ( struct ib_device *ibdev,
 | 
		
	
		
			
			| 993 | 991 |  		       arbel, qp->qpn, strerror ( rc ) );
 | 
		
	
		
			
			| 994 | 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 | 996 |  	DBGC ( arbel, "Arbel %p QPN %#lx send ring [%08lx,%08lx), doorbell "
 | 
		
	
		
			
			| 1013 | 997 |  	       "%08lx\n", arbel, qp->qpn, virt_to_phys ( arbel_qp->send.wqe ),
 | 
		
	
	
		
			
			|  | @@ -1024,8 +1008,6 @@ static int arbel_create_qp ( struct ib_device *ibdev,
 | 
		
	
		
			
			| 1024 | 1008 |  	ib_qp_set_drvdata ( qp, arbel_qp );
 | 
		
	
		
			
			| 1025 | 1009 |  	return 0;
 | 
		
	
		
			
			| 1026 | 1010 |  
 | 
		
	
		
			
			| 1027 |  | - err_rtr2rts_qpee:
 | 
		
	
		
			
			| 1028 |  | - err_init2rtr_qpee:
 | 
		
	
		
			
			| 1029 | 1011 |  	arbel_cmd_2rst_qpee ( arbel, qp->qpn );
 | 
		
	
		
			
			| 1030 | 1012 |   err_rst2init_qpee:
 | 
		
	
		
			
			| 1031 | 1013 |  	MLX_FILL_1 ( send_db_rec, 1, res, ARBEL_UAR_RES_NONE );
 | 
		
	
	
		
			
			|  | @@ -1051,10 +1033,40 @@ static int arbel_create_qp ( struct ib_device *ibdev,
 | 
		
	
		
			
			| 1051 | 1033 |  static int arbel_modify_qp ( struct ib_device *ibdev,
 | 
		
	
		
			
			| 1052 | 1034 |  			     struct ib_queue_pair *qp ) {
 | 
		
	
		
			
			| 1053 | 1035 |  	struct arbel *arbel = ib_get_drvdata ( ibdev );
 | 
		
	
		
			
			|  | 1036 | +	struct arbel_queue_pair *arbel_qp = ib_qp_get_drvdata ( qp );
 | 
		
	
		
			
			| 1054 | 1037 |  	struct arbelprm_qp_ee_state_transitions qpctx;
 | 
		
	
		
			
			| 1055 | 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 | 1070 |  	memset ( &qpctx, 0, sizeof ( qpctx ) );
 | 
		
	
		
			
			| 1059 | 1071 |  	MLX_FILL_1 ( &qpctx, 0, opt_param_mask, ARBEL_QPEE_OPT_PARAM_QKEY );
 | 
		
	
		
			
			| 1060 | 1072 |  	MLX_FILL_1 ( &qpctx, 44, qpc_eec_data.q_key, qp->qkey );
 |