| 
				
			 | 
			
			
				
				@@ -53,28 +53,28 @@ static struct io_buffer *static_ipoib_tx_ring[NUM_IPOIB_SND_WQES]; 
			 | 
		
		
	
		
			
			| 
				53
			 | 
			
				53
			 | 
			
			
				
				 static struct io_buffer *static_ipoib_rx_ring[NUM_IPOIB_RCV_WQES]; 
			 | 
		
		
	
		
			
			| 
				54
			 | 
			
				54
			 | 
			
			
				
				  
			 | 
		
		
	
		
			
			| 
				55
			 | 
			
				55
			 | 
			
			
				
				 static struct arbel static_arbel; 
			 | 
		
		
	
		
			
			| 
				56
			 | 
			
				
			 | 
			
			
				
				-static struct arbel_completion_queue static_ipoib_send_cq; 
			 | 
		
		
	
		
			
			| 
				57
			 | 
			
				
			 | 
			
			
				
				-static struct arbel_completion_queue static_ipoib_recv_cq; 
			 | 
		
		
	
		
			
			| 
				58
			 | 
			
				
			 | 
			
			
				
				- 
			 | 
		
		
	
		
			
			| 
				59
			 | 
			
				
			 | 
			
			
				
				-static struct arbel_queue_pair static_ipoib_qp = { 
			 | 
		
		
	
		
			
			| 
				60
			 | 
			
				
			 | 
			
			
				
				-	.qp = { 
			 | 
		
		
	
		
			
			| 
				61
			 | 
			
				
			 | 
			
			
				
				-		.send = { 
			 | 
		
		
	
		
			
			| 
				62
			 | 
			
				
			 | 
			
			
				
				-			.qp = &static_ipoib_qp.qp, 
			 | 
		
		
	
		
			
			| 
				63
			 | 
			
				
			 | 
			
			
				
				-			.is_send = 1, 
			 | 
		
		
	
		
			
			| 
				64
			 | 
			
				
			 | 
			
			
				
				-			.cq = &static_ipoib_send_cq.cq, 
			 | 
		
		
	
		
			
			| 
				65
			 | 
			
				
			 | 
			
			
				
				-			.num_wqes = NUM_IPOIB_SND_WQES, 
			 | 
		
		
	
		
			
			| 
				66
			 | 
			
				
			 | 
			
			
				
				-			.iobufs = static_ipoib_tx_ring, 
			 | 
		
		
	
		
			
			| 
				67
			 | 
			
				
			 | 
			
			
				
				-			.list = LIST_HEAD_INIT (static_ipoib_qp.qp.send.list), 
			 | 
		
		
	
		
			
			| 
				68
			 | 
			
				
			 | 
			
			
				
				-		}, 
			 | 
		
		
	
		
			
			| 
				69
			 | 
			
				
			 | 
			
			
				
				-		.recv = { 
			 | 
		
		
	
		
			
			| 
				70
			 | 
			
				
			 | 
			
			
				
				-			.qp = &static_ipoib_qp.qp, 
			 | 
		
		
	
		
			
			| 
				71
			 | 
			
				
			 | 
			
			
				
				-			.is_send = 0, 
			 | 
		
		
	
		
			
			| 
				72
			 | 
			
				
			 | 
			
			
				
				-			.cq = &static_ipoib_recv_cq.cq, 
			 | 
		
		
	
		
			
			| 
				73
			 | 
			
				
			 | 
			
			
				
				-			.num_wqes = NUM_IPOIB_RCV_WQES, 
			 | 
		
		
	
		
			
			| 
				74
			 | 
			
				
			 | 
			
			
				
				-			.iobufs = static_ipoib_rx_ring, 
			 | 
		
		
	
		
			
			| 
				75
			 | 
			
				
			 | 
			
			
				
				-			.list = LIST_HEAD_INIT (static_ipoib_qp.qp.recv.list), 
			 | 
		
		
	
		
			
			| 
				76
			 | 
			
				
			 | 
			
			
				
				-		}, 
			 | 
		
		
	
		
			
			| 
				77
			 | 
			
				
			 | 
			
			
				
				-	}, 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				56
			 | 
			
			
				
				+ 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				57
			 | 
			
			
				
				+static struct arbel_completion_queue static_arbel_ipoib_send_cq = { 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				58
			 | 
			
			
				
				+	.ci_doorbell_idx = IPOIB_SND_CQ_CI_DB_IDX, 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				59
			 | 
			
			
				
				+}; 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				60
			 | 
			
			
				
				+static struct ib_completion_queue static_ipoib_send_cq = { 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				61
			 | 
			
			
				
				+	.cqn = 1234, /* Only used for debug messages */ 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				62
			 | 
			
			
				
				+	.num_cqes = NUM_IPOIB_SND_CQES, 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				63
			 | 
			
			
				
				+	.work_queues = LIST_HEAD_INIT ( static_ipoib_send_cq.work_queues ), 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				64
			 | 
			
			
				
				+	.dev_priv = &static_arbel_ipoib_send_cq, 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				65
			 | 
			
			
				
				+}; 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				66
			 | 
			
			
				
				+ 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				67
			 | 
			
			
				
				+static struct arbel_completion_queue static_arbel_ipoib_recv_cq = { 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				68
			 | 
			
			
				
				+	.ci_doorbell_idx = IPOIB_RCV_CQ_CI_DB_IDX, 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				69
			 | 
			
			
				
				+}; 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				70
			 | 
			
			
				
				+static struct ib_completion_queue static_ipoib_recv_cq = { 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				71
			 | 
			
			
				
				+	.cqn = 2345, /* Only used for debug messages */ 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				72
			 | 
			
			
				
				+	.num_cqes = NUM_IPOIB_RCV_CQES, 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				73
			 | 
			
			
				
				+	.work_queues = LIST_HEAD_INIT ( static_ipoib_recv_cq.work_queues ), 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				74
			 | 
			
			
				
				+	.dev_priv = &static_arbel_ipoib_recv_cq, 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				75
			 | 
			
			
				
				+}; 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				76
			 | 
			
			
				
				+ 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				77
			 | 
			
			
				
				+static struct arbel_queue_pair static_arbel_ipoib_qp = { 
			 | 
		
		
	
		
			
			| 
				78
			 | 
			
				78
			 | 
			
			
				
				 	.send = { 
			 | 
		
		
	
		
			
			| 
				79
			 | 
			
				79
			 | 
			
			
				
				 		.doorbell_idx = IPOIB_SND_QP_DB_IDX, 
			 | 
		
		
	
		
			
			| 
				80
			 | 
			
				80
			 | 
			
			
				
				 	}, 
			 | 
		
		
	
	
		
			
			| 
				
			 | 
			
			
				
				@@ -82,24 +82,31 @@ static struct arbel_queue_pair static_ipoib_qp = { 
			 | 
		
		
	
		
			
			| 
				82
			 | 
			
				82
			 | 
			
			
				
				 		.doorbell_idx = IPOIB_RCV_QP_DB_IDX, 
			 | 
		
		
	
		
			
			| 
				83
			 | 
			
				83
			 | 
			
			
				
				 	}, 
			 | 
		
		
	
		
			
			| 
				84
			 | 
			
				84
			 | 
			
			
				
				 }; 
			 | 
		
		
	
		
			
			| 
				85
			 | 
			
				
			 | 
			
			
				
				-static struct arbel_completion_queue static_ipoib_send_cq = { 
			 | 
		
		
	
		
			
			| 
				86
			 | 
			
				
			 | 
			
			
				
				-	.cq = { 
			 | 
		
		
	
		
			
			| 
				87
			 | 
			
				
			 | 
			
			
				
				-		.cqn = 1234, /* Only used for debug messages */ 
			 | 
		
		
	
		
			
			| 
				88
			 | 
			
				
			 | 
			
			
				
				-		.num_cqes = NUM_IPOIB_SND_CQES, 
			 | 
		
		
	
		
			
			| 
				89
			 | 
			
				
			 | 
			
			
				
				-		.work_queues = LIST_HEAD_INIT (static_ipoib_send_cq.cq.work_queues), 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				85
			 | 
			
			
				
				+static struct ib_queue_pair static_ipoib_qp = { 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				86
			 | 
			
			
				
				+	.send = { 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				87
			 | 
			
			
				
				+		.qp = &static_ipoib_qp, 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				88
			 | 
			
			
				
				+		.is_send = 1, 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				89
			 | 
			
			
				
				+		.cq = &static_ipoib_send_cq, 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				90
			 | 
			
			
				
				+		.num_wqes = NUM_IPOIB_SND_WQES, 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				91
			 | 
			
			
				
				+		.iobufs = static_ipoib_tx_ring, 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				92
			 | 
			
			
				
				+		.list = LIST_HEAD_INIT (static_ipoib_qp.send.list), 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				93
			 | 
			
			
				
				+		.dev_priv = &static_arbel_ipoib_qp.send, 
			 | 
		
		
	
		
			
			| 
				90
			 | 
			
				94
			 | 
			
			
				
				 	}, 
			 | 
		
		
	
		
			
			| 
				91
			 | 
			
				
			 | 
			
			
				
				-	.doorbell_idx = IPOIB_SND_CQ_CI_DB_IDX, 
			 | 
		
		
	
		
			
			| 
				92
			 | 
			
				
			 | 
			
			
				
				-}; 
			 | 
		
		
	
		
			
			| 
				93
			 | 
			
				
			 | 
			
			
				
				-static struct arbel_completion_queue static_ipoib_recv_cq = { 
			 | 
		
		
	
		
			
			| 
				94
			 | 
			
				
			 | 
			
			
				
				-	.cq = { 
			 | 
		
		
	
		
			
			| 
				95
			 | 
			
				
			 | 
			
			
				
				-		.cqn = 2345, /* Only used for debug messages */ 
			 | 
		
		
	
		
			
			| 
				96
			 | 
			
				
			 | 
			
			
				
				-		.num_cqes = NUM_IPOIB_RCV_CQES, 
			 | 
		
		
	
		
			
			| 
				97
			 | 
			
				
			 | 
			
			
				
				-		.work_queues = LIST_HEAD_INIT (static_ipoib_recv_cq.cq.work_queues), 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				95
			 | 
			
			
				
				+	.recv = { 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				96
			 | 
			
			
				
				+		.qp = &static_ipoib_qp, 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				97
			 | 
			
			
				
				+		.is_send = 0, 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				98
			 | 
			
			
				
				+		.cq = &static_ipoib_recv_cq, 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				99
			 | 
			
			
				
				+		.num_wqes = NUM_IPOIB_RCV_WQES, 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				100
			 | 
			
			
				
				+		.iobufs = static_ipoib_rx_ring, 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				101
			 | 
			
			
				
				+		.list = LIST_HEAD_INIT (static_ipoib_qp.recv.list), 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				102
			 | 
			
			
				
				+		.dev_priv = &static_arbel_ipoib_qp.recv, 
			 | 
		
		
	
		
			
			| 
				98
			 | 
			
				103
			 | 
			
			
				
				 	}, 
			 | 
		
		
	
		
			
			| 
				99
			 | 
			
				
			 | 
			
			
				
				-	.doorbell_idx = IPOIB_RCV_CQ_CI_DB_IDX, 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				104
			 | 
			
			
				
				+	.dev_priv = &static_arbel_ipoib_qp, 
			 | 
		
		
	
		
			
			| 
				100
			 | 
			
				105
			 | 
			
			
				
				 }; 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				106
			 | 
			
			
				
				+ 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				107
			 | 
			
			
				
				+ 
			 | 
		
		
	
		
			
			| 
				101
			 | 
			
				108
			 | 
			
			
				
				 static struct ib_device static_ibdev = { 
			 | 
		
		
	
		
			
			| 
				102
			 | 
			
				
			 | 
			
			
				
				-	.priv = &static_arbel, 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				109
			 | 
			
			
				
				+	.dev_priv = &static_arbel, 
			 | 
		
		
	
		
			
			| 
				103
			 | 
			
				110
			 | 
			
			
				
				 }; 
			 | 
		
		
	
		
			
			| 
				104
			 | 
			
				111
			 | 
			
			
				
				  
			 | 
		
		
	
		
			
			| 
				105
			 | 
			
				112
			 | 
			
			
				
				  
			 | 
		
		
	
	
		
			
			| 
				
			 | 
			
			
				
				@@ -150,7 +157,7 @@ static int mlx_transmit_direct ( struct net_device *netdev, 
			 | 
		
		
	
		
			
			| 
				150
			 | 
			
				157
			 | 
			
			
				
				 	}; 
			 | 
		
		
	
		
			
			| 
				151
			 | 
			
				158
			 | 
			
			
				
				 	memcpy ( &av.gid, ( ( void * ) bav ) + 16, 16 ); 
			 | 
		
		
	
		
			
			| 
				152
			 | 
			
				159
			 | 
			
			
				
				  
			 | 
		
		
	
		
			
			| 
				153
			 | 
			
				
			 | 
			
			
				
				-	rc = arbel_post_send ( &static_ibdev, &static_ipoib_qp.qp, &av, iobuf ); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				160
			 | 
			
			
				
				+	rc = arbel_post_send ( &static_ibdev, &static_ipoib_qp, &av, iobuf ); 
			 | 
		
		
	
		
			
			| 
				154
			 | 
			
				161
			 | 
			
			
				
				  
			 | 
		
		
	
		
			
			| 
				155
			 | 
			
				162
			 | 
			
			
				
				 	return rc; 
			 | 
		
		
	
		
			
			| 
				156
			 | 
			
				163
			 | 
			
			
				
				 } 
			 | 
		
		
	
	
		
			
			| 
				
			 | 
			
			
				
				@@ -164,7 +171,7 @@ static void temp_complete_send ( struct ib_device *ibdev __unused, 
			 | 
		
		
	
		
			
			| 
				164
			 | 
			
				171
			 | 
			
			
				
				 				 struct ib_queue_pair *qp, 
			 | 
		
		
	
		
			
			| 
				165
			 | 
			
				172
			 | 
			
			
				
				 				 struct ib_completion *completion, 
			 | 
		
		
	
		
			
			| 
				166
			 | 
			
				173
			 | 
			
			
				
				 				 struct io_buffer *iobuf ) { 
			 | 
		
		
	
		
			
			| 
				167
			 | 
			
				
			 | 
			
			
				
				-	struct net_device *netdev = qp->priv; 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				174
			 | 
			
			
				
				+	struct net_device *netdev = qp->owner_priv; 
			 | 
		
		
	
		
			
			| 
				168
			 | 
			
				175
			 | 
			
			
				
				  
			 | 
		
		
	
		
			
			| 
				169
			 | 
			
				176
			 | 
			
			
				
				 	DBG ( "Wahey! TX completion\n" ); 
			 | 
		
		
	
		
			
			| 
				170
			 | 
			
				177
			 | 
			
			
				
				 	netdev_tx_complete_err ( netdev, iobuf, 
			 | 
		
		
	
	
		
			
			| 
				
			 | 
			
			
				
				@@ -175,7 +182,7 @@ static void temp_complete_recv ( struct ib_device *ibdev __unused, 
			 | 
		
		
	
		
			
			| 
				175
			 | 
			
				182
			 | 
			
			
				
				 				 struct ib_queue_pair *qp, 
			 | 
		
		
	
		
			
			| 
				176
			 | 
			
				183
			 | 
			
			
				
				 				 struct ib_completion *completion, 
			 | 
		
		
	
		
			
			| 
				177
			 | 
			
				184
			 | 
			
			
				
				 				 struct io_buffer *iobuf ) { 
			 | 
		
		
	
		
			
			| 
				178
			 | 
			
				
			 | 
			
			
				
				-	struct net_device *netdev = qp->priv; 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				185
			 | 
			
			
				
				+	struct net_device *netdev = qp->owner_priv; 
			 | 
		
		
	
		
			
			| 
				179
			 | 
			
				186
			 | 
			
			
				
				 	struct mlx_nic *mlx = netdev->priv; 
			 | 
		
		
	
		
			
			| 
				180
			 | 
			
				187
			 | 
			
			
				
				  
			 | 
		
		
	
		
			
			| 
				181
			 | 
			
				188
			 | 
			
			
				
				 	DBG ( "Yay! RX completion on %p len %zx:\n", iobuf, completion->len ); 
			 | 
		
		
	
	
		
			
			| 
				
			 | 
			
			
				
				@@ -205,7 +212,7 @@ static void mlx_refill_rx ( struct net_device *netdev ) { 
			 | 
		
		
	
		
			
			| 
				205
			 | 
			
				212
			 | 
			
			
				
				 			break; 
			 | 
		
		
	
		
			
			| 
				206
			 | 
			
				213
			 | 
			
			
				
				 		DBG ( "Posting RX buffer %p:\n", iobuf ); 
			 | 
		
		
	
		
			
			| 
				207
			 | 
			
				214
			 | 
			
			
				
				 		if ( ( rc = arbel_post_recv ( &static_ibdev, 
			 | 
		
		
	
		
			
			| 
				208
			 | 
			
				
			 | 
			
			
				
				-					      &static_ipoib_qp.qp, 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				215
			 | 
			
			
				
				+					      &static_ipoib_qp, 
			 | 
		
		
	
		
			
			| 
				209
			 | 
			
				216
			 | 
			
			
				
				 					      iobuf ) ) != 0 ) { 
			 | 
		
		
	
		
			
			| 
				210
			 | 
			
				217
			 | 
			
			
				
				 			free_iob ( iobuf ); 
			 | 
		
		
	
		
			
			| 
				211
			 | 
			
				218
			 | 
			
			
				
				 			break; 
			 | 
		
		
	
	
		
			
			| 
				
			 | 
			
			
				
				@@ -237,11 +244,10 @@ static void mlx_poll ( struct net_device *netdev ) { 
			 | 
		
		
	
		
			
			| 
				237
			 | 
			
				244
			 | 
			
			
				
				 	} 
			 | 
		
		
	
		
			
			| 
				238
			 | 
			
				245
			 | 
			
			
				
				  
			 | 
		
		
	
		
			
			| 
				239
			 | 
			
				246
			 | 
			
			
				
				 	/* Poll completion queues */ 
			 | 
		
		
	
		
			
			| 
				240
			 | 
			
				
			 | 
			
			
				
				-	arbel_poll_cq ( &static_ibdev, &static_ipoib_send_cq.cq, 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				247
			 | 
			
			
				
				+	arbel_poll_cq ( &static_ibdev, &static_ipoib_send_cq, 
			 | 
		
		
	
		
			
			| 
				241
			 | 
			
				248
			 | 
			
			
				
				 			temp_complete_send, temp_complete_recv ); 
			 | 
		
		
	
		
			
			| 
				242
			 | 
			
				
			 | 
			
			
				
				-	arbel_poll_cq ( &static_ibdev, &static_ipoib_recv_cq.cq, 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				249
			 | 
			
			
				
				+	arbel_poll_cq ( &static_ibdev, &static_ipoib_recv_cq, 
			 | 
		
		
	
		
			
			| 
				243
			 | 
			
				250
			 | 
			
			
				
				 			temp_complete_send, temp_complete_recv ); 
			 | 
		
		
	
		
			
			| 
				244
			 | 
			
				
			 | 
			
			
				
				-	//	mlx_poll_cq ( netdev, mlx->rcv_cqh, mlx_rx_complete ); 
			 | 
		
		
	
		
			
			| 
				245
			 | 
			
				251
			 | 
			
			
				
				  
			 | 
		
		
	
		
			
			| 
				246
			 | 
			
				252
			 | 
			
			
				
				 	mlx_refill_rx ( netdev ); 
			 | 
		
		
	
		
			
			| 
				247
			 | 
			
				253
			 | 
			
			
				
				 } 
			 | 
		
		
	
	
		
			
			| 
				
			 | 
			
			
				
				@@ -469,24 +475,18 @@ arbel_cmd_hw2sw_cq ( struct arbel *arbel, unsigned long cqn ) { 
			 | 
		
		
	
		
			
			| 
				469
			 | 
			
				475
			 | 
			
			
				
				  * Create completion queue 
			 | 
		
		
	
		
			
			| 
				470
			 | 
			
				476
			 | 
			
			
				
				  * 
			 | 
		
		
	
		
			
			| 
				471
			 | 
			
				477
			 | 
			
			
				
				  * @v ibdev		Infiniband device 
			 | 
		
		
	
		
			
			| 
				472
			 | 
			
				
			 | 
			
			
				
				- * @v log2_num_cqes	Log2 of the number of completion queue entries 
			 | 
		
		
	
		
			
			| 
				473
			 | 
			
				
			 | 
			
			
				
				- * @ret new_cq		New completion queue 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				478
			 | 
			
			
				
				+ * @v cq		Completion queue 
			 | 
		
		
	
		
			
			| 
				474
			 | 
			
				479
			 | 
			
			
				
				  * @ret rc		Return status code 
			 | 
		
		
	
		
			
			| 
				475
			 | 
			
				480
			 | 
			
			
				
				  */ 
			 | 
		
		
	
		
			
			| 
				476
			 | 
			
				481
			 | 
			
			
				
				 static int arbel_create_cq ( struct ib_device *ibdev, 
			 | 
		
		
	
		
			
			| 
				477
			 | 
			
				
			 | 
			
			
				
				-			     unsigned int log2_num_cqes, 
			 | 
		
		
	
		
			
			| 
				478
			 | 
			
				
			 | 
			
			
				
				-			     struct ib_completion_queue **new_cq ) { 
			 | 
		
		
	
		
			
			| 
				479
			 | 
			
				
			 | 
			
			
				
				-	struct arbel *arbel = ibdev->priv; 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				482
			 | 
			
			
				
				+			     struct ib_completion_queue *cq ) { 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				483
			 | 
			
			
				
				+	struct arbel *arbel = ibdev->dev_priv; 
			 | 
		
		
	
		
			
			| 
				480
			 | 
			
				484
			 | 
			
			
				
				 	struct arbel_completion_queue *arbel_cq; 
			 | 
		
		
	
		
			
			| 
				481
			 | 
			
				485
			 | 
			
			
				
				 	struct arbelprm_completion_queue_context cqctx; 
			 | 
		
		
	
		
			
			| 
				482
			 | 
			
				486
			 | 
			
			
				
				 	struct arbelprm_cq_ci_db_record *ci_db_rec; 
			 | 
		
		
	
		
			
			| 
				483
			 | 
			
				487
			 | 
			
			
				
				 	struct arbelprm_cq_arm_db_record *arm_db_rec; 
			 | 
		
		
	
		
			
			| 
				484
			 | 
			
				488
			 | 
			
			
				
				 	int cqn_offset; 
			 | 
		
		
	
		
			
			| 
				485
			 | 
			
				
			 | 
			
			
				
				-	unsigned int cqn; 
			 | 
		
		
	
		
			
			| 
				486
			 | 
			
				
			 | 
			
			
				
				-	unsigned int num_cqes; 
			 | 
		
		
	
		
			
			| 
				487
			 | 
			
				489
			 | 
			
			
				
				 	size_t cqe_size; 
			 | 
		
		
	
		
			
			| 
				488
			 | 
			
				
			 | 
			
			
				
				-	unsigned int ci_doorbell_idx; 
			 | 
		
		
	
		
			
			| 
				489
			 | 
			
				
			 | 
			
			
				
				-	unsigned int arm_doorbell_idx; 
			 | 
		
		
	
		
			
			| 
				490
			 | 
			
				490
			 | 
			
			
				
				 	unsigned int i; 
			 | 
		
		
	
		
			
			| 
				491
			 | 
			
				491
			 | 
			
			
				
				 	int rc; 
			 | 
		
		
	
		
			
			| 
				492
			 | 
			
				492
			 | 
			
			
				
				  
			 | 
		
		
	
	
		
			
			| 
				
			 | 
			
			
				
				@@ -497,9 +497,7 @@ static int arbel_create_cq ( struct ib_device *ibdev, 
			 | 
		
		
	
		
			
			| 
				497
			 | 
			
				497
			 | 
			
			
				
				 		rc = cqn_offset; 
			 | 
		
		
	
		
			
			| 
				498
			 | 
			
				498
			 | 
			
			
				
				 		goto err_cqn_offset; 
			 | 
		
		
	
		
			
			| 
				499
			 | 
			
				499
			 | 
			
			
				
				 	} 
			 | 
		
		
	
		
			
			| 
				500
			 | 
			
				
			 | 
			
			
				
				-	cqn = ( arbel->limits.reserved_cqs + cqn_offset ); 
			 | 
		
		
	
		
			
			| 
				501
			 | 
			
				
			 | 
			
			
				
				-	ci_doorbell_idx = arbel_cq_ci_doorbell_idx ( cqn_offset ); 
			 | 
		
		
	
		
			
			| 
				502
			 | 
			
				
			 | 
			
			
				
				-	arm_doorbell_idx = arbel_cq_arm_doorbell_idx ( cqn_offset ); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				500
			 | 
			
			
				
				+	cq->cqn = ( arbel->limits.reserved_cqs + cqn_offset ); 
			 | 
		
		
	
		
			
			| 
				503
			 | 
			
				501
			 | 
			
			
				
				  
			 | 
		
		
	
		
			
			| 
				504
			 | 
			
				502
			 | 
			
			
				
				 	/* Allocate control structures */ 
			 | 
		
		
	
		
			
			| 
				505
			 | 
			
				503
			 | 
			
			
				
				 	arbel_cq = zalloc ( sizeof ( *arbel_cq ) ); 
			 | 
		
		
	
	
		
			
			| 
				
			 | 
			
			
				
				@@ -507,58 +505,59 @@ static int arbel_create_cq ( struct ib_device *ibdev, 
			 | 
		
		
	
		
			
			| 
				507
			 | 
			
				505
			 | 
			
			
				
				 		rc = -ENOMEM; 
			 | 
		
		
	
		
			
			| 
				508
			 | 
			
				506
			 | 
			
			
				
				 		goto err_arbel_cq; 
			 | 
		
		
	
		
			
			| 
				509
			 | 
			
				507
			 | 
			
			
				
				 	} 
			 | 
		
		
	
		
			
			| 
				510
			 | 
			
				
			 | 
			
			
				
				-	arbel_cq->cq.cqn = cqn; 
			 | 
		
		
	
		
			
			| 
				511
			 | 
			
				
			 | 
			
			
				
				-	arbel_cq->cq.num_cqes = num_cqes; 
			 | 
		
		
	
		
			
			| 
				512
			 | 
			
				
			 | 
			
			
				
				-	INIT_LIST_HEAD ( &arbel_cq->cq.work_queues ); 
			 | 
		
		
	
		
			
			| 
				513
			 | 
			
				
			 | 
			
			
				
				-	arbel_cq->doorbell_idx = ci_doorbell_idx; 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				508
			 | 
			
			
				
				+	arbel_cq->ci_doorbell_idx = arbel_cq_ci_doorbell_idx ( cqn_offset ); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				509
			 | 
			
			
				
				+	arbel_cq->arm_doorbell_idx = arbel_cq_arm_doorbell_idx ( cqn_offset ); 
			 | 
		
		
	
		
			
			| 
				514
			 | 
			
				510
			 | 
			
			
				
				  
			 | 
		
		
	
		
			
			| 
				515
			 | 
			
				511
			 | 
			
			
				
				 	/* Allocate completion queue itself */ 
			 | 
		
		
	
		
			
			| 
				516
			 | 
			
				
			 | 
			
			
				
				-	num_cqes = ( 1 << log2_num_cqes ); 
			 | 
		
		
	
		
			
			| 
				517
			 | 
			
				
			 | 
			
			
				
				-	cqe_size = ( num_cqes * sizeof ( arbel_cq->cqe[0] ) ); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				512
			 | 
			
			
				
				+	cqe_size = ( cq->num_cqes * sizeof ( arbel_cq->cqe[0] ) ); 
			 | 
		
		
	
		
			
			| 
				518
			 | 
			
				513
			 | 
			
			
				
				 	arbel_cq->cqe = malloc_dma ( cqe_size, sizeof ( arbel_cq->cqe[0] ) ); 
			 | 
		
		
	
		
			
			| 
				519
			 | 
			
				514
			 | 
			
			
				
				 	if ( ! arbel_cq->cqe ) { 
			 | 
		
		
	
		
			
			| 
				520
			 | 
			
				515
			 | 
			
			
				
				 		rc = -ENOMEM; 
			 | 
		
		
	
		
			
			| 
				521
			 | 
			
				516
			 | 
			
			
				
				 		goto err_cqe; 
			 | 
		
		
	
		
			
			| 
				522
			 | 
			
				517
			 | 
			
			
				
				 	} 
			 | 
		
		
	
		
			
			| 
				523
			 | 
			
				518
			 | 
			
			
				
				 	memset ( arbel_cq->cqe, 0, cqe_size ); 
			 | 
		
		
	
		
			
			| 
				524
			 | 
			
				
			 | 
			
			
				
				-	for ( i = 0 ; i < num_cqes ; i++ ) { 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				519
			 | 
			
			
				
				+	for ( i = 0 ; i < cq->num_cqes ; i++ ) { 
			 | 
		
		
	
		
			
			| 
				525
			 | 
			
				520
			 | 
			
			
				
				 		MLX_FILL_1 ( &arbel_cq->cqe[i].normal, 7, owner, 1 ); 
			 | 
		
		
	
		
			
			| 
				526
			 | 
			
				521
			 | 
			
			
				
				 	} 
			 | 
		
		
	
		
			
			| 
				527
			 | 
			
				522
			 | 
			
			
				
				 	barrier(); 
			 | 
		
		
	
		
			
			| 
				528
			 | 
			
				523
			 | 
			
			
				
				  
			 | 
		
		
	
		
			
			| 
				529
			 | 
			
				524
			 | 
			
			
				
				 	/* Initialise doorbell records */ 
			 | 
		
		
	
		
			
			| 
				530
			 | 
			
				
			 | 
			
			
				
				-	ci_db_rec = &arbel->db_rec[ci_doorbell_idx].cq_ci; 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				525
			 | 
			
			
				
				+	ci_db_rec = &arbel->db_rec[arbel_cq->ci_doorbell_idx].cq_ci; 
			 | 
		
		
	
		
			
			| 
				531
			 | 
			
				526
			 | 
			
			
				
				 	MLX_FILL_1 ( ci_db_rec, 0, counter, 0 ); 
			 | 
		
		
	
		
			
			| 
				532
			 | 
			
				527
			 | 
			
			
				
				 	MLX_FILL_2 ( ci_db_rec, 1, 
			 | 
		
		
	
		
			
			| 
				533
			 | 
			
				528
			 | 
			
			
				
				 		     res, ARBEL_UAR_RES_CQ_CI, 
			 | 
		
		
	
		
			
			| 
				534
			 | 
			
				
			 | 
			
			
				
				-		     cq_number, cqn ); 
			 | 
		
		
	
		
			
			| 
				535
			 | 
			
				
			 | 
			
			
				
				-	arm_db_rec = &arbel->db_rec[arm_doorbell_idx].cq_arm; 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				529
			 | 
			
			
				
				+		     cq_number, cq->cqn ); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				530
			 | 
			
			
				
				+	arm_db_rec = &arbel->db_rec[arbel_cq->arm_doorbell_idx].cq_arm; 
			 | 
		
		
	
		
			
			| 
				536
			 | 
			
				531
			 | 
			
			
				
				 	MLX_FILL_1 ( arm_db_rec, 0, counter, 0 ); 
			 | 
		
		
	
		
			
			| 
				537
			 | 
			
				532
			 | 
			
			
				
				 	MLX_FILL_2 ( arm_db_rec, 1, 
			 | 
		
		
	
		
			
			| 
				538
			 | 
			
				533
			 | 
			
			
				
				 		     res, ARBEL_UAR_RES_CQ_ARM, 
			 | 
		
		
	
		
			
			| 
				539
			 | 
			
				
			 | 
			
			
				
				-		     cq_number, cqn ); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				534
			 | 
			
			
				
				+		     cq_number, cq->cqn ); 
			 | 
		
		
	
		
			
			| 
				540
			 | 
			
				535
			 | 
			
			
				
				  
			 | 
		
		
	
		
			
			| 
				541
			 | 
			
				536
			 | 
			
			
				
				 	/* Hand queue over to hardware */ 
			 | 
		
		
	
		
			
			| 
				542
			 | 
			
				537
			 | 
			
			
				
				 	memset ( &cqctx, 0, sizeof ( cqctx ) ); 
			 | 
		
		
	
		
			
			| 
				543
			 | 
			
				538
			 | 
			
			
				
				 	MLX_FILL_1 ( &cqctx, 0, st, 0xa /* "Event fired" */ ); 
			 | 
		
		
	
		
			
			| 
				544
			 | 
			
				539
			 | 
			
			
				
				 	MLX_FILL_1 ( &cqctx, 2, start_address_l, 
			 | 
		
		
	
		
			
			| 
				545
			 | 
			
				540
			 | 
			
			
				
				 		     virt_to_bus ( arbel_cq->cqe ) ); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				541
			 | 
			
			
				
				+#if 0 
			 | 
		
		
	
		
			
			| 
				546
			 | 
			
				542
			 | 
			
			
				
				 	MLX_FILL_2 ( &cqctx, 3, 
			 | 
		
		
	
		
			
			| 
				547
			 | 
			
				543
			 | 
			
			
				
				 		     usr_page, arbel->limits.reserved_uars, 
			 | 
		
		
	
		
			
			| 
				548
			 | 
			
				544
			 | 
			
			
				
				 		     log_cq_size, log2_num_cqes ); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				545
			 | 
			
			
				
				+#endif 
			 | 
		
		
	
		
			
			| 
				549
			 | 
			
				546
			 | 
			
			
				
				 	MLX_FILL_1 ( &cqctx, 5, c_eqn, arbel->eqn ); 
			 | 
		
		
	
		
			
			| 
				550
			 | 
			
				547
			 | 
			
			
				
				 	MLX_FILL_1 ( &cqctx, 6, pd, ARBEL_GLOBAL_PD ); 
			 | 
		
		
	
		
			
			| 
				551
			 | 
			
				548
			 | 
			
			
				
				 	MLX_FILL_1 ( &cqctx, 7, l_key, arbel->reserved_lkey ); 
			 | 
		
		
	
		
			
			| 
				552
			 | 
			
				
			 | 
			
			
				
				-	MLX_FILL_1 ( &cqctx, 12, cqn, cqn ); 
			 | 
		
		
	
		
			
			| 
				553
			 | 
			
				
			 | 
			
			
				
				-	MLX_FILL_1 ( &cqctx, 13, cq_ci_db_record, ci_doorbell_idx ); 
			 | 
		
		
	
		
			
			| 
				554
			 | 
			
				
			 | 
			
			
				
				-	MLX_FILL_1 ( &cqctx, 14, cq_state_db_record, arm_doorbell_idx ); 
			 | 
		
		
	
		
			
			| 
				555
			 | 
			
				
			 | 
			
			
				
				-	if ( ( rc = arbel_cmd_sw2hw_cq ( arbel, cqn, &cqctx ) ) != 0 ) { 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				549
			 | 
			
			
				
				+	MLX_FILL_1 ( &cqctx, 12, cqn, cq->cqn ); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				550
			 | 
			
			
				
				+	MLX_FILL_1 ( &cqctx, 13, 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				551
			 | 
			
			
				
				+		     cq_ci_db_record, arbel_cq->ci_doorbell_idx ); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				552
			 | 
			
			
				
				+	MLX_FILL_1 ( &cqctx, 14, 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				553
			 | 
			
			
				
				+		     cq_state_db_record, arbel_cq->arm_doorbell_idx ); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				554
			 | 
			
			
				
				+	if ( ( rc = arbel_cmd_sw2hw_cq ( arbel, cq->cqn, &cqctx ) ) != 0 ) { 
			 | 
		
		
	
		
			
			| 
				556
			 | 
			
				555
			 | 
			
			
				
				 		DBGC ( arbel, "Arbel %p SW2HW_CQ failed: %s\n", 
			 | 
		
		
	
		
			
			| 
				557
			 | 
			
				556
			 | 
			
			
				
				 		       arbel, strerror ( rc ) ); 
			 | 
		
		
	
		
			
			| 
				558
			 | 
			
				557
			 | 
			
			
				
				 		goto err_sw2hw; 
			 | 
		
		
	
		
			
			| 
				559
			 | 
			
				558
			 | 
			
			
				
				 	} 
			 | 
		
		
	
		
			
			| 
				560
			 | 
			
				559
			 | 
			
			
				
				  
			 | 
		
		
	
		
			
			| 
				561
			 | 
			
				
			 | 
			
			
				
				-	*new_cq = &arbel_cq->cq; 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				560
			 | 
			
			
				
				+	cq->dev_priv = arbel_cq; 
			 | 
		
		
	
		
			
			| 
				562
			 | 
			
				561
			 | 
			
			
				
				 	return 0; 
			 | 
		
		
	
		
			
			| 
				563
			 | 
			
				562
			 | 
			
			
				
				  
			 | 
		
		
	
		
			
			| 
				564
			 | 
			
				563
			 | 
			
			
				
				  err_sw2hw: 
			 | 
		
		
	
	
		
			
			| 
				
			 | 
			
			
				
				@@ -581,9 +580,8 @@ static int arbel_create_cq ( struct ib_device *ibdev, 
			 | 
		
		
	
		
			
			| 
				581
			 | 
			
				580
			 | 
			
			
				
				  */ 
			 | 
		
		
	
		
			
			| 
				582
			 | 
			
				581
			 | 
			
			
				
				 static void arbel_destroy_cq ( struct ib_device *ibdev, 
			 | 
		
		
	
		
			
			| 
				583
			 | 
			
				582
			 | 
			
			
				
				 			       struct ib_completion_queue *cq ) { 
			 | 
		
		
	
		
			
			| 
				584
			 | 
			
				
			 | 
			
			
				
				-	struct arbel *arbel = ibdev->priv; 
			 | 
		
		
	
		
			
			| 
				585
			 | 
			
				
			 | 
			
			
				
				-	struct arbel_completion_queue *arbel_cq = 
			 | 
		
		
	
		
			
			| 
				586
			 | 
			
				
			 | 
			
			
				
				-		container_of ( cq, struct arbel_completion_queue, cq ); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				583
			 | 
			
			
				
				+	struct arbel *arbel = ibdev->dev_priv; 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				584
			 | 
			
			
				
				+	struct arbel_completion_queue *arbel_cq = cq->dev_priv; 
			 | 
		
		
	
		
			
			| 
				587
			 | 
			
				585
			 | 
			
			
				
				 	struct arbelprm_cq_ci_db_record *ci_db_rec; 
			 | 
		
		
	
		
			
			| 
				588
			 | 
			
				586
			 | 
			
			
				
				 	struct arbelprm_cq_arm_db_record *arm_db_rec; 
			 | 
		
		
	
		
			
			| 
				589
			 | 
			
				587
			 | 
			
			
				
				 	int cqn_offset; 
			 | 
		
		
	
	
		
			
			| 
				
			 | 
			
			
				
				@@ -618,6 +616,53 @@ static void arbel_destroy_cq ( struct ib_device *ibdev, 
			 | 
		
		
	
		
			
			| 
				618
			 | 
			
				616
			 | 
			
			
				
				 	arbel_free_qn_offset ( arbel->cq_inuse, cqn_offset ); 
			 | 
		
		
	
		
			
			| 
				619
			 | 
			
				617
			 | 
			
			
				
				 } 
			 | 
		
		
	
		
			
			| 
				620
			 | 
			
				618
			 | 
			
			
				
				  
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				619
			 | 
			
			
				
				+/*************************************************************************** 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				620
			 | 
			
			
				
				+ * 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				621
			 | 
			
			
				
				+ * Queue pair operations 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				622
			 | 
			
			
				
				+ * 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				623
			 | 
			
			
				
				+ *************************************************************************** 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				624
			 | 
			
			
				
				+ */ 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				625
			 | 
			
			
				
				+ 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				626
			 | 
			
			
				
				+static int arbel_create_qp ( struct ib_device *ibdev, 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				627
			 | 
			
			
				
				+			     unsigned int log2_num_send_wqes, 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				628
			 | 
			
			
				
				+			     struct ib_completion_queue *send_cq, 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				629
			 | 
			
			
				
				+			     unsigned int log2_num_recv_wqes, 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				630
			 | 
			
			
				
				+			     struct ib_completion_queue *recv_cq, 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				631
			 | 
			
			
				
				+			     struct ib_queue_pair **new_qp ) { 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				632
			 | 
			
			
				
				+	struct arbel *arbel = ibdev->dev_priv; 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				633
			 | 
			
			
				
				+	struct arbel_queue_pair *arbel_qp; 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				634
			 | 
			
			
				
				+	struct arbelprm_qp_db_record *send_db_rec; 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				635
			 | 
			
			
				
				+	struct arbelprm_qp_db_record *recv_db_rec; 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				636
			 | 
			
			
				
				+	int qpn_offset; 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				637
			 | 
			
			
				
				+	unsigned int qpn; 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				638
			 | 
			
			
				
				+	unsigned int num_send_wqes; 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				639
			 | 
			
			
				
				+	unsigned int num_recv_wqes; 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				640
			 | 
			
			
				
				+	unsigned int send_doorbell_idx; 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				641
			 | 
			
			
				
				+	unsigned int recv_doorbell_idx; 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				642
			 | 
			
			
				
				+	int rc; 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				643
			 | 
			
			
				
				+ 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				644
			 | 
			
			
				
				+	/* Find a free queue pair number */ 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				645
			 | 
			
			
				
				+	qpn_offset = arbel_alloc_qn_offset ( arbel->qp_inuse, ARBEL_MAX_QPS ); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				646
			 | 
			
			
				
				+	if ( qpn_offset < 0 ) { 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				647
			 | 
			
			
				
				+		DBGC ( arbel, "Arbel %p out of queue pairs\n", arbel ); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				648
			 | 
			
			
				
				+		rc = qpn_offset; 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				649
			 | 
			
			
				
				+		goto err_qpn_offset; 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				650
			 | 
			
			
				
				+	} 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				651
			 | 
			
			
				
				+	qpn = ( ARBEL_QPN_BASE + arbel->limits.reserved_qps + qpn_offset ); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				652
			 | 
			
			
				
				+	send_doorbell_idx = arbel_send_doorbell_idx ( qpn_offset ); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				653
			 | 
			
			
				
				+	recv_doorbell_idx = arbel_recv_doorbell_idx ( qpn_offset ); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				654
			 | 
			
			
				
				+ 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				655
			 | 
			
			
				
				+	/* Allocate control structures */ 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				656
			 | 
			
			
				
				+	num_send_wqes = ( 1 << log2_num_send_wqes ); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				657
			 | 
			
			
				
				+	num_recv_wqes = ( 1 << log2_num_recv_wqes ); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				658
			 | 
			
			
				
				+	arbel_qp = zalloc ( sizeof ( *arbel_qp ) ); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				659
			 | 
			
			
				
				+ 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				660
			 | 
			
			
				
				+	return 0; 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				661
			 | 
			
			
				
				+ 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				662
			 | 
			
			
				
				+ err_qpn_offset: 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				663
			 | 
			
			
				
				+	return rc; 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				664
			 | 
			
			
				
				+} 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				665
			 | 
			
			
				
				+ 
			 | 
		
		
	
		
			
			| 
				621
			 | 
			
				666
			 | 
			
			
				
				 /*************************************************************************** 
			 | 
		
		
	
		
			
			| 
				622
			 | 
			
				667
			 | 
			
			
				
				  * 
			 | 
		
		
	
		
			
			| 
				623
			 | 
			
				668
			 | 
			
			
				
				  * Work request operations 
			 | 
		
		
	
	
		
			
			| 
				
			 | 
			
			
				
				@@ -659,9 +704,8 @@ static int arbel_post_send ( struct ib_device *ibdev, 
			 | 
		
		
	
		
			
			| 
				659
			 | 
			
				704
			 | 
			
			
				
				 			     struct ib_queue_pair *qp, 
			 | 
		
		
	
		
			
			| 
				660
			 | 
			
				705
			 | 
			
			
				
				 			     struct ib_address_vector *av, 
			 | 
		
		
	
		
			
			| 
				661
			 | 
			
				706
			 | 
			
			
				
				 			     struct io_buffer *iobuf ) { 
			 | 
		
		
	
		
			
			| 
				662
			 | 
			
				
			 | 
			
			
				
				-	struct arbel *arbel = ibdev->priv; 
			 | 
		
		
	
		
			
			| 
				663
			 | 
			
				
			 | 
			
			
				
				-	struct arbel_queue_pair *arbel_qp 
			 | 
		
		
	
		
			
			| 
				664
			 | 
			
				
			 | 
			
			
				
				-		= container_of ( qp, struct arbel_queue_pair, qp ); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				707
			 | 
			
			
				
				+	struct arbel *arbel = ibdev->dev_priv; 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				708
			 | 
			
			
				
				+	struct arbel_queue_pair *arbel_qp = qp->dev_priv; 
			 | 
		
		
	
		
			
			| 
				665
			 | 
			
				709
			 | 
			
			
				
				 	struct ib_work_queue *wq = &qp->send; 
			 | 
		
		
	
		
			
			| 
				666
			 | 
			
				710
			 | 
			
			
				
				 	struct arbel_send_work_queue *arbel_send_wq = &arbel_qp->send; 
			 | 
		
		
	
		
			
			| 
				667
			 | 
			
				711
			 | 
			
			
				
				 	struct arbelprm_ud_send_wqe *prev_wqe; 
			 | 
		
		
	
	
		
			
			| 
				
			 | 
			
			
				
				@@ -749,9 +793,8 @@ static int arbel_post_send ( struct ib_device *ibdev, 
			 | 
		
		
	
		
			
			| 
				749
			 | 
			
				793
			 | 
			
			
				
				 static int arbel_post_recv ( struct ib_device *ibdev, 
			 | 
		
		
	
		
			
			| 
				750
			 | 
			
				794
			 | 
			
			
				
				 			     struct ib_queue_pair *qp, 
			 | 
		
		
	
		
			
			| 
				751
			 | 
			
				795
			 | 
			
			
				
				 			     struct io_buffer *iobuf ) { 
			 | 
		
		
	
		
			
			| 
				752
			 | 
			
				
			 | 
			
			
				
				-	struct arbel *arbel = ibdev->priv; 
			 | 
		
		
	
		
			
			| 
				753
			 | 
			
				
			 | 
			
			
				
				-	struct arbel_queue_pair *arbel_qp 
			 | 
		
		
	
		
			
			| 
				754
			 | 
			
				
			 | 
			
			
				
				-		= container_of ( qp, struct arbel_queue_pair, qp ); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				796
			 | 
			
			
				
				+	struct arbel *arbel = ibdev->dev_priv; 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				797
			 | 
			
			
				
				+	struct arbel_queue_pair *arbel_qp = qp->dev_priv; 
			 | 
		
		
	
		
			
			| 
				755
			 | 
			
				798
			 | 
			
			
				
				 	struct ib_work_queue *wq = &qp->recv; 
			 | 
		
		
	
		
			
			| 
				756
			 | 
			
				799
			 | 
			
			
				
				 	struct arbel_recv_work_queue *arbel_recv_wq = &arbel_qp->recv; 
			 | 
		
		
	
		
			
			| 
				757
			 | 
			
				800
			 | 
			
			
				
				 	struct arbelprm_recv_wqe *wqe; 
			 | 
		
		
	
	
		
			
			| 
				
			 | 
			
			
				
				@@ -800,7 +843,7 @@ static int arbel_complete ( struct ib_device *ibdev, 
			 | 
		
		
	
		
			
			| 
				800
			 | 
			
				843
			 | 
			
			
				
				 			    union arbelprm_completion_entry *cqe, 
			 | 
		
		
	
		
			
			| 
				801
			 | 
			
				844
			 | 
			
			
				
				 			    ib_completer_t complete_send, 
			 | 
		
		
	
		
			
			| 
				802
			 | 
			
				845
			 | 
			
			
				
				 			    ib_completer_t complete_recv ) { 
			 | 
		
		
	
		
			
			| 
				803
			 | 
			
				
			 | 
			
			
				
				-	struct arbel *arbel = ibdev->priv; 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				846
			 | 
			
			
				
				+	struct arbel *arbel = ibdev->dev_priv; 
			 | 
		
		
	
		
			
			| 
				804
			 | 
			
				847
			 | 
			
			
				
				 	struct ib_completion completion; 
			 | 
		
		
	
		
			
			| 
				805
			 | 
			
				848
			 | 
			
			
				
				 	struct ib_work_queue *wq; 
			 | 
		
		
	
		
			
			| 
				806
			 | 
			
				849
			 | 
			
			
				
				 	struct ib_queue_pair *qp; 
			 | 
		
		
	
	
		
			
			| 
				
			 | 
			
			
				
				@@ -842,7 +885,7 @@ static int arbel_complete ( struct ib_device *ibdev, 
			 | 
		
		
	
		
			
			| 
				842
			 | 
			
				885
			 | 
			
			
				
				 		return -EIO; 
			 | 
		
		
	
		
			
			| 
				843
			 | 
			
				886
			 | 
			
			
				
				 	} 
			 | 
		
		
	
		
			
			| 
				844
			 | 
			
				887
			 | 
			
			
				
				 	qp = wq->qp; 
			 | 
		
		
	
		
			
			| 
				845
			 | 
			
				
			 | 
			
			
				
				-	arbel_qp = container_of ( qp, struct arbel_queue_pair, qp ); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				888
			 | 
			
			
				
				+	arbel_qp = qp->dev_priv; 
			 | 
		
		
	
		
			
			| 
				846
			 | 
			
				889
			 | 
			
			
				
				  
			 | 
		
		
	
		
			
			| 
				847
			 | 
			
				890
			 | 
			
			
				
				 	/* Identify work queue entry index */ 
			 | 
		
		
	
		
			
			| 
				848
			 | 
			
				891
			 | 
			
			
				
				 	if ( is_send ) { 
			 | 
		
		
	
	
		
			
			| 
				
			 | 
			
			
				
				@@ -883,9 +926,8 @@ static void arbel_poll_cq ( struct ib_device *ibdev, 
			 | 
		
		
	
		
			
			| 
				883
			 | 
			
				926
			 | 
			
			
				
				 			    struct ib_completion_queue *cq, 
			 | 
		
		
	
		
			
			| 
				884
			 | 
			
				927
			 | 
			
			
				
				 			    ib_completer_t complete_send, 
			 | 
		
		
	
		
			
			| 
				885
			 | 
			
				928
			 | 
			
			
				
				 			    ib_completer_t complete_recv ) { 
			 | 
		
		
	
		
			
			| 
				886
			 | 
			
				
			 | 
			
			
				
				-	struct arbel *arbel = ibdev->priv; 
			 | 
		
		
	
		
			
			| 
				887
			 | 
			
				
			 | 
			
			
				
				-	struct arbel_completion_queue *arbel_cq 
			 | 
		
		
	
		
			
			| 
				888
			 | 
			
				
			 | 
			
			
				
				-		= container_of ( cq, struct arbel_completion_queue, cq ); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				929
			 | 
			
			
				
				+	struct arbel *arbel = ibdev->dev_priv; 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				930
			 | 
			
			
				
				+	struct arbel_completion_queue *arbel_cq = cq->dev_priv; 
			 | 
		
		
	
		
			
			| 
				889
			 | 
			
				931
			 | 
			
			
				
				 	struct arbelprm_cq_ci_db_record *ci_db_rec; 
			 | 
		
		
	
		
			
			| 
				890
			 | 
			
				932
			 | 
			
			
				
				 	union arbelprm_completion_entry *cqe; 
			 | 
		
		
	
		
			
			| 
				891
			 | 
			
				933
			 | 
			
			
				
				 	unsigned int cqe_idx_mask; 
			 | 
		
		
	
	
		
			
			| 
				
			 | 
			
			
				
				@@ -914,7 +956,7 @@ static void arbel_poll_cq ( struct ib_device *ibdev, 
			 | 
		
		
	
		
			
			| 
				914
			 | 
			
				956
			 | 
			
			
				
				 		/* Update completion queue's index */ 
			 | 
		
		
	
		
			
			| 
				915
			 | 
			
				957
			 | 
			
			
				
				 		cq->next_idx++; 
			 | 
		
		
	
		
			
			| 
				916
			 | 
			
				958
			 | 
			
			
				
				 		/* Update doorbell record */ 
			 | 
		
		
	
		
			
			| 
				917
			 | 
			
				
			 | 
			
			
				
				-		ci_db_rec = &arbel->db_rec[arbel_cq->doorbell_idx].cq_ci; 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				959
			 | 
			
			
				
				+		ci_db_rec = &arbel->db_rec[arbel_cq->ci_doorbell_idx].cq_ci; 
			 | 
		
		
	
		
			
			| 
				918
			 | 
			
				960
			 | 
			
			
				
				 		MLX_FILL_1 ( ci_db_rec, 0, 
			 | 
		
		
	
		
			
			| 
				919
			 | 
			
				961
			 | 
			
			
				
				 			     counter, ( cq->next_idx & 0xffffffffUL ) ); 
			 | 
		
		
	
		
			
			| 
				920
			 | 
			
				962
			 | 
			
			
				
				 	} 
			 | 
		
		
	
	
		
			
			| 
				
			 | 
			
			
				
				@@ -992,20 +1034,20 @@ static int arbel_probe ( struct pci_device *pci, 
			 | 
		
		
	
		
			
			| 
				992
			 | 
			
				1034
			 | 
			
			
				
				 	arbel->db_rec = dev_ib_data.uar_context_base; 
			 | 
		
		
	
		
			
			| 
				993
			 | 
			
				1035
			 | 
			
			
				
				 	arbel->reserved_lkey = dev_ib_data.mkey; 
			 | 
		
		
	
		
			
			| 
				994
			 | 
			
				1036
			 | 
			
			
				
				 	arbel->eqn = dev_ib_data.eq.eqn; 
			 | 
		
		
	
		
			
			| 
				995
			 | 
			
				
			 | 
			
			
				
				-	static_ipoib_qp.send.wqe = 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				1037
			 | 
			
			
				
				+	static_arbel_ipoib_qp.send.wqe = 
			 | 
		
		
	
		
			
			| 
				996
			 | 
			
				1038
			 | 
			
			
				
				 		( ( struct udqp_st * ) qph )->snd_wq; 
			 | 
		
		
	
		
			
			| 
				997
			 | 
			
				
			 | 
			
			
				
				-	static_ipoib_qp.recv.wqe = 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				1039
			 | 
			
			
				
				+	static_arbel_ipoib_qp.recv.wqe = 
			 | 
		
		
	
		
			
			| 
				998
			 | 
			
				1040
			 | 
			
			
				
				 		( ( struct udqp_st * ) qph )->rcv_wq; 
			 | 
		
		
	
		
			
			| 
				999
			 | 
			
				
			 | 
			
			
				
				-	static_ipoib_send_cq.cqe = 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				1041
			 | 
			
			
				
				+	static_arbel_ipoib_send_cq.cqe = 
			 | 
		
		
	
		
			
			| 
				1000
			 | 
			
				1042
			 | 
			
			
				
				 		( ( struct cq_st * ) ib_data.ipoib_snd_cq )->cq_buf; 
			 | 
		
		
	
		
			
			| 
				1001
			 | 
			
				
			 | 
			
			
				
				-	static_ipoib_recv_cq.cqe = 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				1043
			 | 
			
			
				
				+	static_arbel_ipoib_recv_cq.cqe = 
			 | 
		
		
	
		
			
			| 
				1002
			 | 
			
				1044
			 | 
			
			
				
				 		( ( struct cq_st * ) ib_data.ipoib_rcv_cq )->cq_buf; 
			 | 
		
		
	
		
			
			| 
				1003
			 | 
			
				
			 | 
			
			
				
				-	static_ipoib_qp.qp.qpn = ib_get_qpn ( qph ); 
			 | 
		
		
	
		
			
			| 
				1004
			 | 
			
				
			 | 
			
			
				
				-	static_ipoib_qp.qp.priv = netdev; 
			 | 
		
		
	
		
			
			| 
				1005
			 | 
			
				
			 | 
			
			
				
				-	list_add ( &static_ipoib_qp.qp.send.list, 
			 | 
		
		
	
		
			
			| 
				1006
			 | 
			
				
			 | 
			
			
				
				-		   &static_ipoib_send_cq.cq.work_queues ); 
			 | 
		
		
	
		
			
			| 
				1007
			 | 
			
				
			 | 
			
			
				
				-	list_add ( &static_ipoib_qp.qp.recv.list, 
			 | 
		
		
	
		
			
			| 
				1008
			 | 
			
				
			 | 
			
			
				
				-		   &static_ipoib_recv_cq.cq.work_queues ); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				1045
			 | 
			
			
				
				+	static_ipoib_qp.qpn = ib_get_qpn ( qph ); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				1046
			 | 
			
			
				
				+	static_ipoib_qp.owner_priv = netdev; 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				1047
			 | 
			
			
				
				+	list_add ( &static_ipoib_qp.send.list, 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				1048
			 | 
			
			
				
				+		   &static_ipoib_send_cq.work_queues ); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				1049
			 | 
			
			
				
				+	list_add ( &static_ipoib_qp.recv.list, 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				1050
			 | 
			
			
				
				+		   &static_ipoib_recv_cq.work_queues ); 
			 | 
		
		
	
		
			
			| 
				1009
			 | 
			
				1051
			 | 
			
			
				
				  
			 | 
		
		
	
		
			
			| 
				1010
			 | 
			
				1052
			 | 
			
			
				
				 	/* Get device limits */ 
			 | 
		
		
	
		
			
			| 
				1011
			 | 
			
				1053
			 | 
			
			
				
				 	if ( ( rc = arbel_cmd_query_dev_lim ( arbel, &dev_lim ) ) != 0 ) { 
			 | 
		
		
	
	
		
			
			| 
				
			 | 
			
			
				
				@@ -1016,6 +1058,8 @@ static int arbel_probe ( struct pci_device *pci, 
			 | 
		
		
	
		
			
			| 
				1016
			 | 
			
				1058
			 | 
			
			
				
				 	arbel->limits.reserved_uars = MLX_GET ( &dev_lim, num_rsvd_uars ); 
			 | 
		
		
	
		
			
			| 
				1017
			 | 
			
				1059
			 | 
			
			
				
				 	arbel->limits.reserved_cqs = 
			 | 
		
		
	
		
			
			| 
				1018
			 | 
			
				1060
			 | 
			
			
				
				 		( 1 << MLX_GET ( &dev_lim, log2_rsvd_cqs ) ); 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				1061
			 | 
			
			
				
				+	arbel->limits.reserved_qps = 
			 | 
		
		
	
		
			
			| 
				
			 | 
			
				1062
			 | 
			
			
				
				+		( 1 << MLX_GET ( &dev_lim, log2_rsvd_qps ) ); 
			 | 
		
		
	
		
			
			| 
				1019
			 | 
			
				1063
			 | 
			
			
				
				 	DBG ( "Device limits:\n "); 
			 | 
		
		
	
		
			
			| 
				1020
			 | 
			
				1064
			 | 
			
			
				
				 	DBG_HD ( &dev_lim, sizeof ( dev_lim ) ); 
			 | 
		
		
	
		
			
			| 
				1021
			 | 
			
				1065
			 | 
			
			
				
				  
			 |