[ovs-dev] [PATCH v2 3/6] dpif-netdev: Register packet processing cores for keepalive.

Bhanuprakash Bodireddy bhanuprakash.bodireddy at intel.com
Wed Apr 26 22:59:52 UTC 2017


This commit registers the packet processing cores for keepalive
monitoring. Also the pmd threads respond to heartbeats by marking
themselves alive. When the pmd thread is teared down due to datapath
reconfiguration the core state is marked as 'sleep'.

Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy at intel.com>
---
 lib/dpif-netdev.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index 41d0836..5327703 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -3249,6 +3249,14 @@ rxq_scheduling(struct dp_netdev *dp, bool pinned) OVS_REQUIRES(dp->port_mutex)
 }
 
 static void
+ka_register_core(unsigned core_id OVS_UNUSED)
+{
+#ifdef DPDK_NETDEV
+    dpdk_ka_register_core(core_id);
+#endif
+}
+
+static void
 reconfigure_pmd_threads(struct dp_netdev *dp)
     OVS_REQUIRES(dp->port_mutex)
 {
@@ -3296,6 +3304,9 @@ reconfigure_pmd_threads(struct dp_netdev *dp)
             dp_netdev_configure_pmd(pmd, dp, core->core_id, core->numa_id);
 
             pmd->thread = ovs_thread_create("pmd", pmd_thread_main, pmd);
+
+            /* Register core for KeepAlive detection. */
+            ka_register_core(core->core_id);
         }
 
         /* Log the number of pmd threads per numa node. */
@@ -3664,6 +3675,9 @@ 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);
+
+    /* Store the pmd thread_id in shared memory. */
+    dpdk_ka_get_tid(pmd->core_id);
 reload:
     emc_cache_init(&pmd->flow_cache);
 
@@ -3688,6 +3702,9 @@ reload:
                                        poll_list[i].port_no);
         }
 
+        /* Mark packet processing core alive if KeepAlive is enabled. */
+        ka_mark_core_alive();
+
         if (lc++ > 1024) {
             bool reload;
 
@@ -3718,6 +3735,8 @@ reload:
         goto reload;
     }
 
+    ka_mark_core_sleep();
+
     free(poll_list);
     pmd_free_cached_ports(pmd);
     return NULL;
-- 
2.4.11



More information about the dev mailing list