Browse Source

[infiniband] Profile post work queue entry operations

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 8 years ago
parent
commit
7c6858e95d
1 changed files with 25 additions and 0 deletions
  1. 25
    0
      src/net/infiniband.c

+ 25
- 0
src/net/infiniband.c View File

@@ -37,6 +37,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
37 37
 #include <ipxe/netdevice.h>
38 38
 #include <ipxe/iobuf.h>
39 39
 #include <ipxe/process.h>
40
+#include <ipxe/profile.h>
40 41
 #include <ipxe/infiniband.h>
41 42
 #include <ipxe/ib_mi.h>
42 43
 #include <ipxe/ib_sma.h>
@@ -53,6 +54,14 @@ struct list_head ib_devices = LIST_HEAD_INIT ( ib_devices );
53 54
 /** List of open Infiniband devices, in reverse order of opening */
54 55
 static struct list_head open_ib_devices = LIST_HEAD_INIT ( open_ib_devices );
55 56
 
57
+/** Post send work queue entry profiler */
58
+static struct profiler ib_post_send_profiler __profiler =
59
+	{ .name = "ib.post_send" };
60
+
61
+/** Post receive work queue entry profiler */
62
+static struct profiler ib_post_recv_profiler __profiler =
63
+	{ .name = "ib.post_recv" };
64
+
56 65
 /* Disambiguate the various possible EINPROGRESSes */
57 66
 #define EINPROGRESS_INIT __einfo_error ( EINFO_EINPROGRESS_INIT )
58 67
 #define EINFO_EINPROGRESS_INIT __einfo_uniqify \
@@ -397,6 +406,9 @@ int ib_post_send ( struct ib_device *ibdev, struct ib_queue_pair *qp,
397 406
 	struct ib_address_vector dest_copy;
398 407
 	int rc;
399 408
 
409
+	/* Start profiling */
410
+	profile_start ( &ib_post_send_profiler );
411
+
400 412
 	/* Check queue fill level */
401 413
 	if ( qp->send.fill >= qp->send.num_wqes ) {
402 414
 		DBGC ( ibdev, "IBDEV %p QPN %#lx send queue full\n",
@@ -425,7 +437,12 @@ int ib_post_send ( struct ib_device *ibdev, struct ib_queue_pair *qp,
425 437
 		return rc;
426 438
 	}
427 439
 
440
+	/* Increase fill level */
428 441
 	qp->send.fill++;
442
+
443
+	/* Stop profiling */
444
+	profile_stop ( &ib_post_send_profiler );
445
+
429 446
 	return 0;
430 447
 }
431 448
 
@@ -441,6 +458,9 @@ int ib_post_recv ( struct ib_device *ibdev, struct ib_queue_pair *qp,
441 458
 		   struct io_buffer *iobuf ) {
442 459
 	int rc;
443 460
 
461
+	/* Start profiling */
462
+	profile_start ( &ib_post_recv_profiler );
463
+
444 464
 	/* Check packet length */
445 465
 	if ( iob_tailroom ( iobuf ) < IB_MAX_PAYLOAD_SIZE ) {
446 466
 		DBGC ( ibdev, "IBDEV %p QPN %#lx wrong RX buffer size (%zd)\n",
@@ -462,7 +482,12 @@ int ib_post_recv ( struct ib_device *ibdev, struct ib_queue_pair *qp,
462 482
 		return rc;
463 483
 	}
464 484
 
485
+	/* Increase fill level */
465 486
 	qp->recv.fill++;
487
+
488
+	/* Stop profiling */
489
+	profile_stop ( &ib_post_recv_profiler );
490
+
466 491
 	return 0;
467 492
 }
468 493
 

Loading…
Cancel
Save