[ovs-dev] [PATCH v3 05/19] keepalive: Add more helper functions to KA framework.

Bhanuprakash Bodireddy bhanuprakash.bodireddy at intel.com
Fri Aug 4 08:07:52 UTC 2017


This commit introduces helper functions in 'keepalive' module that are
needed to register/unregister PMD threads to KA framework. Also
introduce APIs to mark the PMD core states.

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy at intel.com>
---
 lib/keepalive.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++
 lib/keepalive.h |  8 ++++++++
 2 files changed, 59 insertions(+)

diff --git a/lib/keepalive.c b/lib/keepalive.c
index e93dc99..66c969d 100644
--- a/lib/keepalive.c
+++ b/lib/keepalive.c
@@ -49,6 +49,57 @@ ka_get_pmd_tid(unsigned core_idx)
     return tid;
 }
 
+/* Return the Keepalive timer interval. */
+inline uint32_t
+get_ka_interval(void)
+{
+    return keepalive_timer_interval;
+}
+
+int
+get_ka_init_status(void)
+{
+    return ka_init_status;
+}
+
+/* Register thread to KA framework. */
+void
+ka_register_pmd_thread(int tid OVS_UNUSED, bool thread_is_pmd OVS_UNUSED,
+                       unsigned core_id)
+{
+    if (ka_is_enabled()) {
+        dpdk_register_pmd_core(core_id);
+    }
+}
+
+/* Unregister thread from KA framework. */
+void
+ka_unregister_pmd_thread(int tid OVS_UNUSED, bool thread_is_pmd OVS_UNUSED,
+                         unsigned core_id)
+{
+    if (ka_is_enabled()) {
+        dpdk_unregister_pmd_core(core_id);
+    }
+}
+
+/* Mark packet processing core alive. */
+void
+ka_mark_pmd_thread_alive(void)
+{
+    if (ka_is_enabled()) {
+        dpdk_mark_pmd_core_alive();
+    }
+}
+
+/* Mark packet processing core as idle. */
+inline void
+ka_mark_pmd_thread_sleep(void)
+{
+    if (ka_is_enabled()) {
+        dpdk_mark_pmd_core_sleep();
+    }
+}
+
 void
 ka_set_pmd_state_ts(unsigned core_id, enum keepalive_state state,
                     uint64_t last_alive)
diff --git a/lib/keepalive.h b/lib/keepalive.h
index b87b66f..c96f2d0 100644
--- a/lib/keepalive.h
+++ b/lib/keepalive.h
@@ -71,4 +71,12 @@ void ka_set_pmd_state_ts(unsigned, enum keepalive_state, uint64_t);
 
 int ka_get_pmd_tid(unsigned core);
 bool ka_is_enabled(void);
+void ka_register_pmd_thread(int, bool, unsigned);
+void ka_unregister_pmd_thread(int, bool, unsigned);
+void ka_mark_pmd_thread_alive(void);
+void ka_mark_pmd_thread_sleep(void);
+
+uint32_t get_ka_interval(void);
+int get_ka_init_status(void);
+
 #endif /* keepalive.h */
-- 
2.4.11



More information about the dev mailing list