This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "".
The branch, master has been updated via 235478efa4afa44167b0af95b5ee10e635beed08 (commit) via 784508fa45ed1a006ee7924737c69d33758563cd (commit) via cb42240e0e8eb586694f96adeac814421a57f838 (commit) via 79de47dbfc26fa53070f6a7b08e63b3bc5b0440f (commit) via 9585df1b0fc62cdb645f1faeeb05fbe1a365197d (commit) via bc6bf0a4ff3c7b5f1a0709fcf6451683958a124b (commit) from 5a63614fd03e4fafe24ea576790c44792d998a1c (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- commit 235478efa4afa44167b0af95b5ee10e635beed08 Author: Matias Elo matias.elo@nokia.com Date: Mon Sep 16 16:34:07 2019 +0300
validation: use helper library debug macros
Use ODP helper library debug macros instead of reimplementing the same functionality in test_debug.h.
Signed-off-by: Matias Elo matias.elo@nokia.com Reviewed-by: Petri Savolainen petri.savolainen@nokia.com
diff --git a/test/common/Makefile.am b/test/common/Makefile.am index fbd5d52f4..79146e01c 100644 --- a/test/common/Makefile.am +++ b/test/common/Makefile.am @@ -14,5 +14,5 @@ libthrmask_common_la_CFLAGS = $(AM_CFLAGS) -DTEST_THRMASK
endif
-noinst_HEADERS = test_debug.h test_packet_parser.h +noinst_HEADERS = test_packet_parser.h dist_test_SCRIPTS = run-test.sh diff --git a/test/common/odp_cunit_common.c b/test/common/odp_cunit_common.c index eceff6537..f6e7a0490 100644 --- a/test/common/odp_cunit_common.c +++ b/test/common/odp_cunit_common.c @@ -4,14 +4,11 @@ * SPDX-License-Identifier: BSD-3-Clause */
-#include "config.h" - #include <stdlib.h> #include <string.h> #include <unistd.h> #include <odp_api.h> #include "odp_cunit_common.h" -#include "test_debug.h" #include <odp/helper/odph_api.h>
#include <CUnit/TestDB.h> @@ -431,8 +428,8 @@ int odp_cunit_parse_options(int argc, char *argv[])
if (env && !strcmp(env, "true")) { allow_skip_result = 1; - LOG_DBG("\nWARNING: test result can be used for code coverage only.\n" - "CI=true env variable is set!\n"); + ODPH_DBG("\nWARNING: test result can be used for code coverage only.\n" + "CI=true env variable is set!\n"); }
return 0; diff --git a/test/common/test_debug.h b/test/common/test_debug.h deleted file mode 100644 index e2177941a..000000000 --- a/test/common/test_debug.h +++ /dev/null @@ -1,93 +0,0 @@ -/* Copyright (c) 2014-2018, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ -/** - * @file - * - * test debug - */ - -#ifndef TEST_DEBUG_H_ -#define TEST_DEBUG_H_ - -#include <stdio.h> -#include <stdlib.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef TEST_DEBUG_PRINT -#define TEST_DEBUG_PRINT 1 -#endif - -/** - * log level. - */ -typedef enum test_log_level { - TEST_LOG_DBG, - TEST_LOG_ERR, - TEST_LOG_ABORT -} test_log_level_e; - -/** - * default LOG macro. - */ -#define TEST_LOG(level, fmt, ...) \ -do { \ - switch (level) { \ - case TEST_LOG_ERR: \ - fprintf(stderr, "%s:%d:%s():" fmt, __FILE__, \ - __LINE__, __func__, ##__VA_ARGS__); \ - break; \ - case TEST_LOG_DBG: \ - if (TEST_DEBUG_PRINT == 1) \ - fprintf(stderr, "%s:%d:%s():" fmt, __FILE__, \ - __LINE__, __func__, ##__VA_ARGS__); \ - break; \ - case TEST_LOG_ABORT: \ - fprintf(stderr, "%s:%d:%s(): " fmt, __FILE__, \ - __LINE__, __func__, ##__VA_ARGS__); \ - abort(); \ - break; \ - default: \ - fprintf(stderr, "Unknown LOG level"); \ - break;\ - } \ -} while (0) - -/** - * Debug printing macro, which prints output when DEBUG flag is set. - */ -#define LOG_DBG(fmt, ...) \ - TEST_LOG(TEST_LOG_DBG, fmt, ##__VA_ARGS__) - -/** - * Print output to stderr (file, line and function). - */ -#define LOG_ERR(fmt, ...) \ - TEST_LOG(TEST_LOG_ERR, fmt, ##__VA_ARGS__) - -/** - * Print output to stderr (file, line and function), - * then abort. - */ -#define LOG_ABORT(fmt, ...) \ - TEST_LOG(TEST_LOG_ABORT, fmt, ##__VA_ARGS__) - -/** - * @} - */ - -/** - * Mark intentionally unused argument for functions - */ -#define TEST_UNUSED __attribute__((__unused__)) - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/test/validation/api/classification/odp_classification_common.c b/test/validation/api/classification/odp_classification_common.c index 80eb9e3c4..ad64b9d4a 100644 --- a/test/validation/api/classification/odp_classification_common.c +++ b/test/validation/api/classification/odp_classification_common.c @@ -4,12 +4,10 @@ * SPDX-License-Identifier: BSD-3-Clause */
-#include "config.h" - #include "odp_classification_testsuites.h" #include "classification.h" #include <odp_cunit_common.h> -#include "test_debug.h" +#include <odp/helper/odph_api.h>
typedef struct cls_test_packet { odp_u32be_t magic; @@ -359,7 +357,7 @@ odp_packet_t create_packet(cls_packet_info_t pkt_info) udp->chksum = 0; odp_packet_has_udp_set(pkt, 1); if (odph_udp_tcp_chksum(pkt, ODPH_CHKSUM_GENERATE, NULL) != 0) { - LOG_ERR("odph_udp_tcp_chksum failed\n"); + ODPH_ERR("odph_udp_tcp_chksum failed\n"); return ODP_PACKET_INVALID; } } else { @@ -369,7 +367,7 @@ odp_packet_t create_packet(cls_packet_info_t pkt_info) tcp->cksm = 0; odp_packet_has_tcp_set(pkt, 1); if (odph_udp_tcp_chksum(pkt, ODPH_CHKSUM_GENERATE, NULL) != 0) { - LOG_ERR("odph_udp_tcp_chksum failed\n"); + ODPH_ERR("odph_udp_tcp_chksum failed\n"); return ODP_PACKET_INVALID; }
diff --git a/test/validation/api/system/system.c b/test/validation/api/system/system.c index f016a2ded..090999457 100644 --- a/test/validation/api/system/system.c +++ b/test/validation/api/system/system.c @@ -4,13 +4,11 @@ * SPDX-License-Identifier: BSD-3-Clause */
-#include "config.h" - #include <ctype.h> #include <odp_api.h> -#include <odp/api/cpumask.h> +#include <odp/helper/odph_api.h> + #include "odp_cunit_common.h" -#include "test_debug.h"
#define DIFF_TRY_NUM 160 #define RES_TRY_NUM 10 @@ -34,7 +32,7 @@ static void system_test_odp_version_numbers(void) s++; } else { char_ok = 0; - LOG_DBG("\nBAD VERSION=%s\n", version_string); + ODPH_DBG("\nBAD VERSION=%s\n", version_string); break; } } @@ -218,7 +216,7 @@ static void system_test_odp_sys_huge_page_size(void) page = odp_sys_huge_page_size(); if (page == 0) /* Not an error, but just to be sure to hit logs */ - LOG_ERR("Huge pages do not seem to be supported\n"); + ODPH_ERR("Huge pages do not seem to be supported\n"); else CU_ASSERT(page % ODP_PAGE_SIZE == 0); } diff --git a/test/validation/api/thread/thread.c b/test/validation/api/thread/thread.c index 7b40cda62..59b92e45f 100644 --- a/test/validation/api/thread/thread.c +++ b/test/validation/api/thread/thread.c @@ -4,13 +4,10 @@ * SPDX-License-Identifier: BSD-3-Clause */
-#include "config.h" - #include <odp_api.h> #include <odp/helper/odph_api.h> #include <odp_cunit_common.h> #include <mask_common.h> -#include <test_debug.h>
#define GLOBAL_SHM_NAME "GlobalThreadTest"
@@ -100,7 +97,7 @@ static void thread_test_odp_thread_count(void) CU_PASS(); }
-static int thread_func(void *arg TEST_UNUSED) +static int thread_func(void *arg ODP_UNUSED) { /* indicate that thread has started */ odp_barrier_wait(&global_mem->bar_entry); diff --git a/test/validation/api/timer/timer.c b/test/validation/api/timer/timer.c index c0527c2e1..376a1218b 100644 --- a/test/validation/api/timer/timer.c +++ b/test/validation/api/timer/timer.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */
-#include "config.h" - /* For rand_r and nanosleep */ #ifndef _GNU_SOURCE #define _GNU_SOURCE @@ -15,7 +13,6 @@ #include <odp.h> #include <odp/helper/odph_api.h> #include "odp_cunit_common.h" -#include "test_debug.h"
#define GLOBAL_SHM_NAME "GlobalTimerTest"
@@ -435,13 +432,13 @@ static void timer_test_event_type(odp_queue_type_t queue_type, period_tick = odp_timer_ns_to_tick(timer_pool, period_ns); duration_ns = num * period_ns;
- LOG_DBG("\nTimer pool parameters:\n"); - LOG_DBG(" res_ns %" PRIu64 "\n", timer_param.res_ns); - LOG_DBG(" min_tmo %" PRIu64 "\n", timer_param.min_tmo); - LOG_DBG(" max_tmo %" PRIu64 "\n", timer_param.max_tmo); - LOG_DBG(" period_ns %" PRIu64 "\n", period_ns); - LOG_DBG(" period_tick %" PRIu64 "\n", period_tick); - LOG_DBG(" duration_ns %" PRIu64 "\n\n", duration_ns); + ODPH_DBG("\nTimer pool parameters:\n"); + ODPH_DBG(" res_ns %" PRIu64 "\n", timer_param.res_ns); + ODPH_DBG(" min_tmo %" PRIu64 "\n", timer_param.min_tmo); + ODPH_DBG(" max_tmo %" PRIu64 "\n", timer_param.max_tmo); + ODPH_DBG(" period_ns %" PRIu64 "\n", period_ns); + ODPH_DBG(" period_tick %" PRIu64 "\n", period_tick); + ODPH_DBG(" duration_ns %" PRIu64 "\n\n", duration_ns);
for (i = 0; i < num; i++) { if (event_type == ODP_EVENT_BUFFER) { @@ -463,11 +460,11 @@ static void timer_test_event_type(odp_queue_type_t queue_type, ret = odp_timer_set_rel(timer[i], (i + 1) * period_tick, &ev);
if (ret == ODP_TIMER_TOOEARLY) - LOG_DBG("Too early %i\n", i); + ODPH_DBG("Too early %i\n", i); else if (ret == ODP_TIMER_TOOLATE) - LOG_DBG("Too late %i\n", i); + ODPH_DBG("Too late %i\n", i); else if (ret == ODP_TIMER_NOEVENT) - LOG_DBG("No event %i\n", i); + ODPH_DBG("No event %i\n", i);
CU_ASSERT(ret == ODP_TIMER_SUCCESS); } @@ -573,10 +570,10 @@ static void timer_test_queue_type(odp_queue_type_t queue_type) tparam.priv = 0; tparam.clk_src = ODP_CLOCK_CPU;
- LOG_DBG("\nTimer pool parameters:\n"); - LOG_DBG(" res_ns %" PRIu64 "\n", tparam.res_ns); - LOG_DBG(" min_tmo %" PRIu64 "\n", tparam.min_tmo); - LOG_DBG(" max_tmo %" PRIu64 "\n", tparam.max_tmo); + ODPH_DBG("\nTimer pool parameters:\n"); + ODPH_DBG(" res_ns %" PRIu64 "\n", tparam.res_ns); + ODPH_DBG(" min_tmo %" PRIu64 "\n", tparam.min_tmo); + ODPH_DBG(" max_tmo %" PRIu64 "\n", tparam.max_tmo);
tp = odp_timer_pool_create("timer_pool", &tparam); if (tp == ODP_TIMER_POOL_INVALID) @@ -599,8 +596,8 @@ static void timer_test_queue_type(odp_queue_type_t queue_type) period_tick = odp_timer_ns_to_tick(tp, period_ns); test_period = num * period_ns;
- LOG_DBG(" period_ns %" PRIu64 "\n", period_ns); - LOG_DBG(" period_tick %" PRIu64 "\n\n", period_tick); + ODPH_DBG(" period_ns %" PRIu64 "\n", period_ns); + ODPH_DBG(" period_tick %" PRIu64 "\n\n", period_tick);
tick_base = odp_timer_current_tick(tp); t0 = odp_time_local(); @@ -619,13 +616,13 @@ static void timer_test_queue_type(odp_queue_type_t queue_type) tick = tick_base + ((i + 1) * period_tick); ret = odp_timer_set_abs(tim, tick, &ev);
- LOG_DBG("abs timer tick %" PRIu64 "\n", tick); + ODPH_DBG("abs timer tick %" PRIu64 "\n", tick); if (ret == ODP_TIMER_TOOEARLY) - LOG_DBG("Too early %" PRIu64 "\n", tick); + ODPH_DBG("Too early %" PRIu64 "\n", tick); else if (ret == ODP_TIMER_TOOLATE) - LOG_DBG("Too late %" PRIu64 "\n", tick); + ODPH_DBG("Too late %" PRIu64 "\n", tick); else if (ret == ODP_TIMER_NOEVENT) - LOG_DBG("No event %" PRIu64 "\n", tick); + ODPH_DBG("No event %" PRIu64 "\n", tick);
CU_ASSERT(ret == ODP_TIMER_SUCCESS); } @@ -651,9 +648,8 @@ static void timer_test_queue_type(odp_queue_type_t queue_type) CU_ASSERT(diff_period > (period_ns - (5 * res_ns))); CU_ASSERT(diff_period < (period_ns + (5 * res_ns)));
- LOG_DBG("timeout tick %" PRIu64 ", " - "timeout period %" PRIu64 "\n", - tick, diff_period); + ODPH_DBG("timeout tick %" PRIu64 ", timeout period " + "%" PRIu64 "\n", tick, diff_period);
odp_timeout_free(tmo); CU_ASSERT(odp_timer_free(tim) == ODP_EVENT_INVALID); @@ -663,7 +659,7 @@ static void timer_test_queue_type(odp_queue_type_t queue_type)
} while (diff_test < (2 * test_period) && num_tmo < num);
- LOG_DBG("test period %" PRIu64 "\n", diff_test); + ODPH_DBG("test period %" PRIu64 "\n", diff_test);
CU_ASSERT(num_tmo == num); CU_ASSERT(diff_test > (test_period - period_ns)); @@ -741,7 +737,7 @@ static void timer_test_cancel(void) tim = odp_timer_alloc(tp, queue, USER_PTR); if (tim == ODP_TIMER_INVALID) CU_FAIL_FATAL("Failed to allocate timer"); - LOG_DBG("Timer handle: %" PRIu64 "\n", odp_timer_to_u64(tim)); + ODPH_DBG("Timer handle: %" PRIu64 "\n", odp_timer_to_u64(tim));
ev = odp_timeout_to_event(odp_timeout_alloc(pool)); if (ev == ODP_EVENT_INVALID) @@ -763,7 +759,7 @@ static void timer_test_cancel(void) tmo = odp_timeout_from_event(ev); if (tmo == ODP_TIMEOUT_INVALID) CU_FAIL_FATAL("Cancel did not return timeout"); - LOG_DBG("Timeout handle: %" PRIu64 "\n", odp_timeout_to_u64(tmo)); + ODPH_DBG("Timeout handle: %" PRIu64 "\n", odp_timeout_to_u64(tmo));
if (odp_timeout_timer(tmo) != tim) CU_FAIL("Cancel invalid tmo.timer"); @@ -860,12 +856,12 @@ static void timer_test_tmo_limit(odp_queue_type_t queue_type, /* Min_tmo maybe zero. Wait min timeouts at least 20ms + resolution */ max_wait = (20 * ODP_TIME_MSEC_IN_NS + res_ns + 10 * tmo_ns);
- LOG_DBG("\nTimer pool parameters:\n"); - LOG_DBG(" res_ns %" PRIu64 "\n", timer_param.res_ns); - LOG_DBG(" min_tmo %" PRIu64 "\n", timer_param.min_tmo); - LOG_DBG(" max_tmo %" PRIu64 "\n", timer_param.max_tmo); - LOG_DBG(" tmo_ns %" PRIu64 "\n", tmo_ns); - LOG_DBG(" tmo_tick %" PRIu64 "\n\n", tmo_tick); + ODPH_DBG("\nTimer pool parameters:\n"); + ODPH_DBG(" res_ns %" PRIu64 "\n", timer_param.res_ns); + ODPH_DBG(" min_tmo %" PRIu64 "\n", timer_param.min_tmo); + ODPH_DBG(" max_tmo %" PRIu64 "\n", timer_param.max_tmo); + ODPH_DBG(" tmo_ns %" PRIu64 "\n", tmo_ns); + ODPH_DBG(" tmo_tick %" PRIu64 "\n\n", tmo_tick);
for (i = 0; i < num; i++) { timer[i] = odp_timer_alloc(timer_pool, queue, NULL); @@ -884,11 +880,11 @@ static void timer_test_tmo_limit(odp_queue_type_t queue_type, ret = odp_timer_set_rel(timer[i], tmo_tick, &ev);
if (ret == ODP_TIMER_TOOEARLY) - LOG_DBG("Too early %i\n", i); + ODPH_DBG("Too early %i\n", i); else if (ret == ODP_TIMER_TOOLATE) - LOG_DBG("Too late %i\n", i); + ODPH_DBG("Too late %i\n", i); else if (ret == ODP_TIMER_NOEVENT) - LOG_DBG("No event %i\n", i); + ODPH_DBG("No event %i\n", i);
CU_ASSERT(ret == ODP_TIMER_SUCCESS);
@@ -910,8 +906,8 @@ static void timer_test_tmo_limit(odp_queue_type_t queue_type, odp_event_free(ev); num_tmo++; break_loop = 1; - LOG_DBG("Timeout [%i]: %" PRIu64 - " nsec\n", i, diff_ns); + ODPH_DBG("Timeout [%i]: %" PRIu64 " " + "nsec\n", i, diff_ns); continue; }
@@ -937,8 +933,8 @@ static void timer_test_tmo_limit(odp_queue_type_t queue_type, if (ev != ODP_EVENT_INVALID) odp_event_free(ev);
- LOG_DBG("Cancelled [%i]: %" PRIu64 - " nsec\n", i, diff_ns); + ODPH_DBG("Cancelled [%i]: %" PRIu64 " nsec\n", i, + diff_ns); } }
@@ -1050,9 +1046,8 @@ static void handle_tmo(odp_event_t ev, bool stale, uint64_t prev_tick) if (!stale) { /* tmo tick cannot be smaller than pre-calculated tick */ if (tick < ttp->tick) { - LOG_DBG("Too small tick: pre-calculated %" PRIu64 - " timeout %" PRIu64 "\n", - ttp->tick, tick); + ODPH_DBG("Too small tick: pre-calculated %" PRIu64 " " + "timeout %" PRIu64 "\n", ttp->tick, tick); CU_FAIL("odp_timeout_tick() too small tick"); }
@@ -1060,9 +1055,8 @@ static void handle_tmo(odp_event_t ev, bool stale, uint64_t prev_tick) CU_FAIL("Timeout delivered early");
if (tick < prev_tick) { - LOG_DBG("Too late tick: %" PRIu64 - " prev_tick %" PRIu64"\n", - tick, prev_tick); + ODPH_DBG("Too late tick: %" PRIu64 " prev_tick " + "%" PRIu64 "\n", tick, prev_tick); /* We don't report late timeouts using CU_FAIL */ odp_atomic_inc_u32(&global_mem->ndelivtoolate); } @@ -1075,7 +1069,7 @@ static void handle_tmo(odp_event_t ev, bool stale, uint64_t prev_tick)
/* Worker thread entrypoint which performs timer alloc/set/cancel/free * tests */ -static int worker_entrypoint(void *arg TEST_UNUSED) +static int worker_entrypoint(void *arg ODP_UNUSED) { int thr = odp_thread_id(); uint32_t i, allocated; @@ -1112,14 +1106,14 @@ static int worker_entrypoint(void *arg TEST_UNUSED) for (i = 0; i < num_timers; i++) { tt[i].ev = odp_timeout_to_event(odp_timeout_alloc(tbp)); if (tt[i].ev == ODP_EVENT_INVALID) { - LOG_DBG("Failed to allocate timeout (%" PRIu32 "/%d)\n", - i, num_timers); + ODPH_DBG("Failed to allocate timeout (" + "%" PRIu32 "/%d)\n", i, num_timers); break; } tt[i].tim = odp_timer_alloc(tp, queue, &tt[i]); if (tt[i].tim == ODP_TIMER_INVALID) { - LOG_DBG("Failed to allocate timer (%" PRIu32 "/%d)\n", - i, num_timers); + ODPH_DBG("Failed to allocate timer (%" PRIu32 "/%d)\n", + i, num_timers); odp_event_free(tt[i].ev); break; } @@ -1142,9 +1136,9 @@ static int worker_entrypoint(void *arg TEST_UNUSED) odp_timer_ns_to_tick(tp, nsec); timer_rc = odp_timer_set_abs(tt[i].tim, tck, &tt[i].ev); if (timer_rc == ODP_TIMER_TOOEARLY) { - LOG_ERR("Missed tick, setting timer\n"); + ODPH_ERR("Missed tick, setting timer\n"); } else if (timer_rc != ODP_TIMER_SUCCESS) { - LOG_ERR("Failed to set timer: %d\n", timer_rc); + ODPH_ERR("Failed to set timer: %d\n", timer_rc); CU_FAIL("Failed to set timer"); } else { tt[i].tick = tck; @@ -1175,7 +1169,7 @@ static int worker_entrypoint(void *arg TEST_UNUSED) if (rc != 0) { /* Cancel failed, timer already expired */ ntoolate++; - LOG_DBG("Failed to cancel timer, probably already expired\n"); + ODPH_DBG("Failed to cancel timer, probably already expired\n"); } else { tt[i].tick = TICK_INVALID; ncancel++; @@ -1232,15 +1226,14 @@ static int worker_entrypoint(void *arg TEST_UNUSED) nstale++; }
- LOG_DBG("Thread %u: %" PRIu32 " timers set\n", thr, nset); - LOG_DBG("Thread %u: %" PRIu32 " timers reset\n", thr, nreset); - LOG_DBG("Thread %u: %" PRIu32 " timers cancelled\n", thr, ncancel); - LOG_DBG("Thread %u: %" PRIu32 " timers reset/cancelled too late\n", - thr, ntoolate); - LOG_DBG("Thread %u: %" PRIu32 " timeouts received\n", thr, nrcv); - LOG_DBG("Thread %u: %" PRIu32 - " stale timeout(s) after odp_timer_cancel()\n", - thr, nstale); + ODPH_DBG("Thread %u: %" PRIu32 " timers set\n", thr, nset); + ODPH_DBG("Thread %u: %" PRIu32 " timers reset\n", thr, nreset); + ODPH_DBG("Thread %u: %" PRIu32 " timers cancelled\n", thr, ncancel); + ODPH_DBG("Thread %u: %" PRIu32 " timers reset/cancelled too late\n", + thr, ntoolate); + ODPH_DBG("Thread %u: %" PRIu32 " timeouts received\n", thr, nrcv); + ODPH_DBG("Thread %u: %" PRIu32 " " + "stale timeout(s) after odp_timer_cancel()\n", thr, nstale);
/* Delay some more to ensure timeouts for expired timers can be * received. Can not use busy loop here to make background timer @@ -1279,7 +1272,7 @@ static int worker_entrypoint(void *arg TEST_UNUSED) }
free(tt); - LOG_DBG("Thread %u: exiting\n", thr); + ODPH_DBG("Thread %u: exiting\n", thr); return CU_get_number_of_failures(); }
@@ -1364,17 +1357,17 @@ static void timer_test_all(void) CU_ASSERT(tpinfo.param.max_tmo == max_tmo); CU_ASSERT(strcmp(tpinfo.name, NAME) == 0);
- LOG_DBG("Timer pool handle: %" PRIu64 "\n", odp_timer_pool_to_u64(tp)); - LOG_DBG("Resolution: %" PRIu64 "\n", tparam.res_ns); - LOG_DBG("Min timeout: %" PRIu64 "\n", tparam.min_tmo); - LOG_DBG("Max timeout: %" PRIu64 "\n", tparam.max_tmo); - LOG_DBG("Num timers: %u\n", tparam.num_timers); - LOG_DBG("Tmo range: %u ms (%" PRIu64 " ticks)\n", RANGE_MS, - odp_timer_ns_to_tick(tp, 1000000ULL * RANGE_MS)); - LOG_DBG("Max timers: %" PRIu32 "\n", timer_capa.max_timers); - LOG_DBG("Max timer pools: %" PRIu32 "\n", timer_capa.max_pools); - LOG_DBG("Max timer pools combined: %" PRIu32 "\n", - timer_capa.max_pools_combined); + ODPH_DBG("Timer pool handle: %" PRIu64 "\n", odp_timer_pool_to_u64(tp)); + ODPH_DBG("Resolution: %" PRIu64 "\n", tparam.res_ns); + ODPH_DBG("Min timeout: %" PRIu64 "\n", tparam.min_tmo); + ODPH_DBG("Max timeout: %" PRIu64 "\n", tparam.max_tmo); + ODPH_DBG("Num timers: %u\n", tparam.num_timers); + ODPH_DBG("Tmo range: %u ms (%" PRIu64 " ticks)\n", RANGE_MS, + odp_timer_ns_to_tick(tp, 1000000ULL * RANGE_MS)); + ODPH_DBG("Max timers: %" PRIu32 "\n", timer_capa.max_timers); + ODPH_DBG("Max timer pools: %" PRIu32 "\n", timer_capa.max_pools); + ODPH_DBG("Max timer pools combined: %" PRIu32 "\n", + timer_capa.max_pools_combined);
tick = odp_timer_ns_to_tick(tp, 0); CU_ASSERT(tick == 0); @@ -1386,14 +1379,14 @@ static void timer_test_all(void) ns2 = odp_timer_tick_to_ns(tp, tick);
if (ns2 < ns - res_ns) { - LOG_DBG("FAIL ns:%" PRIu64 " tick:%" PRIu64 " ns2:%" - PRIu64 "\n", ns, tick, ns2); + ODPH_DBG("FAIL ns:%" PRIu64 " tick:%" PRIu64 " ns2:" + "%" PRIu64 "\n", ns, tick, ns2); CU_FAIL("tick conversion: nsec too small\n"); }
if (ns2 > ns + res_ns) { - LOG_DBG("FAIL ns:%" PRIu64 " tick:%" PRIu64 " ns2:%" - PRIu64 "\n", ns, tick, ns2); + ODPH_DBG("FAIL ns:%" PRIu64 " tick:%" PRIu64 " ns2:" + "%" PRIu64 "\n", ns, tick, ns2); CU_FAIL("tick conversion: nsec too large\n"); } } @@ -1414,8 +1407,9 @@ static void timer_test_all(void)
/* Wait for worker threads to exit */ odp_cunit_thread_exit(&thrdarg); - LOG_DBG("Number of timeouts delivered/received too late: %" PRIu32 "\n", - odp_atomic_load_u32(&global_mem->ndelivtoolate)); + ODPH_DBG("Number of timeouts delivered/received too late: " + "%" PRIu32 "\n", + odp_atomic_load_u32(&global_mem->ndelivtoolate));
/* Check some statistics after the test */ if (odp_timer_pool_info(tp, &tpinfo) != 0) diff --git a/test/validation/api/traffic_mngr/traffic_mngr.c b/test/validation/api/traffic_mngr/traffic_mngr.c index f18957d24..ff35b7b91 100644 --- a/test/validation/api/traffic_mngr/traffic_mngr.c +++ b/test/validation/api/traffic_mngr/traffic_mngr.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */
-#include "config.h" - #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif @@ -15,9 +13,9 @@ #include <string.h> #include <unistd.h> #include <math.h> -#include <odp.h> + +#include <odp_api.h> #include <odp/helper/odph_api.h> -#include <test_debug.h> #include "odp_cunit_common.h"
#define TM_DEBUG 0 @@ -404,8 +402,8 @@ static int test_overall_capabilities(void) */ num_records = MAX_CAPABILITIES; if (MAX_CAPABILITIES < rc) - LOG_DBG("There were more than %u capabilities (%u)\n", - MAX_CAPABILITIES, rc); + ODPH_DBG("There were more than %u capabilities (%u)\n", + MAX_CAPABILITIES, rc); else num_records = rc;
@@ -501,7 +499,7 @@ static int open_pktios(void) if (pktio == ODP_PKTIO_INVALID) pktio = odp_pktio_lookup(iface_name[iface]); if (pktio == ODP_PKTIO_INVALID) { - LOG_ERR("odp_pktio_open() failed\n"); + ODPH_ERR("odp_pktio_open() failed\n"); return -1; }
@@ -516,13 +514,13 @@ static int open_pktios(void)
if (odp_pktin_queue(pktio, &pktins[iface], 1) != 1) { odp_pktio_close(pktio); - LOG_ERR("odp_pktio_open() failed: no pktin queue\n"); + ODPH_ERR("odp_pktio_open() failed: no pktin queue\n"); return -1; }
if (odp_pktout_queue(pktio, &pktouts[iface], 1) != 1) { odp_pktio_close(pktio); - LOG_ERR("odp_pktio_open() failed: no pktout queue\n"); + ODPH_ERR("odp_pktio_open() failed: no pktout queue\n"); return -1; }
@@ -536,7 +534,7 @@ static int open_pktios(void) ODPH_ETHADDR_LEN);
if (rc != ODPH_ETHADDR_LEN) { - LOG_ERR("odp_pktio_mac_addr() failed\n"); + ODPH_ERR("odp_pktio_mac_addr() failed\n"); return -1; } } @@ -546,7 +544,7 @@ static int open_pktios(void) rcv_pktin = pktins[1]; ret = odp_pktio_start(pktios[1]); if (ret != 0) { - LOG_ERR("odp_pktio_start() failed\n"); + ODPH_ERR("odp_pktio_start() failed\n"); return -1; } } else { @@ -556,15 +554,15 @@ static int open_pktios(void)
ret = odp_pktio_start(pktios[0]); if (ret != 0) { - LOG_ERR("odp_pktio_start() failed\n"); + ODPH_ERR("odp_pktio_start() failed\n"); return -1; }
/* Now wait until the link or links are up. */ rc = wait_linkup(pktios[0]); if (rc != 1) { - LOG_ERR("link %" PRIX64 " not up\n", - odp_pktio_to_u64(pktios[0])); + ODPH_ERR("link %" PRIX64 " not up\n", + odp_pktio_to_u64(pktios[0])); return -1; }
@@ -574,8 +572,8 @@ static int open_pktios(void) /* Wait for 2nd link to be up */ rc = wait_linkup(pktios[1]); if (rc != 1) { - LOG_ERR("link %" PRIX64 " not up\n", - odp_pktio_to_u64(pktios[0])); + ODPH_ERR("link %" PRIX64 " not up\n", + odp_pktio_to_u64(pktios[0])); return -1; }
@@ -705,7 +703,7 @@ static odp_packet_t make_pkt(odp_pool_t pkt_pool, l2_len = l2_hdr_len + l3_len; pkt_len = l2_len; if (unique_id == 0) { - LOG_ERR("make_pkt called with invalid unique_id of 0\n"); + ODPH_ERR("%s called with invalid unique_id of 0\n", __func__); return ODP_PACKET_INVALID; }
@@ -812,7 +810,7 @@ static odp_packet_t make_pkt(odp_pool_t pkt_pool,
/* Next the UDP/TCP checksum. */ if (odph_udp_tcp_chksum(odp_pkt, ODPH_CHKSUM_GENERATE, NULL) != 0) - LOG_ERR("odph_udp_tcp_chksum failed\n"); + ODPH_ERR("odph_udp_tcp_chksum failed\n");
return odp_pkt; } @@ -886,17 +884,18 @@ static int receive_pkts(odp_tm_t odp_tm, (odp_packet_has_l3_error(rcv_pkt) << 2) | (odp_packet_has_l4_error(rcv_pkt) << 3);
- LOG_ERR("received a pkt with the following errors\n"); - LOG_ERR(" l2_err=%u l3_err=%u l4_err=%u. Skipping\n", - (rcv_pkt_desc->errors >> 1) & 0x1, - (rcv_pkt_desc->errors >> 2) & 0x1, - (rcv_pkt_desc->errors >> 3) & 0x1); + ODPH_ERR("received a pkt with the following errors\n"); + ODPH_ERR(" l2_err=%u l3_err=%u l4_err=%u. " + "Skipping\n", + (rcv_pkt_desc->errors >> 1) & 0x1, + (rcv_pkt_desc->errors >> 2) & 0x1, + (rcv_pkt_desc->errors >> 3) & 0x1); }
unique_id = 0; rc = get_unique_id(rcv_pkt, &unique_id, &is_ipv4_pkt); if (rc != 0) { - LOG_ERR("received a non IPv4/IPv6 pkt\n"); + ODPH_ERR("received a non IPv4/IPv6 pkt\n"); return -1; }
@@ -1318,14 +1317,14 @@ static int create_tm_queue(odp_tm_t odp_tm,
tm_queue = odp_tm_queue_create(odp_tm, &queue_params); if (tm_queue == ODP_TM_INVALID) { - LOG_ERR("odp_tm_queue_create() failed\n"); + ODPH_ERR("odp_tm_queue_create() failed\n"); return -1; }
queue_desc->tm_queues[priority] = tm_queue; rc = odp_tm_queue_connect(tm_queue, tm_node); if (rc != 0) { - LOG_ERR("odp_tm_queue_connect() failed\n"); + ODPH_ERR("odp_tm_queue_connect() failed\n"); odp_tm_queue_destroy(tm_queue); return -1; } @@ -1385,8 +1384,8 @@ static tm_node_desc_t *create_tm_node(odp_tm_t odp_tm,
tm_node = odp_tm_node_create(odp_tm, node_name, &node_params); if (tm_node == ODP_TM_INVALID) { - LOG_ERR("odp_tm_node_create() failed @ level=%" PRIu32 "\n", - level); + ODPH_ERR("odp_tm_node_create() failed @ level=%" PRIu32 "\n", + level); return NULL; }
@@ -1398,8 +1397,8 @@ static tm_node_desc_t *create_tm_node(odp_tm_t odp_tm,
rc = odp_tm_node_connect(tm_node, parent_node); if (rc != 0) { - LOG_ERR("odp_tm_node_connect() failed @ level=%" PRIu32 "\n", - level); + ODPH_ERR("odp_tm_node_connect() failed @ level=%" PRIu32 "\n", + level); odp_tm_node_destroy(tm_node); return NULL; } @@ -1432,8 +1431,8 @@ static tm_node_desc_t *create_tm_node(odp_tm_t odp_tm, rc = create_tm_queue(odp_tm, tm_node, node_idx, queue_desc, priority); if (rc != 0) { - LOG_ERR("create_tm_queue() failed @ " - "level=%" PRIu32 "\n", level); + ODPH_ERR("create_tm_queue() failed @ " + "level=%" PRIu32 "\n", level); while (priority > 0) (void)destroy_tm_queue (queue_desc->tm_queues[--priority]); @@ -1458,7 +1457,8 @@ static tm_node_desc_t *create_tm_subtree(odp_tm_t odp_tm, node_desc = create_tm_node(odp_tm, level, num_levels, node_idx, parent_node); if (node_desc == NULL) { - LOG_ERR("create_tm_node() failed @ level=%" PRIu32 "\n", level); + ODPH_ERR("create_tm_node() failed @ level=%" PRIu32 "\n", + level); return NULL; }
@@ -1468,8 +1468,8 @@ static tm_node_desc_t *create_tm_subtree(odp_tm_t odp_tm, num_levels, child_idx, node_desc); if (child_desc == NULL) { - LOG_ERR("create_tm_subtree failed " - "level=%" PRIu32 "\n", level); + ODPH_ERR("%s failed level=%" PRIu32 "\n", + __func__, level);
return NULL; } @@ -1634,7 +1634,7 @@ static int create_tm_system(void) num_odp_tm_systems); odp_tm = odp_tm_create(tm_name, &requirements, &egress); if (odp_tm == ODP_TM_INVALID) { - LOG_ERR("odp_tm_create() failed\n"); + ODPH_ERR("odp_tm_create() failed\n"); return -1; }
@@ -1643,7 +1643,7 @@ static int create_tm_system(void) root_node_desc = create_tm_subtree(odp_tm, 0, NUM_LEVELS, 0, NULL); root_node_descs[num_odp_tm_systems] = root_node_desc; if (root_node_desc == NULL) { - LOG_ERR("create_tm_subtree() failed\n"); + ODPH_ERR("create_tm_subtree() failed\n"); return -1; }
@@ -1652,13 +1652,13 @@ static int create_tm_system(void) /* Test odp_tm_capability and odp_tm_find. */ rc = odp_tm_capability(odp_tm, &tm_capabilities); if (rc != 0) { - LOG_ERR("odp_tm_capability() failed\n"); + ODPH_ERR("odp_tm_capability() failed\n"); return -1; }
found_odp_tm = odp_tm_find(tm_name, &requirements, &egress); if ((found_odp_tm == ODP_TM_INVALID) || (found_odp_tm != odp_tm)) { - LOG_ERR("odp_tm_find() failed\n"); + ODPH_ERR("odp_tm_find() failed\n"); return -1; }
@@ -1676,8 +1676,8 @@ static void dump_tm_subtree(tm_node_desc_t *node_desc)
rc = odp_tm_node_info(node_desc->node, &node_info); if (rc != 0) { - LOG_ERR("odp_tm_node_info failed for tm_node=0x%" PRIX64 "\n", - node_desc->node); + ODPH_ERR("odp_tm_node_info failed for tm_node=0x%" PRIX64 "\n", + node_desc->node); }
num_queues = 0; @@ -1717,15 +1717,15 @@ static int unconfig_tm_queue_profiles(odp_tm_queue_t tm_queue)
rc = odp_tm_queue_info(tm_queue, &queue_info); if (rc != 0) { - LOG_ERR("odp_tm_queue_info failed code=%d\n", rc); + ODPH_ERR("odp_tm_queue_info failed code=%d\n", rc); return rc; }
if (queue_info.shaper_profile != ODP_TM_INVALID) { rc = odp_tm_queue_shaper_config(tm_queue, ODP_TM_INVALID); if (rc != 0) { - LOG_ERR("odp_tm_queue_shaper_config failed code=%d\n", - rc); + ODPH_ERR("odp_tm_queue_shaper_config failed code=%d\n", + rc); return rc; } } @@ -1733,8 +1733,8 @@ static int unconfig_tm_queue_profiles(odp_tm_queue_t tm_queue) if (queue_info.threshold_profile != ODP_TM_INVALID) { rc = odp_tm_queue_threshold_config(tm_queue, ODP_TM_INVALID); if (rc != 0) { - LOG_ERR("odp_tm_queue_threshold_config failed " - "code=%d\n", rc); + ODPH_ERR("odp_tm_queue_threshold_config failed " + "code=%d\n", rc); return rc; } } @@ -1745,8 +1745,8 @@ static int unconfig_tm_queue_profiles(odp_tm_queue_t tm_queue) rc = odp_tm_queue_wred_config(tm_queue, color, ODP_TM_INVALID); if (rc != 0) { - LOG_ERR("odp_tm_queue_wred_config failed " - "color=%" PRIu32 " code=%d\n", + ODPH_ERR("odp_tm_queue_wred_config failed " + "color=%" PRIu32 " code=%d\n", color, rc); return rc; } @@ -1768,24 +1768,24 @@ static int destroy_tm_queues(tm_queue_desc_t *queue_desc) if (tm_queue != ODP_TM_INVALID) { rc = odp_tm_queue_disconnect(tm_queue); if (rc != 0) { - LOG_ERR("odp_tm_queue_disconnect failed " - "idx=%" PRIu32 " code=%d\n", + ODPH_ERR("odp_tm_queue_disconnect failed " + "idx=%" PRIu32 " code=%d\n", queue_idx, rc); return rc; }
rc = unconfig_tm_queue_profiles(tm_queue); if (rc != 0) { - LOG_ERR("unconfig_tm_queue_profiles failed " - "idx=%" PRIu32 " code=%d\n", + ODPH_ERR("unconfig_tm_queue_profiles failed " + "idx=%" PRIu32 " code=%d\n", queue_idx, rc); return rc; }
rc = odp_tm_queue_destroy(tm_queue); if (rc != 0) { - LOG_ERR("odp_tm_queue_destroy failed " - "idx=%" PRIu32 " code=%d\n", + ODPH_ERR("odp_tm_queue_destroy failed " + "idx=%" PRIu32 " code=%d\n", queue_idx, rc); return rc; } @@ -1805,15 +1805,15 @@ static int unconfig_tm_node_profiles(odp_tm_node_t tm_node)
rc = odp_tm_node_info(tm_node, &node_info); if (rc != 0) { - LOG_ERR("odp_tm_node_info failed code=%d\n", rc); + ODPH_ERR("odp_tm_node_info failed code=%d\n", rc); return rc; }
if (node_info.shaper_profile != ODP_TM_INVALID) { rc = odp_tm_node_shaper_config(tm_node, ODP_TM_INVALID); if (rc != 0) { - LOG_ERR("odp_tm_node_shaper_config failed code=%d\n", - rc); + ODPH_ERR("odp_tm_node_shaper_config failed code=%d\n", + rc); return rc; } } @@ -1821,8 +1821,8 @@ static int unconfig_tm_node_profiles(odp_tm_node_t tm_node) if (node_info.threshold_profile != ODP_TM_INVALID) { rc = odp_tm_node_threshold_config(tm_node, ODP_TM_INVALID); if (rc != 0) { - LOG_ERR("odp_tm_node_threshold_config failed " - "code=%d\n", rc); + ODPH_ERR("odp_tm_node_threshold_config failed " + "code=%d\n", rc); return rc; } } @@ -1833,9 +1833,9 @@ static int unconfig_tm_node_profiles(odp_tm_node_t tm_node) rc = odp_tm_node_wred_config(tm_node, color, ODP_TM_INVALID); if (rc != 0) { - LOG_ERR("odp_tm_node_wred_config failed " - "color=%" PRIu32 " code=%d\n", - color, rc); + ODPH_ERR("odp_tm_node_wred_config failed " + "color=%" PRIu32 " code=%d\n", + color, rc); return rc; } } @@ -1858,9 +1858,8 @@ static int destroy_tm_subtree(tm_node_desc_t *node_desc) if (child_desc != NULL) { rc = destroy_tm_subtree(child_desc); if (rc != 0) { - LOG_ERR("destroy_tm_subtree failed " - "child_num=%" PRIu32 " code=%d\n", - child_num, rc); + ODPH_ERR("%s failed child_num=%" PRIu32 " " + "code=%d\n", __func__, child_num, rc); return rc; } } @@ -1870,7 +1869,7 @@ static int destroy_tm_subtree(tm_node_desc_t *node_desc) if (queue_desc != NULL) { rc = destroy_tm_queues(queue_desc); if (rc != 0) { - LOG_ERR("destroy_tm_queues failed code=%d\n", rc); + ODPH_ERR("destroy_tm_queues failed code=%d\n", rc); return rc; } } @@ -1878,19 +1877,19 @@ static int destroy_tm_subtree(tm_node_desc_t *node_desc) tm_node = node_desc->node; rc = odp_tm_node_disconnect(tm_node); if (rc != 0) { - LOG_ERR("odp_tm_node_disconnect failed code=%d\n", rc); + ODPH_ERR("odp_tm_node_disconnect failed code=%d\n", rc); return rc; }
rc = unconfig_tm_node_profiles(tm_node); if (rc != 0) { - LOG_ERR("unconfig_tm_node_profiles failed code=%d\n", rc); + ODPH_ERR("unconfig_tm_node_profiles failed code=%d\n", rc); return rc; }
rc = odp_tm_node_destroy(tm_node); if (rc != 0) { - LOG_ERR("odp_tm_node_destroy failed code=%d\n", rc); + ODPH_ERR("odp_tm_node_destroy failed code=%d\n", rc); return rc; }
@@ -1912,8 +1911,8 @@ static int destroy_all_shaper_profiles(void) if (shaper_profile != ODP_TM_INVALID) { rc = odp_tm_shaper_destroy(shaper_profile); if (rc != 0) { - LOG_ERR("odp_tm_sched_destroy failed " - "idx=%" PRIu32 " code=%d\n", idx, rc); + ODPH_ERR("odp_tm_sched_destroy failed " + "idx=%" PRIu32 " code=%d\n", idx, rc); return rc; } shaper_profiles[idx] = ODP_TM_INVALID; @@ -1934,8 +1933,8 @@ static int destroy_all_sched_profiles(void) if (sched_profile != ODP_TM_INVALID) { rc = odp_tm_sched_destroy(sched_profile); if (rc != 0) { - LOG_ERR("odp_tm_sched_destroy failed " - "idx=%" PRIu32 " code=%d\n", idx, rc); + ODPH_ERR("odp_tm_sched_destroy failed " + "idx=%" PRIu32 " code=%d\n", idx, rc); return rc; } sched_profiles[idx] = ODP_TM_INVALID; @@ -1956,8 +1955,8 @@ static int destroy_all_threshold_profiles(void) if (threshold_profile != ODP_TM_INVALID) { rc = odp_tm_threshold_destroy(threshold_profile); if (rc != 0) { - LOG_ERR("odp_tm_threshold_destroy failed " - "idx=%" PRIu32 " code=%d\n", idx, rc); + ODPH_ERR("odp_tm_threshold_destroy failed " + "idx=%" PRIu32 " code=%d\n", idx, rc); return rc; } threshold_profiles[idx] = ODP_TM_INVALID; @@ -1979,10 +1978,10 @@ static int destroy_all_wred_profiles(void) if (wred_profile != ODP_TM_INVALID) { rc = odp_tm_wred_destroy(wred_profile); if (rc != 0) { - LOG_ERR("odp_tm_wred_destroy failed " - "idx=%" PRIu32 " " - "color=%" PRIu32 " code=%d\n", - idx, color, rc); + ODPH_ERR("odp_tm_wred_destroy failed " + "idx=%" PRIu32 " " + "color=%" PRIu32 " code=%d\n", + idx, color, rc); return rc; } wred_profiles[idx][color] = ODP_TM_INVALID; @@ -1999,25 +1998,25 @@ static int destroy_all_profiles(void)
rc = destroy_all_shaper_profiles(); if (rc != 0) { - LOG_ERR("destroy_all_shaper_profiles failed code=%d\n", rc); + ODPH_ERR("destroy_all_shaper_profiles failed code=%d\n", rc); return rc; }
rc = destroy_all_sched_profiles(); if (rc != 0) { - LOG_ERR("destroy_all_sched_profiles failed code=%d\n", rc); + ODPH_ERR("destroy_all_sched_profiles failed code=%d\n", rc); return rc; }
rc = destroy_all_threshold_profiles(); if (rc != 0) { - LOG_ERR("destroy_all_threshold_profiles failed code=%d\n", rc); + ODPH_ERR("destroy_all_threshold_profiles failed code=%d\n", rc); return rc; }
rc = destroy_all_wred_profiles(); if (rc != 0) { - LOG_ERR("destroy_all_wred_profiles failed code=%d\n", rc); + ODPH_ERR("destroy_all_wred_profiles failed code=%d\n", rc); return rc; }
@@ -2400,7 +2399,7 @@ static int set_shaper(const char *node_name,
tm_node = find_tm_node(0, node_name); if (tm_node == ODP_TM_INVALID) { - LOG_ERR("find_tm_node(%s) failed\n", node_name); + ODPH_ERR("find_tm_node(%s) failed\n", node_name); CU_ASSERT_FATAL(tm_node != ODP_TM_INVALID); return -1; } @@ -2434,9 +2433,9 @@ static int traffic_mngr_check_shaper(void) int cpucount = odp_cpumask_all_available(&cpumask);
if (cpucount < 2) { - LOG_DBG("\nSkipping shaper test because cpucount = %d " - "is less then min number 2 required\n", cpucount); - LOG_DBG("Rerun with more cpu resources\n"); + ODPH_DBG("\nSkipping shaper test because cpucount = %d " + "is less then min number 2 required\n", cpucount); + ODPH_DBG("Rerun with more cpu resources\n"); return ODP_TEST_INACTIVE; }
@@ -2449,9 +2448,9 @@ static int traffic_mngr_check_scheduler(void) int cpucount = odp_cpumask_all_available(&cpumask);
if (cpucount < 2) { - LOG_DBG("\nSkipping scheduler test because cpucount = %d " - "is less then min number 2 required\n", cpucount); - LOG_DBG("Rerun with more cpu resources\n"); + ODPH_DBG("\nSkipping scheduler test because cpucount = %d " + "is less then min number 2 required\n", cpucount); + ODPH_DBG("Rerun with more cpu resources\n"); return ODP_TEST_INACTIVE; }
@@ -2511,19 +2510,19 @@ static int test_shaper_bw(const char *shaper_name, /* This is fairly major failure in that most of the pkts didn't * even get received, regardless of rate or order. Log the error * to assist with debugging */ - LOG_ERR("Sent %" PRIu32 " pkts but only %" PRIu32 " " - "came back\n", pkts_sent, num_rcv_pkts); + ODPH_ERR("Sent %" PRIu32 " pkts but only %" PRIu32 " " + "came back\n", pkts_sent, num_rcv_pkts); CU_ASSERT(num_rcv_pkts <= (pkts_sent / 2)); } else if (pkts_rcvd_in_order <= 32) { - LOG_ERR("Sent %" PRIu32 " pkts but only %" PRIu32 " " - "came back (%" PRIu32 " in order)\n", - pkts_sent, num_rcv_pkts, pkts_rcvd_in_order); + ODPH_ERR("Sent %" PRIu32 " pkts but only %" PRIu32 " " + "came back (%" PRIu32 " in order)\n", + pkts_sent, num_rcv_pkts, pkts_rcvd_in_order); CU_ASSERT(pkts_rcvd_in_order <= 32); } else { if (pkts_rcvd_in_order < pkts_sent) - LOG_DBG("Info: of %" PRIu32 " pkts sent %" PRIu32 " " - "came back (%" PRIu32 " in order)\n", - pkts_sent, num_rcv_pkts, pkts_rcvd_in_order); + ODPH_DBG("Info: of %" PRIu32 " pkts sent %" PRIu32 " " + "came back (%" PRIu32 " in order)\n", + pkts_sent, num_rcv_pkts, pkts_rcvd_in_order);
/* Next determine the inter arrival receive pkt statistics. */ rc = rcv_rate_stats(&rcv_stats, pkt_info.pkt_class); @@ -2538,21 +2537,21 @@ static int test_shaper_bw(const char *shaper_name, 100) + 2; if ((avg_rcv_gap < min_rcv_gap) || (max_rcv_gap < avg_rcv_gap)) { - LOG_ERR("min=%" PRIu32 " avg_rcv_gap=%" PRIu32 " " - "max=%" PRIu32 " std_dev_gap=%" PRIu32 "\n", - rcv_stats.min_rcv_gap, avg_rcv_gap, - rcv_stats.max_rcv_gap, rcv_stats.std_dev_gap); - LOG_ERR(" expected_rcv_gap=%" PRIu64 " acceptable " - "rcv_gap range=%" PRIu32 "..%" PRIu32 "\n", - expected_rcv_gap_us, min_rcv_gap, max_rcv_gap); + ODPH_ERR("min=%" PRIu32 " avg_rcv_gap=%" PRIu32 " " + "max=%" PRIu32 " std_dev_gap=%" PRIu32 "\n", + rcv_stats.min_rcv_gap, avg_rcv_gap, + rcv_stats.max_rcv_gap, rcv_stats.std_dev_gap); + ODPH_ERR(" expected_rcv_gap=%" PRIu64 " acceptable " + "rcv_gap range=%" PRIu32 "..%" PRIu32 "\n", + expected_rcv_gap_us, min_rcv_gap, max_rcv_gap); } else if (expected_rcv_gap_us < rcv_stats.std_dev_gap) { - LOG_ERR("min=%" PRIu32 " avg_rcv_gap=%" PRIu32 " " - "max=%" PRIu32 " std_dev_gap=%" PRIu32 "\n", - rcv_stats.min_rcv_gap, avg_rcv_gap, - rcv_stats.max_rcv_gap, rcv_stats.std_dev_gap); - LOG_ERR(" expected_rcv_gap=%" PRIu64 " acceptable " - "rcv_gap range=%" PRIu32 "..%" PRIu32 "\n", - expected_rcv_gap_us, min_rcv_gap, max_rcv_gap); + ODPH_ERR("min=%" PRIu32 " avg_rcv_gap=%" PRIu32 " " + "max=%" PRIu32 " std_dev_gap=%" PRIu32 "\n", + rcv_stats.min_rcv_gap, avg_rcv_gap, + rcv_stats.max_rcv_gap, rcv_stats.std_dev_gap); + ODPH_ERR(" expected_rcv_gap=%" PRIu64 " acceptable " + "rcv_gap range=%" PRIu32 "..%" PRIu32 "\n", + expected_rcv_gap_us, min_rcv_gap, max_rcv_gap); ret_code = 0; } else { ret_code = 0; @@ -2560,15 +2559,15 @@ static int test_shaper_bw(const char *shaper_name,
if ((avg_rcv_gap < min_rcv_gap) || (avg_rcv_gap > max_rcv_gap)) { - LOG_ERR("agv_rcv_gap=%" PRIu32 " acceptable " - "rcv_gap range=%" PRIu32 "..%" PRIu32 "\n", - avg_rcv_gap, min_rcv_gap, max_rcv_gap); + ODPH_ERR("agv_rcv_gap=%" PRIu32 " acceptable " + "rcv_gap range=%" PRIu32 "..%" PRIu32 "\n", + avg_rcv_gap, min_rcv_gap, max_rcv_gap); ret_code = -1; }
if (rcv_stats.std_dev_gap > expected_rcv_gap_us) { - LOG_ERR("std_dev_gap=%" PRIu32 " > " - "expected_rcv_gap_us=%" PRIu64 "\n", + ODPH_ERR("std_dev_gap=%" PRIu32 " > " + "expected_rcv_gap_us=%" PRIu64 "\n", rcv_stats.std_dev_gap, expected_rcv_gap_us); ret_code = -1; } @@ -2705,9 +2704,9 @@ static int test_sched_queue_priority(const char *shaper_name, pkts_in_order = pkts_rcvd_in_given_order(unique_id_list, pkt_cnt, 0, false, false); if (pkts_in_order != pkt_cnt) { - LOG_ERR("pkts_sent=%" PRIu32 " pkt_cnt=%" PRIu32 " " - "num_rcv_pkts=%" PRIu32 " rcvd_in_order=%" PRIu32 "\n", - pkts_sent, pkt_cnt, num_rcv_pkts, pkts_in_order); + ODPH_ERR("pkts_sent=%" PRIu32 " pkt_cnt=%" PRIu32 " " + "num_rcv_pkts=%" PRIu32 " rcvd_in_order=%" PRIu32 "\n", + pkts_sent, pkt_cnt, num_rcv_pkts, pkts_in_order); }
CU_ASSERT(pkts_in_order == pkt_cnt); @@ -2972,7 +2971,7 @@ static int test_threshold(const char *threshold_name, tm_queue = find_tm_queue(0, node_name, priority); if (set_queue_thresholds(tm_queue, threshold_name, &threshold_params) != 0) { - LOG_ERR("set_queue_thresholds failed\n"); + ODPH_ERR("set_queue_thresholds failed\n"); return -1; }
@@ -2983,7 +2982,7 @@ static int test_threshold(const char *threshold_name, pkt_info.drop_eligible = true; pkt_info.pkt_class = 1; if (make_pkts(num_pkts, pkt_len, &pkt_info) != 0) { - LOG_ERR("make_pkts failed\n"); + ODPH_ERR("make_pkts failed\n"); return -1; }
@@ -3103,7 +3102,7 @@ static int test_byte_wred(const char *wred_name, threshold_params.enable_max_bytes = true; if (set_queue_thresholds(tm_queue, threshold_name, &threshold_params) != 0) { - LOG_ERR("set_queue_thresholds failed\n"); + ODPH_ERR("set_queue_thresholds failed\n"); return -1; }
@@ -3148,9 +3147,9 @@ static int test_byte_wred(const char *wred_name, ret = !((wred_pkt_cnts->min_cnt <= pkts_sent) && (pkts_sent <= wred_pkt_cnts->max_cnt)); if (ret) - LOG_DBG("min %" PRIu32 " pkts %" PRIu32" max %" PRIu32 "\n", - wred_pkt_cnts->min_cnt, pkts_sent, - wred_pkt_cnts->max_cnt); + ODPH_DBG("min %" PRIu32 " pkts %" PRIu32 " max %" PRIu32 "\n", + wred_pkt_cnts->min_cnt, pkts_sent, + wred_pkt_cnts->max_cnt); return odp_cunit_ret(ret); }
@@ -3189,7 +3188,7 @@ static int test_pkt_wred(const char *wred_name, ret = set_queue_thresholds(tm_queue, threshold_name, &threshold_params); if (ret) { - LOG_ERR("set_queue_thresholds failed\n"); + ODPH_ERR("set_queue_thresholds failed\n"); return -1; }
@@ -3236,10 +3235,9 @@ static int test_pkt_wred(const char *wred_name,
if ((pkts_sent < wred_pkt_cnts->min_cnt) || (pkts_sent > wred_pkt_cnts->max_cnt)) { - LOG_ERR("min_cnt %d <= pkts_sent %d <= max_cnt %d\n", - wred_pkt_cnts->min_cnt, - pkts_sent, - wred_pkt_cnts->max_cnt); + ODPH_ERR("min_cnt %d <= pkts_sent %d <= max_cnt %d\n", + wred_pkt_cnts->min_cnt, pkts_sent, + wred_pkt_cnts->max_cnt); return -1; }
@@ -3333,7 +3331,7 @@ static int check_vlan_marking_pkts(void) /* Make sure no VLAN header. */ if (odp_packet_has_vlan(rcv_pkt)) { err_cnt++; - LOG_ERR("VLAN incorrectly added\n"); + ODPH_ERR("VLAN incorrectly added\n"); CU_ASSERT(odp_packet_has_vlan(rcv_pkt)); } break; @@ -3343,7 +3341,7 @@ static int check_vlan_marking_pkts(void) /* Make sure it does have a VLAN header */ if (!odp_packet_has_vlan(rcv_pkt)) { err_cnt++; - LOG_ERR("VLAN header missing\n"); + ODPH_ERR("VLAN header missing\n"); CU_ASSERT(!odp_packet_has_vlan(rcv_pkt)); break; } @@ -3352,7 +3350,7 @@ static int check_vlan_marking_pkts(void) * pkt_class == 3. */ if (get_vlan_tci(rcv_pkt, &tci) != 0) { err_cnt++; - LOG_ERR("VLAN header missing\n"); + ODPH_ERR("VLAN header missing\n"); CU_ASSERT(!odp_packet_has_vlan(rcv_pkt)); break; } @@ -3360,8 +3358,8 @@ static int check_vlan_marking_pkts(void) dei = (tci >> ODPH_VLANHDR_DEI_SHIFT) & 1; expected_dei = (pkt_class == 2) ? 0 : 1; if (dei != expected_dei) { - LOG_ERR("expected_dei=%u rcvd dei=%u\n", - expected_dei, dei); + ODPH_ERR("expected_dei=%u rcvd dei=%u\n", + expected_dei, dei); err_cnt++; CU_ASSERT(dei == expected_dei); } @@ -3370,7 +3368,7 @@ static int check_vlan_marking_pkts(void) default: /* Log error but otherwise ignore, since it is * probably a stray pkt from a previous test. */ - LOG_ERR("Pkt rcvd with invalid pkt class\n"); + ODPH_ERR("Pkt rcvd with invalid pkt class\n"); } }
@@ -3393,7 +3391,7 @@ static int test_vlan_marking(const char *node_name, for (color = 0; color < ODP_NUM_PKT_COLORS; color++) { rc = odp_tm_vlan_marking(odp_tm, color, false); if (rc != 0) { - LOG_ERR("disabling odp_tm_vlan_marking() failed\n"); + ODPH_ERR("disabling odp_tm_vlan_marking() failed\n"); return -1; } } @@ -3403,7 +3401,7 @@ static int test_vlan_marking(const char *node_name,
tm_queue = find_tm_queue(0, node_name, 0); if (tm_queue == ODP_TM_INVALID) { - LOG_ERR("No tm_queue found for node_name='%s'\n", node_name); + ODPH_ERR("No tm_queue found for node_name='%s'\n", node_name); return -1; }
@@ -3436,11 +3434,11 @@ static int test_vlan_marking(const char *node_name, num_rcv_pkts = receive_pkts(odp_tm_systems[0], rcv_pktin, pkts_sent, 1000 * 1000); if (num_rcv_pkts == 0) { - LOG_ERR("No pkts received\n"); + ODPH_ERR("No pkts received\n"); rc = -1; } else if (num_rcv_pkts != pkts_sent) { - LOG_ERR("pkts_sent=%" PRIu32 " but num_rcv_pkts=%" PRIu32 "\n", - pkts_sent, num_rcv_pkts); + ODPH_ERR("pkts_sent=%" PRIu32 " but num_rcv_pkts=%" PRIu32 "\n", + pkts_sent, num_rcv_pkts); dump_rcvd_pkts(0, num_rcv_pkts - 1); CU_ASSERT(num_rcv_pkts == pkts_sent); } else { @@ -3502,9 +3500,9 @@ static int check_tos_marking_pkts(odp_bool_t use_ipv6,
if (rc != 1) { if (use_ipv6) - LOG_ERR("Expected IPv6 pkt but got IPv4"); + ODPH_ERR("Expected IPv6 pkt but got IPv4"); else - LOG_ERR("Expected IPv4 pkt but got IPv6"); + ODPH_ERR("Expected IPv4 pkt but got IPv6");
return -1; } @@ -3517,9 +3515,9 @@ static int check_tos_marking_pkts(odp_bool_t use_ipv6,
if (rc != 1) { if (use_tcp) - LOG_ERR("Expected TCP pkt but got UDP"); + ODPH_ERR("Expected TCP pkt but got UDP"); else - LOG_ERR("Expected UDP pkt but got TCP"); + ODPH_ERR("Expected UDP pkt but got TCP");
return -1; } @@ -3527,7 +3525,7 @@ static int check_tos_marking_pkts(odp_bool_t use_ipv6, /* Now get the tos field to see if it was changed */ rc = get_ip_tos(rcv_pkt, &tos); if (rc != 0) { - LOG_ERR("get_ip_tos failed\n"); + ODPH_ERR("get_ip_tos failed\n"); return -1; }
@@ -3535,8 +3533,8 @@ static int check_tos_marking_pkts(odp_bool_t use_ipv6, case 2: /* Tos field must be unchanged. */ if (unmarked_tos != tos) { - LOG_ERR("Tos was changed from 0x%X to 0x%X\n", - unmarked_tos, tos); + ODPH_ERR("Tos was changed from 0x%X to 0x%X\n", + unmarked_tos, tos); return -1; } break; @@ -3544,8 +3542,8 @@ static int check_tos_marking_pkts(odp_bool_t use_ipv6, case 3: /* Tos field must be changed. */ if (tos != expected_tos) { - LOG_ERR("tos=0x%X instead of expected 0x%X\n", - tos, expected_tos); + ODPH_ERR("tos=0x%X instead of expected 0x%X\n", + tos, expected_tos); CU_ASSERT(tos == expected_tos); } break; @@ -3553,8 +3551,8 @@ static int check_tos_marking_pkts(odp_bool_t use_ipv6, default: /* Log error but otherwise ignore, since it is * probably a stray pkt from a previous test. */ - LOG_ERR("Pkt rcvd with invalid pkt class=%u\n", - pkt_class); + ODPH_ERR("Pkt rcvd with invalid pkt class=%u\n", + pkt_class); } }
@@ -3583,13 +3581,13 @@ static int test_ip_marking(const char *node_name, for (color = 0; color < ODP_NUM_PKT_COLORS; color++) { rc = odp_tm_ecn_marking(odp_tm, color, false); if (rc != 0) { - LOG_ERR("disabling odp_tm_ecn_marking() failed\n"); + ODPH_ERR("disabling odp_tm_ecn_marking() failed\n"); return -1; }
rc = odp_tm_drop_prec_marking(odp_tm, color, false); if (rc != 0) { - LOG_ERR("disabling odp_tm_drop_prec_marking failed\n"); + ODPH_ERR("disabling odp_tm_drop_prec_marking failed\n"); return -1; } } @@ -3601,7 +3599,7 @@ static int test_ip_marking(const char *node_name, if (test_ecn) { rc = odp_tm_ecn_marking(odp_tm, pkt_color, true); if (rc != 0) { - LOG_ERR("odp_tm_ecn_marking() call failed\n"); + ODPH_ERR("odp_tm_ecn_marking() call failed\n"); return -1; } } @@ -3609,14 +3607,14 @@ static int test_ip_marking(const char *node_name, if (test_drop_prec) { rc = odp_tm_drop_prec_marking(odp_tm, pkt_color, true); if (rc != 0) { - LOG_ERR("odp_tm_drop_prec_marking() call failed\n"); + ODPH_ERR("odp_tm_drop_prec_marking() call failed\n"); return -1; } }
tm_queue = find_tm_queue(0, node_name, 0); if (tm_queue == ODP_TM_INVALID) { - LOG_ERR("No tm_queue found for node_name='%s'\n", node_name); + ODPH_ERR("No tm_queue found for node_name='%s'\n", node_name); return -1; }
@@ -3637,7 +3635,7 @@ static int test_ip_marking(const char *node_name, pkt_info.pkt_class = 2;
if (make_pkts(pkt_cnt, pkt_len, &pkt_info) != 0) { - LOG_ERR("make_pkts failed\n"); + ODPH_ERR("make_pkts failed\n"); return -1; } } @@ -3648,12 +3646,12 @@ static int test_ip_marking(const char *node_name, ret_code = -1;
if (num_rcv_pkts == 0) { - LOG_ERR("No pkts received\n"); + ODPH_ERR("No pkts received\n"); CU_ASSERT(num_rcv_pkts != 0); ret_code = -1; } else if (num_rcv_pkts != pkts_sent) { - LOG_ERR("pkts_sent=%" PRIu32 " but num_rcv_pkts=%" PRIu32 "\n", - pkts_sent, num_rcv_pkts); + ODPH_ERR("pkts_sent=%" PRIu32 " but num_rcv_pkts=%" PRIu32 "\n", + pkts_sent, num_rcv_pkts); dump_rcvd_pkts(0, num_rcv_pkts - 1); CU_ASSERT(num_rcv_pkts == pkts_sent); ret_code = -1; @@ -3686,8 +3684,8 @@ static int test_protocol_marking(const char *node_name, test_ecn, test_drop_prec, new_dscp, dscp_mask); CU_ASSERT(rc == 0); if (rc != 0) { - LOG_ERR("test_ip_marking failed using IPV4/UDP pkts color=%u " - "test_ecn=%u test_drop_prec=%u\n", + ODPH_ERR("test_ip_marking failed using IPV4/UDP pkts color=%u " + "test_ecn=%u test_drop_prec=%u\n", pkt_color, test_ecn, test_drop_prec); errs++; } @@ -3696,8 +3694,8 @@ static int test_protocol_marking(const char *node_name, test_ecn, test_drop_prec, new_dscp, dscp_mask); CU_ASSERT(rc == 0); if (rc != 0) { - LOG_ERR("test_ip_marking failed using IPV6/UDP pkts color=%u " - "test_ecn=%u test_drop_prec=%u\n", + ODPH_ERR("test_ip_marking failed using IPV6/UDP pkts color=%u " + "test_ecn=%u test_drop_prec=%u\n", pkt_color, test_ecn, test_drop_prec); errs++; } @@ -3706,8 +3704,8 @@ static int test_protocol_marking(const char *node_name, test_ecn, test_drop_prec, new_dscp, dscp_mask); CU_ASSERT(rc == 0); if (rc != 0) { - LOG_ERR("test_ip_marking failed using IPV4/TCP pkts color=%u " - "test_ecn=%u test_drop_prec=%u\n", + ODPH_ERR("test_ip_marking failed using IPV4/TCP pkts color=%u " + "test_ecn=%u test_drop_prec=%u\n", pkt_color, test_ecn, test_drop_prec); errs++; } @@ -3716,9 +3714,9 @@ static int test_protocol_marking(const char *node_name, test_ecn, test_drop_prec, new_dscp, dscp_mask); CU_ASSERT(rc == 0); if (rc != 0) { - LOG_ERR("test_ip_marking failed using IPV6/TCP pkts color=%u " - "test_ecn=%u test_drop_prec=%u\n", - pkt_color, test_ecn, test_drop_prec); + ODPH_ERR("test_ip_marking failed using IPV6/TCP pkts color=%u " + "test_ecn=%u test_drop_prec=%u\n", + pkt_color, test_ecn, test_drop_prec); errs++; }
@@ -3769,14 +3767,14 @@ static int walk_tree_backwards(odp_tm_node_t tm_node) * and active tm_queue is reached. */ rc = odp_tm_node_info(tm_node, &node_info); if (rc != 0) { - LOG_ERR("odp_tm_node_info failed for tm_node=0x%" PRIX64 "\n", - tm_node); + ODPH_ERR("odp_tm_node_info failed for tm_node=0x%" PRIX64 "\n", + tm_node); return rc; }
if ((node_info.tm_queue_fanin == 0) && (node_info.tm_node_fanin == 0)) { - LOG_ERR("odp_tm_node_info showed no fanin for this node\n"); + ODPH_ERR("odp_tm_node_info showed no fanin for this node\n"); return -1; }
@@ -3798,7 +3796,7 @@ static int walk_tree_backwards(odp_tm_node_t tm_node)
if ((fanin_info.tm_queue != ODP_TM_INVALID) && (fanin_info.tm_node != ODP_TM_INVALID)) { - LOG_ERR("Both tm_queue and tm_node are set\n"); + ODPH_ERR("Both tm_queue and tm_node are set\n"); return -1; } else if (fanin_info.tm_queue != ODP_TM_INVALID) { tm_queue_fanin++; @@ -3809,15 +3807,15 @@ static int walk_tree_backwards(odp_tm_node_t tm_node) if (first_tm_node == ODP_TM_INVALID) first_tm_node = fanin_info.tm_node; } else { - LOG_ERR("both tm_queue and tm_node are INVALID\n"); + ODPH_ERR("both tm_queue and tm_node are INVALID\n"); return -1; } }
if (tm_queue_fanin != node_info.tm_queue_fanin) - LOG_ERR("tm_queue_fanin count error\n"); + ODPH_ERR("tm_queue_fanin count error\n"); else if (tm_node_fanin != node_info.tm_node_fanin) - LOG_ERR("tm_node_fanin count error\n"); + ODPH_ERR("tm_node_fanin count error\n");
/* If we have found a tm_queue then we are successfully done. */ if (first_tm_queue != ODP_TM_INVALID) @@ -3834,13 +3832,13 @@ static int test_fanin_info(const char *node_name)
node_desc = find_node_desc(0, node_name); if (node_desc == NULL) { - LOG_ERR("node_name %s not found\n", node_name); + ODPH_ERR("node_name %s not found\n", node_name); return -1; }
tm_node = node_desc->node; if (tm_node == ODP_TM_INVALID) { - LOG_ERR("tm_node is ODP_TM_INVALID\n"); + ODPH_ERR("tm_node is ODP_TM_INVALID\n"); return -1; }
@@ -3913,8 +3911,8 @@ static void traffic_mngr_test_thresholds(void) static void traffic_mngr_test_byte_wred(void) { if (!tm_capabilities.tm_queue_wred_supported) { - LOG_DBG("\nwas not run because tm_capabilities indicates" - " no WRED support\n"); + ODPH_DBG("\nwas not run because tm_capabilities indicates" + " no WRED support\n"); return; }
@@ -3938,8 +3936,8 @@ static void traffic_mngr_test_pkt_wred(void) int rc;
if (!tm_capabilities.tm_queue_wred_supported) { - LOG_DBG("\ntest_pkt_wred was not run because tm_capabilities " - "indicates no WRED support\n"); + ODPH_DBG("\ntest_pkt_wred was not run because tm_capabilities " + "indicates no WRED support\n"); return; }
@@ -3950,8 +3948,8 @@ static void traffic_mngr_test_pkt_wred(void) CU_FAIL("40G test failed\n");
if (!tm_capabilities.tm_queue_dual_slope_supported) { - LOG_DBG("since tm_capabilities indicates no dual slope " - "WRED support these tests are skipped.\n"); + ODPH_DBG("since tm_capabilities indicates no dual slope " + "WRED support these tests are skipped.\n"); return; }
@@ -3992,8 +3990,8 @@ static void traffic_mngr_test_marking(void) CU_ASSERT(rc == 0); } } else { - LOG_DBG("\ntest_vlan_marking was not run because " - "tm_capabilities indicates no vlan marking support\n"); + ODPH_DBG("\ntest_vlan_marking was not run because " + "tm_capabilities indicates no vlan marking support\n"); }
if (tm_capabilities.ecn_marking_supported) { @@ -4003,8 +4001,8 @@ static void traffic_mngr_test_marking(void) rc = ip_marking_tests("node_1_3_2", test_ecn, test_drop_prec); CU_ASSERT(rc == 0); } else { - LOG_DBG("\necn_marking tests were not run because " - "tm_capabilities indicates no ecn marking support\n"); + ODPH_DBG("\necn_marking tests were not run because " + "tm_capabilities indicates no ecn marking support\n"); }
if (tm_capabilities.drop_prec_marking_supported) { @@ -4014,9 +4012,9 @@ static void traffic_mngr_test_marking(void) rc = ip_marking_tests("node_1_4_2", test_ecn, test_drop_prec); CU_ASSERT(rc == 0); } else { - LOG_DBG("\ndrop_prec marking tests were not run because " - "tm_capabilities indicates no drop precedence " - "marking support\n"); + ODPH_DBG("\ndrop_prec marking tests were not run because " + "tm_capabilities indicates no drop precedence " + "marking support\n"); }
if (tm_capabilities.ecn_marking_supported &&
commit 784508fa45ed1a006ee7924737c69d33758563cd Author: Matias Elo matias.elo@nokia.com Date: Mon Sep 16 16:33:02 2019 +0300
linux-gen: test: use helper library debug macros
Use ODP helper library debug macros instead of reimplementing the same functionality in test_debug.h.
Signed-off-by: Matias Elo matias.elo@nokia.com Reviewed-by: Petri Savolainen petri.savolainen@nokia.com
diff --git a/platform/linux-generic/test/pktio_ipc/ipc_common.c b/platform/linux-generic/test/pktio_ipc/ipc_common.c index 9ff0463e2..f2f73a5a1 100644 --- a/platform/linux-generic/test/pktio_ipc/ipc_common.c +++ b/platform/linux-generic/test/pktio_ipc/ipc_common.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */
-#include "config.h" - #include "ipc_common.h"
/** Run time in seconds */ @@ -29,14 +27,14 @@ int ipc_odp_packet_send_or_free(odp_pktio_t pktio, end_time = odp_time_sum(start_time, wait);
if (odp_pktout_queue(pktio, &pktout, 1) != 1) { - LOG_ERR("no output queue\n"); + ODPH_ERR("no output queue\n"); return -1; }
while (sent != num) { ret = odp_pktout_send(pktout, &pkt_tbl[sent], num - sent); if (ret < 0) { - LOG_ERR("odp_pktout_send return %d\n", ret); + ODPH_ERR("odp_pktout_send return %d\n", ret); for (i = sent; i < num; i++) odp_packet_free(pkt_tbl[i]); return -1; @@ -47,7 +45,7 @@ int ipc_odp_packet_send_or_free(odp_pktio_t pktio, if (odp_time_cmp(end_time, odp_time_local()) < 0) { for (i = sent; i < num; i++) odp_packet_free(pkt_tbl[i]); - LOG_ERR("Send Timeout!\n"); + ODPH_ERR("Send Timeout!\n"); return -1; } } @@ -71,17 +69,17 @@ odp_pktio_t create_pktio(odp_pool_t pool, int master_pid) printf("pid: %d, create IPC pktio %s\n", getpid(), name); ipc_pktio = odp_pktio_open(name, pool, &pktio_param); if (ipc_pktio == ODP_PKTIO_INVALID) { - LOG_ERR("Error: ipc pktio %s create failed.\n", name); + ODPH_ERR("Error: ipc pktio %s create failed.\n", name); return ODP_PKTIO_INVALID; }
if (odp_pktin_queue_config(ipc_pktio, NULL)) { - LOG_ERR("Input queue config failed\n"); + ODPH_ERR("Input queue config failed\n"); return ODP_PKTIO_INVALID; }
if (odp_pktout_queue_config(ipc_pktio, NULL)) { - LOG_ERR("Output queue config failed\n"); + ODPH_ERR("Output queue config failed\n"); return ODP_PKTIO_INVALID; }
diff --git a/platform/linux-generic/test/pktio_ipc/ipc_common.h b/platform/linux-generic/test/pktio_ipc/ipc_common.h index 5723a00eb..d8e7a2f4e 100644 --- a/platform/linux-generic/test/pktio_ipc/ipc_common.h +++ b/platform/linux-generic/test/pktio_ipc/ipc_common.h @@ -20,8 +20,6 @@ #include <signal.h> #include <sys/wait.h>
-#include <test_debug.h> - #include <odp.h> #include <odp/helper/odph_api.h>
diff --git a/platform/linux-generic/test/pktio_ipc/pktio_ipc1.c b/platform/linux-generic/test/pktio_ipc/pktio_ipc1.c index 4f77306de..bf9656452 100644 --- a/platform/linux-generic/test/pktio_ipc/pktio_ipc1.c +++ b/platform/linux-generic/test/pktio_ipc/pktio_ipc1.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */
-#include "config.h" - #include "ipc_common.h"
/** @@ -77,7 +75,7 @@ static int pktio_run_loop(odp_pool_t pool) return -1;
if (odp_pktin_queue(ipc_pktio, &pktin, 1) != 1) { - LOG_ERR("no input queue\n"); + ODPH_ERR("no input queue\n"); return -1; }
@@ -110,8 +108,8 @@ static int pktio_run_loop(odp_pool_t pool) cycle = odp_time_local(); diff = odp_time_diff(cycle, start_cycle); if (odp_time_cmp(wait, diff) < 0) { - LOG_DBG("exit after %d seconds\n", - run_time_sec); + ODPH_DBG("exit after %d seconds\n", + run_time_sec); break; } } @@ -135,7 +133,7 @@ static int pktio_run_loop(odp_pool_t pool) stat_errors++; stat_free++; odp_packet_free(pkt); - LOG_ERR("invalid l4 offset\n"); + ODPH_ERR("invalid l4 offset\n"); }
off += ODPH_UDPHDR_LEN; @@ -146,7 +144,7 @@ static int pktio_run_loop(odp_pool_t pool) stat_errors++; stat_free++; odp_packet_free(pkt); - LOG_DBG("error\n"); + ODPH_DBG("error\n"); continue; }
@@ -160,7 +158,7 @@ static int pktio_run_loop(odp_pool_t pool) stat_errors++; stat_free++; odp_packet_free(pkt); - LOG_DBG("error\n"); + ODPH_DBG("error\n"); continue; }
@@ -187,11 +185,10 @@ static int pktio_run_loop(odp_pool_t pool) if (head.seq != cnt_recv && sync_cnt) { stat_errors++; odp_packet_free(pkt); - LOG_DBG("head.seq %d - " - "cnt_recv %" PRIu64 "" - " = %" PRIu64 "\n", - head.seq, cnt_recv, - head.seq - cnt_recv); + ODPH_DBG("head.seq %d - cnt_recv " + "%" PRIu64 " = %" PRIu64 "\n", + head.seq, cnt_recv, + head.seq - cnt_recv); cnt_recv = head.seq; stat_free++; continue; @@ -206,7 +203,7 @@ static int pktio_run_loop(odp_pool_t pool) ret = odp_random_data((uint8_t *)&pkts, sizeof(pkts), ODP_RANDOM_BASIC); if (ret != sizeof(pkts)) { - LOG_ABORT("random failed"); + ODPH_ABORT("random failed"); break; } pkts = ((pkts & 0xffff) % MAX_PKT_BURST) + 1; @@ -234,7 +231,7 @@ static int pktio_run_loop(odp_pool_t pool)
off = odp_packet_l4_offset(pkt); if (off == ODP_PACKET_OFFSET_INVALID) - LOG_ABORT("packet L4 offset not set"); + ODPH_ABORT("packet L4 offset not set");
head.magic = TEST_SEQ_MAGIC; head.seq = cnt++; @@ -243,20 +240,20 @@ static int pktio_run_loop(odp_pool_t pool) ret = odp_packet_copy_from_mem(pkt, off, sizeof(head), &head); if (ret) - LOG_ABORT("unable to copy in head data"); + ODPH_ABORT("unable to copy in head data");
tail.magic = TEST_SEQ_MAGIC; off = odp_packet_len(pkt) - sizeof(pkt_tail_t); ret = odp_packet_copy_from_mem(pkt, off, sizeof(tail), &tail); if (ret) - LOG_ABORT("unable to copy in tail data"); + ODPH_ABORT("unable to copy in tail data"); }
/* 5. Send packets to ipc_pktio */ ret = ipc_odp_packet_send_or_free(ipc_pktio, pkt_tbl, pkts); if (ret < 0) { - LOG_DBG("unable to sending to ipc pktio\n"); + ODPH_DBG("unable to sending to ipc pktio\n"); break; }
@@ -283,14 +280,14 @@ static int pktio_run_loop(odp_pool_t pool) /* cleanup and exit */ ret = odp_pktio_stop(ipc_pktio); if (ret) { - LOG_DBG("odp_pktio_stop error %d\n", ret); + ODPH_DBG("odp_pktio_stop error %d\n", ret); return -1; }
exit: ret = odp_pktio_close(ipc_pktio); if (ret) { - LOG_DBG("odp_pktio_close error %d\n", ret); + ODPH_DBG("odp_pktio_close error %d\n", ret); return -1; }
@@ -316,7 +313,7 @@ int main(int argc, char *argv[])
/* Init ODP before calling anything else */ if (odp_init_global(&instance, NULL, NULL)) { - LOG_ERR("Error: ODP global init failed.\n"); + ODPH_ERR("Error: ODP global init failed.\n"); exit(EXIT_FAILURE); }
@@ -337,7 +334,7 @@ int main(int argc, char *argv[])
/* Init this thread */ if (odp_init_local(instance, ODP_THREAD_WORKER)) { - LOG_ERR("Error: ODP local init failed.\n"); + ODPH_ERR("Error: ODP local init failed.\n"); exit(EXIT_FAILURE); }
@@ -353,7 +350,7 @@ int main(int argc, char *argv[])
pool = odp_pool_create(TEST_IPC_POOL_NAME, ¶ms); if (pool == ODP_POOL_INVALID) { - LOG_ERR("Error: packet pool create failed.\n"); + ODPH_ERR("Error: packet pool create failed.\n"); exit(EXIT_FAILURE); }
@@ -362,20 +359,20 @@ int main(int argc, char *argv[]) ret = pktio_run_loop(pool);
if (odp_pool_destroy(pool)) { - LOG_ERR("Error: odp_pool_destroy() failed.\n"); + ODPH_ERR("Error: odp_pool_destroy() failed.\n"); exit(EXIT_FAILURE); }
if (odp_term_local()) { - LOG_ERR("Error: odp_term_local() failed.\n"); + ODPH_ERR("Error: odp_term_local() failed.\n"); exit(EXIT_FAILURE); }
if (odp_term_global(instance)) { - LOG_ERR("Error: odp_term_global() failed.\n"); + ODPH_ERR("Error: odp_term_global() failed.\n"); exit(EXIT_FAILURE); }
- LOG_DBG("return %d\n", ret); + ODPH_DBG("return %d\n", ret); return ret; } diff --git a/platform/linux-generic/test/pktio_ipc/pktio_ipc2.c b/platform/linux-generic/test/pktio_ipc/pktio_ipc2.c index e6270f89d..0d64e94ba 100644 --- a/platform/linux-generic/test/pktio_ipc/pktio_ipc2.c +++ b/platform/linux-generic/test/pktio_ipc/pktio_ipc2.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */
-#include "config.h" - /** * @file * @@ -44,7 +42,7 @@ static int ipc_second_process(int master_pid)
pool = odp_pool_create(TEST_IPC_POOL_NAME, ¶ms); if (pool == ODP_POOL_INVALID) { - LOG_ERR("Error: packet pool create failed.\n"); + ODPH_ERR("Error: packet pool create failed.\n"); exit(EXIT_FAILURE); }
@@ -77,7 +75,7 @@ static int ipc_second_process(int master_pid)
if (odp_pktin_queue(ipc_pktio, &pktin, 1) != 1) { odp_pool_destroy(pool); - LOG_ERR("no input queue\n"); + ODPH_ERR("no input queue\n"); return -1; }
@@ -108,8 +106,8 @@ static int ipc_second_process(int master_pid) cycle = odp_time_local(); diff = odp_time_diff(cycle, start_cycle); if (odp_time_cmp(wait, diff) < 0) { - LOG_DBG("exit after %d seconds\n", - run_time_sec); + ODPH_DBG("exit after %d seconds\n", + run_time_sec); break; } } @@ -126,7 +124,7 @@ static int ipc_second_process(int master_pid)
off = odp_packet_l4_offset(pkt); if (off == ODP_PACKET_OFFSET_INVALID) { - LOG_ERR("invalid l4 offset\n"); + ODPH_ERR("invalid l4 offset\n"); for (int j = i; j < pkts; j++) odp_packet_free(pkt_tbl[j]); break; @@ -136,10 +134,10 @@ static int ipc_second_process(int master_pid) ret = odp_packet_copy_to_mem(pkt, off, sizeof(head), &head); if (ret) - LOG_ABORT("unable copy out head data"); + ODPH_ABORT("unable copy out head data");
if (head.magic != TEST_SEQ_MAGIC) { - LOG_ERR("Wrong head magic! %x", head.magic); + ODPH_ERR("Wrong head magic! %x", head.magic); for (int j = i; j < pkts; j++) odp_packet_free(pkt_tbl[j]); break; @@ -150,13 +148,13 @@ static int ipc_second_process(int master_pid) ret = odp_packet_copy_from_mem(pkt, off, sizeof(head), &head); if (ret) - LOG_ABORT("unable to copy in head data"); + ODPH_ABORT("unable to copy in head data"); }
/* send all packets back */ ret = ipc_odp_packet_send_or_free(ipc_pktio, pkt_tbl, i); if (ret < 0) - LOG_ABORT("can not send packets\n"); + ODPH_ABORT("can not send packets\n");
stat_pkts += ret;
@@ -177,13 +175,13 @@ static int ipc_second_process(int master_pid) sizeof(head), &head); if (ret) - LOG_ABORT("unable to copy in head data"); + ODPH_ABORT("unable to copy in head data");
pkt_tbl[0] = alloc_pkt; ret = ipc_odp_packet_send_or_free(ipc_pktio, pkt_tbl, 1); if (ret < 0) - LOG_ABORT("can not send packets\n"); + ODPH_ABORT("can not send packets\n"); stat_pkts += 1; } } @@ -191,20 +189,20 @@ static int ipc_second_process(int master_pid) /* cleanup and exit */ ret = odp_pktio_stop(ipc_pktio); if (ret) { - LOG_DBG("ipc2: odp_pktio_stop error %d\n", ret); + ODPH_DBG("ipc2: odp_pktio_stop error %d\n", ret); return -1; }
not_started: ret = odp_pktio_close(ipc_pktio); if (ret) { - LOG_DBG("ipc2: odp_pktio_close error %d\n", ret); + ODPH_DBG("ipc2: odp_pktio_close error %d\n", ret); return -1; }
ret = odp_pool_destroy(pool); if (ret) - LOG_DBG("ipc2: pool_destroy error %d\n", ret); + ODPH_DBG("ipc2: pool_destroy error %d\n", ret);
return stat_pkts > 1000 ? 0 : -1; } @@ -222,7 +220,7 @@ int main(int argc, char *argv[]) parse_args(argc, argv);
if (odp_init_global(&instance, NULL, NULL)) { - LOG_ERR("Error: ODP global init failed.\n"); + ODPH_ERR("Error: ODP global init failed.\n"); exit(EXIT_FAILURE); }
@@ -246,19 +244,19 @@ int main(int argc, char *argv[])
/* Init this thread */ if (odp_init_local(instance, ODP_THREAD_WORKER)) { - LOG_ERR("Error: ODP local init failed.\n"); + ODPH_ERR("Error: ODP local init failed.\n"); exit(EXIT_FAILURE); }
ret = ipc_second_process(master_pid);
if (odp_term_local()) { - LOG_ERR("Error: odp_term_local() failed.\n"); + ODPH_ERR("Error: odp_term_local() failed.\n"); exit(EXIT_FAILURE); }
if (odp_term_global(instance)) { - LOG_ERR("Error: odp_term_global() failed.\n"); + ODPH_ERR("Error: odp_term_global() failed.\n"); exit(EXIT_FAILURE); }
diff --git a/platform/linux-generic/test/ring/ring_basic.c b/platform/linux-generic/test/ring/ring_basic.c index 6b17d8e52..dc76fd6b3 100644 --- a/platform/linux-generic/test/ring/ring_basic.c +++ b/platform/linux-generic/test/ring/ring_basic.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */
-#include "config.h" - /** * @file * @@ -16,11 +14,12 @@ #include <stdio.h> #include <string.h>
-#include <test_debug.h> #include <odp_cunit_common.h> #include <odp_packet_io_ring_internal.h> #include <odp_errno_define.h>
+#include <odp/helper/odph_api.h> + #include "ring_suites.h"
/* labor functions declaration */ @@ -42,7 +41,7 @@ int ring_test_basic_start(void) /* alloc dummy object pointers for enqueue testing */ test_enq_data = malloc(RING_SIZE * 2 * sizeof(void *)); if (NULL == test_enq_data) { - LOG_ERR("failed to allocate basic test enqeue data\n"); + ODPH_ERR("failed to allocate basic test enqeue data\n"); return -1; }
@@ -52,7 +51,7 @@ int ring_test_basic_start(void) /* alloc dummy object pointers for dequeue testing */ test_deq_data = malloc(RING_SIZE * 2 * sizeof(void *)); if (NULL == test_deq_data) { - LOG_ERR("failed to allocate basic test dequeue data\n"); + ODPH_ERR("failed to allocate basic test dequeue data\n"); free(test_enq_data); test_enq_data = NULL; return -1; } diff --git a/platform/linux-generic/test/ring/ring_stress.c b/platform/linux-generic/test/ring/ring_stress.c index ddabffad0..b0b996789 100644 --- a/platform/linux-generic/test/ring/ring_stress.c +++ b/platform/linux-generic/test/ring/ring_stress.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */
-#include "config.h" - /** * @file * @@ -24,7 +22,6 @@ #include <odp_api.h> #include <odp/helper/odph_api.h> #include <odp_packet_io_ring_internal.h> -#include <test_debug.h> #include <odp_cunit_common.h>
#include "ring_suites.h" @@ -88,7 +85,7 @@ int ring_test_stress_start(void) /* multiple thread usage scenario, thread or process sharable */ r_stress = _ring_create(ring_name, RING_SIZE, _RING_SHM_PROC); if (r_stress == NULL) { - LOG_ERR("create ring failed for stress.\n"); + ODPH_ERR("create ring failed for stress.\n"); return -1; }
@@ -121,7 +118,7 @@ void ring_test_stress_1_1_producer_consumer(void)
/* not failure, insufficient resource */ if (worker_param.numthrds < 2) { - LOG_ERR("insufficient cpu for 1:1 " + ODPH_ERR("insufficient cpu for 1:1 " "producer/consumer stress.\n"); return; } @@ -156,7 +153,7 @@ void ring_test_stress_N_M_producer_consumer(void)
/* not failure, insufficient resource */ if (worker_param.numthrds < 3) { - LOG_ERR("insufficient cpu for N:M " + ODPH_ERR("insufficient cpu for N:M " "producer/consumer stress.\n"); return; } @@ -244,7 +241,7 @@ static int stress_worker(void *_data) /* verify ring lookup in worker context */ r_stress = _ring_lookup(ring_name); if (NULL == r_stress) { - LOG_ERR("ring lookup %s not found\n", ring_name); + ODPH_ERR("ring lookup %s not found\n", ring_name); return (*result = -1); }
@@ -262,8 +259,8 @@ static int stress_worker(void *_data) case STRESS_1_N_PRODUCER_CONSUMER: case STRESS_N_1_PRODUCER_CONSUMER: default: - LOG_ERR("invalid or not-implemented stress type (%d)\n", - worker_param->testcase); + ODPH_ERR("invalid or not-implemented stress type (%d)\n", + worker_param->testcase); break; }
diff --git a/platform/linux-generic/test/ring/ring_suites.c b/platform/linux-generic/test/ring/ring_suites.c index 5f1957771..a6b3376ce 100644 --- a/platform/linux-generic/test/ring/ring_suites.c +++ b/platform/linux-generic/test/ring/ring_suites.c @@ -4,14 +4,13 @@ * SPDX-License-Identifier: BSD-3-Clause */
-#include "config.h" - #include <stdlib.h> #include <stdio.h> #include <string.h>
#include <odp_api.h> -#include <test_debug.h> +#include <odp/helper/odph_api.h> + #include <odp_cunit_common.h> #include <odp_packet_io_ring_internal.h>
@@ -20,11 +19,11 @@ static int ring_suites_init(odp_instance_t *inst) { if (0 != odp_init_global(inst, NULL, NULL)) { - LOG_ERR("error: odp_init_global() failed.\n"); + ODPH_ERR("error: odp_init_global() failed.\n"); return -1; } if (0 != odp_init_local(*inst, ODP_THREAD_CONTROL)) { - LOG_ERR("error: odp_init_local() failed.\n"); + ODPH_ERR("error: odp_init_local() failed.\n"); return -1; }
commit cb42240e0e8eb586694f96adeac814421a57f838 Author: Matias Elo matias.elo@nokia.com Date: Mon Sep 16 15:30:19 2019 +0300
test: performance: use helper library debug macros
Use ODP helper library debug macros instead of reimplementing the same functionality in test_debug.h.
Signed-off-by: Matias Elo matias.elo@nokia.com Reviewed-by: Petri Savolainen petri.savolainen@nokia.com
diff --git a/test/performance/odp_bench_packet.c b/test/performance/odp_bench_packet.c index 387bd9f25..d050debb9 100644 --- a/test/performance/odp_bench_packet.c +++ b/test/performance/odp_bench_packet.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */
-#include "config.h" - /** * @file * @@ -19,13 +17,8 @@ #include <inttypes.h> #include <signal.h>
-#include <test_debug.h> - #include <odp_api.h> -#include <odp/helper/threads.h> -#include <odp/helper/eth.h> -#include <odp/helper/ip.h> -#include <odp/helper/udp.h> +#include <odp/helper/odph_api.h>
/** Minimum number of packet data bytes in the first segment */ #define PKT_POOL_SEG_LEN 128 @@ -200,7 +193,7 @@ static void run_indef(args_t *args, int idx) args->bench[idx].term();
if (!ret) - LOG_ABORT("Benchmark %s failed\n", desc); + ODPH_ABORT("Benchmark %s failed\n", desc); } }
@@ -257,7 +250,7 @@ static int run_benchmarks(void *arg) args->bench[j].term();
if (!ret) { - LOG_ERR("Benchmark %s failed\n", desc); + ODPH_ERR("Benchmark %s failed\n", desc); args->bench_failed = 1; return -1; } @@ -314,7 +307,7 @@ static void allocate_test_packets(uint32_t len, odp_packet_t pkt[], int num) ret = odp_packet_alloc_multi(gbl_args->pool, len, &pkt[pkts], num - pkts); if (ret < 0) - LOG_ABORT("Allocating test packets failed\n"); + ODPH_ABORT("Allocating test packets failed\n");
pkts += ret; } @@ -351,7 +344,7 @@ static void alloc_ref_packets(void) for (i = 0; i < TEST_REPEAT_COUNT; i++) { ref_tbl[i] = odp_packet_ref(pkt_tbl[i], TEST_MIN_PKT_SIZE / 2); if (ref_tbl[i] == ODP_PACKET_INVALID) - LOG_ABORT("Allocating packet reference failed\n"); + ODPH_ABORT("Allocating packet reference failed\n"); } }
@@ -399,7 +392,7 @@ static void create_packets(void) if (odp_packet_l2_offset_set(pkt_tbl[i], TEST_L2_OFFSET) || odp_packet_l3_offset_set(pkt_tbl[i], TEST_L3_OFFSET) || odp_packet_l4_offset_set(pkt_tbl[i], TEST_L4_OFFSET)) - LOG_ABORT("Setting test packet offsets failed\n"); + ODPH_ABORT("Setting test packet offsets failed\n");
odp_packet_flow_hash_set(pkt_tbl[i], i); odp_packet_ts_set(pkt_tbl[i], odp_time_local()); @@ -523,7 +516,7 @@ static int bench_packet_alloc_free_multi(void) gbl_args->appl.burst_size);
if (pkts < 0) - LOG_ABORT("Packet alloc failed\n"); + ODPH_ABORT("Packet alloc failed\n");
odp_packet_free_multi(gbl_args->pkt_tbl, pkts); } @@ -1530,7 +1523,7 @@ int main(int argc, char *argv[]) /* Let helper collect its own arguments (e.g. --odph_proc) */ argc = odph_parse_options(argc, argv); if (odph_options(&helper_options)) { - LOG_ERR("Error: reading ODP helper options failed.\n"); + ODPH_ERR("Error: reading ODP helper options failed.\n"); exit(EXIT_FAILURE); }
@@ -1539,13 +1532,13 @@ int main(int argc, char *argv[])
/* Init ODP before calling anything else */ if (odp_init_global(&instance, &init_param, NULL)) { - LOG_ERR("Error: ODP global init failed.\n"); + ODPH_ERR("Error: ODP global init failed.\n"); exit(EXIT_FAILURE); }
/* Init this thread */ if (odp_init_local(instance, ODP_THREAD_CONTROL)) { - LOG_ERR("Error: ODP local init failed.\n"); + ODPH_ERR("Error: ODP local init failed.\n"); exit(EXIT_FAILURE); }
@@ -1554,14 +1547,14 @@ int main(int argc, char *argv[]) ODP_CACHE_LINE_SIZE, 0);
if (shm == ODP_SHM_INVALID) { - LOG_ERR("Error: shared mem reserve failed.\n"); + ODPH_ERR("Error: shared mem reserve failed.\n"); exit(EXIT_FAILURE); }
gbl_args = odp_shm_addr(shm);
if (gbl_args == NULL) { - LOG_ERR("Error: shared mem alloc failed.\n"); + ODPH_ERR("Error: shared mem alloc failed.\n"); exit(EXIT_FAILURE); }
@@ -1578,7 +1571,7 @@ int main(int argc, char *argv[])
/* Get default worker cpumask */ if (odp_cpumask_default_worker(&cpumask, 1) != 1) { - LOG_ERR("Error: unable to allocate worker thread.\n"); + ODPH_ERR("Error: unable to allocate worker thread.\n"); exit(EXIT_FAILURE); }
@@ -1586,7 +1579,7 @@ int main(int argc, char *argv[])
/* Check pool capability */ if (odp_pool_capability(&capa)) { - LOG_ERR("Error: unable to query pool capability.\n"); + ODPH_ERR("Error: unable to query pool capability.\n"); exit(EXIT_FAILURE); }
@@ -1596,19 +1589,19 @@ int main(int argc, char *argv[]) 2 * TEST_REPEAT_COUNT;
if (capa.pkt.max_num && capa.pkt.max_num < pkt_num) { - LOG_ERR("Error: packet pool size not supported.\n"); + ODPH_ERR("Error: packet pool size not supported.\n"); printf("MAX: %" PRIu32 "\n", capa.pkt.max_num); exit(EXIT_FAILURE); } else if (capa.pkt.max_len && capa.pkt.max_len < TEST_MAX_PKT_SIZE) { - LOG_ERR("Error: packet length not supported.\n"); + ODPH_ERR("Error: packet length not supported.\n"); exit(EXIT_FAILURE); } else if (capa.pkt.max_seg_len && capa.pkt.max_seg_len < PKT_POOL_SEG_LEN) { - LOG_ERR("Error: segment length not supported.\n"); + ODPH_ERR("Error: segment length not supported.\n"); exit(EXIT_FAILURE); } else if (capa.pkt.max_uarea_size && capa.pkt.max_uarea_size < PKT_POOL_UAREA_SIZE) { - LOG_ERR("Error: user area size not supported.\n"); + ODPH_ERR("Error: user area size not supported.\n"); exit(EXIT_FAILURE); }
@@ -1623,7 +1616,7 @@ int main(int argc, char *argv[]) gbl_args->pool = odp_pool_create("packet pool", ¶ms);
if (gbl_args->pool == ODP_POOL_INVALID) { - LOG_ERR("Error: packet pool create failed.\n"); + ODPH_ERR("Error: packet pool create failed.\n"); exit(EXIT_FAILURE); }
@@ -1660,24 +1653,24 @@ int main(int argc, char *argv[]) ret = gbl_args->bench_failed;
if (odp_pool_destroy(gbl_args->pool)) { - LOG_ERR("Error: pool destroy\n"); + ODPH_ERR("Error: pool destroy\n"); exit(EXIT_FAILURE); } gbl_args = NULL; odp_mb_full();
if (odp_shm_free(shm)) { - LOG_ERR("Error: shm free\n"); + ODPH_ERR("Error: shm free\n"); exit(EXIT_FAILURE); }
if (odp_term_local()) { - LOG_ERR("Error: term local\n"); + ODPH_ERR("Error: term local\n"); exit(EXIT_FAILURE); }
if (odp_term_global(instance)) { - LOG_ERR("Error: term global\n"); + ODPH_ERR("Error: term global\n"); exit(EXIT_FAILURE); }
diff --git a/test/performance/odp_cpu_bench.c b/test/performance/odp_cpu_bench.c index 8ea064535..6a125a1c7 100644 --- a/test/performance/odp_cpu_bench.c +++ b/test/performance/odp_cpu_bench.c @@ -4,13 +4,9 @@ * SPDX-License-Identifier: BSD-3-Clause */
-#include "config.h" - #include <odp_api.h> #include <odp/helper/odph_api.h>
-#include <test_debug.h> - #include <getopt.h> #include <inttypes.h> #include <signal.h> @@ -192,14 +188,14 @@ static inline void init_packet(odp_packet_t pkt, uint32_t seq, uint16_t group) param.last_layer = ODP_PROTO_LAYER_ALL; param.chksums.all_chksum = 0; if (odp_packet_parse(pkt, 0, ¶m)) - LOG_ABORT("odp_packet_parse() failed\n"); + ODPH_ABORT("odp_packet_parse() failed\n");
/* Modify UDP payload and update checksum */ payload = odp_packet_offset(pkt, odp_packet_l4_offset(pkt) + ODPH_UDPHDR_LEN, NULL, NULL); *payload = seq; if (odph_udp_chksum_set(pkt)) - LOG_ABORT("odph_udp_chksum_set() failed\n"); + ODPH_ABORT("odph_udp_chksum_set() failed\n");
/* Test header is stored in user area */ hdr = odp_packet_user_area(pkt); @@ -233,13 +229,13 @@ static inline odp_queue_t work_on_event(odp_event_t event)
crc = odp_hash_crc32c(data, pkt_len, CRC_INIT_VAL); if (crc != hdr->crc) - LOG_ERR("Error: Invalid packet crc\n"); + ODPH_ERR("Error: Invalid packet crc\n");
param.proto = ODP_PROTO_ETH; param.last_layer = ODP_PROTO_LAYER_ALL; param.chksums.all_chksum = 1; if (odp_packet_parse(pkt, 0, ¶m)) { - LOG_ERR("Error: odp_packet_parse() failed\n"); + ODPH_ERR("Error: odp_packet_parse() failed\n"); return ODP_QUEUE_INVALID; }
@@ -304,7 +300,7 @@ static int run_thread(void *arg) }
if (odp_unlikely(odp_queue_enq(dst_queue, event))) { - LOG_ERR("Error: odp_queue_enq() failed\n"); + ODPH_ERR("Error: odp_queue_enq() failed\n"); stats->s.dropped_pkts++; odp_event_free(event); break; @@ -549,7 +545,7 @@ int main(int argc, char *argv[]) /* Let helper collect its own arguments (e.g. --odph_proc) */ argc = odph_parse_options(argc, argv); if (odph_options(&helper_options)) { - LOG_ERR("Error: reading ODP helper options failed.\n"); + ODPH_ERR("Error: reading ODP helper options failed.\n"); exit(EXIT_FAILURE); }
@@ -569,25 +565,25 @@ int main(int argc, char *argv[]) signal(SIGINT, sig_handler);
if (odp_init_global(&instance, &init, NULL)) { - LOG_ERR("Error: ODP global init failed\n"); + ODPH_ERR("Error: ODP global init failed\n"); return -1; }
if (odp_init_local(instance, ODP_THREAD_CONTROL)) { - LOG_ERR("Error: ODP local init failed\n"); + ODPH_ERR("Error: ODP local init failed\n"); exit(EXIT_FAILURE); }
shm = odp_shm_reserve("shm_args", sizeof(args_t), ODP_CACHE_LINE_SIZE, 0); if (shm == ODP_SHM_INVALID) { - LOG_ERR("Error: shared mem reserve failed.\n"); + ODPH_ERR("Error: shared mem reserve failed.\n"); exit(EXIT_FAILURE); }
gbl_args = odp_shm_addr(shm); if (gbl_args == NULL) { - LOG_ERR("Error: shared mem alloc failed\n"); + ODPH_ERR("Error: shared mem alloc failed\n"); exit(EXIT_FAILURE); } gbl_args_init(gbl_args); @@ -600,13 +596,13 @@ int main(int argc, char *argv[]) gbl_args->appl.lookup_tbl_size, ODP_CACHE_LINE_SIZE, 0); if (lookup_tbl_shm == ODP_SHM_INVALID) { - LOG_ERR("Error: shared mem reserve failed.\n"); + ODPH_ERR("Error: shared mem reserve failed.\n"); exit(EXIT_FAILURE); }
gbl_args->lookup_tbl = odp_shm_addr(lookup_tbl_shm); if (gbl_args->lookup_tbl == NULL) { - LOG_ERR("Error: lookup table mem alloc failed\n"); + ODPH_ERR("Error: lookup table mem alloc failed\n"); exit(EXIT_FAILURE); }
@@ -637,7 +633,7 @@ int main(int argc, char *argv[])
/* Divide queues evenly into groups */ if (schedule_config.num_queues < QUEUES_PER_GROUP) { - LOG_ERR("Error: min %d queues required\n", QUEUES_PER_GROUP); + ODPH_ERR("Error: min %d queues required\n", QUEUES_PER_GROUP); return -1; } num_queues = num_workers > schedule_config.num_queues ? @@ -661,7 +657,7 @@ int main(int argc, char *argv[])
queue = odp_queue_create(NULL, ¶m); if (queue == ODP_QUEUE_INVALID) { - LOG_ERR("Error: odp_queue_create() failed\n"); + ODPH_ERR("Error: odp_queue_create() failed\n"); return -1; } gbl_args->queue[i][j] = queue; @@ -670,7 +666,7 @@ int main(int argc, char *argv[])
/* Create packet pool */ if (odp_pool_capability(&pool_capa)) { - LOG_ERR("Error: odp_pool_capability() failed\n"); + ODPH_ERR("Error: odp_pool_capability() failed\n"); exit(EXIT_FAILURE); } num_pkts = pkts_per_group * num_groups; @@ -685,15 +681,15 @@ int main(int argc, char *argv[]) pkt_len = pool_capa.pkt.max_seg_len;
if (pkt_len < sizeof(test_udp_packet)) { - LOG_ERR("Error: min %dB single segment packets required\n", - (int)sizeof(test_udp_packet)); + ODPH_ERR("Error: min %dB single segment packets required\n", + (int)sizeof(test_udp_packet)); exit(EXIT_FAILURE); }
if (pool_capa.pkt.max_uarea_size && pool_capa.pkt.max_uarea_size < sizeof(test_hdr_t)) { - LOG_ERR("Error: min %dB of packet user area required\n", - (int)sizeof(test_hdr_t)); + ODPH_ERR("Error: min %dB of packet user area required\n", + (int)sizeof(test_hdr_t)); exit(EXIT_FAILURE); }
@@ -707,7 +703,7 @@ int main(int argc, char *argv[]) params.type = ODP_POOL_PACKET; pool = odp_pool_create("pkt_pool", ¶ms); if (pool == ODP_POOL_INVALID) { - LOG_ERR("Error: packet pool create failed\n"); + ODPH_ERR("Error: packet pool create failed\n"); exit(EXIT_FAILURE); } odp_pool_print(pool); @@ -728,7 +724,7 @@ int main(int argc, char *argv[]) uint16_t group = i % num_groups;
if (pkt == ODP_PACKET_INVALID) { - LOG_ERR("Error: odp_packet_alloc() failed\n"); + ODPH_ERR("Error: odp_packet_alloc() failed\n"); return -1; }
@@ -740,7 +736,7 @@ int main(int argc, char *argv[])
ev = odp_packet_to_event(pkt); if (odp_queue_enq(queue, ev)) { - LOG_ERR("Error: odp_queue_enq() failed\n"); + ODPH_ERR("Error: odp_queue_enq() failed\n"); return -1; } } @@ -796,7 +792,7 @@ int main(int argc, char *argv[]) for (i = 0; i < num_groups; i++) { for (j = 0; j < QUEUES_PER_GROUP; j++) { if (odp_queue_destroy(gbl_args->queue[i][j])) { - LOG_ERR("Error: queue destroy\n"); + ODPH_ERR("Error: queue destroy\n"); exit(EXIT_FAILURE); } } @@ -805,27 +801,27 @@ int main(int argc, char *argv[]) odp_mb_full();
if (odp_pool_destroy(pool)) { - LOG_ERR("Error: pool destroy\n"); + ODPH_ERR("Error: pool destroy\n"); exit(EXIT_FAILURE); }
if (odp_shm_free(shm)) { - LOG_ERR("Error: shm free\n"); + ODPH_ERR("Error: shm free\n"); exit(EXIT_FAILURE); }
if (odp_shm_free(lookup_tbl_shm)) { - LOG_ERR("Error: shm free\n"); + ODPH_ERR("Error: shm free\n"); exit(EXIT_FAILURE); }
if (odp_term_local()) { - LOG_ERR("Error: term local\n"); + ODPH_ERR("Error: term local\n"); exit(EXIT_FAILURE); }
if (odp_term_global(instance)) { - LOG_ERR("Error: term global\n"); + ODPH_ERR("Error: term global\n"); exit(EXIT_FAILURE); }
diff --git a/test/performance/odp_l2fwd.c b/test/performance/odp_l2fwd.c index bfcd5c189..07777b8ec 100644 --- a/test/performance/odp_l2fwd.c +++ b/test/performance/odp_l2fwd.c @@ -5,8 +5,6 @@ * SPDX-License-Identifier: BSD-3-Clause */
-#include "config.h" - /* enable strtok */ #ifndef _GNU_SOURCE #define _GNU_SOURCE @@ -19,8 +17,6 @@ #include <inttypes.h> #include <signal.h>
-#include <test_debug.h> - #include <odp_api.h> #include <odp/helper/odph_api.h>
@@ -262,7 +258,7 @@ static inline int event_queue_send(odp_queue_t queue, odp_packet_t *pkt_tbl, ret = odp_queue_enq_multi(queue, &ev_tbl[sent], pkts - sent);
if (ret < 0) { - LOG_ERR("Failed to send packet as events\n"); + ODPH_ERR("Failed to send packet as events\n"); break; }
@@ -317,7 +313,7 @@ static int run_worker_sched_mode(void *arg) for (i = 0; i < thr_args->num_groups; i++) { if (odp_schedule_group_join(thr_args->group[i], &mask)) { - LOG_ERR("Join failed\n"); + ODPH_ERR("Join failed\n"); return -1; } } @@ -326,7 +322,7 @@ static int run_worker_sched_mode(void *arg) num_pktio = thr_args->num_pktio;
if (num_pktio > MAX_PKTIOS) { - LOG_ERR("Too many pktios %i\n", num_pktio); + ODPH_ERR("Too many pktios %i\n", num_pktio); return -1; }
@@ -694,12 +690,12 @@ static int create_pktio(const char *dev, int idx, int num_rx, int num_tx,
pktio = odp_pktio_open(dev, pool, &pktio_param); if (pktio == ODP_PKTIO_INVALID) { - LOG_ERR("Error: failed to open %s\n", dev); + ODPH_ERR("Error: failed to open %s\n", dev); return -1; }
if (odp_pktio_info(pktio, &info)) { - LOG_ERR("Error: pktio info failed %s\n", dev); + ODPH_ERR("Error: pktio info failed %s\n", dev); return -1; }
@@ -710,7 +706,7 @@ static int create_pktio(const char *dev, int idx, int num_rx, int num_tx, odp_pktio_print(pktio);
if (odp_pktio_capability(pktio, &pktio_capa)) { - LOG_ERR("Error: pktio capability query failed %s\n", dev); + ODPH_ERR("Error: pktio capability query failed %s\n", dev); return -1; }
@@ -772,28 +768,27 @@ static int create_pktio(const char *dev, int idx, int num_rx, int num_tx, pktout_param.num_queues = num_tx;
if (odp_pktin_queue_config(pktio, &pktin_param)) { - LOG_ERR("Error: input queue config failed %s\n", dev); + ODPH_ERR("Error: input queue config failed %s\n", dev); return -1; }
if (odp_pktout_queue_config(pktio, &pktout_param)) { - LOG_ERR("Error: output queue config failed %s\n", dev); + ODPH_ERR("Error: output queue config failed %s\n", dev); return -1; }
if (gbl_args->appl.in_mode == DIRECT_RECV) { if (odp_pktin_queue(pktio, gbl_args->pktios[idx].pktin, num_rx) != num_rx) { - LOG_ERR("Error: pktin queue query failed %s\n", - dev); + ODPH_ERR("Error: pktin queue query failed %s\n", dev); return -1; } } else { if (odp_pktin_event_queue(pktio, gbl_args->pktios[idx].rx_q, num_rx) != num_rx) { - LOG_ERR("Error: pktin event queue query failed %s\n", - dev); + ODPH_ERR("Error: pktin event queue query failed %s\n", + dev); return -1; } } @@ -802,14 +797,14 @@ static int create_pktio(const char *dev, int idx, int num_rx, int num_tx, if (odp_pktout_queue(pktio, gbl_args->pktios[idx].pktout, num_tx) != num_tx) { - LOG_ERR("Error: pktout queue query failed %s\n", dev); + ODPH_ERR("Error: pktout queue query failed %s\n", dev); return -1; } } else { if (odp_pktout_event_queue(pktio, gbl_args->pktios[idx].tx_q, num_tx) != num_tx) { - LOG_ERR("Error: event queue query failed %s\n", dev); + ODPH_ERR("Error: event queue query failed %s\n", dev); return -1; } } @@ -1096,7 +1091,7 @@ static void init_port_lookup_tbl(void) int dst_port = find_dest_port(rx_idx);
if (pktio_idx < 0 || pktio_idx >= MAX_PKTIO_INDEXES) { - LOG_ERR("Bad pktio index %i\n", pktio_idx); + ODPH_ERR("Bad pktio index %i\n", pktio_idx); exit(EXIT_FAILURE); }
@@ -1442,7 +1437,7 @@ static void create_groups(int num, odp_schedule_group_t *group) group[i] = odp_schedule_group_create(NULL, &zero);
if (group[i] == ODP_SCHED_GROUP_INVALID) { - LOG_ERR("Group create failed\n"); + ODPH_ERR("Group create failed\n"); exit(EXIT_FAILURE); } } @@ -1478,7 +1473,7 @@ int main(int argc, char *argv[]) /* Let helper collect its own arguments (e.g. --odph_proc) */ argc = odph_parse_options(argc, argv); if (odph_options(&helper_options)) { - LOG_ERR("Error: reading ODP helper options failed.\n"); + ODPH_ERR("Error: reading ODP helper options failed.\n"); exit(EXIT_FAILURE); }
@@ -1499,13 +1494,13 @@ int main(int argc, char *argv[])
/* Init ODP before calling anything else */ if (odp_init_global(&instance, &init, NULL)) { - LOG_ERR("Error: ODP global init failed.\n"); + ODPH_ERR("Error: ODP global init failed.\n"); exit(EXIT_FAILURE); }
/* Init this thread */ if (odp_init_local(instance, ODP_THREAD_CONTROL)) { - LOG_ERR("Error: ODP local init failed.\n"); + ODPH_ERR("Error: ODP local init failed.\n"); exit(EXIT_FAILURE); }
@@ -1514,14 +1509,14 @@ int main(int argc, char *argv[]) ODP_CACHE_LINE_SIZE, 0);
if (shm == ODP_SHM_INVALID) { - LOG_ERR("Error: shared mem reserve failed.\n"); + ODPH_ERR("Error: shared mem reserve failed.\n"); exit(EXIT_FAILURE); }
gbl_args = odp_shm_addr(shm);
if (gbl_args == NULL) { - LOG_ERR("Error: shared mem alloc failed.\n"); + ODPH_ERR("Error: shared mem alloc failed.\n"); exit(EXIT_FAILURE); } gbl_args_init(gbl_args); @@ -1562,13 +1557,13 @@ int main(int argc, char *argv[]) printf("\n");
if (num_groups > if_count || num_groups > num_workers) { - LOG_ERR("Too many groups. Number of groups may not exceed " - "number of interfaces or workers.\n"); + ODPH_ERR("Too many groups. Number of groups may not exceed " + "number of interfaces or workers.\n"); exit(EXIT_FAILURE); }
if (odp_pool_capability(&pool_capa)) { - LOG_ERR("Error: pool capability failed\n"); + ODPH_ERR("Error: pool capability failed\n"); return -1; }
@@ -1591,14 +1586,14 @@ int main(int argc, char *argv[]) pool = odp_pool_create("packet pool", ¶ms);
if (pool == ODP_POOL_INVALID) { - LOG_ERR("Error: packet pool create failed.\n"); + ODPH_ERR("Error: packet pool create failed.\n"); exit(EXIT_FAILURE); } odp_pool_print(pool);
if (odp_pktio_max_index() >= MAX_PKTIO_INDEXES) - LOG_DBG("Warning: max pktio index (%u) is too large\n", - odp_pktio_max_index()); + ODPH_DBG("Warning: max pktio index (%u) is too large\n", + odp_pktio_max_index());
bind_workers();
@@ -1637,7 +1632,7 @@ int main(int argc, char *argv[]) if (odp_pktio_mac_addr(gbl_args->pktios[i].pktio, gbl_args->port_eth_addr[i].addr, ODPH_ETHADDR_LEN) != ODPH_ETHADDR_LEN) { - LOG_ERR("Error: interface ethernet address unknown\n"); + ODPH_ERR("Error: interface ethernet address unknown\n"); exit(EXIT_FAILURE); }
@@ -1701,7 +1696,7 @@ int main(int argc, char *argv[]) thr_param, num_workers);
if (num_thr != num_workers) { - LOG_ERR("Error: worker create failed %i\n", num_thr); + ODPH_ERR("Error: worker create failed %i\n", num_thr); exit(EXIT_FAILURE); }
@@ -1712,8 +1707,8 @@ int main(int argc, char *argv[]) pktio = gbl_args->pktios[i].pktio; ret = odp_pktio_start(pktio); if (ret) { - LOG_ERR("Error: unable to start %s\n", - gbl_args->appl.if_names[i]); + ODPH_ERR("Error: unable to start %s\n", + gbl_args->appl.if_names[i]); exit(EXIT_FAILURE); } } @@ -1723,8 +1718,8 @@ int main(int argc, char *argv[])
for (i = 0; i < if_count; ++i) { if (odp_pktio_stop(gbl_args->pktios[i].pktio)) { - LOG_ERR("Error: unable to stop %s\n", - gbl_args->appl.if_names[i]); + ODPH_ERR("Error: unable to stop %s\n", + gbl_args->appl.if_names[i]); exit(EXIT_FAILURE); } } @@ -1736,14 +1731,14 @@ int main(int argc, char *argv[]) /* Master thread waits for other threads to exit */ num_thr = odph_thread_join(gbl_args->thread_tbl, num_workers); if (num_thr != num_workers) { - LOG_ERR("Error: worker join failed %i\n", num_thr); - exit(EXIT_FAILURE); + ODPH_ERR("Error: worker join failed %i\n", num_thr); + exit(EXIT_FAILURE); }
for (i = 0; i < if_count; ++i) { if (odp_pktio_close(gbl_args->pktios[i].pktio)) { - LOG_ERR("Error: unable to close %s\n", - gbl_args->appl.if_names[i]); + ODPH_ERR("Error: unable to close %s\n", + gbl_args->appl.if_names[i]); exit(EXIT_FAILURE); } } @@ -1754,22 +1749,22 @@ int main(int argc, char *argv[]) odp_mb_full();
if (odp_pool_destroy(pool)) { - LOG_ERR("Error: pool destroy\n"); + ODPH_ERR("Error: pool destroy\n"); exit(EXIT_FAILURE); }
if (odp_shm_free(shm)) { - LOG_ERR("Error: shm free\n"); + ODPH_ERR("Error: shm free\n"); exit(EXIT_FAILURE); }
if (odp_term_local()) { - LOG_ERR("Error: term local\n"); + ODPH_ERR("Error: term local\n"); exit(EXIT_FAILURE); }
if (odp_term_global(instance)) { - LOG_ERR("Error: term global\n"); + ODPH_ERR("Error: term global\n"); exit(EXIT_FAILURE); }
diff --git a/test/performance/odp_pktio_ordered.c b/test/performance/odp_pktio_ordered.c index e7383d873..4ac6060b7 100644 --- a/test/performance/odp_pktio_ordered.c +++ b/test/performance/odp_pktio_ordered.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */
-#include "config.h" - /** * @file * @@ -23,14 +21,10 @@ #include <errno.h> #include <inttypes.h>
-#include <test_debug.h> #include "dummy_crc.h"
#include <odp_api.h> -#include <odp/helper/threads.h> -#include <odp/helper/eth.h> -#include <odp/helper/ip.h> -#include <odp/helper/udp.h> +#include <odp/helper/odph_api.h>
/** Jenkins hash support. * @@ -275,7 +269,7 @@ static inline int lookup_dest_port(odp_packet_t pkt) src_idx = i;
if (src_idx == -1) - LOG_ABORT("Failed to determine pktio input\n"); + ODPH_ABORT("Failed to determine pktio input\n");
return gbl_args->dst_port[src_idx]; } @@ -503,7 +497,7 @@ static inline void process_input(odp_event_t ev_tbl[], int num, stats_t *stats, ev_tbl[i]);
if (odp_unlikely(ret != 0)) { - LOG_ERR("odp_queue_enq() failed\n"); + ODPH_ERR("odp_queue_enq() failed\n"); stats->s.tx_drops++; odp_event_free(ev_tbl[i]); } else { @@ -600,7 +594,7 @@ static int create_pktio(const char *dev, int idx, int num_rx, int num_tx,
pktio = odp_pktio_open(dev, pool, &pktio_param); if (pktio == ODP_PKTIO_INVALID) { - LOG_ERR("Error: failed to open %s\n", dev); + ODPH_ERR("Error: failed to open %s\n", dev); return -1; }
@@ -608,7 +602,7 @@ static int create_pktio(const char *dev, int idx, int num_rx, int num_tx, odp_pktio_to_u64(pktio), dev);
if (odp_pktio_capability(pktio, &capa)) { - LOG_ERR("Error: capability query failed %s\n", dev); + ODPH_ERR("Error: capability query failed %s\n", dev); odp_pktio_close(pktio); return -1; } @@ -657,19 +651,18 @@ static int create_pktio(const char *dev, int idx, int num_rx, int num_tx, pktout_param.num_queues = num_tx;
if (odp_pktin_queue_config(pktio, &pktin_param)) { - LOG_ERR("Error: input queue config failed %s\n", dev); + ODPH_ERR("Error: input queue config failed %s\n", dev); return -1; }
if (odp_pktout_queue_config(pktio, &pktout_param)) { - LOG_ERR("Error: output queue config failed %s\n", dev); + ODPH_ERR("Error: output queue config failed %s\n", dev); return -1; }
if (odp_pktin_event_queue(pktio, gbl_args->pktios[idx].pktin, num_rx) != num_rx) { - LOG_ERR("Error: pktin event queue query failed %s\n", - dev); + ODPH_ERR("Error: pktin event queue query failed %s\n", dev); return -1; }
@@ -681,8 +674,8 @@ static int create_pktio(const char *dev, int idx, int num_rx, int num_tx, if (odp_queue_context_set(gbl_args->pktios[idx].pktin[i], &gbl_args->input_qcontext[idx][i], sizeof(qcontext_t))) { - LOG_ERR("Error: pktin queue context set failed %s\n", - dev); + ODPH_ERR("Error: pktin queue context set failed %s\n", + dev); return -1; } } @@ -690,7 +683,7 @@ static int create_pktio(const char *dev, int idx, int num_rx, int num_tx, if (odp_pktout_queue(pktio, gbl_args->pktios[idx].pktout, num_tx) != num_tx) { - LOG_ERR("Error: pktout queue query failed %s\n", dev); + ODPH_ERR("Error: pktout queue query failed %s\n", dev); return -1; }
@@ -1080,7 +1073,7 @@ int main(int argc, char *argv[]) /* Let helper collect its own arguments (e.g. --odph_proc) */ argc = odph_parse_options(argc, argv); if (odph_options(&helper_options)) { - LOG_ERR("Error: reading ODP helper options failed.\n"); + ODPH_ERR("Error: reading ODP helper options failed.\n"); exit(EXIT_FAILURE); }
@@ -1089,13 +1082,13 @@ int main(int argc, char *argv[])
/* Init ODP before calling anything else */ if (odp_init_global(&instance, &init_param, NULL)) { - LOG_ERR("Error: ODP global init failed.\n"); + ODPH_ERR("Error: ODP global init failed.\n"); exit(EXIT_FAILURE); }
/* Init this thread */ if (odp_init_local(instance, ODP_THREAD_CONTROL)) { - LOG_ERR("Error: ODP local init failed.\n"); + ODPH_ERR("Error: ODP local init failed.\n"); exit(EXIT_FAILURE); }
@@ -1105,7 +1098,7 @@ int main(int argc, char *argv[]) }
if (odp_pool_capability(&pool_capa)) { - LOG_ERR("Error: Pool capa failed\n"); + ODPH_ERR("Error: Pool capa failed\n"); exit(EXIT_FAILURE); }
@@ -1114,14 +1107,14 @@ int main(int argc, char *argv[]) ODP_CACHE_LINE_SIZE, 0);
if (shm == ODP_SHM_INVALID) { - LOG_ERR("Error: shared mem reserve failed.\n"); + ODPH_ERR("Error: shared mem reserve failed.\n"); exit(EXIT_FAILURE); }
gbl_args = odp_shm_addr(shm);
if (gbl_args == NULL) { - LOG_ERR("Error: shared mem alloc failed.\n"); + ODPH_ERR("Error: shared mem alloc failed.\n"); odp_shm_free(shm); exit(EXIT_FAILURE); } @@ -1136,7 +1129,7 @@ int main(int argc, char *argv[]) if (gbl_args->appl.in_mode == SCHED_ORDERED) { /* At least one ordered lock required */ if (schedule_capa.max_ordered_locks < 1) { - LOG_ERR("Error: Ordered locks not available.\n"); + ODPH_ERR("Error: Ordered locks not available.\n"); exit(EXIT_FAILURE); } } @@ -1182,7 +1175,7 @@ int main(int argc, char *argv[]) pool = odp_pool_create("packet pool", ¶ms);
if (pool == ODP_POOL_INVALID) { - LOG_ERR("Error: packet pool create failed.\n"); + ODPH_ERR("Error: packet pool create failed.\n"); exit(EXIT_FAILURE); } odp_pool_print(pool); @@ -1203,7 +1196,7 @@ int main(int argc, char *argv[]) if (odp_pktio_mac_addr(gbl_args->pktios[i].pktio, gbl_args->port_eth_addr[i].addr, ODPH_ETHADDR_LEN) != ODPH_ETHADDR_LEN) { - LOG_ERR("Error: interface ethernet address unknown\n"); + ODPH_ERR("Error: interface ethernet address unknown\n"); exit(EXIT_FAILURE); }
@@ -1229,7 +1222,7 @@ int main(int argc, char *argv[]) odp_pktio_capability_t capa;
if (odp_pktio_capability(gbl_args->pktios[i].pktio, &capa)) { - LOG_ERR("Error: pktio capability failed.\n"); + ODPH_ERR("Error: pktio capability failed.\n"); exit(EXIT_FAILURE); }
@@ -1260,7 +1253,7 @@ int main(int argc, char *argv[])
queue = odp_queue_create(qname, &qparam); if (queue == ODP_QUEUE_INVALID) { - LOG_ERR("Error: flow queue create failed.\n"); + ODPH_ERR("Error: flow queue create failed.\n"); exit(EXIT_FAILURE); }
@@ -1314,8 +1307,8 @@ int main(int argc, char *argv[]) pktio = gbl_args->pktios[i].pktio; ret = odp_pktio_start(pktio); if (ret) { - LOG_ERR("Error: unable to start %s\n", - gbl_args->appl.if_names[i]); + ODPH_ERR("Error: unable to start %s\n", + gbl_args->appl.if_names[i]); exit(EXIT_FAILURE); } } @@ -1344,22 +1337,22 @@ int main(int argc, char *argv[]) free(gbl_args->appl.if_str);
if (odp_pool_destroy(pool)) { - LOG_ERR("Error: pool destroy\n"); + ODPH_ERR("Error: pool destroy\n"); exit(EXIT_FAILURE); }
if (odp_shm_free(shm)) { - LOG_ERR("Error: shm free\n"); + ODPH_ERR("Error: shm free\n"); exit(EXIT_FAILURE); }
if (odp_term_local()) { - LOG_ERR("Error: term local\n"); + ODPH_ERR("Error: term local\n"); exit(EXIT_FAILURE); }
if (odp_term_global(instance)) { - LOG_ERR("Error: term global\n"); + ODPH_ERR("Error: term global\n"); exit(EXIT_FAILURE); }
diff --git a/test/performance/odp_pktio_perf.c b/test/performance/odp_pktio_perf.c index 55e905664..f31f6146c 100644 --- a/test/performance/odp_pktio_perf.c +++ b/test/performance/odp_pktio_perf.c @@ -21,8 +21,6 @@ * */
-#include "config.h" - #include <odp_api.h>
#include <odp/helper/odph_api.h> @@ -32,7 +30,6 @@ #include <stdio.h> #include <string.h> #include <inttypes.h> -#include <test_debug.h>
#define TEST_SKIP 77
@@ -223,7 +220,7 @@ static odp_packet_t pktio_create_packet(uint32_t seq) pkt_hdr.magic = TEST_HDR_MAGIC; if (odp_packet_copy_from_mem(pkt, offset, sizeof(pkt_hdr), &pkt_hdr) != 0) - LOG_ABORT("Failed to generate test packet.\n"); + ODPH_ABORT("Failed to generate test packet.\n");
return pkt; } @@ -326,7 +323,8 @@ static int run_thread_tx(void *arg) stats = &globals->tx_stats[thr_id];
if (odp_pktout_queue(globals->pktio_tx, &pktout, 1) != 1) - LOG_ABORT("Failed to get output queue for thread %d\n", thr_id); + ODPH_ABORT("Failed to get output queue for thread %d\n", + thr_id);
burst_gap = odp_time_local_from_ns( ODP_TIME_SEC_IN_NS / (targs->pps / targs->batch_len)); @@ -430,7 +428,7 @@ static int run_thread_rx(void *arg)
if (gbl_args->args.schedule == 0) { if (odp_pktin_event_queue(globals->pktio_rx, &queue, 1) != 1) - LOG_ABORT("No input queue.\n"); + ODPH_ABORT("No input queue.\n"); }
odp_barrier_wait(&globals->rx_barrier); @@ -480,7 +478,7 @@ static int process_results(uint64_t expected_tx_cnt, }
if (rx_pkts == 0) { - LOG_ERR("no packets received\n"); + ODPH_ERR("no packets received\n"); return -1; }
@@ -554,19 +552,19 @@ static int setup_txrx_masks(odp_cpumask_t *thd_mask_tx, odp_cpumask_default_worker(&cpumask, gbl_args->args.cpu_count); if (num_workers < 2) { - LOG_ERR("Need at least two cores\n"); + ODPH_ERR("Need at least two cores\n"); return TEST_SKIP; }
if (num_workers > MAX_WORKERS) { - LOG_DBG("Worker count limited to MAX_WORKERS define (=%d)\n", - MAX_WORKERS); + ODPH_DBG("Worker count limited to MAX_WORKERS define (=%d)\n", + MAX_WORKERS); num_workers = MAX_WORKERS; }
if (gbl_args->args.num_tx_workers) { if (gbl_args->args.num_tx_workers > (num_workers - 1)) { - LOG_ERR("Invalid TX worker count\n"); + ODPH_ERR("Invalid TX worker count\n"); return -1; } num_tx_workers = gbl_args->args.num_tx_workers; @@ -751,7 +749,7 @@ static int test_init(void) gbl_args->transmit_pkt_pool = odp_pool_create("pkt_pool_transmit", ¶ms); if (gbl_args->transmit_pkt_pool == ODP_POOL_INVALID) - LOG_ABORT("Failed to create transmit pool\n"); + ODPH_ABORT("Failed to create transmit pool\n");
odp_atomic_init_u32(&gbl_args->ip_seq, 0); odp_atomic_init_u32(&gbl_args->shutdown, 0); @@ -778,19 +776,19 @@ static int test_init(void)
if (gbl_args->pktio_rx == ODP_PKTIO_INVALID || gbl_args->pktio_tx == ODP_PKTIO_INVALID) { - LOG_ERR("failed to open pktio\n"); + ODPH_ERR("failed to open pktio\n"); return -1; }
/* Create single queue with default parameters */ if (odp_pktout_queue_config(gbl_args->pktio_tx, NULL)) { - LOG_ERR("failed to configure pktio_tx queue\n"); + ODPH_ERR("failed to configure pktio_tx queue\n"); return -1; }
/* Configure also input side (with defaults) */ if (odp_pktin_queue_config(gbl_args->pktio_tx, NULL)) { - LOG_ERR("failed to configure pktio_tx queue\n"); + ODPH_ERR("failed to configure pktio_tx queue\n"); return -1; }
@@ -803,12 +801,12 @@ static int test_init(void)
if (gbl_args->args.num_ifaces > 1) { if (odp_pktout_queue_config(gbl_args->pktio_rx, NULL)) { - LOG_ERR("failed to configure pktio_rx queue\n"); + ODPH_ERR("failed to configure pktio_rx queue\n"); return -1; }
if (odp_pktin_queue_config(gbl_args->pktio_rx, NULL)) { - LOG_ERR("failed to configure pktio_rx queue\n"); + ODPH_ERR("failed to configure pktio_rx queue\n"); return -1; } } @@ -858,12 +856,12 @@ static int test_term(void)
if (gbl_args->pktio_tx != gbl_args->pktio_rx) { if (odp_pktio_stop(gbl_args->pktio_tx)) { - LOG_ERR("Failed to stop pktio_tx\n"); + ODPH_ERR("Failed to stop pktio_tx\n"); return -1; }
if (odp_pktio_close(gbl_args->pktio_tx)) { - LOG_ERR("Failed to close pktio_tx\n"); + ODPH_ERR("Failed to close pktio_tx\n"); ret = -1; } } @@ -871,12 +869,12 @@ static int test_term(void) empty_inq(gbl_args->pktio_rx);
if (odp_pktio_stop(gbl_args->pktio_rx)) { - LOG_ERR("Failed to stop pktio_rx\n"); + ODPH_ERR("Failed to stop pktio_rx\n"); return -1; }
if (odp_pktio_close(gbl_args->pktio_rx) != 0) { - LOG_ERR("Failed to close pktio_rx\n"); + ODPH_ERR("Failed to close pktio_rx\n"); ret = -1; }
@@ -888,28 +886,28 @@ static int test_term(void) continue;
if (odp_pool_destroy(pool) != 0) { - LOG_ERR("Failed to destroy pool %s\n", pool_name); + ODPH_ERR("Failed to destroy pool %s\n", pool_name); ret = -1; } }
if (odp_pool_destroy(gbl_args->transmit_pkt_pool) != 0) { - LOG_ERR("Failed to destroy transmit pool\n"); + ODPH_ERR("Failed to destroy transmit pool\n"); ret = -1; }
free(gbl_args->args.if_str);
if (odp_shm_free(odp_shm_lookup("test_globals")) != 0) { - LOG_ERR("Failed to free test_globals\n"); + ODPH_ERR("Failed to free test_globals\n"); ret = -1; } if (odp_shm_free(odp_shm_lookup("test_globals.rx_stats")) != 0) { - LOG_ERR("Failed to free test_globals.rx_stats\n"); + ODPH_ERR("Failed to free test_globals.rx_stats\n"); ret = -1; } if (odp_shm_free(odp_shm_lookup("test_globals.tx_stats")) != 0) { - LOG_ERR("Failed to free test_globals.tx_stats\n"); + ODPH_ERR("Failed to free test_globals.tx_stats\n"); ret = -1; }
@@ -1002,7 +1000,7 @@ static void parse_args(int argc, char *argv[], test_args_t *args) args->if_str = malloc(strlen(optarg) + 1);
if (!args->if_str) - LOG_ABORT("Failed to alloc iface storage\n"); + ODPH_ABORT("Failed to alloc iface storage\n");
strcpy(args->if_str, optarg); for (token = strtok(args->if_str, ","); @@ -1047,7 +1045,7 @@ int main(int argc, char **argv) /* Let helper collect its own arguments (e.g. --odph_proc) */ argc = odph_parse_options(argc, argv); if (odph_options(&helper_options)) { - LOG_ERR("Error: reading ODP helper options failed.\n"); + ODPH_ERR("Error: reading ODP helper options failed.\n"); exit(EXIT_FAILURE); }
@@ -1055,19 +1053,19 @@ int main(int argc, char **argv) init_param.mem_model = helper_options.mem_model;
if (odp_init_global(&instance, &init_param, NULL) != 0) - LOG_ABORT("Failed global init.\n"); + ODPH_ABORT("Failed global init.\n");
if (odp_init_local(instance, ODP_THREAD_CONTROL) != 0) - LOG_ABORT("Failed local init.\n"); + ODPH_ABORT("Failed local init.\n");
shm = odp_shm_reserve("test_globals", sizeof(test_globals_t), ODP_CACHE_LINE_SIZE, 0); if (shm == ODP_SHM_INVALID) - LOG_ABORT("Shared memory reserve failed.\n"); + ODPH_ABORT("Shared memory reserve failed.\n");
gbl_args = odp_shm_addr(shm); if (gbl_args == NULL) - LOG_ABORT("Shared memory reserve failed.\n"); + ODPH_ABORT("Shared memory reserve failed.\n"); memset(gbl_args, 0, sizeof(test_globals_t));
max_thrs = odp_thread_count_max(); @@ -1080,12 +1078,12 @@ int main(int argc, char **argv) gbl_args->rx_stats_size, ODP_CACHE_LINE_SIZE, 0); if (shm == ODP_SHM_INVALID) - LOG_ABORT("Shared memory reserve failed.\n"); + ODPH_ABORT("Shared memory reserve failed.\n");
gbl_args->rx_stats = odp_shm_addr(shm);
if (gbl_args->rx_stats == NULL) - LOG_ABORT("Shared memory reserve failed.\n"); + ODPH_ABORT("Shared memory reserve failed.\n");
memset(gbl_args->rx_stats, 0, gbl_args->rx_stats_size);
@@ -1093,12 +1091,12 @@ int main(int argc, char **argv) gbl_args->tx_stats_size, ODP_CACHE_LINE_SIZE, 0); if (shm == ODP_SHM_INVALID) - LOG_ABORT("Shared memory reserve failed.\n"); + ODPH_ABORT("Shared memory reserve failed.\n");
gbl_args->tx_stats = odp_shm_addr(shm);
if (gbl_args->tx_stats == NULL) - LOG_ABORT("Shared memory reserve failed.\n"); + ODPH_ABORT("Shared memory reserve failed.\n");
memset(gbl_args->tx_stats, 0, gbl_args->tx_stats_size);
diff --git a/test/performance/odp_sched_latency.c b/test/performance/odp_sched_latency.c index ee5d0f417..2bdc4b356 100644 --- a/test/performance/odp_sched_latency.c +++ b/test/performance/odp_sched_latency.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */
-#include "config.h" - /** * @file * @@ -16,8 +14,6 @@ #include <stdlib.h> #include <inttypes.h>
-#include <test_debug.h> - /* ODP main header */ #include <odp_api.h>
@@ -128,7 +124,7 @@ static void clear_sched_queues(test_globals_t *globals) /* Allocate the cool_down event. */ buf = odp_buffer_alloc(globals->pool); if (buf == ODP_BUFFER_INVALID) - LOG_ABORT("Buffer alloc failed.\n"); + ODPH_ABORT("Buffer alloc failed.\n");
event = odp_buffer_addr(buf); event->type = COOL_DOWN; @@ -138,7 +134,7 @@ static void clear_sched_queues(test_globals_t *globals) for (j = 0; j < globals->args.prio[i].queues; j++) { /* Enqueue cool_down event on each queue. */ if (odp_queue_enq(globals->queue[i][j], ev)) - LOG_ABORT("Queue enqueue failed.\n"); + ODPH_ABORT("Queue enqueue failed.\n");
/* Invoke scheduler until cool_down event has been * received. */ @@ -159,8 +155,8 @@ static void clear_sched_queues(test_globals_t *globals) /* Call odp_schedule() to trigger a release of any scheduler context. */ ev = odp_schedule(&fromq, ODP_SCHED_NO_WAIT); if (ev != ODP_EVENT_INVALID) - LOG_ABORT("Queue %" PRIu64 " not empty.\n", - odp_queue_to_u64(fromq)); + ODPH_ABORT("Queue %" PRIu64 " not empty.\n", + odp_queue_to_u64(fromq)); }
/** @@ -206,14 +202,14 @@ static int enqueue_events(int prio, int num_queues, int num_events, ret = odp_buffer_alloc_multi(globals->pool, buf, events_per_queue); if (ret != events_per_queue) { - LOG_ERR("Buffer alloc failed. Try increasing EVENT_POOL_SIZE.\n"); + ODPH_ERR("Buffer alloc failed. Try increasing EVENT_POOL_SIZE.\n"); ret = ret < 0 ? 0 : ret; odp_buffer_free_multi(buf, ret); return -1; } for (j = 0; j < events_per_queue; j++) { if (!odp_buffer_is_valid(buf[j])) { - LOG_ERR("Buffer alloc failed\n"); + ODPH_ERR("Buffer alloc failed\n"); odp_buffer_free_multi(buf, events_per_queue); return -1; } @@ -240,7 +236,7 @@ static int enqueue_events(int prio, int num_queues, int num_events, events_per_queue - enq_events); if (ret < 0) { - LOG_ERR("Queue enqueue failed.\n"); + ODPH_ERR("Queue enqueue failed.\n"); return -1; } enq_events += ret; @@ -403,7 +399,7 @@ static int test_schedule(int thr, test_globals_t *globals) event->ts = odp_time_to_ns(odp_time_global());
if (odp_queue_enq(dst_queue, ev)) { - LOG_ERR("[%i] Queue enqueue failed.\n", thr); + ODPH_ERR("[%i] Queue enqueue failed.\n", thr); odp_event_free(ev); return -1; } @@ -419,7 +415,7 @@ static int test_schedule(int thr, test_globals_t *globals) break;
if (odp_queue_enq(src_queue, ev)) { - LOG_ERR("[%i] Queue enqueue failed.\n", thr); + ODPH_ERR("[%i] Queue enqueue failed.\n", thr); odp_event_free(ev); return -1; } @@ -458,7 +454,7 @@ static int run_thread(void *arg ODP_UNUSED) globals = odp_shm_addr(shm);
if (globals == NULL) { - LOG_ERR("Shared mem lookup failed\n"); + ODPH_ERR("Shared mem lookup failed\n"); return -1; }
@@ -655,7 +651,7 @@ int main(int argc, char *argv[]) /* Let helper collect its own arguments (e.g. --odph_proc) */ argc = odph_parse_options(argc, argv); if (odph_options(&helper_options)) { - LOG_ERR("Error: reading ODP helper options failed.\n"); + ODPH_ERR("Error: reading ODP helper options failed.\n"); exit(EXIT_FAILURE); }
@@ -667,7 +663,7 @@ int main(int argc, char *argv[])
/* ODP global init */ if (odp_init_global(&instance, &init_param, NULL)) { - LOG_ERR("ODP global init failed.\n"); + ODPH_ERR("ODP global init failed.\n"); return -1; }
@@ -676,7 +672,7 @@ int main(int argc, char *argv[]) * setting up resources for worker threads. */ if (odp_init_local(instance, ODP_THREAD_CONTROL)) { - LOG_ERR("ODP global init failed.\n"); + ODPH_ERR("ODP global init failed.\n"); return -1; }
@@ -698,14 +694,14 @@ int main(int argc, char *argv[])
thread_tbl = calloc(sizeof(odph_odpthread_t), num_workers); if (!thread_tbl) { - LOG_ERR("no memory for thread_tbl\n"); + ODPH_ERR("no memory for thread_tbl\n"); return -1; }
shm = odp_shm_reserve("test_globals", sizeof(test_globals_t), ODP_CACHE_LINE_SIZE, 0); if (shm == ODP_SHM_INVALID) { - LOG_ERR("Shared memory reserve failed.\n"); + ODPH_ERR("Shared memory reserve failed.\n"); return -1; }
@@ -719,7 +715,7 @@ int main(int argc, char *argv[]) * Create event pool */ if (odp_pool_capability(&pool_capa)) { - LOG_ERR("pool capa failed\n"); + ODPH_ERR("pool capa failed\n"); return -1; }
@@ -736,7 +732,7 @@ int main(int argc, char *argv[]) pool = odp_pool_create("event_pool", ¶ms);
if (pool == ODP_POOL_INVALID) { - LOG_ERR("Pool create failed.\n"); + ODPH_ERR("Pool create failed.\n"); return -1; } globals->pool = pool; @@ -771,7 +767,7 @@ int main(int argc, char *argv[]) queue = odp_queue_create(name, ¶m);
if (queue == ODP_QUEUE_INVALID) { - LOG_ERR("Scheduled queue create failed.\n"); + ODPH_ERR("Scheduled queue create failed.\n"); return -1; }
diff --git a/test/performance/odp_scheduling.c b/test/performance/odp_scheduling.c index e44e196c3..76d767220 100644 --- a/test/performance/odp_scheduling.c +++ b/test/performance/odp_scheduling.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */
-#include "config.h" - /** * @file * @@ -16,8 +14,6 @@ #include <stdlib.h> #include <inttypes.h>
-#include <test_debug.h> - /* ODP main header */ #include <odp_api.h>
@@ -150,14 +146,14 @@ static int enqueue_events(int thr, int prio, int num_queues, int num_events,
ret = odp_buffer_alloc_multi(globals->pool, buf, num_events); if (ret != num_events) { - LOG_ERR(" [%i] buffer alloc failed\n", thr); + ODPH_ERR(" [%i] buffer alloc failed\n", thr); ret = ret < 0 ? 0 : ret; odp_buffer_free_multi(buf, ret); return -1; } for (k = 0; k < num_events; k++) { if (!odp_buffer_is_valid(buf[k])) { - LOG_ERR(" [%i] buffer alloc failed\n", thr); + ODPH_ERR(" [%i] buffer alloc failed\n", thr); odp_buffer_free_multi(buf, num_events); return -1; } @@ -166,7 +162,7 @@ static int enqueue_events(int thr, int prio, int num_queues, int num_events,
ret = odp_queue_enq_multi(queue, ev, num_events); if (ret != num_events) { - LOG_ERR(" [%i] Queue enqueue failed.\n", thr); + ODPH_ERR(" [%i] Queue enqueue failed.\n", thr); ret = ret < 0 ? 0 : ret; odp_buffer_free_multi(&buf[ret], num_events - ret); return -1; @@ -196,7 +192,7 @@ static int test_alloc_single(int thr, test_globals_t *globals) temp_buf = odp_buffer_alloc(globals->pool);
if (!odp_buffer_is_valid(temp_buf)) { - LOG_ERR(" [%i] alloc_single failed\n", thr); + ODPH_ERR(" [%i] alloc_single failed\n", thr); return -1; }
@@ -233,7 +229,7 @@ static int test_alloc_multi(int thr, test_globals_t *globals) ret = odp_buffer_alloc_multi(globals->pool, temp_buf, MAX_ALLOCS); if (ret != MAX_ALLOCS) { - LOG_ERR(" [%i] buffer alloc failed\n", thr); + ODPH_ERR(" [%i] buffer alloc failed\n", thr); ret = ret < 0 ? 0 : ret; odp_buffer_free_multi(temp_buf, ret); return -1; @@ -241,7 +237,7 @@ static int test_alloc_multi(int thr, test_globals_t *globals)
for (j = 0; j < MAX_ALLOCS; j++) { if (!odp_buffer_is_valid(temp_buf[j])) { - LOG_ERR(" [%i] alloc_multi failed\n", thr); + ODPH_ERR(" [%i] alloc_multi failed\n", thr); odp_buffer_free_multi(temp_buf, MAX_ALLOCS); return -1; } @@ -282,7 +278,7 @@ static int test_plain_queue(int thr, test_globals_t *globals) buf = odp_buffer_alloc(globals->pool);
if (!odp_buffer_is_valid(buf)) { - LOG_ERR(" [%i] buffer alloc failed\n", thr); + ODPH_ERR(" [%i] buffer alloc failed\n", thr); return -1; }
@@ -305,7 +301,7 @@ static int test_plain_queue(int thr, test_globals_t *globals) ev = odp_buffer_to_event(buf);
if (odp_queue_enq(queue, ev)) { - LOG_ERR(" [%i] Queue enqueue failed.\n", thr); + ODPH_ERR(" [%i] Queue enqueue failed.\n", thr); odp_buffer_free(buf); return -1; } @@ -323,7 +319,7 @@ static int test_plain_queue(int thr, test_globals_t *globals) buf = odp_buffer_from_event(ev);
if (!odp_buffer_is_valid(buf)) { - LOG_ERR(" [%i] Queue empty.\n", thr); + ODPH_ERR(" [%i] Queue empty.\n", thr); return -1; } } @@ -370,7 +366,7 @@ static int test_schedule_single(const char *str, int thr, ev = odp_schedule(&queue, ODP_SCHED_WAIT);
if (odp_queue_enq(queue, ev)) { - LOG_ERR(" [%i] Queue enqueue failed.\n", thr); + ODPH_ERR(" [%i] Queue enqueue failed.\n", thr); odp_event_free(ev); return -1; } @@ -390,7 +386,7 @@ static int test_schedule_single(const char *str, int thr, tot++;
if (odp_queue_enq(queue, ev)) { - LOG_ERR(" [%i] Queue enqueue failed.\n", thr); + ODPH_ERR(" [%i] Queue enqueue failed.\n", thr); odp_event_free(ev); return -1; } @@ -444,7 +440,7 @@ static int test_schedule_many(const char *str, int thr, ev = odp_schedule(&queue, ODP_SCHED_WAIT);
if (odp_queue_enq(queue, ev)) { - LOG_ERR(" [%i] Queue enqueue failed.\n", thr); + ODPH_ERR(" [%i] Queue enqueue failed.\n", thr); odp_event_free(ev); return -1; } @@ -464,7 +460,7 @@ static int test_schedule_many(const char *str, int thr, tot++;
if (odp_queue_enq(queue, ev)) { - LOG_ERR(" [%i] Queue enqueue failed.\n", thr); + ODPH_ERR(" [%i] Queue enqueue failed.\n", thr); odp_event_free(ev); return -1; } @@ -528,7 +524,7 @@ static int test_schedule_multi(const char *str, int thr,
/* Assume we can enqueue all events */ if (odp_queue_enq_multi(queue, ev, num) != num) { - LOG_ERR(" [%i] Queue enqueue failed.\n", thr); + ODPH_ERR(" [%i] Queue enqueue failed.\n", thr); return -1; } } @@ -554,7 +550,7 @@ static int test_schedule_multi(const char *str, int thr,
/* Assume we can enqueue all events */ if (odp_queue_enq_multi(queue, ev, num) != num) { - LOG_ERR(" [%i] Queue enqueue failed.\n", thr); + ODPH_ERR(" [%i] Queue enqueue failed.\n", thr); return -1; } } @@ -605,7 +601,7 @@ static int run_thread(void *arg ODP_UNUSED) globals = odp_shm_addr(shm);
if (globals == NULL) { - LOG_ERR("Shared mem lookup failed\n"); + ODPH_ERR("Shared mem lookup failed\n"); return -1; }
@@ -825,7 +821,7 @@ int main(int argc, char *argv[]) /* Let helper collect its own arguments (e.g. --odph_proc) */ argc = odph_parse_options(argc, argv); if (odph_options(&helper_options)) { - LOG_ERR("Error: reading ODP helper options failed.\n"); + ODPH_ERR("Error: reading ODP helper options failed.\n"); exit(EXIT_FAILURE); }
@@ -837,7 +833,7 @@ int main(int argc, char *argv[])
/* ODP global init */ if (odp_init_global(&instance, &init_param, NULL)) { - LOG_ERR("ODP global init failed.\n"); + ODPH_ERR("ODP global init failed.\n"); return -1; }
@@ -846,7 +842,7 @@ int main(int argc, char *argv[]) * setting up resources for worker threads. */ if (odp_init_local(instance, ODP_THREAD_CONTROL)) { - LOG_ERR("ODP global init failed.\n"); + ODPH_ERR("ODP global init failed.\n"); return -1; }
@@ -863,7 +859,7 @@ int main(int argc, char *argv[])
thread_tbl = calloc(sizeof(odph_thread_t), num_workers); if (!thread_tbl) { - LOG_ERR("no memory for thread_tbl\n"); + ODPH_ERR("no memory for thread_tbl\n"); return -1; }
@@ -873,7 +869,7 @@ int main(int argc, char *argv[]) shm = odp_shm_reserve("test_globals", sizeof(test_globals_t), ODP_CACHE_LINE_SIZE, 0); if (shm == ODP_SHM_INVALID) { - LOG_ERR("Shared memory reserve failed.\n"); + ODPH_ERR("Shared memory reserve failed.\n"); return -1; }
@@ -885,7 +881,7 @@ int main(int argc, char *argv[]) * Create message pool */ if (odp_pool_capability(&pool_capa)) { - LOG_ERR("Pool capabilities failed.\n"); + ODPH_ERR("Pool capabilities failed.\n"); return -1; }
@@ -902,14 +898,14 @@ int main(int argc, char *argv[]) pool = odp_pool_create("msg_pool", ¶ms);
if (pool == ODP_POOL_INVALID) { - LOG_ERR("Pool create failed.\n"); + ODPH_ERR("Pool create failed.\n"); return -1; }
globals->pool = pool;
if (odp_queue_capability(&capa)) { - LOG_ERR("Fetching queue capabilities failed.\n"); + ODPH_ERR("Fetching queue capabilities failed.\n"); return -1; }
@@ -929,8 +925,8 @@ int main(int argc, char *argv[]) globals->queues_per_prio--;
if (globals->queues_per_prio <= 0) { - LOG_ERR("Not enough queues. At least 1 plain and %d scheduled " - "queues required.\n", NUM_PRIOS); + ODPH_ERR("Not enough queues. At least 1 plain and %d scheduled " + "queues required.\n", NUM_PRIOS); return -1; }
@@ -940,7 +936,7 @@ int main(int argc, char *argv[]) plain_queue = odp_queue_create("plain_queue", NULL);
if (plain_queue == ODP_QUEUE_INVALID) { - LOG_ERR("Plain queue create failed.\n"); + ODPH_ERR("Plain queue create failed.\n"); return -1; }
@@ -974,7 +970,7 @@ int main(int argc, char *argv[]) queue = odp_queue_create(name, ¶m);
if (queue == ODP_QUEUE_INVALID) { - LOG_ERR("Schedule queue create failed.\n"); + ODPH_ERR("Schedule queue create failed.\n"); return -1; }
@@ -984,7 +980,7 @@ int main(int argc, char *argv[]) &globals->queue_ctx[i][j], sizeof(queue_context_t)) < 0) { - LOG_ERR("Queue context set failed.\n"); + ODPH_ERR("Queue context set failed.\n"); return -1; } }
commit 79de47dbfc26fa53070f6a7b08e63b3bc5b0440f Author: Matias Elo matias.elo@nokia.com Date: Mon Sep 16 13:52:26 2019 +0300
example: use helper library debug macros
Use ODP helper library debug macros instead of reimplementing the same functionality in example_debug.h.
Signed-off-by: Matias Elo matias.elo@nokia.com Reviewed-by: Petri Savolainen petri.savolainen@nokia.com
diff --git a/example/Makefile.am b/example/Makefile.am index 359031d61..6115c1982 100644 --- a/example/Makefile.am +++ b/example/Makefile.am @@ -14,5 +14,3 @@ SUBDIRS = classifier \ time \ timer \ traffic_mgmt - -noinst_HEADERS = example_debug.h diff --git a/example/classifier/odp_classifier.c b/example/classifier/odp_classifier.c index a6c959a7f..c38c6dfd8 100644 --- a/example/classifier/odp_classifier.c +++ b/example/classifier/odp_classifier.c @@ -9,10 +9,10 @@ #include <getopt.h> #include <unistd.h> #include <inttypes.h> -#include <example_debug.h>
#include <odp_api.h> #include <odp/helper/odph_api.h> + #include <strings.h> #include <errno.h> #include <stdio.h> @@ -220,9 +220,9 @@ static odp_pktio_t create_pktio(const char *dev, odp_pool_t pool) pktio = odp_pktio_open(dev, pool, &pktio_param); if (pktio == ODP_PKTIO_INVALID) { if (odp_errno() == EPERM) - EXAMPLE_ERR("Root level permission required\n"); + ODPH_ERR("Root level permission required\n");
- EXAMPLE_ERR("pktio create failed for %s\n", dev); + ODPH_ERR("pktio create failed for %s\n", dev); exit(EXIT_FAILURE); }
@@ -231,12 +231,12 @@ static odp_pktio_t create_pktio(const char *dev, odp_pool_t pool) pktin_param.classifier_enable = 1;
if (odp_pktin_queue_config(pktio, &pktin_param)) { - EXAMPLE_ERR("pktin queue config failed for %s\n", dev); + ODPH_ERR("pktin queue config failed for %s\n", dev); exit(EXIT_FAILURE); }
if (odp_pktout_queue_config(pktio, NULL)) { - EXAMPLE_ERR("pktout queue config failed for %s\n", dev); + ODPH_ERR("pktout queue config failed for %s\n", dev); exit(EXIT_FAILURE); }
@@ -289,14 +289,14 @@ static int pktio_receive_thread(void *arg)
/* Drop packets with errors */ if (odp_unlikely(drop_err_pkts(&pkt, 1) == 0)) { - EXAMPLE_ERR("Drop frame - err_cnt:%lu\n", ++err_cnt); + ODPH_ERR("Drop frame - err_cnt:%lu\n", ++err_cnt); continue; }
pktio_tmp = odp_packet_input(pkt);
if (odp_pktout_queue(pktio_tmp, &pktout, 1) != 1) { - EXAMPLE_ERR(" [%02i] Error: no output queue\n", thr); + ODPH_ERR(" [%02i] Error: no output queue\n", thr); return -1; }
@@ -318,7 +318,7 @@ static int pktio_receive_thread(void *arg) }
if (odp_pktout_send(pktout, &pkt, 1) < 1) { - EXAMPLE_ERR(" [%i] Packet send failed.\n", thr); + ODPH_ERR(" [%i] Packet send failed\n", thr); odp_packet_free(pkt); } } @@ -347,7 +347,7 @@ static odp_cos_t configure_default_cos(odp_pktio_t pktio, appl_args_t *args) qparam.sched.group = ODP_SCHED_GROUP_ALL; queue_default = odp_queue_create(queue_name, &qparam); if (queue_default == ODP_QUEUE_INVALID) { - EXAMPLE_ERR("Error: default queue create failed.\n"); + ODPH_ERR("Error: default queue create failed\n"); exit(EXIT_FAILURE); }
@@ -359,7 +359,7 @@ static odp_cos_t configure_default_cos(odp_pktio_t pktio, appl_args_t *args) pool_default = odp_pool_create(pool_name, &pool_params);
if (pool_default == ODP_POOL_INVALID) { - EXAMPLE_ERR("Error: default pool create failed.\n"); + ODPH_ERR("Error: default pool create failed\n"); exit(EXIT_FAILURE); }
@@ -370,12 +370,12 @@ static odp_cos_t configure_default_cos(odp_pktio_t pktio, appl_args_t *args) cos_default = odp_cls_cos_create(cos_name, &cls_param);
if (cos_default == ODP_COS_INVALID) { - EXAMPLE_ERR("Error: default cos create failed.\n"); + ODPH_ERR("Error: default cos create failed\n"); exit(EXIT_FAILURE); }
if (0 > odp_pktio_default_cos_set(pktio, cos_default)) { - EXAMPLE_ERR("odp_pktio_default_cos_set failed"); + ODPH_ERR("odp_pktio_default_cos_set failed\n"); exit(EXIT_FAILURE); } stats[args->policy_count].cos = cos_default; @@ -416,7 +416,7 @@ static void configure_cos(odp_cos_t default_cos, appl_args_t *args) args->stats[i].cos_name, i); stats->queue = odp_queue_create(queue_name, &qparam); if (ODP_QUEUE_INVALID == stats->queue) { - EXAMPLE_ERR("odp_queue_create failed"); + ODPH_ERR("odp_queue_create failed\n"); exit(EXIT_FAILURE); }
@@ -432,7 +432,7 @@ static void configure_cos(odp_cos_t default_cos, appl_args_t *args) stats->pool = odp_pool_create(pool_name, &pool_params);
if (stats->pool == ODP_POOL_INVALID) { - EXAMPLE_ERR("Error: default pool create failed.\n"); + ODPH_ERR("Error: default pool create failed\n"); exit(EXIT_FAILURE); }
@@ -454,7 +454,7 @@ static void configure_cos(odp_cos_t default_cos, appl_args_t *args) stats->pmr = odp_cls_pmr_create(&pmr_param, 1, default_cos, stats->cos); if (stats->pmr == ODP_PMR_INVALID) { - EXAMPLE_ERR("odp_pktio_pmr_cos failed"); + ODPH_ERR("odp_pktio_pmr_cos failed\n"); exit(EXIT_FAILURE); }
@@ -489,7 +489,7 @@ int main(int argc, char *argv[]) /* Let helper collect its own arguments (e.g. --odph_proc) */ argc = odph_parse_options(argc, argv); if (odph_options(&helper_options)) { - EXAMPLE_ERR("Error: reading ODP helper options failed.\n"); + ODPH_ERR("Error: reading ODP helper options failed\n"); exit(EXIT_FAILURE); }
@@ -498,13 +498,13 @@ int main(int argc, char *argv[])
/* Init ODP before calling anything else */ if (odp_init_global(&instance, &init_param, NULL)) { - EXAMPLE_ERR("Error: ODP global init failed.\n"); + ODPH_ERR("Error: ODP global init failed\n"); exit(EXIT_FAILURE); }
/* Init this thread */ if (odp_init_local(instance, ODP_THREAD_CONTROL)) { - EXAMPLE_ERR("Error: ODP local init failed.\n"); + ODPH_ERR("Error: ODP local init failed\n"); exit(EXIT_FAILURE); }
@@ -513,14 +513,14 @@ int main(int argc, char *argv[]) ODP_CACHE_LINE_SIZE, 0);
if (shm == ODP_SHM_INVALID) { - EXAMPLE_ERR("Error: shared mem reserve failed.\n"); + ODPH_ERR("Error: shared mem reserve failed\n"); exit(EXIT_FAILURE); }
args = odp_shm_addr(shm);
if (args == NULL) { - EXAMPLE_ERR("Error: shared mem alloc failed.\n"); + ODPH_ERR("Error: shared mem alloc failed\n"); exit(EXIT_FAILURE); }
@@ -553,7 +553,7 @@ int main(int argc, char *argv[]) pool = odp_pool_create("packet_pool", ¶ms);
if (pool == ODP_POOL_INVALID) { - EXAMPLE_ERR("Error: packet pool create failed.\n"); + ODPH_ERR("Error: packet pool create failed\n"); exit(EXIT_FAILURE); }
@@ -572,7 +572,7 @@ int main(int argc, char *argv[]) configure_cos(default_cos, args);
if (odp_pktio_start(pktio)) { - EXAMPLE_ERR("Error: unable to start pktio.\n"); + ODPH_ERR("Error: unable to start pktio\n"); exit(EXIT_FAILURE); }
@@ -600,28 +600,28 @@ int main(int argc, char *argv[]) for (i = 0; i < args->policy_count; i++) { if ((i != args->policy_count - 1) && odp_cls_pmr_destroy(args->stats[i].pmr)) - EXAMPLE_ERR("err: odp_cls_pmr_destroy for %d\n", i); + ODPH_ERR("err: odp_cls_pmr_destroy for %d\n", i); if (odp_cos_destroy(args->stats[i].cos)) - EXAMPLE_ERR("err: odp_cos_destroy for %d\n", i); + ODPH_ERR("err: odp_cos_destroy for %d\n", i); if (odp_queue_destroy(args->stats[i].queue)) - EXAMPLE_ERR("err: odp_queue_destroy for %d\n", i); + ODPH_ERR("err: odp_queue_destroy for %d\n", i); if (odp_pool_destroy(args->stats[i].pool)) - EXAMPLE_ERR("err: odp_pool_destroy for %d\n", i); + ODPH_ERR("err: odp_pool_destroy for %d\n", i); }
free(args->if_name); odp_shm_free(shm); if (odp_pktio_close(pktio)) - EXAMPLE_ERR("err: close pktio error\n"); + ODPH_ERR("err: close pktio error\n"); if (odp_pool_destroy(pool)) - EXAMPLE_ERR("err: odp_pool_destroy error\n"); + ODPH_ERR("err: odp_pool_destroy error\n");
ret = odp_term_local(); if (ret) - EXAMPLE_ERR("odp_term_local error %d\n", ret); + ODPH_ERR("odp_term_local error %d\n", ret); ret = odp_term_global(instance); if (ret) - EXAMPLE_ERR("odp_term_global error %d\n", ret); + ODPH_ERR("odp_term_global error %d\n", ret); printf("Exit\n\n"); return ret; } @@ -731,7 +731,7 @@ static int parse_pmr_policy(appl_args_t *appl_args, char *argv[], char *optarg)
/* last array index is needed for default queue */ if (policy_count >= MAX_PMR_COUNT - 1) { - EXAMPLE_ERR("Maximum allowed PMR reached\n"); + ODPH_ERR("Maximum allowed PMR reached\n"); return -1; }
@@ -743,7 +743,7 @@ static int parse_pmr_policy(appl_args_t *appl_args, char *argv[], char *optarg) /* PMR TERM */ token = strtok(pmr_str, ":"); if (convert_str_to_pmr_enum(token, &term, &offset)) { - EXAMPLE_ERR("Invalid ODP_PMR_TERM string\n"); + ODPH_ERR("Invalid ODP_PMR_TERM string\n"); exit(EXIT_FAILURE); } stats[policy_count].rule.term = term; @@ -756,7 +756,7 @@ static int parse_pmr_policy(appl_args_t *appl_args, char *argv[], char *optarg) DISPLAY_STRING_LEN - 1);
if (odph_ipv4_addr_parse(&ip_addr, token)) { - EXAMPLE_ERR("Bad IP address\n"); + ODPH_ERR("Bad IP address\n"); exit(EXIT_FAILURE); }
diff --git a/example/example_debug.h b/example/example_debug.h deleted file mode 100644 index 84f8af1b8..000000000 --- a/example/example_debug.h +++ /dev/null @@ -1,93 +0,0 @@ -/* Copyright (c) 2014-2018, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ -/** - * @file - * - * example debug - */ - -#ifndef EXAMPLE_DEBUG_H_ -#define EXAMPLE_DEBUG_H_ - -#include <stdio.h> -#include <stdlib.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef EXAMPLE_DEBUG_PRINT -#define EXAMPLE_DEBUG_PRINT 1 -#endif - -/** - * log level. - */ -typedef enum example_log_level { - EXAMPLE_LOG_DBG, - EXAMPLE_LOG_ERR, - EXAMPLE_LOG_ABORT -} example_log_level_e; - -/** - * default LOG macro. - */ -#define EXAMPLE_LOG(level, fmt, ...) \ -do { \ - switch (level) { \ - case EXAMPLE_LOG_ERR: \ - fprintf(stderr, "%s:%d:%s():" fmt, __FILE__, \ - __LINE__, __func__, ##__VA_ARGS__); \ - break; \ - case EXAMPLE_LOG_DBG: \ - if (EXAMPLE_DEBUG_PRINT == 1) \ - fprintf(stderr, "%s:%d:%s():" fmt, __FILE__, \ - __LINE__, __func__, ##__VA_ARGS__); \ - break; \ - case EXAMPLE_LOG_ABORT: \ - fprintf(stderr, "%s:%d:%s(): " fmt, __FILE__, \ - __LINE__, __func__, ##__VA_ARGS__); \ - abort(); \ - break; \ - default: \ - fprintf(stderr, "Unknown LOG level"); \ - break;\ - } \ -} while (0) - -/** - * Debug printing macro, which prints output when DEBUG flag is set. - */ -#define EXAMPLE_DBG(fmt, ...) \ - EXAMPLE_LOG(EXAMPLE_LOG_DBG, fmt, ##__VA_ARGS__) - -/** - * Print output to stderr (file, line and function). - */ -#define EXAMPLE_ERR(fmt, ...) \ - EXAMPLE_LOG(EXAMPLE_LOG_ERR, fmt, ##__VA_ARGS__) - -/** - * Print output to stderr (file, line and function), - * then abort. - */ -#define EXAMPLE_ABORT(fmt, ...) \ - EXAMPLE_LOG(EXAMPLE_LOG_ABORT, fmt, ##__VA_ARGS__) - -/** - * Intentionally unused variables to functions - */ -#define EXAMPLE_UNUSED __attribute__((__unused__)) - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index 976dd722a..1ed734c6e 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -17,8 +17,6 @@ #include <sys/time.h> #include <signal.h>
-#include <example_debug.h> - #include <odp_api.h>
#include <odp/helper/odph_api.h> @@ -560,13 +558,13 @@ static int create_pktio(const char *dev, odp_pool_t pool, itf->pktio = odp_pktio_open(dev, pool, &pktio_param);
if (itf->pktio == ODP_PKTIO_INVALID) { - EXAMPLE_ERR("Error: pktio create failed for %s\n", dev); + ODPH_ERR("Error: pktio create failed for %s\n", dev); return -1; }
if (odp_pktio_capability(itf->pktio, &capa)) { - EXAMPLE_ERR("Error: Failed to get interface capabilities %s\n", - dev); + ODPH_ERR("Error: Failed to get interface capabilities %s\n", + dev); return -1; } odp_pktio_config_init(&itf->config); @@ -604,8 +602,8 @@ static int create_pktio(const char *dev, odp_pool_t pool, itf->config.parser.layer = ODP_PROTO_LAYER_L3;
if (odp_pktio_config(itf->pktio, &itf->config)) { - EXAMPLE_ERR("Error: Failed to set interface configuration %s\n", - dev); + ODPH_ERR("Error: Failed to set interface configuration %s\n", + dev); return -1; }
@@ -614,8 +612,8 @@ static int create_pktio(const char *dev, odp_pool_t pool, if (num_rx_queues > capa.max_input_queues) { num_rx_queues = capa.max_input_queues; pktin_mode = ODP_PKTIO_OP_MT; - EXAMPLE_DBG("Warning: Force RX multithread safe mode " - "(slower)on %s\n", dev); + ODPH_DBG("Warning: Force RX multithread safe mode " + "(slower)on %s\n", dev); }
odp_pktin_queue_param_init(&pktin_param); @@ -626,8 +624,8 @@ static int create_pktio(const char *dev, odp_pool_t pool, ODP_SCHED_SYNC_ATOMIC;
if (odp_pktin_queue_config(itf->pktio, &pktin_param)) { - EXAMPLE_ERR("Error: pktin queue config failed " - "for %s\n", dev); + ODPH_ERR("Error: pktin queue config failed for %s\n", + dev); return -1; } } @@ -637,8 +635,8 @@ static int create_pktio(const char *dev, odp_pool_t pool, if (num_tx_queues > capa.max_output_queues) { num_tx_queues = capa.max_output_queues; pktout_mode = ODP_PKTIO_OP_MT; - EXAMPLE_DBG("Warning: Force TX multithread safe mode " - "(slower) on %s\n", dev); + ODPH_DBG("Warning: Force TX multithread safe mode " + "(slower) on %s\n", dev); }
odp_pktout_queue_param_init(&pktout_param); @@ -646,21 +644,21 @@ static int create_pktio(const char *dev, odp_pool_t pool, pktout_param.op_mode = pktout_mode;
if (odp_pktout_queue_config(itf->pktio, &pktout_param)) { - EXAMPLE_ERR("Error: pktout queue config failed for %s\n", - dev); + ODPH_ERR("Error: pktout queue config failed for %s\n", + dev); return -1; } }
ret = odp_pktio_start(itf->pktio); if (ret) - EXAMPLE_ABORT("Error: unable to start %s\n", dev); + ODPH_ABORT("Error: unable to start %s\n", dev);
itf->pktout_count = num_tx_queues; if (itf->pktout_count && odp_pktout_queue(itf->pktio, itf->pktout, itf->pktout_count) != (int)itf->pktout_count) { - EXAMPLE_ERR("Error: failed to get output queues for %s\n", dev); + ODPH_ERR("Error: failed to get output queues for %s\n", dev); return -1; }
@@ -668,7 +666,7 @@ static int create_pktio(const char *dev, odp_pool_t pool, if (!sched && itf->pktin_count && odp_pktin_queue(itf->pktio, itf->pktin, itf->pktin_count) != (int)itf->pktin_count) { - EXAMPLE_ERR("Error: failed to get input queues for %s\n", dev); + ODPH_ERR("Error: failed to get input queues for %s\n", dev); return -1; }
@@ -727,8 +725,8 @@ static int gen_send_thread(void *arg) if (args->appl.number != -1) pkt_count_max = args->appl.number; } else { - EXAMPLE_ERR(" [%02i] Error: invalid processing mode %d\n", - thr, args->appl.mode); + ODPH_ERR(" [%02i] Error: invalid processing mode %d\n", thr, + args->appl.mode); return -1; } pkt_array_size = args->tx_burst_size; @@ -736,8 +734,8 @@ static int gen_send_thread(void *arg) if (setup_pkt_ref_array(thr_args->pool, pktout_cfg, pkt_ref_array, pkt_array_size, setup_pkt_ref)) { - EXAMPLE_ERR("[%02i] Error: failed to create" - " reference packets\n", thr); + ODPH_ERR("[%02i] Error: failed to create reference packets\n", + thr); return -1; }
@@ -758,8 +756,8 @@ static int gen_send_thread(void *arg) if (setup_pkt_array(pktout_cfg, counters, pkt_ref_array, pkt_array, pkt_array_size, setup_pkt, setup_pkt_arg)) { - EXAMPLE_ERR("[%02i] Error: failed to setup packets\n", - thr); + ODPH_ERR("[%02i] Error: failed to setup packets\n", + thr); break; }
@@ -778,7 +776,7 @@ static int gen_send_thread(void *arg) burst_size -= ret; continue; } - EXAMPLE_ERR(" [%02i] packet send failed\n", thr); + ODPH_ERR(" [%02i] packet send failed\n", thr); odp_packet_free_multi(&pkt_array[burst_start], burst_size); break; @@ -1123,7 +1121,7 @@ int main(int argc, char *argv[]) /* Let helper collect its own arguments (e.g. --odph_proc) */ argc = odph_parse_options(argc, argv); if (odph_options(&helper_options)) { - EXAMPLE_ERR("Error: reading ODP helper options failed.\n"); + ODPH_ERR("Error: reading ODP helper options failed.\n"); exit(EXIT_FAILURE); }
@@ -1132,12 +1130,12 @@ int main(int argc, char *argv[])
/* Init ODP before calling anything else */ if (odp_init_global(&instance, &init_param, NULL)) { - EXAMPLE_ERR("Error: ODP global init failed.\n"); + ODPH_ERR("Error: ODP global init failed.\n"); exit(EXIT_FAILURE); }
if (odp_init_local(instance, ODP_THREAD_CONTROL)) { - EXAMPLE_ERR("Error: ODP local init failed.\n"); + ODPH_ERR("Error: ODP local init failed.\n"); exit(EXIT_FAILURE); }
@@ -1146,14 +1144,14 @@ int main(int argc, char *argv[]) ODP_CACHE_LINE_SIZE, 0);
if (shm == ODP_SHM_INVALID) { - EXAMPLE_ERR("Error: shared mem reserve failed.\n"); + ODPH_ERR("Error: shared mem reserve failed.\n"); exit(EXIT_FAILURE); }
args = odp_shm_addr(shm);
if (args == NULL) { - EXAMPLE_ERR("Error: shared mem alloc failed.\n"); + ODPH_ERR("Error: shared mem alloc failed.\n"); exit(EXIT_FAILURE); } memset(args, 0, sizeof(*args)); @@ -1187,7 +1185,7 @@ int main(int argc, char *argv[]) /* ping mode need two workers */ if (args->appl.mode == APPL_MODE_PING) { if (num_workers < 2) { - EXAMPLE_ERR("Need at least two worker threads\n"); + ODPH_ERR("Need at least two worker threads\n"); exit(EXIT_FAILURE); } else { num_workers = 2; @@ -1220,7 +1218,7 @@ int main(int argc, char *argv[]) pool = odp_pool_create("packet_pool", ¶ms);
if (pool == ODP_POOL_INVALID) { - EXAMPLE_ERR("Error: packet pool create failed.\n"); + ODPH_ERR("Error: packet pool create failed.\n"); exit(EXIT_FAILURE); } odp_pool_print(pool); @@ -1245,8 +1243,8 @@ int main(int argc, char *argv[])
if (create_pktio(args->appl.if_names[i], pool, num_rx_queues, num_tx_queues, &ifs[i])) { - EXAMPLE_ERR("Error: create interface %s failed.\n", - args->appl.if_names[i]); + ODPH_ERR("Error: create interface %s failed.\n", + args->appl.if_names[i]); exit(EXIT_FAILURE); } } @@ -1374,7 +1372,7 @@ int main(int argc, char *argv[]) else thr_run_func = gen_recv_direct_thread; } else { - EXAMPLE_ERR("ERR MODE\n"); + ODPH_ERR("ERR MODE\n"); exit(EXIT_FAILURE); } /* @@ -1497,9 +1495,9 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) if (odp_cpumask_count(&cpumask_and) < odp_cpumask_count(&cpumask_args) || odp_cpumask_count(&cpumask_args) > MAX_WORKERS) { - EXAMPLE_ERR("Wrong cpu mask, max cpu's:%d\n", - num_workers < MAX_WORKERS ? - num_workers : MAX_WORKERS); + ODPH_ERR("Wrong cpu mask, max cpu's:%d\n", + num_workers < MAX_WORKERS ? + num_workers : MAX_WORKERS); exit(EXIT_FAILURE); } break; @@ -1552,35 +1550,35 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) } else if (optarg[0] == 'r') { appl_args->mode = APPL_MODE_RCV; } else { - EXAMPLE_ERR("wrong mode!\n"); + ODPH_ERR("wrong mode!\n"); exit(EXIT_FAILURE); } break;
case 'a': if (odph_eth_addr_parse(&appl_args->srcmac, optarg)) { - EXAMPLE_ERR("wrong src mac:%s\n", optarg); + ODPH_ERR("wrong src mac:%s\n", optarg); exit(EXIT_FAILURE); } break;
case 'b': if (odph_eth_addr_parse(&appl_args->dstmac, optarg)) { - EXAMPLE_ERR("wrong dst mac:%s\n", optarg); + ODPH_ERR("wrong dst mac:%s\n", optarg); exit(EXIT_FAILURE); } break;
case 's': if (scan_ip(optarg, &appl_args->srcip) != 1) { - EXAMPLE_ERR("wrong src ip:%s\n", optarg); + ODPH_ERR("wrong src ip:%s\n", optarg); exit(EXIT_FAILURE); } break;
case 'd': if (scan_ip(optarg, &appl_args->dstip) != 1) { - EXAMPLE_ERR("wrong dst ip:%s\n", optarg); + ODPH_ERR("wrong dst ip:%s\n", optarg); exit(EXIT_FAILURE); } break; @@ -1612,23 +1610,23 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) case 'i': appl_args->interval = atoi(optarg); if (appl_args->interval <= 200 && geteuid() != 0) { - EXAMPLE_ERR("should be root user\n"); + ODPH_ERR("should be root user\n"); exit(EXIT_FAILURE); } break; case 'x': appl_args->udp_tx_burst = atoi(optarg); if (appl_args->udp_tx_burst > MAX_UDP_TX_BURST) { - EXAMPLE_ERR("wrong UDP Tx burst size (max %d)\n", - MAX_UDP_TX_BURST); + ODPH_ERR("wrong UDP Tx burst size (max %d)\n", + MAX_UDP_TX_BURST); exit(EXIT_FAILURE); } break; case 'r': appl_args->rx_burst = atoi(optarg); if (appl_args->rx_burst > MAX_RX_BURST) { - EXAMPLE_ERR("wrong Rx burst size (max %d)\n", - MAX_RX_BURST); + ODPH_ERR("wrong Rx burst size (max %d)\n", + MAX_RX_BURST); exit(EXIT_FAILURE); } break; diff --git a/example/ipfragreass/odp_ipfragreass.c b/example/ipfragreass/odp_ipfragreass.c index 2d11ac0cb..baf8b13dc 100644 --- a/example/ipfragreass/odp_ipfragreass.c +++ b/example/ipfragreass/odp_ipfragreass.c @@ -16,7 +16,6 @@ #include <assert.h>
#include <odp/helper/odph_api.h> -#include <example_debug.h>
#include "odp_ipfragreass_fragment.h" #include "odp_ipfragreass_reassemble.h" @@ -161,7 +160,7 @@ static void init(odp_instance_t *instance, odp_pool_t *fragment_pool, * * @return Always returns zero */ -static int run_worker(void *arg EXAMPLE_UNUSED) +static int run_worker(void *arg ODP_UNUSED) { int threadno = odp_thread_id() - 1; int iterations = 0; diff --git a/example/ipfragreass/odp_ipfragreass_atomics.h b/example/ipfragreass/odp_ipfragreass_atomics.h index 2f3bb51b6..7db64911f 100644 --- a/example/ipfragreass/odp_ipfragreass_atomics.h +++ b/example/ipfragreass/odp_ipfragreass_atomics.h @@ -7,8 +7,6 @@ #ifndef ODP_FRAGREASS_PP_ATOMICS_H_ #define ODP_FRAGREASS_PP_ATOMICS_H_
-#include <example_debug.h> - #if __SIZEOF_POINTER__ == 4 /** * A wrapper function to perform a 64-bit "strong" atomic compare and swap diff --git a/example/ipfragreass/odp_ipfragreass_atomics_arm.h b/example/ipfragreass/odp_ipfragreass_atomics_arm.h index d539fa187..5d61909ab 100644 --- a/example/ipfragreass/odp_ipfragreass_atomics_arm.h +++ b/example/ipfragreass/odp_ipfragreass_atomics_arm.h @@ -7,7 +7,7 @@ #ifndef ODP_FRAGREASS_PP_ATOMICS_ARM_H_ #define ODP_FRAGREASS_PP_ATOMICS_ARM_H_
-#include <example_debug.h> +#include <odp_api.h>
#if __SIZEOF_POINTER__ == 8 && defined(__aarch64__) static inline __int128 lld(__int128 *var, int mo) @@ -45,7 +45,7 @@ static inline uint32_t scd(__int128 *var, __int128 neu, int mo)
static inline bool atomic_strong_cas_dblptr(__int128 *var, __int128 *exp, __int128 neu, int mo_success, - int mo_failure EXAMPLE_UNUSED) + int mo_failure ODP_UNUSED) { register __int128 old; register __int128 expected = *exp; @@ -95,7 +95,7 @@ static inline uint32_t scd(uint64_t *var, uint64_t neu, int mo)
static inline bool atomic_strong_cas_dblptr(uint64_t *var, uint64_t *exp, uint64_t neu, int mo_success, - int mo_failure EXAMPLE_UNUSED) + int mo_failure ODP_UNUSED) { register uint64_t old; register uint64_t expected = *exp; diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c index 1c26e405c..a50468d6e 100644 --- a/example/ipsec/odp_ipsec.c +++ b/example/ipsec/odp_ipsec.c @@ -20,8 +20,6 @@ #include <unistd.h> #include <inttypes.h>
-#include <example_debug.h> - #include <odp_api.h>
#include <odp/helper/odph_api.h> @@ -330,7 +328,7 @@ void ipsec_init_pre(void)
global->completionq = queue_create("completion", &qparam); if (ODP_QUEUE_INVALID == global->completionq) { - EXAMPLE_ERR("Error: completion queue creation failed\n"); + ODPH_ERR("Error: completion queue creation failed\n"); exit(EXIT_FAILURE); }
@@ -341,7 +339,7 @@ void ipsec_init_pre(void)
global->seqnumq = queue_create("seqnum", &qparam); if (ODP_QUEUE_INVALID == global->seqnumq) { - EXAMPLE_ERR("Error: sequence number queue creation failed\n"); + ODPH_ERR("Error: sequence number queue creation failed\n"); exit(EXIT_FAILURE); }
@@ -355,7 +353,7 @@ void ipsec_init_pre(void) global->out_pool = odp_pool_create("out_pool", ¶ms);
if (ODP_POOL_INVALID == global->out_pool) { - EXAMPLE_ERR("Error: message pool create failed.\n"); + ODPH_ERR("Error: message pool create failed.\n"); exit(EXIT_FAILURE); }
@@ -407,7 +405,7 @@ void ipsec_init_post(crypto_api_mode_e api_mode) entry->input, global->completionq, global->out_pool)) { - EXAMPLE_ERR("Error: IPSec cache entry failed.\n" + ODPH_ERR("Error: IPSec cache entry failed.\n" ); exit(EXIT_FAILURE); } @@ -473,7 +471,7 @@ void initialize_intf(char *intf) */ pktio = odp_pktio_open(intf, global->pkt_pool, &pktio_param); if (ODP_PKTIO_INVALID == pktio) { - EXAMPLE_ERR("Error: pktio create failed for %s\n", intf); + ODPH_ERR("Error: pktio create failed for %s\n", intf); exit(EXIT_FAILURE); }
@@ -481,36 +479,35 @@ void initialize_intf(char *intf) pktin_param.queue_param.sched.sync = ODP_SCHED_SYNC_ATOMIC;
if (odp_pktin_queue_config(pktio, &pktin_param)) { - EXAMPLE_ERR("Error: pktin config failed for %s\n", intf); + ODPH_ERR("Error: pktin config failed for %s\n", intf); exit(EXIT_FAILURE); }
if (odp_pktout_queue_config(pktio, NULL)) { - EXAMPLE_ERR("Error: pktout config failed for %s\n", intf); + ODPH_ERR("Error: pktout config failed for %s\n", intf); exit(EXIT_FAILURE); }
if (odp_pktin_event_queue(pktio, &inq, 1) != 1) { - EXAMPLE_ERR("Error: failed to get input queue for %s\n", intf); + ODPH_ERR("Error: failed to get input queue for %s\n", intf); exit(EXIT_FAILURE); }
if (odp_pktout_queue(pktio, &pktout, 1) != 1) { - EXAMPLE_ERR("Error: failed to get pktout queue for %s\n", intf); + ODPH_ERR("Error: failed to get pktout queue for %s\n", intf); exit(EXIT_FAILURE); }
ret = odp_pktio_start(pktio); if (ret) { - EXAMPLE_ERR("Error: unable to start %s\n", intf); + ODPH_ERR("Error: unable to start %s\n", intf); exit(EXIT_FAILURE); }
/* Read the source MAC address for this interface */ ret = odp_pktio_mac_addr(pktio, src_mac, sizeof(src_mac)); if (ret <= 0) { - EXAMPLE_ERR("Error: failed during MAC address get for %s\n", - intf); + ODPH_ERR("Error: failed during MAC address get for %s\n", intf); exit(EXIT_FAILURE); }
@@ -535,7 +532,7 @@ void initialize_intf(char *intf) */ static pkt_disposition_e do_input_verify(odp_packet_t pkt, - pkt_ctx_t *ctx EXAMPLE_UNUSED) + pkt_ctx_t *ctx ODP_UNUSED) { if (odp_unlikely(odp_packet_has_error(pkt))) return PKT_DROP; @@ -663,14 +660,14 @@ pkt_disposition_e do_ipsec_in_classify(odp_packet_t *pkt, ctx->state = PKT_STATE_IPSEC_IN_FINISH; if (entry->async) { if (odp_crypto_op_enq(pkt, &out_pkt, ¶ms, 1) != 1) { - EXAMPLE_ERR("Error: odp_crypto_op_enq() failed\n"); + ODPH_ERR("Error: odp_crypto_op_enq() failed\n"); exit(EXIT_FAILURE); } return PKT_POSTED; }
if (odp_crypto_op(pkt, &out_pkt, ¶ms, 1) != 1) { - EXAMPLE_ERR("Error: odp_crypto_op() failed\n"); + ODPH_ERR("Error: odp_crypto_op() failed\n"); exit(EXIT_FAILURE); } *pkt = out_pkt; @@ -961,7 +958,7 @@ pkt_disposition_e do_ipsec_out_seq(odp_packet_t *pkt, sizeof(*ctx->ipsec.tun_hdr_id), 1); if (ret != sizeof(*ctx->ipsec.tun_hdr_id)) { - EXAMPLE_ERR("Error: Not enough random data\n"); + ODPH_ERR("Error: Not enough random data\n"); exit(EXIT_FAILURE); } } @@ -973,14 +970,14 @@ pkt_disposition_e do_ipsec_out_seq(odp_packet_t *pkt, if (entry->async) { if (odp_crypto_op_enq(pkt, &out_pkt, &ctx->ipsec.params, 1) != 1) { - EXAMPLE_ERR("Error: odp_crypto_op_enq() failed\n"); + ODPH_ERR("Error: odp_crypto_op_enq() failed\n"); exit(EXIT_FAILURE); } return PKT_POSTED; }
if (odp_crypto_op(pkt, &out_pkt, &ctx->ipsec.params, 1) != 1) { - EXAMPLE_ERR("Error: odp_crypto_op() failed\n"); + ODPH_ERR("Error: odp_crypto_op() failed\n"); exit(EXIT_FAILURE); } *pkt = out_pkt; @@ -1041,7 +1038,7 @@ pkt_disposition_e do_ipsec_out_finish(odp_packet_t pkt, * @return NULL (should never return) */ static -int pktio_thread(void *arg EXAMPLE_UNUSED) +int pktio_thread(void *arg ODP_UNUSED) { int thr; odp_packet_t pkt; @@ -1082,7 +1079,7 @@ int pktio_thread(void *arg EXAMPLE_UNUSED) ctx->state = PKT_STATE_INPUT_VERIFY; } } else { - EXAMPLE_ERR("Error: Bad event type\n"); + ODPH_ERR("Error: Bad event type\n"); exit(EXIT_FAILURE); }
@@ -1222,7 +1219,7 @@ main(int argc, char *argv[]) /* Let helper collect its own arguments (e.g. --odph_proc) */ argc = odph_parse_options(argc, argv); if (odph_options(&helper_options)) { - EXAMPLE_ERR("Error: reading ODP helper options failed.\n"); + ODPH_ERR("Error: reading ODP helper options failed.\n"); exit(EXIT_FAILURE); }
@@ -1231,13 +1228,13 @@ main(int argc, char *argv[])
/* Init ODP before calling anything else */ if (odp_init_global(&instance, &init_param, NULL)) { - EXAMPLE_ERR("Error: ODP global init failed.\n"); + ODPH_ERR("Error: ODP global init failed.\n"); exit(EXIT_FAILURE); }
/* Init this thread */ if (odp_init_local(instance, ODP_THREAD_CONTROL)) { - EXAMPLE_ERR("Error: ODP local init failed.\n"); + ODPH_ERR("Error: ODP local init failed.\n"); exit(EXIT_FAILURE); }
@@ -1246,14 +1243,14 @@ main(int argc, char *argv[]) ODP_CACHE_LINE_SIZE, 0);
if (shm == ODP_SHM_INVALID) { - EXAMPLE_ERR("Error: shared mem reserve failed.\n"); + ODPH_ERR("Error: shared mem reserve failed.\n"); exit(EXIT_FAILURE); }
global = odp_shm_addr(shm);
if (NULL == global) { - EXAMPLE_ERR("Error: shared mem alloc failed.\n"); + ODPH_ERR("Error: shared mem alloc failed.\n"); exit(EXIT_FAILURE); } memset(global, 0, sizeof(global_data_t)); @@ -1298,7 +1295,7 @@ main(int argc, char *argv[]) global->pkt_pool = odp_pool_create("packet_pool", ¶ms);
if (ODP_POOL_INVALID == global->pkt_pool) { - EXAMPLE_ERR("Error: packet pool create failed.\n"); + ODPH_ERR("Error: packet pool create failed.\n"); exit(EXIT_FAILURE); }
@@ -1311,7 +1308,7 @@ main(int argc, char *argv[]) global->ctx_pool = odp_pool_create("ctx_pool", ¶ms);
if (ODP_POOL_INVALID == global->ctx_pool) { - EXAMPLE_ERR("Error: context pool create failed.\n"); + ODPH_ERR("Error: context pool create failed.\n"); exit(EXIT_FAILURE); }
@@ -1367,8 +1364,8 @@ main(int argc, char *argv[]) continue;
if (odp_pktio_stop(pktio) || odp_pktio_close(pktio)) { - EXAMPLE_ERR("Error: failed to close pktio %s\n", - global->appl.if_names[i]); + ODPH_ERR("Error: failed to close pktio %s\n", + global->appl.if_names[i]); exit(EXIT_FAILURE); } } @@ -1377,50 +1374,50 @@ main(int argc, char *argv[]) free(global->appl.if_str);
if (destroy_ipsec_cache()) - EXAMPLE_ERR("Error: crypto session destroy failed\n"); + ODPH_ERR("Error: crypto session destroy failed\n");
if (odp_queue_destroy(global->completionq)) - EXAMPLE_ERR("Error: queue destroy failed\n"); + ODPH_ERR("Error: queue destroy failed\n"); if (odp_queue_destroy(global->seqnumq)) - EXAMPLE_ERR("Error: queue destroy failed\n"); + ODPH_ERR("Error: queue destroy failed\n");
if (odp_pool_destroy(global->pkt_pool)) - EXAMPLE_ERR("Error: pool destroy failed\n"); + ODPH_ERR("Error: pool destroy failed\n"); if (odp_pool_destroy(global->ctx_pool)) - EXAMPLE_ERR("Error: pool destroy failed\n"); + ODPH_ERR("Error: pool destroy failed\n"); if (odp_pool_destroy(global->out_pool)) - EXAMPLE_ERR("Error: pool destroy failed\n"); + ODPH_ERR("Error: pool destroy failed\n");
shm = odp_shm_lookup("shm_ipsec_cache"); if (odp_shm_free(shm) != 0) - EXAMPLE_ERR("Error: shm free shm_ipsec_cache failed\n"); + ODPH_ERR("Error: shm free shm_ipsec_cache failed\n"); shm = odp_shm_lookup("shm_fwd_db"); if (odp_shm_free(shm) != 0) - EXAMPLE_ERR("Error: shm free shm_fwd_db failed\n"); + ODPH_ERR("Error: shm free shm_fwd_db failed\n"); shm = odp_shm_lookup("shm_sa_db"); if (odp_shm_free(shm) != 0) - EXAMPLE_ERR("Error: shm free shm_sa_db failed\n"); + ODPH_ERR("Error: shm free shm_sa_db failed\n"); shm = odp_shm_lookup("shm_tun_db"); if (odp_shm_free(shm) != 0) - EXAMPLE_ERR("Error: shm free shm_tun_db failed\n"); + ODPH_ERR("Error: shm free shm_tun_db failed\n"); shm = odp_shm_lookup("shm_sp_db"); if (odp_shm_free(shm) != 0) - EXAMPLE_ERR("Error: shm free shm_sp_db failed\n"); + ODPH_ERR("Error: shm free shm_sp_db failed\n"); shm = odp_shm_lookup("stream_db"); if (odp_shm_free(shm) != 0) - EXAMPLE_ERR("Error: shm free stream_db failed\n"); + ODPH_ERR("Error: shm free stream_db failed\n"); if (odp_shm_free(global->shm)) { - EXAMPLE_ERR("Error: shm free global data failed\n"); + ODPH_ERR("Error: shm free global data failed\n"); exit(EXIT_FAILURE); }
if (odp_term_local()) { - EXAMPLE_ERR("Error: term local failed\n"); + ODPH_ERR("Error: term local failed\n"); exit(EXIT_FAILURE); }
if (odp_term_global(instance)) { - EXAMPLE_ERR("Error: term global failed\n"); + ODPH_ERR("Error: term global failed\n"); exit(EXIT_FAILURE); }
diff --git a/example/ipsec/odp_ipsec_cache.c b/example/ipsec/odp_ipsec_cache.c index 362e64a44..044538c59 100644 --- a/example/ipsec/odp_ipsec_cache.c +++ b/example/ipsec/odp_ipsec_cache.c @@ -7,8 +7,6 @@ #include <stdlib.h> #include <string.h>
-#include <example_debug.h> - #include <odp_api.h>
#include <odp/helper/ipsec.h> @@ -28,14 +26,14 @@ void init_ipsec_cache(void) ODP_CACHE_LINE_SIZE, 0); if (shm == ODP_SHM_INVALID) { - EXAMPLE_ERR("Error: shared mem alloc failed.\n"); + ODPH_ERR("Error: shared mem alloc failed.\n"); exit(EXIT_FAILURE); }
ipsec_cache = odp_shm_addr(shm);
if (ipsec_cache == NULL) { - EXAMPLE_ERR("Error: shared mem alloc failed.\n"); + ODPH_ERR("Error: shared mem alloc failed.\n"); exit(EXIT_FAILURE); } memset(ipsec_cache, 0, sizeof(*ipsec_cache)); @@ -217,7 +215,7 @@ ipsec_cache_entry_t *find_ipsec_cache_entry_in(uint32_t src_ip,
ipsec_cache_entry_t *find_ipsec_cache_entry_out(uint32_t src_ip, uint32_t dst_ip, - uint8_t proto EXAMPLE_UNUSED) + uint8_t proto ODP_UNUSED) { ipsec_cache_entry_t *entry = ipsec_cache->out_list;
diff --git a/example/ipsec/odp_ipsec_fwd_db.c b/example/ipsec/odp_ipsec_fwd_db.c index 5e84656a4..ca0abf6c1 100644 --- a/example/ipsec/odp_ipsec_fwd_db.c +++ b/example/ipsec/odp_ipsec_fwd_db.c @@ -12,9 +12,8 @@ #include <stdlib.h> #include <string.h>
-#include <example_debug.h> - #include <odp_api.h> +#include <odp/helper/odph_api.h>
#include <odp_ipsec_fwd_db.h>
@@ -31,14 +30,14 @@ void init_fwd_db(void) 0);
if (shm == ODP_SHM_INVALID) { - EXAMPLE_ERR("Error: shared mem reserve failed.\n"); + ODPH_ERR("Error: shared mem reserve failed.\n"); exit(EXIT_FAILURE); }
fwd_db = odp_shm_addr(shm);
if (fwd_db == NULL) { - EXAMPLE_ERR("Error: shared mem alloc failed.\n"); + ODPH_ERR("Error: shared mem alloc failed.\n"); exit(EXIT_FAILURE); } memset(fwd_db, 0, sizeof(*fwd_db)); diff --git a/example/ipsec/odp_ipsec_sa_db.c b/example/ipsec/odp_ipsec_sa_db.c index 0c6fdf51a..9a7c593b3 100644 --- a/example/ipsec/odp_ipsec_sa_db.c +++ b/example/ipsec/odp_ipsec_sa_db.c @@ -12,9 +12,8 @@ #include <stdlib.h> #include <string.h>
-#include <example_debug.h> - #include <odp_api.h> +#include <odp/helper/odph_api.h>
#include <odp_ipsec_sa_db.h>
@@ -34,14 +33,14 @@ void init_sa_db(void) 0);
if (shm == ODP_SHM_INVALID) { - EXAMPLE_ERR("Error: shared mem reserve failed.\n"); + ODPH_ERR("Error: shared mem reserve failed.\n"); exit(EXIT_FAILURE); }
sa_db = odp_shm_addr(shm);
if (sa_db == NULL) { - EXAMPLE_ERR("Error: shared mem alloc failed.\n"); + ODPH_ERR("Error: shared mem alloc failed.\n"); exit(EXIT_FAILURE); } memset(sa_db, 0, sizeof(*sa_db)); @@ -57,14 +56,14 @@ void init_tun_db(void) 0);
if (shm == ODP_SHM_INVALID) { - EXAMPLE_ERR("Error: shared mem reserve failed.\n"); + ODPH_ERR("Error: shared mem reserve failed.\n"); exit(EXIT_FAILURE); }
tun_db = odp_shm_addr(shm);
if (!tun_db) { - EXAMPLE_ERR("Error: shared mem alloc failed.\n"); + ODPH_ERR("Error: shared mem alloc failed.\n"); exit(EXIT_FAILURE); } memset(tun_db, 0, sizeof(*tun_db)); diff --git a/example/ipsec/odp_ipsec_sp_db.c b/example/ipsec/odp_ipsec_sp_db.c index 51690ddfe..88ac55298 100644 --- a/example/ipsec/odp_ipsec_sp_db.c +++ b/example/ipsec/odp_ipsec_sp_db.c @@ -12,9 +12,8 @@ #include <stdlib.h> #include <string.h>
-#include <example_debug.h> - #include <odp_api.h> +#include <odp/helper/odph_api.h>
#include <odp_ipsec_sp_db.h>
@@ -31,14 +30,14 @@ void init_sp_db(void) 0);
if (shm == ODP_SHM_INVALID) { - EXAMPLE_ERR("Error: shared mem reserve failed.\n"); + ODPH_ERR("Error: shared mem reserve failed.\n"); exit(EXIT_FAILURE); }
sp_db = odp_shm_addr(shm);
if (sp_db == NULL) { - EXAMPLE_ERR("Error: shared mem alloc failed.\n"); + ODPH_ERR("Error: shared mem alloc failed.\n"); exit(EXIT_FAILURE); } memset(sp_db, 0, sizeof(*sp_db)); diff --git a/example/ipsec/odp_ipsec_stream.c b/example/ipsec/odp_ipsec_stream.c index c55dc4845..9f953e4a9 100644 --- a/example/ipsec/odp_ipsec_stream.c +++ b/example/ipsec/odp_ipsec_stream.c @@ -17,8 +17,6 @@ #include <openssl/hmac.h> #include <openssl/evp.h>
-#include <example_debug.h> - #include <odp_api.h>
#include <odp/helper/odph_api.h> @@ -49,14 +47,14 @@ void init_stream_db(void) 0);
if (shm == ODP_SHM_INVALID) { - EXAMPLE_ERR("Error: shared mem reserve failed.\n"); + ODPH_ERR("Error: shared mem reserve failed.\n"); exit(EXIT_FAILURE); }
stream_db = odp_shm_addr(shm);
if (stream_db == NULL) { - EXAMPLE_ERR("Error: shared mem alloc failed.\n"); + ODPH_ERR("Error: shared mem alloc failed.\n"); exit(EXIT_FAILURE); } memset(stream_db, 0, sizeof(*stream_db)); @@ -552,7 +550,7 @@ int create_stream_db_inputs(void) /* Lookup the packet pool */ pkt_pool = odp_pool_lookup("packet_pool"); if (pkt_pool == ODP_POOL_INVALID) { - EXAMPLE_ERR("Error: pkt_pool not found\n"); + ODPH_ERR("Error: pkt_pool not found\n"); exit(EXIT_FAILURE); }
@@ -566,16 +564,15 @@ int create_stream_db_inputs(void) ret = odp_pktio_mac_addr(stream->input.pktio, dmac, sizeof(dmac)); if (ret <= 0) { - EXAMPLE_ERR("Error: failed during MAC address get " - "for %s\n", - stream->input.intf); + ODPH_ERR("Error: failed during MAC address get for " + "%s\n", stream->input.intf); continue; }
ret = odp_pktout_queue(stream->input.pktio, &queue, 1); if (ret < 1) { - EXAMPLE_ERR("Error: failed to get outqueue for %s\n", - stream->input.intf); + ODPH_ERR("Error: failed to get outqueue for %s\n", + stream->input.intf); continue; }
@@ -620,8 +617,8 @@ odp_bool_t verify_stream_db_outputs(void)
ret = odp_pktin_event_queue(stream->output.pktio, &queue, 1); if (ret < 1) { - EXAMPLE_ERR("Error: failed to get inqueue for %s\n", - stream->output.intf); + ODPH_ERR("Error: failed to get inqueue for %s\n", + stream->output.intf); continue; }
diff --git a/example/ipsec_api/odp_ipsec.c b/example/ipsec_api/odp_ipsec.c index fa977db8e..a02343467 100644 --- a/example/ipsec_api/odp_ipsec.c +++ b/example/ipsec_api/odp_ipsec.c @@ -20,8 +20,6 @@ #include <unistd.h> #include <inttypes.h>
-#include <example_debug.h> - #include <odp_api.h>
#include <odp/helper/odph_api.h> @@ -284,7 +282,7 @@ void ipsec_init_pre(void)
global->completionq = queue_create("completion", &qparam); if (ODP_QUEUE_INVALID == global->completionq) { - EXAMPLE_ERR("Error: completion queue creation failed\n"); + ODPH_ERR("Error: completion queue creation failed\n"); exit(EXIT_FAILURE); }
@@ -315,7 +313,7 @@ void ipsec_init_post(odp_ipsec_op_mode_t api_mode) odp_ipsec_capability_t ipsec_cap;
if (odp_ipsec_capability(&ipsec_cap) != ODP_IPSEC_OK) { - EXAMPLE_ERR("Error: failure getting IPSec caps\n"); + ODPH_ERR("Error: failure getting IPSec caps\n"); exit(EXIT_FAILURE); }
@@ -325,7 +323,7 @@ void ipsec_init_post(odp_ipsec_op_mode_t api_mode) ipsec_config.outbound_mode = api_mode; ipsec_config.inbound.default_queue = global->completionq; if (odp_ipsec_config(&ipsec_config) != ODP_IPSEC_OK) { - EXAMPLE_ERR("Error: failure setting IPSec config\n"); + ODPH_ERR("Error: failure setting IPSec config\n"); exit(EXIT_FAILURE); }
@@ -356,7 +354,7 @@ void ipsec_init_post(odp_ipsec_op_mode_t api_mode) tun, entry->input, global->completionq)) { - EXAMPLE_ERR("Error: IPSec cache entry failed.\n" + ODPH_ERR("Error: IPSec cache entry failed.\n" ); exit(EXIT_FAILURE); } @@ -444,7 +442,7 @@ void initialize_intf(char *intf) */ pktio = odp_pktio_open(intf, global->pkt_pool, &pktio_param); if (ODP_PKTIO_INVALID == pktio) { - EXAMPLE_ERR("Error: pktio create failed for %s\n", intf); + ODPH_ERR("Error: pktio create failed for %s\n", intf); exit(EXIT_FAILURE); }
@@ -452,27 +450,27 @@ void initialize_intf(char *intf) pktin_param.queue_param.sched.sync = ODP_SCHED_SYNC_ATOMIC;
if (odp_pktin_queue_config(pktio, &pktin_param)) { - EXAMPLE_ERR("Error: pktin config failed for %s\n", intf); + ODPH_ERR("Error: pktin config failed for %s\n", intf); exit(EXIT_FAILURE); }
if (odp_pktout_queue_config(pktio, NULL)) { - EXAMPLE_ERR("Error: pktout config failed for %s\n", intf); + ODPH_ERR("Error: pktout config failed for %s\n", intf); exit(EXIT_FAILURE); }
if (odp_pktin_event_queue(pktio, &inq, 1) != 1) { - EXAMPLE_ERR("Error: failed to get input queue for %s\n", intf); + ODPH_ERR("Error: failed to get input queue for %s\n", intf); exit(EXIT_FAILURE); }
if (odp_pktout_queue(pktio, &pktout, 1) != 1) { - EXAMPLE_ERR("Error: failed to get pktout queue for %s\n", intf); + ODPH_ERR("Error: failed to get pktout queue for %s\n", intf); exit(EXIT_FAILURE); }
if (odp_pktio_capability(pktio, &capa) != 0) { - EXAMPLE_ERR("Error: failed to get capabilities for %s\n", intf); + ODPH_ERR("Error: failed to get capabilities for %s\n", intf); exit(EXIT_FAILURE); }
@@ -485,21 +483,20 @@ void initialize_intf(char *intf) config.outbound_ipsec = capa.config.outbound_ipsec;
if (odp_pktio_config(pktio, &config) != 0) { - EXAMPLE_ERR("Error: failed to set config for %s\n", intf); + ODPH_ERR("Error: failed to set config for %s\n", intf); exit(EXIT_FAILURE); }
ret = odp_pktio_start(pktio); if (ret) { - EXAMPLE_ERR("Error: unable to start %s\n", intf); + ODPH_ERR("Error: unable to start %s\n", intf); exit(EXIT_FAILURE); }
/* Read the source MAC address for this interface */ ret = odp_pktio_mac_addr(pktio, src_mac, sizeof(src_mac)); if (ret <= 0) { - EXAMPLE_ERR("Error: failed during MAC address get for %s\n", - intf); + ODPH_ERR("Error: failed during MAC address get for %s\n", intf); exit(EXIT_FAILURE); }
@@ -524,7 +521,7 @@ void initialize_intf(char *intf) */ static pkt_disposition_e do_input_verify(odp_packet_t pkt, - pkt_ctx_t *ctx EXAMPLE_UNUSED) + pkt_ctx_t *ctx ODP_UNUSED) { if (odp_unlikely(odp_packet_has_error(pkt))) return PKT_DROP; @@ -723,7 +720,7 @@ pkt_disposition_e do_ipsec_out_classify(odp_packet_t *ppkt, pkt_ctx_t *ctx) * @return NULL (should never return) */ static -int pktio_thread(void *arg EXAMPLE_UNUSED) +int pktio_thread(void *arg ODP_UNUSED) { int thr; odp_packet_t pkt; @@ -764,13 +761,13 @@ int pktio_thread(void *arg EXAMPLE_UNUSED)
if (odp_unlikely(odp_ipsec_result(&result, pkt) < 0)) { - EXAMPLE_DBG("Error Event\n"); + ODPH_DBG("Error Event\n"); odp_event_free(ev); continue; }
if (result.status.error.all != 0) { - EXAMPLE_DBG("Error in IPsec\n"); + ODPH_DBG("Error in IPsec\n"); rc = PKT_DROP; }
@@ -789,7 +786,7 @@ int pktio_thread(void *arg EXAMPLE_UNUSED) ctx = odp_packet_user_ptr(pkt); } } else { - EXAMPLE_DBG("Unsupported Packet\n"); + ODPH_DBG("Unsupported Packet\n"); odp_event_free(ev); continue; } @@ -797,7 +794,7 @@ int pktio_thread(void *arg EXAMPLE_UNUSED) odp_ipsec_status_t status;
if (odp_unlikely(odp_ipsec_status(&status, ev) < 0)) { - EXAMPLE_DBG("Error Event\n"); + ODPH_DBG("Error Event\n"); odp_event_free(ev); continue; } @@ -916,7 +913,7 @@ main(int argc, char *argv[]) /* Let helper collect its own arguments (e.g. --odph_proc) */ argc = odph_parse_options(argc, argv); if (odph_options(&helper_options)) { - EXAMPLE_ERR("Error: reading ODP helper options failed.\n"); + ODPH_ERR("Error: reading ODP helper options failed.\n"); exit(EXIT_FAILURE); }
@@ -925,13 +922,13 @@ main(int argc, char *argv[])
/* Init ODP before calling anything else */ if (odp_init_global(&instance, &init_param, NULL)) { - EXAMPLE_ERR("Error: ODP global init failed.\n"); + ODPH_ERR("Error: ODP global init failed.\n"); exit(EXIT_FAILURE); }
/* Init this thread */ if (odp_init_local(instance, ODP_THREAD_CONTROL)) { - EXAMPLE_ERR("Error: ODP local init failed.\n"); + ODPH_ERR("Error: ODP local init failed.\n"); exit(EXIT_FAILURE); }
@@ -940,14 +937,14 @@ main(int argc, char *argv[]) ODP_CACHE_LINE_SIZE, 0);
if (shm == ODP_SHM_INVALID) { - EXAMPLE_ERR("Error: shared mem reserve failed.\n"); + ODPH_ERR("Error: shared mem reserve failed.\n"); exit(EXIT_FAILURE); }
global = odp_shm_addr(shm);
if (NULL == global) { - EXAMPLE_ERR("Error: shared mem alloc failed.\n"); + ODPH_ERR("Error: shared mem alloc failed.\n"); exit(EXIT_FAILURE); } memset(global, 0, sizeof(global_data_t)); @@ -992,7 +989,7 @@ main(int argc, char *argv[]) global->pkt_pool = odp_pool_create("packet_pool", ¶ms);
if (ODP_POOL_INVALID == global->pkt_pool) { - EXAMPLE_ERR("Error: packet pool create failed.\n"); + ODPH_ERR("Error: packet pool create failed.\n"); exit(EXIT_FAILURE); }
@@ -1005,7 +1002,7 @@ main(int argc, char *argv[]) global->ctx_pool = odp_pool_create("ctx_pool", ¶ms);
if (ODP_POOL_INVALID == global->ctx_pool) { - EXAMPLE_ERR("Error: context pool create failed.\n"); + ODPH_ERR("Error: context pool create failed.\n"); exit(EXIT_FAILURE); }
@@ -1062,8 +1059,8 @@ main(int argc, char *argv[]) continue;
if (odp_pktio_stop(pktio) || odp_pktio_close(pktio)) { - EXAMPLE_ERR("Error: failed to close pktio %s\n", - global->appl.if_names[i]); + ODPH_ERR("Error: failed to close pktio %s\n", + global->appl.if_names[i]); exit(EXIT_FAILURE); } } @@ -1072,7 +1069,7 @@ main(int argc, char *argv[]) free(global->appl.if_str);
if (destroy_ipsec_cache()) - EXAMPLE_ERR("Error: crypto session destroy failed\n"); + ODPH_ERR("Error: crypto session destroy failed\n");
/* Drop any remaining events. ipsec_sa_disable sends status event in * async mode */ @@ -1080,43 +1077,43 @@ main(int argc, char *argv[]) odp_event_free(ev);
if (odp_queue_destroy(global->completionq)) - EXAMPLE_ERR("Error: queue destroy failed\n"); + ODPH_ERR("Error: queue destroy failed\n");
if (odp_pool_destroy(global->pkt_pool)) - EXAMPLE_ERR("Error: pool destroy failed\n"); + ODPH_ERR("Error: pool destroy failed\n"); if (odp_pool_destroy(global->ctx_pool)) - EXAMPLE_ERR("Error: pool destroy failed\n"); + ODPH_ERR("Error: pool destroy failed\n");
shm = odp_shm_lookup("shm_ipsec_cache"); if (odp_shm_free(shm) != 0) - EXAMPLE_ERR("Error: shm free shm_ipsec_cache failed\n"); + ODPH_ERR("Error: shm free shm_ipsec_cache failed\n"); shm = odp_shm_lookup("shm_fwd_db"); if (odp_shm_free(shm) != 0) - EXAMPLE_ERR("Error: shm free shm_fwd_db failed\n"); + ODPH_ERR("Error: shm free shm_fwd_db failed\n"); shm = odp_shm_lookup("shm_sa_db"); if (odp_shm_free(shm) != 0) - EXAMPLE_ERR("Error: shm free shm_sa_db failed\n"); + ODPH_ERR("Error: shm free shm_sa_db failed\n"); shm = odp_shm_lookup("shm_tun_db"); if (odp_shm_free(shm) != 0) - EXAMPLE_ERR("Error: shm free shm_tun_db failed\n"); + ODPH_ERR("Error: shm free shm_tun_db failed\n"); shm = odp_shm_lookup("shm_sp_db"); if (odp_shm_free(shm) != 0) - EXAMPLE_ERR("Error: shm free shm_sp_db failed\n"); + ODPH_ERR("Error: shm free shm_sp_db failed\n"); shm = odp_shm_lookup("stream_db"); if (odp_shm_free(shm) != 0) - EXAMPLE_ERR("Error: shm free stream_db failed\n"); + ODPH_ERR("Error: shm free stream_db failed\n"); if (odp_shm_free(global->shm)) { - EXAMPLE_ERR("Error: shm free global data failed\n"); + ODPH_ERR("Error: shm free global data failed\n"); exit(EXIT_FAILURE); }
if (odp_term_local()) { - EXAMPLE_ERR("Error: term local failed\n"); + ODPH_ERR("Error: term local failed\n"); exit(EXIT_FAILURE); }
if (odp_term_global(instance)) { - EXAMPLE_ERR("Error: term global failed\n"); + ODPH_ERR("Error: term global failed\n"); exit(EXIT_FAILURE); }
diff --git a/example/ipsec_api/odp_ipsec_cache.c b/example/ipsec_api/odp_ipsec_cache.c index e408899ac..c16c71115 100644 --- a/example/ipsec_api/odp_ipsec_cache.c +++ b/example/ipsec_api/odp_ipsec_cache.c @@ -7,11 +7,8 @@ #include <stdlib.h> #include <string.h>
-#include <example_debug.h> - #include <odp_api.h> - -#include <odp/helper/ipsec.h> +#include <odp/helper/odph_api.h>
#include <odp_ipsec_cache.h>
@@ -29,14 +26,14 @@ void init_ipsec_cache(void) 0);
if (shm == ODP_SHM_INVALID) { - EXAMPLE_ERR("Error: shared mem reserve failed.\n"); + ODPH_ERR("Error: shared mem reserve failed.\n"); exit(EXIT_FAILURE); }
ipsec_cache = odp_shm_addr(shm);
if (ipsec_cache == NULL) { - EXAMPLE_ERR("Error: shared mem alloc failed.\n"); + ODPH_ERR("Error: shared mem alloc failed.\n"); exit(EXIT_FAILURE); } memset(ipsec_cache, 0, sizeof(*ipsec_cache)); @@ -102,7 +99,7 @@ int create_ipsec_cache_entry(sa_db_entry_t *cipher_sa,
ipsec_sa = odp_ipsec_sa_create(¶m); if (ODP_IPSEC_SA_INVALID == ipsec_sa) { - EXAMPLE_ERR("Error: SA creation failed\n"); + ODPH_ERR("Error: SA creation failed\n"); exit(EXIT_FAILURE); }
@@ -176,7 +173,7 @@ ipsec_cache_entry_t *find_ipsec_cache_entry_in(uint32_t src_ip,
ipsec_cache_entry_t *find_ipsec_cache_entry_out(uint32_t src_ip, uint32_t dst_ip, - uint8_t proto EXAMPLE_UNUSED) + uint8_t proto ODP_UNUSED) { ipsec_cache_entry_t *entry = ipsec_cache->out_list;
diff --git a/example/ipsec_offload/odp_ipsec_offload.c b/example/ipsec_offload/odp_ipsec_offload.c index f6936b335..a75b15c2a 100644 --- a/example/ipsec_offload/odp_ipsec_offload.c +++ b/example/ipsec_offload/odp_ipsec_offload.c @@ -20,15 +20,8 @@ #include <unistd.h> #include <inttypes.h>
-#include <example_debug.h> - #include <odp_api.h> -#include <odp/helper/linux.h> -#include <odp/helper/eth.h> -#include <odp/helper/ip.h> -#include <odp/helper/icmp.h> -#include <odp/helper/udp.h> -#include <odp/helper/ipsec.h> +#include <odp/helper/odph_api.h>
#include <stdbool.h> #include <sys/socket.h> @@ -177,7 +170,7 @@ void ipsec_init_post(void) entry->input, queue) ) { - EXAMPLE_ABORT("Error: IPSec cache entry failed.\n"); + ODPH_ABORT("Error: IPSec cache entry failed\n"); } } else { printf(" WARNING: SA not found for SP\n"); @@ -214,14 +207,14 @@ static void initialize_intf(char *intf, int queue_type) */ pktio = odp_pktio_open(intf, global->pkt_pool, &pktio_param); if (ODP_PKTIO_INVALID == pktio) - EXAMPLE_ABORT("Error: pktio create failed for %s\n", intf); + ODPH_ABORT("Error: pktio create failed for %s\n", intf);
odp_pktin_queue_param_init(&pktin_param);
ret = odp_pktio_capability(pktio, &capa); if (ret != 0) - EXAMPLE_ABORT("Error: Unable to get pktio capability %s\n", - intf); + ODPH_ABORT("Error: Unable to get pktio capability %s\n", + intf);
pktin_param.queue_param.type = ODP_QUEUE_TYPE_SCHED; pktin_param.queue_param.sched.sync = queue_type; @@ -232,24 +225,24 @@ static void initialize_intf(char *intf, int queue_type) pktin_param.hash_enable = 1;
if (odp_pktin_queue_config(pktio, &pktin_param)) - EXAMPLE_ABORT("Error: pktin config failed for %s\n", intf); + ODPH_ABORT("Error: pktin config failed for %s\n", intf);
if (odp_pktout_queue_config(pktio, NULL)) - EXAMPLE_ABORT("Error: pktout config failed for %s\n", intf); + ODPH_ABORT("Error: pktout config failed for %s\n", intf);
if (odp_pktout_queue(pktio, &pktout, 1) != 1) - EXAMPLE_ABORT("Error: failed to get pktout queue for %s\n", - intf); + ODPH_ABORT("Error: failed to get pktout queue for %s\n", + intf);
ret = odp_pktio_start(pktio); if (ret) - EXAMPLE_ABORT("Error: unable to start %s\n", intf); + ODPH_ABORT("Error: unable to start %s\n", intf);
/* Read the source MAC address for this interface */ ret = odp_pktio_mac_addr(pktio, src_mac, sizeof(src_mac)); if (ret < 0) { - EXAMPLE_ABORT("Error: failed during MAC address get for %s\n", - intf); + ODPH_ABORT("Error: failed during MAC address get for %s\n", + intf); }
printf("Created pktio:%02" PRIu64 "\n", odp_pktio_to_u64(pktio)); @@ -326,7 +319,7 @@ pkt_disposition_e do_route_fwd_db(odp_packet_t pkt) /*Check into Routing table*/ fwd_entry = find_fwd_db_entry(dip); if (!fwd_entry) { - EXAMPLE_DBG("No flow match found. Packet is dropped.\n"); + ODPH_DBG("No flow match found. Packet is dropped.\n"); odp_packet_free(pkt); return PKT_DROP; } @@ -334,7 +327,7 @@ pkt_disposition_e do_route_fwd_db(odp_packet_t pkt) /*Entry found. Updated in Flow table first.*/ flow = calloc(1, sizeof(flow_entry_t)); if (!flow) { - EXAMPLE_ABORT("Failure to allocate memory"); + ODPH_ABORT("Failure to allocate memory"); return PKT_DROP; } flow->l3_src = sip; @@ -369,7 +362,7 @@ pkt_disposition_e do_route_fwd_db(odp_packet_t pkt)
/* Issue ipsec request */ if (odp_unlikely(odp_ipsec_out_enq(&pkt, 1, ¶ms) < 0)) { - EXAMPLE_DBG("Unable to out enqueue\n"); + ODPH_DBG("Unable to out enqueue\n"); odp_packet_free(pkt); return PKT_DROP; } @@ -400,7 +393,7 @@ pkt_disposition_e do_ipsec_in_classify(odp_packet_t pkt)
/* Issue ipsec request */ if (odp_unlikely(odp_ipsec_in_enq(&pkt, 1, ¶ms) < 0)) { - EXAMPLE_DBG("Unable to in enqueue\n"); + ODPH_DBG("Unable to in enqueue\n"); odp_packet_free(pkt); return PKT_DROP; } @@ -421,7 +414,7 @@ pkt_disposition_e do_ipsec_in_classify(odp_packet_t pkt) * @return NULL (should never return) */ static -int pktio_thread(void *arg EXAMPLE_UNUSED) +int pktio_thread(void *arg ODP_UNUSED) { int thr = odp_thread_id(); odp_packet_t pkt; @@ -448,7 +441,7 @@ int pktio_thread(void *arg EXAMPLE_UNUSED)
if (odp_unlikely(odp_ipsec_result(&res, pkt) < 0)) { - EXAMPLE_DBG("Error Event\n"); + ODPH_DBG("Error Event\n"); odp_event_free((odp_event_t)ev); continue; } @@ -479,7 +472,7 @@ int pktio_thread(void *arg EXAMPLE_UNUSED) odp_packet_free(pkt);
} else { - EXAMPLE_DBG("Invalid Event\n"); + ODPH_DBG("Invalid Event\n"); odp_event_free(ev); continue; } @@ -517,21 +510,21 @@ main(int argc, char *argv[])
/* Initialize ODP before calling anything else */ if (odp_init_global(&instance, NULL, NULL)) - EXAMPLE_ABORT("Error: ODP global init failed.\n"); + ODPH_ABORT("Error: ODP global init failed.\n"); /* Initialize this thread */ if (odp_init_local(instance, ODP_THREAD_CONTROL)) - EXAMPLE_ABORT("Error: ODP local init failed.\n"); + ODPH_ABORT("Error: ODP local init failed.\n"); /* Reserve memory for arguments from shared memory */ shm = odp_shm_reserve("shm_args", sizeof(global_data_t), ODP_CACHE_LINE_SIZE, 0);
if (shm == ODP_SHM_INVALID) - EXAMPLE_ABORT("Error: shared mem reserve failed.\n"); + ODPH_ABORT("Error: shared mem reserve failed.\n");
global = odp_shm_addr(shm);
if (NULL == global) - EXAMPLE_ABORT("Error: shared mem alloc failed.\n"); + ODPH_ABORT("Error: shared mem alloc failed.\n"); memset(global, 0, sizeof(global_data_t));
/* Must init our databases before parsing args */ @@ -548,7 +541,7 @@ main(int argc, char *argv[]) print_info(NO_PATH(argv[0]), &global->appl);
if (odp_ipsec_capability(&capa)) - EXAMPLE_ABORT("Error: Capability not configured.\n"); + ODPH_ABORT("Error: Capability not configured.\n");
odp_ipsec_config_init(&config);
@@ -556,11 +549,11 @@ main(int argc, char *argv[]) config.inbound_mode = ODP_IPSEC_OP_MODE_ASYNC; config.outbound_mode = ODP_IPSEC_OP_MODE_ASYNC; } else { - EXAMPLE_ABORT("Error: Sync mode not supported.\n"); + ODPH_ABORT("Error: Sync mode not supported.\n"); }
if (odp_ipsec_config(&config)) - EXAMPLE_ABORT("Error: IPSec not configured.\n"); + ODPH_ABORT("Error: IPSec not configured.\n");
global->num_workers = MAX_WORKERS; if (global->appl.cpu_count && global->appl.cpu_count < MAX_WORKERS) @@ -587,7 +580,7 @@ main(int argc, char *argv[]) global->completionq[i] = odp_queue_create("completion", &qparam); if (ODP_QUEUE_INVALID == global->completionq[i]) - EXAMPLE_ABORT("Error: completion queue creation failed\n"); + ODPH_ABORT("Error: completion queue creation failed\n"); } printf("num worker threads: %i\n", global->num_workers); printf("first CPU: %i\n", odp_cpumask_first(&cpumask)); @@ -606,7 +599,7 @@ main(int argc, char *argv[]) global->pkt_pool = odp_pool_create("packet_pool", ¶ms);
if (ODP_POOL_INVALID == global->pkt_pool) - EXAMPLE_ABORT("Error: packet pool create failed.\n"); + ODPH_ABORT("Error: packet pool create failed.\n");
ipsec_init_post();
@@ -642,8 +635,8 @@ main(int argc, char *argv[]) continue;
if (odp_pktio_stop(pktio) || odp_pktio_close(pktio)) { - EXAMPLE_ERR("Error: failed to close pktio %s\n", - global->appl.if_names[i]); + ODPH_ERR("Error: failed to close pktio %s\n", + global->appl.if_names[i]); exit(EXIT_FAILURE); } } @@ -652,7 +645,7 @@ main(int argc, char *argv[]) free(global->appl.if_str);
if (odp_shm_free(shm)) { - EXAMPLE_ERR("Error: shm free global data\n"); + ODPH_ERR("Error: shm free global data\n"); exit(EXIT_FAILURE); }
@@ -710,7 +703,7 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) printf("-f must be the 1st argument of the command\n"); rc = -1; } - EXAMPLE_DBG("Bucket count = %d\n", bucket_count); + ODPH_DBG("Bucket count = %d\n", bucket_count); break; case 'c': appl_args->cpu_count = atoi(optarg); @@ -745,7 +738,7 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) appl_args->if_names = calloc(appl_args->if_count, sizeof(char *)); if (!appl_args->if_names) - EXAMPLE_ABORT("Memory allocation failure\n"); + ODPH_ABORT("Memory allocation failure\n"); /* Store the if names (reset names string) */ strcpy(appl_args->if_str, optarg); for (token = strtok(appl_args->if_str, ","), i = 0; diff --git a/example/ipsec_offload/odp_ipsec_offload_cache.c b/example/ipsec_offload/odp_ipsec_offload_cache.c index 6f0e09398..e4ac3c6f3 100644 --- a/example/ipsec_offload/odp_ipsec_offload_cache.c +++ b/example/ipsec_offload/odp_ipsec_offload_cache.c @@ -10,12 +10,8 @@ #include <stdlib.h> #include <string.h>
-#include <example_debug.h> - #include <odp.h> - -#include <odp/helper/ipsec.h> -#include <odp/helper/ip.h> +#include <odp/helper/odph_api.h>
#include <odp_ipsec_offload_cache.h>
@@ -34,12 +30,12 @@ void init_ipsec_cache(void) 0);
if (shm == ODP_SHM_INVALID) - EXAMPLE_ABORT("Error: shared mem reserve failed.\n"); + ODPH_ABORT("Error: shared mem reserve failed.\n");
ipsec_cache = odp_shm_addr(shm);
if (ipsec_cache == NULL) - EXAMPLE_ABORT("Error: shared mem alloc failed.\n"); + ODPH_ABORT("Error: shared mem alloc failed.\n"); memset(ipsec_cache, 0, sizeof(*ipsec_cache)); }
diff --git a/example/ipsec_offload/odp_ipsec_offload_fwd_db.c b/example/ipsec_offload/odp_ipsec_offload_fwd_db.c index a92a566f6..8d87051f5 100644 --- a/example/ipsec_offload/odp_ipsec_offload_fwd_db.c +++ b/example/ipsec_offload/odp_ipsec_offload_fwd_db.c @@ -10,8 +10,8 @@ #include <stdlib.h> #include <string.h>
-#include <example_debug.h> #include <odp.h> +#include <odp/helper/odph_api.h>
#include <odp_ipsec_offload_fwd_db.h>
@@ -39,10 +39,10 @@ void init_routing_table(void) sizeof(flow_bucket_t) * bucket_count, ODP_CACHE_LINE_SIZE, 0); if (hash_shm == ODP_SHM_INVALID) - EXAMPLE_ABORT("Error: shared mem alloc failed.\n"); + ODPH_ABORT("Error: shared mem alloc failed.\n"); flow_table = odp_shm_addr(hash_shm); if (!flow_table) - EXAMPLE_ABORT("Error: shared mem alloc failed.\n"); + ODPH_ABORT("Error: shared mem alloc failed.\n"); /*Inialize Locks*/ for (i = 0; i < bucket_count; i++) { bucket = &flow_table[i]; @@ -62,12 +62,12 @@ void init_fwd_db(void) 0);
if (shm == ODP_SHM_INVALID) - EXAMPLE_ABORT("Error: shared mem reserve failed.\n"); + ODPH_ABORT("Error: shared mem reserve failed.\n");
fwd_db = odp_shm_addr(shm);
if (fwd_db == NULL) - EXAMPLE_ABORT("Error: shared mem alloc failed.\n"); + ODPH_ABORT("Error: shared mem alloc failed.\n"); memset(fwd_db, 0, sizeof(*fwd_db)); }
diff --git a/example/ipsec_offload/odp_ipsec_offload_fwd_db.h b/example/ipsec_offload/odp_ipsec_offload_fwd_db.h index 864c0ab55..f9f448aea 100644 --- a/example/ipsec_offload/odp_ipsec_offload_fwd_db.h +++ b/example/ipsec_offload/odp_ipsec_offload_fwd_db.h @@ -12,7 +12,8 @@ extern "C" { #endif
#include <odp.h> -#include <odp/helper/eth.h> +#include <odp/helper/odph_api.h> + #include <odp_ipsec_offload_misc.h>
#define OIF_LEN 32 @@ -120,7 +121,7 @@ static inline void route_flow_insert_in_bucket(flow_entry_t *flow, flow_bucket_t *bkt = (flow_bucket_t *)bucket;
if (!flow) { - EXAMPLE_ERR("Invalid flow entry passed\n"); + ODPH_ERR("Invalid flow entry passed\n"); return; }
diff --git a/example/ipsec_offload/odp_ipsec_offload_sa_db.c b/example/ipsec_offload/odp_ipsec_offload_sa_db.c index 5c1264838..f61fd34db 100644 --- a/example/ipsec_offload/odp_ipsec_offload_sa_db.c +++ b/example/ipsec_offload/odp_ipsec_offload_sa_db.c @@ -10,9 +10,8 @@ #include <stdlib.h> #include <string.h>
-#include <example_debug.h> - #include <odp.h> +#include <odp/helper/odph_api.h>
#include <odp_ipsec_offload_sa_db.h>
@@ -32,12 +31,12 @@ void init_sa_db(void) 0);
if (shm == ODP_SHM_INVALID) - EXAMPLE_ABORT("Error: shared mem reserve failed.\n"); + ODPH_ABORT("Error: shared mem reserve failed.\n");
sa_db = odp_shm_addr(shm);
if (sa_db == NULL) - EXAMPLE_ABORT("Error: shared mem alloc failed.\n"); + ODPH_ABORT("Error: shared mem alloc failed.\n"); memset(sa_db, 0, sizeof(*sa_db)); }
@@ -51,12 +50,12 @@ void init_tun_db(void) 0);
if (shm == ODP_SHM_INVALID) - EXAMPLE_ABORT("Error: shared mem reserve failed.\n"); + ODPH_ABORT("Error: shared mem reserve failed.\n");
tun_db = odp_shm_addr(shm);
if (!tun_db) - EXAMPLE_ABORT("Error: shared mem alloc failed.\n"); + ODPH_ABORT("Error: shared mem alloc failed.\n"); memset(tun_db, 0, sizeof(*tun_db)); }
diff --git a/example/ipsec_offload/odp_ipsec_offload_sp_db.c b/example/ipsec_offload/odp_ipsec_offload_sp_db.c index cfa8cb94c..ac8aa148e 100644 --- a/example/ipsec_offload/odp_ipsec_offload_sp_db.c +++ b/example/ipsec_offload/odp_ipsec_offload_sp_db.c @@ -10,9 +10,8 @@ #include <stdlib.h> #include <string.h>
-#include <example_debug.h> - #include <odp.h> +#include <odp/helper/odph_api.h>
#include <odp_ipsec_offload_sp_db.h>
@@ -29,12 +28,12 @@ void init_sp_db(void) 0);
if (shm == ODP_SHM_INVALID) - EXAMPLE_ABORT("Error: shared mem reserve failed.\n"); + ODPH_ABORT("Error: shared mem reserve failed.\n");
sp_db = odp_shm_addr(shm);
if (sp_db == NULL) - EXAMPLE_ABORT("Error: shared mem alloc failed.\n"); + ODPH_ABORT("Error: shared mem alloc failed.\n"); memset(sp_db, 0, sizeof(*sp_db)); }
diff --git a/example/l3fwd/odp_l3fwd.c b/example/l3fwd/odp_l3fwd.c index 4bf265863..79613d672 100644 --- a/example/l3fwd/odp_l3fwd.c +++ b/example/l3fwd/odp_l3fwd.c @@ -11,8 +11,6 @@ #include <unistd.h> #include <inttypes.h>
-#include <example_debug.h> - #include <odp_api.h> #include <odp/helper/odph_api.h>
@@ -317,7 +315,7 @@ static int run_worker(void *arg) }
if (num_pktio == 0) - EXAMPLE_ABORT("No pktio devices found\n"); + ODPH_ABORT("No pktio devices found\n");
if_idx = input_ifs[pktio]; inq = input_queues[pktio]; @@ -735,31 +733,28 @@ static void setup_worker_qconf(app_args_t *args)
q = &args->qconf_config[i]; if (q->core_idx >= nb_worker || q->if_idx >= if_count) - EXAMPLE_ABORT("Error queue (%d, %d, %d), max port: " - "%d, max core: %d\n", q->if_idx, - q->rxq_idx, q->core_idx, - args->if_count - 1, - args->worker_count - 1); + ODPH_ABORT("Error queue (%d, %d, %d), max port: %d, " + "max core: %d\n", q->if_idx, q->rxq_idx, + q->core_idx, args->if_count - 1, + args->worker_count - 1);
/* check if one queue is configured twice or more */ if (queue_mask[q->if_idx][q->rxq_idx]) - EXAMPLE_ABORT("Error queue (%d, %d, %d)," - " reconfig queue\n", - q->if_idx, q->rxq_idx, q->core_idx); + ODPH_ABORT("Error queue (%d, %d, %d), reconfig queue\n", + q->if_idx, q->rxq_idx, q->core_idx); queue_mask[q->if_idx][q->rxq_idx] = 1;
port = &global->l3fwd_pktios[q->if_idx]; if (port->rxq_idx < q->rxq_idx) - EXAMPLE_ABORT("Error queue (%d, %d, %d), queue should" - " be in sequence and start from 0, queue" - " %d\n", - q->if_idx, q->rxq_idx, q->core_idx, - q->rxq_idx); + ODPH_ABORT("Error queue (%d, %d, %d), queue should be " + "in sequence and start from 0, queue %d\n", + q->if_idx, q->rxq_idx, q->core_idx, + q->rxq_idx);
if (q->rxq_idx > port->nb_rxq) { - EXAMPLE_ABORT("Error queue (%d, %d, %d), max queue %d\n", - q->if_idx, q->rxq_idx, q->core_idx, - port->nb_rxq - 1); + ODPH_ABORT("Error queue (%d, %d, %d), max queue %d\n", + q->if_idx, q->rxq_idx, q->core_idx, + port->nb_rxq - 1); } port->rxq_idx = q->rxq_idx + 1;
@@ -820,8 +815,8 @@ static void setup_worker_qconf(app_args_t *args) }
if (odp_pktin_queue_config(port->pktio, &in_queue_param)) - EXAMPLE_ABORT("Fail to config input queue for port %s\n", - name); + ODPH_ABORT("Fail to config input queue for port %s\n", + name);
out_queue_param.num_queues = port->txq_idx; if (port->txq_idx > port->nb_txq) { @@ -829,20 +824,20 @@ static void setup_worker_qconf(app_args_t *args) out_queue_param.op_mode = ODP_PKTIO_OP_MT; } if (odp_pktout_queue_config(port->pktio, &out_queue_param)) - EXAMPLE_ABORT("Fail to config output queue for port %s\n", - name); + ODPH_ABORT("Fail to config output queue for port %s\n", + name);
inq = port->ifin; nb_rxq = in_queue_param.num_queues; if (odp_pktin_queue(port->pktio, inq, nb_rxq) != nb_rxq) - EXAMPLE_ABORT("Fail to set pktin queue for port %s\n", - name); + ODPH_ABORT("Fail to set pktin queue for port %s\n", + name);
outq = port->ifout; nb_txq = out_queue_param.num_queues; if (odp_pktout_queue(port->pktio, outq, nb_txq) != nb_txq) - EXAMPLE_ABORT("Fail to set pktout queue for port %s\n", - name); + ODPH_ABORT("Fail to set pktout queue for port %s\n", + name); } }
diff --git a/example/l3fwd/odp_l3fwd_db.c b/example/l3fwd/odp_l3fwd_db.c index a27801a5a..a4e4681f6 100644 --- a/example/l3fwd/odp_l3fwd_db.c +++ b/example/l3fwd/odp_l3fwd_db.c @@ -11,8 +11,9 @@ #include <stdlib.h> #include <string.h>
-#include <example_debug.h> #include <odp_api.h> +#include <odp/helper/odph_api.h> + #include <odp_l3fwd_db.h>
/** Jenkins hash support. @@ -203,13 +204,13 @@ static void create_fwd_hash_cache(void) hash_shm = odp_shm_reserve("flow_table", size, ODP_CACHE_LINE_SIZE, 0); if (hash_shm == ODP_SHM_INVALID) { - EXAMPLE_ERR("Error: shared mem reserve failed.\n"); + ODPH_ERR("Error: shared mem reserve failed.\n"); exit(EXIT_FAILURE); }
bucket = odp_shm_addr(hash_shm); if (!bucket) { - EXAMPLE_ERR("Error: shared mem alloc failed.\n"); + ODPH_ERR("Error: shared mem alloc failed.\n"); exit(-1); } } @@ -349,14 +350,14 @@ void init_fwd_db(void) 0);
if (shm == ODP_SHM_INVALID) { - EXAMPLE_ERR("Error: shared mem reserve failed.\n"); + ODPH_ERR("Error: shared mem reserve failed.\n"); exit(EXIT_FAILURE); }
fwd_db = odp_shm_addr(shm);
if (fwd_db == NULL) { - EXAMPLE_ERR("Error: shared mem alloc failed.\n"); + ODPH_ERR("Error: shared mem alloc failed.\n"); exit(EXIT_FAILURE); } memset(fwd_db, 0, sizeof(*fwd_db)); diff --git a/example/l3fwd/odp_l3fwd_lpm.c b/example/l3fwd/odp_l3fwd_lpm.c index f88303399..7eb32b5d0 100644 --- a/example/l3fwd/odp_l3fwd_lpm.c +++ b/example/l3fwd/odp_l3fwd_lpm.c @@ -10,8 +10,8 @@ #include <stdio.h> #include <stdlib.h>
-#include <example_debug.h> #include <odp_api.h> +#include <odp/helper/odph_api.h>
#include <odp_l3fwd_lpm.h>
@@ -155,13 +155,13 @@ void fib_tbl_init(void) /*Reserve memory for Routing hash table*/ lpm_shm = odp_shm_reserve("fib_lpm_sub", size, ODP_CACHE_LINE_SIZE, 0); if (lpm_shm == ODP_SHM_INVALID) { - EXAMPLE_ERR("Error: shared mem reserve failed.\n"); + ODPH_ERR("Error: shared mem reserve failed.\n"); exit(EXIT_FAILURE); }
fe = odp_shm_addr(lpm_shm); if (!fe) { - EXAMPLE_ERR("Error: shared mem alloc failed for lpm cache.\n"); + ODPH_ERR("Error: shared mem alloc failed for lpm cache.\n"); exit(-1); }
diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c index 55e217e54..24aa039d5 100644 --- a/example/packet/odp_pktio.c +++ b/example/packet/odp_pktio.c @@ -10,8 +10,6 @@ #include <unistd.h> #include <inttypes.h>
-#include <example_debug.h> - #include <odp_api.h> #include <odp/helper/odph_api.h>
@@ -133,13 +131,13 @@ static odp_pktio_t create_pktio(const char *dev, odp_pool_t pool, int mode) pktio_param.in_mode = ODP_PKTIN_MODE_SCHED; break; default: - EXAMPLE_ABORT("invalid mode %d\n", mode); + ODPH_ABORT("invalid mode %d\n", mode); }
/* Open a packet IO instance */ pktio = odp_pktio_open(dev, pool, &pktio_param); if (pktio == ODP_PKTIO_INVALID) - EXAMPLE_ABORT("Error: pktio create failed for %s\n", dev); + ODPH_ABORT("Error: pktio create failed for %s\n", dev);
odp_pktin_queue_param_init(&pktin_param);
@@ -147,14 +145,14 @@ static odp_pktio_t create_pktio(const char *dev, odp_pool_t pool, int mode) pktin_param.queue_param.sched.sync = ODP_SCHED_SYNC_ATOMIC;
if (odp_pktin_queue_config(pktio, &pktin_param)) - EXAMPLE_ABORT("Error: pktin config failed for %s\n", dev); + ODPH_ABORT("Error: pktin config failed for %s\n", dev);
if (odp_pktout_queue_config(pktio, NULL)) - EXAMPLE_ABORT("Error: pktout config failed for %s\n", dev); + ODPH_ABORT("Error: pktout config failed for %s\n", dev);
ret = odp_pktio_start(pktio); if (ret != 0) - EXAMPLE_ABORT("Error: unable to start %s\n", dev); + ODPH_ABORT("Error: unable to start %s\n", dev);
printf(" created pktio:%02" PRIu64 ", dev:%s, queue mode (ATOMIC queues)\n" @@ -188,8 +186,8 @@ static int pktio_queue_thread(void *arg)
pktio = odp_pktio_lookup(thr_args->pktio_dev); if (pktio == ODP_PKTIO_INVALID) { - EXAMPLE_ERR(" [%02i] Error: lookup of pktio %s failed\n", - thr, thr_args->pktio_dev); + ODPH_ERR(" [%02i] Error: lookup of pktio %s failed\n", + thr, thr_args->pktio_dev); return -1; }
@@ -202,8 +200,8 @@ static int pktio_queue_thread(void *arg)
if ((thr_args->mode == APPL_MODE_PKT_QUEUE) && (odp_pktin_event_queue(pktio, &inq, 1) != 1)) { - EXAMPLE_ERR(" [%02i] Error: no input queue for %s\n", - thr, thr_args->pktio_dev); + ODPH_ERR(" [%02i] Error: no input queue for %s\n", + thr, thr_args->pktio_dev); return -1; }
@@ -225,14 +223,14 @@ static int pktio_queue_thread(void *arg)
/* Drop packets with errors */ if (odp_unlikely(drop_err_pkts(&pkt, 1) == 0)) { - EXAMPLE_ERR("Drop frame - err_cnt:%lu\n", ++err_cnt); + ODPH_ERR("Drop frame - err_cnt:%lu\n", ++err_cnt); continue; }
pktio_tmp = odp_packet_input(pkt);
if (odp_pktout_queue(pktio_tmp, &pktout, 1) != 1) { - EXAMPLE_ERR(" [%02i] Error: no pktout queue\n", thr); + ODPH_ERR(" [%02i] Error: no pktout queue\n", thr); return -1; }
@@ -241,7 +239,7 @@ static int pktio_queue_thread(void *arg)
/* Enqueue the packet for output */ if (odp_pktout_send(pktout, &pkt, 1) != 1) { - EXAMPLE_ERR(" [%i] Packet send failed.\n", thr); + ODPH_ERR(" [%i] Packet send failed.\n", thr); odp_packet_free(pkt); continue; } @@ -279,8 +277,8 @@ static int pktio_ifburst_thread(void *arg)
pktio = odp_pktio_lookup(thr_args->pktio_dev); if (pktio == ODP_PKTIO_INVALID) { - EXAMPLE_ERR(" [%02i] Error: lookup of pktio %s failed\n", - thr, thr_args->pktio_dev); + ODPH_ERR(" [%02i] Error: lookup of pktio %s failed\n", + thr, thr_args->pktio_dev); return -1; }
@@ -288,12 +286,12 @@ static int pktio_ifburst_thread(void *arg) thr, odp_pktio_to_u64(pktio));
if (odp_pktin_queue(pktio, &pktin, 1) != 1) { - EXAMPLE_ERR(" [%02i] Error: no pktin queue\n", thr); + ODPH_ERR(" [%02i] Error: no pktin queue\n", thr); return -1; }
if (odp_pktout_queue(pktio, &pktout, 1) != 1) { - EXAMPLE_ERR(" [%02i] Error: no pktout queue\n", thr); + ODPH_ERR(" [%02i] Error: no pktout queue\n", thr); return -1; }
@@ -320,8 +318,8 @@ static int pktio_ifburst_thread(void *arg) }
if (odp_unlikely(pkts_ok != pkts)) - EXAMPLE_ERR("Dropped frames:%u - err_cnt:%lu\n", - pkts-pkts_ok, ++err_cnt); + ODPH_ERR("Dropped frames:%u - err_cnt:%lu\n", + pkts - pkts_ok, ++err_cnt);
/* Print packet counts every once in a while */ tmp += pkts_ok; @@ -360,7 +358,7 @@ int main(int argc, char *argv[]) /* Let helper collect its own arguments (e.g. --odph_proc) */ argc = odph_parse_options(argc, argv); if (odph_options(&helper_options)) { - EXAMPLE_ERR("Error: reading ODP helper options failed.\n"); + ODPH_ERR("Error: reading ODP helper options failed.\n"); exit(EXIT_FAILURE); }
@@ -369,13 +367,13 @@ int main(int argc, char *argv[])
/* Init ODP before calling anything else */ if (odp_init_global(&instance, &init_param, NULL)) { - EXAMPLE_ERR("Error: ODP global init failed.\n"); + ODPH_ERR("Error: ODP global init failed.\n"); exit(EXIT_FAILURE); }
/* Init this thread */ if (odp_init_local(instance, ODP_THREAD_CONTROL)) { - EXAMPLE_ERR("Error: ODP local init failed.\n"); + ODPH_ERR("Error: ODP local init failed.\n"); exit(EXIT_FAILURE); }
@@ -383,13 +381,13 @@ int main(int argc, char *argv[]) shm = odp_shm_reserve("_appl_global_data", sizeof(args_t), ODP_CACHE_LINE_SIZE, 0); if (shm == ODP_SHM_INVALID) { - EXAMPLE_ERR("Error: shared mem reserve failed.\n"); + ODPH_ERR("Error: shared mem reserve failed.\n"); exit(EXIT_FAILURE); }
args = odp_shm_addr(shm); if (args == NULL) { - EXAMPLE_ERR("Error: shared mem alloc failed.\n"); + ODPH_ERR("Error: shared mem alloc failed.\n"); exit(EXIT_FAILURE); }
@@ -424,7 +422,7 @@ int main(int argc, char *argv[]) pool = odp_pool_create("packet_pool", ¶ms);
if (pool == ODP_POOL_INVALID) { - EXAMPLE_ERR("Error: packet pool create failed.\n"); + ODPH_ERR("Error: packet pool create failed.\n"); exit(EXIT_FAILURE); } odp_pool_print(pool); @@ -500,7 +498,7 @@ int main(int argc, char *argv[]) odp_pool_destroy(pool);
if (odp_shm_free(args->shm)) { - EXAMPLE_ERR("Error: shm free global data\n"); + ODPH_ERR("Error: shm free global data\n"); exit(EXIT_FAILURE); }
diff --git a/example/time/time_global_test.c b/example/time/time_global_test.c index 1e5cb0bd4..3c5d15b85 100644 --- a/example/time/time_global_test.c +++ b/example/time/time_global_test.c @@ -7,7 +7,6 @@ #include <inttypes.h>
#include <odp_api.h> -#include <example_debug.h> #include <odp/helper/odph_api.h>
#define MAX_WORKERS 32 @@ -106,8 +105,8 @@ static void generate_next_queue(test_globals_t *gbls, odp_queue_t *queue, *queue = odp_queue_lookup(queue_name);
if (ODP_QUEUE_INVALID == *queue) - EXAMPLE_ABORT("Cannot lookup thread queue "%s", thread %d\n", - queue_name, thr); + ODPH_ABORT("Cannot lookup thread queue "%s", thread %d\n", + queue_name, thr); }
static void test_global_timestamps(test_globals_t *gbls, @@ -134,11 +133,11 @@ static void test_global_timestamps(test_globals_t *gbls,
time = odp_time_global(); if (odp_time_cmp(time, timestamp_ev->timestamp) < 0) { - EXAMPLE_ERR("timestamp is less than previous time_prev=%" - PRIu64 "ns, time_next=%" - PRIu64 "ns, thread %d\n", - odp_time_to_ns(timestamp_ev->timestamp), - odp_time_to_ns(time), thr); + ODPH_ERR("timestamp is less than previous time_prev=%" + PRIu64 "ns, time_next=%" + PRIu64 "ns, thread %d\n", + odp_time_to_ns(timestamp_ev->timestamp), + odp_time_to_ns(time), thr); odp_atomic_inc_u32(&gbls->err_counter); }
@@ -152,11 +151,10 @@ static void test_global_timestamps(test_globals_t *gbls, generate_next_queue(gbls, &queue_next, id); timestamp_ev->timestamp = time; if (odp_queue_enq(queue_next, ev)) - EXAMPLE_ABORT("Cannot enqueue event %" - PRIu64 " on queue %" - PRIu64 ", thread %d\n", - odp_event_to_u64(ev), - odp_queue_to_u64(queue_next), thr); + ODPH_ABORT("Cannot enqueue event %" PRIu64 " on queue " + "%" PRIu64 ", thread %d\n", + odp_event_to_u64(ev), + odp_queue_to_u64(queue_next), thr);
odp_atomic_inc_u32(&gbls->iteration_counter); } @@ -194,16 +192,16 @@ static int run_thread(void *ptr) sprintf(queue_name, QUEUE_NAME_PREFIX "%d", id); queue = odp_queue_create(queue_name, NULL); if (queue == ODP_QUEUE_INVALID) - EXAMPLE_ABORT("Cannot create thread queue, thread %d", thr); + ODPH_ABORT("Cannot create thread queue, thread %d", thr);
/* allocate buffer for timestamp */ buffer_pool = odp_pool_lookup("time buffers pool"); if (buffer_pool == ODP_POOL_INVALID) - EXAMPLE_ABORT("Buffer pool was not found, thread %d\n", thr); + ODPH_ABORT("Buffer pool was not found, thread %d\n", thr);
buf = odp_buffer_alloc(buffer_pool); if (buf == ODP_BUFFER_INVALID) - EXAMPLE_ABORT("Buffer was not allocated, thread %d\n", thr); + ODPH_ABORT("Buffer was not allocated, thread %d\n", thr);
/* wait all threads allocated their queues */ odp_barrier_wait(&gbls->start_barrier); @@ -217,10 +215,9 @@ static int run_thread(void *ptr) timestamp_ev->id = id; timestamp_ev->timestamp = odp_time_global(); if (odp_queue_enq(queue_next, ev)) - EXAMPLE_ABORT("Cannot enqueue timestamp event %" - PRIu64 " on queue %" PRIu64 ", thread %d", - odp_event_to_u64(ev), - odp_queue_to_u64(queue_next), thr); + ODPH_ABORT("Cannot enqueue timestamp event %" PRIu64 " on " + "queue %" PRIu64 ", thread %d", odp_event_to_u64(ev), + odp_queue_to_u64(queue_next), thr);
test_global_timestamps(gbls, queue, id);
@@ -239,8 +236,8 @@ static int run_thread(void *ptr)
/* free allocated queue */ if (odp_queue_destroy(queue)) - EXAMPLE_ABORT("Cannot destroy queue %" PRIu64 "", - odp_queue_to_u64(queue)); + ODPH_ABORT("Cannot destroy queue %" PRIu64 "", + odp_queue_to_u64(queue));
printf("Thread %i exits\n", thr); fflush(NULL); @@ -271,7 +268,7 @@ int main(int argc, char *argv[]) /* Let helper collect its own arguments (e.g. --odph_proc) */ argc = odph_parse_options(argc, argv); if (odph_options(&helper_options)) { - EXAMPLE_ERR("Error: reading ODP helper options failed.\n"); + ODPH_ERR("Error: reading ODP helper options failed.\n"); exit(EXIT_FAILURE); }
@@ -280,14 +277,14 @@ int main(int argc, char *argv[])
if (odp_init_global(&instance, &init_param, NULL)) { err = 1; - EXAMPLE_ERR("ODP global init failed.\n"); + ODPH_ERR("ODP global init failed.\n"); goto end; }
/* Init this thread. */ if (odp_init_local(instance, ODP_THREAD_CONTROL)) { err = 1; - EXAMPLE_ERR("ODP local init failed.\n"); + ODPH_ERR("ODP local init failed.\n"); goto err_global; }
@@ -298,7 +295,7 @@ int main(int argc, char *argv[]) ODP_CACHE_LINE_SIZE, 0); if (ODP_SHM_INVALID == shm_glbls) { err = 1; - EXAMPLE_ERR("Error: shared mem reserve failed.\n"); + ODPH_ERR("Error: shared mem reserve failed.\n"); goto err; }
@@ -307,7 +304,7 @@ int main(int argc, char *argv[]) shm_log = odp_shm_reserve("test_log", log_size, ODP_CACHE_LINE_SIZE, 0); if (ODP_SHM_INVALID == shm_log) { err = 1; - EXAMPLE_ERR("Error: shared mem reserve failed.\n"); + ODPH_ERR("Error: shared mem reserve failed.\n"); goto err; }
@@ -326,7 +323,7 @@ int main(int argc, char *argv[])
if (odp_pool_capability(&pool_capa)) { err = 1; - EXAMPLE_ERR("Error: pool capability failed.\n"); + ODPH_ERR("Error: pool capability failed.\n"); goto err; }
@@ -343,7 +340,7 @@ int main(int argc, char *argv[]) pool = odp_pool_create("time buffers pool", &pool_param); if (pool == ODP_POOL_INVALID) { err = 1; - EXAMPLE_ERR("Pool create failed.\n"); + ODPH_ERR("Pool create failed.\n"); goto err; }
@@ -386,7 +383,7 @@ err_global: err = 1; end: if (err) { - EXAMPLE_ERR("Err: ODP global time test failed\n\n"); + ODPH_ERR("Err: ODP global time test failed\n\n"); return -1; }
diff --git a/example/timer/odp_timer_simple.c b/example/timer/odp_timer_simple.c index ddefb0d2a..8084a4568 100644 --- a/example/timer/odp_timer_simple.c +++ b/example/timer/odp_timer_simple.c @@ -13,11 +13,12 @@ #include <string.h> #include <stdlib.h> #include <inttypes.h> -#include <example_debug.h>
/* ODP main header */ #include <odp_api.h>
+#include <odp/helper/odph_api.h> + #define MAX(a, b) (((a) > (b)) ? (a) : (b))
int main(int argc ODP_UNUSED, char *argv[] ODP_UNUSED) @@ -101,14 +102,14 @@ int main(int argc ODP_UNUSED, char *argv[] ODP_UNUSED)
tim = odp_timer_alloc(timer_pool, queue, NULL); if (tim == ODP_TIMER_INVALID) { - EXAMPLE_ERR("Failed to allocate timer\n"); + ODPH_ERR("Failed to allocate timer\n"); ret += 1; goto err; }
tmo = odp_timeout_alloc(timeout_pool); if (tmo == ODP_TIMEOUT_INVALID) { - EXAMPLE_ERR("Failed to allocate timeout\n"); + ODPH_ERR("Failed to allocate timeout\n"); return -1; }
@@ -131,16 +132,15 @@ int main(int argc ODP_UNUSED, char *argv[] ODP_UNUSED) rc = odp_timer_set_abs(tim, tick + period, &ev); /* Too early or too late timeout requested */ if (odp_unlikely(rc != ODP_TIMER_SUCCESS)) - EXAMPLE_ABORT("odp_timer_set_abs() failed: %d\n", - rc); + ODPH_ABORT("odp_timer_set_abs() failed: %d\n", rc);
/* Wait for 2 seconds for timeout action to be generated */ ev = odp_schedule(&queue, sched_tmo); if (ev == ODP_EVENT_INVALID) - EXAMPLE_ABORT("Invalid event\n"); + ODPH_ABORT("Invalid event\n"); if (odp_event_type(ev) != ODP_EVENT_TIMEOUT) - EXAMPLE_ABORT("Unexpected event type (%u) received\n", - odp_event_type(ev)); + ODPH_ABORT("Unexpected event type (%u) received\n", + odp_event_type(ev));
time = odp_time_global(); printf("timer tick %d, time ns %" PRIu64 "\n", diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c index ca3e8ddf5..a6c8dc73f 100644 --- a/example/timer/odp_timer_test.c +++ b/example/timer/odp_timer_test.c @@ -8,8 +8,6 @@ #include <stdlib.h> #include <inttypes.h>
-#include <example_debug.h> - /* ODP main header */ #include <odp_api.h>
@@ -92,28 +90,28 @@ static void test_abs_timeouts(int thr, test_globals_t *gbls) odp_timeout_t tmo; uint32_t num_workers = gbls->num_workers;
- EXAMPLE_DBG(" [%i] test_timeouts\n", thr); + ODPH_DBG(" [%i] test_timeouts\n", thr);
queue = odp_queue_lookup("timer_queue");
period_ns = gbls->args.period_us * ODP_TIME_USEC_IN_NS; period = odp_timer_ns_to_tick(gbls->tp, period_ns);
- EXAMPLE_DBG(" [%i] period %"PRIu64" ticks, %"PRIu64" ns\n", thr, - period, period_ns); + ODPH_DBG(" [%i] period %" PRIu64 " ticks, %" PRIu64 " ns\n", thr, + period, period_ns);
- EXAMPLE_DBG(" [%i] current tick %"PRIu64"\n", thr, - odp_timer_current_tick(gbls->tp)); + ODPH_DBG(" [%i] current tick %" PRIu64 "\n", thr, + odp_timer_current_tick(gbls->tp));
ttp = &gbls->tt[thr]; ttp->tim = odp_timer_alloc(gbls->tp, queue, ttp); if (ttp->tim == ODP_TIMER_INVALID) { - EXAMPLE_ERR("Failed to allocate timer\n"); + ODPH_ERR("Failed to allocate timer\n"); return; } tmo = odp_timeout_alloc(gbls->pool); if (tmo == ODP_TIMEOUT_INVALID) { - EXAMPLE_ERR("Failed to allocate timeout\n"); + ODPH_ERR("Failed to allocate timeout\n"); return; } ttp->ev = odp_timeout_to_event(tmo); @@ -129,8 +127,8 @@ static void test_abs_timeouts(int thr, test_globals_t *gbls) rc = odp_timer_set_abs(ttp->tim, tick, &ttp->ev); if (odp_unlikely(rc != ODP_TIMER_SUCCESS)) { /* Too early or too late timeout requested */ - EXAMPLE_ABORT("odp_timer_set_abs() failed: %s\n", - timerset2str(rc)); + ODPH_ABORT("odp_timer_set_abs() failed: %s\n", + timerset2str(rc)); } }
@@ -148,7 +146,7 @@ static void test_abs_timeouts(int thr, test_globals_t *gbls) * are no remaining timeouts to receive */ if (++wait > WAIT_NUM && odp_atomic_load_u32(&gbls->remain) < num_workers) - EXAMPLE_ABORT("At least one TMO was lost\n"); + ODPH_ABORT("At least one TMO was lost\n"); } while (ev == ODP_EVENT_INVALID && (int)odp_atomic_load_u32(&gbls->remain) > 0);
@@ -156,8 +154,8 @@ static void test_abs_timeouts(int thr, test_globals_t *gbls) break; /* No more timeouts */ if (odp_event_type(ev) != ODP_EVENT_TIMEOUT) { /* Not a default timeout event */ - EXAMPLE_ABORT("Unexpected event type (%u) received\n", - odp_event_type(ev)); + ODPH_ABORT("Unexpected event type (%u) received\n", + odp_event_type(ev)); } odp_timeout_t tmo = odp_timeout_from_event(ev); tick = odp_timeout_tick(tmo); @@ -166,18 +164,18 @@ static void test_abs_timeouts(int thr, test_globals_t *gbls) if (!odp_timeout_fresh(tmo)) { /* Not the expected expiration tick, timer has * been reset or cancelled or freed */ - EXAMPLE_ABORT("Unexpected timeout received (timer " - "%" PRIu64", tick %" PRIu64 ")\n", - odp_timer_to_u64(ttp->tim), tick); + ODPH_ABORT("Unexpected timeout received (timer " + "%" PRIu64 ", tick %" PRIu64 ")\n", + odp_timer_to_u64(ttp->tim), tick); } - EXAMPLE_DBG(" [%i] timeout, tick %"PRIu64"\n", thr, tick); + ODPH_DBG(" [%i] timeout, tick %" PRIu64 "\n", thr, tick);
uint32_t rx_num = odp_atomic_fetch_dec_u32(&gbls->remain);
if (!rx_num) - EXAMPLE_ABORT("Unexpected timeout received (timer " - "%" PRIu64 ", tick %" PRIu64 ")\n", - odp_timer_to_u64(ttp->tim), tick); + ODPH_ABORT("Unexpected timeout received (timer " + "%" PRIu64 ", tick %" PRIu64 ")\n", + odp_timer_to_u64(ttp->tim), tick); else if (rx_num > num_workers) continue;
@@ -215,7 +213,7 @@ static int run_thread(void *ptr) msg_pool = odp_pool_lookup("msg_pool");
if (msg_pool == ODP_POOL_INVALID) { - EXAMPLE_ERR(" [%i] msg_pool not found\n", thr); + ODPH_ERR(" [%i] msg_pool not found\n", thr); return -1; }
@@ -354,7 +352,7 @@ int main(int argc, char *argv[]) /* Let helper collect its own arguments (e.g. --odph_proc) */ argc = odph_parse_options(argc, argv); if (odph_options(&helper_options)) { - EXAMPLE_ERR("Error: reading ODP helper options failed.\n"); + ODPH_ERR("Error: reading ODP helper options failed.\n"); exit(EXIT_FAILURE); }
@@ -382,14 +380,14 @@ int main(int argc, char *argv[]) ODP_CACHE_LINE_SIZE, 0); if (ODP_SHM_INVALID == shm) { err = 1; - EXAMPLE_ERR("Error: shared mem reserve failed.\n"); + ODPH_ERR("Error: shared mem reserve failed.\n"); goto err; }
gbls = odp_shm_addr(shm); if (NULL == gbls) { err = 1; - EXAMPLE_ERR("Error: shared mem alloc failed.\n"); + ODPH_ERR("Error: shared mem alloc failed.\n"); goto err; } memset(gbls, 0, sizeof(test_globals_t)); @@ -432,7 +430,7 @@ int main(int argc, char *argv[])
if (gbls->pool == ODP_POOL_INVALID) { err = 1; - EXAMPLE_ERR("Pool create failed.\n"); + ODPH_ERR("Pool create failed.\n"); goto err; }
@@ -445,7 +443,7 @@ int main(int argc, char *argv[]) gbls->tp = odp_timer_pool_create("timer_pool", &tparams); if (gbls->tp == ODP_TIMER_POOL_INVALID) { err = 1; - EXAMPLE_ERR("Timer pool create failed.\n"); + ODPH_ERR("Timer pool create failed.\n"); goto err; } odp_timer_pool_start(); @@ -473,7 +471,7 @@ int main(int argc, char *argv[])
if (queue == ODP_QUEUE_INVALID) { err = 1; - EXAMPLE_ERR("Timer queue create failed.\n"); + ODPH_ERR("Timer queue create failed.\n"); goto err; }
diff --git a/example/traffic_mgmt/odp_traffic_mgmt.c b/example/traffic_mgmt/odp_traffic_mgmt.c index dbc659589..c80e03bab 100644 --- a/example/traffic_mgmt/odp_traffic_mgmt.c +++ b/example/traffic_mgmt/odp_traffic_mgmt.c @@ -8,14 +8,16 @@
#define _GNU_SOURCE
-#include <unistd.h> -#include <signal.h> -#include <string.h> +#include <execinfo.h> #include <inttypes.h> +#include <signal.h> #include <sys/resource.h> -#include <execinfo.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> + #include <odp_api.h> -#include <example_debug.h>
#define NUM_SVC_CLASSES 4 #define USERS_PER_SVC_CLASS 2
commit 9585df1b0fc62cdb645f1faeeb05fbe1a365197d Author: Matias Elo matias.elo@nokia.com Date: Mon Sep 16 15:46:39 2019 +0300
helper: debug: remove duplicate ODPH_UNUSED macro
ODP API already has ODP_UNUSED macro.
Signed-off-by: Matias Elo matias.elo@nokia.com Reviewed-by: Petri Savolainen petri.savolainen@nokia.com
diff --git a/configure.ac b/configure.ac index 32b38868f..2eb284a7c 100644 --- a/configure.ac +++ b/configure.ac @@ -22,7 +22,7 @@ AC_SUBST(ODP_VERSION_API_MINOR) ########################################################################## m4_define([odph_version_generation], [1]) m4_define([odph_version_major], [0]) -m4_define([odph_version_minor], [2]) +m4_define([odph_version_minor], [3])
m4_define([odph_version], [odph_version_generation.odph_version_major.odph_version_minor]) diff --git a/helper/include/odp/helper/odph_debug.h b/helper/include/odp/helper/odph_debug.h index 04d839b1d..ef520497b 100644 --- a/helper/include/odp/helper/odph_debug.h +++ b/helper/include/odp/helper/odph_debug.h @@ -24,6 +24,10 @@ extern "C" { #endif
+/** @addtogroup odph_debug ODPH DEBUG + * @{ + */ + /** * Assert macro for applications and helper code * @@ -97,11 +101,6 @@ do { \ * @} */
-/** - * Mark intentionally unused argument for functions - */ -#define ODPH_UNUSED __attribute__((__unused__)) - #ifdef __cplusplus } #endif diff --git a/helper/lineartable.c b/helper/lineartable.c index 8479d2f1a..864c7973f 100644 --- a/helper/lineartable.c +++ b/helper/lineartable.c @@ -43,7 +43,7 @@ typedef struct { */
odph_table_t odph_linear_table_create(const char *name, uint32_t capacity, - uint32_t un ODPH_UNUSED, + uint32_t un ODP_UNUSED, uint32_t value_size) { uint32_t idx; @@ -181,7 +181,7 @@ static int odph_lineartable_put_value(odph_table_t table, /* should make sure the input table exists and is available */ static int odph_lineartable_get_value(odph_table_t table, void *key, void *buffer, - uint32_t buffer_size ODPH_UNUSED) + uint32_t buffer_size ODP_UNUSED) { odph_linear_table_imp *tbl; uint32_t ikey = 0; diff --git a/helper/test/chksum.c b/helper/test/chksum.c index 9fa4ec18a..a569f2394 100644 --- a/helper/test/chksum.c +++ b/helper/test/chksum.c @@ -20,7 +20,7 @@ struct udata_struct { };
/* Create additional dataplane threads */ -int main(int argc ODPH_UNUSED, char *argv[] ODPH_UNUSED) +int main(int argc ODP_UNUSED, char *argv[] ODP_UNUSED) { odp_instance_t instance; int status = 0; diff --git a/helper/test/cuckootable.c b/helper/test/cuckootable.c index ee5f1d832..22df27f3d 100644 --- a/helper/test/cuckootable.c +++ b/helper/test/cuckootable.c @@ -542,7 +542,7 @@ test_cuckoo_hash_table(void) return 0; }
-int main(int argc ODPH_UNUSED, char *argv[] ODPH_UNUSED) +int main(int argc ODP_UNUSED, char *argv[] ODP_UNUSED) { odp_instance_t instance; int ret = 0; diff --git a/helper/test/iplookuptable.c b/helper/test/iplookuptable.c index 6637242d8..8ffc75efe 100644 --- a/helper/test/iplookuptable.c +++ b/helper/test/iplookuptable.c @@ -138,7 +138,7 @@ static int test_ip_lookup_table(void) return 0; }
-int main(int argc ODPH_UNUSED, char *argv[] ODPH_UNUSED) +int main(int argc ODP_UNUSED, char *argv[] ODP_UNUSED) { odp_instance_t instance; int ret = 0; diff --git a/helper/test/linux/process.c b/helper/test/linux/process.c index 26c9649d6..0bc53e5a7 100644 --- a/helper/test/linux/process.c +++ b/helper/test/linux/process.c @@ -15,7 +15,7 @@
#define NUMBER_WORKERS 16 /* 0 = max */
-static void *worker_fn(void *arg ODPH_UNUSED) +static void *worker_fn(void *arg ODP_UNUSED) { /* depend on the odp helper to call odp_init_local */ printf("Worker thread on CPU %d\n", odp_cpu_id()); @@ -24,7 +24,7 @@ static void *worker_fn(void *arg ODPH_UNUSED) }
/* Create additional dataplane processes */ -int main(int argc ODPH_UNUSED, char *argv[] ODPH_UNUSED) +int main(int argc ODP_UNUSED, char *argv[] ODP_UNUSED) { odp_cpumask_t cpu_mask; int num_workers; diff --git a/helper/test/linux/pthread.c b/helper/test/linux/pthread.c index b0a578151..e14d5cdf8 100644 --- a/helper/test/linux/pthread.c +++ b/helper/test/linux/pthread.c @@ -13,7 +13,7 @@ #include <string.h>
#define NUMBER_WORKERS 16 -static void *worker_fn(void *arg ODPH_UNUSED) +static void *worker_fn(void *arg ODP_UNUSED) { /* depend on the odp helper to call odp_init_local */
@@ -25,7 +25,7 @@ static void *worker_fn(void *arg ODPH_UNUSED) }
/* Create additional dataplane threads */ -int main(int argc ODPH_UNUSED, char *argv[] ODPH_UNUSED) +int main(int argc ODP_UNUSED, char *argv[] ODP_UNUSED) { odph_linux_pthread_t thread_tbl[NUMBER_WORKERS]; odp_cpumask_t cpu_mask; diff --git a/helper/test/odpthreads.c b/helper/test/odpthreads.c index dbff4294e..83f9476fd 100644 --- a/helper/test/odpthreads.c +++ b/helper/test/odpthreads.c @@ -26,7 +26,7 @@ static void main_exit(void); /* ODP application instance */ static odp_instance_t odp_instance;
-static int worker_fn(void *arg ODPH_UNUSED) +static int worker_fn(void *arg ODP_UNUSED) { int cpu; odp_cpumask_t workers; diff --git a/helper/test/table.c b/helper/test/table.c index 2887bd599..1a889392c 100644 --- a/helper/test/table.c +++ b/helper/test/table.c @@ -25,7 +25,7 @@ * value (data): MAC address of the next hop station (6 bytes). */
-int main(int argc ODPH_UNUSED, char *argv[] ODPH_UNUSED) +int main(int argc ODP_UNUSED, char *argv[] ODP_UNUSED) { odp_instance_t instance; int ret = 0;
commit bc6bf0a4ff3c7b5f1a0709fcf6451683958a124b Author: Matias Elo matias.elo@nokia.com Date: Mon Sep 16 14:01:21 2019 +0300
helper: debug: add missing config header include
Signed-off-by: Matias Elo matias.elo@nokia.com Reviewed-by: Petri Savolainen petri.savolainen@nokia.com
diff --git a/helper/include/odp/helper/odph_debug.h b/helper/include/odp/helper/odph_debug.h index c99936f4b..04d839b1d 100644 --- a/helper/include/odp/helper/odph_debug.h +++ b/helper/include/odp/helper/odph_debug.h @@ -15,6 +15,8 @@ #ifndef ODPH_DEBUG_H_ #define ODPH_DEBUG_H_
+#include "config.h" + #include <stdio.h> #include <stdlib.h>
-----------------------------------------------------------------------
Summary of changes: configure.ac | 2 +- example/Makefile.am | 2 - example/classifier/odp_classifier.c | 66 ++-- example/example_debug.h | 93 ----- example/generator/odp_generator.c | 94 +++-- example/ipfragreass/odp_ipfragreass.c | 3 +- example/ipfragreass/odp_ipfragreass_atomics.h | 2 - example/ipfragreass/odp_ipfragreass_atomics_arm.h | 6 +- example/ipsec/odp_ipsec.c | 89 +++-- example/ipsec/odp_ipsec_cache.c | 8 +- example/ipsec/odp_ipsec_fwd_db.c | 7 +- example/ipsec/odp_ipsec_sa_db.c | 11 +- example/ipsec/odp_ipsec_sp_db.c | 7 +- example/ipsec/odp_ipsec_stream.c | 21 +- example/ipsec_api/odp_ipsec.c | 85 +++-- example/ipsec_api/odp_ipsec_cache.c | 13 +- example/ipsec_offload/odp_ipsec_offload.c | 73 ++-- example/ipsec_offload/odp_ipsec_offload_cache.c | 10 +- example/ipsec_offload/odp_ipsec_offload_fwd_db.c | 10 +- example/ipsec_offload/odp_ipsec_offload_fwd_db.h | 5 +- example/ipsec_offload/odp_ipsec_offload_sa_db.c | 11 +- example/ipsec_offload/odp_ipsec_offload_sp_db.c | 7 +- example/l3fwd/odp_l3fwd.c | 49 ++- example/l3fwd/odp_l3fwd_db.c | 11 +- example/l3fwd/odp_l3fwd_lpm.c | 6 +- example/packet/odp_pktio.c | 52 ++- example/time/time_global_test.c | 57 ++- example/timer/odp_timer_simple.c | 16 +- example/timer/odp_timer_test.c | 54 ++- example/traffic_mgmt/odp_traffic_mgmt.c | 12 +- helper/include/odp/helper/odph_debug.h | 11 +- helper/lineartable.c | 4 +- helper/test/chksum.c | 2 +- helper/test/cuckootable.c | 2 +- helper/test/iplookuptable.c | 2 +- helper/test/linux/process.c | 4 +- helper/test/linux/pthread.c | 4 +- helper/test/odpthreads.c | 2 +- helper/test/table.c | 2 +- platform/linux-generic/test/pktio_ipc/ipc_common.c | 14 +- platform/linux-generic/test/pktio_ipc/ipc_common.h | 2 - platform/linux-generic/test/pktio_ipc/pktio_ipc1.c | 51 ++- platform/linux-generic/test/pktio_ipc/pktio_ipc2.c | 38 +- platform/linux-generic/test/ring/ring_basic.c | 9 +- platform/linux-generic/test/ring/ring_stress.c | 15 +- platform/linux-generic/test/ring/ring_suites.c | 9 +- test/common/Makefile.am | 2 +- test/common/odp_cunit_common.c | 7 +- test/common/test_debug.h | 93 ----- test/performance/odp_bench_packet.c | 53 ++- test/performance/odp_cpu_bench.c | 60 ++-- test/performance/odp_l2fwd.c | 85 +++-- test/performance/odp_pktio_ordered.c | 63 ++-- test/performance/odp_pktio_perf.c | 70 ++-- test/performance/odp_sched_latency.c | 40 +-- test/performance/odp_scheduling.c | 62 ++-- .../api/classification/odp_classification_common.c | 8 +- test/validation/api/system/system.c | 10 +- test/validation/api/thread/thread.c | 5 +- test/validation/api/timer/timer.c | 160 +++++---- test/validation/api/traffic_mngr/traffic_mngr.c | 384 ++++++++++----------- 61 files changed, 930 insertions(+), 1225 deletions(-) delete mode 100644 example/example_debug.h delete mode 100644 test/common/test_debug.h
hooks/post-receive