@@ -78,3 +78,9 @@ dpdk_mark_pmd_core_sleep(void)
{
/* Nothing */
}
+
+void
+dpdk_dispatch_pmd_hb(void)
+{
+ /* Nothing */
+}
@@ -542,3 +542,10 @@ dpdk_mark_pmd_core_sleep(void)
{
rte_keepalive_mark_sleep(rte_global_keepalive_info);
}
+
+/* Dispatch pings */
+void
+dpdk_dispatch_pmd_hb(void)
+{
+ rte_keepalive_dispatch_pings(NULL, rte_global_keepalive_info);
+}
@@ -47,4 +47,6 @@ void dpdk_unregister_pmd_core(unsigned core_id);
void dpdk_mark_pmd_core_alive(void);
void dpdk_mark_pmd_core_sleep(void);
+void dpdk_dispatch_pmd_hb(void);
+
#endif /* dpdk.h */
@@ -971,11 +971,18 @@ sorted_poll_thread_list(struct dp_netdev *dp,
}
static void *
-ovs_keepalive(void *f_ OVS_UNUSED)
+ovs_keepalive(void *f_)
{
+ struct dp_netdev *dp = f_;
+
pthread_detach(pthread_self());
for (;;) {
+ int n_pmds = cmap_count(&dp->poll_threads) - 1;
+ if (n_pmds > 0) {
+ dispatch_heartbeats();
+ }
+
ovsrcu_quiesce_start();
usleep(get_ka_interval() * 1000);
ovsrcu_quiesce_end();
@@ -249,6 +249,15 @@ ka_destroy_portstats(void)
}
}
+/* Dispatch pings */
+void
+dispatch_heartbeats(void)
+{
+#ifdef DPDK_NETDEV
+ dpdk_dispatch_pmd_hb();
+#endif
+}
+
static struct keepalive_info *
keepalive_info_create(void)
{
@@ -101,4 +101,5 @@ int get_ka_init_status(void);
int ka_alloc_portstats(unsigned, int);
void ka_destroy_portstats(void);
+void dispatch_heartbeats(void);
#endif /* keepalive.h */
This commit adds heartbeat mechanism support for DPDK datapath. Heartbeats are sent to registered PMD threads at predefined intervals (as set in ovsdb with 'keepalive-interval'). The heartbeats are only enabled when there is atleast one port added to the bridge and with active PMD thread polling the port. Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com> --- lib/dpdk-stub.c | 6 ++++++ lib/dpdk.c | 7 +++++++ lib/dpdk.h | 2 ++ lib/dpif-netdev.c | 9 ++++++++- lib/keepalive.c | 9 +++++++++ lib/keepalive.h | 1 + 6 files changed, 33 insertions(+), 1 deletion(-)