Bladeren bron

[ipoib] Kill off the now-unused IPoIB metadata queue set

All packets handled by the metadata queue set now go via the GMA.
tags/v0.9.8
Michael Brown 15 jaren geleden
bovenliggende
commit
63c112ed38
1 gewijzigde bestanden met toevoegingen van 39 en 144 verwijderingen
  1. 39
    144
      src/drivers/net/ipoib.c

+ 39
- 144
src/drivers/net/ipoib.c Bestand weergeven

@@ -38,23 +38,14 @@ FILE_LICENCE ( GPL2_OR_LATER );
38 38
  * IP over Infiniband
39 39
  */
40 40
 
41
-/** Number of IPoIB data send work queue entries */
42
-#define IPOIB_DATA_NUM_SEND_WQES 2
41
+/** Number of IPoIB send work queue entries */
42
+#define IPOIB_NUM_SEND_WQES 2
43 43
 
44
-/** Number of IPoIB data receive work queue entries */
45
-#define IPOIB_DATA_NUM_RECV_WQES 4
44
+/** Number of IPoIB receive work queue entries */
45
+#define IPOIB_NUM_RECV_WQES 4
46 46
 
47
-/** Number of IPoIB data completion entries */
48
-#define IPOIB_DATA_NUM_CQES 8
49
-
50
-/** Number of IPoIB metadata send work queue entries */
51
-#define IPOIB_META_NUM_SEND_WQES 2
52
-
53
-/** Number of IPoIB metadata receive work queue entries */
54
-#define IPOIB_META_NUM_RECV_WQES 2
55
-
56
-/** Number of IPoIB metadata completion entries */
57
-#define IPOIB_META_NUM_CQES 8
47
+/** Number of IPoIB completion entries */
48
+#define IPOIB_NUM_CQES 8
58 49
 
59 50
 /** An IPoIB device */
60 51
 struct ipoib_device {
@@ -62,10 +53,8 @@ struct ipoib_device {
62 53
 	struct net_device *netdev;
63 54
 	/** Underlying Infiniband device */
64 55
 	struct ib_device *ibdev;
65
-	/** Data queue set */
66
-	struct ib_queue_set data;
67
-	/** Data queue set */
68
-	struct ib_queue_set meta;
56
+	/** Queue set */
57
+	struct ib_queue_set qset;
69 58
 	/** Broadcast MAC */
70 59
 	struct ipoib_mac broadcast;
71 60
 	/** Joined to multicast group
@@ -372,27 +361,27 @@ static int ipoib_transmit ( struct net_device *netdev,
372 361
 		return rc;
373 362
 	}
374 363
 
375
-	return ib_post_send ( ibdev, ipoib->data.qp, &av, iobuf );
364
+	return ib_post_send ( ibdev, ipoib->qset.qp, &av, iobuf );
376 365
 }
377 366
 
378 367
 /**
379
- * Handle IPoIB data send completion
368
+ * Handle IPoIB send completion
380 369
  *
381 370
  * @v ibdev		Infiniband device
382 371
  * @v qp		Queue pair
383 372
  * @v iobuf		I/O buffer
384 373
  * @v rc		Completion status code
385 374
  */
386
-static void ipoib_data_complete_send ( struct ib_device *ibdev __unused,
387
-				       struct ib_queue_pair *qp,
388
-				       struct io_buffer *iobuf, int rc ) {
375
+static void ipoib_complete_send ( struct ib_device *ibdev __unused,
376
+				  struct ib_queue_pair *qp,
377
+				  struct io_buffer *iobuf, int rc ) {
389 378
 	struct ipoib_device *ipoib = ib_qp_get_ownerdata ( qp );
390 379
 
391 380
 	netdev_tx_complete_err ( ipoib->netdev, iobuf, rc );
392 381
 }
393 382
 
394 383
 /**
395
- * Handle IPoIB data receive completion
384
+ * Handle IPoIB receive completion
396 385
  *
397 386
  * @v ibdev		Infiniband device
398 387
  * @v qp		Queue pair
@@ -400,10 +389,10 @@ static void ipoib_data_complete_send ( struct ib_device *ibdev __unused,
400 389
  * @v iobuf		I/O buffer
401 390
  * @v rc		Completion status code
402 391
  */
403
-static void ipoib_data_complete_recv ( struct ib_device *ibdev __unused,
404
-				       struct ib_queue_pair *qp,
405
-				       struct ib_address_vector *av,
406
-				       struct io_buffer *iobuf, int rc ) {
392
+static void ipoib_complete_recv ( struct ib_device *ibdev __unused,
393
+				  struct ib_queue_pair *qp,
394
+				  struct ib_address_vector *av,
395
+				  struct io_buffer *iobuf, int rc ) {
407 396
 	struct ipoib_device *ipoib = ib_qp_get_ownerdata ( qp );
408 397
 	struct net_device *netdev = ipoib->netdev;
409 398
 	struct ipoib_hdr *ipoib_hdr;
@@ -417,7 +406,7 @@ static void ipoib_data_complete_recv ( struct ib_device *ibdev __unused,
417 406
 
418 407
 	/* Sanity check */
419 408
 	if ( iob_len ( iobuf ) < sizeof ( struct ipoib_hdr ) ) {
420
-		DBGC ( ipoib, "IPoIB %p received data packet too short to "
409
+		DBGC ( ipoib, "IPoIB %p received packet too short to "
421 410
 		       "contain IPoIB header\n", ipoib );
422 411
 		DBGC_HD ( ipoib, iobuf->data, iob_len ( iobuf ) );
423 412
 		netdev_rx_err ( netdev, iobuf, -EIO );
@@ -437,85 +426,10 @@ static void ipoib_data_complete_recv ( struct ib_device *ibdev __unused,
437 426
 	netdev_rx ( netdev, iobuf );
438 427
 }
439 428
 
440
-/** IPoIB data completion operations */
441
-static struct ib_completion_queue_operations ipoib_data_cq_op = {
442
-	.complete_send = ipoib_data_complete_send,
443
-	.complete_recv = ipoib_data_complete_recv,
444
-};
445
-
446
-/**
447
- * Handle IPoIB metadata send completion
448
- *
449
- * @v ibdev		Infiniband device
450
- * @v qp		Queue pair
451
- * @v iobuf		I/O buffer
452
- * @v rc		Completion status code
453
- */
454
-static void ipoib_meta_complete_send ( struct ib_device *ibdev __unused,
455
-				       struct ib_queue_pair *qp,
456
-				       struct io_buffer *iobuf, int rc ) {
457
-	struct ipoib_device *ipoib = ib_qp_get_ownerdata ( qp );
458
-
459
-	if ( rc != 0 ) {
460
-		DBGC ( ipoib, "IPoIB %p metadata TX completion error: %s\n",
461
-		       ipoib, strerror ( rc ) );
462
-	}
463
-	free_iob ( iobuf );
464
-}
465
-
466
-/**
467
- * Handle IPoIB metadata receive completion
468
- *
469
- * @v ibdev		Infiniband device
470
- * @v qp		Queue pair
471
- * @v av		Address vector, or NULL
472
- * @v iobuf		I/O buffer
473
- * @v rc		Completion status code
474
- */
475
-static void
476
-ipoib_meta_complete_recv ( struct ib_device *ibdev __unused,
477
-			   struct ib_queue_pair *qp,
478
-			   struct ib_address_vector *av __unused,
479
-			   struct io_buffer *iobuf, int rc ) {
480
-	struct ipoib_device *ipoib = ib_qp_get_ownerdata ( qp );
481
-	struct ib_mad_sa *sa;
482
-
483
-	if ( rc != 0 ) {
484
-		DBGC ( ipoib, "IPoIB %p metadata RX completion error: %s\n",
485
-		       ipoib, strerror ( rc ) );
486
-		goto done;
487
-	}
488
-
489
-	if ( iob_len ( iobuf ) < sizeof ( *sa ) ) {
490
-		DBGC ( ipoib, "IPoIB %p received metadata packet too short "
491
-		       "to contain reply\n", ipoib );
492
-		DBGC_HD ( ipoib, iobuf->data, iob_len ( iobuf ) );
493
-		goto done;
494
-	}
495
-	sa = iobuf->data;
496
-
497
-	if ( sa->mad_hdr.status != 0 ) {
498
-		DBGC ( ipoib, "IPoIB %p metadata RX err status %04x\n",
499
-		       ipoib, ntohs ( sa->mad_hdr.status ) );
500
-		goto done;
501
-	}
502
-
503
-	switch ( sa->mad_hdr.tid[0] ) {
504
-	default:
505
-		DBGC ( ipoib, "IPoIB %p unwanted response:\n",
506
-		       ipoib );
507
-		DBGC_HD ( ipoib, sa, sizeof ( *sa ) );
508
-		break;
509
-	}
510
-
511
- done:
512
-	free_iob ( iobuf );
513
-}
514
-
515
-/** IPoIB metadata completion operations */
516
-static struct ib_completion_queue_operations ipoib_meta_cq_op = {
517
-	.complete_send = ipoib_meta_complete_send,
518
-	.complete_recv = ipoib_meta_complete_recv,
429
+/** IPoIB completion operations */
430
+static struct ib_completion_queue_operations ipoib_cq_op = {
431
+	.complete_send = ipoib_complete_send,
432
+	.complete_recv = ipoib_complete_recv,
519 433
 };
520 434
 
521 435
 /**
@@ -550,7 +464,7 @@ static void ipoib_irq ( struct net_device *netdev __unused,
550 464
 static int ipoib_join_broadcast_group ( struct ipoib_device *ipoib ) {
551 465
 	int rc;
552 466
 
553
-	if ( ( rc = ib_mcast_join ( ipoib->ibdev, ipoib->data.qp,
467
+	if ( ( rc = ib_mcast_join ( ipoib->ibdev, ipoib->qset.qp,
554 468
 				    &ipoib->broadcast.gid ) ) != 0 ) {
555 469
 		DBGC ( ipoib, "IPoIB %p could not join broadcast group: %s\n",
556 470
 		       ipoib, strerror ( rc ) );
@@ -568,9 +482,8 @@ static int ipoib_join_broadcast_group ( struct ipoib_device *ipoib ) {
568 482
  */
569 483
 static void ipoib_leave_broadcast_group ( struct ipoib_device *ipoib ) {
570 484
 
571
-	/* Detach data queue from broadcast multicast GID */
572 485
 	if ( ipoib->broadcast_joined ) {
573
-		ib_mcast_leave ( ipoib->ibdev, ipoib->data.qp,
486
+		ib_mcast_leave ( ipoib->ibdev, ipoib->qset.qp,
574 487
 				 &ipoib->broadcast.gid );
575 488
 		ipoib->broadcast_joined = 0;
576 489
 	}
@@ -595,36 +508,21 @@ static int ipoib_open ( struct net_device *netdev ) {
595 508
 		goto err_ib_open;
596 509
 	}
597 510
 
598
-	/* Allocate metadata queue set */
599
-	if ( ( rc = ib_create_qset ( ibdev, &ipoib->meta,
600
-				     IPOIB_META_NUM_CQES, &ipoib_meta_cq_op,
601
-				     IPOIB_META_NUM_SEND_WQES,
602
-				     IPOIB_META_NUM_RECV_WQES,
603
-				     IB_QKEY_GMA ) ) != 0 ) {
604
-		DBGC ( ipoib, "IPoIB %p could not allocate metadata QP: %s\n",
605
-		       ipoib, strerror ( rc ) );
606
-		goto err_create_meta_qset;
607
-	}
608
-	ib_qp_set_ownerdata ( ipoib->meta.qp, ipoib );
609
-
610
-	/* Allocate data queue set */
611
-	if ( ( rc = ib_create_qset ( ibdev, &ipoib->data,
612
-				     IPOIB_DATA_NUM_CQES, &ipoib_data_cq_op,
613
-				     IPOIB_DATA_NUM_SEND_WQES,
614
-				     IPOIB_DATA_NUM_RECV_WQES,
615
-				     IB_QKEY_GMA ) ) != 0 ) {
616
-		DBGC ( ipoib, "IPoIB %p could not allocate data QP: %s\n",
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",
617 516
 		       ipoib, strerror ( rc ) );
618
-		goto err_create_data_qset;
517
+		goto err_create_qset;
619 518
 	}
620
-	ib_qp_set_ownerdata ( ipoib->data.qp, ipoib );
519
+	ib_qp_set_ownerdata ( ipoib->qset.qp, ipoib );
621 520
 
622
-	/* Update MAC address with data QPN */
623
-	mac->qpn = htonl ( ipoib->data.qp->qpn );
521
+	/* Update MAC address with QPN */
522
+	mac->qpn = htonl ( ipoib->qset.qp->qpn );
624 523
 
625 524
 	/* Fill receive rings */
626
-	ib_refill_recv ( ibdev, ipoib->meta.qp );
627
-	ib_refill_recv ( ibdev, ipoib->data.qp );
525
+	ib_refill_recv ( ibdev, ipoib->qset.qp );
628 526
 
629 527
 	/* Join broadcast group */
630 528
 	if ( ( rc = ipoib_join_broadcast_group ( ipoib ) ) != 0 ) {
@@ -636,10 +534,8 @@ static int ipoib_open ( struct net_device *netdev ) {
636 534
 	return 0;
637 535
 
638 536
  err_join_broadcast:
639
-	ib_destroy_qset ( ibdev, &ipoib->data );
640
- err_create_data_qset:
641
-	ib_destroy_qset ( ibdev, &ipoib->meta );
642
- err_create_meta_qset:
537
+	ib_destroy_qset ( ibdev, &ipoib->qset );
538
+ err_create_qset:
643 539
 	ib_close ( ibdev );
644 540
  err_ib_open:
645 541
 	return rc;
@@ -657,12 +553,11 @@ static void ipoib_close ( struct net_device *netdev ) {
657 553
 	/* Leave broadcast group */
658 554
 	ipoib_leave_broadcast_group ( ipoib );
659 555
 
660
-	/* Remove data QPN from MAC address */
556
+	/* Remove QPN from MAC address */
661 557
 	mac->qpn = 0;
662 558
 
663 559
 	/* Tear down the queues */
664
-	ib_destroy_qset ( ipoib->ibdev, &ipoib->data );
665
-	ib_destroy_qset ( ipoib->ibdev, &ipoib->meta );
560
+	ib_destroy_qset ( ipoib->ibdev, &ipoib->qset );
666 561
 
667 562
 	/* Close IB device */
668 563
 	ib_close ( ipoib->ibdev );

Laden…
Annuleren
Opslaan