@@ -48,3 +48,27 @@ dpdk_get_vhost_sock_dir(void)
{
return NULL;
}
+
+void
+dpdk_register_pmd_core(unsigned core_id OVS_UNUSED)
+{
+ /* Nothing */
+}
+
+void
+dpdk_unregister_pmd_core(unsigned core_id OVS_UNUSED)
+{
+ /* Nothing */
+}
+
+void
+dpdk_mark_pmd_core_alive(void)
+{
+ /* Nothing */
+}
+
+void
+dpdk_mark_pmd_core_sleep(void)
+{
+ /* Nothing */
+}
@@ -22,6 +22,7 @@
#include <sys/stat.h>
#include <getopt.h>
+#include <rte_keepalive.h>
#include <rte_log.h>
#include <rte_memzone.h>
#ifdef DPDK_PDUMP
@@ -489,3 +490,33 @@ dpdk_set_lcore_id(unsigned cpu)
ovs_assert(cpu != NON_PMD_CORE_ID);
RTE_PER_LCORE(_lcore_id) = cpu;
}
+
+/* Register packet processing core 'core_id' for liveness checks. */
+void
+dpdk_register_pmd_core(unsigned core)
+{
+ rte_keepalive_register_core(rte_global_keepalive_info, core);
+}
+
+void
+dpdk_unregister_pmd_core(unsigned core OVS_UNUSED)
+{
+ /* XXX: DPDK unfortunately hasn't implemented unregister API
+ * This will be fixed later, instead use sleep API now.
+ */
+ rte_keepalive_mark_sleep(rte_global_keepalive_info);
+}
+
+/* Mark packet processing core alive. */
+void
+dpdk_mark_pmd_core_alive(void)
+{
+ rte_keepalive_mark_alive(rte_global_keepalive_info);
+}
+
+/* Mark packet processing core as idle. */
+void
+dpdk_mark_pmd_core_sleep(void)
+{
+ rte_keepalive_mark_sleep(rte_global_keepalive_info);
+}
@@ -17,6 +17,7 @@
#ifndef DPDK_H
#define DPDK_H
+#include <stdbool.h>
#ifdef DPDK_NETDEV
#include <rte_config.h>
@@ -26,14 +27,23 @@
#else
+#include <stdint.h>
+
#define NON_PMD_CORE_ID UINT32_MAX
#endif /* DPDK_NETDEV */
struct smap;
+struct rte_keepalive *rte_global_keepalive_info;
void dpdk_init(const struct smap *ovs_other_config);
void dpdk_set_lcore_id(unsigned cpu);
const char *dpdk_get_vhost_sock_dir(void);
+/* Keepalive APIs */
+void dpdk_register_pmd_core(unsigned core_id);
+void dpdk_unregister_pmd_core(unsigned core_id);
+void dpdk_mark_pmd_core_alive(void);
+void dpdk_mark_pmd_core_sleep(void);
+
#endif /* dpdk.h */
Introduce helper functions in 'dpdk' module that are needed for DPDK keepalive functionality. Also add dummy functions in 'dpdk-stub' module that are needed when DPDK datapath is not available. Signed-off-by: Bhanuprakash Bodireddy <bhanuprakash.bodireddy@intel.com> --- lib/dpdk-stub.c | 24 ++++++++++++++++++++++++ lib/dpdk.c | 31 +++++++++++++++++++++++++++++++ lib/dpdk.h | 10 ++++++++++ 3 files changed, 65 insertions(+)