diff mbox

[ovs-dev,RFC,v3,05/18] dpif-netdev: Add helper function to store datapath tids.

Message ID 1497813871-27572-6-git-send-email-bhanuprakash.bodireddy@intel.com
State RFC
Headers show

Commit Message

Bodireddy, Bhanuprakash June 18, 2017, 7:24 p.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 2b65dc7..ce141e8 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"
@@ -3708,6 +3709,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 747d947..54faf49 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 packet processing PMD thread to KA framework. */
 void
 ka_register_pmd_thread(int tid OVS_UNUSED, unsigned core_id)
diff --git a/lib/keepalive.h b/lib/keepalive.h
index a35b309..67f89da 100644
--- a/lib/keepalive.h
+++ b/lib/keepalive.h
@@ -76,6 +76,7 @@  void ka_unregister_pmd_thread(int, 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);
 int ka_get_pmd_tid(unsigned core);