ソースを参照

[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 14年前
コミット
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
 		     opcode, opcode,
176
 		     opcode, opcode,
177
 		     opcode_modifier, op_mod,
177
 		     opcode_modifier, op_mod,
178
 		     go, 1 );
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
 	/* Issue command */
188
 	/* Issue command */
212
 	hcr.u.dwords[4] = readl ( arbel->config + ARBEL_HCR_REG ( 4 ) );
215
 	hcr.u.dwords[4] = readl ( arbel->config + ARBEL_HCR_REG ( 4 ) );
213
 	memcpy ( out, out_buffer, out_len );
216
 	memcpy ( out, out_buffer, out_len );
214
 	if ( out_len ) {
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
 	return 0;
224
 	return 0;
322
 			   0, NULL, cqn, cqctx );
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
 static inline int
339
 static inline int
326
 arbel_cmd_rst2init_qpee ( struct arbel *arbel, unsigned long qpn,
340
 arbel_cmd_rst2init_qpee ( struct arbel *arbel, unsigned long qpn,
327
 			  const struct arbelprm_qp_ee_state_transitions *ctx ){
341
 			  const struct arbelprm_qp_ee_state_transitions *ctx ){
350
 }
364
 }
351
 
365
 
352
 static inline int
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
 	return arbel_cmd ( arbel,
369
 	return arbel_cmd ( arbel,
356
 			   ARBEL_HCR_IN_CMD ( ARBEL_HCR_RTS2RTS_QPEE,
370
 			   ARBEL_HCR_IN_CMD ( ARBEL_HCR_RTS2RTS_QPEE,
357
 					      1, sizeof ( *ctx ) ),
371
 					      1, sizeof ( *ctx ) ),
365
 			   0x03, NULL, qpn, NULL );
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
 static inline int
391
 static inline int
369
 arbel_cmd_conf_special_qp ( struct arbel *arbel, unsigned int qp_type,
392
 arbel_cmd_conf_special_qp ( struct arbel *arbel, unsigned int qp_type,
370
 			    unsigned long base_qpn ) {
393
 			    unsigned long base_qpn ) {
520
 	/* Issue MAD */
543
 	/* Issue MAD */
521
 	if ( ( rc = arbel_cmd_mad_ifc ( arbel, ibdev->port,
544
 	if ( ( rc = arbel_cmd_mad_ifc ( arbel, ibdev->port,
522
 					&mad_ifc ) ) != 0 ) {
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
 		return rc;
548
 		return rc;
526
 	}
549
 	}
527
 
550
 
529
 	memcpy ( mad, &mad_ifc.mad, sizeof ( *mad ) );
552
 	memcpy ( mad, &mad_ifc.mad, sizeof ( *mad ) );
530
 
553
 
531
 	if ( mad->hdr.status != 0 ) {
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
 		return -EIO;
557
 		return -EIO;
535
 	}
558
 	}
536
 	return 0;
559
 	return 0;
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
  * Create completion queue
594
  * Create completion queue
548
  *
595
  *
622
 	MLX_FILL_1 ( &cqctx, 14,
669
 	MLX_FILL_1 ( &cqctx, 14,
623
 		     cq_state_db_record, arbel_cq->arm_doorbell_idx );
670
 		     cq_state_db_record, arbel_cq->arm_doorbell_idx );
624
 	if ( ( rc = arbel_cmd_sw2hw_cq ( arbel, cq->cqn, &cqctx ) ) != 0 ) {
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
 		goto err_sw2hw_cq;
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
 	ib_cq_set_drvdata ( cq, arbel_cq );
681
 	ib_cq_set_drvdata ( cq, arbel_cq );
634
 	return 0;
682
 	return 0;
635
 
683
 
663
 
711
 
664
 	/* Take ownership back from hardware */
712
 	/* Take ownership back from hardware */
665
 	if ( ( rc = arbel_cmd_hw2sw_cq ( arbel, cq->cqn, &cqctx ) ) != 0 ) {
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
 		       "%s\n", arbel, cq->cqn, strerror ( rc ) );
715
 		       "%s\n", arbel, cq->cqn, strerror ( rc ) );
668
 		/* Leak memory and return; at least we avoid corruption */
716
 		/* Leak memory and return; at least we avoid corruption */
669
 		return;
717
 		return;
751
 		arbel_bitmask_free ( arbel->qp_inuse, qpn_offset );
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
  * Create send work queue
827
  * Create send work queue
756
  *
828
  *
917
 	MLX_FILL_1 ( &qpctx, 43, qpc_eec_data.rcv_db_record_index,
989
 	MLX_FILL_1 ( &qpctx, 43, qpc_eec_data.rcv_db_record_index,
918
 		     arbel_qp->recv.doorbell_idx );
990
 		     arbel_qp->recv.doorbell_idx );
919
 	if ( ( rc = arbel_cmd_rst2init_qpee ( arbel, qp->qpn, &qpctx )) != 0 ){
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
 		goto err_rst2init_qpee;
994
 		goto err_rst2init_qpee;
923
 	}
995
 	}
924
 	memset ( &qpctx, 0, sizeof ( qpctx ) );
996
 	memset ( &qpctx, 0, sizeof ( qpctx ) );
926
 		     qpc_eec_data.mtu, ARBEL_MTU_2048,
998
 		     qpc_eec_data.mtu, ARBEL_MTU_2048,
927
 		     qpc_eec_data.msg_max, 11 /* 2^11 = 2048 */ );
999
 		     qpc_eec_data.msg_max, 11 /* 2^11 = 2048 */ );
928
 	if ( ( rc = arbel_cmd_init2rtr_qpee ( arbel, qp->qpn, &qpctx )) != 0 ){
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
 		goto err_init2rtr_qpee;
1003
 		goto err_init2rtr_qpee;
932
 	}
1004
 	}
933
 	memset ( &qpctx, 0, sizeof ( qpctx ) );
1005
 	memset ( &qpctx, 0, sizeof ( qpctx ) );
934
 	if ( ( rc = arbel_cmd_rtr2rts_qpee ( arbel, qp->qpn, &qpctx ) ) != 0 ){
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
 		goto err_rtr2rts_qpee;
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
 	ib_qp_set_drvdata ( qp, arbel_qp );
1024
 	ib_qp_set_drvdata ( qp, arbel_qp );
947
 	return 0;
1025
 	return 0;
948
 
1026
 
976
 	struct arbelprm_qp_ee_state_transitions qpctx;
1054
 	struct arbelprm_qp_ee_state_transitions qpctx;
977
 	int rc;
1055
 	int rc;
978
 
1056
 
979
-	/* Issue RTS2RTS_QP */
1057
+	/* Issue RTS2RTS_QPEE */
980
 	memset ( &qpctx, 0, sizeof ( qpctx ) );
1058
 	memset ( &qpctx, 0, sizeof ( qpctx ) );
981
 	MLX_FILL_1 ( &qpctx, 0, opt_param_mask, ARBEL_QPEE_OPT_PARAM_QKEY );
1059
 	MLX_FILL_1 ( &qpctx, 0, opt_param_mask, ARBEL_QPEE_OPT_PARAM_QKEY );
982
 	MLX_FILL_1 ( &qpctx, 44, qpc_eec_data.q_key, qp->qkey );
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
 		return rc;
1064
 		return rc;
987
 	}
1065
 	}
988
 
1066
 
1005
 
1083
 
1006
 	/* Take ownership back from hardware */
1084
 	/* Take ownership back from hardware */
1007
 	if ( ( rc = arbel_cmd_2rst_qpee ( arbel, qp->qpn ) ) != 0 ) {
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
 		       "%s\n", arbel, qp->qpn, strerror ( rc ) );
1087
 		       "%s\n", arbel, qp->qpn, strerror ( rc ) );
1010
 		/* Leak memory and return; at least we avoid corruption */
1088
 		/* Leak memory and return; at least we avoid corruption */
1011
 		return;
1089
 		return;
1185
 	union arbel_send_wqe *wqe;
1263
 	union arbel_send_wqe *wqe;
1186
 	struct arbelprm_qp_db_record *qp_db_rec;
1264
 	struct arbelprm_qp_db_record *qp_db_rec;
1187
 	union arbelprm_doorbell_register db_reg;
1265
 	union arbelprm_doorbell_register db_reg;
1188
-	unsigned int wqe_idx_mask;
1266
+	unsigned long wqe_idx_mask;
1189
 	size_t nds;
1267
 	size_t nds;
1190
 
1268
 
1191
 	/* Allocate work queue entry */
1269
 	/* Allocate work queue entry */
1192
 	wqe_idx_mask = ( wq->num_wqes - 1 );
1270
 	wqe_idx_mask = ( wq->num_wqes - 1 );
1193
 	if ( wq->iobufs[wq->next_idx & wqe_idx_mask] ) {
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
 		return -ENOBUFS;
1274
 		return -ENOBUFS;
1196
 	}
1275
 	}
1197
 	wq->iobufs[wq->next_idx & wqe_idx_mask] = iobuf;
1276
 	wq->iobufs[wq->next_idx & wqe_idx_mask] = iobuf;
1205
 			      sizeof ( arbel_fill_send_wqe[0] ) ) );
1284
 			      sizeof ( arbel_fill_send_wqe[0] ) ) );
1206
 	assert ( arbel_fill_send_wqe[qp->type] != NULL );
1285
 	assert ( arbel_fill_send_wqe[qp->type] != NULL );
1207
 	nds = arbel_fill_send_wqe[qp->type] ( ibdev, qp, av, iobuf, wqe );
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
 	/* Update previous work queue entry's "next" field */
1291
 	/* Update previous work queue entry's "next" field */
1210
 	MLX_SET ( &prev_wqe->next, nopcode, ARBEL_OPCODE_SEND );
1292
 	MLX_SET ( &prev_wqe->next, nopcode, ARBEL_OPCODE_SEND );
1258
 	/* Allocate work queue entry */
1340
 	/* Allocate work queue entry */
1259
 	wqe_idx_mask = ( wq->num_wqes - 1 );
1341
 	wqe_idx_mask = ( wq->num_wqes - 1 );
1260
 	if ( wq->iobufs[wq->next_idx & wqe_idx_mask] ) {
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
 		return -ENOBUFS;
1345
 		return -ENOBUFS;
1263
 	}
1346
 	}
1264
 	wq->iobufs[wq->next_idx & wqe_idx_mask] = iobuf;
1347
 	wq->iobufs[wq->next_idx & wqe_idx_mask] = iobuf;
1307
 	unsigned long qpn;
1390
 	unsigned long qpn;
1308
 	int is_send;
1391
 	int is_send;
1309
 	unsigned long wqe_adr;
1392
 	unsigned long wqe_adr;
1310
-	unsigned int wqe_idx;
1393
+	unsigned long wqe_idx;
1311
 	size_t len;
1394
 	size_t len;
1312
 	int rc = 0;
1395
 	int rc = 0;
1313
 
1396
 
1319
 	if ( opcode >= ARBEL_OPCODE_RECV_ERROR ) {
1402
 	if ( opcode >= ARBEL_OPCODE_RECV_ERROR ) {
1320
 		/* "s" field is not valid for error opcodes */
1403
 		/* "s" field is not valid for error opcodes */
1321
 		is_send = ( opcode == ARBEL_OPCODE_SEND_ERROR );
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
 		       arbel, cq->cqn, MLX_GET ( &cqe->error, syndrome ),
1406
 		       arbel, cq->cqn, MLX_GET ( &cqe->error, syndrome ),
1324
 		       MLX_GET ( &cqe->error, vendor_code ) );
1407
 		       MLX_GET ( &cqe->error, vendor_code ) );
1325
 		rc = -EIO;
1408
 		rc = -EIO;
1329
 	/* Identify work queue */
1412
 	/* Identify work queue */
1330
 	wq = ib_find_wq ( cq, qpn, is_send );
1413
 	wq = ib_find_wq ( cq, qpn, is_send );
1331
 	if ( ! wq ) {
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
 		       arbel, cq->cqn, ( is_send ? "send" : "recv" ), qpn );
1416
 		       arbel, cq->cqn, ( is_send ? "send" : "recv" ), qpn );
1334
 		return -EIO;
1417
 		return -EIO;
1335
 	}
1418
 	}
1348
 			    sizeof ( arbel_recv_wq->wqe[0] ) );
1431
 			    sizeof ( arbel_recv_wq->wqe[0] ) );
1349
 		assert ( wqe_idx < qp->recv.num_wqes );
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
 	/* Identify I/O buffer */
1439
 	/* Identify I/O buffer */
1353
 	iobuf = wq->iobufs[wqe_idx];
1440
 	iobuf = wq->iobufs[wqe_idx];
1354
 	if ( ! iobuf ) {
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
 		return -EIO;
1445
 		return -EIO;
1358
 	}
1446
 	}
1359
 	wq->iobufs[wqe_idx] = NULL;
1447
 	wq->iobufs[wqe_idx] = NULL;
1417
 
1505
 
1418
 		/* Handle completion */
1506
 		/* Handle completion */
1419
 		if ( ( rc = arbel_complete ( ibdev, cq, cqe ) ) != 0 ) {
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
 			DBGC_HD ( arbel, cqe, sizeof ( *cqe ) );
1510
 			DBGC_HD ( arbel, cqe, sizeof ( *cqe ) );
1423
 		}
1511
 		}
1424
 
1512
 
1486
 	MLX_FILL_1 ( &eqctx, 7, lkey, arbel->reserved_lkey );
1574
 	MLX_FILL_1 ( &eqctx, 7, lkey, arbel->reserved_lkey );
1487
 	if ( ( rc = arbel_cmd_sw2hw_eq ( arbel, arbel_eq->eqn,
1575
 	if ( ( rc = arbel_cmd_sw2hw_eq ( arbel, arbel_eq->eqn,
1488
 					 &eqctx ) ) != 0 ) {
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
 		goto err_sw2hw_eq;
1579
 		goto err_sw2hw_eq;
1492
 	}
1580
 	}
1493
 
1581
 
1496
 	if ( ( rc = arbel_cmd_map_eq ( arbel,
1584
 	if ( ( rc = arbel_cmd_map_eq ( arbel,
1497
 				       ( ARBEL_MAP_EQ | arbel_eq->eqn ),
1585
 				       ( ARBEL_MAP_EQ | arbel_eq->eqn ),
1498
 				       &mask ) ) != 0 ) {
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
 		goto err_map_eq;
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
 	return 0;
1596
 	return 0;
1508
 
1597
 
1509
  err_map_eq:
1598
  err_map_eq:
1532
 	if ( ( rc = arbel_cmd_map_eq ( arbel,
1621
 	if ( ( rc = arbel_cmd_map_eq ( arbel,
1533
 				       ( ARBEL_UNMAP_EQ | arbel_eq->eqn ),
1622
 				       ( ARBEL_UNMAP_EQ | arbel_eq->eqn ),
1534
 				       &mask ) ) != 0 ) {
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
 		/* Continue; HCA may die but system should survive */
1626
 		/* Continue; HCA may die but system should survive */
1538
 	}
1627
 	}
1539
 
1628
 
1540
 	/* Take ownership back from hardware */
1629
 	/* Take ownership back from hardware */
1541
 	if ( ( rc = arbel_cmd_hw2sw_eq ( arbel, arbel_eq->eqn,
1630
 	if ( ( rc = arbel_cmd_hw2sw_eq ( arbel, arbel_eq->eqn,
1542
 					 &eqctx ) ) != 0 ) {
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
 		/* Leak memory and return; at least we avoid corruption */
1634
 		/* Leak memory and return; at least we avoid corruption */
1546
 		return;
1635
 		return;
1547
 	}
1636
 	}
1609
 			/* Entry still owned by hardware; end of poll */
1698
 			/* Entry still owned by hardware; end of poll */
1610
 			break;
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
 		/* Handle event */
1706
 		/* Handle event */
1616
 		event_type = MLX_GET ( &eqe->generic, event_type );
1707
 		event_type = MLX_GET ( &eqe->generic, event_type );
1619
 			arbel_event_port_state_change ( arbel, eqe );
1710
 			arbel_event_port_state_change ( arbel, eqe );
1620
 			break;
1711
 			break;
1621
 		default:
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
 			break;
1718
 			break;
1626
 		}
1719
 		}
1627
 
1720
 
1634
 
1727
 
1635
 		/* Ring doorbell */
1728
 		/* Ring doorbell */
1636
 		MLX_FILL_1 ( &db_reg.ci, 0, ci, arbel_eq->next_idx );
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
 		writel ( db_reg.dword[0], arbel_eq->doorbell );
1730
 		writel ( db_reg.dword[0], arbel_eq->doorbell );
1641
 	}
1731
 	}
1642
 }
1732
 }
1668
 	MLX_FILL_1 ( &init_ib, 2, max_pkey, 64 );
1758
 	MLX_FILL_1 ( &init_ib, 2, max_pkey, 64 );
1669
 	if ( ( rc = arbel_cmd_init_ib ( arbel, ibdev->port,
1759
 	if ( ( rc = arbel_cmd_init_ib ( arbel, ibdev->port,
1670
 					&init_ib ) ) != 0 ) {
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
 		return rc;
1763
 		return rc;
1674
 	}
1764
 	}
1675
 
1765
 
1689
 	int rc;
1779
 	int rc;
1690
 
1780
 
1691
 	if ( ( rc = arbel_cmd_close_ib ( arbel, ibdev->port ) ) != 0 ) {
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
 		/* Nothing we can do about this */
1784
 		/* Nothing we can do about this */
1695
 	}
1785
 	}
1696
 }
1786
 }
1887
 	}
1977
 	}
1888
 	fw_base = ( user_to_phys ( arbel->firmware_area, fw_size ) &
1978
 	fw_base = ( user_to_phys ( arbel->firmware_area, fw_size ) &
1889
 		    ~( fw_size - 1 ) );
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
 	       arbel, fw_base, ( fw_base + fw_size ) );
1981
 	       arbel, fw_base, ( fw_base + fw_size ) );
1892
 	memset ( &map_fa, 0, sizeof ( map_fa ) );
1982
 	memset ( &map_fa, 0, sizeof ( map_fa ) );
1893
 	MLX_FILL_2 ( &map_fa, 3,
1983
 	MLX_FILL_2 ( &map_fa, 3,
2387
 	/* Register Infiniband devices */
2477
 	/* Register Infiniband devices */
2388
 	for ( i = 0 ; i < ARBEL_NUM_PORTS ; i++ ) {
2478
 	for ( i = 0 ; i < ARBEL_NUM_PORTS ; i++ ) {
2389
 		if ( ( rc = register_ibdev ( arbel->ibdev[i] ) ) != 0 ) {
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
 			goto err_register_ibdev;
2483
 			goto err_register_ibdev;
2393
 		}
2484
 		}
2394
 	}
2485
 	}

+ 2
- 0
src/drivers/infiniband/arbel.h ファイルの表示

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

読み込み中…
キャンセル
保存