[ovs-dev] [RFC PATCH v2 07/19] dpif-netdev: Enable heartbeats for DPDK datapath.

Bhanuprakash Bodireddy bhanuprakash.bodireddy at intel.com
Mon Jun 12 16:49:35 UTC 2017


This commit adds heartbeat mechanism support for DPDK datapath. Heartbeats
are sent to registered PMD threads at predefined intervals (as set in ovsdb
with 'keepalive-interval').

The heartbeats are only enabled when there is atleast one port added to
the bridge and with active PMD thread polling the port.

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy at intel.com>
---
 lib/dpdk-stub.c   | 6 ++++++
 lib/dpdk.c        | 7 +++++++
 lib/dpdk.h        | 2 ++
 lib/dpif-netdev.c | 5 +++++
 4 files changed, 20 insertions(+)

diff --git a/lib/dpdk-stub.c b/lib/dpdk-stub.c
index d7fb19b..3353ddd 100644
--- a/lib/dpdk-stub.c
+++ b/lib/dpdk-stub.c
@@ -72,3 +72,9 @@ dpdk_mark_pmd_core_sleep(void)
 {
     /* Nothing */
 }
+
+void
+dispatch_heartbeats(void)
+{
+    /* Nothing */
+}
diff --git a/lib/dpdk.c b/lib/dpdk.c
index 3f5669b..8a9132a 100644
--- a/lib/dpdk.c
+++ b/lib/dpdk.c
@@ -543,3 +543,10 @@ dpdk_mark_pmd_core_sleep(void)
 {
     rte_keepalive_mark_sleep(rte_global_keepalive_info);
 }
+
+/* Dispatch pings */
+void
+dispatch_heartbeats(void)
+{
+    rte_keepalive_dispatch_pings(NULL, rte_global_keepalive_info);
+}
diff --git a/lib/dpdk.h b/lib/dpdk.h
index dc830c4..7b7f06f 100644
--- a/lib/dpdk.h
+++ b/lib/dpdk.h
@@ -47,4 +47,6 @@ void dpdk_unregister_pmd_core(unsigned core_id);
 void dpdk_mark_pmd_core_alive(void);
 void dpdk_mark_pmd_core_sleep(void);
 
+void dispatch_heartbeats(void);
+
 #endif /* dpdk.h */
diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 2607b9a..97c3807 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -978,6 +978,11 @@ ovs_keepalive(void *f_)
     pthread_detach(pthread_self());
 
     for (;;) {
+        int n_pmds = cmap_count(&dp->poll_threads) - 1;
+        if (n_pmds > 0) {
+            dispatch_heartbeats();
+        }
+
         ovsrcu_quiesce_start();
         usleep(get_ka_interval() * 1000);
         ovsrcu_quiesce_end();
-- 
2.4.11



More information about the dev mailing list