@@ -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();
+ }
+}
+
void
ka_set_pmd_state_ts(unsigned core_id, enum keepalive_state state,
uint64_t last_alive)
@@ -57,4 +57,13 @@ void ka_init(const struct smap *);
struct keepalive_shm *get_ka_shm(void);
void ka_set_pmd_state_ts(unsigned, enum keepalive_state, uint64_t);
+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 */
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 | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ lib/keepalive.h | 9 +++++++++ 2 files changed, 65 insertions(+)