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 <[email protected]> --- lib/keepalive.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ lib/keepalive.h | 9 +++++++++ 2 files changed, 65 insertions(+) diff --git a/lib/keepalive.c b/lib/keepalive.c index 0de6f49..33ddd00 100644 --- a/lib/keepalive.c +++ b/lib/keepalive.c @@ -48,6 +48,62 @@ get_ka_shm(void) return ka_shm; } +/* If KA enabled return true, otherwise 'false'. */ +inline bool +is_ka_enabled(void) +{ + return keepalive_enable; +} + +/* 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 core 'core_id' for liveness checks. */ +void +ka_register_pmd_thread(unsigned core_id) +{ + if (is_ka_enabled()) { + dpdk_register_pmd_core(core_id); + } +} + +/* Register packet processing core 'core_id' for liveness checks. */ +void +ka_unregister_pmd_thread(unsigned core_id) +{ + if (is_ka_enabled()) { + dpdk_unregister_pmd_core(core_id); + } +} + +/* Mark packet processing core alive. */ +inline void +ka_mark_pmd_thread_alive(void) +{ + if (is_ka_enabled()) { + dpdk_mark_pmd_core_alive(); + } +} + +/* Mark packet processing core as idle. */ +inline void +ka_mark_pmd_thread_sleep(void) +{ + if (is_ka_enabled()) { + dpdk_mark_pmd_core_sleep(); + } +} + /* Retrieve and return the keepalive timer interval from OVSDB. */ static uint32_t get_ka_timer_interval(const struct smap *ovs_other_config OVS_UNUSED) diff --git a/lib/keepalive.h b/lib/keepalive.h index 15407b7..920e934 100644 --- a/lib/keepalive.h +++ b/lib/keepalive.h @@ -56,4 +56,13 @@ enum keepalive_status { void ka_init(const struct smap *); struct keepalive_shm *get_ka_shm(void); +void ka_register_pmd_thread(unsigned); +void ka_unregister_pmd_thread(unsigned); +void ka_mark_pmd_thread_alive(void); +void ka_mark_pmd_thread_sleep(void); + +bool is_ka_enabled(void); +uint32_t get_ka_interval(void); +int get_ka_init_status(void); + #endif /* keepalive.h */ -- 2.4.11 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
