Ver código fonte

[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 anos atrás
pai
commit
63c112ed38
1 arquivos alterados com 39 adições e 144 exclusões
  1. 39
    144
      src/drivers/net/ipoib.c

+ 39
- 144
src/drivers/net/ipoib.c Ver arquivo

38
  * IP over Infiniband
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
 /** An IPoIB device */
50
 /** An IPoIB device */
60
 struct ipoib_device {
51
 struct ipoib_device {
62
 	struct net_device *netdev;
53
 	struct net_device *netdev;
63
 	/** Underlying Infiniband device */
54
 	/** Underlying Infiniband device */
64
 	struct ib_device *ibdev;
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
 	/** Broadcast MAC */
58
 	/** Broadcast MAC */
70
 	struct ipoib_mac broadcast;
59
 	struct ipoib_mac broadcast;
71
 	/** Joined to multicast group
60
 	/** Joined to multicast group
372
 		return rc;
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
  * @v ibdev		Infiniband device
370
  * @v ibdev		Infiniband device
382
  * @v qp		Queue pair
371
  * @v qp		Queue pair
383
  * @v iobuf		I/O buffer
372
  * @v iobuf		I/O buffer
384
  * @v rc		Completion status code
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
 	struct ipoib_device *ipoib = ib_qp_get_ownerdata ( qp );
378
 	struct ipoib_device *ipoib = ib_qp_get_ownerdata ( qp );
390
 
379
 
391
 	netdev_tx_complete_err ( ipoib->netdev, iobuf, rc );
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
  * @v ibdev		Infiniband device
386
  * @v ibdev		Infiniband device
398
  * @v qp		Queue pair
387
  * @v qp		Queue pair
400
  * @v iobuf		I/O buffer
389
  * @v iobuf		I/O buffer
401
  * @v rc		Completion status code
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
 	struct ipoib_device *ipoib = ib_qp_get_ownerdata ( qp );
396
 	struct ipoib_device *ipoib = ib_qp_get_ownerdata ( qp );
408
 	struct net_device *netdev = ipoib->netdev;
397
 	struct net_device *netdev = ipoib->netdev;
409
 	struct ipoib_hdr *ipoib_hdr;
398
 	struct ipoib_hdr *ipoib_hdr;
417
 
406
 
418
 	/* Sanity check */
407
 	/* Sanity check */
419
 	if ( iob_len ( iobuf ) < sizeof ( struct ipoib_hdr ) ) {
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
 		       "contain IPoIB header\n", ipoib );
410
 		       "contain IPoIB header\n", ipoib );
422
 		DBGC_HD ( ipoib, iobuf->data, iob_len ( iobuf ) );
411
 		DBGC_HD ( ipoib, iobuf->data, iob_len ( iobuf ) );
423
 		netdev_rx_err ( netdev, iobuf, -EIO );
412
 		netdev_rx_err ( netdev, iobuf, -EIO );
437
 	netdev_rx ( netdev, iobuf );
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
 static int ipoib_join_broadcast_group ( struct ipoib_device *ipoib ) {
464
 static int ipoib_join_broadcast_group ( struct ipoib_device *ipoib ) {
551
 	int rc;
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
 				    &ipoib->broadcast.gid ) ) != 0 ) {
468
 				    &ipoib->broadcast.gid ) ) != 0 ) {
555
 		DBGC ( ipoib, "IPoIB %p could not join broadcast group: %s\n",
469
 		DBGC ( ipoib, "IPoIB %p could not join broadcast group: %s\n",
556
 		       ipoib, strerror ( rc ) );
470
 		       ipoib, strerror ( rc ) );
568
  */
482
  */
569
 static void ipoib_leave_broadcast_group ( struct ipoib_device *ipoib ) {
483
 static void ipoib_leave_broadcast_group ( struct ipoib_device *ipoib ) {
570
 
484
 
571
-	/* Detach data queue from broadcast multicast GID */
572
 	if ( ipoib->broadcast_joined ) {
485
 	if ( ipoib->broadcast_joined ) {
573
-		ib_mcast_leave ( ipoib->ibdev, ipoib->data.qp,
486
+		ib_mcast_leave ( ipoib->ibdev, ipoib->qset.qp,
574
 				 &ipoib->broadcast.gid );
487
 				 &ipoib->broadcast.gid );
575
 		ipoib->broadcast_joined = 0;
488
 		ipoib->broadcast_joined = 0;
576
 	}
489
 	}
595
 		goto err_ib_open;
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
 		       ipoib, strerror ( rc ) );
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
 	/* Fill receive rings */
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
 	/* Join broadcast group */
527
 	/* Join broadcast group */
630
 	if ( ( rc = ipoib_join_broadcast_group ( ipoib ) ) != 0 ) {
528
 	if ( ( rc = ipoib_join_broadcast_group ( ipoib ) ) != 0 ) {
636
 	return 0;
534
 	return 0;
637
 
535
 
638
  err_join_broadcast:
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
 	ib_close ( ibdev );
539
 	ib_close ( ibdev );
644
  err_ib_open:
540
  err_ib_open:
645
 	return rc;
541
 	return rc;
657
 	/* Leave broadcast group */
553
 	/* Leave broadcast group */
658
 	ipoib_leave_broadcast_group ( ipoib );
554
 	ipoib_leave_broadcast_group ( ipoib );
659
 
555
 
660
-	/* Remove data QPN from MAC address */
556
+	/* Remove QPN from MAC address */
661
 	mac->qpn = 0;
557
 	mac->qpn = 0;
662
 
558
 
663
 	/* Tear down the queues */
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
 	/* Close IB device */
562
 	/* Close IB device */
668
 	ib_close ( ipoib->ibdev );
563
 	ib_close ( ipoib->ibdev );

Carregando…
Cancelar
Salvar