[ovs-dev] [PATCH 07/20] dpif-netdev: Add helper function to store datapath tids.

Bhanuprakash Bodireddy bhanuprakash.bodireddy at intel.com
Mon Jul 3 20:27:20 UTC 2017


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 at intel.com>
---
 lib/dpif-netdev.c |  3 +++
 lib/keepalive.c   | 13 +++++++++++++
 lib/keepalive.h   |  1 +
 3 files changed, 17 insertions(+)

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 4e29085..55a658c 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"
@@ -3707,6 +3708,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);
 
-- 
2.4.11



More information about the dev mailing list