浏览代码

[arbel] Improve debugging output and facilities

Improve the utility of debugging messages by including the relevant
port number, queue number (QPN, CQN, EQN), work queue entry (WQE)
number, and physical addresses wherever applicable.

Add arbel_dump_cqctx() for dumping a completion queue context and
arbel_dump_qpctx() for dumping a queue pair context.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 13 年前
父节点
当前提交
767e27e06b
共有 2 个文件被更改,包括 164 次插入71 次删除
  1. 162
    71
      src/drivers/infiniband/arbel.c
  2. 2
    0
      src/drivers/infiniband/arbel.h

+ 162
- 71
src/drivers/infiniband/arbel.c 查看文件

@@ -176,10 +176,13 @@ static int arbel_cmd ( struct arbel *arbel, unsigned long command,
176 176
 		     opcode, opcode,
177 177
 		     opcode_modifier, op_mod,
178 178
 		     go, 1 );
179
-	DBGC2_HD ( arbel, &hcr, sizeof ( hcr ) );
180
-	if ( in_len ) {
181
-		DBGC2 ( arbel, "Input:\n" );
182
-		DBGC2_HD ( arbel, in, ( ( in_len < 512 ) ? in_len : 512 ) );
179
+	DBGC ( arbel, "Arbel %p issuing command %04x\n", arbel, opcode );
180
+	DBGC2_HDA ( arbel, virt_to_phys ( arbel->config + ARBEL_HCR_BASE ),
181
+		    &hcr, sizeof ( hcr ) );
182
+	if ( in_len && ( command & ARBEL_HCR_IN_MBOX ) ) {
183
+		DBGC2 ( arbel, "Input mailbox:\n" );
184
+		DBGC2_HDA ( arbel, virt_to_phys ( in_buffer ), in_buffer,
185
+			    ( ( in_len < 512 ) ? in_len : 512 ) );
183 186
 	}
184 187
 
185 188
 	/* Issue command */
@@ -212,8 +215,10 @@ static int arbel_cmd ( struct arbel *arbel, unsigned long command,
212 215
 	hcr.u.dwords[4] = readl ( arbel->config + ARBEL_HCR_REG ( 4 ) );
213 216
 	memcpy ( out, out_buffer, out_len );
214 217
 	if ( out_len ) {
215
-		DBGC2 ( arbel, "Output:\n" );
216
-		DBGC2_HD ( arbel, out, ( ( out_len < 512 ) ? out_len : 512 ) );
218
+		DBGC2 ( arbel, "Output%s:\n",
219
+			( command & ARBEL_HCR_OUT_MBOX ) ? " mailbox" : "" );
220
+		DBGC2_HDA ( arbel, virt_to_phys ( out_buffer ), out_buffer,
221
+			    ( ( out_len < 512 ) ? out_len : 512 ) );
217 222
 	}
218 223
 
219 224
 	return 0;
@@ -322,6 +327,15 @@ arbel_cmd_hw2sw_cq ( struct arbel *arbel, unsigned long cqn,
322 327
 			   0, NULL, cqn, cqctx );
323 328
 }
324 329
 
330
+static inline int
331
+arbel_cmd_query_cq ( struct arbel *arbel, unsigned long cqn,
332
+		     struct arbelprm_completion_queue_context *cqctx ) {
333
+	return arbel_cmd ( arbel,
334
+			   ARBEL_HCR_OUT_CMD ( ARBEL_HCR_QUERY_CQ,
335
+					       1, sizeof ( *cqctx ) ),
336
+			   0, NULL, cqn, cqctx );
337
+}
338
+
325 339
 static inline int
326 340
 arbel_cmd_rst2init_qpee ( struct arbel *arbel, unsigned long qpn,
327 341
 			  const struct arbelprm_qp_ee_state_transitions *ctx ){
@@ -350,8 +364,8 @@ arbel_cmd_rtr2rts_qpee ( struct arbel *arbel, unsigned long qpn,
350 364
 }
351 365
 
352 366
 static inline int
353
-arbel_cmd_rts2rts_qp ( struct arbel *arbel, unsigned long qpn,
354
-		       const struct arbelprm_qp_ee_state_transitions *ctx ) {
367
+arbel_cmd_rts2rts_qpee ( struct arbel *arbel, unsigned long qpn,
368
+			 const struct arbelprm_qp_ee_state_transitions *ctx ) {
355 369
 	return arbel_cmd ( arbel,
356 370
 			   ARBEL_HCR_IN_CMD ( ARBEL_HCR_RTS2RTS_QPEE,
357 371
 					      1, sizeof ( *ctx ) ),
@@ -365,6 +379,15 @@ arbel_cmd_2rst_qpee ( struct arbel *arbel, unsigned long qpn ) {
365 379
 			   0x03, NULL, qpn, NULL );
366 380
 }
367 381
 
382
+static inline int
383
+arbel_cmd_query_qpee ( struct arbel *arbel, unsigned long qpn,
384
+		       struct arbelprm_qp_ee_state_transitions *ctx ) {
385
+	return arbel_cmd ( arbel,
386
+			   ARBEL_HCR_OUT_CMD ( ARBEL_HCR_QUERY_QPEE,
387
+					       1, sizeof ( *ctx ) ),
388
+			   0, NULL, qpn, ctx );
389
+}
390
+
368 391
 static inline int
369 392
 arbel_cmd_conf_special_qp ( struct arbel *arbel, unsigned int qp_type,
370 393
 			    unsigned long base_qpn ) {
@@ -520,8 +543,8 @@ static int arbel_mad ( struct ib_device *ibdev, union ib_mad *mad ) {
520 543
 	/* Issue MAD */
521 544
 	if ( ( rc = arbel_cmd_mad_ifc ( arbel, ibdev->port,
522 545
 					&mad_ifc ) ) != 0 ) {
523
-		DBGC ( arbel, "Arbel %p could not issue MAD IFC: %s\n",
524
-		       arbel, strerror ( rc ) );
546
+		DBGC ( arbel, "Arbel %p port %d could not issue MAD IFC: %s\n",
547
+		       arbel, ibdev->port, strerror ( rc ) );
525 548
 		return rc;
526 549
 	}
527 550
 
@@ -529,8 +552,8 @@ static int arbel_mad ( struct ib_device *ibdev, union ib_mad *mad ) {
529 552
 	memcpy ( mad, &mad_ifc.mad, sizeof ( *mad ) );
530 553
 
531 554
 	if ( mad->hdr.status != 0 ) {
532
-		DBGC ( arbel, "Arbel %p MAD IFC status %04x\n",
533
-		       arbel, ntohs ( mad->hdr.status ) );
555
+		DBGC ( arbel, "Arbel %p port %d MAD IFC status %04x\n",
556
+		       arbel, ibdev->port, ntohs ( mad->hdr.status ) );
534 557
 		return -EIO;
535 558
 	}
536 559
 	return 0;
@@ -543,6 +566,30 @@ static int arbel_mad ( struct ib_device *ibdev, union ib_mad *mad ) {
543 566
  ***************************************************************************
544 567
  */
545 568
 
569
+/**
570
+ * Dump completion queue context (for debugging only)
571
+ *
572
+ * @v arbel		Arbel device
573
+ * @v cq		Completion queue
574
+ * @ret rc		Return status code
575
+ */
576
+static __attribute__ (( unused )) int
577
+arbel_dump_cqctx ( struct arbel *arbel, struct ib_completion_queue *cq ) {
578
+	struct arbelprm_completion_queue_context cqctx;
579
+	int rc;
580
+
581
+	memset ( &cqctx, 0, sizeof ( cqctx ) );
582
+	if ( ( rc = arbel_cmd_query_cq ( arbel, cq->cqn, &cqctx ) ) != 0 ) {
583
+		DBGC ( arbel, "Arbel %p CQN %#lx QUERY_CQ failed: %s\n",
584
+		       arbel, cq->cqn, strerror ( rc ) );
585
+		return rc;
586
+	}
587
+	DBGC ( arbel, "Arbel %p CQN %#lx context:\n", arbel, cq->cqn );
588
+	DBGC_HDA ( arbel, 0, &cqctx, sizeof ( cqctx ) );
589
+
590
+	return 0;
591
+}
592
+
546 593
 /**
547 594
  * Create completion queue
548 595
  *
@@ -622,14 +669,15 @@ static int arbel_create_cq ( struct ib_device *ibdev,
622 669
 	MLX_FILL_1 ( &cqctx, 14,
623 670
 		     cq_state_db_record, arbel_cq->arm_doorbell_idx );
624 671
 	if ( ( rc = arbel_cmd_sw2hw_cq ( arbel, cq->cqn, &cqctx ) ) != 0 ) {
625
-		DBGC ( arbel, "Arbel %p SW2HW_CQ failed: %s\n",
626
-		       arbel, strerror ( rc ) );
672
+		DBGC ( arbel, "Arbel %p CQN %#lx SW2HW_CQ failed: %s\n",
673
+		       arbel, cq->cqn, strerror ( rc ) );
627 674
 		goto err_sw2hw_cq;
628 675
 	}
629 676
 
630
-	DBGC ( arbel, "Arbel %p CQN %#lx ring at [%p,%p)\n",
631
-	       arbel, cq->cqn, arbel_cq->cqe,
632
-	       ( ( ( void * ) arbel_cq->cqe ) + arbel_cq->cqe_size ) );
677
+	DBGC ( arbel, "Arbel %p CQN %#lx ring [%08lx,%08lx), doorbell %08lx\n",
678
+	       arbel, cq->cqn, virt_to_phys ( arbel_cq->cqe ),
679
+	       ( virt_to_phys ( arbel_cq->cqe ) + arbel_cq->cqe_size ),
680
+	       virt_to_phys ( ci_db_rec ) );
633 681
 	ib_cq_set_drvdata ( cq, arbel_cq );
634 682
 	return 0;
635 683
 
@@ -663,7 +711,7 @@ static void arbel_destroy_cq ( struct ib_device *ibdev,
663 711
 
664 712
 	/* Take ownership back from hardware */
665 713
 	if ( ( rc = arbel_cmd_hw2sw_cq ( arbel, cq->cqn, &cqctx ) ) != 0 ) {
666
-		DBGC ( arbel, "Arbel %p FATAL HW2SW_CQ failed on CQN %#lx: "
714
+		DBGC ( arbel, "Arbel %p CQN %#lx FATAL HW2SW_CQ failed: "
667 715
 		       "%s\n", arbel, cq->cqn, strerror ( rc ) );
668 716
 		/* Leak memory and return; at least we avoid corruption */
669 717
 		return;
@@ -751,6 +799,30 @@ static void arbel_free_qpn ( struct ib_device *ibdev,
751 799
 		arbel_bitmask_free ( arbel->qp_inuse, qpn_offset );
752 800
 }
753 801
 
802
+/**
803
+ * Dump queue pair context (for debugging only)
804
+ *
805
+ * @v arbel		Arbel device
806
+ * @v qp		Queue pair
807
+ * @ret rc		Return status code
808
+ */
809
+static __attribute__ (( unused )) int
810
+arbel_dump_qpctx ( struct arbel *arbel, struct ib_queue_pair *qp ) {
811
+	struct arbelprm_qp_ee_state_transitions qpctx;
812
+	int rc;
813
+
814
+	memset ( &qpctx, 0, sizeof ( qpctx ) );
815
+	if ( ( rc = arbel_cmd_query_qpee ( arbel, qp->qpn, &qpctx ) ) != 0 ) {
816
+		DBGC ( arbel, "Arbel %p QPN %#lx QUERY_QPEE failed: %s\n",
817
+		       arbel, qp->qpn, strerror ( rc ) );
818
+		return rc;
819
+	}
820
+	DBGC ( arbel, "Arbel %p QPN %#lx context:\n", arbel, qp->qpn );
821
+	DBGC_HDA ( arbel, 0, &qpctx.u.dwords[2], ( sizeof ( qpctx ) - 8 ) );
822
+
823
+	return 0;
824
+}
825
+
754 826
 /**
755 827
  * Create send work queue
756 828
  *
@@ -917,8 +989,8 @@ static int arbel_create_qp ( struct ib_device *ibdev,
917 989
 	MLX_FILL_1 ( &qpctx, 43, qpc_eec_data.rcv_db_record_index,
918 990
 		     arbel_qp->recv.doorbell_idx );
919 991
 	if ( ( rc = arbel_cmd_rst2init_qpee ( arbel, qp->qpn, &qpctx )) != 0 ){
920
-		DBGC ( arbel, "Arbel %p RST2INIT_QPEE failed: %s\n",
921
-		       arbel, strerror ( rc ) );
992
+		DBGC ( arbel, "Arbel %p QPN %#lx RST2INIT_QPEE failed: %s\n",
993
+		       arbel, qp->qpn, strerror ( rc ) );
922 994
 		goto err_rst2init_qpee;
923 995
 	}
924 996
 	memset ( &qpctx, 0, sizeof ( qpctx ) );
@@ -926,23 +998,29 @@ static int arbel_create_qp ( struct ib_device *ibdev,
926 998
 		     qpc_eec_data.mtu, ARBEL_MTU_2048,
927 999
 		     qpc_eec_data.msg_max, 11 /* 2^11 = 2048 */ );
928 1000
 	if ( ( rc = arbel_cmd_init2rtr_qpee ( arbel, qp->qpn, &qpctx )) != 0 ){
929
-		DBGC ( arbel, "Arbel %p INIT2RTR_QPEE failed: %s\n",
930
-		       arbel, strerror ( rc ) );
1001
+		DBGC ( arbel, "Arbel %p QPN %#lx INIT2RTR_QPEE failed: %s\n",
1002
+		       arbel, qp->qpn, strerror ( rc ) );
931 1003
 		goto err_init2rtr_qpee;
932 1004
 	}
933 1005
 	memset ( &qpctx, 0, sizeof ( qpctx ) );
934 1006
 	if ( ( rc = arbel_cmd_rtr2rts_qpee ( arbel, qp->qpn, &qpctx ) ) != 0 ){
935
-		DBGC ( arbel, "Arbel %p RTR2RTS_QPEE failed: %s\n",
936
-		       arbel, strerror ( rc ) );
1007
+		DBGC ( arbel, "Arbel %p QPN %#lx RTR2RTS_QPEE failed: %s\n",
1008
+		       arbel, qp->qpn, strerror ( rc ) );
937 1009
 		goto err_rtr2rts_qpee;
938 1010
 	}
939 1011
 
940
-	DBGC ( arbel, "Arbel %p QPN %#lx send ring at [%p,%p)\n",
941
-	       arbel, qp->qpn, arbel_qp->send.wqe,
942
-	       ( ( (void *) arbel_qp->send.wqe ) + arbel_qp->send.wqe_size ) );
943
-	DBGC ( arbel, "Arbel %p QPN %#lx receive ring at [%p,%p)\n",
944
-	       arbel, qp->qpn, arbel_qp->recv.wqe,
945
-	       ( ( (void *) arbel_qp->recv.wqe ) + arbel_qp->recv.wqe_size ) );
1012
+	DBGC ( arbel, "Arbel %p QPN %#lx send ring [%08lx,%08lx), doorbell "
1013
+	       "%08lx\n", arbel, qp->qpn, virt_to_phys ( arbel_qp->send.wqe ),
1014
+	       ( virt_to_phys ( arbel_qp->send.wqe ) +
1015
+		 arbel_qp->send.wqe_size ),
1016
+	       virt_to_phys ( send_db_rec ) );
1017
+	DBGC ( arbel, "Arbel %p QPN %#lx receive ring [%08lx,%08lx), doorbell "
1018
+	       "%08lx\n", arbel, qp->qpn, virt_to_phys ( arbel_qp->recv.wqe ),
1019
+	       ( virt_to_phys ( arbel_qp->recv.wqe ) +
1020
+		 arbel_qp->recv.wqe_size ),
1021
+	       virt_to_phys ( recv_db_rec ) );
1022
+	DBGC ( arbel, "Arbel %p QPN %#lx send CQN %#lx receive CQN %#lx\n",
1023
+	       arbel, qp->qpn, qp->send.cq->cqn, qp->recv.cq->cqn );
946 1024
 	ib_qp_set_drvdata ( qp, arbel_qp );
947 1025
 	return 0;
948 1026
 
@@ -976,13 +1054,13 @@ static int arbel_modify_qp ( struct ib_device *ibdev,
976 1054
 	struct arbelprm_qp_ee_state_transitions qpctx;
977 1055
 	int rc;
978 1056
 
979
-	/* Issue RTS2RTS_QP */
1057
+	/* Issue RTS2RTS_QPEE */
980 1058
 	memset ( &qpctx, 0, sizeof ( qpctx ) );
981 1059
 	MLX_FILL_1 ( &qpctx, 0, opt_param_mask, ARBEL_QPEE_OPT_PARAM_QKEY );
982 1060
 	MLX_FILL_1 ( &qpctx, 44, qpc_eec_data.q_key, qp->qkey );
983
-	if ( ( rc = arbel_cmd_rts2rts_qp ( arbel, qp->qpn, &qpctx ) ) != 0 ){
984
-		DBGC ( arbel, "Arbel %p RTS2RTS_QP failed: %s\n",
985
-		       arbel, strerror ( rc ) );
1061
+	if ( ( rc = arbel_cmd_rts2rts_qpee ( arbel, qp->qpn, &qpctx ) ) != 0 ){
1062
+		DBGC ( arbel, "Arbel %p QPN %#lx RTS2RTS_QPEE failed: %s\n",
1063
+		       arbel, qp->qpn, strerror ( rc ) );
986 1064
 		return rc;
987 1065
 	}
988 1066
 
@@ -1005,7 +1083,7 @@ static void arbel_destroy_qp ( struct ib_device *ibdev,
1005 1083
 
1006 1084
 	/* Take ownership back from hardware */
1007 1085
 	if ( ( rc = arbel_cmd_2rst_qpee ( arbel, qp->qpn ) ) != 0 ) {
1008
-		DBGC ( arbel, "Arbel %p FATAL 2RST_QPEE failed on QPN %#lx: "
1086
+		DBGC ( arbel, "Arbel %p QPN %#lx FATAL 2RST_QPEE failed: "
1009 1087
 		       "%s\n", arbel, qp->qpn, strerror ( rc ) );
1010 1088
 		/* Leak memory and return; at least we avoid corruption */
1011 1089
 		return;
@@ -1185,13 +1263,14 @@ static int arbel_post_send ( struct ib_device *ibdev,
1185 1263
 	union arbel_send_wqe *wqe;
1186 1264
 	struct arbelprm_qp_db_record *qp_db_rec;
1187 1265
 	union arbelprm_doorbell_register db_reg;
1188
-	unsigned int wqe_idx_mask;
1266
+	unsigned long wqe_idx_mask;
1189 1267
 	size_t nds;
1190 1268
 
1191 1269
 	/* Allocate work queue entry */
1192 1270
 	wqe_idx_mask = ( wq->num_wqes - 1 );
1193 1271
 	if ( wq->iobufs[wq->next_idx & wqe_idx_mask] ) {
1194
-		DBGC ( arbel, "Arbel %p send queue full", arbel );
1272
+		DBGC ( arbel, "Arbel %p QPN %#lx send queue full",
1273
+		       arbel, qp->qpn );
1195 1274
 		return -ENOBUFS;
1196 1275
 	}
1197 1276
 	wq->iobufs[wq->next_idx & wqe_idx_mask] = iobuf;
@@ -1205,6 +1284,9 @@ static int arbel_post_send ( struct ib_device *ibdev,
1205 1284
 			      sizeof ( arbel_fill_send_wqe[0] ) ) );
1206 1285
 	assert ( arbel_fill_send_wqe[qp->type] != NULL );
1207 1286
 	nds = arbel_fill_send_wqe[qp->type] ( ibdev, qp, av, iobuf, wqe );
1287
+	DBGCP ( arbel, "Arbel %p QPN %#lx posting send WQE %#lx:\n",
1288
+		arbel, qp->qpn, ( wq->next_idx & wqe_idx_mask ) );
1289
+	DBGCP_HDA ( arbel, virt_to_phys ( wqe ), wqe, sizeof ( *wqe ) );
1208 1290
 
1209 1291
 	/* Update previous work queue entry's "next" field */
1210 1292
 	MLX_SET ( &prev_wqe->next, nopcode, ARBEL_OPCODE_SEND );
@@ -1258,7 +1340,8 @@ static int arbel_post_recv ( struct ib_device *ibdev,
1258 1340
 	/* Allocate work queue entry */
1259 1341
 	wqe_idx_mask = ( wq->num_wqes - 1 );
1260 1342
 	if ( wq->iobufs[wq->next_idx & wqe_idx_mask] ) {
1261
-		DBGC ( arbel, "Arbel %p receive queue full", arbel );
1343
+		DBGC ( arbel, "Arbel %p QPN %#lx receive queue full\n",
1344
+		       arbel, qp->qpn );
1262 1345
 		return -ENOBUFS;
1263 1346
 	}
1264 1347
 	wq->iobufs[wq->next_idx & wqe_idx_mask] = iobuf;
@@ -1307,7 +1390,7 @@ static int arbel_complete ( struct ib_device *ibdev,
1307 1390
 	unsigned long qpn;
1308 1391
 	int is_send;
1309 1392
 	unsigned long wqe_adr;
1310
-	unsigned int wqe_idx;
1393
+	unsigned long wqe_idx;
1311 1394
 	size_t len;
1312 1395
 	int rc = 0;
1313 1396
 
@@ -1319,7 +1402,7 @@ static int arbel_complete ( struct ib_device *ibdev,
1319 1402
 	if ( opcode >= ARBEL_OPCODE_RECV_ERROR ) {
1320 1403
 		/* "s" field is not valid for error opcodes */
1321 1404
 		is_send = ( opcode == ARBEL_OPCODE_SEND_ERROR );
1322
-		DBGC ( arbel, "Arbel %p CPN %lx syndrome %x vendor %x\n",
1405
+		DBGC ( arbel, "Arbel %p CQN %#lx syndrome %x vendor %x\n",
1323 1406
 		       arbel, cq->cqn, MLX_GET ( &cqe->error, syndrome ),
1324 1407
 		       MLX_GET ( &cqe->error, vendor_code ) );
1325 1408
 		rc = -EIO;
@@ -1329,7 +1412,7 @@ static int arbel_complete ( struct ib_device *ibdev,
1329 1412
 	/* Identify work queue */
1330 1413
 	wq = ib_find_wq ( cq, qpn, is_send );
1331 1414
 	if ( ! wq ) {
1332
-		DBGC ( arbel, "Arbel %p CQN %lx unknown %s QPN %lx\n",
1415
+		DBGC ( arbel, "Arbel %p CQN %#lx unknown %s QPN %#lx\n",
1333 1416
 		       arbel, cq->cqn, ( is_send ? "send" : "recv" ), qpn );
1334 1417
 		return -EIO;
1335 1418
 	}
@@ -1348,12 +1431,17 @@ static int arbel_complete ( struct ib_device *ibdev,
1348 1431
 			    sizeof ( arbel_recv_wq->wqe[0] ) );
1349 1432
 		assert ( wqe_idx < qp->recv.num_wqes );
1350 1433
 	}
1434
+	DBGCP ( arbel, "Arbel %p CQN %#lx QPN %#lx %s WQE %#lx completed:\n",
1435
+		arbel, cq->cqn, qp->qpn, ( is_send ? "send" : "recv" ),
1436
+		wqe_idx );
1437
+	DBGCP_HDA ( arbel, virt_to_phys ( cqe ), cqe, sizeof ( *cqe ) );
1351 1438
 
1352 1439
 	/* Identify I/O buffer */
1353 1440
 	iobuf = wq->iobufs[wqe_idx];
1354 1441
 	if ( ! iobuf ) {
1355
-		DBGC ( arbel, "Arbel %p CQN %lx QPN %lx empty WQE %x\n",
1356
-		       arbel, cq->cqn, qp->qpn, wqe_idx );
1442
+		DBGC ( arbel, "Arbel %p CQN %#lx QPN %#lx empty %s WQE %#lx\n",
1443
+		       arbel, cq->cqn, qp->qpn, ( is_send ? "send" : "recv" ),
1444
+		       wqe_idx );
1357 1445
 		return -EIO;
1358 1446
 	}
1359 1447
 	wq->iobufs[wqe_idx] = NULL;
@@ -1417,8 +1505,8 @@ static void arbel_poll_cq ( struct ib_device *ibdev,
1417 1505
 
1418 1506
 		/* Handle completion */
1419 1507
 		if ( ( rc = arbel_complete ( ibdev, cq, cqe ) ) != 0 ) {
1420
-			DBGC ( arbel, "Arbel %p failed to complete: %s\n",
1421
-			       arbel, strerror ( rc ) );
1508
+			DBGC ( arbel, "Arbel %p CQN %#lx failed to complete: "
1509
+			       "%s\n", arbel, cq->cqn, strerror ( rc ) );
1422 1510
 			DBGC_HD ( arbel, cqe, sizeof ( *cqe ) );
1423 1511
 		}
1424 1512
 
@@ -1486,8 +1574,8 @@ static int arbel_create_eq ( struct arbel *arbel ) {
1486 1574
 	MLX_FILL_1 ( &eqctx, 7, lkey, arbel->reserved_lkey );
1487 1575
 	if ( ( rc = arbel_cmd_sw2hw_eq ( arbel, arbel_eq->eqn,
1488 1576
 					 &eqctx ) ) != 0 ) {
1489
-		DBGC ( arbel, "Arbel %p SW2HW_EQ failed: %s\n",
1490
-		       arbel, strerror ( rc ) );
1577
+		DBGC ( arbel, "Arbel %p EQN %#lx SW2HW_EQ failed: %s\n",
1578
+		       arbel, arbel_eq->eqn, strerror ( rc ) );
1491 1579
 		goto err_sw2hw_eq;
1492 1580
 	}
1493 1581
 
@@ -1496,14 +1584,15 @@ static int arbel_create_eq ( struct arbel *arbel ) {
1496 1584
 	if ( ( rc = arbel_cmd_map_eq ( arbel,
1497 1585
 				       ( ARBEL_MAP_EQ | arbel_eq->eqn ),
1498 1586
 				       &mask ) ) != 0 ) {
1499
-		DBGC ( arbel, "Arbel %p MAP_EQ failed: %s\n",
1500
-		       arbel, strerror ( rc )  );
1587
+		DBGC ( arbel, "Arbel %p EQN %#lx MAP_EQ failed: %s\n",
1588
+		       arbel, arbel_eq->eqn, strerror ( rc )  );
1501 1589
 		goto err_map_eq;
1502 1590
 	}
1503 1591
 
1504
-	DBGC ( arbel, "Arbel %p EQN %#lx ring at [%p,%p])\n",
1505
-	       arbel, arbel_eq->eqn, arbel_eq->eqe,
1506
-	       ( ( ( void * ) arbel_eq->eqe ) + arbel_eq->eqe_size ) );
1592
+	DBGC ( arbel, "Arbel %p EQN %#lx ring [%08lx,%08lx), doorbell %08lx\n",
1593
+	       arbel, arbel_eq->eqn, virt_to_phys ( arbel_eq->eqe ),
1594
+	       ( virt_to_phys ( arbel_eq->eqe ) + arbel_eq->eqe_size ),
1595
+	       virt_to_phys ( arbel_eq->doorbell ) );
1507 1596
 	return 0;
1508 1597
 
1509 1598
  err_map_eq:
@@ -1532,16 +1621,16 @@ static void arbel_destroy_eq ( struct arbel *arbel ) {
1532 1621
 	if ( ( rc = arbel_cmd_map_eq ( arbel,
1533 1622
 				       ( ARBEL_UNMAP_EQ | arbel_eq->eqn ),
1534 1623
 				       &mask ) ) != 0 ) {
1535
-		DBGC ( arbel, "Arbel %p FATAL MAP_EQ failed to unmap: %s\n",
1536
-		       arbel, strerror ( rc ) );
1624
+		DBGC ( arbel, "Arbel %p EQN %#lx FATAL MAP_EQ failed to "
1625
+		       "unmap: %s\n", arbel, arbel_eq->eqn, strerror ( rc ) );
1537 1626
 		/* Continue; HCA may die but system should survive */
1538 1627
 	}
1539 1628
 
1540 1629
 	/* Take ownership back from hardware */
1541 1630
 	if ( ( rc = arbel_cmd_hw2sw_eq ( arbel, arbel_eq->eqn,
1542 1631
 					 &eqctx ) ) != 0 ) {
1543
-		DBGC ( arbel, "Arbel %p FATAL HW2SW_EQ failed: %s\n",
1544
-		       arbel, strerror ( rc ) );
1632
+		DBGC ( arbel, "Arbel %p EQN %#lx FATAL HW2SW_EQ failed: %s\n",
1633
+		       arbel, arbel_eq->eqn, strerror ( rc ) );
1545 1634
 		/* Leak memory and return; at least we avoid corruption */
1546 1635
 		return;
1547 1636
 	}
@@ -1609,8 +1698,10 @@ static void arbel_poll_eq ( struct ib_device *ibdev ) {
1609 1698
 			/* Entry still owned by hardware; end of poll */
1610 1699
 			break;
1611 1700
 		}
1612
-		DBGCP ( arbel, "Arbel %p event:\n", arbel );
1613
-		DBGCP_HD ( arbel, eqe, sizeof ( *eqe ) );
1701
+		DBGCP ( arbel, "Arbel %p EQN %#lx event:\n",
1702
+			arbel, arbel_eq->eqn );
1703
+		DBGCP_HDA ( arbel, virt_to_phys ( eqe ),
1704
+			    eqe, sizeof ( *eqe ) );
1614 1705
 
1615 1706
 		/* Handle event */
1616 1707
 		event_type = MLX_GET ( &eqe->generic, event_type );
@@ -1619,9 +1710,11 @@ static void arbel_poll_eq ( struct ib_device *ibdev ) {
1619 1710
 			arbel_event_port_state_change ( arbel, eqe );
1620 1711
 			break;
1621 1712
 		default:
1622
-			DBGC ( arbel, "Arbel %p unrecognised event type "
1623
-			       "%#x:\n", arbel, event_type );
1624
-			DBGC_HD ( arbel, eqe, sizeof ( *eqe ) );
1713
+			DBGC ( arbel, "Arbel %p EQN %#lx unrecognised event "
1714
+			       "type %#x:\n",
1715
+			       arbel, arbel_eq->eqn, event_type );
1716
+			DBGC_HDA ( arbel, virt_to_phys ( eqe ),
1717
+				   eqe, sizeof ( *eqe ) );
1625 1718
 			break;
1626 1719
 		}
1627 1720
 
@@ -1634,9 +1727,6 @@ static void arbel_poll_eq ( struct ib_device *ibdev ) {
1634 1727
 
1635 1728
 		/* Ring doorbell */
1636 1729
 		MLX_FILL_1 ( &db_reg.ci, 0, ci, arbel_eq->next_idx );
1637
-		DBGCP ( arbel, "Ringing doorbell %08lx with %08x\n",
1638
-			virt_to_phys ( arbel_eq->doorbell ),
1639
-			db_reg.dword[0] );
1640 1730
 		writel ( db_reg.dword[0], arbel_eq->doorbell );
1641 1731
 	}
1642 1732
 }
@@ -1668,8 +1758,8 @@ static int arbel_open ( struct ib_device *ibdev ) {
1668 1758
 	MLX_FILL_1 ( &init_ib, 2, max_pkey, 64 );
1669 1759
 	if ( ( rc = arbel_cmd_init_ib ( arbel, ibdev->port,
1670 1760
 					&init_ib ) ) != 0 ) {
1671
-		DBGC ( arbel, "Arbel %p could not intialise IB: %s\n",
1672
-		       arbel, strerror ( rc ) );
1761
+		DBGC ( arbel, "Arbel %p port %d could not intialise IB: %s\n",
1762
+		       arbel, ibdev->port, strerror ( rc ) );
1673 1763
 		return rc;
1674 1764
 	}
1675 1765
 
@@ -1689,8 +1779,8 @@ static void arbel_close ( struct ib_device *ibdev ) {
1689 1779
 	int rc;
1690 1780
 
1691 1781
 	if ( ( rc = arbel_cmd_close_ib ( arbel, ibdev->port ) ) != 0 ) {
1692
-		DBGC ( arbel, "Arbel %p could not close IB: %s\n",
1693
-		       arbel, strerror ( rc ) );
1782
+		DBGC ( arbel, "Arbel %p port %d could not close IB: %s\n",
1783
+		       arbel, ibdev->port, strerror ( rc ) );
1694 1784
 		/* Nothing we can do about this */
1695 1785
 	}
1696 1786
 }
@@ -1887,7 +1977,7 @@ static int arbel_start_firmware ( struct arbel *arbel ) {
1887 1977
 	}
1888 1978
 	fw_base = ( user_to_phys ( arbel->firmware_area, fw_size ) &
1889 1979
 		    ~( fw_size - 1 ) );
1890
-	DBGC ( arbel, "Arbel %p firmware area at physical [%lx,%lx)\n",
1980
+	DBGC ( arbel, "Arbel %p firmware area at [%08lx,%08lx)\n",
1891 1981
 	       arbel, fw_base, ( fw_base + fw_size ) );
1892 1982
 	memset ( &map_fa, 0, sizeof ( map_fa ) );
1893 1983
 	MLX_FILL_2 ( &map_fa, 3,
@@ -2387,8 +2477,9 @@ static int arbel_probe ( struct pci_device *pci,
2387 2477
 	/* Register Infiniband devices */
2388 2478
 	for ( i = 0 ; i < ARBEL_NUM_PORTS ; i++ ) {
2389 2479
 		if ( ( rc = register_ibdev ( arbel->ibdev[i] ) ) != 0 ) {
2390
-			DBGC ( arbel, "Arbel %p could not register IB "
2391
-			       "device: %s\n", arbel, strerror ( rc ) );
2480
+			DBGC ( arbel, "Arbel %p port %d could not register IB "
2481
+			       "device: %s\n", arbel,
2482
+			       arbel->ibdev[i]->port, strerror ( rc ) );
2392 2483
 			goto err_register_ibdev;
2393 2484
 		}
2394 2485
 	}

+ 2
- 0
src/drivers/infiniband/arbel.h 查看文件

@@ -57,11 +57,13 @@ FILE_LICENCE ( GPL2_OR_LATER );
57 57
 #define ARBEL_HCR_HW2SW_EQ		0x0014
58 58
 #define ARBEL_HCR_SW2HW_CQ		0x0016
59 59
 #define ARBEL_HCR_HW2SW_CQ		0x0017
60
+#define ARBEL_HCR_QUERY_CQ		0x0018
60 61
 #define ARBEL_HCR_RST2INIT_QPEE		0x0019
61 62
 #define ARBEL_HCR_INIT2RTR_QPEE		0x001a
62 63
 #define ARBEL_HCR_RTR2RTS_QPEE		0x001b
63 64
 #define ARBEL_HCR_RTS2RTS_QPEE		0x001c
64 65
 #define ARBEL_HCR_2RST_QPEE		0x0021
66
+#define ARBEL_HCR_QUERY_QPEE		0x0022
65 67
 #define ARBEL_HCR_CONF_SPECIAL_QP	0x0023
66 68
 #define ARBEL_HCR_MAD_IFC		0x0024
67 69
 #define ARBEL_HCR_READ_MGM		0x0025

正在加载...
取消
保存