diff mbox

[NETMAP,07/12] linux-netmap: add odp_netmap_init_global

Message ID 1425322017-14636-8-git-send-email-ciprian.barbu@linaro.org
State New
Headers show

Commit Message

Ciprian Barbu March 2, 2015, 6:46 p.m. UTC
Signed-off-by: Ciprian Barbu <ciprian.barbu@linaro.org>
---
 platform/linux-netmap/Makefile.am            |  2 +-
 platform/linux-netmap/include/odp_internal.h | 51 +++++++++++++++
 platform/linux-netmap/odp_init.c             | 96 ++++++++++++++++++++++++++++
 platform/linux-netmap/odp_packet_netmap.c    |  6 ++
 4 files changed, 154 insertions(+), 1 deletion(-)
 create mode 100644 platform/linux-netmap/include/odp_internal.h
 create mode 100644 platform/linux-netmap/odp_init.c
diff mbox

Patch

diff --git a/platform/linux-netmap/Makefile.am b/platform/linux-netmap/Makefile.am
index 0b08cad..98e0962 100644
--- a/platform/linux-netmap/Makefile.am
+++ b/platform/linux-netmap/Makefile.am
@@ -67,7 +67,7 @@  __LIB__libodp_la_SOURCES = \
 			   ../linux-generic/odp_classification.c \
 			   ../linux-generic/odp_coremask.c \
 			   ../linux-generic/odp_crypto.c \
-			   ../linux-generic/odp_init.c \
+			   odp_init.c \
 			   ../linux-generic/odp_linux.c \
 			   ../linux-generic/odp_packet.c \
 			   ../linux-generic/odp_packet_flags.c \
diff --git a/platform/linux-netmap/include/odp_internal.h b/platform/linux-netmap/include/odp_internal.h
new file mode 100644
index 0000000..b2592c6
--- /dev/null
+++ b/platform/linux-netmap/include/odp_internal.h
@@ -0,0 +1,51 @@ 
+/* Copyright (c) 2013, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+
+/**
+ * @file
+ *
+ * ODP HW system information
+ */
+
+#ifndef ODP_INTERNAL_H_
+#define ODP_INTERNAL_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+int odp_system_info_init(void);
+
+int odp_thread_init_global(void);
+int odp_thread_init_local(void);
+
+int odp_shm_init_global(void);
+int odp_shm_init_local(void);
+
+int odp_buffer_pool_init_global(void);
+
+int odp_pktio_init_global(void);
+int odp_pktio_init_local(void);
+
+int odp_queue_init_global(void);
+
+int odp_crypto_init_global(void);
+
+int odp_schedule_init_global(void);
+int odp_schedule_init_local(void);
+
+int odp_timer_init_global(void);
+int odp_timer_disarm_all(void);
+
+int odp_netmap_init_global(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/platform/linux-netmap/odp_init.c b/platform/linux-netmap/odp_init.c
new file mode 100644
index 0000000..22c52b4
--- /dev/null
+++ b/platform/linux-netmap/odp_init.c
@@ -0,0 +1,96 @@ 
+/* Copyright (c) 2013, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+#include <odp_init.h>
+#include <odp_internal.h>
+#include <odp_debug.h>
+#include <odp_debug_internal.h>
+
+
+int odp_init_global(odp_init_t *params  ODP_UNUSED,
+			odp_platform_init_t *platform_params ODP_UNUSED)
+{
+	odp_system_info_init();
+
+	if (odp_shm_init_global()) {
+		ODP_ERR("ODP shm init failed.\n");
+		return -1;
+	}
+
+	if (odp_thread_init_global()) {
+		ODP_ERR("ODP thread init failed.\n");
+		return -1;
+	}
+
+	if (odp_buffer_pool_init_global()) {
+		ODP_ERR("ODP buffer pool init failed.\n");
+		return -1;
+	}
+
+	if (odp_queue_init_global()) {
+		ODP_ERR("ODP queue init failed.\n");
+		return -1;
+	}
+
+	if (odp_schedule_init_global()) {
+		ODP_ERR("ODP schedule init failed.\n");
+		return -1;
+	}
+
+	if (odp_pktio_init_global()) {
+		ODP_ERR("ODP packet io init failed.\n");
+		return -1;
+	}
+
+	if (odp_timer_init_global()) {
+		ODP_ERR("ODP timer init failed.\n");
+		return -1;
+	}
+
+	if (odp_crypto_init_global()) {
+		ODP_ERR("ODP crypto init failed.\n");
+		return -1;
+	}
+
+	if (odp_netmap_init_global()) {
+		ODP_ERR("ODP netmap global init failed.\n");
+		return -1;
+	}
+
+	return 0;
+}
+
+int odp_term_global(void)
+{
+	ODP_UNIMPLEMENTED();
+	return 0;
+}
+
+int odp_init_local(void)
+{
+	if (odp_thread_init_local()) {
+		ODP_ERR("ODP thread local init failed.\n");
+		return -1;
+	}
+
+	if (odp_pktio_init_local()) {
+		ODP_ERR("ODP packet io local init failed.\n");
+		return -1;
+	}
+
+	if (odp_schedule_init_local()) {
+		ODP_ERR("ODP schedule local init failed.\n");
+		return -1;
+	}
+
+	return 0;
+}
+
+int odp_term_local(void)
+{
+	ODP_UNIMPLEMENTED();
+	return 0;
+}
diff --git a/platform/linux-netmap/odp_packet_netmap.c b/platform/linux-netmap/odp_packet_netmap.c
index bd864b5..361f639 100644
--- a/platform/linux-netmap/odp_packet_netmap.c
+++ b/platform/linux-netmap/odp_packet_netmap.c
@@ -27,6 +27,7 @@ 
 #include <linux/ethtool.h>
 #include <linux/sockios.h>
 
+#include <odp_internal.h>
 #include <odp_packet_internal.h>
 #include <odp_hints.h>
 #include <odp_thread.h>
@@ -54,6 +55,11 @@ 
 #define WAITLINK_TMO 2
 #define POLL_TMO     0
 
+int odp_netmap_init_global(void)
+{
+	return 0;
+}
+
 static int nm_do_ioctl(pkt_netmap_t * const pkt_nm, unsigned long cmd,
 		       int subcmd)
 {