|
@@ -28,7 +28,6 @@ FILE_LICENCE ( GPL2_OR_LATER );
|
28
|
28
|
#include <gpxe/iobuf.h>
|
29
|
29
|
#include <gpxe/netdevice.h>
|
30
|
30
|
#include <gpxe/infiniband.h>
|
31
|
|
-#include <gpxe/ib_qset.h>
|
32
|
31
|
#include <gpxe/ib_pathrec.h>
|
33
|
32
|
#include <gpxe/ib_mcast.h>
|
34
|
33
|
#include <gpxe/ipoib.h>
|
|
@@ -53,8 +52,10 @@ struct ipoib_device {
|
53
|
52
|
struct net_device *netdev;
|
54
|
53
|
/** Underlying Infiniband device */
|
55
|
54
|
struct ib_device *ibdev;
|
56
|
|
- /** Queue set */
|
57
|
|
- struct ib_queue_set qset;
|
|
55
|
+ /** Completion queue */
|
|
56
|
+ struct ib_completion_queue *cq;
|
|
57
|
+ /** Queue pair */
|
|
58
|
+ struct ib_queue_pair *qp;
|
58
|
59
|
/** Broadcast MAC */
|
59
|
60
|
struct ipoib_mac broadcast;
|
60
|
61
|
/** Joined to multicast group
|
|
@@ -361,7 +362,7 @@ static int ipoib_transmit ( struct net_device *netdev,
|
361
|
362
|
return rc;
|
362
|
363
|
}
|
363
|
364
|
|
364
|
|
- return ib_post_send ( ibdev, ipoib->qset.qp, &av, iobuf );
|
|
365
|
+ return ib_post_send ( ibdev, ipoib->qp, &av, iobuf );
|
365
|
366
|
}
|
366
|
367
|
|
367
|
368
|
/**
|
|
@@ -464,7 +465,7 @@ static void ipoib_irq ( struct net_device *netdev __unused,
|
464
|
465
|
static int ipoib_join_broadcast_group ( struct ipoib_device *ipoib ) {
|
465
|
466
|
int rc;
|
466
|
467
|
|
467
|
|
- if ( ( rc = ib_mcast_join ( ipoib->ibdev, ipoib->qset.qp,
|
|
468
|
+ if ( ( rc = ib_mcast_join ( ipoib->ibdev, ipoib->qp,
|
468
|
469
|
&ipoib->broadcast.gid ) ) != 0 ) {
|
469
|
470
|
DBGC ( ipoib, "IPoIB %p could not join broadcast group: %s\n",
|
470
|
471
|
ipoib, strerror ( rc ) );
|
|
@@ -483,7 +484,7 @@ static int ipoib_join_broadcast_group ( struct ipoib_device *ipoib ) {
|
483
|
484
|
static void ipoib_leave_broadcast_group ( struct ipoib_device *ipoib ) {
|
484
|
485
|
|
485
|
486
|
if ( ipoib->broadcast_joined ) {
|
486
|
|
- ib_mcast_leave ( ipoib->ibdev, ipoib->qset.qp,
|
|
487
|
+ ib_mcast_leave ( ipoib->ibdev, ipoib->qp,
|
487
|
488
|
&ipoib->broadcast.gid );
|
488
|
489
|
ipoib->broadcast_joined = 0;
|
489
|
490
|
}
|
|
@@ -508,21 +509,31 @@ static int ipoib_open ( struct net_device *netdev ) {
|
508
|
509
|
goto err_ib_open;
|
509
|
510
|
}
|
510
|
511
|
|
511
|
|
- /* Allocate queue set */
|
512
|
|
- if ( ( rc = ib_create_qset ( ibdev, &ipoib->qset, IPOIB_NUM_CQES,
|
513
|
|
- &ipoib_cq_op, IPOIB_NUM_SEND_WQES,
|
514
|
|
- IPOIB_NUM_RECV_WQES, 0 ) ) != 0 ) {
|
515
|
|
- DBGC ( ipoib, "IPoIB %p could not allocate queue set: %s\n",
|
516
|
|
- ipoib, strerror ( rc ) );
|
517
|
|
- goto err_create_qset;
|
|
512
|
+ /* Allocate completion queue */
|
|
513
|
+ ipoib->cq = ib_create_cq ( ibdev, IPOIB_NUM_CQES, &ipoib_cq_op );
|
|
514
|
+ if ( ! ipoib->cq ) {
|
|
515
|
+ DBGC ( ipoib, "IPoIB %p could not allocate completion queue\n",
|
|
516
|
+ ipoib );
|
|
517
|
+ rc = -ENOMEM;
|
|
518
|
+ goto err_create_cq;
|
|
519
|
+ }
|
|
520
|
+
|
|
521
|
+ /* Allocate queue pair */
|
|
522
|
+ ipoib->qp = ib_create_qp ( ibdev, IPOIB_NUM_SEND_WQES, ipoib->cq,
|
|
523
|
+ IPOIB_NUM_RECV_WQES, ipoib->cq, 0 );
|
|
524
|
+ if ( ! ipoib->qp ) {
|
|
525
|
+ DBGC ( ipoib, "IPoIB %p could not allocate queue pair\n",
|
|
526
|
+ ipoib );
|
|
527
|
+ rc = -ENOMEM;
|
|
528
|
+ goto err_create_qp;
|
518
|
529
|
}
|
519
|
|
- ib_qp_set_ownerdata ( ipoib->qset.qp, ipoib );
|
|
530
|
+ ib_qp_set_ownerdata ( ipoib->qp, ipoib );
|
520
|
531
|
|
521
|
532
|
/* Update MAC address with QPN */
|
522
|
|
- mac->qpn = htonl ( ipoib->qset.qp->qpn );
|
|
533
|
+ mac->qpn = htonl ( ipoib->qp->qpn );
|
523
|
534
|
|
524
|
535
|
/* Fill receive rings */
|
525
|
|
- ib_refill_recv ( ibdev, ipoib->qset.qp );
|
|
536
|
+ ib_refill_recv ( ibdev, ipoib->qp );
|
526
|
537
|
|
527
|
538
|
/* Join broadcast group */
|
528
|
539
|
if ( ( rc = ipoib_join_broadcast_group ( ipoib ) ) != 0 ) {
|
|
@@ -533,9 +544,12 @@ static int ipoib_open ( struct net_device *netdev ) {
|
533
|
544
|
|
534
|
545
|
return 0;
|
535
|
546
|
|
|
547
|
+ ipoib_leave_broadcast_group ( ipoib );
|
536
|
548
|
err_join_broadcast:
|
537
|
|
- ib_destroy_qset ( ibdev, &ipoib->qset );
|
538
|
|
- err_create_qset:
|
|
549
|
+ ib_destroy_qp ( ibdev, ipoib->qp );
|
|
550
|
+ err_create_qp:
|
|
551
|
+ ib_destroy_cq ( ibdev, ipoib->cq );
|
|
552
|
+ err_create_cq:
|
539
|
553
|
ib_close ( ibdev );
|
540
|
554
|
err_ib_open:
|
541
|
555
|
return rc;
|
|
@@ -548,6 +562,7 @@ static int ipoib_open ( struct net_device *netdev ) {
|
548
|
562
|
*/
|
549
|
563
|
static void ipoib_close ( struct net_device *netdev ) {
|
550
|
564
|
struct ipoib_device *ipoib = netdev->priv;
|
|
565
|
+ struct ib_device *ibdev = ipoib->ibdev;
|
551
|
566
|
struct ipoib_mac *mac = ( ( struct ipoib_mac * ) netdev->ll_addr );
|
552
|
567
|
|
553
|
568
|
/* Leave broadcast group */
|
|
@@ -557,10 +572,11 @@ static void ipoib_close ( struct net_device *netdev ) {
|
557
|
572
|
mac->qpn = 0;
|
558
|
573
|
|
559
|
574
|
/* Tear down the queues */
|
560
|
|
- ib_destroy_qset ( ipoib->ibdev, &ipoib->qset );
|
|
575
|
+ ib_destroy_qp ( ibdev, ipoib->qp );
|
|
576
|
+ ib_destroy_cq ( ibdev, ipoib->cq );
|
561
|
577
|
|
562
|
578
|
/* Close IB device */
|
563
|
|
- ib_close ( ipoib->ibdev );
|
|
579
|
+ ib_close ( ibdev );
|
564
|
580
|
}
|
565
|
581
|
|
566
|
582
|
/** IPoIB network device operations */
|