diff mbox

[ovs-dev,RFC,v3,04/18] keepalive: Add more helper functions to KA framework.

Message ID 1497813871-27572-5-git-send-email-bhanuprakash.bodireddy@intel.com
State RFC
Headers show

Commit Message

Bodireddy, Bhanuprakash June 18, 2017, 7:24 p.m. UTC
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@intel.com>
---
 lib/keepalive.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
 lib/keepalive.h |  9 +++++++++
 2 files changed, 58 insertions(+)
diff mbox

Patch

diff --git a/lib/keepalive.c b/lib/keepalive.c
index 7d1c01c..747d947 100644
--- a/lib/keepalive.c
+++ b/lib/keepalive.c
@@ -50,6 +50,55 @@  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;
+}
+
+inline int
+get_ka_init_status(void)
+{
+    return ka_init_status;
+}
+
+/* Register packet processing PMD thread to KA framework. */
+void
+ka_register_pmd_thread(int tid OVS_UNUSED, unsigned core_id)
+{
+    if (ka_is_enabled()) {
+        dpdk_register_pmd_core(core_id);
+    }
+}
+
+/* Unregister packet processing PMD thread from KA framework. */
+void
+ka_unregister_pmd_thread(int tid OVS_UNUSED, unsigned core_id)
+{
+    if (ka_is_enabled()) {
+        dpdk_unregister_pmd_core(core_id);
+    }
+}
+
+/* Mark packet processing core alive. */
+inline 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..a35b309 100644
--- a/lib/keepalive.h
+++ b/lib/keepalive.h
@@ -71,4 +71,13 @@  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, unsigned);
+void ka_unregister_pmd_thread(int, 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);
+int ka_get_pmd_tid(unsigned core);
+
 #endif /* keepalive.h */