|
@@ -369,13 +369,22 @@ hermon_cmd_sw2hw_cq ( struct hermon *hermon, unsigned long cqn,
|
369
|
369
|
|
370
|
370
|
static inline int
|
371
|
371
|
hermon_cmd_hw2sw_cq ( struct hermon *hermon, unsigned long cqn,
|
372
|
|
- struct hermonprm_completion_queue_context *cqctx) {
|
|
372
|
+ struct hermonprm_completion_queue_context *cqctx ) {
|
373
|
373
|
return hermon_cmd ( hermon,
|
374
|
374
|
HERMON_HCR_OUT_CMD ( HERMON_HCR_HW2SW_CQ,
|
375
|
375
|
1, sizeof ( *cqctx ) ),
|
376
|
376
|
0, NULL, cqn, cqctx );
|
377
|
377
|
}
|
378
|
378
|
|
|
379
|
+static inline int
|
|
380
|
+hermon_cmd_query_cq ( struct hermon *hermon, unsigned long cqn,
|
|
381
|
+ struct hermonprm_completion_queue_context *cqctx ) {
|
|
382
|
+ return hermon_cmd ( hermon,
|
|
383
|
+ HERMON_HCR_OUT_CMD ( HERMON_HCR_QUERY_CQ,
|
|
384
|
+ 1, sizeof ( *cqctx ) ),
|
|
385
|
+ 0, NULL, cqn, cqctx );
|
|
386
|
+}
|
|
387
|
+
|
379
|
388
|
static inline int
|
380
|
389
|
hermon_cmd_rst2init_qp ( struct hermon *hermon, unsigned long qpn,
|
381
|
390
|
const struct hermonprm_qp_ee_state_transitions *ctx ){
|
|
@@ -573,6 +582,7 @@ static int hermon_alloc_mtt ( struct hermon *hermon,
|
573
|
582
|
struct hermon_mtt *mtt ) {
|
574
|
583
|
struct hermonprm_write_mtt write_mtt;
|
575
|
584
|
physaddr_t start;
|
|
585
|
+ physaddr_t addr;
|
576
|
586
|
unsigned int page_offset;
|
577
|
587
|
unsigned int num_pages;
|
578
|
588
|
int mtt_offset;
|
|
@@ -596,6 +606,7 @@ static int hermon_alloc_mtt ( struct hermon *hermon,
|
596
|
606
|
}
|
597
|
607
|
mtt_base_addr = ( ( hermon->cap.reserved_mtts + mtt_offset ) *
|
598
|
608
|
hermon->cap.mtt_entry_size );
|
|
609
|
+ addr = start;
|
599
|
610
|
|
600
|
611
|
/* Fill in MTT structure */
|
601
|
612
|
mtt->mtt_offset = mtt_offset;
|
|
@@ -610,17 +621,22 @@ static int hermon_alloc_mtt ( struct hermon *hermon,
|
610
|
621
|
value, mtt_base_addr );
|
611
|
622
|
MLX_FILL_2 ( &write_mtt.mtt, 1,
|
612
|
623
|
p, 1,
|
613
|
|
- ptag_l, ( start >> 3 ) );
|
|
624
|
+ ptag_l, ( addr >> 3 ) );
|
614
|
625
|
if ( ( rc = hermon_cmd_write_mtt ( hermon,
|
615
|
626
|
&write_mtt ) ) != 0 ) {
|
616
|
627
|
DBGC ( hermon, "Hermon %p could not write MTT at %x\n",
|
617
|
628
|
hermon, mtt_base_addr );
|
618
|
629
|
goto err_write_mtt;
|
619
|
630
|
}
|
620
|
|
- start += HERMON_PAGE_SIZE;
|
|
631
|
+ addr += HERMON_PAGE_SIZE;
|
621
|
632
|
mtt_base_addr += hermon->cap.mtt_entry_size;
|
622
|
633
|
}
|
623
|
634
|
|
|
635
|
+ DBGC ( hermon, "Hermon %p MTT entries [%#x,%#x] for "
|
|
636
|
+ "[%08lx,%08lx,%08lx,%08lx)\n", hermon, mtt->mtt_offset,
|
|
637
|
+ ( mtt->mtt_offset + mtt->num_pages - 1 ), start,
|
|
638
|
+ ( start + page_offset ), ( start + len ), addr );
|
|
639
|
+
|
624
|
640
|
return 0;
|
625
|
641
|
|
626
|
642
|
err_write_mtt:
|
|
@@ -637,6 +653,10 @@ static int hermon_alloc_mtt ( struct hermon *hermon,
|
637
|
653
|
*/
|
638
|
654
|
static void hermon_free_mtt ( struct hermon *hermon,
|
639
|
655
|
struct hermon_mtt *mtt ) {
|
|
656
|
+
|
|
657
|
+ DBGC ( hermon, "Hermon %p MTT entries [%#x,%#x] freed\n",
|
|
658
|
+ hermon, mtt->mtt_offset,
|
|
659
|
+ ( mtt->mtt_offset + mtt->num_pages - 1 ) );
|
640
|
660
|
hermon_bitmask_free ( hermon->mtt_inuse, mtt->mtt_offset,
|
641
|
661
|
mtt->num_pages );
|
642
|
662
|
}
|
|
@@ -669,8 +689,8 @@ static int hermon_mad ( struct ib_device *ibdev, union ib_mad *mad ) {
|
669
|
689
|
/* Issue MAD */
|
670
|
690
|
if ( ( rc = hermon_cmd_mad_ifc ( hermon, ibdev->port,
|
671
|
691
|
&mad_ifc ) ) != 0 ) {
|
672
|
|
- DBGC ( hermon, "Hermon %p could not issue MAD IFC: %s\n",
|
673
|
|
- hermon, strerror ( rc ) );
|
|
692
|
+ DBGC ( hermon, "Hermon %p port %d could not issue MAD IFC: "
|
|
693
|
+ "%s\n", hermon, ibdev->port, strerror ( rc ) );
|
674
|
694
|
return rc;
|
675
|
695
|
}
|
676
|
696
|
|
|
@@ -678,8 +698,8 @@ static int hermon_mad ( struct ib_device *ibdev, union ib_mad *mad ) {
|
678
|
698
|
memcpy ( mad, &mad_ifc.mad, sizeof ( *mad ) );
|
679
|
699
|
|
680
|
700
|
if ( mad->hdr.status != 0 ) {
|
681
|
|
- DBGC ( hermon, "Hermon %p MAD IFC status %04x\n",
|
682
|
|
- hermon, ntohs ( mad->hdr.status ) );
|
|
701
|
+ DBGC ( hermon, "Hermon %p port %d MAD IFC status %04x\n",
|
|
702
|
+ hermon, ibdev->port, ntohs ( mad->hdr.status ) );
|
683
|
703
|
return -EIO;
|
684
|
704
|
}
|
685
|
705
|
return 0;
|
|
@@ -692,6 +712,30 @@ static int hermon_mad ( struct ib_device *ibdev, union ib_mad *mad ) {
|
692
|
712
|
***************************************************************************
|
693
|
713
|
*/
|
694
|
714
|
|
|
715
|
+/**
|
|
716
|
+ * Dump completion queue context (for debugging only)
|
|
717
|
+ *
|
|
718
|
+ * @v hermon Hermon device
|
|
719
|
+ * @v cq Completion queue
|
|
720
|
+ * @ret rc Return status code
|
|
721
|
+ */
|
|
722
|
+static __attribute__ (( unused )) int
|
|
723
|
+hermon_dump_cqctx ( struct hermon *hermon, struct ib_completion_queue *cq ) {
|
|
724
|
+ struct hermonprm_completion_queue_context cqctx;
|
|
725
|
+ int rc;
|
|
726
|
+
|
|
727
|
+ memset ( &cqctx, 0, sizeof ( cqctx ) );
|
|
728
|
+ if ( ( rc = hermon_cmd_query_cq ( hermon, cq->cqn, &cqctx ) ) != 0 ) {
|
|
729
|
+ DBGC ( hermon, "Hermon %p CQN %#lx QUERY_CQ failed: %s\n",
|
|
730
|
+ hermon, cq->cqn, strerror ( rc ) );
|
|
731
|
+ return rc;
|
|
732
|
+ }
|
|
733
|
+ DBGC ( hermon, "Hermon %p CQN %#lx context:\n", hermon, cq->cqn );
|
|
734
|
+ DBGC_HDA ( hermon, 0, &cqctx, sizeof ( cqctx ) );
|
|
735
|
+
|
|
736
|
+ return 0;
|
|
737
|
+}
|
|
738
|
+
|
695
|
739
|
/**
|
696
|
740
|
* Create completion queue
|
697
|
741
|
*
|
|
@@ -759,14 +803,15 @@ static int hermon_create_cq ( struct ib_device *ibdev,
|
759
|
803
|
MLX_FILL_1 ( &cqctx, 15, db_record_addr_l,
|
760
|
804
|
( virt_to_phys ( &hermon_cq->doorbell ) >> 3 ) );
|
761
|
805
|
if ( ( rc = hermon_cmd_sw2hw_cq ( hermon, cq->cqn, &cqctx ) ) != 0 ) {
|
762
|
|
- DBGC ( hermon, "Hermon %p SW2HW_CQ failed: %s\n",
|
763
|
|
- hermon, strerror ( rc ) );
|
|
806
|
+ DBGC ( hermon, "Hermon %p CQN %#lx SW2HW_CQ failed: %s\n",
|
|
807
|
+ hermon, cq->cqn, strerror ( rc ) );
|
764
|
808
|
goto err_sw2hw_cq;
|
765
|
809
|
}
|
766
|
810
|
|
767
|
|
- DBGC ( hermon, "Hermon %p CQN %#lx ring at [%p,%p)\n",
|
768
|
|
- hermon, cq->cqn, hermon_cq->cqe,
|
769
|
|
- ( ( ( void * ) hermon_cq->cqe ) + hermon_cq->cqe_size ) );
|
|
811
|
+ DBGC ( hermon, "Hermon %p CQN %#lx ring [%08lx,%08lx), doorbell "
|
|
812
|
+ "%08lx\n", hermon, cq->cqn, virt_to_phys ( hermon_cq->cqe ),
|
|
813
|
+ ( virt_to_phys ( hermon_cq->cqe ) + hermon_cq->cqe_size ),
|
|
814
|
+ virt_to_phys ( &hermon_cq->doorbell ) );
|
770
|
815
|
ib_cq_set_drvdata ( cq, hermon_cq );
|
771
|
816
|
return 0;
|
772
|
817
|
|
|
@@ -798,7 +843,7 @@ static void hermon_destroy_cq ( struct ib_device *ibdev,
|
798
|
843
|
|
799
|
844
|
/* Take ownership back from hardware */
|
800
|
845
|
if ( ( rc = hermon_cmd_hw2sw_cq ( hermon, cq->cqn, &cqctx ) ) != 0 ) {
|
801
|
|
- DBGC ( hermon, "Hermon %p FATAL HW2SW_CQ failed on CQN %#lx: "
|
|
846
|
+ DBGC ( hermon, "Hermon %p CQN %#lx FATAL HW2SW_CQ failed: "
|
802
|
847
|
"%s\n", hermon, cq->cqn, strerror ( rc ) );
|
803
|
848
|
/* Leak memory and return; at least we avoid corruption */
|
804
|
849
|
return;
|
|
@@ -925,20 +970,19 @@ static uint8_t hermon_qp_st[] = {
|
925
|
970
|
* @v qp Queue pair
|
926
|
971
|
* @ret rc Return status code
|
927
|
972
|
*/
|
928
|
|
-static inline int hermon_dump_qpctx ( struct hermon *hermon,
|
929
|
|
- struct ib_queue_pair *qp ) {
|
|
973
|
+static __attribute__ (( unused )) int
|
|
974
|
+hermon_dump_qpctx ( struct hermon *hermon, struct ib_queue_pair *qp ) {
|
930
|
975
|
struct hermonprm_qp_ee_state_transitions qpctx;
|
931
|
976
|
int rc;
|
932
|
977
|
|
933
|
978
|
memset ( &qpctx, 0, sizeof ( qpctx ) );
|
934
|
979
|
if ( ( rc = hermon_cmd_query_qp ( hermon, qp->qpn, &qpctx ) ) != 0 ) {
|
935
|
|
- DBGC ( hermon, "Hermon %p QUERY_QP failed: %s\n",
|
936
|
|
- hermon, strerror ( rc ) );
|
|
980
|
+ DBGC ( hermon, "Hermon %p QPN %#lx QUERY_QP failed: %s\n",
|
|
981
|
+ hermon, qp->qpn, strerror ( rc ) );
|
937
|
982
|
return rc;
|
938
|
983
|
}
|
939
|
|
- DBGC ( hermon, "Hermon %p QPN %lx context:\n", hermon, qp->qpn );
|
940
|
|
- DBGC_HDA ( hermon, 0, &qpctx.u.dwords[2],
|
941
|
|
- ( sizeof ( qpctx ) - 8 ) );
|
|
984
|
+ DBGC ( hermon, "Hermon %p QPN %#lx context:\n", hermon, qp->qpn );
|
|
985
|
+ DBGC_HDA ( hermon, 0, &qpctx.u.dwords[2], ( sizeof ( qpctx ) - 8 ) );
|
942
|
986
|
|
943
|
987
|
return 0;
|
944
|
988
|
}
|
|
@@ -1032,18 +1076,26 @@ static int hermon_create_qp ( struct ib_device *ibdev,
|
1032
|
1076
|
( hermon_qp->mtt.mtt_base_addr >> 3 ) );
|
1033
|
1077
|
if ( ( rc = hermon_cmd_rst2init_qp ( hermon, qp->qpn,
|
1034
|
1078
|
&qpctx ) ) != 0 ) {
|
1035
|
|
- DBGC ( hermon, "Hermon %p RST2INIT_QP failed: %s\n",
|
1036
|
|
- hermon, strerror ( rc ) );
|
|
1079
|
+ DBGC ( hermon, "Hermon %p QPN %#lx RST2INIT_QP failed: %s\n",
|
|
1080
|
+ hermon, qp->qpn, strerror ( rc ) );
|
1037
|
1081
|
goto err_rst2init_qp;
|
1038
|
1082
|
}
|
1039
|
1083
|
hermon_qp->state = HERMON_QP_ST_INIT;
|
1040
|
1084
|
|
1041
|
|
- DBGC ( hermon, "Hermon %p QPN %#lx send ring at [%p,%p)\n",
|
1042
|
|
- hermon, qp->qpn, hermon_qp->send.wqe,
|
1043
|
|
- ( ((void *)hermon_qp->send.wqe ) + hermon_qp->send.wqe_size ) );
|
1044
|
|
- DBGC ( hermon, "Hermon %p QPN %#lx receive ring at [%p,%p)\n",
|
1045
|
|
- hermon, qp->qpn, hermon_qp->recv.wqe,
|
1046
|
|
- ( ((void *)hermon_qp->recv.wqe ) + hermon_qp->recv.wqe_size ) );
|
|
1085
|
+ DBGC ( hermon, "Hermon %p QPN %#lx send ring [%08lx,%08lx), doorbell "
|
|
1086
|
+ "%08lx\n", hermon, qp->qpn,
|
|
1087
|
+ virt_to_phys ( hermon_qp->send.wqe ),
|
|
1088
|
+ ( virt_to_phys ( hermon_qp->send.wqe ) +
|
|
1089
|
+ hermon_qp->send.wqe_size ),
|
|
1090
|
+ virt_to_phys ( hermon_qp->send.doorbell ) );
|
|
1091
|
+ DBGC ( hermon, "Hermon %p QPN %#lx receive ring [%08lx,%08lx), "
|
|
1092
|
+ "doorbell %08lx\n", hermon, qp->qpn,
|
|
1093
|
+ virt_to_phys ( hermon_qp->recv.wqe ),
|
|
1094
|
+ ( virt_to_phys ( hermon_qp->recv.wqe ) +
|
|
1095
|
+ hermon_qp->recv.wqe_size ),
|
|
1096
|
+ virt_to_phys ( &hermon_qp->recv.doorbell ) );
|
|
1097
|
+ DBGC ( hermon, "Hermon %p QPN %#lx send CQN %#lx receive CQN %#lx\n",
|
|
1098
|
+ hermon, qp->qpn, qp->send.cq->cqn, qp->recv.cq->cqn );
|
1047
|
1099
|
ib_qp_set_drvdata ( qp, hermon_qp );
|
1048
|
1100
|
return 0;
|
1049
|
1101
|
|
|
@@ -1097,8 +1149,8 @@ static int hermon_modify_qp ( struct ib_device *ibdev,
|
1097
|
1149
|
qpc_eec_data.next_rcv_psn, qp->recv.psn );
|
1098
|
1150
|
if ( ( rc = hermon_cmd_init2rtr_qp ( hermon, qp->qpn,
|
1099
|
1151
|
&qpctx ) ) != 0 ) {
|
1100
|
|
- DBGC ( hermon, "Hermon %p INIT2RTR_QP failed: %s\n",
|
1101
|
|
- hermon, strerror ( rc ) );
|
|
1152
|
+ DBGC ( hermon, "Hermon %p QPN %#lx INIT2RTR_QP failed:"
|
|
1153
|
+ " %s\n", hermon, qp->qpn, strerror ( rc ) );
|
1102
|
1154
|
return rc;
|
1103
|
1155
|
}
|
1104
|
1156
|
hermon_qp->state = HERMON_QP_ST_RTR;
|
|
@@ -1117,8 +1169,8 @@ static int hermon_modify_qp ( struct ib_device *ibdev,
|
1117
|
1169
|
qpc_eec_data.next_send_psn, qp->send.psn );
|
1118
|
1170
|
if ( ( rc = hermon_cmd_rtr2rts_qp ( hermon, qp->qpn,
|
1119
|
1171
|
&qpctx ) ) != 0 ) {
|
1120
|
|
- DBGC ( hermon, "Hermon %p RTR2RTS_QP failed: %s\n",
|
1121
|
|
- hermon, strerror ( rc ) );
|
|
1172
|
+ DBGC ( hermon, "Hermon %p QPN %#lx RTR2RTS_QP failed: "
|
|
1173
|
+ "%s\n", hermon, qp->qpn, strerror ( rc ) );
|
1122
|
1174
|
return rc;
|
1123
|
1175
|
}
|
1124
|
1176
|
hermon_qp->state = HERMON_QP_ST_RTS;
|
|
@@ -1129,8 +1181,8 @@ static int hermon_modify_qp ( struct ib_device *ibdev,
|
1129
|
1181
|
MLX_FILL_1 ( &qpctx, 0, opt_param_mask, HERMON_QP_OPT_PARAM_QKEY );
|
1130
|
1182
|
MLX_FILL_1 ( &qpctx, 44, qpc_eec_data.q_key, qp->qkey );
|
1131
|
1183
|
if ( ( rc = hermon_cmd_rts2rts_qp ( hermon, qp->qpn, &qpctx ) ) != 0 ){
|
1132
|
|
- DBGC ( hermon, "Hermon %p RTS2RTS_QP failed: %s\n",
|
1133
|
|
- hermon, strerror ( rc ) );
|
|
1184
|
+ DBGC ( hermon, "Hermon %p QPN %#lx RTS2RTS_QP failed: %s\n",
|
|
1185
|
+ hermon, qp->qpn, strerror ( rc ) );
|
1134
|
1186
|
return rc;
|
1135
|
1187
|
}
|
1136
|
1188
|
|
|
@@ -1151,8 +1203,8 @@ static void hermon_destroy_qp ( struct ib_device *ibdev,
|
1151
|
1203
|
|
1152
|
1204
|
/* Take ownership back from hardware */
|
1153
|
1205
|
if ( ( rc = hermon_cmd_2rst_qp ( hermon, qp->qpn ) ) != 0 ) {
|
1154
|
|
- DBGC ( hermon, "Hermon %p FATAL 2RST_QP failed on QPN %#lx: "
|
1155
|
|
- "%s\n", hermon, qp->qpn, strerror ( rc ) );
|
|
1206
|
+ DBGC ( hermon, "Hermon %p QPN %#lx FATAL 2RST_QP failed: %s\n",
|
|
1207
|
+ hermon, qp->qpn, strerror ( rc ) );
|
1156
|
1208
|
/* Leak memory and return; at least we avoid corruption */
|
1157
|
1209
|
return;
|
1158
|
1210
|
}
|
|
@@ -1177,6 +1229,28 @@ static void hermon_destroy_qp ( struct ib_device *ibdev,
|
1177
|
1229
|
***************************************************************************
|
1178
|
1230
|
*/
|
1179
|
1231
|
|
|
1232
|
+/**
|
|
1233
|
+ * Construct UD send work queue entry
|
|
1234
|
+ *
|
|
1235
|
+ * @v ibdev Infiniband device
|
|
1236
|
+ * @v qp Queue pair
|
|
1237
|
+ * @v av Address vector
|
|
1238
|
+ * @v iobuf I/O buffer
|
|
1239
|
+ * @v wqe Send work queue entry
|
|
1240
|
+ * @ret opcode Control opcode
|
|
1241
|
+ */
|
|
1242
|
+static __attribute__ (( unused )) unsigned int
|
|
1243
|
+hermon_fill_nop_send_wqe ( struct ib_device *ibdev __unused,
|
|
1244
|
+ struct ib_queue_pair *qp __unused,
|
|
1245
|
+ struct ib_address_vector *av __unused,
|
|
1246
|
+ struct io_buffer *iobuf __unused,
|
|
1247
|
+ union hermon_send_wqe *wqe ) {
|
|
1248
|
+
|
|
1249
|
+ MLX_FILL_1 ( &wqe->ctrl, 1, ds, ( sizeof ( wqe->ctrl ) / 16 ) );
|
|
1250
|
+ MLX_FILL_1 ( &wqe->ctrl, 2, c, 0x03 /* generate completion */ );
|
|
1251
|
+ return HERMON_OPCODE_NOP;
|
|
1252
|
+}
|
|
1253
|
+
|
1180
|
1254
|
/**
|
1181
|
1255
|
* Construct UD send work queue entry
|
1182
|
1256
|
*
|
|
@@ -1325,18 +1399,22 @@ static int hermon_post_send ( struct ib_device *ibdev,
|
1325
|
1399
|
struct hermon_send_work_queue *hermon_send_wq = &hermon_qp->send;
|
1326
|
1400
|
union hermon_send_wqe *wqe;
|
1327
|
1401
|
union hermonprm_doorbell_register db_reg;
|
1328
|
|
- unsigned int wqe_idx_mask;
|
|
1402
|
+ unsigned long wqe_idx_mask;
|
|
1403
|
+ unsigned long wqe_idx;
|
|
1404
|
+ unsigned int owner;
|
1329
|
1405
|
unsigned int opcode;
|
1330
|
1406
|
|
1331
|
1407
|
/* Allocate work queue entry */
|
|
1408
|
+ wqe_idx = ( wq->next_idx & ( hermon_send_wq->num_wqes - 1 ) );
|
|
1409
|
+ owner = ( ( wq->next_idx & hermon_send_wq->num_wqes ) ? 1 : 0 );
|
1332
|
1410
|
wqe_idx_mask = ( wq->num_wqes - 1 );
|
1333
|
|
- if ( wq->iobufs[wq->next_idx & wqe_idx_mask] ) {
|
1334
|
|
- DBGC ( hermon, "Hermon %p send queue full", hermon );
|
|
1411
|
+ if ( wq->iobufs[ wqe_idx & wqe_idx_mask ] ) {
|
|
1412
|
+ DBGC ( hermon, "Hermon %p QPN %#lx send queue full",
|
|
1413
|
+ hermon, qp->qpn );
|
1335
|
1414
|
return -ENOBUFS;
|
1336
|
1415
|
}
|
1337
|
|
- wq->iobufs[wq->next_idx & wqe_idx_mask] = iobuf;
|
1338
|
|
- wqe = &hermon_send_wq->wqe[ wq->next_idx &
|
1339
|
|
- ( hermon_send_wq->num_wqes - 1 ) ];
|
|
1416
|
+ wq->iobufs[ wqe_idx & wqe_idx_mask ] = iobuf;
|
|
1417
|
+ wqe = &hermon_send_wq->wqe[wqe_idx];
|
1340
|
1418
|
|
1341
|
1419
|
/* Construct work queue entry */
|
1342
|
1420
|
memset ( ( ( ( void * ) wqe ) + 4 /* avoid ctrl.owner */ ), 0,
|
|
@@ -1348,17 +1426,15 @@ static int hermon_post_send ( struct ib_device *ibdev,
|
1348
|
1426
|
barrier();
|
1349
|
1427
|
MLX_FILL_2 ( &wqe->ctrl, 0,
|
1350
|
1428
|
opcode, opcode,
|
1351
|
|
- owner,
|
1352
|
|
- ( ( wq->next_idx & hermon_send_wq->num_wqes ) ? 1 : 0 ) );
|
1353
|
|
- DBGCP ( hermon, "Hermon %p posting send WQE:\n", hermon );
|
1354
|
|
- DBGCP_HD ( hermon, wqe, sizeof ( *wqe ) );
|
1355
|
|
- barrier();
|
|
1429
|
+ owner, owner );
|
|
1430
|
+ DBGCP ( hermon, "Hermon %p QPN %#lx posting send WQE %#lx:\n",
|
|
1431
|
+ hermon, qp->qpn, wqe_idx );
|
|
1432
|
+ DBGCP_HDA ( hermon, virt_to_phys ( wqe ), wqe, sizeof ( *wqe ) );
|
1356
|
1433
|
|
1357
|
1434
|
/* Ring doorbell register */
|
1358
|
1435
|
MLX_FILL_1 ( &db_reg.send, 0, qn, qp->qpn );
|
1359
|
|
- DBGCP ( hermon, "Ringing doorbell %08lx with %08x\n",
|
1360
|
|
- virt_to_phys ( hermon_send_wq->doorbell ), db_reg.dword[0] );
|
1361
|
|
- writel ( db_reg.dword[0], ( hermon_send_wq->doorbell ) );
|
|
1436
|
+ barrier();
|
|
1437
|
+ writel ( db_reg.dword[0], hermon_send_wq->doorbell );
|
1362
|
1438
|
|
1363
|
1439
|
/* Update work queue's index */
|
1364
|
1440
|
wq->next_idx++;
|
|
@@ -1387,7 +1463,8 @@ static int hermon_post_recv ( struct ib_device *ibdev,
|
1387
|
1463
|
/* Allocate work queue entry */
|
1388
|
1464
|
wqe_idx_mask = ( wq->num_wqes - 1 );
|
1389
|
1465
|
if ( wq->iobufs[wq->next_idx & wqe_idx_mask] ) {
|
1390
|
|
- DBGC ( hermon, "Hermon %p receive queue full", hermon );
|
|
1466
|
+ DBGC ( hermon, "Hermon %p QPN %#lx receive queue full",
|
|
1467
|
+ hermon, qp->qpn );
|
1391
|
1468
|
return -ENOBUFS;
|
1392
|
1469
|
}
|
1393
|
1470
|
wq->iobufs[wq->next_idx & wqe_idx_mask] = iobuf;
|
|
@@ -1432,7 +1509,8 @@ static int hermon_complete ( struct ib_device *ibdev,
|
1432
|
1509
|
unsigned int opcode;
|
1433
|
1510
|
unsigned long qpn;
|
1434
|
1511
|
int is_send;
|
1435
|
|
- unsigned int wqe_idx;
|
|
1512
|
+ unsigned long wqe_idx;
|
|
1513
|
+ unsigned long wqe_idx_mask;
|
1436
|
1514
|
size_t len;
|
1437
|
1515
|
int rc = 0;
|
1438
|
1516
|
|
|
@@ -1443,7 +1521,7 @@ static int hermon_complete ( struct ib_device *ibdev,
|
1443
|
1521
|
if ( opcode >= HERMON_OPCODE_RECV_ERROR ) {
|
1444
|
1522
|
/* "s" field is not valid for error opcodes */
|
1445
|
1523
|
is_send = ( opcode == HERMON_OPCODE_SEND_ERROR );
|
1446
|
|
- DBGC ( hermon, "Hermon %p CQN %lx syndrome %x vendor %x\n",
|
|
1524
|
+ DBGC ( hermon, "Hermon %p CQN %#lx syndrome %x vendor %x\n",
|
1447
|
1525
|
hermon, cq->cqn, MLX_GET ( &cqe->error, syndrome ),
|
1448
|
1526
|
MLX_GET ( &cqe->error, vendor_error_syndrome ) );
|
1449
|
1527
|
rc = -EIO;
|
|
@@ -1453,23 +1531,30 @@ static int hermon_complete ( struct ib_device *ibdev,
|
1453
|
1531
|
/* Identify work queue */
|
1454
|
1532
|
wq = ib_find_wq ( cq, qpn, is_send );
|
1455
|
1533
|
if ( ! wq ) {
|
1456
|
|
- DBGC ( hermon, "Hermon %p CQN %lx unknown %s QPN %lx\n",
|
|
1534
|
+ DBGC ( hermon, "Hermon %p CQN %#lx unknown %s QPN %#lx\n",
|
1457
|
1535
|
hermon, cq->cqn, ( is_send ? "send" : "recv" ), qpn );
|
1458
|
1536
|
return -EIO;
|
1459
|
1537
|
}
|
1460
|
1538
|
qp = wq->qp;
|
1461
|
1539
|
hermon_qp = ib_qp_get_drvdata ( qp );
|
1462
|
1540
|
|
|
1541
|
+ /* Identify work queue entry */
|
|
1542
|
+ wqe_idx = MLX_GET ( &cqe->normal, wqe_counter );
|
|
1543
|
+ wqe_idx_mask = ( wq->num_wqes - 1 );
|
|
1544
|
+ DBGCP ( hermon, "Hermon %p CQN %#lx QPN %#lx %s WQE %#lx completed:\n",
|
|
1545
|
+ hermon, cq->cqn, qp->qpn, ( is_send ? "send" : "recv" ),
|
|
1546
|
+ wqe_idx );
|
|
1547
|
+ DBGCP_HDA ( hermon, virt_to_phys ( cqe ), cqe, sizeof ( *cqe ) );
|
|
1548
|
+
|
1463
|
1549
|
/* Identify I/O buffer */
|
1464
|
|
- wqe_idx = ( MLX_GET ( &cqe->normal, wqe_counter ) &
|
1465
|
|
- ( wq->num_wqes - 1 ) );
|
1466
|
|
- iobuf = wq->iobufs[wqe_idx];
|
|
1550
|
+ iobuf = wq->iobufs[ wqe_idx & wqe_idx_mask ];
|
1467
|
1551
|
if ( ! iobuf ) {
|
1468
|
|
- DBGC ( hermon, "Hermon %p CQN %lx QPN %lx empty WQE %x\n",
|
1469
|
|
- hermon, cq->cqn, qp->qpn, wqe_idx );
|
|
1552
|
+ DBGC ( hermon, "Hermon %p CQN %#lx QPN %#lx empty %s WQE "
|
|
1553
|
+ "%#lx\n", hermon, cq->cqn, qp->qpn,
|
|
1554
|
+ ( is_send ? "send" : "recv" ), wqe_idx );
|
1470
|
1555
|
return -EIO;
|
1471
|
1556
|
}
|
1472
|
|
- wq->iobufs[wqe_idx] = NULL;
|
|
1557
|
+ wq->iobufs[ wqe_idx & wqe_idx_mask ] = NULL;
|
1473
|
1558
|
|
1474
|
1559
|
if ( is_send ) {
|
1475
|
1560
|
/* Hand off to completion handler */
|
|
@@ -1532,14 +1617,13 @@ static void hermon_poll_cq ( struct ib_device *ibdev,
|
1532
|
1617
|
/* Entry still owned by hardware; end of poll */
|
1533
|
1618
|
break;
|
1534
|
1619
|
}
|
1535
|
|
- DBGCP ( hermon, "Hermon %p completion:\n", hermon );
|
1536
|
|
- DBGCP_HD ( hermon, cqe, sizeof ( *cqe ) );
|
1537
|
1620
|
|
1538
|
1621
|
/* Handle completion */
|
1539
|
1622
|
if ( ( rc = hermon_complete ( ibdev, cq, cqe ) ) != 0 ) {
|
1540
|
|
- DBGC ( hermon, "Hermon %p failed to complete: %s\n",
|
1541
|
|
- hermon, strerror ( rc ) );
|
1542
|
|
- DBGC_HD ( hermon, cqe, sizeof ( *cqe ) );
|
|
1623
|
+ DBGC ( hermon, "Hermon %p CQN %#lx failed to complete:"
|
|
1624
|
+ " %s\n", hermon, cq->cqn, strerror ( rc ) );
|
|
1625
|
+ DBGC_HDA ( hermon, virt_to_phys ( cqe ),
|
|
1626
|
+ cqe, sizeof ( *cqe ) );
|
1543
|
1627
|
}
|
1544
|
1628
|
|
1545
|
1629
|
/* Update completion queue's index */
|
|
@@ -1611,8 +1695,8 @@ static int hermon_create_eq ( struct hermon *hermon ) {
|
1611
|
1695
|
( hermon_eq->mtt.mtt_base_addr >> 3 ) );
|
1612
|
1696
|
if ( ( rc = hermon_cmd_sw2hw_eq ( hermon, hermon_eq->eqn,
|
1613
|
1697
|
&eqctx ) ) != 0 ) {
|
1614
|
|
- DBGC ( hermon, "Hermon %p SW2HW_EQ failed: %s\n",
|
1615
|
|
- hermon, strerror ( rc ) );
|
|
1698
|
+ DBGC ( hermon, "Hermon %p EQN %#lx SW2HW_EQ failed: %s\n",
|
|
1699
|
+ hermon, hermon_eq->eqn, strerror ( rc ) );
|
1616
|
1700
|
goto err_sw2hw_eq;
|
1617
|
1701
|
}
|
1618
|
1702
|
|
|
@@ -1622,14 +1706,16 @@ static int hermon_create_eq ( struct hermon *hermon ) {
|
1622
|
1706
|
if ( ( rc = hermon_cmd_map_eq ( hermon,
|
1623
|
1707
|
( HERMON_MAP_EQ | hermon_eq->eqn ),
|
1624
|
1708
|
&mask ) ) != 0 ) {
|
1625
|
|
- DBGC ( hermon, "Hermon %p MAP_EQ failed: %s\n",
|
1626
|
|
- hermon, strerror ( rc ) );
|
|
1709
|
+ DBGC ( hermon, "Hermon %p EQN %#lx MAP_EQ failed: %s\n",
|
|
1710
|
+ hermon, hermon_eq->eqn, strerror ( rc ) );
|
1627
|
1711
|
goto err_map_eq;
|
1628
|
1712
|
}
|
1629
|
1713
|
|
1630
|
|
- DBGC ( hermon, "Hermon %p EQN %#lx ring at [%p,%p])\n",
|
1631
|
|
- hermon, hermon_eq->eqn, hermon_eq->eqe,
|
1632
|
|
- ( ( ( void * ) hermon_eq->eqe ) + hermon_eq->eqe_size ) );
|
|
1714
|
+ DBGC ( hermon, "Hermon %p EQN %#lx ring [%08lx,%08lx), doorbell "
|
|
1715
|
+ "%08lx\n", hermon, hermon_eq->eqn,
|
|
1716
|
+ virt_to_phys ( hermon_eq->eqe ),
|
|
1717
|
+ ( virt_to_phys ( hermon_eq->eqe ) + hermon_eq->eqe_size ),
|
|
1718
|
+ virt_to_phys ( hermon_eq->doorbell ) );
|
1633
|
1719
|
return 0;
|
1634
|
1720
|
|
1635
|
1721
|
err_map_eq:
|
|
@@ -1660,16 +1746,16 @@ static void hermon_destroy_eq ( struct hermon *hermon ) {
|
1660
|
1746
|
if ( ( rc = hermon_cmd_map_eq ( hermon,
|
1661
|
1747
|
( HERMON_UNMAP_EQ | hermon_eq->eqn ),
|
1662
|
1748
|
&mask ) ) != 0 ) {
|
1663
|
|
- DBGC ( hermon, "Hermon %p FATAL MAP_EQ failed to unmap: %s\n",
|
1664
|
|
- hermon, strerror ( rc ) );
|
|
1749
|
+ DBGC ( hermon, "Hermon %p EQN %#lx FATAL MAP_EQ failed to "
|
|
1750
|
+ "unmap: %s\n", hermon, hermon_eq->eqn, strerror ( rc ) );
|
1665
|
1751
|
/* Continue; HCA may die but system should survive */
|
1666
|
1752
|
}
|
1667
|
1753
|
|
1668
|
1754
|
/* Take ownership back from hardware */
|
1669
|
1755
|
if ( ( rc = hermon_cmd_hw2sw_eq ( hermon, hermon_eq->eqn,
|
1670
|
1756
|
&eqctx ) ) != 0 ) {
|
1671
|
|
- DBGC ( hermon, "Hermon %p FATAL HW2SW_EQ failed: %s\n",
|
1672
|
|
- hermon, strerror ( rc ) );
|
|
1757
|
+ DBGC ( hermon, "Hermon %p EQN %#lx FATAL HW2SW_EQ failed: %s\n",
|
|
1758
|
+ hermon, hermon_eq->eqn, strerror ( rc ) );
|
1673
|
1759
|
/* Leak memory and return; at least we avoid corruption */
|
1674
|
1760
|
return;
|
1675
|
1761
|
}
|
|
@@ -1735,8 +1821,10 @@ static void hermon_poll_eq ( struct ib_device *ibdev ) {
|
1735
|
1821
|
/* Entry still owned by hardware; end of poll */
|
1736
|
1822
|
break;
|
1737
|
1823
|
}
|
1738
|
|
- DBGCP ( hermon, "Hermon %p event:\n", hermon );
|
1739
|
|
- DBGCP_HD ( hermon, eqe, sizeof ( *eqe ) );
|
|
1824
|
+ DBGCP ( hermon, "Hermon %p EQN %#lx event:\n",
|
|
1825
|
+ hermon, hermon_eq->eqn );
|
|
1826
|
+ DBGCP_HDA ( hermon, virt_to_phys ( eqe ),
|
|
1827
|
+ eqe, sizeof ( *eqe ) );
|
1740
|
1828
|
|
1741
|
1829
|
/* Handle event */
|
1742
|
1830
|
event_type = MLX_GET ( &eqe->generic, event_type );
|
|
@@ -1745,9 +1833,11 @@ static void hermon_poll_eq ( struct ib_device *ibdev ) {
|
1745
|
1833
|
hermon_event_port_state_change ( hermon, eqe );
|
1746
|
1834
|
break;
|
1747
|
1835
|
default:
|
1748
|
|
- DBGC ( hermon, "Hermon %p unrecognised event type "
|
1749
|
|
- "%#x:\n", hermon, event_type );
|
1750
|
|
- DBGC_HD ( hermon, eqe, sizeof ( *eqe ) );
|
|
1836
|
+ DBGC ( hermon, "Hermon %p EQN %#lx unrecognised event "
|
|
1837
|
+ "type %#x:\n",
|
|
1838
|
+ hermon, hermon_eq->eqn, event_type );
|
|
1839
|
+ DBGC_HDA ( hermon, virt_to_phys ( eqe ),
|
|
1840
|
+ eqe, sizeof ( *eqe ) );
|
1751
|
1841
|
break;
|
1752
|
1842
|
}
|
1753
|
1843
|
|
|
@@ -1757,9 +1847,6 @@ static void hermon_poll_eq ( struct ib_device *ibdev ) {
|
1757
|
1847
|
/* Ring doorbell */
|
1758
|
1848
|
MLX_FILL_1 ( &db_reg.event, 0,
|
1759
|
1849
|
ci, ( hermon_eq->next_idx & 0x00ffffffUL ) );
|
1760
|
|
- DBGCP ( hermon, "Ringing doorbell %08lx with %08x\n",
|
1761
|
|
- virt_to_phys ( hermon_eq->doorbell ),
|
1762
|
|
- db_reg.dword[0] );
|
1763
|
1850
|
writel ( db_reg.dword[0], hermon_eq->doorbell );
|
1764
|
1851
|
}
|
1765
|
1852
|
}
|
|
@@ -1833,8 +1920,8 @@ static int hermon_open ( struct ib_device *ibdev ) {
|
1833
|
1920
|
MLX_FILL_1 ( &init_port, 2, max_pkey, 64 );
|
1834
|
1921
|
if ( ( rc = hermon_cmd_init_port ( hermon, ibdev->port,
|
1835
|
1922
|
&init_port ) ) != 0 ) {
|
1836
|
|
- DBGC ( hermon, "Hermon %p could not intialise port: %s\n",
|
1837
|
|
- hermon, strerror ( rc ) );
|
|
1923
|
+ DBGC ( hermon, "Hermon %p port %d could not intialise port: "
|
|
1924
|
+ "%s\n", hermon, ibdev->port, strerror ( rc ) );
|
1838
|
1925
|
return rc;
|
1839
|
1926
|
}
|
1840
|
1927
|
|
|
@@ -1854,8 +1941,8 @@ static void hermon_close ( struct ib_device *ibdev ) {
|
1854
|
1941
|
int rc;
|
1855
|
1942
|
|
1856
|
1943
|
if ( ( rc = hermon_cmd_close_port ( hermon, ibdev->port ) ) != 0 ) {
|
1857
|
|
- DBGC ( hermon, "Hermon %p could not close port: %s\n",
|
1858
|
|
- hermon, strerror ( rc ) );
|
|
1944
|
+ DBGC ( hermon, "Hermon %p port %d could not close port: %s\n",
|
|
1945
|
+ hermon, ibdev->port, strerror ( rc ) );
|
1859
|
1946
|
/* Nothing we can do about this */
|
1860
|
1947
|
}
|
1861
|
1948
|
}
|
|
@@ -2085,7 +2172,7 @@ static int hermon_start_firmware ( struct hermon *hermon ) {
|
2085
|
2172
|
goto err_alloc_fa;
|
2086
|
2173
|
}
|
2087
|
2174
|
fw_base = user_to_phys ( hermon->firmware_area, 0 );
|
2088
|
|
- DBGC ( hermon, "Hermon %p firmware area at physical [%lx,%lx)\n",
|
|
2175
|
+ DBGC ( hermon, "Hermon %p firmware area at physical [%08lx,%08lx)\n",
|
2089
|
2176
|
hermon, fw_base, ( fw_base + fw_size ) );
|
2090
|
2177
|
if ( ( rc = hermon_map_vpm ( hermon, hermon_cmd_map_fa,
|
2091
|
2178
|
0, fw_base, fw_size ) ) != 0 ) {
|
|
@@ -2720,8 +2807,9 @@ static int hermon_probe ( struct pci_device *pci,
|
2720
|
2807
|
/* Register Infiniband devices */
|
2721
|
2808
|
for ( i = 0 ; i < hermon->cap.num_ports ; i++ ) {
|
2722
|
2809
|
if ( ( rc = register_ibdev ( hermon->ibdev[i] ) ) != 0 ) {
|
2723
|
|
- DBGC ( hermon, "Hermon %p could not register IB "
|
2724
|
|
- "device: %s\n", hermon, strerror ( rc ) );
|
|
2810
|
+ DBGC ( hermon, "Hermon %p port %d could not register "
|
|
2811
|
+ "IB device: %s\n", hermon,
|
|
2812
|
+ hermon->ibdev[i]->port, strerror ( rc ) );
|
2725
|
2813
|
goto err_register_ibdev;
|
2726
|
2814
|
}
|
2727
|
2815
|
}
|