diff options
author | Matias Elo <matias.elo@nokia.com> | 2021-11-24 09:23:14 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-24 09:23:14 +0200 |
commit | 450eed7b050496cc6dd981fe20f38915063f8a7c (patch) | |
tree | d46c0c4439dab28ad6f353c2ad3bc3d166f28ce1 /platform/linux-generic/pktio/ipc.c | |
parent | f5e9dc2da1202c6afc09559e74a63eb4126e7eef (diff) | |
parent | a323b89bd7296b7774d51774a7426d432735d061 (diff) |
Merge ODP v1.32.1.0v1.32.1.0_DPDK_19.11
Merge ODP linux-generic v1.32.1.0 into linux-dpdk
Diffstat (limited to 'platform/linux-generic/pktio/ipc.c')
-rw-r--r-- | platform/linux-generic/pktio/ipc.c | 30 |
1 files changed, 13 insertions, 17 deletions
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)); |