This commit adds an API to store the PMD thread id in SHM block.
The tid later shall be retrieved by callback function that gets invoked to
check for false positives.

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodire...@intel.com>
---
 lib/dpif-netdev.c |  1 +
 lib/keepalive.c   | 13 +++++++++++++
 lib/keepalive.h   |  1 +
 3 files changed, 15 insertions(+)

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index c76c74c..6ac1bd3 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -3778,6 +3778,7 @@ pmd_thread_main(void *f_)
     ovs_numa_thread_setaffinity_core(pmd->core_id);
     dpdk_set_lcore_id(pmd->core_id);
     poll_cnt = pmd_load_queues_and_ports(pmd, &poll_list);
+    ka_get_tid(pmd->core_id);
 reload:
     emc_cache_init(&pmd->flow_cache);
 
diff --git a/lib/keepalive.c b/lib/keepalive.c
index d74b4ab..da830ab 100644
--- a/lib/keepalive.c
+++ b/lib/keepalive.c
@@ -75,6 +75,19 @@ get_ka_init_status(void)
     return ka_init_status;
 }
 
+void
+ka_get_tid(unsigned core_idx)
+{
+    uint32_t tid = 0;
+#ifdef DPDK_NETDEV
+    tid = rte_sys_gettid();
+#endif
+
+    if (is_ka_enabled()) {
+        ka_shm->thread_id[core_idx] = tid;
+    }
+}
+
 /* Register packet processing core 'core_id' for liveness checks. */
 void
 ka_register_pmd_thread(unsigned core_id)
diff --git a/lib/keepalive.h b/lib/keepalive.h
index 1d37050..63f35f0 100644
--- a/lib/keepalive.h
+++ b/lib/keepalive.h
@@ -61,6 +61,7 @@ void ka_unregister_pmd_thread(unsigned);
 void ka_mark_pmd_thread_alive(void);
 void ka_mark_pmd_thread_sleep(void);
 
+void ka_get_tid(unsigned core);
 bool is_ka_enabled(void);
 uint32_t get_ka_interval(void);
 int get_ka_init_status(void);
-- 
2.4.11

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to