Browse Source

Almost working with own-queue allocation.

tags/v0.9.3
Michael Brown 17 years ago
parent
commit
4ddb6570f8

+ 3
- 1
src/drivers/net/mlx_ipoib/arbel.h View File

35
 #define ARBEL_HCR_2RST_QPEE		0x0021
35
 #define ARBEL_HCR_2RST_QPEE		0x0021
36
 
36
 
37
 /* Service types */
37
 /* Service types */
38
-#define ARBEL_ST_UD			0x01
38
+#define ARBEL_ST_UD			0x03
39
 
39
 
40
 /* MTUs */
40
 /* MTUs */
41
 #define ARBEL_MTU_2048			0x04
41
 #define ARBEL_MTU_2048			0x04
42
 
42
 
43
+#define ARBEL_INVALID_LKEY		0x00000100UL
44
+
43
 /*
45
 /*
44
  * Wrapper structures for hardware datatypes
46
  * Wrapper structures for hardware datatypes
45
  *
47
  *

+ 24
- 0
src/drivers/net/mlx_ipoib/cmdif_comm.c View File

112
 	__u32 hcr[7], data;
112
 	__u32 hcr[7], data;
113
 	__u8 status;
113
 	__u8 status;
114
 
114
 
115
+	DBG ( "Executing command:\n" );
116
+		
115
 	/* check if go bit is free */
117
 	/* check if go bit is free */
116
 	ret = cmdif_is_free(&is_free);
118
 	ret = cmdif_is_free(&is_free);
117
 	if (ret) {
119
 	if (ret) {
129
 	edit_hcr(cmd_prms, hcr);
131
 	edit_hcr(cmd_prms, hcr);
130
 	__asm__ __volatile__("":::"memory");
132
 	__asm__ __volatile__("":::"memory");
131
 
133
 
134
+	DBG_HD ( &hcr[0], sizeof ( hcr ) ); 
135
+	if ( cmd_prms->in_trans == TRANS_MAILBOX ) {
136
+		size_t size = ( 4 * cmd_prms->in_param_size );
137
+		if ( size > 256 )
138
+			size = 256;
139
+#if ! CREATE_OWN
140
+		DBG ( "Input mailbox:\n" );
141
+		DBG_HD ( &cmd_prms->in_param[0], size );
142
+#endif
143
+	}
144
+
132
 	for (i = 0; i < 7; ++i) {
145
 	for (i = 0; i < 7; ++i) {
133
 		ret = gw_write_cr(HCR_BASE + i * 4, hcr[i]);
146
 		ret = gw_write_cr(HCR_BASE + i * 4, hcr[i]);
134
 		if (ret) {
147
 		if (ret) {
168
 			return -1;
181
 			return -1;
169
 	}
182
 	}
170
 
183
 
184
+	if ( cmd_prms->out_trans == TRANS_MAILBOX ) {
185
+		size_t size = ( 4 * cmd_prms->out_param_size );
186
+		if ( size > 256 )
187
+			size = 256;
188
+#if ! CREATE_OWN
189
+		DBG ( "Output mailbox:\n" );
190
+		DBG_HD ( &cmd_prms->out_param[0], size );
191
+#endif
192
+	}
193
+	DBG ( "Command executed successfully\n" );
194
+
171
 	return 0;
195
 	return 0;
172
 }
196
 }
173
 
197
 

+ 19
- 0
src/drivers/net/mlx_ipoib/ib_driver.c View File

62
 	return 0;
62
 	return 0;
63
 }
63
 }
64
 
64
 
65
+unsigned long ipoib_qkey;
66
+
65
 static int ib_driver_init(struct pci_device *pci, udqp_t * ipoib_qph_p)
67
 static int ib_driver_init(struct pci_device *pci, udqp_t * ipoib_qph_p)
66
 {
68
 {
67
 	int rc;
69
 	int rc;
147
 			qkey, mlid);
149
 			qkey, mlid);
148
 	}
150
 	}
149
 
151
 
152
+	ipoib_qkey = qkey;
153
+
154
+#if 0
150
 	rc = create_ipoib_qp(&ib_data.ipoib_qp,
155
 	rc = create_ipoib_qp(&ib_data.ipoib_qp,
151
 			     &ib_data.ipoib_snd_cq,
156
 			     &ib_data.ipoib_snd_cq,
152
 			     &ib_data.ipoib_rcv_cq, qkey);
157
 			     &ib_data.ipoib_rcv_cq, qkey);
166
 	} else {
171
 	} else {
167
 		tprintf("add_qp_to_mcast_group() success");
172
 		tprintf("add_qp_to_mcast_group() success");
168
 	}
173
 	}
174
+#endif
169
 
175
 
170
 	/* create a broadcast group ud AV */
176
 	/* create a broadcast group ud AV */
171
 	av = alloc_ud_av();
177
 	av = alloc_ud_av();
178
 	tprintf("modify_av_params() success");
184
 	tprintf("modify_av_params() success");
179
 	ib_data.bcast_av = av;
185
 	ib_data.bcast_av = av;
180
 
186
 
187
+#if ! CREATE_OWN
188
+	rc = create_ipoib_qp(&ib_data.ipoib_qp,
189
+			     &ib_data.ipoib_snd_cq,
190
+			     &ib_data.ipoib_rcv_cq, qkey);
191
+	if (rc) {
192
+		eprintf("");
193
+		return rc;
194
+	}
195
+
196
+	tprintf("create_ipoib_qp() success");
197
+	*ipoib_qph_p = ib_data.ipoib_qp;
198
+#endif
199
+
181
 	do {
200
 	do {
182
 		rc = poll_eq(&ib_eqe, &num_eqe);
201
 		rc = poll_eq(&ib_eqe, &num_eqe);
183
 		if (rc) {
202
 		if (rc) {

+ 3
- 3
src/drivers/net/mlx_ipoib/ib_driver.h View File

49
 #define QPN_BASE 0x550000
49
 #define QPN_BASE 0x550000
50
 
50
 
51
 enum {
51
 enum {
52
-	MADS_QPN_SN,
53
 	IPOIB_QPN_SN,
52
 	IPOIB_QPN_SN,
53
+	MADS_QPN_SN = 4,
54
 	MAX_APP_QPS = 8
54
 	MAX_APP_QPS = 8
55
 };
55
 };
56
 
56
 
57
 enum {
57
 enum {
58
-	MADS_SND_CQN_SN = 4,
59
-	MADS_RCV_CQN_SN,
60
 	IPOIB_SND_CQN_SN,
58
 	IPOIB_SND_CQN_SN,
61
 	IPOIB_RCV_CQN_SN,
59
 	IPOIB_RCV_CQN_SN,
60
+	MADS_SND_CQN_SN = 4,
61
+	MADS_RCV_CQN_SN,
62
 	MAX_APP_CQS = 8
62
 	MAX_APP_CQS = 8
63
 };
63
 };
64
 
64
 

+ 16
- 0
src/drivers/net/mlx_ipoib/ib_mt25218.c View File

336
 	//	INS_FLD(virt_to_bus(dev_buffers_p), buf, arbelprm_mpt_st,
336
 	//	INS_FLD(virt_to_bus(dev_buffers_p), buf, arbelprm_mpt_st,
337
 	//		start_address_l);
337
 	//		start_address_l);
338
 	//	INS_FLD(memreg_size, buf, arbelprm_mpt_st, reg_wnd_len_l);
338
 	//	INS_FLD(memreg_size, buf, arbelprm_mpt_st, reg_wnd_len_l);
339
+	INS_FLD(0, buf, arbelprm_mpt_st, start_address_l);
340
+	INS_FLD(0, buf, arbelprm_mpt_st, start_address_h);
339
 	INS_FLD(0xffffffffUL, buf, arbelprm_mpt_st, reg_wnd_len_l);
341
 	INS_FLD(0xffffffffUL, buf, arbelprm_mpt_st, reg_wnd_len_l);
340
 	INS_FLD(0xffffffffUL, buf, arbelprm_mpt_st, reg_wnd_len_h);
342
 	INS_FLD(0xffffffffUL, buf, arbelprm_mpt_st, reg_wnd_len_h);
341
 }
343
 }
1179
 	__u8 nds;
1181
 	__u8 nds;
1180
 	void *ptr;
1182
 	void *ptr;
1181
 
1183
 
1184
+	DBG ( "*** Creating MADS queue pair ***\n" );
1185
+
1182
 	qp = &dev_ib_data.mads_qp;
1186
 	qp = &dev_ib_data.mads_qp;
1183
 
1187
 
1184
 	/* set the pointer to the receive WQEs buffer */
1188
 	/* set the pointer to the receive WQEs buffer */
1289
 		*rcv_cq_pp = &qp->rcv_cq;
1293
 		*rcv_cq_pp = &qp->rcv_cq;
1290
 	}
1294
 	}
1291
 
1295
 
1296
+	DBG ( "*** Created MADS queue pair ***\n" );
1297
+
1292
 	return rc;
1298
 	return rc;
1293
 }
1299
 }
1294
 
1300
 
1302
 	__u8 nds;
1308
 	__u8 nds;
1303
 	void *ptr;
1309
 	void *ptr;
1304
 
1310
 
1311
+	DBG ( "*** Creating IPoIB queue pair ***\n" );
1312
+
1305
 	qp = &dev_ib_data.ipoib_qp;
1313
 	qp = &dev_ib_data.ipoib_qp;
1306
 
1314
 
1307
 	/* set the pointer to the receive WQEs buffer */
1315
 	/* set the pointer to the receive WQEs buffer */
1407
 		*rcv_cq_pp = &qp->rcv_cq;
1415
 		*rcv_cq_pp = &qp->rcv_cq;
1408
 	}
1416
 	}
1409
 
1417
 
1418
+	DBG ( "*** Created IPoIB queue pair ***\n" );
1419
+
1410
 	return rc;
1420
 	return rc;
1411
 }
1421
 }
1412
 
1422
 
1427
 	qp->snd_cq.ci_db_ctx_pointer =
1437
 	qp->snd_cq.ci_db_ctx_pointer =
1428
 	    dev_ib_data.uar_context_base + 8 * qp->snd_cq.ci_db_ctx_idx;
1438
 	    dev_ib_data.uar_context_base + 8 * qp->snd_cq.ci_db_ctx_idx;
1429
 
1439
 
1440
+	DBG ( "* Creating send CQ *\n" );
1441
+
1430
 	/* create send CQ */
1442
 	/* create send CQ */
1431
 	init_cq_buf(qp->snd_cq.cq_buf, qp->snd_cq.num_cqes);
1443
 	init_cq_buf(qp->snd_cq.cq_buf, qp->snd_cq.num_cqes);
1432
 	qp->snd_cq.cons_counter = 0;
1444
 	qp->snd_cq.cons_counter = 0;
1443
 		goto exit;
1455
 		goto exit;
1444
 	}
1456
 	}
1445
 
1457
 
1458
+	DBG ( "* Creating receive CQ *\n" );
1459
+
1446
 	/* create receive CQ */
1460
 	/* create receive CQ */
1447
 	init_cq_buf(qp->rcv_cq.cq_buf, qp->rcv_cq.num_cqes);
1461
 	init_cq_buf(qp->rcv_cq.cq_buf, qp->rcv_cq.num_cqes);
1448
 	qp->rcv_cq.cons_counter = 0;
1462
 	qp->rcv_cq.cons_counter = 0;
1460
 		goto undo_snd_cq;
1474
 		goto undo_snd_cq;
1461
 	}
1475
 	}
1462
 
1476
 
1477
+	DBG ( "* Creating QP *\n" );
1478
+
1463
 	prep_rst2init_qpee_buf(inprm,
1479
 	prep_rst2init_qpee_buf(inprm,
1464
 			       qp->snd_cq.cqn,
1480
 			       qp->snd_cq.cqn,
1465
 			       qp->rcv_cq.cqn,
1481
 			       qp->rcv_cq.cqn,

+ 101
- 7
src/drivers/net/mlx_ipoib/mt25218.c View File

22
 /* to get the interface to the body of the program */
22
 /* to get the interface to the body of the program */
23
 #include "nic.h"
23
 #include "nic.h"
24
 
24
 
25
+#define CREATE_OWN 1
26
+
25
 #include "mt25218_imp.c"
27
 #include "mt25218_imp.c"
26
 
28
 
27
 #include "arbel.h"
29
 #include "arbel.h"
35
 #define MLX_RX_MAX_FILL NUM_IPOIB_RCV_WQES
37
 #define MLX_RX_MAX_FILL NUM_IPOIB_RCV_WQES
36
 
38
 
37
 struct mlx_nic {
39
 struct mlx_nic {
40
+#if ! CREATE_OWN
38
 	/** Queue pair handle */
41
 	/** Queue pair handle */
39
 	udqp_t ipoib_qph;
42
 	udqp_t ipoib_qph;
40
-	/** Broadcast Address Vector */
41
-	ud_av_t bcast_av;
42
 	/** Send completion queue */
43
 	/** Send completion queue */
43
 	cq_t snd_cqh;
44
 	cq_t snd_cqh;
44
 	/** Receive completion queue */
45
 	/** Receive completion queue */
45
 	cq_t rcv_cqh;
46
 	cq_t rcv_cqh;
47
+#endif
48
+	/** Broadcast Address Vector */
49
+	ud_av_t bcast_av;
46
 
50
 
47
 	/** RX fill level */
51
 	/** RX fill level */
48
 	unsigned int rx_fill;
52
 	unsigned int rx_fill;
53
+
54
+#if CREATE_OWN
55
+	struct ib_completion_queue *own_send_cq;
56
+	struct ib_completion_queue *own_recv_cq;
57
+	struct ib_queue_pair *own_qp;
58
+#endif
49
 };
59
 };
50
 
60
 
51
 
61
 
54
 
64
 
55
 static struct arbel static_arbel;
65
 static struct arbel static_arbel;
56
 
66
 
67
+#if ! CREATE_OWN
68
+
57
 static struct arbel_completion_queue static_arbel_ipoib_send_cq = {
69
 static struct arbel_completion_queue static_arbel_ipoib_send_cq = {
58
 	.ci_doorbell_idx = IPOIB_SND_CQ_CI_DB_IDX,
70
 	.ci_doorbell_idx = IPOIB_SND_CQ_CI_DB_IDX,
59
 };
71
 };
104
 	.dev_priv = &static_arbel_ipoib_qp,
116
 	.dev_priv = &static_arbel_ipoib_qp,
105
 };
117
 };
106
 
118
 
119
+#endif
120
+
107
 
121
 
108
 static struct ib_device static_ibdev = {
122
 static struct ib_device static_ibdev = {
109
 	.dev_priv = &static_arbel,
123
 	.dev_priv = &static_arbel,
157
 	};
171
 	};
158
 	memcpy ( &av.gid, ( ( void * ) bav ) + 16, 16 );
172
 	memcpy ( &av.gid, ( ( void * ) bav ) + 16, 16 );
159
 
173
 
160
-	rc = arbel_post_send ( &static_ibdev, &static_ipoib_qp, &av, iobuf );
174
+	rc = arbel_post_send ( &static_ibdev,
175
+#if CREATE_OWN
176
+			       mlx->own_qp,
177
+#else
178
+			       &static_ipoib_qp,
179
+#endif
180
+			       &av, iobuf );
161
 
181
 
162
 	return rc;
182
 	return rc;
163
 }
183
 }
212
 			break;
232
 			break;
213
 		DBG ( "Posting RX buffer %p:\n", iobuf );
233
 		DBG ( "Posting RX buffer %p:\n", iobuf );
214
 		if ( ( rc = arbel_post_recv ( &static_ibdev,
234
 		if ( ( rc = arbel_post_recv ( &static_ibdev,
235
+#if CREATE_OWN
236
+					      mlx->own_qp,
237
+#else
215
 					      &static_ipoib_qp,
238
 					      &static_ipoib_qp,
239
+#endif
216
 					      iobuf ) ) != 0 ) {
240
 					      iobuf ) ) != 0 ) {
217
 			free_iob ( iobuf );
241
 			free_iob ( iobuf );
218
 			break;
242
 			break;
244
 	}
268
 	}
245
 
269
 
246
 	/* Poll completion queues */
270
 	/* Poll completion queues */
247
-	arbel_poll_cq ( &static_ibdev, &static_ipoib_send_cq,
271
+	arbel_poll_cq ( &static_ibdev,
272
+#if CREATE_OWN
273
+			mlx->own_send_cq,
274
+#else
275
+			&static_ipoib_send_cq,
276
+#endif
248
 			temp_complete_send, temp_complete_recv );
277
 			temp_complete_send, temp_complete_recv );
249
-	arbel_poll_cq ( &static_ibdev, &static_ipoib_recv_cq,
278
+	arbel_poll_cq ( &static_ibdev,
279
+#if CREATE_OWN
280
+			mlx->own_recv_cq,
281
+#else
282
+			&static_ipoib_recv_cq,
283
+#endif
250
 			temp_complete_send, temp_complete_recv );
284
 			temp_complete_send, temp_complete_recv );
251
 
285
 
252
 	mlx_refill_rx ( netdev );
286
 	mlx_refill_rx ( netdev );
406
 		     opcode_modifier, op_mod,
440
 		     opcode_modifier, op_mod,
407
 		     go, 1 );
441
 		     go, 1 );
408
 
442
 
443
+	DBG_HD ( &hcr, sizeof ( hcr ) );
444
+	if ( in_len ) {
445
+		size_t dump_len = in_len;
446
+		if ( dump_len > 256 )
447
+			dump_len = 256;
448
+		DBG ( "Input:\n" );
449
+		DBG_HD ( in, dump_len );
450
+	}
451
+
409
 	/* Issue command */
452
 	/* Issue command */
410
 	for ( i = 0 ; i < ( sizeof ( hcr ) / sizeof ( hcr.u.dwords[0] ) ) ;
453
 	for ( i = 0 ; i < ( sizeof ( hcr ) / sizeof ( hcr.u.dwords[0] ) ) ;
411
 	      i++ ) {
454
 	      i++ ) {
436
 	hcr.u.dwords[4] = readl ( arbel->config + ARBEL_HCR_REG ( 4 ) );
479
 	hcr.u.dwords[4] = readl ( arbel->config + ARBEL_HCR_REG ( 4 ) );
437
 	memcpy ( out, out_buffer, out_len );
480
 	memcpy ( out, out_buffer, out_len );
438
 
481
 
482
+	if ( out_len ) {
483
+		size_t dump_len = out_len;
484
+		if ( dump_len > 256 )
485
+			dump_len = 256;
486
+		DBG ( "Output:\n" );
487
+		DBG_HD ( out, dump_len );
488
+	}
489
+
439
 	return 0;
490
 	return 0;
440
 }
491
 }
441
 
492
 
698
 	struct arbelprm_recv_wqe *wqe;
749
 	struct arbelprm_recv_wqe *wqe;
699
 	struct arbelprm_recv_wqe *next_wqe;
750
 	struct arbelprm_recv_wqe *next_wqe;
700
 	unsigned int wqe_idx_mask;
751
 	unsigned int wqe_idx_mask;
752
+	size_t nds;
701
 	unsigned int i;
753
 	unsigned int i;
754
+	unsigned int j;
702
 
755
 
703
 	/* Allocate work queue */
756
 	/* Allocate work queue */
704
 	arbel_recv_wq->wqe_size = ( num_wqes *
757
 	arbel_recv_wq->wqe_size = ( num_wqes *
711
 
764
 
712
 	/* Link work queue entries */
765
 	/* Link work queue entries */
713
 	wqe_idx_mask = ( num_wqes - 1 );
766
 	wqe_idx_mask = ( num_wqes - 1 );
767
+	nds = ( ( offsetof ( typeof ( *wqe ), data ) +
768
+		  sizeof ( wqe->data[0] ) ) >> 4 );
714
 	for ( i = 0 ; i < num_wqes ; i++ ) {
769
 	for ( i = 0 ; i < num_wqes ; i++ ) {
715
 		wqe = &arbel_recv_wq->wqe[i].recv;
770
 		wqe = &arbel_recv_wq->wqe[i].recv;
716
 		next_wqe = &arbel_recv_wq->wqe[( i + 1 ) & wqe_idx_mask].recv;
771
 		next_wqe = &arbel_recv_wq->wqe[( i + 1 ) & wqe_idx_mask].recv;
717
 		MLX_FILL_1 ( &wqe->next, 0, nda_31_6,
772
 		MLX_FILL_1 ( &wqe->next, 0, nda_31_6,
718
 			     ( virt_to_bus ( next_wqe ) >> 6 ) );
773
 			     ( virt_to_bus ( next_wqe ) >> 6 ) );
774
+		MLX_FILL_1 ( &wqe->next, 1, nds, ( sizeof ( *wqe ) / 16 ) );
775
+		for ( j = 0 ; ( ( ( void * ) &wqe->data[j] ) <
776
+				( ( void * ) ( wqe + 1 ) ) ) ; j++ ) {
777
+			MLX_FILL_1 ( &wqe->data[j], 1,
778
+				     l_key, ARBEL_INVALID_LKEY );
779
+		}
719
 	}
780
 	}
720
 	
781
 	
721
 	return 0;
782
 	return 0;
787
 		     qpc_eec_data.msg_max, 11 /* 2^11 = 2048 */,
848
 		     qpc_eec_data.msg_max, 11 /* 2^11 = 2048 */,
788
 		     qpc_eec_data.log_rq_size, fls ( qp->recv.num_wqes - 1 ),
849
 		     qpc_eec_data.log_rq_size, fls ( qp->recv.num_wqes - 1 ),
789
 		     qpc_eec_data.log_rq_stride,
850
 		     qpc_eec_data.log_rq_stride,
790
-		     ( fls ( sizeof ( arbel_qp->send.wqe[0] ) - 1 ) - 4 ),
851
+		     ( fls ( sizeof ( arbel_qp->recv.wqe[0] ) - 1 ) - 4 ),
791
 		     qpc_eec_data.log_sq_size, fls ( qp->send.num_wqes - 1 ),
852
 		     qpc_eec_data.log_sq_size, fls ( qp->send.num_wqes - 1 ),
792
 		     qpc_eec_data.log_sq_stride,
853
 		     qpc_eec_data.log_sq_stride,
793
-		     ( fls ( sizeof ( arbel_qp->recv.wqe[0] ) - 1 ) - 4 ) );
854
+		     ( fls ( sizeof ( arbel_qp->send.wqe[0] ) - 1 ) - 4 ) );
794
 	MLX_FILL_1 ( &qpctx, 5,
855
 	MLX_FILL_1 ( &qpctx, 5,
795
 		     qpc_eec_data.usr_page, arbel->limits.reserved_uars );
856
 		     qpc_eec_data.usr_page, arbel->limits.reserved_uars );
796
 	MLX_FILL_1 ( &qpctx, 10, qpc_eec_data.primary_address_path.port_number,
857
 	MLX_FILL_1 ( &qpctx, 10, qpc_eec_data.primary_address_path.port_number,
976
 	MLX_FILL_1 ( &wqe->ud, 8, destination_qp, av->dest_qp );
1037
 	MLX_FILL_1 ( &wqe->ud, 8, destination_qp, av->dest_qp );
977
 	MLX_FILL_1 ( &wqe->ud, 9, q_key, av->qkey );
1038
 	MLX_FILL_1 ( &wqe->ud, 9, q_key, av->qkey );
978
 	MLX_FILL_1 ( &wqe->data[0], 0, byte_count, iob_len ( iobuf ) );
1039
 	MLX_FILL_1 ( &wqe->data[0], 0, byte_count, iob_len ( iobuf ) );
1040
+	MLX_FILL_1 ( &wqe->data[0], 1, l_key, arbel->reserved_lkey );
979
 	MLX_FILL_1 ( &wqe->data[0], 3,
1041
 	MLX_FILL_1 ( &wqe->data[0], 3,
980
 		     local_address_l, virt_to_bus ( iobuf->data ) );
1042
 		     local_address_l, virt_to_bus ( iobuf->data ) );
981
 
1043
 
1249
 	/* Initialise hardware */
1311
 	/* Initialise hardware */
1250
 	if ( ( rc = ib_driver_init ( pci, &qph ) ) != 0 )
1312
 	if ( ( rc = ib_driver_init ( pci, &qph ) ) != 0 )
1251
 		goto err_ipoib_init;
1313
 		goto err_ipoib_init;
1314
+#if ! CREATE_OWN
1252
 	mlx->ipoib_qph = qph;
1315
 	mlx->ipoib_qph = qph;
1253
 	mlx->bcast_av = ib_data.bcast_av;
1316
 	mlx->bcast_av = ib_data.bcast_av;
1254
 	mlx->snd_cqh = ib_data.ipoib_snd_cq;
1317
 	mlx->snd_cqh = ib_data.ipoib_snd_cq;
1256
 	mac = ( ( struct ib_mac * ) netdev->ll_addr );
1319
 	mac = ( ( struct ib_mac * ) netdev->ll_addr );
1257
 	mac->qpn = htonl ( ib_get_qpn ( mlx->ipoib_qph ) );
1320
 	mac->qpn = htonl ( ib_get_qpn ( mlx->ipoib_qph ) );
1258
 	memcpy ( &mac->gid, ib_data.port_gid.raw, sizeof ( mac->gid ) );
1321
 	memcpy ( &mac->gid, ib_data.port_gid.raw, sizeof ( mac->gid ) );
1322
+#endif
1259
 
1323
 
1260
 	/* Hack up IB structures */
1324
 	/* Hack up IB structures */
1261
 	arbel->config = memfree_pci_dev.cr_space;
1325
 	arbel->config = memfree_pci_dev.cr_space;
1265
 	arbel->db_rec = dev_ib_data.uar_context_base;
1329
 	arbel->db_rec = dev_ib_data.uar_context_base;
1266
 	arbel->reserved_lkey = dev_ib_data.mkey;
1330
 	arbel->reserved_lkey = dev_ib_data.mkey;
1267
 	arbel->eqn = dev_ib_data.eq.eqn;
1331
 	arbel->eqn = dev_ib_data.eq.eqn;
1332
+#if ! CREATE_OWN
1268
 	static_arbel_ipoib_qp.send.wqe =
1333
 	static_arbel_ipoib_qp.send.wqe =
1269
 		( ( struct udqp_st * ) qph )->snd_wq;
1334
 		( ( struct udqp_st * ) qph )->snd_wq;
1270
 	static_arbel_ipoib_qp.recv.wqe =
1335
 	static_arbel_ipoib_qp.recv.wqe =
1279
 		   &static_ipoib_send_cq.work_queues );
1344
 		   &static_ipoib_send_cq.work_queues );
1280
 	list_add ( &static_ipoib_qp.recv.list,
1345
 	list_add ( &static_ipoib_qp.recv.list,
1281
 		   &static_ipoib_recv_cq.work_queues );
1346
 		   &static_ipoib_recv_cq.work_queues );
1347
+#endif
1282
 	static_ibdev.op = &arbel_ib_operations;
1348
 	static_ibdev.op = &arbel_ib_operations;
1283
 
1349
 
1284
 	/* Get device limits */
1350
 	/* Get device limits */
1293
 	arbel->limits.reserved_qps =
1359
 	arbel->limits.reserved_qps =
1294
 		( 1 << MLX_GET ( &dev_lim, log2_rsvd_qps ) );
1360
 		( 1 << MLX_GET ( &dev_lim, log2_rsvd_qps ) );
1295
 
1361
 
1362
+#if CREATE_OWN
1363
+	struct ib_device *ibdev = &static_ibdev;
1364
+	mlx->own_send_cq = ib_create_cq ( ibdev, 32 );
1365
+	if ( ! mlx->own_send_cq ) {
1366
+		DBG ( "Could not create send CQ\n" );
1367
+		return -EIO;
1368
+	}
1369
+	mlx->own_recv_cq = ib_create_cq ( ibdev, 32 );
1370
+	if ( ! mlx->own_recv_cq ) {
1371
+		DBG ( "Could not create send CQ\n" );
1372
+		return -EIO;
1373
+	}
1374
+	mlx->own_qp = ib_create_qp ( ibdev, NUM_IPOIB_SND_WQES,
1375
+				     mlx->own_send_cq, NUM_IPOIB_RCV_WQES,
1376
+				     mlx->own_recv_cq, ipoib_qkey );
1377
+	if ( ! mlx->own_qp ) {
1378
+		DBG ( "Could not create QP\n" );
1379
+		return -EIO;
1380
+	}
1381
+	mlx->own_qp->owner_priv = netdev;
1382
+
1383
+	mac = ( ( struct ib_mac * ) netdev->ll_addr );
1384
+	mac->qpn = htonl ( mlx->own_qp->qpn );
1385
+	memcpy ( &mac->gid, ib_data.port_gid.raw, sizeof ( mac->gid ) );	
1386
+#endif
1387
+
1388
+#if 0
1296
 	DBG ( "MADS SND CQN = %#lx\n", dev_ib_data.mads_qp.snd_cq.cqn );
1389
 	DBG ( "MADS SND CQN = %#lx\n", dev_ib_data.mads_qp.snd_cq.cqn );
1297
 	struct ib_completion_queue *test_cq;
1390
 	struct ib_completion_queue *test_cq;
1298
 	test_cq = ib_create_cq ( &static_ibdev, 32 );
1391
 	test_cq = ib_create_cq ( &static_ibdev, 32 );
1299
 	if ( test_cq ) {
1392
 	if ( test_cq ) {
1300
 		DBG ( "Woot: create_cq() passed!\n" );
1393
 		DBG ( "Woot: create_cq() passed!\n" );
1301
 	}
1394
 	}
1395
+#endif
1302
 
1396
 
1303
 	/* Register network device */
1397
 	/* Register network device */
1304
 	if ( ( rc = register_netdev ( netdev ) ) != 0 )
1398
 	if ( ( rc = register_netdev ( netdev ) ) != 0 )

Loading…
Cancel
Save