diff mbox

[ovs-dev,v2,06/19] dpif-netdev: Add helper function to store datapath tids.

Message ID 1500621850-3818-7-git-send-email-bhanuprakash.bodireddy@intel.com
State Superseded
Headers show

Commit Message

Bodireddy, Bhanuprakash July 21, 2017, 7:23 a.m. UTC
This commit adds an API to store the PMD thread ids in to KA info struct.
The thread ids shall be used to check false positives and for status and
statistics reporting.

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

Patch

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 47a9fa0..2ec0fc9 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -48,6 +48,7 @@ 
 #include "fat-rwlock.h"
 #include "flow.h"
 #include "hmapx.h"
+#include "keepalive.h"
 #include "latch.h"
 #include "netdev.h"
 #include "netdev-vport.h"
@@ -3723,6 +3724,8 @@  pmd_thread_main(void *f_)
 
     poll_list = NULL;
 
+    ka_store_pmd_id(pmd->core_id);
+
     /* Stores the pmd thread's 'pmd' to 'per_pmd_key'. */
     ovsthread_setspecific(pmd->dp->per_pmd_key, pmd);
     ovs_numa_thread_setaffinity_core(pmd->core_id);
diff --git a/lib/keepalive.c b/lib/keepalive.c
index 80e47ef..da58663 100644
--- a/lib/keepalive.c
+++ b/lib/keepalive.c
@@ -63,6 +63,19 @@  get_ka_init_status(void)
     return ka_init_status;
 }
 
+void
+ka_store_pmd_id(unsigned core_idx)
+{
+    int tid = -1;
+#ifdef DPDK_NETDEV
+    tid = rte_sys_gettid();
+#endif
+
+    if (ka_is_enabled()) {
+        ka_info->thread_id[core_idx] = tid;
+    }
+}
+
 /* Register thread to KA framework. */
 void
 ka_register_pmd_thread(int tid OVS_UNUSED, bool thread_is_pmd OVS_UNUSED,
diff --git a/lib/keepalive.h b/lib/keepalive.h
index c96f2d0..f74b23a 100644
--- a/lib/keepalive.h
+++ b/lib/keepalive.h
@@ -76,6 +76,7 @@  void ka_unregister_pmd_thread(int, bool, unsigned);
 void ka_mark_pmd_thread_alive(void);
 void ka_mark_pmd_thread_sleep(void);
 
+void ka_store_pmd_id(unsigned core);
 uint32_t get_ka_interval(void);
 int get_ka_init_status(void);