diff options
author | Petri Savolainen <petri.savolainen@nokia.com> | 2019-09-12 10:21:59 +0300 |
---|---|---|
committer | Petri Savolainen <petri.savolainen@nokia.com> | 2019-09-16 12:42:59 +0300 |
commit | f2ed58011a827959eb81452a99845278acc8a3fb (patch) | |
tree | 3ec67092a9835c7c055ff441a9d2eb2667d02651 | |
parent | 8994bbabb8efb58822b82ad6f03a4f0f332f81cf (diff) |
linux-gen: socket_mmap: remove redundant header file
Remove odp_packet_socket.h as it is only used by
socket_mmap.c. Move relevant content to the c file.
Signed-off-by: Petri Savolainen <petri.savolainen@nokia.com>
Reviewed-by: Matias Elo <matias.elo@nokia.com>
-rw-r--r-- | platform/linux-generic/Makefile.am | 1 | ||||
-rw-r--r-- | platform/linux-generic/include/odp_packet_socket.h | 62 | ||||
-rw-r--r-- | platform/linux-generic/pktio/socket.c | 1 | ||||
-rw-r--r-- | platform/linux-generic/pktio/socket_mmap.c | 33 |
4 files changed, 32 insertions, 65 deletions
diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am index 517ea258b..9f24bc829 100644 --- a/platform/linux-generic/Makefile.am +++ b/platform/linux-generic/Makefile.am @@ -111,7 +111,6 @@ noinst_HEADERS = \ include/odp_packet_io_internal.h \ include/odp_packet_io_ipc_internal.h \ include/odp_packet_io_ring_internal.h \ - include/odp_packet_socket.h \ include/odp_socket_common.h \ include/odp_packet_io_stats_common.h \ include/odp_packet_io_stats.h \ diff --git a/platform/linux-generic/include/odp_packet_socket.h b/platform/linux-generic/include/odp_packet_socket.h deleted file mode 100644 index 16cee16bc..000000000 --- a/platform/linux-generic/include/odp_packet_socket.h +++ /dev/null @@ -1,62 +0,0 @@ -/* Copyright (c) 2013-2018, Linaro Limited - * Copyright (c) 2013, Nokia Solutions and Networks - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#ifndef ODP_PACKET_SOCKET_H -#define ODP_PACKET_SOCKET_H - -#include <linux/if_packet.h> -#include <linux/if_ether.h> -#include <sys/socket.h> -#include <string.h> -#include <stddef.h> - -#include <odp/api/align.h> -#include <odp/api/buffer.h> -#include <odp/api/debug.h> -#include <odp/api/pool.h> -#include <odp/api/packet.h> -#include <odp/api/packet_io.h> -#include <odp/api/shared_memory.h> - -#include <linux/version.h> - -/* - * Packet socket config: - */ - -/* - * This makes sure that building for kernels older than 3.1 works - * and a fanout requests fails (for invalid packet socket option) - * in runtime if requested - */ -#ifndef PACKET_FANOUT -#define PACKET_FANOUT 18 -#define PACKET_FANOUT_HASH 0 -#endif /* PACKET_FANOUT */ - -/** packet mmap ring */ -struct ring { - struct iovec *rd; - unsigned frame_num; - int rd_num; - - odp_shm_t shm; - int sock; - int type; - int version; - uint8_t *mm_space; - size_t mm_len; - size_t rd_len; - int flen; - - struct tpacket_req req; -}; - -ODP_STATIC_ASSERT(offsetof(struct ring, mm_space) <= ODP_CACHE_LINE_SIZE, - "ERR_STRUCT_RING"); - -#endif diff --git a/platform/linux-generic/pktio/socket.c b/platform/linux-generic/pktio/socket.c index cae838e83..7e195580c 100644 --- a/platform/linux-generic/pktio/socket.c +++ b/platform/linux-generic/pktio/socket.c @@ -35,7 +35,6 @@ #include <linux/sockios.h> #include <odp_api.h> -#include <odp_packet_socket.h> #include <odp_socket_common.h> #include <odp_packet_internal.h> #include <odp_packet_io_internal.h> diff --git a/platform/linux-generic/pktio/socket_mmap.c b/platform/linux-generic/pktio/socket_mmap.c index 54fc7367e..ca58eb39a 100644 --- a/platform/linux-generic/pktio/socket_mmap.c +++ b/platform/linux-generic/pktio/socket_mmap.c @@ -24,10 +24,10 @@ #include <sys/ioctl.h> #include <errno.h> #include <time.h> +#include <linux/if_packet.h> #include <odp_api.h> #include <odp/api/plat/packet_inlines.h> -#include <odp_packet_socket.h> #include <odp_socket_common.h> #include <odp_packet_internal.h> #include <odp_packet_io_internal.h> @@ -47,6 +47,37 @@ #define FRAME_MEM_SIZE (4 * 1024 * 1024) #define BLOCK_SIZE (4 * 1024) +/* + * This makes sure that building for kernels older than 3.1 works + * and a fanout requests fails (for invalid packet socket option) + * in runtime if requested + */ +#ifndef PACKET_FANOUT +#define PACKET_FANOUT 18 +#define PACKET_FANOUT_HASH 0 +#endif + +/** packet mmap ring */ +struct ring { + struct iovec *rd; + unsigned int frame_num; + int rd_num; + + odp_shm_t shm; + int sock; + int type; + int version; + uint8_t *mm_space; + size_t mm_len; + size_t rd_len; + int flen; + + struct tpacket_req req; +}; + +ODP_STATIC_ASSERT(offsetof(struct ring, mm_space) <= ODP_CACHE_LINE_SIZE, + "ERR_STRUCT_RING"); + /** Packet socket using mmap rings for both Rx and Tx */ typedef struct { /** Packet mmap ring for Rx */ |