[ovs-dev] [RFC PATCH v2 12/19] dpif-netdev: Add helper function to check false positives.

Bhanuprakash Bodireddy bhanuprakash.bodireddy at intel.com
Mon Jun 12 16:49:40 UTC 2017


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

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index c76c74c..81b6111 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_store_pmd_id(pmd->core_id);
 reload:
     emc_cache_init(&pmd->flow_cache);
 
diff --git a/lib/keepalive.c b/lib/keepalive.c
index 974d17a..0c3c144 100644
--- a/lib/keepalive.c
+++ b/lib/keepalive.c
@@ -75,6 +75,29 @@ get_ka_init_status(void)
     return ka_init_status;
 }
 
+void
+ka_store_pmd_id(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;
+    }
+}
+
+uint32_t
+ka_get_tid(unsigned core_idx)
+{
+    uint32_t tid = 0;
+    if (ka_shm) {
+        tid = ka_shm->thread_id[core_idx];
+    }
+    return 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 6e0a1c6..dbc787e 100644
--- a/lib/keepalive.h
+++ b/lib/keepalive.h
@@ -62,6 +62,8 @@ void ka_unregister_pmd_thread(unsigned);
 void ka_mark_pmd_thread_alive(void);
 void ka_mark_pmd_thread_sleep(void);
 
+void ka_store_pmd_id(unsigned core);
+uint32_t 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



More information about the dev mailing list