diff --git a/src/net/infiniband.c b/src/net/infiniband.c index 2e3d76d54..c059fe8c4 100644 --- a/src/net/infiniband.c +++ b/src/net/infiniband.c @@ -37,6 +37,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ); #include #include #include +#include #include #include #include @@ -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; }