]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[infiniband] Profile post work queue entry operations
authorMichael Brown <mcb30@ipxe.org>
Sun, 10 Jan 2016 15:44:00 +0000 (15:44 +0000)
committerMichael Brown <mcb30@ipxe.org>
Sun, 10 Jan 2016 15:44:00 +0000 (15:44 +0000)
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/net/infiniband.c

index 2e3d76d541cdaadaec09921cfa0e235b685fafef..c059fe8c47a8ff161614245faa03e34df178af80 100644 (file)
@@ -37,6 +37,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
 #include <ipxe/netdevice.h>
 #include <ipxe/iobuf.h>
 #include <ipxe/process.h>
+#include <ipxe/profile.h>
 #include <ipxe/infiniband.h>
 #include <ipxe/ib_mi.h>
 #include <ipxe/ib_sma.h>
@@ -53,6 +54,14 @@ struct list_head ib_devices = LIST_HEAD_INIT ( ib_devices );
 /** List of open Infiniband devices, in reverse order of opening */
 static struct list_head open_ib_devices = LIST_HEAD_INIT ( open_ib_devices );
 
+/** Post send work queue entry profiler */
+static struct profiler ib_post_send_profiler __profiler =
+       { .name = "ib.post_send" };
+
+/** Post receive work queue entry profiler */
+static struct profiler ib_post_recv_profiler __profiler =
+       { .name = "ib.post_recv" };
+
 /* Disambiguate the various possible EINPROGRESSes */
 #define EINPROGRESS_INIT __einfo_error ( EINFO_EINPROGRESS_INIT )
 #define EINFO_EINPROGRESS_INIT __einfo_uniqify \
@@ -397,6 +406,9 @@ int ib_post_send ( struct ib_device *ibdev, struct ib_queue_pair *qp,
        struct ib_address_vector dest_copy;
        int rc;
 
+       /* Start profiling */
+       profile_start ( &ib_post_send_profiler );
+
        /* Check queue fill level */
        if ( qp->send.fill >= qp->send.num_wqes ) {
                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,
                return rc;
        }
 
+       /* Increase fill level */
        qp->send.fill++;
+
+       /* Stop profiling */
+       profile_stop ( &ib_post_send_profiler );
+
        return 0;
 }
 
@@ -441,6 +458,9 @@ int ib_post_recv ( struct ib_device *ibdev, struct ib_queue_pair *qp,
                   struct io_buffer *iobuf ) {
        int rc;
 
+       /* Start profiling */
+       profile_start ( &ib_post_recv_profiler );
+
        /* Check packet length */
        if ( iob_tailroom ( iobuf ) < IB_MAX_PAYLOAD_SIZE ) {
                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,
                return rc;
        }
 
+       /* Increase fill level */
        qp->recv.fill++;
+
+       /* Stop profiling */
+       profile_stop ( &ib_post_recv_profiler );
+
        return 0;
 }