aboutsummaryrefslogtreecommitdiff
path: root/platform/linux-generic/pktio
diff options
context:
space:
mode:
authorMatias Elo <matias.elo@nokia.com>2022-11-17 16:33:19 +0200
committerGitHub <noreply@github.com>2022-11-17 16:33:19 +0200
commit00285f307c545deac5684905ade826690085df8e (patch)
tree697f56a596da6ac11d55317818db7854b620582f /platform/linux-generic/pktio
parentbdfef681d7849339946bd63151fa2875d9ee801d (diff)
parent9ec371fde404b0c924a6309264383388936f18b5 (diff)
Merge ODP linux-generic
Merge ODP linux-generic into linux-dpdk
Diffstat (limited to 'platform/linux-generic/pktio')
-rw-r--r--platform/linux-generic/pktio/dpdk.c203
-rw-r--r--platform/linux-generic/pktio/ethtool_rss.c2
-rw-r--r--platform/linux-generic/pktio/ipc.c125
-rw-r--r--platform/linux-generic/pktio/loop.c10
-rw-r--r--platform/linux-generic/pktio/netmap.c67
-rw-r--r--platform/linux-generic/pktio/null.c2
-rw-r--r--platform/linux-generic/pktio/pcap.c25
-rw-r--r--platform/linux-generic/pktio/pktio_common.c4
-rw-r--r--platform/linux-generic/pktio/socket.c21
-rw-r--r--platform/linux-generic/pktio/socket_common.c32
-rw-r--r--platform/linux-generic/pktio/socket_mmap.c51
-rw-r--r--platform/linux-generic/pktio/socket_xdp.c42
-rw-r--r--platform/linux-generic/pktio/stats/ethtool_stats.c12
-rw-r--r--platform/linux-generic/pktio/stats/packet_io_stats.c2
-rw-r--r--platform/linux-generic/pktio/stats/sysfs_stats.c14
-rw-r--r--platform/linux-generic/pktio/tap.c44
16 files changed, 310 insertions, 346 deletions
diff --git a/platform/linux-generic/pktio/dpdk.c b/platform/linux-generic/pktio/dpdk.c
index fdb448e9c..30e6a0e61 100644
--- a/platform/linux-generic/pktio/dpdk.c
+++ b/platform/linux-generic/pktio/dpdk.c
@@ -58,7 +58,6 @@
#endif
#include <ctype.h>
-#include <math.h>
#include <sched.h>
#include <stdint.h>
#include <unistd.h>
@@ -216,8 +215,7 @@ static int lookup_opt(const char *opt_name, const char *drv_name, int *val)
ret = _odp_libconfig_lookup_ext_int(base, drv_name, opt_name, val);
if (ret == 0)
- ODP_ERR("Unable to find DPDK configuration option: %s\n",
- opt_name);
+ _ODP_ERR("Unable to find DPDK configuration option: %s\n", opt_name);
return ret;
}
@@ -234,7 +232,7 @@ static int init_options(pktio_entry_t *pktio_entry,
if (opt->num_rx_desc < dev_info->rx_desc_lim.nb_min ||
opt->num_rx_desc > dev_info->rx_desc_lim.nb_max ||
opt->num_rx_desc % dev_info->rx_desc_lim.nb_align) {
- ODP_ERR("Invalid number of RX descriptors\n");
+ _ODP_ERR("Invalid number of RX descriptors\n");
return -1;
}
@@ -254,12 +252,12 @@ static int init_options(pktio_entry_t *pktio_entry,
return -1;
opt->multicast_en = !!val;
- ODP_DBG("DPDK interface (%s): %" PRIu16 "\n", dev_info->driver_name,
- pkt_priv(pktio_entry)->port_id);
- ODP_DBG(" multicast_en: %d\n", opt->multicast_en);
- ODP_DBG(" num_rx_desc: %d\n", opt->num_rx_desc);
- ODP_DBG(" num_tx_desc: %d\n", opt->num_tx_desc_default);
- ODP_DBG(" rx_drop_en: %d\n", opt->rx_drop_en);
+ _ODP_DBG("DPDK interface (%s): %" PRIu16 "\n", dev_info->driver_name,
+ pkt_priv(pktio_entry)->port_id);
+ _ODP_DBG(" multicast_en: %d\n", opt->multicast_en);
+ _ODP_DBG(" num_rx_desc: %d\n", opt->num_rx_desc);
+ _ODP_DBG(" num_tx_desc: %d\n", opt->num_tx_desc_default);
+ _ODP_DBG(" rx_drop_en: %d\n", opt->rx_drop_en);
return 0;
}
@@ -267,15 +265,15 @@ static int init_options(pktio_entry_t *pktio_entry,
/**
* Calculate valid cache size for DPDK packet pool
*/
-static unsigned cache_size(uint32_t num)
+static uint32_t cache_size(uint32_t num)
{
- unsigned size = 0;
- unsigned i;
+ uint32_t size = 0;
+ uint32_t i;
if (!RTE_MEMPOOL_CACHE_MAX_SIZE)
return 0;
- i = ceil((double)num / RTE_MEMPOOL_CACHE_MAX_SIZE);
+ i = (num + RTE_MEMPOOL_CACHE_MAX_SIZE - 1) / RTE_MEMPOOL_CACHE_MAX_SIZE;
i = RTE_MAX(i, 2UL);
for (; i <= (num / 2); ++i)
if ((num % i) == 0) {
@@ -284,7 +282,7 @@ static unsigned cache_size(uint32_t num)
}
if (odp_unlikely(size > RTE_MEMPOOL_CACHE_MAX_SIZE ||
(uint32_t)size * 1.5 > num)) {
- ODP_ERR("Cache size calc failure: %d\n", size);
+ _ODP_ERR("Cache size calc failure: %d\n", size);
size = 0;
}
@@ -340,7 +338,7 @@ static void pktmbuf_init(struct rte_mempool *mp, void *opaque_arg ODP_UNUSED,
m->buf_iova = rte_mem_virt2iova(buf_addr);
if (odp_unlikely(m->buf_iova == 0))
- ODP_ABORT("Bad IO virtual address\n");
+ _ODP_ABORT("Bad IO virtual address\n");
m->buf_len = (uint16_t)buf_len;
m->data_off = RTE_PKTMBUF_HEADROOM;
@@ -372,28 +370,28 @@ static struct rte_mempool *mbuf_pool_create(const char *name,
int ret;
if (!(pool_entry->mem_from_huge_pages)) {
- ODP_ERR("DPDK requires memory is allocated from huge pages\n");
+ _ODP_ERR("DPDK requires memory is allocated from huge pages\n");
goto fail;
}
if (pool_entry->seg_len < RTE_MBUF_DEFAULT_BUF_SIZE) {
- ODP_ERR("Some NICs need at least %dB buffers to not segment "
- "standard ethernet frames. Increase pool seg_len.\n",
- RTE_MBUF_DEFAULT_BUF_SIZE);
+ _ODP_ERR("Some NICs need at least %dB buffers to not segment "
+ "standard ethernet frames. Increase pool seg_len.\n",
+ RTE_MBUF_DEFAULT_BUF_SIZE);
goto fail;
}
if (odp_shm_info(pool_entry->shm, &shm_info)) {
- ODP_ERR("Failed to query SHM info.\n");
+ _ODP_ERR("Failed to query SHM info.\n");
goto fail;
}
page_size = shm_info.page_size;
total_size = rte_mempool_calc_obj_size(elt_size, MEMPOOL_FLAGS, &sz);
if (total_size != pool_entry->block_size) {
- ODP_ERR("DPDK pool block size not matching to ODP pool: "
- "%" PRIu32 "/%" PRIu32 "\n", total_size,
- pool_entry->block_size);
+ _ODP_ERR("DPDK pool block size not matching to ODP pool: "
+ "%" PRIu32 "/%" PRIu32 "\n", total_size,
+ pool_entry->block_size);
goto fail;
}
@@ -401,14 +399,14 @@ static struct rte_mempool *mbuf_pool_create(const char *name,
sizeof(struct rte_pktmbuf_pool_private),
rte_socket_id(), MEMPOOL_FLAGS);
if (mp == NULL) {
- ODP_ERR("Failed to create empty DPDK packet pool\n");
+ _ODP_ERR("Failed to create empty DPDK packet pool\n");
goto fail;
}
mp->pool_data = _odp_pool_handle(pool_entry);
if (rte_mempool_set_ops_byname(mp, "odp_pool", pool_entry)) {
- ODP_ERR("Failed setting mempool operations\n");
+ _ODP_ERR("Failed setting mempool operations\n");
goto fail;
}
@@ -430,7 +428,7 @@ static struct rte_mempool *mbuf_pool_create(const char *name,
NULL, NULL);
if (ret <= 0) {
- ODP_ERR("Failed to populate mempool: %d\n", ret);
+ _ODP_ERR("Failed to populate mempool: %d\n", ret);
goto fail;
}
@@ -439,8 +437,8 @@ static struct rte_mempool *mbuf_pool_create(const char *name,
}
if (populated != num) {
- ODP_ERR("Failed to populate mempool with all requested blocks, populated: %u, "
- "requested: %u\n", populated, num);
+ _ODP_ERR("Failed to populate mempool with all requested blocks, populated: %u, "
+ "requested: %u\n", populated, num);
goto fail;
}
@@ -517,7 +515,7 @@ static unsigned pool_get_count(const struct rte_mempool *mp)
odp_pool_info_t info;
if (odp_pool_info(pool, &info)) {
- ODP_ERR("Failed to read pool info\n");
+ _ODP_ERR("Failed to read pool info\n");
return 0;
}
return info.params.pkt.num;
@@ -566,7 +564,7 @@ static int pool_create(uint8_t *data, pool_t *pool)
pkt_pool = mbuf_pool_create(pool_name, pool, mem_src_data->dpdk_elt_size);
if (pkt_pool == NULL) {
- ODP_ERR("Creating external DPDK pool failed\n");
+ _ODP_ERR("Creating external DPDK pool failed\n");
return -1;
}
@@ -589,7 +587,7 @@ static void pool_obj_size(uint8_t *data, uint32_t *block_size, uint32_t *block_o
if (odp_global_rw->dpdk_initialized == 0) {
if (dpdk_pktio_init()) {
- ODP_ERR("Initializing DPDK failed\n");
+ _ODP_ERR("Initializing DPDK failed\n");
*block_size = 0;
return;
}
@@ -641,8 +639,8 @@ static inline int mbuf_to_pkt(pktio_entry_t *pktio_entry,
num = _odp_packet_alloc_multi(pool, max_len + frame_offset,
pkt_table, mbuf_num);
if (num != mbuf_num) {
- ODP_DBG("_odp_packet_alloc_multi() unable to allocate all packets: "
- "%d/%" PRIu16 " allocated\n", num, mbuf_num);
+ _ODP_DBG("_odp_packet_alloc_multi() unable to allocate all packets: "
+ "%d/%" PRIu16 " allocated\n", num, mbuf_num);
for (i = num; i < mbuf_num; i++)
rte_pktmbuf_free(mbuf_table[i]);
}
@@ -650,7 +648,7 @@ static inline int mbuf_to_pkt(pktio_entry_t *pktio_entry,
for (i = 0; i < num; i++) {
mbuf = mbuf_table[i];
if (odp_unlikely(mbuf->nb_segs != 1)) {
- ODP_ERR("Segmented buffers not supported\n");
+ _ODP_ERR("Segmented buffers not supported\n");
goto fail;
}
@@ -856,7 +854,7 @@ static inline int pkt_to_mbuf(pktio_entry_t *pktio_entry,
if (odp_unlikely((rte_pktmbuf_alloc_bulk(pkt_dpdk->pkt_pool,
mbuf_table, num)))) {
- ODP_ERR("Failed to alloc mbuf\n");
+ _ODP_ERR("Failed to alloc mbuf\n");
return 0;
}
for (i = 0; i < num; i++) {
@@ -937,7 +935,7 @@ static inline int mbuf_to_pkt_zero(pktio_entry_t *pktio_entry,
mbuf = mbuf_table[i];
if (odp_unlikely(mbuf->nb_segs != 1)) {
- ODP_ERR("Segmented buffers not supported\n");
+ _ODP_ERR("Segmented buffers not supported\n");
rte_pktmbuf_free(mbuf);
continue;
}
@@ -1078,7 +1076,7 @@ static uint32_t dpdk_vdev_mtu_get(uint16_t port_id)
sockfd = socket(AF_INET, SOCK_DGRAM, 0);
if (sockfd < 0) {
- ODP_ERR("Failed to create control socket\n");
+ _ODP_ERR("Failed to create control socket\n");
return 0;
}
@@ -1127,7 +1125,7 @@ static int dpdk_maxlen_set(pktio_entry_t *pktio_entry, uint32_t maxlen_input,
ret = rte_eth_dev_set_mtu(pkt_dpdk->port_id, mtu);
if (odp_unlikely(ret))
- ODP_ERR("rte_eth_dev_set_mtu() failed: %d\n", ret);
+ _ODP_ERR("rte_eth_dev_set_mtu() failed: %d\n", ret);
pkt_dpdk->mtu = maxlen_input;
pkt_dpdk->mtu_set = 1;
@@ -1149,7 +1147,7 @@ static int dpdk_vdev_promisc_mode_get(uint16_t port_id)
sockfd = socket(AF_INET, SOCK_DGRAM, 0);
if (sockfd < 0) {
- ODP_ERR("Failed to create control socket\n");
+ _ODP_ERR("Failed to create control socket\n");
return -1;
}
@@ -1172,7 +1170,7 @@ static int dpdk_vdev_promisc_mode_set(uint16_t port_id, int enable)
sockfd = socket(AF_INET, SOCK_DGRAM, 0);
if (sockfd < 0) {
- ODP_ERR("Failed to create control socket\n");
+ _ODP_ERR("Failed to create control socket\n");
return -1;
}
@@ -1252,8 +1250,8 @@ static int dpdk_setup_eth_dev(pktio_entry_t *pktio_entry)
pktio_entry->num_in_queue,
pktio_entry->num_out_queue, &eth_conf);
if (ret < 0) {
- ODP_ERR("Failed to setup device: err=%d, port=%" PRIu8 "\n",
- ret, pkt_dpdk->port_id);
+ _ODP_ERR("Failed to setup device: err=%d, port=%" PRIu8 "\n",
+ ret, pkt_dpdk->port_id);
return -1;
}
return 0;
@@ -1302,7 +1300,7 @@ static int dpdk_pktio_init(void)
i = pthread_getaffinity_np(pthread_self(),
sizeof(original_cpuset), &original_cpuset);
if (i != 0) {
- ODP_ERR("Failed to read thread affinity: %d\n", i);
+ _ODP_ERR("Failed to read thread affinity: %d\n", i);
return -1;
}
@@ -1316,7 +1314,7 @@ static int dpdk_pktio_init(void)
masklen = odp_cpumask_to_str(&mask, mask_str, ODP_CPUMASK_STR_SIZE);
if (masklen < 0) {
- ODP_ERR("CPU mask error: %" PRId32 "\n", masklen);
+ _ODP_ERR("CPU mask error: %" PRId32 "\n", masklen);
return -1;
}
@@ -1360,7 +1358,7 @@ static int dpdk_pktio_init(void)
dpdk_argc = rte_strsplit(full_cmd, strlen(full_cmd), dpdk_argv,
dpdk_argc, ' ');
for (i = 0; i < dpdk_argc; ++i)
- ODP_DBG("arg[%d]: %s\n", i, dpdk_argv[i]);
+ _ODP_DBG("arg[%d]: %s\n", i, dpdk_argv[i]);
i = rte_eal_init(dpdk_argc, dpdk_argv);
@@ -1368,22 +1366,22 @@ static int dpdk_pktio_init(void)
optind = 0;
if (i < 0) {
- ODP_ERR("Cannot init the Intel DPDK EAL!\n");
+ _ODP_ERR("Cannot init the Intel DPDK EAL!\n");
return -1;
} else if (i + 1 != dpdk_argc) {
- ODP_DBG("Some DPDK args were not processed!\n");
- ODP_DBG("Passed: %d Consumed %d\n", dpdk_argc, i + 1);
+ _ODP_DBG("Some DPDK args were not processed!\n");
+ _ODP_DBG("Passed: %d Consumed %d\n", dpdk_argc, i + 1);
}
- ODP_DBG("rte_eal_init OK\n");
+ _ODP_DBG("rte_eal_init OK\n");
rte_log_set_global_level(RTE_LOG_WARNING);
i = pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t),
&original_cpuset);
if (i)
- ODP_ERR("Failed to reset thread affinity: %d\n", i);
+ _ODP_ERR("Failed to reset thread affinity: %d\n", i);
- ODP_PRINT("\nDPDK version: %s\n", rte_version());
+ _ODP_PRINT("\nDPDK version: %s\n", rte_version());
return 0;
}
@@ -1392,12 +1390,12 @@ static int dpdk_pktio_init(void)
static int dpdk_pktio_init_global(void)
{
if (getenv("ODP_PKTIO_DISABLE_DPDK")) {
- ODP_PRINT("PKTIO: dpdk pktio skipped,"
- " enabled export ODP_PKTIO_DISABLE_DPDK=1.\n");
+ _ODP_PRINT("PKTIO: dpdk pktio skipped,"
+ " enabled export ODP_PKTIO_DISABLE_DPDK=1.\n");
disable_pktio = 1;
} else {
- ODP_PRINT("PKTIO: initialized dpdk pktio,"
- " use export ODP_PKTIO_DISABLE_DPDK=1 to disable.\n");
+ _ODP_PRINT("PKTIO: initialized dpdk pktio,"
+ " use export ODP_PKTIO_DISABLE_DPDK=1 to disable.\n");
}
return 0;
}
@@ -1408,7 +1406,7 @@ static int dpdk_pktio_init_local(void)
cpu = sched_getcpu();
if (cpu < 0) {
- ODP_ERR("getcpu failed\n");
+ _ODP_ERR("getcpu failed\n");
return -1;
}
@@ -1458,33 +1456,33 @@ static void prepare_rss_conf(pktio_entry_t *pktio_entry,
/* Print debug info about unsupported hash protocols */
if (p->hash_proto.proto.ipv4 &&
((rss_hf_capa & ETH_RSS_IPV4) == 0))
- ODP_PRINT("DPDK: hash_proto.ipv4 not supported (rss_hf_capa 0x%" PRIx64 ")\n",
- rss_hf_capa);
+ _ODP_PRINT("DPDK: hash_proto.ipv4 not supported (rss_hf_capa 0x%" PRIx64 ")\n",
+ rss_hf_capa);
if (p->hash_proto.proto.ipv4_udp &&
((rss_hf_capa & ETH_RSS_NONFRAG_IPV4_UDP) == 0))
- ODP_PRINT("DPDK: hash_proto.ipv4_udp not supported (rss_hf_capa 0x%" PRIx64 ")\n",
- rss_hf_capa);
+ _ODP_PRINT("DPDK: hash_proto.ipv4_udp not supported (rss_hf_capa 0x%" PRIx64 ")\n",
+ rss_hf_capa);
if (p->hash_proto.proto.ipv4_tcp &&
((rss_hf_capa & ETH_RSS_NONFRAG_IPV4_TCP) == 0))
- ODP_PRINT("DPDK: hash_proto.ipv4_tcp not supported (rss_hf_capa 0x%" PRIx64 ")\n",
- rss_hf_capa);
+ _ODP_PRINT("DPDK: hash_proto.ipv4_tcp not supported (rss_hf_capa 0x%" PRIx64 ")\n",
+ rss_hf_capa);
if (p->hash_proto.proto.ipv6 &&
((rss_hf_capa & ETH_RSS_IPV6) == 0))
- ODP_PRINT("DPDK: hash_proto.ipv6 not supported (rss_hf_capa 0x%" PRIx64 ")\n",
- rss_hf_capa);
+ _ODP_PRINT("DPDK: hash_proto.ipv6 not supported (rss_hf_capa 0x%" PRIx64 ")\n",
+ rss_hf_capa);
if (p->hash_proto.proto.ipv6_udp &&
((rss_hf_capa & ETH_RSS_NONFRAG_IPV6_UDP) == 0))
- ODP_PRINT("DPDK: hash_proto.ipv6_udp not supported (rss_hf_capa 0x%" PRIx64 ")\n",
- rss_hf_capa);
+ _ODP_PRINT("DPDK: hash_proto.ipv6_udp not supported (rss_hf_capa 0x%" PRIx64 ")\n",
+ rss_hf_capa);
if (p->hash_proto.proto.ipv6_tcp &&
((rss_hf_capa & ETH_RSS_NONFRAG_IPV6_TCP) == 0))
- ODP_PRINT("DPDK: hash_proto.ipv6_tcp not supported (rss_hf_capa 0x%" PRIx64 ")\n",
- rss_hf_capa);
+ _ODP_PRINT("DPDK: hash_proto.ipv6_tcp not supported (rss_hf_capa 0x%" PRIx64 ")\n",
+ rss_hf_capa);
hash_proto_to_rss_conf(&pkt_dpdk->rss_conf, &p->hash_proto);
@@ -1531,7 +1529,7 @@ static int dpdk_output_queues_config(pktio_entry_t *pktio_entry,
ret = rte_eth_dev_info_get(pkt_dpdk->port_id, &dev_info);
if (ret) {
- ODP_ERR("DPDK: rte_eth_dev_info_get() failed: %d\n", ret);
+ _ODP_ERR("DPDK: rte_eth_dev_info_get() failed: %d\n", ret);
return -1;
}
@@ -1550,7 +1548,7 @@ static int dpdk_output_queues_config(pktio_entry_t *pktio_entry,
if (num_tx_desc < dev_info.tx_desc_lim.nb_min ||
num_tx_desc > dev_info.tx_desc_lim.nb_max ||
num_tx_desc % dev_info.tx_desc_lim.nb_align) {
- ODP_ERR("DPDK: invalid number of TX descriptors\n");
+ _ODP_ERR("DPDK: invalid number of TX descriptors\n");
return -1;
}
pkt_dpdk->num_tx_desc[i] = num_tx_desc;
@@ -1595,7 +1593,7 @@ static int dpdk_init_capability(pktio_entry_t *pktio_entry,
if (ret == 0) {
capa->set_op.op.mac_addr = 1;
} else if (ret != -ENOTSUP && ret != -EPERM) {
- ODP_ERR("Failed to set interface default MAC: %d\n", ret);
+ _ODP_ERR("Failed to set interface default MAC: %d\n", ret);
return -1;
}
@@ -1744,7 +1742,7 @@ static int dpdk_open(odp_pktio_t id ODP_UNUSED,
else if (dpdk_netdev_is_valid(netdev))
pkt_dpdk->port_id = atoi(netdev);
else {
- ODP_ERR("Invalid DPDK interface name: %s\n", netdev);
+ _ODP_ERR("Invalid DPDK interface name: %s\n", netdev);
return -1;
}
@@ -1758,27 +1756,27 @@ static int dpdk_open(odp_pktio_t id ODP_UNUSED,
pkt_dpdk->pool = pool;
if (rte_eth_dev_count_avail() == 0) {
- ODP_ERR("No DPDK ports found\n");
+ _ODP_ERR("No DPDK ports found\n");
return -1;
}
memset(&dev_info, 0, sizeof(struct rte_eth_dev_info));
ret = rte_eth_dev_info_get(pkt_dpdk->port_id, &dev_info);
if (ret) {
- ODP_ERR("Failed to read device info: %d\n", ret);
+ _ODP_ERR("Failed to read device info: %d\n", ret);
return -1;
}
/* Initialize runtime options */
if (init_options(pktio_entry, &dev_info)) {
- ODP_ERR("Initializing runtime options failed\n");
+ _ODP_ERR("Initializing runtime options failed\n");
return -1;
}
pkt_dpdk->flags.set_flow_hash = pkt_dpdk->opt.set_flow_hash; /* Copy for fast path access */
mtu = dpdk_mtu_get(pktio_entry);
if (mtu == 0) {
- ODP_ERR("Failed to read interface MTU\n");
+ _ODP_ERR("Failed to read interface MTU\n");
return -1;
}
pkt_dpdk->mtu = mtu + _ODP_ETHHDR_LEN;
@@ -1794,7 +1792,7 @@ static int dpdk_open(odp_pktio_t id ODP_UNUSED,
/* Not supported by all PMDs, so ignore the return value */
if (ret)
- ODP_DBG("Configuring multicast reception not supported by the PMD\n");
+ _ODP_DBG("Configuring multicast reception not supported by the PMD\n");
/* Drivers requiring minimum burst size. Supports also *_vf versions
* of the drivers. */
@@ -1825,7 +1823,7 @@ static int dpdk_open(odp_pktio_t id ODP_UNUSED,
}
}
if (pkt_pool == NULL) {
- ODP_ERR("Cannot init mbuf packet pool\n");
+ _ODP_ERR("Cannot init mbuf packet pool\n");
return -1;
}
@@ -1843,7 +1841,7 @@ static int dpdk_open(odp_pktio_t id ODP_UNUSED,
pkt_dpdk->mtu_max = RTE_MIN(pkt_dpdk->mtu_max, pkt_dpdk->data_room);
if (dpdk_init_capability(pktio_entry, &dev_info)) {
- ODP_ERR("Failed to initialize capability\n");
+ _ODP_ERR("Failed to initialize capability\n");
return -1;
}
@@ -1871,8 +1869,7 @@ static int dpdk_setup_eth_tx(pktio_entry_t *pktio_entry,
rte_eth_dev_socket_id(port_id),
&dev_info->default_txconf);
if (ret < 0) {
- ODP_ERR("Queue setup failed: err=%d, port=%" PRIu8 "\n",
- ret, port_id);
+ _ODP_ERR("Queue setup failed: err=%d, port=%" PRIu8 "\n", ret, port_id);
return -1;
}
}
@@ -1882,11 +1879,11 @@ static int dpdk_setup_eth_tx(pktio_entry_t *pktio_entry,
for (i = 0; i < pktio_entry->num_out_queue && i < RTE_ETHDEV_QUEUE_STAT_CNTRS; i++) {
ret = rte_eth_dev_set_tx_queue_stats_mapping(port_id, i, i);
if (ret) {
- ODP_DBG("Mapping per TX queue statistics not supported: %d\n", ret);
+ _ODP_DBG("Mapping per TX queue statistics not supported: %d\n", ret);
break;
}
}
- ODP_DBG("Mapped %" PRIu32 "/%d TX counters\n", i, RTE_ETHDEV_QUEUE_STAT_CNTRS);
+ _ODP_DBG("Mapped %" PRIu32 "/%d TX counters\n", i, RTE_ETHDEV_QUEUE_STAT_CNTRS);
return 0;
}
@@ -1910,8 +1907,7 @@ static int dpdk_setup_eth_rx(const pktio_entry_t *pktio_entry,
rte_eth_dev_socket_id(port_id),
&rxconf, pkt_dpdk->pkt_pool);
if (ret < 0) {
- ODP_ERR("Queue setup failed: err=%d, port=%" PRIu8 "\n",
- ret, port_id);
+ _ODP_ERR("Queue setup failed: err=%d, port=%" PRIu8 "\n", ret, port_id);
return -1;
}
}
@@ -1921,11 +1917,11 @@ static int dpdk_setup_eth_rx(const pktio_entry_t *pktio_entry,
for (i = 0; i < pktio_entry->num_in_queue && i < RTE_ETHDEV_QUEUE_STAT_CNTRS; i++) {
ret = rte_eth_dev_set_rx_queue_stats_mapping(port_id, i, i);
if (ret) {
- ODP_DBG("Mapping per RX queue statistics not supported: %d\n", ret);
+ _ODP_DBG("Mapping per RX queue statistics not supported: %d\n", ret);
break;
}
}
- ODP_DBG("Mapped %" PRIu32 "/%d RX counters\n", i, RTE_ETHDEV_QUEUE_STAT_CNTRS);
+ _ODP_DBG("Mapped %" PRIu32 "/%d RX counters\n", i, RTE_ETHDEV_QUEUE_STAT_CNTRS);
return 0;
}
@@ -1947,7 +1943,7 @@ static int dpdk_start(pktio_entry_t *pktio_entry)
/* Setup device */
if (dpdk_setup_eth_dev(pktio_entry)) {
- ODP_ERR("Failed to configure device\n");
+ _ODP_ERR("Failed to configure device\n");
return -1;
}
@@ -1963,16 +1959,15 @@ static int dpdk_start(pktio_entry_t *pktio_entry)
if (pkt_dpdk->mtu_set && pktio_entry->capa.set_op.op.maxlen) {
ret = dpdk_maxlen_set(pktio_entry, pkt_dpdk->mtu, 0);
if (ret) {
- ODP_ERR("Restoring device MTU failed: err=%d, port=%" PRIu8 "\n",
- ret, port_id);
+ _ODP_ERR("Restoring device MTU failed: err=%d, port=%" PRIu8 "\n",
+ ret, port_id);
return -1;
}
}
/* Start device */
ret = rte_eth_dev_start(port_id);
if (ret < 0) {
- ODP_ERR("Device start failed: err=%d, port=%" PRIu8 "\n",
- ret, port_id);
+ _ODP_ERR("Device start failed: err=%d, port=%" PRIu8 "\n", ret, port_id);
return -1;
}
@@ -2192,7 +2187,7 @@ static int dpdk_link_info(pktio_entry_t *pktio_entry, odp_pktio_link_info_t *inf
ret = rte_eth_dev_flow_ctrl_get(port_id, &fc_conf);
if (ret && ret != -ENOTSUP) {
- ODP_ERR("rte_eth_dev_flow_ctrl_get() failed\n");
+ _ODP_ERR("rte_eth_dev_flow_ctrl_get() failed\n");
return -1;
}
@@ -2279,7 +2274,7 @@ static int dpdk_extra_stat_info(pktio_entry_t *pktio_entry,
num_stats = rte_eth_xstats_get_names(port_id, NULL, 0);
if (num_stats < 0) {
- ODP_ERR("rte_eth_xstats_get_names() failed: %d\n", num_stats);
+ _ODP_ERR("rte_eth_xstats_get_names() failed: %d\n", num_stats);
return num_stats;
} else if (info == NULL || num == 0 || num_stats == 0) {
return num_stats;
@@ -2289,7 +2284,7 @@ static int dpdk_extra_stat_info(pktio_entry_t *pktio_entry,
ret = rte_eth_xstats_get_names(port_id, xstats_names, num_stats);
if (ret < 0 || ret > num_stats) {
- ODP_ERR("rte_eth_xstats_get_names() failed: %d\n", ret);
+ _ODP_ERR("rte_eth_xstats_get_names() failed: %d\n", ret);
return -1;
}
num_stats = ret;
@@ -2309,7 +2304,7 @@ static int dpdk_extra_stats(pktio_entry_t *pktio_entry,
num_stats = rte_eth_xstats_get(port_id, NULL, 0);
if (num_stats < 0) {
- ODP_ERR("rte_eth_xstats_get() failed: %d\n", num_stats);
+ _ODP_ERR("rte_eth_xstats_get() failed: %d\n", num_stats);
return num_stats;
} else if (stats == NULL || num == 0 || num_stats == 0) {
return num_stats;
@@ -2319,7 +2314,7 @@ static int dpdk_extra_stats(pktio_entry_t *pktio_entry,
ret = rte_eth_xstats_get(port_id, xstats, num_stats);
if (ret < 0 || ret > num_stats) {
- ODP_ERR("rte_eth_xstats_get() failed: %d\n", ret);
+ _ODP_ERR("rte_eth_xstats_get() failed: %d\n", ret);
return -1;
}
num_stats = ret;
@@ -2339,7 +2334,7 @@ static int dpdk_extra_stat_counter(pktio_entry_t *pktio_entry, uint32_t id,
ret = rte_eth_xstats_get_by_id(port_id, &xstat_id, stat, 1);
if (ret != 1) {
- ODP_ERR("rte_eth_xstats_get_by_id() failed: %d\n", ret);
+ _ODP_ERR("rte_eth_xstats_get_by_id() failed: %d\n", ret);
return -1;
}
@@ -2353,14 +2348,13 @@ static int dpdk_pktin_stats(pktio_entry_t *pktio_entry, uint32_t index,
int ret;
if (odp_unlikely(index > RTE_ETHDEV_QUEUE_STAT_CNTRS - 1)) {
- ODP_ERR("DPDK supports max %d per queue counters\n",
- RTE_ETHDEV_QUEUE_STAT_CNTRS);
+ _ODP_ERR("DPDK supports max %d per queue counters\n", RTE_ETHDEV_QUEUE_STAT_CNTRS);
return -1;
}
ret = rte_eth_stats_get(pkt_priv(pktio_entry)->port_id, &rte_stats);
if (odp_unlikely(ret)) {
- ODP_ERR("Failed to read DPDK pktio stats: %d\n", ret);
+ _ODP_ERR("Failed to read DPDK pktio stats: %d\n", ret);
return -1;
}
@@ -2380,14 +2374,13 @@ static int dpdk_pktout_stats(pktio_entry_t *pktio_entry, uint32_t index,
int ret;
if (odp_unlikely(index > RTE_ETHDEV_QUEUE_STAT_CNTRS - 1)) {
- ODP_ERR("DPDK supports max %d per queue counters\n",
- RTE_ETHDEV_QUEUE_STAT_CNTRS);
+ _ODP_ERR("DPDK supports max %d per queue counters\n", RTE_ETHDEV_QUEUE_STAT_CNTRS);
return -1;
}
ret = rte_eth_stats_get(pkt_priv(pktio_entry)->port_id, &rte_stats);
if (odp_unlikely(ret)) {
- ODP_ERR("Failed to read DPDK pktio stats: %d\n", ret);
+ _ODP_ERR("Failed to read DPDK pktio stats: %d\n", ret);
return -1;
}
diff --git a/platform/linux-generic/pktio/ethtool_rss.c b/platform/linux-generic/pktio/ethtool_rss.c
index 80a66420e..df97e2417 100644
--- a/platform/linux-generic/pktio/ethtool_rss.c
+++ b/platform/linux-generic/pktio/ethtool_rss.c
@@ -248,6 +248,6 @@ void _odp_rss_conf_print(const odp_pktin_hash_proto_t *hash_proto)
" IPV6 UDP\n");
str[len] = '\0';
- ODP_PRINT("%s\n", str);
+ _ODP_PRINT("%s\n", str);
}
diff --git a/platform/linux-generic/pktio/ipc.c b/platform/linux-generic/pktio/ipc.c
index f3246c068..586bc0aa7 100644
--- a/platform/linux-generic/pktio/ipc.c
+++ b/platform/linux-generic/pktio/ipc.c
@@ -128,7 +128,7 @@ static ring_ptr_t *_ring_create(const char *name, uint32_t count,
/* count must be a power of 2 */
if (!_ODP_CHECK_IS_POWER2(count)) {
- ODP_ERR("Requested size is invalid, must be a power of 2\n");
+ _ODP_ERR("Requested size is invalid, must be a power of 2\n");
_odp_errno = EINVAL;
return NULL;
}
@@ -145,7 +145,7 @@ static ring_ptr_t *_ring_create(const char *name, uint32_t count,
} else {
_odp_errno = ENOMEM;
- ODP_ERR("Cannot reserve memory\n");
+ _ODP_ERR("Cannot reserve memory\n");
}
return r;
@@ -210,8 +210,7 @@ static int _ipc_master_start(pktio_entry_t *pktio_entry)
shm = _ipc_map_remote_pool(pinfo->slave.pool_name,
pinfo->slave.pid);
if (shm == ODP_SHM_INVALID) {
- ODP_DBG("no pool file %s for pid %d\n",
- pinfo->slave.pool_name, pinfo->slave.pid);
+ _ODP_DBG("no pool file %s for pid %d\n", pinfo->slave.pool_name, pinfo->slave.pid);
return -1;
}
@@ -238,7 +237,7 @@ static int _ipc_init_master(pktio_entry_t *pktio_entry,
uint32_t ring_mask;
if ((uint64_t)_ODP_ROUNDUP_POWER2_U32(pool->num + 1) > UINT32_MAX) {
- ODP_ERR("Too large packet pool\n");
+ _ODP_ERR("Too large packet pool\n");
return -1;
}
@@ -254,13 +253,13 @@ static int _ipc_init_master(pktio_entry_t *pktio_entry,
pktio_ipc->ring_mask = ring_mask;
if (strlen(dev) > (ODP_POOL_NAME_LEN - sizeof("_m_prod"))) {
- ODP_ERR("too big ipc name\n");
+ _ODP_ERR("too big ipc name\n");
return -1;
}
pktio_ipc->rx.cache = _ring_create("ipc_rx_cache", ring_size, 0);
if (!pktio_ipc->rx.cache) {
- ODP_ERR("pid %d unable to create ipc rx cache\n", getpid());
+ _ODP_ERR("pid %d unable to create ipc rx cache\n", getpid());
return -1;
}
@@ -271,13 +270,12 @@ static int _ipc_init_master(pktio_entry_t *pktio_entry,
pktio_ipc->tx.send = _ring_create(ipc_shm_name, ring_size,
ODP_SHM_PROC | ODP_SHM_EXPORT);
if (!pktio_ipc->tx.send) {
- ODP_ERR("pid %d unable to create ipc ring %s name\n",
- getpid(), ipc_shm_name);
+ _ODP_ERR("pid %d unable to create ipc ring %s name\n", getpid(), ipc_shm_name);
return -1;
}
- ODP_DBG("Created IPC ring: %s, count %d, free %d\n",
- ipc_shm_name, _ring_count(pktio_ipc->tx.send, ring_mask),
- _ring_free_count(pktio_ipc->tx.send, ring_mask));
+ _ODP_DBG("Created IPC ring: %s, count %d, free %d\n",
+ ipc_shm_name, _ring_count(pktio_ipc->tx.send, ring_mask),
+ _ring_free_count(pktio_ipc->tx.send, ring_mask));
/* generate name in shm like ipc_pktio_p for
* already processed packets
@@ -286,44 +284,41 @@ static int _ipc_init_master(pktio_entry_t *pktio_entry,
pktio_ipc->tx.free = _ring_create(ipc_shm_name, ring_size,
ODP_SHM_PROC | ODP_SHM_EXPORT);
if (!pktio_ipc->tx.free) {
- ODP_ERR("pid %d unable to create ipc ring %s name\n",
- getpid(), ipc_shm_name);
+ _ODP_ERR("pid %d unable to create ipc ring %s name\n", getpid(), ipc_shm_name);
goto free_m_prod;
}
- ODP_DBG("Created IPC ring: %s, count %d, free %d\n",
- ipc_shm_name, _ring_count(pktio_ipc->tx.free, ring_mask),
- _ring_free_count(pktio_ipc->tx.free, ring_mask));
+ _ODP_DBG("Created IPC ring: %s, count %d, free %d\n",
+ ipc_shm_name, _ring_count(pktio_ipc->tx.free, ring_mask),
+ _ring_free_count(pktio_ipc->tx.free, ring_mask));
snprintf(ipc_shm_name, sizeof(ipc_shm_name), "%s_s_prod", dev);
pktio_ipc->rx.recv = _ring_create(ipc_shm_name, ring_size,
ODP_SHM_PROC | ODP_SHM_EXPORT);
if (!pktio_ipc->rx.recv) {
- ODP_ERR("pid %d unable to create ipc ring %s name\n",
- getpid(), ipc_shm_name);
+ _ODP_ERR("pid %d unable to create ipc ring %s name\n", getpid(), ipc_shm_name);
goto free_m_cons;
}
- ODP_DBG("Created IPC ring: %s, count %d, free %d\n",
- ipc_shm_name, _ring_count(pktio_ipc->rx.recv, ring_mask),
- _ring_free_count(pktio_ipc->rx.recv, ring_mask));
+ _ODP_DBG("Created IPC ring: %s, count %d, free %d\n",
+ ipc_shm_name, _ring_count(pktio_ipc->rx.recv, ring_mask),
+ _ring_free_count(pktio_ipc->rx.recv, ring_mask));
snprintf(ipc_shm_name, sizeof(ipc_shm_name), "%s_s_cons", dev);
pktio_ipc->rx.free = _ring_create(ipc_shm_name, ring_size,
ODP_SHM_PROC | ODP_SHM_EXPORT);
if (!pktio_ipc->rx.free) {
- ODP_ERR("pid %d unable to create ipc ring %s name\n",
- getpid(), ipc_shm_name);
+ _ODP_ERR("pid %d unable to create ipc ring %s name\n", getpid(), ipc_shm_name);
goto free_s_prod;
}
- ODP_DBG("Created IPC ring: %s, count %d, free %d\n",
- ipc_shm_name, _ring_count(pktio_ipc->rx.free, ring_mask),
- _ring_free_count(pktio_ipc->rx.free, ring_mask));
+ _ODP_DBG("Created IPC ring: %s, count %d, free %d\n",
+ ipc_shm_name, _ring_count(pktio_ipc->rx.free, ring_mask),
+ _ring_free_count(pktio_ipc->rx.free, ring_mask));
/* Set up pool name for remote info */
pinfo = pktio_ipc->pinfo;
pool_name = _ipc_odp_buffer_pool_shm_name(pool_hdl);
if (strlen(pool_name) > ODP_POOL_NAME_LEN) {
- ODP_ERR("pid %d ipc pool name %s is too big %zu\n",
- getpid(), pool_name, strlen(pool_name));
+ _ODP_ERR("pid %d ipc pool name %s is too big %zu\n",
+ getpid(), pool_name, strlen(pool_name));
goto free_s_prod;
}
@@ -340,7 +335,7 @@ static int _ipc_init_master(pktio_entry_t *pktio_entry,
pktio_ipc->pool = pool_hdl;
- ODP_DBG("Pre init... DONE.\n");
+ _ODP_DBG("Pre init... DONE.\n");
pinfo->master.init_done = 1;
_ipc_master_start(pktio_entry);
@@ -378,7 +373,7 @@ static odp_shm_t _ipc_map_remote_pool(const char *name, int pid)
snprintf(rname, ODP_SHM_NAME_LEN, "remote-%s", name);
shm = odp_shm_import(name, pid, rname);
if (shm == ODP_SHM_INVALID) {
- ODP_ERR("unable map %s\n", name);
+ _ODP_ERR("unable map %s\n", name);
return ODP_SHM_INVALID;
}
@@ -392,7 +387,7 @@ static void *_ipc_shm_map(char *name, int pid)
shm = odp_shm_import(name, pid, name);
if (ODP_SHM_INVALID == shm) {
- ODP_ERR("unable to map: %s\n", name);
+ _ODP_ERR("unable to map: %s\n", name);
return NULL;
}
@@ -407,20 +402,20 @@ static int _ipc_init_slave(const char *dev, pktio_entry_t *pktio_entry,
uint32_t ring_size = pktio_ipc->pinfo->master.ring_size;
if (strlen(dev) > (ODP_POOL_NAME_LEN - sizeof("_slave_r"))) {
- ODP_ERR("Too big ipc name\n");
+ _ODP_ERR("Too big ipc name\n");
return -1;
}
/* Check that IPC rings are able to store all packets */
if (pool->num >= ring_size) {
- ODP_ERR("Slave process packet pool too large. Master process "
+ _ODP_ERR("Slave process packet pool too large. Master process "
"packet pool has to be larger than slave pool.\n");
return -1;
}
pktio_ipc->rx.cache = _ring_create("ipc_rx_cache", ring_size, 0);
if (!pktio_ipc->rx.cache) {
- ODP_ERR("Pid %d unable to create ipc rx cache\n", getpid());
+ _ODP_ERR("Pid %d unable to create ipc rx cache\n", getpid());
return -1;
}
pktio_ipc->ring_size = ring_size;
@@ -442,7 +437,7 @@ static int _ipc_slave_start(pktio_entry_t *pktio_entry)
uint32_t ring_mask = pktio_ipc->ring_mask;
if (sscanf(pktio_entry->name, "ipc:%d:%s", &pid, tail) != 2) {
- ODP_ERR("wrong pktio name\n");
+ _ODP_ERR("wrong pktio name\n");
return -1;
}
@@ -451,47 +446,43 @@ static int _ipc_slave_start(pktio_entry_t *pktio_entry)
snprintf(ipc_shm_name, sizeof(ipc_shm_name), "%s_m_prod", dev);
pktio_ipc->rx.recv = _ipc_shm_map(ipc_shm_name, pid);
if (!pktio_ipc->rx.recv) {
- ODP_DBG("pid %d unable to find ipc ring %s name\n",
- getpid(), dev);
+ _ODP_DBG("pid %d unable to find ipc ring %s name\n", getpid(), dev);
sleep(1);
return -1;
}
- ODP_DBG("Connected IPC ring: %s, count %d, free %d\n",
- ipc_shm_name, _ring_count(pktio_ipc->rx.recv, ring_mask),
- _ring_free_count(pktio_ipc->rx.recv, ring_mask));
+ _ODP_DBG("Connected IPC ring: %s, count %d, free %d\n",
+ ipc_shm_name, _ring_count(pktio_ipc->rx.recv, ring_mask),
+ _ring_free_count(pktio_ipc->rx.recv, ring_mask));
snprintf(ipc_shm_name, sizeof(ipc_shm_name), "%s_m_cons", dev);
pktio_ipc->rx.free = _ipc_shm_map(ipc_shm_name, pid);
if (!pktio_ipc->rx.free) {
- ODP_ERR("pid %d unable to find ipc ring %s name\n",
- getpid(), dev);
+ _ODP_ERR("pid %d unable to find ipc ring %s name\n", getpid(), dev);
goto free_m_prod;
}
- ODP_DBG("Connected IPC ring: %s, count %d, free %d\n",
- ipc_shm_name, _ring_count(pktio_ipc->rx.free, ring_mask),
- _ring_free_count(pktio_ipc->rx.free, ring_mask));
+ _ODP_DBG("Connected IPC ring: %s, count %d, free %d\n",
+ ipc_shm_name, _ring_count(pktio_ipc->rx.free, ring_mask),
+ _ring_free_count(pktio_ipc->rx.free, ring_mask));
snprintf(ipc_shm_name, sizeof(ipc_shm_name), "%s_s_prod", dev);
pktio_ipc->tx.send = _ipc_shm_map(ipc_shm_name, pid);
if (!pktio_ipc->tx.send) {
- ODP_ERR("pid %d unable to find ipc ring %s name\n",
- getpid(), dev);
+ _ODP_ERR("pid %d unable to find ipc ring %s name\n", getpid(), dev);
goto free_m_cons;
}
- ODP_DBG("Connected IPC ring: %s, count %d, free %d\n",
- ipc_shm_name, _ring_count(pktio_ipc->tx.send, ring_mask),
- _ring_free_count(pktio_ipc->tx.send, ring_mask));
+ _ODP_DBG("Connected IPC ring: %s, count %d, free %d\n",
+ ipc_shm_name, _ring_count(pktio_ipc->tx.send, ring_mask),
+ _ring_free_count(pktio_ipc->tx.send, ring_mask));
snprintf(ipc_shm_name, sizeof(ipc_shm_name), "%s_s_cons", dev);
pktio_ipc->tx.free = _ipc_shm_map(ipc_shm_name, pid);
if (!pktio_ipc->tx.free) {
- ODP_ERR("pid %d unable to find ipc ring %s name\n",
- getpid(), dev);
+ _ODP_ERR("pid %d unable to find ipc ring %s name\n", getpid(), dev);
goto free_s_prod;
}
- ODP_DBG("Connected IPC ring: %s, count %d, free %d\n",
- ipc_shm_name, _ring_count(pktio_ipc->tx.free, ring_mask),
- _ring_free_count(pktio_ipc->tx.free, ring_mask));
+ _ODP_DBG("Connected IPC ring: %s, count %d, free %d\n",
+ ipc_shm_name, _ring_count(pktio_ipc->tx.free, ring_mask),
+ _ring_free_count(pktio_ipc->tx.free, ring_mask));
/* Get info about remote pool */
pinfo = pktio_ipc->pinfo;
@@ -506,7 +497,7 @@ static int _ipc_slave_start(pktio_entry_t *pktio_entry)
odp_atomic_store_u32(&pktio_ipc->ready, 1);
pinfo->slave.init_done = 1;
- ODP_DBG("%s started.\n", pktio_entry->name);
+ _ODP_DBG("%s started.\n", pktio_entry->name);
return 0;
free_s_prod:
@@ -560,7 +551,7 @@ static int ipc_pktio_open(odp_pktio_t id ODP_UNUSED,
}
pktio_ipc->pinfo = pinfo;
pktio_ipc->pinfo_shm = shm;
- ODP_DBG("process %d is slave\n", getpid());
+ _ODP_DBG("process %d is slave\n", getpid());
ret = _ipc_init_slave(name, pktio_entry, pool);
} else {
pktio_ipc->type = PKTIO_TYPE_IPC_MASTER;
@@ -569,7 +560,7 @@ static int ipc_pktio_open(odp_pktio_t id ODP_UNUSED,
ODP_CACHE_LINE_SIZE,
ODP_SHM_EXPORT | ODP_SHM_SINGLE_VA);
if (ODP_SHM_INVALID == shm) {
- ODP_ERR("can not create shm %s\n", name);
+ _ODP_ERR("can not create shm %s\n", name);
return -1;
}
@@ -579,7 +570,7 @@ static int ipc_pktio_open(odp_pktio_t id ODP_UNUSED,
pktio_ipc->pinfo = pinfo;
pktio_ipc->pinfo_shm = shm;
- ODP_DBG("process %d is master\n", getpid());
+ _ODP_DBG("process %d is master\n", getpid());
ret = _ipc_init_master(pktio_entry, dev, pool);
}
@@ -649,7 +640,7 @@ static int ipc_pktio_recv_lockless(pktio_entry_t *pktio_entry,
r = pktio_ipc->rx.cache;
pkts = ring_ptr_deq_multi(r, ring_mask, ipcbufs_p, len);
if (odp_unlikely(pkts < 0))
- ODP_ABORT("internal error dequeue\n");
+ _ODP_ABORT("internal error dequeue\n");
/* rx from other app */
if (pkts == 0) {
@@ -658,7 +649,7 @@ static int ipc_pktio_recv_lockless(pktio_entry_t *pktio_entry,
pkts = ring_ptr_deq_multi(r, ring_mask, ipcbufs_p,
len);
if (odp_unlikely(pkts < 0))
- ODP_ABORT("internal error dequeue\n");
+ _ODP_ABORT("internal error dequeue\n");
}
/* fast path */
@@ -678,7 +669,7 @@ static int ipc_pktio_recv_lockless(pktio_entry_t *pktio_entry,
pool = pktio_ipc->pool;
if (odp_unlikely(pool == ODP_POOL_INVALID))
- ODP_ABORT("invalid pool");
+ _ODP_ABORT("invalid pool");
data_pool_off = (uint8_t *)phdr->seg_data -
(uint8_t *)pktio_ipc->remote_base_addr;
@@ -700,8 +691,8 @@ static int ipc_pktio_recv_lockless(pktio_entry_t *pktio_entry,
/* Copy packet data. */
pkt_data = odp_packet_data(pkt);
if (odp_unlikely(!pkt_data))
- ODP_ABORT("unable to map pkt_data ipc_slave %d\n",
- (PKTIO_TYPE_IPC_SLAVE == pktio_ipc->type));
+ _ODP_ABORT("unable to map pkt_data ipc_slave %d\n",
+ (PKTIO_TYPE_IPC_SLAVE == pktio_ipc->type));
/* Copy packet data from shared pool to local pool. */
rmt_data_ptr = (uint8_t *)pktio_ipc->pool_mdata_base +
@@ -799,7 +790,7 @@ static int ipc_pktio_send_lockless(pktio_entry_t *pktio_entry,
newpkt = odp_packet_copy(pkt, pktio_ipc->pool);
if (newpkt == ODP_PACKET_INVALID)
- ODP_ABORT("Unable to copy packet\n");
+ _ODP_ABORT("Unable to copy packet\n");
odp_packet_free(pkt);
pkt_table_mapped[i] = newpkt;
@@ -870,7 +861,7 @@ static int ipc_start(pktio_entry_t *pktio_entry)
uint32_t ready = odp_atomic_load_u32(&pktio_ipc->ready);
if (ready) {
- ODP_ABORT("%s Already started\n", pktio_entry->name);
+ _ODP_ABORT("%s Already started\n", pktio_entry->name);
return -1;
}
diff --git a/platform/linux-generic/pktio/loop.c b/platform/linux-generic/pktio/loop.c
index 695bc477e..947edd476 100644
--- a/platform/linux-generic/pktio/loop.c
+++ b/platform/linux-generic/pktio/loop.c
@@ -106,7 +106,7 @@ static int loopback_queue_destroy(odp_queue_t queue)
} while (event != ODP_EVENT_INVALID);
if (odp_queue_destroy(queue)) {
- ODP_ERR("Destroying loopback pktio queue failed\n");
+ _ODP_ERR("Destroying loopback pktio queue failed\n");
return -1;
}
return 0;
@@ -131,7 +131,7 @@ static int loopback_pktout_queue_config(pktio_entry_t *pktio_entry,
pkt_loop->loopq = odp_queue_create(queue_name, &queue_param);
if (pkt_loop->loopq == ODP_QUEUE_INVALID) {
- ODP_ERR("Creating loopback pktio queue failed\n");
+ _ODP_ERR("Creating loopback pktio queue failed\n");
return -1;
}
@@ -408,7 +408,7 @@ static int loopback_send(pktio_entry_t *pktio_entry, int index ODP_UNUSED,
pktio_entry->stats.out_packets += ret;
pktio_entry->stats.out_octets += out_octets_tbl[ret - 1];
} else {
- ODP_DBG("queue enqueue failed %i\n", ret);
+ _ODP_DBG("queue enqueue failed %i\n", ret);
ret = -1;
}
@@ -468,7 +468,7 @@ static int loopback_init_capability(pktio_entry_t *pktio_entry)
odp_queue_capability_t queue_capa;
if (odp_queue_capability(&queue_capa)) {
- ODP_ERR("Queue capability failed\n");
+ _ODP_ERR("Queue capability failed\n");
return -1;
}
@@ -579,7 +579,7 @@ static int loopback_pktout_stats(pktio_entry_t *pktio_entry,
static int loop_init_global(void)
{
- ODP_PRINT("PKTIO: initialized loop interface.\n");
+ _ODP_PRINT("PKTIO: initialized loop interface.\n");
return 0;
}
diff --git a/platform/linux-generic/pktio/netmap.c b/platform/linux-generic/pktio/netmap.c
index 6cb3feeb5..41ded2ae1 100644
--- a/platform/linux-generic/pktio/netmap.c
+++ b/platform/linux-generic/pktio/netmap.c
@@ -142,8 +142,7 @@ static int lookup_opt(const char *opt_name, const char *drv_name, int *val)
ret = _odp_libconfig_lookup_ext_int(base, drv_name, opt_name, val);
if (ret == 0)
- ODP_ERR("Unable to find netmap configuration option: %s\n",
- opt_name);
+ _ODP_ERR("Unable to find netmap configuration option: %s\n", opt_name);
return ret;
}
@@ -157,7 +156,7 @@ static int init_options(pktio_entry_t *pktio_entry)
return -1;
if (opt->nr_rx_slots < 0 ||
opt->nr_rx_slots > 4096) {
- ODP_ERR("Invalid number of RX slots\n");
+ _ODP_ERR("Invalid number of RX slots\n");
return -1;
}
@@ -166,13 +165,13 @@ static int init_options(pktio_entry_t *pktio_entry)
return -1;
if (opt->nr_tx_slots < 0 ||
opt->nr_tx_slots > 4096) {
- ODP_ERR("Invalid number of TX slots\n");
+ _ODP_ERR("Invalid number of TX slots\n");
return -1;
}
- ODP_DBG("netmap interface: %s\n", pkt_priv(pktio_entry)->if_name);
- ODP_DBG(" num_rx_desc: %d\n", opt->nr_rx_slots);
- ODP_DBG(" num_tx_desc: %d\n", opt->nr_tx_slots);
+ _ODP_DBG("netmap interface: %s\n", pkt_priv(pktio_entry)->if_name);
+ _ODP_DBG(" num_rx_desc: %d\n", opt->nr_rx_slots);
+ _ODP_DBG(" num_tx_desc: %d\n", opt->nr_tx_slots);
return 0;
}
@@ -220,7 +219,7 @@ static int netmap_do_ioctl(pktio_entry_t *pktio_entry, unsigned long cmd,
}
done:
if (err)
- ODP_ERR("ioctl err %d %lu: %s\n", err, cmd, strerror(errno));
+ _ODP_ERR("ioctl err %d %lu: %s\n", err, cmd, strerror(errno));
return err;
}
@@ -246,7 +245,7 @@ static inline void map_netmap_rings(netmap_ring_t *rings,
remainder = num_rings % num_queues;
if (remainder)
- ODP_DBG("WARNING: Netmap rings mapped unevenly to queues\n");
+ _ODP_DBG("WARNING: Netmap rings mapped unevenly to queues\n");
for (i = 0; i < num_queues; i++) {
desc_ring = &rings[i];
@@ -283,7 +282,7 @@ static int netmap_input_queues_config(pktio_entry_t *pktio_entry,
if (_odp_rss_conf_set_fd(pkt_priv(pktio_entry)->sockfd,
pkt_priv(pktio_entry)->if_name,
&p->hash_proto)) {
- ODP_ERR("Failed to configure input hash\n");
+ _ODP_ERR("Failed to configure input hash\n");
return -1;
}
}
@@ -342,7 +341,7 @@ static int netmap_close(pktio_entry_t *pktio_entry)
if (pkt_nm->sockfd != -1 && close(pkt_nm->sockfd) != 0) {
_odp_errno = errno;
- ODP_ERR("close(sockfd): %s\n", strerror(errno));
+ _ODP_ERR("close(sockfd): %s\n", strerror(errno));
return -1;
}
return 0;
@@ -407,7 +406,7 @@ static inline int netmap_wait_for_link(pktio_entry_t *pktio_entry)
if (ret == 1)
return 1;
}
- ODP_DBG("%s link is down\n", pkt_priv(pktio_entry)->if_name);
+ _ODP_DBG("%s link is down\n", pkt_priv(pktio_entry)->if_name);
return 0;
}
@@ -430,7 +429,7 @@ static void netmap_init_capability(pktio_entry_t *pktio_entry)
/* Have to use a single descriptor to fetch packets from all
* netmap rings */
capa->max_input_queues = 1;
- ODP_DBG("Unable to store all %" PRIu32 " rx rings (max %d)\n"
+ _ODP_DBG("Unable to store all %" PRIu32 " rx rings (max %d)\n"
" max input queues: %u\n", pkt_nm->num_rx_rings,
NM_MAX_DESC, capa->max_input_queues);
}
@@ -440,7 +439,7 @@ static void netmap_init_capability(pktio_entry_t *pktio_entry)
capa->max_output_queues = pkt_nm->num_tx_rings;
if (capa->max_output_queues > NM_MAX_DESC) {
capa->max_output_queues = NM_MAX_DESC;
- ODP_DBG("Unable to store all %" PRIu32 " tx rings (max %d)\n"
+ _ODP_DBG("Unable to store all %" PRIu32 " tx rings (max %d)\n"
" max output queues: %u\n", pkt_nm->num_tx_rings,
NM_MAX_DESC, capa->max_output_queues);
}
@@ -525,14 +524,14 @@ static int netmap_open(odp_pktio_t id ODP_UNUSED, pktio_entry_t *pktio_entry,
/* Initialize runtime options */
if (init_options(pktio_entry)) {
- ODP_ERR("Initializing runtime options failed\n");
+ _ODP_ERR("Initializing runtime options failed\n");
return -1;
}
/* Read netmap buffer size */
nm_buf_size = read_netmap_buf_size();
if (!nm_buf_size) {
- ODP_ERR("Unable to read netmap buf size\n");
+ _ODP_ERR("Unable to read netmap buf size\n");
return -1;
}
pkt_nm->mtu_max = _ODP_SOCKET_MTU_MAX;
@@ -542,7 +541,7 @@ static int netmap_open(odp_pktio_t id ODP_UNUSED, pktio_entry_t *pktio_entry,
if (!pkt_nm->is_virtual) {
sockfd = socket(AF_INET, SOCK_DGRAM, 0);
if (sockfd == -1) {
- ODP_ERR("Cannot get device control socket\n");
+ _ODP_ERR("Cannot get device control socket\n");
return -1;
}
pkt_nm->sockfd = sockfd;
@@ -551,7 +550,7 @@ static int netmap_open(odp_pktio_t id ODP_UNUSED, pktio_entry_t *pktio_entry,
* whichever is smaller. */
mtu = _odp_mtu_get_fd(pkt_nm->sockfd, pkt_nm->if_name);
if (mtu == 0) {
- ODP_ERR("Unable to read interface MTU\n");
+ _ODP_ERR("Unable to read interface MTU\n");
goto error;
}
pkt_nm->mtu = (mtu < nm_buf_size) ? mtu : nm_buf_size;
@@ -560,7 +559,7 @@ static int netmap_open(odp_pktio_t id ODP_UNUSED, pktio_entry_t *pktio_entry,
if (mtu > nm_buf_size) {
if (_odp_mtu_set_fd(pkt_nm->sockfd, pkt_nm->if_name,
nm_buf_size)) {
- ODP_ERR("Unable to set interface MTU\n");
+ _ODP_ERR("Unable to set interface MTU\n");
goto error;
}
}
@@ -569,7 +568,7 @@ static int netmap_open(odp_pktio_t id ODP_UNUSED, pktio_entry_t *pktio_entry,
* capability info. */
desc = nm_open(pkt_nm->nm_name, NULL, 0, NULL);
if (desc == NULL) {
- ODP_ERR("nm_open(%s) failed\n", pkt_nm->nm_name);
+ _ODP_ERR("nm_open(%s) failed\n", pkt_nm->nm_name);
goto error;
}
pkt_nm->num_rx_rings = desc->nifp->ni_rx_rings;
@@ -589,7 +588,7 @@ static int netmap_open(odp_pktio_t id ODP_UNUSED, pktio_entry_t *pktio_entry,
uint32_t tid = syscall(SYS_gettid);
if ((int)tid == -1)
- ODP_DBG("Unable to fetch thread ID. VALE port MAC "
+ _ODP_DBG("Unable to fetch thread ID. VALE port MAC "
"addresses may not be unique.\n");
pktio_entry->capa.max_input_queues = 1;
@@ -611,7 +610,7 @@ static int netmap_open(odp_pktio_t id ODP_UNUSED, pktio_entry_t *pktio_entry,
/* Check if RSS is supported. If not, set 'max_input_queues' to 1. */
if (_odp_rss_conf_get_supported_fd(pkt_nm->sockfd, netdev,
&hash_proto) == 0) {
- ODP_DBG("RSS not supported\n");
+ _ODP_DBG("RSS not supported\n");
pktio_entry->capa.max_input_queues = 1;
}
@@ -619,7 +618,7 @@ static int netmap_open(odp_pktio_t id ODP_UNUSED, pktio_entry_t *pktio_entry,
if (err)
goto error;
if ((pkt_nm->if_flags & IFF_UP) == 0)
- ODP_DBG("%s is down\n", pkt_nm->if_name);
+ _ODP_DBG("%s is down\n", pkt_nm->if_name);
err = _odp_mac_addr_get_fd(pkt_nm->sockfd, netdev, pkt_nm->if_mac);
if (err)
@@ -628,8 +627,8 @@ static int netmap_open(odp_pktio_t id ODP_UNUSED, pktio_entry_t *pktio_entry,
/* netmap uses only ethtool to get statistics counters */
err = _odp_ethtool_stats_get_fd(pkt_nm->sockfd, pkt_nm->if_name, &cur_stats);
if (err) {
- ODP_DBG("netmap pktio %s does not support statistics counters\n",
- pkt_nm->if_name);
+ _ODP_DBG("netmap pktio %s does not support statistics counters\n",
+ pkt_nm->if_name);
pktio_entry->stats_type = STATS_UNSUPPORTED;
} else {
pktio_entry->stats_type = STATS_ETHTOOL;
@@ -703,7 +702,7 @@ static int netmap_start(pktio_entry_t *pktio_entry)
/* Use nm_open() to parse netmap flags from interface name */
desc_ptr = nm_open(pkt_nm->nm_name, NULL, 0, NULL);
if (desc_ptr == NULL) {
- ODP_ERR("nm_start(%s) failed\n", pkt_nm->nm_name);
+ _ODP_ERR("nm_start(%s) failed\n", pkt_nm->nm_name);
goto error;
}
struct nm_desc base_desc = *desc_ptr;
@@ -736,7 +735,7 @@ static int netmap_start(pktio_entry_t *pktio_entry)
desc_ring[0].desc[0] = nm_open(pkt_nm->nm_name, NULL, flags,
&base_desc);
if (desc_ring[0].desc[0] == NULL) {
- ODP_ERR("nm_start(%s) failed\n", pkt_nm->nm_name);
+ _ODP_ERR("nm_start(%s) failed\n", pkt_nm->nm_name);
goto error;
}
/* Open rest of the rx descriptors (one per netmap ring) */
@@ -755,8 +754,7 @@ static int netmap_start(pktio_entry_t *pktio_entry)
desc_ring[i].desc[j] = nm_open(pkt_nm->nm_name, NULL,
flags, &base_desc);
if (desc_ring[i].desc[j] == NULL) {
- ODP_ERR("nm_start(%s) failed\n",
- pkt_nm->nm_name);
+ _ODP_ERR("nm_start(%s) failed\n", pkt_nm->nm_name);
goto error;
}
}
@@ -778,8 +776,7 @@ static int netmap_start(pktio_entry_t *pktio_entry)
desc_ring[i].desc[j] = nm_open(pkt_nm->nm_name, NULL,
flags, &base_desc);
if (desc_ring[i].desc[j] == NULL) {
- ODP_ERR("nm_start(%s) failed\n",
- pkt_nm->nm_name);
+ _ODP_ERR("nm_start(%s) failed\n", pkt_nm->nm_name);
goto error;
}
}
@@ -934,7 +931,7 @@ static inline int netmap_recv_desc(pktio_entry_t *pktio_entry,
slot_tbl[num_rx].len = ring->slot[slot_id].len;
num_rx++;
} else {
- ODP_DBG("Dropped oversized packet: %" PRIu16 " "
+ _ODP_DBG("Dropped oversized packet: %" PRIu16 " "
"B\n", ring->slot[slot_id].len);
}
ring->cur = nm_ring_next(ring, slot_id);
@@ -1031,7 +1028,7 @@ static int netmap_recv(pktio_entry_t *pktio_entry, int index,
struct timeval tout = {.tv_sec = 0, .tv_usec = 0};
if (select(max_fd + 1, &empty_rings, NULL, NULL, &tout) == -1)
- ODP_ERR("RX: select error\n");
+ _ODP_ERR("RX: select error\n");
}
if (!pkt_nm->lockless_rx)
odp_ticketlock_unlock(&pkt_nm->rx_desc_ring[index].lock);
@@ -1293,11 +1290,11 @@ static void netmap_print(pktio_entry_t *pktio_entry)
static int netmap_init_global(void)
{
if (getenv("ODP_PKTIO_DISABLE_NETMAP")) {
- ODP_PRINT("PKTIO: netmap pktio skipped,"
+ _ODP_PRINT("PKTIO: netmap pktio skipped,"
" enabled export ODP_PKTIO_DISABLE_NETMAP=1.\n");
disable_pktio = 1;
} else {
- ODP_PRINT("PKTIO: initialized netmap pktio,"
+ _ODP_PRINT("PKTIO: initialized netmap pktio,"
" use export ODP_PKTIO_DISABLE_NETMAP=1 to disable.\n"
" Netmap prefixes are netmap:eth0 or vale:eth0. Refer to"
" Netmap documentation for usage information.\n");
diff --git a/platform/linux-generic/pktio/null.c b/platform/linux-generic/pktio/null.c
index d6060dc73..0bd33f517 100644
--- a/platform/linux-generic/pktio/null.c
+++ b/platform/linux-generic/pktio/null.c
@@ -157,7 +157,7 @@ static int null_outqueues_config(pktio_entry_t *pktio_entry ODP_UNUSED,
static int null_init_global(void)
{
- ODP_PRINT("PKTIO: initialized null interface.\n");
+ _ODP_PRINT("PKTIO: initialized null interface.\n");
return 0;
}
diff --git a/platform/linux-generic/pktio/pcap.c b/platform/linux-generic/pktio/pcap.c
index 768f876f5..20b6ec179 100644
--- a/platform/linux-generic/pktio/pcap.c
+++ b/platform/linux-generic/pktio/pcap.c
@@ -109,7 +109,7 @@ static int _pcapif_parse_devname(pkt_pcap_t *pcap, const char *devname)
} else if (strncmp(tok, "loops=", 6) == 0) {
pcap->loops = atoi(tok + 6);
if (pcap->loops < 0) {
- ODP_ERR("invalid loop count\n");
+ _ODP_ERR("invalid loop count\n");
return -1;
}
}
@@ -125,14 +125,13 @@ static int _pcapif_init_rx(pkt_pcap_t *pcap)
pcap->rx = pcap_open_offline(pcap->fname_rx, errbuf);
if (!pcap->rx) {
- ODP_ERR("failed to open pcap file %s (%s)\n",
- pcap->fname_rx, errbuf);
+ _ODP_ERR("failed to open pcap file %s (%s)\n", pcap->fname_rx, errbuf);
return -1;
}
linktype = pcap_datalink(pcap->rx);
if (linktype != DLT_EN10MB) {
- ODP_ERR("unsupported datalink type: %d\n", linktype);
+ _ODP_ERR("unsupported datalink type: %d\n", linktype);
return -1;
}
@@ -148,7 +147,7 @@ static int _pcapif_init_tx(pkt_pcap_t *pcap)
* one needs to be opened for writing the dump */
tx = pcap_open_dead(DLT_EN10MB, PKTIO_PCAP_MTU_MAX);
if (!tx) {
- ODP_ERR("failed to open TX dump\n");
+ _ODP_ERR("failed to open TX dump\n");
return -1;
}
@@ -157,8 +156,7 @@ static int _pcapif_init_tx(pkt_pcap_t *pcap)
pcap->tx_dump = pcap_dump_open(tx, pcap->fname_tx);
if (!pcap->tx_dump) {
- ODP_ERR("failed to open dump file %s (%s)\n",
- pcap->fname_tx, pcap_geterr(tx));
+ _ODP_ERR("failed to open dump file %s (%s)\n", pcap->fname_tx, pcap_geterr(tx));
return -1;
}
@@ -192,14 +190,12 @@ static int pcapif_promisc_mode_set(pktio_entry_t *pktio_entry,
if (pcap_compile(pcap->rx, &bpf, filter_exp,
0, PCAP_NETMASK_UNKNOWN) != 0) {
- ODP_ERR("failed to compile promisc mode filter: %s\n",
- pcap_geterr(pcap->rx));
+ _ODP_ERR("failed to compile promisc mode filter: %s\n", pcap_geterr(pcap->rx));
return -1;
}
if (pcap_setfilter(pcap->rx, &bpf) != 0) {
- ODP_ERR("failed to set promisc mode filter: %s\n",
- pcap_geterr(pcap->rx));
+ _ODP_ERR("failed to set promisc mode filter: %s\n", pcap_geterr(pcap->rx));
return -1;
}
@@ -274,8 +270,7 @@ static int _pcapif_reopen(pkt_pcap_t *pcap)
pcap->rx = pcap_open_offline(pcap->fname_rx, errbuf);
if (!pcap->rx) {
- ODP_ERR("failed to reopen pcap file %s (%s)\n",
- pcap->fname_rx, errbuf);
+ _ODP_ERR("failed to reopen pcap file %s (%s)\n", pcap->fname_rx, errbuf);
return 1;
}
@@ -336,7 +331,7 @@ static int pcapif_recv_pkt(pktio_entry_t *pktio_entry, int index ODP_UNUSED,
pull_head(pkt_hdr, frame_offset);
if (odp_packet_copy_from_mem(pkt, 0, pkt_len, data) != 0) {
- ODP_ERR("failed to copy packet data\n");
+ _ODP_ERR("failed to copy packet data\n");
break;
}
@@ -530,7 +525,7 @@ static int pcapif_stats(pktio_entry_t *pktio_entry,
static int pcapif_init_global(void)
{
- ODP_PRINT("PKTIO: initialized pcap interface.\n");
+ _ODP_PRINT("PKTIO: initialized pcap interface.\n");
return 0;
}
diff --git a/platform/linux-generic/pktio/pktio_common.c b/platform/linux-generic/pktio/pktio_common.c
index 5eaf40c33..097b8cf29 100644
--- a/platform/linux-generic/pktio/pktio_common.c
+++ b/platform/linux-generic/pktio/pktio_common.c
@@ -72,8 +72,8 @@ int _odp_sock_recv_mq_tmo_try_int_driven(const struct odp_pktin_queue_t queues[]
entry[i] = get_pktio_entry(queues[i].pktio);
index[i] = queues[i].index;
if (entry[i] == NULL) {
- ODP_DBG("pktio entry %" PRIuPTR " does not exist\n",
- (uintptr_t)queues[i].pktio);
+ _ODP_DBG("pktio entry %" PRIuPTR " does not exist\n",
+ (uintptr_t)queues[i].pktio);
*trial_successful = 0;
return -1;
}
diff --git a/platform/linux-generic/pktio/socket.c b/platform/linux-generic/pktio/socket.c
index 4ceb5151e..97574186c 100644
--- a/platform/linux-generic/pktio/socket.c
+++ b/platform/linux-generic/pktio/socket.c
@@ -97,7 +97,7 @@ static int sock_close(pktio_entry_t *pktio_entry)
if (pkt_sock->sockfd != -1 && close(pkt_sock->sockfd) != 0) {
_odp_errno = errno;
- ODP_ERR("close(sockfd): %s\n", strerror(errno));
+ _ODP_ERR("close(sockfd): %s\n", strerror(errno));
return -1;
}
@@ -129,7 +129,7 @@ static int sock_setup_pkt(pktio_entry_t *pktio_entry, const char *netdev,
sockfd = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
if (sockfd == -1) {
_odp_errno = errno;
- ODP_ERR("socket(): %s\n", strerror(errno));
+ _ODP_ERR("socket(): %s\n", strerror(errno));
goto error;
}
pkt_sock->sockfd = sockfd;
@@ -140,8 +140,7 @@ static int sock_setup_pkt(pktio_entry_t *pktio_entry, const char *netdev,
err = ioctl(sockfd, SIOCGIFINDEX, &ethreq);
if (err != 0) {
_odp_errno = errno;
- ODP_ERR("ioctl(SIOCGIFINDEX): %s: \"%s\".\n", strerror(errno),
- ethreq.ifr_name);
+ _ODP_ERR("ioctl(SIOCGIFINDEX): %s: \"%s\".\n", strerror(errno), ethreq.ifr_name);
goto error;
}
if_idx = ethreq.ifr_ifindex;
@@ -164,14 +163,14 @@ static int sock_setup_pkt(pktio_entry_t *pktio_entry, const char *netdev,
sa_ll.sll_protocol = htons(ETH_P_ALL);
if (bind(sockfd, (struct sockaddr *)&sa_ll, sizeof(sa_ll)) < 0) {
_odp_errno = errno;
- ODP_ERR("bind(to IF): %s\n", strerror(errno));
+ _ODP_ERR("bind(to IF): %s\n", strerror(errno));
goto error;
}
pktio_entry->stats_type = _odp_sock_stats_type_fd(pktio_entry,
pkt_sock->sockfd);
if (pktio_entry->stats_type == STATS_UNSUPPORTED)
- ODP_DBG("pktio: %s unsupported stats\n", pktio_entry->name);
+ _ODP_DBG("pktio: %s unsupported stats\n", pktio_entry->name);
err = sock_stats_reset(pktio_entry);
if (err != 0)
@@ -268,14 +267,14 @@ static int sock_mmsg_recv(pktio_entry_t *pktio_entry, int index ODP_UNUSED,
if (odp_unlikely(msgvec[i].msg_hdr.msg_flags & MSG_TRUNC)) {
odp_packet_free(pkt);
- ODP_DBG("dropped truncated packet\n");
+ _ODP_DBG("dropped truncated packet\n");
continue;
}
ret = odp_packet_trunc_tail(&pkt, odp_packet_len(pkt) - pkt_len,
NULL, NULL);
if (ret < 0) {
- ODP_ERR("trunc_tail failed");
+ _ODP_ERR("trunc_tail failed");
odp_packet_free(pkt);
continue;
}
@@ -488,7 +487,7 @@ static int sock_mmsg_send(pktio_entry_t *pktio_entry, int index ODP_UNUSED,
if (odp_unlikely(ret <= -1)) {
if (i == 0 && SOCK_ERR_REPORT(errno)) {
_odp_errno = errno;
- ODP_ERR("sendmmsg(): %s\n", strerror(errno));
+ _ODP_ERR("sendmmsg(): %s\n", strerror(errno));
odp_ticketlock_unlock(&pkt_sock->tx_lock);
return -1;
}
@@ -625,11 +624,11 @@ static int sock_extra_stat_counter(pktio_entry_t *pktio_entry, uint32_t id,
static int sock_init_global(void)
{
if (getenv("ODP_PKTIO_DISABLE_SOCKET_MMSG")) {
- ODP_PRINT("PKTIO: socket mmsg skipped,"
+ _ODP_PRINT("PKTIO: socket mmsg skipped,"
" enabled export ODP_PKTIO_DISABLE_SOCKET_MMSG=1.\n");
disable_pktio = 1;
} else {
- ODP_PRINT("PKTIO: initialized socket mmsg,"
+ _ODP_PRINT("PKTIO: initialized socket mmsg,"
" use export ODP_PKTIO_DISABLE_SOCKET_MMSG=1 to disable.\n");
}
return 0;
diff --git a/platform/linux-generic/pktio/socket_common.c b/platform/linux-generic/pktio/socket_common.c
index ab0caeb81..b6ae7b9ae 100644
--- a/platform/linux-generic/pktio/socket_common.c
+++ b/platform/linux-generic/pktio/socket_common.c
@@ -58,8 +58,7 @@ int _odp_mac_addr_get_fd(int fd, const char *name, unsigned char mac_dst[])
ret = ioctl(fd, SIOCGIFHWADDR, &ethreq);
if (ret != 0) {
_odp_errno = errno;
- ODP_ERR("ioctl(SIOCGIFHWADDR): %s: \"%s\".\n", strerror(errno),
- ethreq.ifr_name);
+ _ODP_ERR("ioctl(SIOCGIFHWADDR): %s: \"%s\".\n", strerror(errno), ethreq.ifr_name);
return -1;
}
@@ -83,8 +82,7 @@ uint32_t _odp_mtu_get_fd(int fd, const char *name)
ret = ioctl(fd, SIOCGIFMTU, &ifr);
if (ret < 0) {
_odp_errno = errno;
- ODP_ERR("ioctl(SIOCGIFMTU): %s: \"%s\".\n", strerror(errno),
- ifr.ifr_name);
+ _ODP_ERR("ioctl(SIOCGIFMTU): %s: \"%s\".\n", strerror(errno), ifr.ifr_name);
return 0;
}
return ifr.ifr_mtu + _ODP_ETHHDR_LEN;
@@ -107,8 +105,7 @@ int _odp_mtu_set_fd(int fd, const char *name, int mtu)
ret = ioctl(fd, SIOCSIFMTU, &ifr);
if (ret < 0) {
_odp_errno = errno;
- ODP_ERR("ioctl(SIOCSIFMTU): %s: \"%s\".\n", strerror(errno),
- ifr.ifr_name);
+ _ODP_ERR("ioctl(SIOCSIFMTU): %s: \"%s\".\n", strerror(errno), ifr.ifr_name);
return -1;
}
return 0;
@@ -128,8 +125,7 @@ int _odp_promisc_mode_set_fd(int fd, const char *name, int enable)
ret = ioctl(fd, SIOCGIFFLAGS, &ifr);
if (ret < 0) {
_odp_errno = errno;
- ODP_DBG("ioctl(SIOCGIFFLAGS): %s: \"%s\".\n", strerror(errno),
- ifr.ifr_name);
+ _ODP_DBG("ioctl(SIOCGIFFLAGS): %s: \"%s\".\n", strerror(errno), ifr.ifr_name);
return -1;
}
@@ -141,8 +137,7 @@ int _odp_promisc_mode_set_fd(int fd, const char *name, int enable)
ret = ioctl(fd, SIOCSIFFLAGS, &ifr);
if (ret < 0) {
_odp_errno = errno;
- ODP_DBG("ioctl(SIOCSIFFLAGS): %s: \"%s\".\n", strerror(errno),
- ifr.ifr_name);
+ _ODP_DBG("ioctl(SIOCSIFFLAGS): %s: \"%s\".\n", strerror(errno), ifr.ifr_name);
return -1;
}
return 0;
@@ -162,8 +157,7 @@ int _odp_promisc_mode_get_fd(int fd, const char *name)
ret = ioctl(fd, SIOCGIFFLAGS, &ifr);
if (ret < 0) {
_odp_errno = errno;
- ODP_DBG("ioctl(SIOCGIFFLAGS): %s: \"%s\".\n", strerror(errno),
- ifr.ifr_name);
+ _ODP_DBG("ioctl(SIOCGIFFLAGS): %s: \"%s\".\n", strerror(errno), ifr.ifr_name);
return -1;
}
@@ -179,8 +173,7 @@ int _odp_link_status_fd(int fd, const char *name)
ret = ioctl(fd, SIOCGIFFLAGS, &ifr);
if (ret < 0) {
_odp_errno = errno;
- ODP_DBG("ioctl(SIOCGIFFLAGS): %s: \"%s\".\n", strerror(errno),
- ifr.ifr_name);
+ _ODP_DBG("ioctl(SIOCGIFFLAGS): %s: \"%s\".\n", strerror(errno), ifr.ifr_name);
return ODP_PKTIO_LINK_STATUS_UNKNOWN;
}
@@ -207,8 +200,7 @@ int _odp_link_info_fd(int fd, const char *name, odp_pktio_link_info_t *info)
ifr.ifr_data = (void *)&pcmd;
if (ioctl(fd, SIOCETHTOOL, &ifr) && errno != EOPNOTSUPP) {
_odp_errno = errno;
- ODP_ERR("ioctl(SIOCETHTOOL): %s: \"%s\".\n", strerror(errno),
- ifr.ifr_name);
+ _ODP_ERR("ioctl(SIOCETHTOOL): %s: \"%s\".\n", strerror(errno), ifr.ifr_name);
return -1;
}
@@ -220,7 +212,8 @@ int _odp_link_info_fd(int fd, const char *name, odp_pktio_link_info_t *info)
ifr.ifr_data = (void *)&ecmd_old;
if (ioctl(fd, SIOCETHTOOL, &ifr) < 0) {
_odp_errno = errno;
- ODP_ERR("ioctl(SIOCETHTOOL): %s: \"%s\".\n", strerror(errno), ifr.ifr_name);
+ _ODP_ERR("ioctl(SIOCETHTOOL): %s: \"%s\".\n", strerror(errno),
+ ifr.ifr_name);
return -1;
}
@@ -261,7 +254,7 @@ int _odp_link_info_fd(int fd, const char *name, odp_pktio_link_info_t *info)
}
if (hcmd.link_mode_masks_nwords >= 0 || hcmd.cmd != ETHTOOL_GLINKSETTINGS) {
- ODP_ERR("ETHTOOL_GLINKSETTINGS handshake failed\n");
+ _ODP_ERR("ETHTOOL_GLINKSETTINGS handshake failed\n");
return -1;
}
/* Absolute value indicates kernel recommended 'link_mode_masks_nwords' value. */
@@ -278,8 +271,7 @@ int _odp_link_info_fd(int fd, const char *name, odp_pktio_link_info_t *info)
ifr.ifr_data = (void *)ecmd;
if (ioctl(fd, SIOCETHTOOL, &ifr) < 0) {
_odp_errno = errno;
- ODP_ERR("ioctl(SIOCETHTOOL): %s: \"%s\".\n", strerror(errno),
- ifr.ifr_name);
+ _ODP_ERR("ioctl(SIOCETHTOOL): %s: \"%s\".\n", strerror(errno), ifr.ifr_name);
return -1;
}
diff --git a/platform/linux-generic/pktio/socket_mmap.c b/platform/linux-generic/pktio/socket_mmap.c
index 4e1bf8527..ea6c0b9b7 100644
--- a/platform/linux-generic/pktio/socket_mmap.c
+++ b/platform/linux-generic/pktio/socket_mmap.c
@@ -114,14 +114,14 @@ static int mmap_pkt_socket(void)
if (sock == -1) {
_odp_errno = errno;
- ODP_ERR("socket(SOCK_RAW): %s\n", strerror(errno));
+ _ODP_ERR("socket(SOCK_RAW): %s\n", strerror(errno));
return -1;
}
ret = setsockopt(sock, SOL_PACKET, PACKET_VERSION, &ver, sizeof(ver));
if (ret == -1) {
_odp_errno = errno;
- ODP_ERR("setsockopt(PACKET_VERSION): %s\n", strerror(errno));
+ _ODP_ERR("setsockopt(PACKET_VERSION): %s\n", strerror(errno));
close(sock);
return -1;
}
@@ -187,7 +187,7 @@ static inline unsigned pkt_mmap_v2_rx(pktio_entry_t *pktio_entry,
if (odp_unlikely(pkt_len > pkt_sock->mtu)) {
tp_hdr->tp_status = TP_STATUS_KERNEL;
frame_num = next_frame_num;
- ODP_DBG("dropped oversized packet\n");
+ _ODP_DBG("dropped oversized packet\n");
continue;
}
@@ -251,7 +251,7 @@ static inline unsigned pkt_mmap_v2_rx(pktio_entry_t *pktio_entry,
static int warning_printed;
if (warning_printed == 0) {
- ODP_DBG("Original TPID value lost. Using 0x8100 for single tagged and 0x88a8 for double tagged.\n");
+ _ODP_DBG("Original TPID value lost. Using 0x8100 for single tagged and 0x88a8 for double tagged.\n");
warning_printed = 1;
}
type2 = (uint16_t *)(uintptr_t)(mac + (2 * _ODP_ETHADDR_LEN) + vlan_len);
@@ -347,7 +347,7 @@ static inline int pkt_mmap_v2_tx(pktio_entry_t *pktio_entry, int sock,
if (tp_status != TP_STATUS_AVAILABLE) {
if (tp_status == TP_STATUS_WRONG_FORMAT) {
- ODP_ERR("Socket mmap: wrong format\n");
+ _ODP_ERR("Socket mmap: wrong format\n");
return -1;
}
@@ -389,8 +389,7 @@ static inline int pkt_mmap_v2_tx(pktio_entry_t *pktio_entry, int sock,
/* Returns -1 when nothing is sent (send() would block) */
if (ret < 0 && errno != EWOULDBLOCK) {
- ODP_ERR("Socket mmap: send failed, ret %i, errno %i\n",
- ret, errno);
+ _ODP_ERR("Socket mmap: send failed, ret %i, errno %i\n", ret, errno);
return -1;
}
@@ -404,7 +403,7 @@ static inline int pkt_mmap_v2_tx(pktio_entry_t *pktio_entry, int sock,
break;
if (tp_status == TP_STATUS_WRONG_FORMAT) {
- ODP_ERR("Socket mmap: wrong format\n");
+ _ODP_ERR("Socket mmap: wrong format\n");
break;
}
}
@@ -462,7 +461,7 @@ static int mmap_setup_ring(pkt_sock_mmap_t *pkt_sock, struct ring *ring,
shm = odp_shm_reserve(NULL, ring_size, ODP_CACHE_LINE_SIZE, flags);
if (shm == ODP_SHM_INVALID) {
- ODP_ERR("Reserving shm failed\n");
+ _ODP_ERR("Reserving shm failed\n");
return -1;
}
ring->shm = shm;
@@ -477,21 +476,21 @@ static int mmap_setup_ring(pkt_sock_mmap_t *pkt_sock, struct ring *ring,
ring->flen = ring->req.tp_frame_size;
ring->rd_len = ring_size;
- ODP_DBG(" tp_block_size %u\n", ring->req.tp_block_size);
- ODP_DBG(" tp_block_nr %u\n", ring->req.tp_block_nr);
- ODP_DBG(" tp_frame_size %u\n", ring->req.tp_frame_size);
- ODP_DBG(" tp_frame_nr %u\n", ring->req.tp_frame_nr);
+ _ODP_DBG(" tp_block_size %u\n", ring->req.tp_block_size);
+ _ODP_DBG(" tp_block_nr %u\n", ring->req.tp_block_nr);
+ _ODP_DBG(" tp_frame_size %u\n", ring->req.tp_frame_size);
+ _ODP_DBG(" tp_frame_nr %u\n", ring->req.tp_frame_nr);
ret = setsockopt(sock, SOL_PACKET, type, &ring->req, sizeof(ring->req));
if (ret == -1) {
_odp_errno = errno;
- ODP_ERR("setsockopt(pkt mmap): %s\n", strerror(errno));
+ _ODP_ERR("setsockopt(pkt mmap): %s\n", strerror(errno));
return -1;
}
ring->rd = odp_shm_addr(shm);
if (!ring->rd) {
- ODP_ERR("Reading shm addr failed\n");
+ _ODP_ERR("Reading shm addr failed\n");
return -1;
}
@@ -516,7 +515,7 @@ static int mmap_sock(pkt_sock_mmap_t *pkt_sock)
if (pkt_sock->mmap_base == MAP_FAILED) {
_odp_errno = errno;
- ODP_ERR("mmap rx&tx buffer failed: %s\n", strerror(errno));
+ _ODP_ERR("mmap rx&tx buffer failed: %s\n", strerror(errno));
return -1;
}
@@ -572,7 +571,7 @@ static int mmap_bind_sock(pkt_sock_mmap_t *pkt_sock, const char *netdev)
sizeof(pkt_sock->ll));
if (ret == -1) {
_odp_errno = errno;
- ODP_ERR("bind(to IF): %s\n", strerror(errno));
+ _ODP_ERR("bind(to IF): %s\n", strerror(errno));
return -1;
}
@@ -586,13 +585,13 @@ static int sock_mmap_close(pktio_entry_t *entry)
ret = mmap_unmap_sock(pkt_sock);
if (ret != 0) {
- ODP_ERR("mmap_unmap_sock() %s\n", strerror(errno));
+ _ODP_ERR("mmap_unmap_sock() %s\n", strerror(errno));
return -1;
}
if (pkt_sock->sockfd != -1 && close(pkt_sock->sockfd) != 0) {
_odp_errno = errno;
- ODP_ERR("close(sockfd): %s\n", strerror(errno));
+ _ODP_ERR("close(sockfd): %s\n", strerror(errno));
return -1;
}
@@ -643,14 +642,14 @@ static int sock_mmap_open(odp_pktio_t id ODP_UNUSED,
if (pkt_sock->mtu > _ODP_SOCKET_MTU_MAX)
pkt_sock->mtu_max = pkt_sock->mtu;
- ODP_DBG("MTU size: %i\n", pkt_sock->mtu);
+ _ODP_DBG("MTU size: %i\n", pkt_sock->mtu);
- ODP_DBG("TX ring setup:\n");
+ _ODP_DBG("TX ring setup:\n");
ret = mmap_setup_ring(pkt_sock, &pkt_sock->tx_ring, PACKET_TX_RING);
if (ret != 0)
goto error;
- ODP_DBG("RX ring setup:\n");
+ _ODP_DBG("RX ring setup:\n");
ret = mmap_setup_ring(pkt_sock, &pkt_sock->rx_ring, PACKET_RX_RING);
if (ret != 0)
goto error;
@@ -666,14 +665,14 @@ static int sock_mmap_open(odp_pktio_t id ODP_UNUSED,
if_idx = if_nametoindex(netdev);
if (if_idx == 0) {
_odp_errno = errno;
- ODP_ERR("if_nametoindex(): %s\n", strerror(errno));
+ _ODP_ERR("if_nametoindex(): %s\n", strerror(errno));
goto error;
}
pktio_entry->stats_type = _odp_sock_stats_type_fd(pktio_entry,
pkt_sock->sockfd);
if (pktio_entry->stats_type == STATS_UNSUPPORTED)
- ODP_DBG("pktio: %s unsupported stats\n", pktio_entry->name);
+ _ODP_DBG("pktio: %s unsupported stats\n", pktio_entry->name);
ret = _odp_sock_stats_reset_fd(pktio_entry,
pkt_priv(pktio_entry)->sockfd);
@@ -934,11 +933,11 @@ static int sock_mmap_extra_stat_counter(pktio_entry_t *pktio_entry, uint32_t id,
static int sock_mmap_init_global(void)
{
if (getenv("ODP_PKTIO_DISABLE_SOCKET_MMAP")) {
- ODP_PRINT("PKTIO: socket mmap skipped,"
+ _ODP_PRINT("PKTIO: socket mmap skipped,"
" enabled export ODP_PKTIO_DISABLE_SOCKET_MMAP=1.\n");
disable_pktio = 1;
} else {
- ODP_PRINT("PKTIO: initialized socket mmap,"
+ _ODP_PRINT("PKTIO: initialized socket mmap,"
" use export ODP_PKTIO_DISABLE_SOCKET_MMAP=1 to disable.\n");
}
return 0;
diff --git a/platform/linux-generic/pktio/socket_xdp.c b/platform/linux-generic/pktio/socket_xdp.c
index 2b4abf66c..b10fc9fce 100644
--- a/platform/linux-generic/pktio/socket_xdp.c
+++ b/platform/linux-generic/pktio/socket_xdp.c
@@ -121,11 +121,11 @@ static odp_bool_t disable_pktio;
static int sock_xdp_init_global(void)
{
if (getenv("ODP_PKTIO_DISABLE_SOCKET_XDP")) {
- ODP_PRINT("PKTIO: socket xdp skipped,"
+ _ODP_PRINT("PKTIO: socket xdp skipped,"
" enabled export ODP_PKTIO_DISABLE_SOCKET_XDP=1.\n");
disable_pktio = true;
} else {
- ODP_PRINT("PKTIO: initialized socket xdp,"
+ _ODP_PRINT("PKTIO: initialized socket xdp,"
" use export ODP_PKTIO_DISABLE_SOCKET_XDP=1 to disable.\n");
}
@@ -143,16 +143,16 @@ static void parse_options(xdp_umem_info_t *umem_info)
&umem_info->num_rx_desc) ||
!_odp_libconfig_lookup_ext_int(CONF_BASE_STR, NULL, TX_DESCS_STR,
&umem_info->num_tx_desc)) {
- ODP_ERR("Unable to parse xdp descriptor configuration, using defaults (%d).\n",
- NUM_DESCS_DEFAULT);
+ _ODP_ERR("Unable to parse xdp descriptor configuration, using defaults (%d).\n",
+ NUM_DESCS_DEFAULT);
goto defaults;
}
if (umem_info->num_rx_desc <= 0 || umem_info->num_tx_desc <= 0 ||
!_ODP_CHECK_IS_POWER2(umem_info->num_rx_desc) ||
!_ODP_CHECK_IS_POWER2(umem_info->num_tx_desc)) {
- ODP_ERR("Invalid xdp descriptor configuration, using defaults (%d).\n",
- NUM_DESCS_DEFAULT);
+ _ODP_ERR("Invalid xdp descriptor configuration, using defaults (%d).\n",
+ NUM_DESCS_DEFAULT);
goto defaults;
}
@@ -251,7 +251,7 @@ static int sock_xdp_open(odp_pktio_t pktio, pktio_entry_t *pktio_entry, const ch
ret = umem_create(priv->umem_info, pool);
if (ret) {
- ODP_ERR("Error creating UMEM pool for xdp: %d\n", ret);
+ _ODP_ERR("Error creating UMEM pool for xdp: %d\n", ret);
return -1;
}
@@ -263,7 +263,7 @@ static int sock_xdp_open(odp_pktio_t pktio, pktio_entry_t *pktio_entry, const ch
ret = socket(AF_INET, SOCK_DGRAM, 0);
if (ret == -1) {
- ODP_ERR("Error creating helper socket for xdp: %s\n", strerror(errno));
+ _ODP_ERR("Error creating helper socket for xdp: %s\n", strerror(errno));
goto sock_err;
}
@@ -282,10 +282,10 @@ static int sock_xdp_open(odp_pktio_t pktio, pktio_entry_t *pktio_entry, const ch
priv->bind_q = get_bind_queue_index(pktio_entry->name);
- ODP_DBG("Socket xdp interface (%s):\n", pktio_entry->name);
- ODP_DBG(" num_rx_desc: %d\n", priv->umem_info->num_rx_desc);
- ODP_DBG(" num_tx_desc: %d\n", priv->umem_info->num_tx_desc);
- ODP_DBG(" starting bind queue: %u\n", priv->bind_q);
+ _ODP_DBG("Socket xdp interface (%s):\n", pktio_entry->name);
+ _ODP_DBG(" num_rx_desc: %d\n", priv->umem_info->num_rx_desc);
+ _ODP_DBG(" num_tx_desc: %d\n", priv->umem_info->num_tx_desc);
+ _ODP_DBG(" starting bind queue: %u\n", priv->bind_q);
return 0;
@@ -465,7 +465,7 @@ static int sock_xdp_extra_stat_counter(pktio_entry_t *pktio_entry, uint32_t id,
const uint32_t total_stats = MAX_INTERNAL_STATS * priv->num_q;
if (id >= total_stats) {
- ODP_ERR("Invalid counter id: %u (allowed range: 0-%u)\n", id, total_stats - 1U);
+ _ODP_ERR("Invalid counter id: %u (allowed range: 0-%u)\n", id, total_stats - 1U);
return -1;
}
@@ -652,9 +652,9 @@ static void handle_pending_tx(xdp_sock_t *sock, uint8_t *base_addr, int num)
compl_q = &sock->compl_q;
sent = xsk_ring_cons__peek(compl_q, num, &start_idx);
- odp_packet_t packets[sent];
-
if (sent) {
+ odp_packet_t packets[sent];
+
for (uint32_t i = 0U; i < sent; ++i) {
frame_off = *xsk_ring_cons__comp_addr(compl_q, start_idx++);
frame_off = xsk_umem__extract_addr(frame_off);
@@ -845,7 +845,7 @@ static int set_queue_capability(int fd, const char *devname, odp_pktio_capabilit
if (ret == -1 || channels.max_combined == 0U) {
if (ret == -1 && errno != EOPNOTSUPP) {
- ODP_ERR("Unable to query NIC channel capabilities: %s\n", strerror(errno));
+ _ODP_ERR("Unable to query NIC channel capabilities: %s\n", strerror(errno));
return -1;
}
@@ -940,15 +940,15 @@ static int sock_xdp_output_queues_config(pktio_entry_t *pktio_entry,
&sock->tx, &sock->fill_q, &sock->compl_q, &config);
if (ret) {
- ODP_ERR("Error creating xdp socket for bind queue %u: %d\n", bind_q, ret);
+ _ODP_ERR("Error creating xdp socket for bind queue %u: %d\n", bind_q, ret);
goto err;
}
++i;
if (!reserve_fill_queue_elements(priv, sock, config.rx_size)) {
- ODP_ERR("Unable to reserve fill queue descriptors for queue: %u.\n",
- bind_q);
+ _ODP_ERR("Unable to reserve fill queue descriptors for queue: %u.\n",
+ bind_q);
goto err;
}
@@ -1032,8 +1032,8 @@ static void sock_xdp_adjust_block_size(uint8_t *data ODP_UNUSED, uint32_t *block
return;
if (size > ps) {
- ODP_ERR("Adjusted pool block size larger than page size: %u > %" PRIu64 "\n",
- size, ps);
+ _ODP_ERR("Adjusted pool block size larger than page size: %u > %" PRIu64 "\n",
+ size, ps);
*block_size = 0U;
}
diff --git a/platform/linux-generic/pktio/stats/ethtool_stats.c b/platform/linux-generic/pktio/stats/ethtool_stats.c
index f300ed0ba..678ec45ee 100644
--- a/platform/linux-generic/pktio/stats/ethtool_stats.c
+++ b/platform/linux-generic/pktio/stats/ethtool_stats.c
@@ -51,7 +51,7 @@ static struct ethtool_gstrings *get_stringset(int fd, struct ifreq *ifr)
ifr->ifr_data = (void *)&drvinfo;
if (ioctl(fd, SIOCETHTOOL, ifr)) {
_odp_errno = errno;
- ODP_ERR("Cannot get stats information\n");
+ _ODP_ERR("Cannot get stats information\n");
return NULL;
}
len = *(uint32_t *)(void *)((char *)&drvinfo + drvinfo_offset);
@@ -61,13 +61,13 @@ static struct ethtool_gstrings *get_stringset(int fd, struct ifreq *ifr)
}
if (!len) {
- ODP_ERR("len is zero");
+ _ODP_ERR("len is zero");
return NULL;
}
strings = calloc(1, sizeof(*strings) + len * ETH_GSTRING_LEN);
if (!strings) {
- ODP_ERR("alloc failed\n");
+ _ODP_ERR("alloc failed\n");
return NULL;
}
@@ -77,7 +77,7 @@ static struct ethtool_gstrings *get_stringset(int fd, struct ifreq *ifr)
ifr->ifr_data = (void *)strings;
if (ioctl(fd, SIOCETHTOOL, ifr)) {
_odp_errno = errno;
- ODP_ERR("Cannot get stats information\n");
+ _ODP_ERR("Cannot get stats information\n");
free(strings);
return NULL;
}
@@ -105,7 +105,7 @@ static int ethtool_stats_get(int fd, const char *name,
n_stats = strings->len;
if (n_stats < 1) {
- ODP_ERR("no stats available\n");
+ _ODP_ERR("no stats available\n");
free(strings);
return -1;
}
@@ -272,7 +272,7 @@ int _odp_ethtool_extra_stat_counter(int fd, const char *name, uint32_t id,
return -1;
if (id >= n_stats) {
- ODP_ERR("Invalid counter id\n");
+ _ODP_ERR("Invalid counter id\n");
ret = -1;
} else {
*stat = estats->data[id];
diff --git a/platform/linux-generic/pktio/stats/packet_io_stats.c b/platform/linux-generic/pktio/stats/packet_io_stats.c
index 54df874f0..ac61c0343 100644
--- a/platform/linux-generic/pktio/stats/packet_io_stats.c
+++ b/platform/linux-generic/pktio/stats/packet_io_stats.c
@@ -24,7 +24,7 @@ static int sock_stats_get(pktio_entry_t *e, odp_pktio_stats_t *stats, int fd)
ret = _odp_sysfs_stats(e, stats);
if (ret)
- ODP_ERR("Failed to get pktio statistics.\n");
+ _ODP_ERR("Failed to get pktio statistics.\n");
return ret;
}
diff --git a/platform/linux-generic/pktio/stats/sysfs_stats.c b/platform/linux-generic/pktio/stats/sysfs_stats.c
index 94872dfd7..d9fb0754c 100644
--- a/platform/linux-generic/pktio/stats/sysfs_stats.c
+++ b/platform/linux-generic/pktio/stats/sysfs_stats.c
@@ -32,7 +32,7 @@ static int sysfs_get_val(const char *fname, uint64_t *val)
* kernel driver.
*/
if (errno != ENOENT)
- ODP_ERR("fopen %s: %s\n", fname, strerror(errno));
+ _ODP_ERR("fopen %s: %s\n", fname, strerror(errno));
return 0;
}
@@ -42,7 +42,7 @@ static int sysfs_get_val(const char *fname, uint64_t *val)
(void)fclose(file);
if (ret != 1) {
- ODP_ERR("read %s\n", fname);
+ _ODP_ERR("read %s\n", fname);
return -1;
}
@@ -103,7 +103,7 @@ int _odp_sysfs_extra_stat_info(pktio_entry_t *pktio_entry,
snprintf(sysfs_dir, PATH_MAX, SYSFS_DIR, pktio_entry->name);
dir = opendir(sysfs_dir);
if (!dir) {
- ODP_ERR("Failed to open sysfs dir: %s\n", sysfs_dir);
+ _ODP_ERR("Failed to open sysfs dir: %s\n", sysfs_dir);
return -1;
}
@@ -135,7 +135,7 @@ int _odp_sysfs_extra_stats(pktio_entry_t *pktio_entry, uint64_t stats[],
snprintf(sysfs_dir, PATH_MAX, SYSFS_DIR, pktio_entry->name);
dir = opendir(sysfs_dir);
if (!dir) {
- ODP_ERR("Failed to open dir: %s\n", sysfs_dir);
+ _ODP_ERR("Failed to open dir: %s\n", sysfs_dir);
return -1;
}
@@ -148,7 +148,7 @@ int _odp_sysfs_extra_stats(pktio_entry_t *pktio_entry, uint64_t stats[],
snprintf(file_path, PATH_MAX, "%s/%s", sysfs_dir, e->d_name);
if (sysfs_get_val(file_path, &val)) {
- ODP_ERR("Failed to read file: %s/n", file_path);
+ _ODP_ERR("Failed to read file: %s/n", file_path);
counters = -1;
break;
}
@@ -176,7 +176,7 @@ int _odp_sysfs_extra_stat_counter(pktio_entry_t *pktio_entry, uint32_t id,
snprintf(sysfs_dir, PATH_MAX, SYSFS_DIR, pktio_entry->name);
dir = opendir(sysfs_dir);
if (!dir) {
- ODP_ERR("Failed to open dir: %s\n", sysfs_dir);
+ _ODP_ERR("Failed to open dir: %s\n", sysfs_dir);
return -1;
}
@@ -191,7 +191,7 @@ int _odp_sysfs_extra_stat_counter(pktio_entry_t *pktio_entry, uint32_t id,
snprintf(file_path, PATH_MAX, "%s/%s",
sysfs_dir, e->d_name);
if (sysfs_get_val(file_path, &val)) {
- ODP_ERR("Failed to read file: %s/n", file_path);
+ _ODP_ERR("Failed to read file: %s/n", file_path);
} else {
*stat = val;
ret = 0;
diff --git a/platform/linux-generic/pktio/tap.c b/platform/linux-generic/pktio/tap.c
index 7b0df4cac..604e53170 100644
--- a/platform/linux-generic/pktio/tap.c
+++ b/platform/linux-generic/pktio/tap.c
@@ -78,7 +78,7 @@ static int gen_random_mac(unsigned char *mac)
{
mac[0] = 0x7a; /* not multicast and local assignment bit is set */
if (odp_random_data(mac + 1, 5, ODP_RANDOM_BASIC) < 5) {
- ODP_ERR("odp_random_data failed.\n");
+ _ODP_ERR("odp_random_data failed.\n");
return -1;
}
return 0;
@@ -99,8 +99,7 @@ static int mac_addr_set_fd(int fd, const char *name,
ret = ioctl(fd, SIOCSIFHWADDR, &ethreq);
if (ret != 0) {
_odp_errno = errno;
- ODP_ERR("ioctl(SIOCSIFHWADDR): %s: \"%s\".\n", strerror(errno),
- ethreq.ifr_name);
+ _ODP_ERR("ioctl(SIOCSIFHWADDR): %s: \"%s\".\n", strerror(errno), ethreq.ifr_name);
return -1;
}
@@ -130,7 +129,7 @@ static int tap_pktio_open(odp_pktio_t id ODP_UNUSED,
fd = open("/dev/net/tun", O_RDWR);
if (fd < 0) {
_odp_errno = errno;
- ODP_ERR("failed to open /dev/net/tun: %s\n", strerror(errno));
+ _ODP_ERR("failed to open /dev/net/tun: %s\n", strerror(errno));
return -1;
}
@@ -145,8 +144,7 @@ static int tap_pktio_open(odp_pktio_t id ODP_UNUSED,
if (ioctl(fd, TUNSETIFF, (void *)&ifr) < 0) {
_odp_errno = errno;
- ODP_ERR("%s: creating tap device failed: %s\n",
- ifr.ifr_name, strerror(errno));
+ _ODP_ERR("%s: creating tap device failed: %s\n", ifr.ifr_name, strerror(errno));
goto tap_err;
}
@@ -154,13 +152,13 @@ static int tap_pktio_open(odp_pktio_t id ODP_UNUSED,
flags = fcntl(fd, F_GETFL, 0);
if (flags < 0) {
_odp_errno = errno;
- ODP_ERR("fcntl(F_GETFL) failed: %s\n", strerror(errno));
+ _ODP_ERR("fcntl(F_GETFL) failed: %s\n", strerror(errno));
goto tap_err;
}
if (fcntl(fd, F_SETFL, flags | O_NONBLOCK) < 0) {
_odp_errno = errno;
- ODP_ERR("fcntl(F_SETFL) failed: %s\n", strerror(errno));
+ _ODP_ERR("fcntl(F_SETFL) failed: %s\n", strerror(errno));
goto tap_err;
}
@@ -171,14 +169,14 @@ static int tap_pktio_open(odp_pktio_t id ODP_UNUSED,
skfd = socket(AF_INET, SOCK_DGRAM, 0);
if (skfd < 0) {
_odp_errno = errno;
- ODP_ERR("socket creation failed: %s\n", strerror(errno));
+ _ODP_ERR("socket creation failed: %s\n", strerror(errno));
goto tap_err;
}
mtu = _odp_mtu_get_fd(skfd, devname + 4);
if (mtu == 0) {
_odp_errno = errno;
- ODP_ERR("_odp_mtu_get_fd failed: %s\n", strerror(errno));
+ _ODP_ERR("_odp_mtu_get_fd failed: %s\n", strerror(errno));
goto sock_err;
}
tap->mtu_max = _ODP_SOCKET_MTU_MAX;
@@ -194,7 +192,7 @@ sock_err:
close(skfd);
tap_err:
close(fd);
- ODP_ERR("Tap device alloc failed.\n");
+ _ODP_ERR("Tap device alloc failed.\n");
return -1;
}
@@ -210,7 +208,7 @@ static int tap_pktio_start(pktio_entry_t *pktio_entry)
/* Up interface by default. */
if (ioctl(tap->skfd, SIOCGIFFLAGS, &ifr) < 0) {
_odp_errno = errno;
- ODP_ERR("ioctl(SIOCGIFFLAGS) failed: %s\n", strerror(errno));
+ _ODP_ERR("ioctl(SIOCGIFFLAGS) failed: %s\n", strerror(errno));
goto sock_err;
}
@@ -219,13 +217,13 @@ static int tap_pktio_start(pktio_entry_t *pktio_entry)
if (ioctl(tap->skfd, SIOCSIFFLAGS, &ifr) < 0) {
_odp_errno = errno;
- ODP_ERR("failed to come up: %s\n", strerror(errno));
+ _ODP_ERR("failed to come up: %s\n", strerror(errno));
goto sock_err;
}
return 0;
sock_err:
- ODP_ERR("Tap device open failed.\n");
+ _ODP_ERR("Tap device open failed.\n");
return -1;
}
@@ -241,7 +239,7 @@ static int tap_pktio_stop(pktio_entry_t *pktio_entry)
/* Up interface by default. */
if (ioctl(tap->skfd, SIOCGIFFLAGS, &ifr) < 0) {
_odp_errno = errno;
- ODP_ERR("ioctl(SIOCGIFFLAGS) failed: %s\n", strerror(errno));
+ _ODP_ERR("ioctl(SIOCGIFFLAGS) failed: %s\n", strerror(errno));
goto sock_err;
}
@@ -250,13 +248,13 @@ static int tap_pktio_stop(pktio_entry_t *pktio_entry)
if (ioctl(tap->skfd, SIOCSIFFLAGS, &ifr) < 0) {
_odp_errno = errno;
- ODP_ERR("failed to come up: %s\n", strerror(errno));
+ _ODP_ERR("failed to come up: %s\n", strerror(errno));
goto sock_err;
}
return 0;
sock_err:
- ODP_ERR("Tap device open failed.\n");
+ _ODP_ERR("Tap device open failed.\n");
return -1;
}
@@ -267,13 +265,13 @@ static int tap_pktio_close(pktio_entry_t *pktio_entry)
if (tap->fd != -1 && close(tap->fd) != 0) {
_odp_errno = errno;
- ODP_ERR("close(tap->fd): %s\n", strerror(errno));
+ _ODP_ERR("close(tap->fd): %s\n", strerror(errno));
ret = -1;
}
if (tap->skfd != -1 && close(tap->skfd) != 0) {
_odp_errno = errno;
- ODP_ERR("close(tap->skfd): %s\n", strerror(errno));
+ _ODP_ERR("close(tap->skfd): %s\n", strerror(errno));
ret = -1;
}
@@ -301,7 +299,7 @@ static odp_packet_t pack_odp_pkt(pktio_entry_t *pktio_entry, const void *data,
pull_head(pkt_hdr, frame_offset);
if (odp_packet_copy_from_mem(pkt, 0, len, data) < 0) {
- ODP_ERR("failed to copy packet data\n");
+ _ODP_ERR("failed to copy packet data\n");
odp_packet_free(pkt);
return ODP_PACKET_INVALID;
}
@@ -401,7 +399,7 @@ static int tap_pktio_send_lockless(pktio_entry_t *pktio_entry,
}
if (odp_packet_copy_to_mem(pkts[i], 0, pkt_len, buf) < 0) {
- ODP_ERR("failed to copy packet data\n");
+ _ODP_ERR("failed to copy packet data\n");
break;
}
@@ -412,12 +410,12 @@ static int tap_pktio_send_lockless(pktio_entry_t *pktio_entry,
if (retval < 0) {
if (i == 0 && SOCK_ERR_REPORT(errno)) {
_odp_errno = errno;
- ODP_ERR("write(): %s\n", strerror(errno));
+ _ODP_ERR("write(): %s\n", strerror(errno));
return -1;
}
break;
} else if ((uint32_t)retval != pkt_len) {
- ODP_ERR("sent partial ethernet packet\n");
+ _ODP_ERR("sent partial ethernet packet\n");
if (i == 0) {
_odp_errno = EMSGSIZE;
return -1;