[ovs-dev] [PATCH 3/7] dpif: hook timer event api in datapath functions

Gowrishankar Muthukrishnan gmuthukr at redhat.com
Tue Jun 2 10:09:45 UTC 2020


This patch injects timing some important functions as listed
below in datapath. This can be expanded but the list is short
for now.

Signed-off-by: Gowrishankar Muthukrishnan <gmuthukr at redhat.com>
---
 lib/dpif-netdev.c | 5 ++++-
 lib/netdev-dpdk.c | 3 +++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 51c8885..4db07c4 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -20,6 +20,7 @@
 
 #include <ctype.h>
 #include <errno.h>
+#include <event.h>
 #include <fcntl.h>
 #include <inttypes.h>
 #include <net/if.h>
@@ -4297,7 +4298,9 @@ dp_netdev_pmd_flush_output_on_port(struct dp_netdev_pmd_thread *pmd,
     output_cnt = dp_packet_batch_size(&p->output_pkts);
     ovs_assert(output_cnt > 0);
 
-    netdev_send(p->port->netdev, tx_qid, &p->output_pkts, dynamic_txqs);
+    EVENT_FUNC_TIMER_TRY(netdev_send,
+                         p->port->netdev,
+                         tx_qid, &p->output_pkts, dynamic_txqs);
     dp_packet_batch_init(&p->output_pkts);
 
     /* Update time of the next flush. */
diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index 44ebf96..3493b05 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -17,6 +17,7 @@
 #include <config.h>
 #include "netdev-dpdk.h"
 
+#include <event.h>
 #include <errno.h>
 #include <signal.h>
 #include <stdlib.h>
@@ -2605,6 +2606,8 @@ __netdev_dpdk_vhost_send(struct netdev *netdev, int qid,
         unsigned int tx_pkts;
 
         tx_pkts = rte_vhost_enqueue_burst(vid, vhost_qid, cur_pkts, cnt);
+        EVENT_RETFUNC_TIMER_TRY(tx_pkts, rte_vhost_enqueue_burst,
+                            vid, vhost_qid, cur_pkts, cnt);
         if (OVS_LIKELY(tx_pkts)) {
             /* Packets have been sent.*/
             cnt -= tx_pkts;
-- 
1.8.3.1



More information about the dev mailing list