diff mbox

[2/2] Removed unnecessary pktio type include files

Message ID 1412173976-5238-3-git-send-email-ciprian.barbu@linaro.org
State Superseded
Headers show

Commit Message

Ciprian Barbu Oct. 1, 2014, 2:32 p.m. UTC
Signed-off-by: Ciprian Barbu <ciprian.barbu@linaro.org>
---
 platform/linux-generic/Makefile.am                 |  4 +-
 platform/linux-generic/include/api/odp_packet_io.h |  2 -
 .../linux-generic/include/api/odp_pktio_netmap.h   | 39 ---------------
 .../linux-generic/include/api/odp_pktio_socket.h   | 34 -------------
 .../linux-generic/include/api/odp_pktio_types.h    | 55 ----------------------
 .../linux-generic/include/odp_packet_io_internal.h | 11 ++++-
 platform/linux-generic/include/odp_packet_socket.h |  1 +
 platform/linux-generic/odp_packet_io.c             | 21 +++------
 platform/linux-generic/odp_packet_socket.c         |  1 +
 9 files changed, 19 insertions(+), 149 deletions(-)
 delete mode 100644 platform/linux-generic/include/api/odp_pktio_netmap.h
 delete mode 100644 platform/linux-generic/include/api/odp_pktio_socket.h
 delete mode 100644 platform/linux-generic/include/api/odp_pktio_types.h
diff mbox

Patch

diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am
index 5b3c879..d076d50 100644
--- a/platform/linux-generic/Makefile.am
+++ b/platform/linux-generic/Makefile.am
@@ -35,9 +35,7 @@  include_HEADERS = \
 		  $(top_srcdir)/platform/linux-generic/include/api/odp_ticketlock.h \
 		  $(top_srcdir)/platform/linux-generic/include/api/odp_time.h \
 		  $(top_srcdir)/platform/linux-generic/include/api/odp_timer.h \
-		  $(top_srcdir)/platform/linux-generic/include/api/odp_version.h \
-		  $(top_srcdir)/platform/linux-generic/include/api/odp_pktio_types.h \
-		  $(top_srcdir)/platform/linux-generic/include/api/odp_pktio_socket.h
+		  $(top_srcdir)/platform/linux-generic/include/api/odp_version.h
 
 subdirheadersdir = $(includedir)/helper
 subdirheaders_HEADERS = \
diff --git a/platform/linux-generic/include/api/odp_packet_io.h b/platform/linux-generic/include/api/odp_packet_io.h
index 9f9e754..29fd105 100644
--- a/platform/linux-generic/include/api/odp_packet_io.h
+++ b/platform/linux-generic/include/api/odp_packet_io.h
@@ -23,8 +23,6 @@  extern "C" {
 #include <odp_packet.h>
 #include <odp_queue.h>
 
-#include <odp_pktio_types.h>
-
 /** ODP packet IO handle */
 typedef uint32_t odp_pktio_t;
 
diff --git a/platform/linux-generic/include/api/odp_pktio_netmap.h b/platform/linux-generic/include/api/odp_pktio_netmap.h
deleted file mode 100644
index 294a13d..0000000
--- a/platform/linux-generic/include/api/odp_pktio_netmap.h
+++ /dev/null
@@ -1,39 +0,0 @@ 
-
-/* Copyright (c) 2013, Linaro Limited
- * All rights reserved.
- *
- * SPDX-License-Identifier:     BSD-3-Clause
- */
-
-/**
- * @file
- *
- * ODP packet input/output netmap
- */
-
-#ifndef ODP_PKTIO_NETMAP_H
-#define ODP_PKTIO_NETMAP_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <odp_pktio_types.h>
-
-#define ODP_NETMAP_MODE_HW	0 /**< Netmap mode in hardware */
-#define ODP_NETMAP_MODE_SW	1 /**< Netmap mode in software */
-
-/**
- * Netmap parameters
- */
-typedef struct {
-	odp_pktio_type_t type;	/**< Packet IO type */
-	int netmap_mode;	/**< Netmap Mode */
-	uint16_t ringid;	/**< Ring identifiers */
-} netmap_params_t;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/platform/linux-generic/include/api/odp_pktio_socket.h b/platform/linux-generic/include/api/odp_pktio_socket.h
deleted file mode 100644
index 6444cba..0000000
--- a/platform/linux-generic/include/api/odp_pktio_socket.h
+++ /dev/null
@@ -1,34 +0,0 @@ 
-/* Copyright (c) 2013, Linaro Limited
- * All rights reserved.
- *
- * SPDX-License-Identifier:     BSD-3-Clause
- */
-
-/**
- * @file
- *
- * ODP packet input/output socket
- */
-
-#ifndef ODP_PKTIO_SOCKET_H
-#define ODP_PKTIO_SOCKET_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <odp_pktio_types.h>
-
-/**
- * Socket Parameters
- */
-typedef struct {
-	odp_pktio_type_t type;	/**< Packet IO type */
-	int fanout;		/**< Fantout */
-} socket_params_t;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/platform/linux-generic/include/api/odp_pktio_types.h b/platform/linux-generic/include/api/odp_pktio_types.h
deleted file mode 100644
index 54ce459..0000000
--- a/platform/linux-generic/include/api/odp_pktio_types.h
+++ /dev/null
@@ -1,55 +0,0 @@ 
-/* Copyright (c) 2013, Linaro Limited
- * All rights reserved.
- *
- * SPDX-License-Identifier:     BSD-3-Clause
- */
-
-/**
- * @file
- *
- * ODP packet input/output types
- */
-
-#ifndef ODP_PKTIO_TYPES_H
-#define ODP_PKTIO_TYPES_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* We should ensure that future enum values will never overlap, otherwise
- * applications that want netmap suport might get in trouble if the odp lib
- * was not built with netmap support and there are more types define below
- */
-
-/**
- * Packet IO types
- */
-typedef enum {
-	ODP_PKTIO_TYPE_SOCKET_BASIC = 0x1,
-	ODP_PKTIO_TYPE_SOCKET_MMSG,
-	ODP_PKTIO_TYPE_SOCKET_MMAP,
-	ODP_PKTIO_TYPE_NETMAP,
-} odp_pktio_type_t;
-
-#include <odp_pktio_socket.h>
-#ifdef ODP_HAVE_NETMAP
-#include <odp_pktio_netmap.h>
-#endif
-
-/**
- * Packet IO parameters
- */
-typedef union odp_pktio_params_t {
-	odp_pktio_type_t type;		/**< Packet IO type */
-	socket_params_t sock_params;	/**< Socket parameter */
-#ifdef ODP_HAVE_NETMAP
-	netmap_params_t nm_params;
-#endif
-} odp_pktio_params_t;
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/platform/linux-generic/include/odp_packet_io_internal.h b/platform/linux-generic/include/odp_packet_io_internal.h
index 7ba72df..23633ed 100644
--- a/platform/linux-generic/include/odp_packet_io_internal.h
+++ b/platform/linux-generic/include/odp_packet_io_internal.h
@@ -21,12 +21,21 @@  extern "C" {
 #include <odp_spinlock.h>
 #include <odp_packet_socket.h>
 
+/**
+ * Packet IO types
+ */
+typedef enum {
+	ODP_PKTIO_TYPE_SOCKET_BASIC = 0x1,
+	ODP_PKTIO_TYPE_SOCKET_MMSG,
+	ODP_PKTIO_TYPE_SOCKET_MMAP,
+} odp_pktio_type_t;
+
 struct pktio_entry {
 	odp_spinlock_t lock;		/**< entry spinlock */
 	int taken;			/**< is entry taken(1) or free(0) */
 	odp_queue_t inq_default;	/**< default input queue, if set */
 	odp_queue_t outq_default;	/**< default out queue */
-	odp_pktio_params_t params;	/**< pktio parameters */
+	odp_pktio_type_t type;		/**< pktio type */
 	pkt_sock_t pkt_sock;		/**< using socket API for IO */
 	pkt_sock_mmap_t pkt_sock_mmap;	/**< using socket mmap API for IO */
 };
diff --git a/platform/linux-generic/include/odp_packet_socket.h b/platform/linux-generic/include/odp_packet_socket.h
index f38f5b0..9c1bd78 100644
--- a/platform/linux-generic/include/odp_packet_socket.h
+++ b/platform/linux-generic/include/odp_packet_socket.h
@@ -81,6 +81,7 @@  typedef struct {
 	unsigned mmap_len;
 	unsigned char if_mac[ETH_ALEN];
 	struct sockaddr_ll ll;
+	int fanout;
 } pkt_sock_mmap_t;
 
 /**
diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c
index 719e1d0..0c30f0f 100644
--- a/platform/linux-generic/odp_packet_io.c
+++ b/platform/linux-generic/odp_packet_io.c
@@ -19,8 +19,6 @@ 
 #include <odp_schedule_internal.h>
 #include <odp_debug.h>
 
-#include <odp_pktio_socket.h>
-
 #include <string.h>
 
 typedef struct {
@@ -113,7 +111,6 @@  static void init_pktio_entry(pktio_entry_t *entry)
 {
 	set_taken(entry);
 	entry->s.inq_default = ODP_QUEUE_INVALID;
-	memset(&entry->s.params, 0, sizeof(entry->s.params));
 	memset(&entry->s.pkt_sock, 0, sizeof(entry->s.pkt_sock));
 	memset(&entry->s.pkt_sock_mmap, 0, sizeof(entry->s.pkt_sock_mmap));
 }
@@ -170,9 +167,7 @@  odp_pktio_t odp_pktio_open(const char *dev, odp_buffer_pool_t pool)
 
 	ODP_DBG("ODP_PKTIO_USE_FANOUT: %d\n", fanout);
 	if (getenv("ODP_PKTIO_DISABLE_SOCKET_MMAP") == NULL) {
-		pktio_entry->s.params.sock_params.type =
-			ODP_PKTIO_TYPE_SOCKET_MMAP;
-		pktio_entry->s.params.sock_params.fanout = fanout;
+		pktio_entry->s.type = ODP_PKTIO_TYPE_SOCKET_MMAP;
 		res = setup_pkt_sock_mmap(&pktio_entry->s.pkt_sock_mmap, dev,
 				pool, fanout);
 		if (res != -1) {
@@ -183,9 +178,7 @@  odp_pktio_t odp_pktio_open(const char *dev, odp_buffer_pool_t pool)
 	}
 
 	if (getenv("ODP_PKTIO_DISABLE_SOCKET_MMSG") == NULL) {
-		pktio_entry->s.params.sock_params.type =
-			ODP_PKTIO_TYPE_SOCKET_MMSG;
-		pktio_entry->s.params.sock_params.fanout = fanout;
+		pktio_entry->s.type = ODP_PKTIO_TYPE_SOCKET_MMSG;
 		res = setup_pkt_sock(&pktio_entry->s.pkt_sock, dev, pool);
 		if (res != -1) {
 			ODP_DBG("IO type: ODP_PKTIO_TYPE_SOCKET_MMSG\n");
@@ -195,9 +188,7 @@  odp_pktio_t odp_pktio_open(const char *dev, odp_buffer_pool_t pool)
 	}
 
 	if (getenv("ODP_PKTIO_DISABLE_SOCKET_BASIC") == NULL) {
-		pktio_entry->s.params.sock_params.type =
-			ODP_PKTIO_TYPE_SOCKET_BASIC;
-		pktio_entry->s.params.sock_params.fanout = fanout;
+		pktio_entry->s.type = ODP_PKTIO_TYPE_SOCKET_BASIC;
 		res = setup_pkt_sock(&pktio_entry->s.pkt_sock, dev, pool);
 		if (res != -1) {
 			ODP_DBG("IO type: ODP_PKTIO_TYPE_SOCKET_BASIC\n");
@@ -227,7 +218,7 @@  int odp_pktio_close(odp_pktio_t id)
 
 	lock_entry(entry);
 	if (!is_free(entry)) {
-		switch (entry->s.params.type) {
+		switch (entry->s.type) {
 		case ODP_PKTIO_TYPE_SOCKET_BASIC:
 		case ODP_PKTIO_TYPE_SOCKET_MMSG:
 			res  = close_pkt_sock(&entry->s.pkt_sock);
@@ -268,7 +259,7 @@  int odp_pktio_recv(odp_pktio_t id, odp_packet_t pkt_table[], unsigned len)
 		return -1;
 
 	lock_entry(pktio_entry);
-	switch (pktio_entry->s.params.type) {
+	switch (pktio_entry->s.type) {
 	case ODP_PKTIO_TYPE_SOCKET_BASIC:
 		pkts = recv_pkt_sock_basic(&pktio_entry->s.pkt_sock,
 				pkt_table, len);
@@ -305,7 +296,7 @@  int odp_pktio_send(odp_pktio_t id, odp_packet_t pkt_table[], unsigned len)
 		return -1;
 
 	lock_entry(pktio_entry);
-	switch (pktio_entry->s.params.type) {
+	switch (pktio_entry->s.type) {
 	case ODP_PKTIO_TYPE_SOCKET_BASIC:
 		pkts = send_pkt_sock_basic(&pktio_entry->s.pkt_sock,
 				pkt_table, len);
diff --git a/platform/linux-generic/odp_packet_socket.c b/platform/linux-generic/odp_packet_socket.c
index 279a0cb..844f117 100644
--- a/platform/linux-generic/odp_packet_socket.c
+++ b/platform/linux-generic/odp_packet_socket.c
@@ -857,6 +857,7 @@  int setup_pkt_sock_mmap(pkt_sock_mmap_t *const pkt_sock, const char *netdev,
 		return -1;
 	}
 
+	pkt_sock->fanout = fanout;
 	if (fanout) {
 		ret = set_pkt_sock_fanout_mmap(pkt_sock, if_idx);
 		if (ret != 0)