diff options
Diffstat (limited to 'platform/linux-generic/pktio')
-rw-r--r-- | platform/linux-generic/pktio/dpdk.c | 2 | ||||
-rw-r--r-- | platform/linux-generic/pktio/dpdk_parse.c | 5 | ||||
-rw-r--r-- | platform/linux-generic/pktio/ipc.c | 30 | ||||
-rw-r--r-- | platform/linux-generic/pktio/loop.c | 2 | ||||
-rw-r--r-- | platform/linux-generic/pktio/netmap.c | 6 | ||||
-rw-r--r-- | platform/linux-generic/pktio/null.c | 4 | ||||
-rw-r--r-- | platform/linux-generic/pktio/pcap.c | 3 |
7 files changed, 28 insertions, 24 deletions
diff --git a/platform/linux-generic/pktio/dpdk.c b/platform/linux-generic/pktio/dpdk.c index 9abba6292..36c1ec06e 100644 --- a/platform/linux-generic/pktio/dpdk.c +++ b/platform/linux-generic/pktio/dpdk.c @@ -559,7 +559,7 @@ static struct rte_mempool_ops odp_pool_ops = { .get_count = pool_get_count }; -MEMPOOL_REGISTER_OPS(odp_pool_ops); +MEMPOOL_REGISTER_OPS(odp_pool_ops) static inline int mbuf_to_pkt(pktio_entry_t *pktio_entry, odp_packet_t pkt_table[], diff --git a/platform/linux-generic/pktio/dpdk_parse.c b/platform/linux-generic/pktio/dpdk_parse.c index c1b75f126..0984f06c5 100644 --- a/platform/linux-generic/pktio/dpdk_parse.c +++ b/platform/linux-generic/pktio/dpdk_parse.c @@ -510,4 +510,7 @@ int _odp_dpdk_packet_parse_common(packet_parser_t *prs, const uint8_t *ptr, pktin_cfg); } -#endif /* _ODP_PKTIO_DPDK */ +#else /* _ODP_PKTIO_DPDK */ +/* Avoid warning about empty translation unit */ +typedef int _odp_dummy; +#endif diff --git a/platform/linux-generic/pktio/ipc.c b/platform/linux-generic/pktio/ipc.c index ad633e231..b89252303 100644 --- a/platform/linux-generic/pktio/ipc.c +++ b/platform/linux-generic/pktio/ipc.c @@ -1,5 +1,5 @@ /* Copyright (c) 2015-2018, Linaro Limited - * Copyright (c) 2019, Nokia + * Copyright (c) 2019-2021, Nokia * All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause @@ -15,17 +15,13 @@ #include <errno.h> #include <fcntl.h> +#include <stdint.h> #include <sys/mman.h> #include <sys/stat.h> #include <unistd.h> -#define IPC_ODP_DEBUG_PRINT 0 - -#define IPC_ODP_DBG(fmt, ...) \ - do { \ - if (IPC_ODP_DEBUG_PRINT == 1) \ - ODP_DBG(fmt, ##__VA_ARGS__);\ - } while (0) +/* Debug level for IPC */ +#define IPC_DBG 3 /* Burst size for IPC free operations */ #define IPC_BURST_SIZE 32 @@ -112,7 +108,7 @@ static inline pkt_ipc_t *pkt_priv(pktio_entry_t *pktio_entry) } /* MAC address for the "ipc" interface */ -static const char pktio_ipc_mac[] = {0x12, 0x12, 0x12, 0x12, 0x12, 0x12}; +static const uint8_t pktio_ipc_mac[] = {0x12, 0x12, 0x12, 0x12, 0x12, 0x12}; static odp_shm_t _ipc_map_remote_pool(const char *name, int pid); @@ -221,7 +217,7 @@ static int _ipc_master_start(pktio_entry_t *pktio_entry) odp_atomic_store_u32(&pktio_ipc->ready, 1); - IPC_ODP_DBG("%s started.\n", pktio_entry->s.name); + ODP_DBG_LVL(IPC_DBG, "%s started.\n", pktio_entry->s.name); return 0; } @@ -382,7 +378,7 @@ static odp_shm_t _ipc_map_remote_pool(const char *name, int pid) return ODP_SHM_INVALID; } - IPC_ODP_DBG("Mapped remote pool %s to local %s\n", name, rname); + ODP_DBG_LVL(IPC_DBG, "Mapped remote pool %s to local %s\n", name, rname); return shm; } @@ -547,7 +543,7 @@ static int ipc_pktio_open(odp_pktio_t id ODP_UNUSED, pktio_ipc->type = PKTIO_TYPE_IPC_SLAVE; snprintf(name, sizeof(name), "ipc:%s_info", tail); - IPC_ODP_DBG("lookup for name %s for pid %d\n", name, pid); + ODP_DBG_LVL(IPC_DBG, "lookup for name %s for pid %d\n", name, pid); shm = odp_shm_import(name, pid, name); if (ODP_SHM_INVALID == shm) return -1; @@ -639,7 +635,7 @@ static int ipc_pktio_recv_lockless(pktio_entry_t *pktio_entry, ready = odp_atomic_load_u32(&pktio_ipc->ready); if (odp_unlikely(!ready)) { - IPC_ODP_DBG("start pktio is missing before usage?\n"); + ODP_DBG_LVL(IPC_DBG, "start pktio is missing before usage?\n"); return 0; } @@ -692,7 +688,7 @@ static int ipc_pktio_recv_lockless(pktio_entry_t *pktio_entry, * packet ordering store such packets in local * cache. */ - IPC_ODP_DBG("unable to allocate packet %d/%d\n", + ODP_DBG_LVL(IPC_DBG, "unable to allocate packet %d/%d\n", i, pkts); break; } @@ -742,7 +738,7 @@ static int ipc_pktio_recv_lockless(pktio_entry_t *pktio_entry, ring_ptr_enq_multi(r_p, ring_mask, ipcbufs_p, pkts); for (i = 0; i < pkts; i++) { - IPC_ODP_DBG("%d/%d send to be free packet offset %" PRIuPTR "\n", + ODP_DBG_LVL(IPC_DBG, "%d/%d send to be free packet offset %" PRIuPTR "\n", i, pkts, offsets[i]); } @@ -819,11 +815,11 @@ static int ipc_pktio_send_lockless(pktio_entry_t *pktio_entry, (uint8_t *)odp_shm_addr(pool->shm); /* compile all function code even if ipc disabled with config */ - IPC_ODP_DBG("%d/%d send packet %" PRIu64 ", pool %" PRIu64 "," + ODP_DBG_LVL(IPC_DBG, "%d/%d send packet %" PRIu64 ", pool %" PRIu64 "," "phdr = %p, offset %td, sendoff %" PRIxPTR ", addr %p iaddr " "%p\n", i, num, odp_packet_to_u64(pkt), odp_pool_to_u64(pool_hdl), - pkt_hdr, (uint8_t *)pkt_hdr->seg_data - + (void *)pkt_hdr, (uint8_t *)pkt_hdr->seg_data - (uint8_t *)odp_shm_addr(pool->shm), offsets[i], odp_shm_addr(pool->shm), odp_shm_addr(ipc_pool->shm)); diff --git a/platform/linux-generic/pktio/loop.c b/platform/linux-generic/pktio/loop.c index 889a270ea..666e7ce90 100644 --- a/platform/linux-generic/pktio/loop.c +++ b/platform/linux-generic/pktio/loop.c @@ -49,7 +49,7 @@ static inline pkt_loop_t *pkt_priv(pktio_entry_t *pktio_entry) } /* MAC address for the "loop" interface */ -static const char pktio_loop_mac[] = {0x02, 0xe9, 0x34, 0x80, 0x73, 0x01}; +static const uint8_t pktio_loop_mac[] = {0x02, 0xe9, 0x34, 0x80, 0x73, 0x01}; static int loopback_stats_reset(pktio_entry_t *pktio_entry); static int loopback_init_capability(pktio_entry_t *pktio_entry); diff --git a/platform/linux-generic/pktio/netmap.c b/platform/linux-generic/pktio/netmap.c index 18d9b3a33..b45cdbe47 100644 --- a/platform/linux-generic/pktio/netmap.c +++ b/platform/linux-generic/pktio/netmap.c @@ -1331,5 +1331,7 @@ const pktio_if_ops_t _odp_netmap_pktio_ops = { .send = netmap_send, .fd_set = netmap_fd_set }; - -#endif /* _ODP_PKTIO_NETMAP */ +#else /* _ODP_PKTIO_NETMAP */ +/* Avoid warning about empty translation unit */ +typedef int _odp_dummy; +#endif diff --git a/platform/linux-generic/pktio/null.c b/platform/linux-generic/pktio/null.c index cbcde323c..8a421986b 100644 --- a/platform/linux-generic/pktio/null.c +++ b/platform/linux-generic/pktio/null.c @@ -7,6 +7,8 @@ #include <odp_api.h> #include <odp_packet_io_internal.h> +#include <stdint.h> + typedef struct { int promisc; /**< whether promiscuous mode is on */ } pkt_null_t; @@ -116,7 +118,7 @@ static uint32_t null_mtu_get(pktio_entry_t *pktio_entry ODP_UNUSED) return PKTIO_NULL_MTU; } -static const char null_mac[] = {0x02, 0xe9, 0x34, 0x80, 0x73, 0x05}; +static const uint8_t null_mac[] = {0x02, 0xe9, 0x34, 0x80, 0x73, 0x05}; static int null_mac_addr_get(pktio_entry_t *pktio_entry ODP_UNUSED, void *mac_addr) diff --git a/platform/linux-generic/pktio/pcap.c b/platform/linux-generic/pktio/pcap.c index bf4c87c02..d42840da9 100644 --- a/platform/linux-generic/pktio/pcap.c +++ b/platform/linux-generic/pktio/pcap.c @@ -50,6 +50,7 @@ #include <errno.h> #include <pcap/pcap.h> #include <pcap/bpf.h> +#include <stdint.h> typedef struct { char *fname_rx; /**< name of pcap file for rx */ @@ -75,7 +76,7 @@ static inline pkt_pcap_t *pkt_priv(pktio_entry_t *pktio_entry) #define PKTIO_PCAP_MTU_MIN (68 + _ODP_ETHHDR_LEN) #define PKTIO_PCAP_MTU_MAX (64 * 1024) -static const char pcap_mac[] = {0x02, 0xe9, 0x34, 0x80, 0x73, 0x04}; +static const uint8_t pcap_mac[] = {0x02, 0xe9, 0x34, 0x80, 0x73, 0x04}; static int pcapif_stats_reset(pktio_entry_t *pktio_entry); |