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

Submitted by Bhanuprakash Bodireddy on Aug. 4, 2017, 8:07 a.m.

Details

Message ID 1501834086-31829-7-git-send-email-bhanuprakash.bodireddy@intel.com
State New
Headers show

Commit Message

Bhanuprakash Bodireddy Aug. 4, 2017, 8:07 a.m.
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(+)

Patch hide | download patch | download mbox

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 8ecc9d1..b51674f 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -49,6 +49,7 @@ 
 #include "flow.h"
 #include "hmapx.h"
 #include "id-pool.h"
+#include "keepalive.h"
 #include "latch.h"
 #include "netdev.h"
 #include "netdev-vport.h"
@@ -3824,6 +3825,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 66c969d..0087e5c 100644
--- a/lib/keepalive.c
+++ b/lib/keepalive.c
@@ -62,6 +62,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);