|
|
@@ -277,20 +277,18 @@ static void ipoib_destroy_qset ( struct ipoib_device *ipoib,
|
|
277
|
277
|
* @v ipoib IPoIB device
|
|
278
|
278
|
* @v qset Queue set
|
|
279
|
279
|
* @v num_cqes Number of completion queue entries
|
|
|
280
|
+ * @v cq_op Completion queue operations
|
|
280
|
281
|
* @v num_send_wqes Number of send work queue entries
|
|
281
|
|
- * @v complete_send Send completion handler
|
|
282
|
282
|
* @v num_recv_wqes Number of receive work queue entries
|
|
283
|
|
- * @v complete_recv Receive completion handler
|
|
284
|
283
|
* @v qkey Queue key
|
|
285
|
284
|
* @ret rc Return status code
|
|
286
|
285
|
*/
|
|
287
|
286
|
static int ipoib_create_qset ( struct ipoib_device *ipoib,
|
|
288
|
287
|
struct ipoib_queue_set *qset,
|
|
289
|
288
|
unsigned int num_cqes,
|
|
|
289
|
+ struct ib_completion_queue_operations *cq_op,
|
|
290
|
290
|
unsigned int num_send_wqes,
|
|
291
|
|
- ib_completer_t complete_send,
|
|
292
|
291
|
unsigned int num_recv_wqes,
|
|
293
|
|
- ib_completer_t complete_recv,
|
|
294
|
292
|
unsigned long qkey ) {
|
|
295
|
293
|
struct ib_device *ibdev = ipoib->ibdev;
|
|
296
|
294
|
int rc;
|
|
|
@@ -303,8 +301,7 @@ static int ipoib_create_qset ( struct ipoib_device *ipoib,
|
|
303
|
301
|
qset->recv_max_fill = num_recv_wqes;
|
|
304
|
302
|
|
|
305
|
303
|
/* Allocate completion queue */
|
|
306
|
|
- qset->cq = ib_create_cq ( ibdev, num_cqes, complete_send,
|
|
307
|
|
- complete_recv );
|
|
|
304
|
+ qset->cq = ib_create_cq ( ibdev, num_cqes, cq_op );
|
|
308
|
305
|
if ( ! qset->cq ) {
|
|
309
|
306
|
DBGC ( ipoib, "IPoIB %p could not allocate completion queue\n",
|
|
310
|
307
|
ipoib );
|
|
|
@@ -391,8 +388,8 @@ static int ipoib_get_path_record ( struct ipoib_device *ipoib,
|
|
391
|
388
|
|
|
392
|
389
|
/* Construct address vector */
|
|
393
|
390
|
memset ( &av, 0, sizeof ( av ) );
|
|
394
|
|
- av.dlid = ibdev->sm_lid;
|
|
395
|
|
- av.dest_qp = IB_SA_QPN;
|
|
|
391
|
+ av.lid = ibdev->sm_lid;
|
|
|
392
|
+ av.qpn = IB_SA_QPN;
|
|
396
|
393
|
av.qkey = IB_GLOBAL_QKEY;
|
|
397
|
394
|
|
|
398
|
395
|
/* Post send request */
|
|
|
@@ -451,8 +448,8 @@ static int ipoib_mc_member_record ( struct ipoib_device *ipoib,
|
|
451
|
448
|
|
|
452
|
449
|
/* Construct address vector */
|
|
453
|
450
|
memset ( &av, 0, sizeof ( av ) );
|
|
454
|
|
- av.dlid = ibdev->sm_lid;
|
|
455
|
|
- av.dest_qp = IB_SA_QPN;
|
|
|
451
|
+ av.lid = ibdev->sm_lid;
|
|
|
452
|
+ av.qpn = IB_SA_QPN;
|
|
456
|
453
|
av.qkey = IB_GLOBAL_QKEY;
|
|
457
|
454
|
|
|
458
|
455
|
/* Post send request */
|
|
|
@@ -503,8 +500,8 @@ static int ipoib_transmit ( struct net_device *netdev,
|
|
503
|
500
|
av.gid_present = 1;
|
|
504
|
501
|
if ( ipoib_pshdr->peer.qpn == htonl ( IPOIB_BROADCAST_QPN ) ) {
|
|
505
|
502
|
/* Broadcast address */
|
|
506
|
|
- av.dest_qp = IB_BROADCAST_QPN;
|
|
507
|
|
- av.dlid = ipoib->broadcast_lid;
|
|
|
503
|
+ av.qpn = IB_BROADCAST_QPN;
|
|
|
504
|
+ av.lid = ipoib->broadcast_lid;
|
|
508
|
505
|
gid = &ipoib->broadcast_gid;
|
|
509
|
506
|
} else {
|
|
510
|
507
|
/* Unicast - look in path cache */
|
|
|
@@ -516,8 +513,8 @@ static int ipoib_transmit ( struct net_device *netdev,
|
|
516
|
513
|
netdev_tx_complete ( netdev, iobuf );
|
|
517
|
514
|
return rc;
|
|
518
|
515
|
}
|
|
519
|
|
- av.dest_qp = ntohl ( ipoib_pshdr->peer.qpn );
|
|
520
|
|
- av.dlid = path->dlid;
|
|
|
516
|
+ av.qpn = ntohl ( ipoib_pshdr->peer.qpn );
|
|
|
517
|
+ av.lid = path->dlid;
|
|
521
|
518
|
av.rate = path->rate;
|
|
522
|
519
|
av.sl = path->sl;
|
|
523
|
520
|
gid = &ipoib_pshdr->peer.gid;
|
|
|
@@ -532,17 +529,15 @@ static int ipoib_transmit ( struct net_device *netdev,
|
|
532
|
529
|
*
|
|
533
|
530
|
* @v ibdev Infiniband device
|
|
534
|
531
|
* @v qp Queue pair
|
|
535
|
|
- * @v completion Completion
|
|
536
|
532
|
* @v iobuf I/O buffer
|
|
|
533
|
+ * @v rc Completion status code
|
|
537
|
534
|
*/
|
|
538
|
535
|
static void ipoib_data_complete_send ( struct ib_device *ibdev __unused,
|
|
539
|
536
|
struct ib_queue_pair *qp,
|
|
540
|
|
- struct ib_completion *completion,
|
|
541
|
|
- struct io_buffer *iobuf ) {
|
|
|
537
|
+ struct io_buffer *iobuf, int rc ) {
|
|
542
|
538
|
struct net_device *netdev = ib_qp_get_ownerdata ( qp );
|
|
543
|
539
|
|
|
544
|
|
- netdev_tx_complete_err ( netdev, iobuf,
|
|
545
|
|
- ( completion->syndrome ? -EIO : 0 ) );
|
|
|
540
|
+ netdev_tx_complete_err ( netdev, iobuf, rc );
|
|
546
|
541
|
}
|
|
547
|
542
|
|
|
548
|
543
|
/**
|
|
|
@@ -550,32 +545,23 @@ static void ipoib_data_complete_send ( struct ib_device *ibdev __unused,
|
|
550
|
545
|
*
|
|
551
|
546
|
* @v ibdev Infiniband device
|
|
552
|
547
|
* @v qp Queue pair
|
|
553
|
|
- * @v completion Completion
|
|
|
548
|
+ * @v av Address vector, or NULL
|
|
554
|
549
|
* @v iobuf I/O buffer
|
|
|
550
|
+ * @v rc Completion status code
|
|
555
|
551
|
*/
|
|
556
|
552
|
static void ipoib_data_complete_recv ( struct ib_device *ibdev __unused,
|
|
557
|
553
|
struct ib_queue_pair *qp,
|
|
558
|
|
- struct ib_completion *completion,
|
|
559
|
|
- struct io_buffer *iobuf ) {
|
|
|
554
|
+ struct ib_address_vector *av __unused,
|
|
|
555
|
+ struct io_buffer *iobuf, int rc ) {
|
|
560
|
556
|
struct net_device *netdev = ib_qp_get_ownerdata ( qp );
|
|
561
|
557
|
struct ipoib_device *ipoib = netdev->priv;
|
|
562
|
558
|
struct ipoib_pseudo_hdr *ipoib_pshdr;
|
|
563
|
559
|
|
|
564
|
|
- if ( completion->syndrome ) {
|
|
565
|
|
- netdev_rx_err ( netdev, iobuf, -EIO );
|
|
|
560
|
+ if ( rc != 0 ) {
|
|
|
561
|
+ netdev_rx_err ( netdev, iobuf, rc );
|
|
566
|
562
|
return;
|
|
567
|
563
|
}
|
|
568
|
564
|
|
|
569
|
|
- iob_put ( iobuf, completion->len );
|
|
570
|
|
- if ( iob_len ( iobuf ) < sizeof ( struct ib_global_route_header ) ) {
|
|
571
|
|
- DBGC ( ipoib, "IPoIB %p received data packet too short to "
|
|
572
|
|
- "contain GRH\n", ipoib );
|
|
573
|
|
- DBGC_HD ( ipoib, iobuf->data, iob_len ( iobuf ) );
|
|
574
|
|
- netdev_rx_err ( netdev, iobuf, -EIO );
|
|
575
|
|
- return;
|
|
576
|
|
- }
|
|
577
|
|
- iob_pull ( iobuf, sizeof ( struct ib_global_route_header ) );
|
|
578
|
|
-
|
|
579
|
565
|
if ( iob_len ( iobuf ) < sizeof ( struct ipoib_real_hdr ) ) {
|
|
580
|
566
|
DBGC ( ipoib, "IPoIB %p received data packet too short to "
|
|
581
|
567
|
"contain IPoIB header\n", ipoib );
|
|
|
@@ -590,24 +576,29 @@ static void ipoib_data_complete_recv ( struct ib_device *ibdev __unused,
|
|
590
|
576
|
netdev_rx ( netdev, iobuf );
|
|
591
|
577
|
}
|
|
592
|
578
|
|
|
|
579
|
+/** IPoIB data completion operations */
|
|
|
580
|
+static struct ib_completion_queue_operations ipoib_data_cq_op = {
|
|
|
581
|
+ .complete_send = ipoib_data_complete_send,
|
|
|
582
|
+ .complete_recv = ipoib_data_complete_recv,
|
|
|
583
|
+};
|
|
|
584
|
+
|
|
593
|
585
|
/**
|
|
594
|
586
|
* Handle IPoIB metadata send completion
|
|
595
|
587
|
*
|
|
596
|
588
|
* @v ibdev Infiniband device
|
|
597
|
589
|
* @v qp Queue pair
|
|
598
|
|
- * @v completion Completion
|
|
599
|
590
|
* @v iobuf I/O buffer
|
|
|
591
|
+ * @v rc Completion status code
|
|
600
|
592
|
*/
|
|
601
|
593
|
static void ipoib_meta_complete_send ( struct ib_device *ibdev __unused,
|
|
602
|
594
|
struct ib_queue_pair *qp,
|
|
603
|
|
- struct ib_completion *completion,
|
|
604
|
|
- struct io_buffer *iobuf ) {
|
|
|
595
|
+ struct io_buffer *iobuf, int rc ) {
|
|
605
|
596
|
struct net_device *netdev = ib_qp_get_ownerdata ( qp );
|
|
606
|
597
|
struct ipoib_device *ipoib = netdev->priv;
|
|
607
|
598
|
|
|
608
|
|
- if ( completion->syndrome ) {
|
|
609
|
|
- DBGC ( ipoib, "IPoIB %p metadata TX completion error %x\n",
|
|
610
|
|
- ipoib, completion->syndrome );
|
|
|
599
|
+ if ( rc != 0 ) {
|
|
|
600
|
+ DBGC ( ipoib, "IPoIB %p metadata TX completion error: %s\n",
|
|
|
601
|
+ ipoib, strerror ( rc ) );
|
|
611
|
602
|
}
|
|
612
|
603
|
free_iob ( iobuf );
|
|
613
|
604
|
}
|
|
|
@@ -673,31 +664,25 @@ static void ipoib_recv_mc_member_record ( struct ipoib_device *ipoib,
|
|
673
|
664
|
*
|
|
674
|
665
|
* @v ibdev Infiniband device
|
|
675
|
666
|
* @v qp Queue pair
|
|
676
|
|
- * @v completion Completion
|
|
|
667
|
+ * @v av Address vector, or NULL
|
|
677
|
668
|
* @v iobuf I/O buffer
|
|
|
669
|
+ * @v rc Completion status code
|
|
678
|
670
|
*/
|
|
679
|
|
-static void ipoib_meta_complete_recv ( struct ib_device *ibdev __unused,
|
|
680
|
|
- struct ib_queue_pair *qp,
|
|
681
|
|
- struct ib_completion *completion,
|
|
682
|
|
- struct io_buffer *iobuf ) {
|
|
|
671
|
+static void
|
|
|
672
|
+ipoib_meta_complete_recv ( struct ib_device *ibdev __unused,
|
|
|
673
|
+ struct ib_queue_pair *qp,
|
|
|
674
|
+ struct ib_address_vector *av __unused,
|
|
|
675
|
+ struct io_buffer *iobuf, int rc ) {
|
|
683
|
676
|
struct net_device *netdev = ib_qp_get_ownerdata ( qp );
|
|
684
|
677
|
struct ipoib_device *ipoib = netdev->priv;
|
|
685
|
678
|
union ib_mad *mad;
|
|
686
|
679
|
|
|
687
|
|
- if ( completion->syndrome ) {
|
|
688
|
|
- DBGC ( ipoib, "IPoIB %p metadata RX completion error %x\n",
|
|
689
|
|
- ipoib, completion->syndrome );
|
|
|
680
|
+ if ( rc != 0 ) {
|
|
|
681
|
+ DBGC ( ipoib, "IPoIB %p metadata RX completion error: %s\n",
|
|
|
682
|
+ ipoib, strerror ( rc ) );
|
|
690
|
683
|
goto done;
|
|
691
|
684
|
}
|
|
692
|
685
|
|
|
693
|
|
- iob_put ( iobuf, completion->len );
|
|
694
|
|
- if ( iob_len ( iobuf ) < sizeof ( struct ib_global_route_header ) ) {
|
|
695
|
|
- DBGC ( ipoib, "IPoIB %p received metadata packet too short "
|
|
696
|
|
- "to contain GRH\n", ipoib );
|
|
697
|
|
- DBGC_HD ( ipoib, iobuf->data, iob_len ( iobuf ) );
|
|
698
|
|
- goto done;
|
|
699
|
|
- }
|
|
700
|
|
- iob_pull ( iobuf, sizeof ( struct ib_global_route_header ) );
|
|
701
|
686
|
if ( iob_len ( iobuf ) < sizeof ( *mad ) ) {
|
|
702
|
687
|
DBGC ( ipoib, "IPoIB %p received metadata packet too short "
|
|
703
|
688
|
"to contain reply\n", ipoib );
|
|
|
@@ -730,6 +715,12 @@ static void ipoib_meta_complete_recv ( struct ib_device *ibdev __unused,
|
|
730
|
715
|
free_iob ( iobuf );
|
|
731
|
716
|
}
|
|
732
|
717
|
|
|
|
718
|
+/** IPoIB metadata completion operations */
|
|
|
719
|
+static struct ib_completion_queue_operations ipoib_meta_cq_op = {
|
|
|
720
|
+ .complete_send = ipoib_meta_complete_send,
|
|
|
721
|
+ .complete_recv = ipoib_meta_complete_recv,
|
|
|
722
|
+};
|
|
|
723
|
+
|
|
733
|
724
|
/**
|
|
734
|
725
|
* Refill IPoIB receive ring
|
|
735
|
726
|
*
|
|
|
@@ -846,10 +837,9 @@ static int ipoib_open ( struct net_device *netdev ) {
|
|
846
|
837
|
/* Allocate metadata queue set */
|
|
847
|
838
|
if ( ( rc = ipoib_create_qset ( ipoib, &ipoib->meta,
|
|
848
|
839
|
IPOIB_META_NUM_CQES,
|
|
|
840
|
+ &ipoib_meta_cq_op,
|
|
849
|
841
|
IPOIB_META_NUM_SEND_WQES,
|
|
850
|
|
- ipoib_meta_complete_send,
|
|
851
|
842
|
IPOIB_META_NUM_RECV_WQES,
|
|
852
|
|
- ipoib_meta_complete_recv,
|
|
853
|
843
|
IB_GLOBAL_QKEY ) ) != 0 ) {
|
|
854
|
844
|
DBGC ( ipoib, "IPoIB %p could not allocate metadata QP: %s\n",
|
|
855
|
845
|
ipoib, strerror ( rc ) );
|
|
|
@@ -859,10 +849,9 @@ static int ipoib_open ( struct net_device *netdev ) {
|
|
859
|
849
|
/* Allocate data queue set */
|
|
860
|
850
|
if ( ( rc = ipoib_create_qset ( ipoib, &ipoib->data,
|
|
861
|
851
|
IPOIB_DATA_NUM_CQES,
|
|
|
852
|
+ &ipoib_data_cq_op,
|
|
862
|
853
|
IPOIB_DATA_NUM_SEND_WQES,
|
|
863
|
|
- ipoib_data_complete_send,
|
|
864
|
854
|
IPOIB_DATA_NUM_RECV_WQES,
|
|
865
|
|
- ipoib_data_complete_recv,
|
|
866
|
855
|
IB_GLOBAL_QKEY ) ) != 0 ) {
|
|
867
|
856
|
DBGC ( ipoib, "IPoIB %p could not allocate data QP: %s\n",
|
|
868
|
857
|
ipoib, strerror ( rc ) );
|