lists.linaro.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
List overview
Download
git-lng-odp
September 2019
----- 2025 -----
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
git-lng-odp@lists.linaro.org
1 participants
5 discussions
Start a n
N
ew thread
[COMMIT] branch master updated. v1.21.0.0-212-g1fe4c8442
by git@git-us.linaro.org
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 1fe4c8442faf80f13582eb7ad37254ba8ade2cc6 (commit) via a285e616251254cce6faec1c0ff7cdd18e964948 (commit) from 9a2c3cdbb542c7514e5d89c38b5d3d534a7dc240 (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 1fe4c8442faf80f13582eb7ad37254ba8ade2cc6 Author: Petri Savolainen <petri.savolainen(a)nokia.com> Date: Mon Sep 16 16:31:51 2019 +0300 test: timer_perf: add new timer performance test Added new test application to measure schedule call CPU cycle consumption with various timer pool parameter combinations. This measurement is mostly interesting with software based timer implementations, where timers may be polled from the schedule call. Signed-off-by: Petri Savolainen <petri.savolainen(a)nokia.com> Reviewed-by: Matias Elo <matias.elo(a)nokia.com> diff --git a/test/performance/.gitignore b/test/performance/.gitignore index ca0e884fa..41e18facc 100644 --- a/test/performance/.gitignore +++ b/test/performance/.gitignore @@ -14,3 +14,4 @@ odp_sched_latency odp_sched_perf odp_sched_pktio odp_scheduling +odp_timer_perf diff --git a/test/performance/Makefile.am b/test/performance/Makefile.am index 887a013ed..29aee55bd 100644 --- a/test/performance/Makefile.am +++ b/test/performance/Makefile.am @@ -9,7 +9,8 @@ EXECUTABLES = odp_bench_packet \ odp_pktio_perf \ odp_pool_perf \ odp_queue_perf \ - odp_sched_perf + odp_sched_perf \ + odp_timer_perf COMPILE_ONLY = odp_l2fwd \ odp_pktio_ordered \ @@ -46,6 +47,7 @@ odp_pktio_perf_SOURCES = odp_pktio_perf.c odp_pool_perf_SOURCES = odp_pool_perf.c odp_queue_perf_SOURCES = odp_queue_perf.c odp_sched_perf_SOURCES = odp_sched_perf.c +odp_timer_perf_SOURCES = odp_timer_perf.c # l2fwd test depends on generator example EXTRA_odp_l2fwd_DEPENDENCIES = example-generator diff --git a/test/performance/odp_timer_perf.c b/test/performance/odp_timer_perf.c new file mode 100644 index 000000000..d0f936a8e --- /dev/null +++ b/test/performance/odp_timer_perf.c @@ -0,0 +1,716 @@ +/* Copyright (c) 2019, Nokia + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include <stdio.h> +#include <string.h> +#include <stdint.h> +#include <inttypes.h> +#include <signal.h> +#include <stdlib.h> +#include <getopt.h> + +#include <odp_api.h> +#include <odp/helper/odph_api.h> + +#define MAX_TIMER_POOLS 32 +#define MAX_TIMERS 10000 +#define START_NS (100 * ODP_TIME_MSEC_IN_NS) + +typedef struct test_options_t { + uint32_t num_cpu; + uint32_t num_tp; + uint32_t num_timer; + uint64_t res_ns; + uint64_t period_ns; + +} test_options_t; + +typedef struct time_stat_t { + uint64_t num; + uint64_t sum_ns; + uint64_t max_ns; + +} time_stat_t; + +typedef struct test_stat_t { + uint64_t rounds; + uint64_t events; + uint64_t nsec; + uint64_t cycles; + + time_stat_t before; + time_stat_t after; + +} test_stat_t; + +typedef struct thread_arg_t { + void *global; + +} thread_arg_t; + +typedef struct timer_ctx_t { + uint64_t target_ns; + int last; + +} timer_ctx_t; + +typedef struct test_global_t { + test_options_t test_options; + odp_atomic_u32_t exit_test; + odp_barrier_t barrier; + odp_cpumask_t cpumask; + odp_timer_pool_t tp[MAX_TIMER_POOLS]; + odp_pool_t pool[MAX_TIMER_POOLS]; + odp_queue_t queue[MAX_TIMER_POOLS]; + odp_timer_t timer[MAX_TIMER_POOLS][MAX_TIMERS]; + timer_ctx_t timer_ctx[MAX_TIMER_POOLS][MAX_TIMERS]; + odph_thread_t thread_tbl[ODP_THREAD_COUNT_MAX]; + test_stat_t stat[ODP_THREAD_COUNT_MAX]; + thread_arg_t thread_arg[ODP_THREAD_COUNT_MAX]; + +} test_global_t; + +test_global_t test_global; + +static void print_usage(void) +{ + printf("\n" + "Scheduler performance test\n" + "\n" + "Usage: odp_sched_perf [options]\n" + "\n" + " -c, --num_cpu Number of CPUs (worker threads). 0: all available CPUs. Default: 1\n" + " -n, --num_tp Number of timer pools. Default: 1\n" + " -t, --num_timer Number of timers per timer pool. Default: 10\n" + " -r, --res_ns Resolution in nsec. Default: 10000000\n" + " -p, --period_ns Timeout period in nsec. Default: 100000000\n" + " -h, --help This help\n" + "\n"); +} + +static int parse_options(int argc, char *argv[], test_options_t *test_options) +{ + int opt; + int long_index; + int ret = 0; + + static const struct option longopts[] = { + {"num_cpu", required_argument, NULL, 'c'}, + {"num_tp ", required_argument, NULL, 'n'}, + {"num_timer", required_argument, NULL, 't'}, + {"res_ns", required_argument, NULL, 'r'}, + {"period_ns", required_argument, NULL, 'p'}, + {"help", no_argument, NULL, 'h'}, + {NULL, 0, NULL, 0} + }; + + static const char *shortopts = "+c:n:t:r:p:h"; + + test_options->num_cpu = 1; + test_options->num_tp = 1; + test_options->num_timer = 10; + test_options->res_ns = 10 * ODP_TIME_MSEC_IN_NS; + test_options->period_ns = 100 * ODP_TIME_MSEC_IN_NS; + + while (1) { + opt = getopt_long(argc, argv, shortopts, longopts, &long_index); + + if (opt == -1) + break; + + switch (opt) { + case 'c': + test_options->num_cpu = atoi(optarg); + break; + case 'n': + test_options->num_tp = atoi(optarg); + break; + case 't': + test_options->num_timer = atoi(optarg); + break; + case 'r': + test_options->res_ns = atoll(optarg); + break; + case 'p': + test_options->period_ns = atoll(optarg); + break; + case 'h': + /* fall through */ + default: + print_usage(); + ret = -1; + break; + } + } + + if (test_options->num_timer > MAX_TIMERS) { + printf("Error: too many timers. Max %u\n", MAX_TIMERS); + ret = -1; + } + + return ret; +} + +static int set_num_cpu(test_global_t *global) +{ + int ret; + test_options_t *test_options = &global->test_options; + int num_cpu = test_options->num_cpu; + + /* One thread used for the main thread */ + if (num_cpu > ODP_THREAD_COUNT_MAX - 1) { + printf("Error: Too many workers. Maximum is %i.\n", + ODP_THREAD_COUNT_MAX - 1); + return -1; + } + + ret = odp_cpumask_default_worker(&global->cpumask, num_cpu); + + if (num_cpu && ret != num_cpu) { + printf("Error: Too many workers. Max supported %i\n.", ret); + return -1; + } + + /* Zero: all available workers */ + if (num_cpu == 0) { + num_cpu = ret; + test_options->num_cpu = num_cpu; + } + + /* Main thread + all workers */ + odp_barrier_init(&global->barrier, num_cpu + 1); + + return 0; +} + +static int create_timer_pools(test_global_t *global) +{ + odp_timer_capability_t timer_capa; + odp_timer_pool_param_t timer_pool_param; + odp_timer_pool_t tp; + odp_queue_param_t queue_param; + odp_queue_t queue; + odp_pool_param_t pool_param; + odp_pool_t pool; + uint64_t max_tmo_ns; + uint32_t i, j; + uint32_t max_timers; + test_options_t *test_options = &global->test_options; + uint32_t num_cpu = test_options->num_cpu; + uint32_t num_tp = test_options->num_tp; + uint32_t num_timer = test_options->num_timer; + uint64_t res_ns = test_options->res_ns; + uint64_t period_ns = test_options->period_ns; + + max_tmo_ns = START_NS + (num_timer * period_ns); + + printf("\nTimer performance test\n"); + printf(" num cpu %u\n", num_cpu); + printf(" num timer pool %u\n", num_tp); + printf(" num timer %u\n", num_timer); + printf(" resolution %" PRIu64 " nsec\n", res_ns); + printf(" period %" PRIu64 " nsec\n", period_ns); + printf(" first timer at %.2f sec\n", (double)START_NS / + ODP_TIME_SEC_IN_NS); + printf(" test duration %.2f sec\n", (double)max_tmo_ns / + ODP_TIME_SEC_IN_NS); + printf("\n"); + + for (i = 0; i < MAX_TIMER_POOLS; i++) { + global->tp[i] = ODP_TIMER_POOL_INVALID; + global->pool[i] = ODP_POOL_INVALID; + global->queue[i] = ODP_QUEUE_INVALID; + + for (j = 0; j < MAX_TIMERS; j++) + global->timer[i][j] = ODP_TIMER_INVALID; + } + + if (odp_timer_capability(ODP_CLOCK_CPU, &timer_capa)) { + printf("Error: timer capability failed\n"); + return -1; + } + + if (res_ns < timer_capa.max_res.res_ns) { + printf("Error: too high resolution\n"); + return -1; + } + + if (START_NS < timer_capa.max_res.min_tmo) { + printf("Error: too short min timeout\n"); + return -1; + } + + if (max_tmo_ns > timer_capa.max_res.max_tmo) { + printf("Error: too long max timeout\n"); + return -1; + } + + max_timers = timer_capa.max_timers; + if (max_timers && num_timer > max_timers) { + printf("Error: too many timers (max %u)\n", max_timers); + return -1; + } + + if (num_tp > timer_capa.max_pools) { + printf("Error: too many timer pools (max %u)\n", + timer_capa.max_pools); + return -1; + } + + memset(&timer_pool_param, 0, sizeof(odp_timer_pool_param_t)); + + timer_pool_param.res_ns = res_ns; + timer_pool_param.min_tmo = START_NS; + timer_pool_param.max_tmo = max_tmo_ns; + timer_pool_param.num_timers = num_timer; + timer_pool_param.priv = 0; + timer_pool_param.clk_src = ODP_CLOCK_CPU; + + odp_pool_param_init(&pool_param); + pool_param.type = ODP_POOL_TIMEOUT; + pool_param.tmo.num = num_timer; + + odp_queue_param_init(&queue_param); + queue_param.type = ODP_QUEUE_TYPE_SCHED; + queue_param.sched.prio = ODP_SCHED_PRIO_DEFAULT; + queue_param.sched.sync = ODP_SCHED_SYNC_ATOMIC; + queue_param.sched.group = ODP_SCHED_GROUP_ALL; + + for (i = 0; i < num_tp; i++) { + tp = odp_timer_pool_create(NULL, &timer_pool_param); + global->tp[i] = tp; + if (tp == ODP_TIMER_POOL_INVALID) { + printf("Error: timer pool create failed (%u)\n", i); + return -1; + } + + pool = odp_pool_create(NULL, &pool_param); + global->pool[i] = pool; + if (pool == ODP_POOL_INVALID) { + printf("Error: pool create failed (%u)\n", i); + return -1; + } + + queue = odp_queue_create(NULL, &queue_param); + global->queue[i] = queue; + if (queue == ODP_QUEUE_INVALID) { + printf("Error: queue create failed (%u)\n", i); + return -1; + } + } + + odp_timer_pool_start(); + + return 0; +} + +static int set_timers(test_global_t *global) +{ + odp_timer_pool_info_t timer_pool_info; + odp_timer_pool_t tp; + odp_timer_t timer; + odp_pool_t pool; + odp_queue_t queue; + odp_time_t time; + uint64_t tick_cur, nsec, time_ns; + uint64_t max_tmo_ns; + uint32_t i, j; + test_options_t *test_options = &global->test_options; + uint32_t num_tp = test_options->num_tp; + uint32_t num_timer = test_options->num_timer; + uint64_t period_ns = test_options->period_ns; + + max_tmo_ns = START_NS + (num_timer * period_ns); + + for (i = 0; i < num_tp; i++) { + tp = global->tp[i]; + pool = global->pool[i]; + queue = global->queue[i]; + + nsec = max_tmo_ns; + tick_cur = odp_timer_current_tick(tp); + time = odp_time_global(); + time_ns = odp_time_to_ns(time); + + for (j = 0; j < num_timer; j++) { + uint64_t tick_ns; + odp_timeout_t timeout; + odp_event_t ev; + int status; + timer_ctx_t *ctx = &global->timer_ctx[i][j]; + + /* Set timers backwards, the last timer is set first */ + if (j == 0) + ctx->last = 1; + + ctx->target_ns = time_ns + nsec; + + timeout = odp_timeout_alloc(pool); + ev = odp_timeout_to_event(timeout); + + timer = odp_timer_alloc(tp, queue, ctx); + global->timer[i][j] = timer; + + tick_ns = odp_timer_ns_to_tick(tp, nsec); + nsec = nsec - period_ns; + + status = odp_timer_set_abs(timer, tick_cur + tick_ns, + &ev); + + if (status != ODP_TIMER_SUCCESS) { + printf("Error: Timer set %i/%i (ret %i)\n", + i, j, status); + return -1; + } + } + + if (odp_timer_pool_info(tp, &timer_pool_info)) { + printf("Error: timer pool info failed\n"); + return -1; + } + + printf("Timer pool info [%i]:\n", i); + printf(" cur_timers %u\n", timer_pool_info.cur_timers); + printf(" hwm_timers %u\n", timer_pool_info.hwm_timers); + printf("\n"); + } + + return 0; +} + +static int destroy_timer_pool(test_global_t *global) +{ + odp_timer_pool_t tp; + odp_pool_t pool; + odp_queue_t queue; + odp_timer_t timer; + odp_event_t ev; + uint32_t i, j; + test_options_t *test_options = &global->test_options; + uint32_t num_timer = test_options->num_timer; + uint32_t num_tp = test_options->num_tp; + + for (i = 0; i < num_tp; i++) { + for (j = 0; j < num_timer; j++) { + timer = global->timer[i][j]; + + if (timer == ODP_TIMER_INVALID) + break; + + ev = odp_timer_free(timer); + + if (ev != ODP_EVENT_INVALID) { + printf("Event from timer free %i/%i\n", i, j); + odp_event_free(ev); + } + } + + queue = global->queue[i]; + if (queue != ODP_QUEUE_INVALID) + odp_queue_destroy(queue); + + pool = global->pool[i]; + if (pool != ODP_POOL_INVALID) + odp_pool_destroy(pool); + + tp = global->tp[i]; + if (tp != ODP_TIMER_POOL_INVALID) + odp_timer_pool_destroy(tp); + } + + return 0; +} + +static int test_worker(void *arg) +{ + int thr; + uint32_t exit_test; + odp_event_t ev; + odp_timeout_t tmo; + uint64_t c2, diff, nsec, time_ns, target_ns; + odp_time_t t1, t2, time; + time_stat_t before, after; + timer_ctx_t *ctx; + thread_arg_t *thread_arg = arg; + test_global_t *global = thread_arg->global; + test_options_t *test_options = &global->test_options; + uint32_t num_tp = test_options->num_tp; + uint64_t cycles = 0; + uint64_t events = 0; + uint64_t rounds = 0; + uint64_t c1 = 0; + int meas = 1; + int ret = 0; + + memset(&before, 0, sizeof(time_stat_t)); + memset(&after, 0, sizeof(time_stat_t)); + + thr = odp_thread_id(); + + /* Start all workers at the same time */ + odp_barrier_wait(&global->barrier); + + t1 = odp_time_local(); + + while (1) { + if (meas) { + c1 = odp_cpu_cycles(); + meas = 0; + } + + ev = odp_schedule(NULL, ODP_SCHED_NO_WAIT); + rounds++; + + exit_test = odp_atomic_load_u32(&global->exit_test); + if (odp_likely(ev == ODP_EVENT_INVALID && exit_test < num_tp)) + continue; + + c2 = odp_cpu_cycles(); + diff = odp_cpu_cycles_diff(c2, c1); + cycles += diff; + + if (ev == ODP_EVENT_INVALID && exit_test >= num_tp) + break; + + time = odp_time_global(); + time_ns = odp_time_to_ns(time); + events++; + meas = 1; + + tmo = odp_timeout_from_event(ev); + ctx = odp_timeout_user_ptr(tmo); + odp_timeout_free(tmo); + + target_ns = ctx->target_ns; + if (time_ns < target_ns) { + diff = target_ns - time_ns; + before.num++; + before.sum_ns += diff; + if (diff > before.max_ns) + before.max_ns = diff; + + ODPH_DBG("before %" PRIu64 "\n", diff); + } else { + diff = time_ns - target_ns; + after.num++; + after.sum_ns += diff; + if (diff > after.max_ns) + after.max_ns = diff; + + ODPH_DBG("after %" PRIu64 "\n", time_ns - target_ns); + } + + if (ctx->last) + odp_atomic_inc_u32(&global->exit_test); + } + + t2 = odp_time_local(); + nsec = odp_time_diff_ns(t2, t1); + + /* Update stats*/ + global->stat[thr].events = events; + global->stat[thr].cycles = cycles; + global->stat[thr].rounds = rounds; + global->stat[thr].nsec = nsec; + global->stat[thr].before = before; + global->stat[thr].after = after; + + return ret; +} + +static int start_workers(test_global_t *global, odp_instance_t instance) +{ + odph_thread_common_param_t thr_common; + int i, ret; + test_options_t *test_options = &global->test_options; + int num_cpu = test_options->num_cpu; + odph_thread_param_t thr_param[num_cpu]; + + memset(global->thread_tbl, 0, sizeof(global->thread_tbl)); + memset(thr_param, 0, sizeof(thr_param)); + memset(&thr_common, 0, sizeof(thr_common)); + + thr_common.instance = instance; + thr_common.cpumask = &global->cpumask; + + for (i = 0; i < num_cpu; i++) { + thr_param[i].start = test_worker; + thr_param[i].arg = &global->thread_arg[i]; + thr_param[i].thr_type = ODP_THREAD_WORKER; + + global->thread_arg[i].global = global; + } + + ret = odph_thread_create(global->thread_tbl, &thr_common, thr_param, + num_cpu); + + if (ret != num_cpu) { + printf("Error: thread create failed %i\n", ret); + return -1; + } + + return 0; +} + +static void print_stat(test_global_t *global) +{ + int i; + time_stat_t before, after; + double time_ave = 0.0; + double round_ave = 0.0; + double before_ave = 0.0; + double after_ave = 0.0; + uint64_t time_sum = 0; + uint64_t event_sum = 0; + uint64_t round_sum = 0; + uint64_t cycle_sum = 0; + int num = 0; + + memset(&before, 0, sizeof(time_stat_t)); + memset(&after, 0, sizeof(time_stat_t)); + + printf("\n"); + printf("RESULTS - schedule() cycles per thread:\n"); + printf("----------------------------------------------\n"); + printf(" 1 2 3 4 5 6 7 8 9 10"); + + for (i = 0; i < ODP_THREAD_COUNT_MAX; i++) { + if (global->stat[i].rounds) { + if ((num % 10) == 0) + printf("\n "); + + printf("%6.1f ", (double)global->stat[i].cycles / + global->stat[i].rounds); + num++; + } + } + + printf("\n\n"); + + for (i = 0; i < ODP_THREAD_COUNT_MAX; i++) { + event_sum += global->stat[i].events; + round_sum += global->stat[i].rounds; + cycle_sum += global->stat[i].cycles; + time_sum += global->stat[i].nsec; + before.num += global->stat[i].before.num; + before.sum_ns += global->stat[i].before.sum_ns; + after.num += global->stat[i].after.num; + after.sum_ns += global->stat[i].after.sum_ns; + + if (global->stat[i].before.max_ns > before.max_ns) + before.max_ns = global->stat[i].before.max_ns; + + if (global->stat[i].after.max_ns > after.max_ns) + after.max_ns = global->stat[i].after.max_ns; + } + + if (num) { + time_ave = ((double)time_sum / num) / ODP_TIME_SEC_IN_NS; + round_ave = (double)round_sum / num; + } + + if (before.num) + before_ave = (double)before.sum_ns / before.num; + + if (after.num) + after_ave = (double)after.sum_ns / after.num; + + printf("TOTAL (%i workers)\n", num); + printf(" events: %" PRIu64 "\n", event_sum); + printf(" ave time: %.2f sec\n", time_ave); + printf(" ave rounds per sec: %.2fM\n", + (round_ave / time_ave) / 1000000.0); + printf(" num before: %" PRIu64 "\n", before.num); + printf(" ave before: %.1f nsec\n", before_ave); + printf(" max before: %" PRIu64 " nsec\n", before.max_ns); + printf(" num after: %" PRIu64 "\n", after.num); + printf(" ave after: %.1f nsec\n", after_ave); + printf(" max after: %" PRIu64 " nsec\n", after.max_ns); + printf("\n"); +} + +static void sig_handler(int signo) +{ + (void)signo; + + odp_atomic_add_u32(&test_global.exit_test, MAX_TIMER_POOLS); +} + +int main(int argc, char **argv) +{ + odp_instance_t instance; + odp_init_t init; + test_global_t *global; + + global = &test_global; + memset(global, 0, sizeof(test_global_t)); + odp_atomic_init_u32(&global->exit_test, 0); + + signal(SIGINT, sig_handler); + + if (parse_options(argc, argv, &global->test_options)) + return -1; + + /* List features not to be used */ + odp_init_param_init(&init); + init.not_used.feat.cls = 1; + init.not_used.feat.crypto = 1; + init.not_used.feat.ipsec = 1; + init.not_used.feat.tm = 1; + + /* Init ODP before calling anything else */ + if (odp_init_global(&instance, &init, NULL)) { + printf("Error: Global init failed.\n"); + return -1; + } + + /* Init this thread */ + if (odp_init_local(instance, ODP_THREAD_CONTROL)) { + printf("Error: Local init failed.\n"); + return -1; + } + + odp_schedule_config(NULL); + + if (set_num_cpu(global)) + return -1; + + if (create_timer_pools(global)) + return -1; + + /* Start worker threads */ + start_workers(global, instance); + + /* Wait until workers have started. + * Scheduler calls from workers may be needed to run timer pools in + * a software implementation. Wait 1 msec to ensure that timer pools + * are running before setting timers. */ + odp_barrier_wait(&global->barrier); + odp_time_wait_ns(ODP_TIME_MSEC_IN_NS); + + /* Set timers. Force workers to exit on failure. */ + if (set_timers(global)) + odp_atomic_add_u32(&global->exit_test, MAX_TIMER_POOLS); + + /* Wait workers to exit */ + odph_thread_join(global->thread_tbl, global->test_options.num_cpu); + + print_stat(global); + + destroy_timer_pool(global); + + if (odp_term_local()) { + printf("Error: term local failed.\n"); + return -1; + } + + if (odp_term_global(instance)) { + printf("Error: term global failed.\n"); + return -1; + } + + return 0; +} commit a285e616251254cce6faec1c0ff7cdd18e964948 Author: Matias Elo <matias.elo(a)nokia.com> Date: Fri Sep 27 13:42:27 2019 +0300 gitignore: fix stamp-h1 path Signed-off-by: Matias Elo <matias.elo(a)nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen(a)nokia.com> diff --git a/.gitignore b/.gitignore index 963b86438..b5856a50c 100644 --- a/.gitignore +++ b/.gitignore @@ -40,7 +40,7 @@ dpdk/ install-sh include/odp/config.h.in include/odp/config.h -include/stamp-h1 +include/odp/stamp-h1 lib/ libtool ltmain.sh ----------------------------------------------------------------------- Summary of changes: .gitignore | 2 +- test/performance/.gitignore | 1 + test/performance/Makefile.am | 4 +- test/performance/odp_timer_perf.c | 716 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 721 insertions(+), 2 deletions(-) create mode 100644 test/performance/odp_timer_perf.c hooks/post-receive --
5 years, 3 months
1
0
0
0
[COMMIT] branch master updated. v1.21.0.0-210-g9a2c3cdbb
by git@git-us.linaro.org
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 9a2c3cdbb542c7514e5d89c38b5d3d534a7dc240 (commit) from 235478efa4afa44167b0af95b5ee10e635beed08 (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 9a2c3cdbb542c7514e5d89c38b5d3d534a7dc240 Author: Matias Elo <matias.elo(a)nokia.com> Date: Tue Sep 24 10:25:47 2019 +0300 linux-gen: include config.h header in install directory Previously, config.h header was not included in install dir. This caused a compilation failure when an application tried to include ODP helper headers. config.h has been moved to include/odp subdirectory to avoid naming conflicts and unnecessary includes have been removed. Signed-off-by: Matias Elo <matias.elo(a)nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen(a)nokia.com> Reported-by: Mikko Parpala <mikko.parpala(a)nokia.com> diff --git a/.gitignore b/.gitignore index 4653f8976..963b86438 100644 --- a/.gitignore +++ b/.gitignore @@ -38,8 +38,8 @@ depcomp doc/output dpdk/ install-sh -include/config.h.in -include/config.h +include/odp/config.h.in +include/odp/config.h include/stamp-h1 lib/ libtool diff --git a/configure.ac b/configure.ac index 2eb284a7c..857905c3d 100644 --- a/configure.ac +++ b/configure.ac @@ -43,7 +43,7 @@ AS_IF([test "$ac_cv_env_CFLAGS_set" = ""], [user_cflags=0], [user_cflags=1]) # Initialize automake AM_INIT_AUTOMAKE([1.9 tar-pax subdir-objects foreign nostdinc -Wall -Werror]) AC_CONFIG_SRCDIR([include/odp/api/spec/init.h]) -AM_CONFIG_HEADER([include/config.h]) +AM_CONFIG_HEADER([include/odp/config.h]) AC_USE_SYSTEM_EXTENSIONS AC_SYS_LARGEFILE diff --git a/helper/chksum.c b/helper/chksum.c index c3e712421..e9ef19a62 100644 --- a/helper/chksum.c +++ b/helper/chksum.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp.h> #include <odp/helper/ip.h> #include <odp/helper/udp.h> diff --git a/helper/cuckootable.c b/helper/cuckootable.c index 5609e6906..237c2f297 100644 --- a/helper/cuckootable.c +++ b/helper/cuckootable.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - /*- * BSD LICENSE * diff --git a/helper/eth.c b/helper/eth.c index d46283b23..86a0be6f5 100644 --- a/helper/eth.c +++ b/helper/eth.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp/helper/eth.h> #include <stdio.h> diff --git a/helper/hashtable.c b/helper/hashtable.c index 496bca5e6..ac11acb15 100644 --- a/helper/hashtable.c +++ b/helper/hashtable.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <stdio.h> #include <string.h> #include <malloc.h> diff --git a/helper/include/odp/helper/odph_debug.h b/helper/include/odp/helper/odph_debug.h index ef520497b..370a0fa12 100644 --- a/helper/include/odp/helper/odph_debug.h +++ b/helper/include/odp/helper/odph_debug.h @@ -15,7 +15,7 @@ #ifndef ODPH_DEBUG_H_ #define ODPH_DEBUG_H_ -#include "config.h" +#include <odp/config.h> #include <stdio.h> #include <stdlib.h> diff --git a/helper/ip.c b/helper/ip.c index 8ecda69e0..9e02892aa 100644 --- a/helper/ip.c +++ b/helper/ip.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp/helper/ip.h> #include <stdio.h> diff --git a/helper/iplookuptable.c b/helper/iplookuptable.c index 1b5538ab8..c02ee5415 100644 --- a/helper/iplookuptable.c +++ b/helper/iplookuptable.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <string.h> #include <stdint.h> #include <errno.h> diff --git a/helper/lineartable.c b/helper/lineartable.c index 864c7973f..0999569cc 100644 --- a/helper/lineartable.c +++ b/helper/lineartable.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <stdio.h> #include <string.h> #include <malloc.h> diff --git a/helper/linux/thread.c b/helper/linux/thread.c index eecd6fed1..c7ed24512 100644 --- a/helper/linux/thread.c +++ b/helper/linux/thread.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif diff --git a/helper/test/chksum.c b/helper/test/chksum.c index a569f2394..d14ee20d1 100644 --- a/helper/test/chksum.c +++ b/helper/test/chksum.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp_api.h> #include <odp/helper/odph_api.h> diff --git a/helper/test/cuckootable.c b/helper/test/cuckootable.c index 22df27f3d..d11e944f9 100644 --- a/helper/test/cuckootable.c +++ b/helper/test/cuckootable.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - /*- * BSD LICENSE * diff --git a/helper/test/debug.c b/helper/test/debug.c index e20fd325a..48d4462c9 100644 --- a/helper/test/debug.c +++ b/helper/test/debug.c @@ -4,7 +4,7 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" +#include <odp/config.h> #include <odp_api.h> #include <odp/helper/odph_api.h> diff --git a/helper/test/iplookuptable.c b/helper/test/iplookuptable.c index 8ffc75efe..bd724b1b7 100644 --- a/helper/test/iplookuptable.c +++ b/helper/test/iplookuptable.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <stdio.h> #include <stdint.h> #include <string.h> diff --git a/helper/test/linux/process.c b/helper/test/linux/process.c index 0bc53e5a7..f57b5ab8a 100644 --- a/helper/test/linux/process.c +++ b/helper/test/linux/process.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp_api.h> #include <odp/helper/odph_api.h> #include <odp/helper/linux/pthread.h> diff --git a/helper/test/linux/pthread.c b/helper/test/linux/pthread.c index e14d5cdf8..770308faa 100644 --- a/helper/test/linux/pthread.c +++ b/helper/test/linux/pthread.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp_api.h> #include <odp/helper/odph_api.h> #include <odp/helper/linux/pthread.h> diff --git a/helper/test/odpthreads.c b/helper/test/odpthreads.c index 83f9476fd..1540ad503 100644 --- a/helper/test/odpthreads.c +++ b/helper/test/odpthreads.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - /* * This program tests the ability of the linux helper to create ODP threads, * either implemented as linux pthreads or as linux processes, depending on diff --git a/helper/test/parse.c b/helper/test/parse.c index 5f8c5846a..3097ae476 100644 --- a/helper/test/parse.c +++ b/helper/test/parse.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp_api.h> #include <odp/helper/odph_api.h> diff --git a/helper/test/table.c b/helper/test/table.c index 1a889392c..df7a23d6e 100644 --- a/helper/test/table.c +++ b/helper/test/table.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier:BSD-3-Clause */ -#include "config.h" - #include <odp_api.h> #include <odp/helper/odph_api.h> diff --git a/helper/test/version.c b/helper/test/version.c index 22ee2955d..925d305da 100644 --- a/helper/test/version.c +++ b/helper/test/version.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp_api.h> #include <odp/helper/odph_api.h> diff --git a/helper/threads.c b/helper/threads.c index 37a0c25db..431712d93 100644 --- a/helper/threads.c +++ b/helper/threads.c @@ -5,8 +5,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif diff --git a/include/Makefile.am b/include/Makefile.am index 49ed0164e..ed33e7c8e 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -4,6 +4,7 @@ include_HEADERS = \ odpincludedir= $(includedir)/odp odpinclude_HEADERS = \ + odp/config.h \ odp/visibility_begin.h \ odp/visibility_end.h diff --git a/platform/linux-generic/arch/aarch64/odp_global_time.c b/platform/linux-generic/arch/aarch64/odp_global_time.c index 91e5c7a66..fa59f5a15 100644 --- a/platform/linux-generic/arch/aarch64/odp_global_time.c +++ b/platform/linux-generic/arch/aarch64/odp_global_time.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp_posix_extensions.h> #include <time.h> diff --git a/platform/linux-generic/arch/aarch64/odp_sysinfo_parse.c b/platform/linux-generic/arch/aarch64/odp_sysinfo_parse.c index 3a1486dd2..966d0d85a 100644 --- a/platform/linux-generic/arch/aarch64/odp_sysinfo_parse.c +++ b/platform/linux-generic/arch/aarch64/odp_sysinfo_parse.c @@ -3,7 +3,6 @@ * * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" #include <stdio.h> #include <string.h> diff --git a/platform/linux-generic/arch/default/odp_cpu_cycles.c b/platform/linux-generic/arch/default/odp_cpu_cycles.c index 88e70b2e4..542a68dbe 100644 --- a/platform/linux-generic/arch/default/odp_cpu_cycles.c +++ b/platform/linux-generic/arch/default/odp_cpu_cycles.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp_posix_extensions.h> #include <stdlib.h> diff --git a/platform/linux-generic/arch/default/odp_sysinfo_parse.c b/platform/linux-generic/arch/default/odp_sysinfo_parse.c index da3f2eb3f..3db15828d 100644 --- a/platform/linux-generic/arch/default/odp_sysinfo_parse.c +++ b/platform/linux-generic/arch/default/odp_sysinfo_parse.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp_sysinfo_internal.h> int cpuinfo_parser(FILE *file ODP_UNUSED, system_info_t *sysinfo) diff --git a/platform/linux-generic/arch/mips64/odp_cpu_cycles.c b/platform/linux-generic/arch/mips64/odp_cpu_cycles.c index 72a0e5b0c..6423af76d 100644 --- a/platform/linux-generic/arch/mips64/odp_cpu_cycles.c +++ b/platform/linux-generic/arch/mips64/odp_cpu_cycles.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp/api/cpu.h> #include <odp/api/hints.h> #include <odp/api/system_info.h> diff --git a/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c b/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c index 7b313b6d0..af8d910e8 100644 --- a/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c +++ b/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp_sysinfo_internal.h> #include <string.h> diff --git a/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c b/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c index 1fb1b4a3e..769bdd4ca 100644 --- a/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c +++ b/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp_sysinfo_internal.h> #include <string.h> diff --git a/platform/linux-generic/arch/x86/cpu_flags.c b/platform/linux-generic/arch/x86/cpu_flags.c index 935af2cb7..f5c9c0d45 100644 --- a/platform/linux-generic/arch/x86/cpu_flags.c +++ b/platform/linux-generic/arch/x86/cpu_flags.c @@ -37,8 +37,6 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "config.h" - #include "cpu_flags.h" #include <odp_debug_internal.h> #include <odp/api/abi/cpu_time.h> diff --git a/platform/linux-generic/arch/x86/odp_global_time.c b/platform/linux-generic/arch/x86/odp_global_time.c index e46a75865..d4d7ab150 100644 --- a/platform/linux-generic/arch/x86/odp_global_time.c +++ b/platform/linux-generic/arch/x86/odp_global_time.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp_posix_extensions.h> #include <time.h> diff --git a/platform/linux-generic/arch/x86/odp_sysinfo_parse.c b/platform/linux-generic/arch/x86/odp_sysinfo_parse.c index 7124e84f2..084ec730b 100644 --- a/platform/linux-generic/arch/x86/odp_sysinfo_parse.c +++ b/platform/linux-generic/arch/x86/odp_sysinfo_parse.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp_sysinfo_internal.h> #include "cpu_flags.h" #include <string.h> diff --git a/platform/linux-generic/include/odp_debug_internal.h b/platform/linux-generic/include/odp_debug_internal.h index 4dbe01b59..2ef5a24a8 100644 --- a/platform/linux-generic/include/odp_debug_internal.h +++ b/platform/linux-generic/include/odp_debug_internal.h @@ -16,10 +16,13 @@ #ifndef ODP_DEBUG_INTERNAL_H_ #define ODP_DEBUG_INTERNAL_H_ -#include <stdio.h> -#include <stdlib.h> +#include <odp/config.h> #include <odp/api/debug.h> #include <odp_global_data.h> + +#include <stdio.h> +#include <stdlib.h> + #ifdef __cplusplus extern "C" { #endif diff --git a/platform/linux-generic/include/odp_packet_io_internal.h b/platform/linux-generic/include/odp_packet_io_internal.h index 18bbf6de8..645b27907 100644 --- a/platform/linux-generic/include/odp_packet_io_internal.h +++ b/platform/linux-generic/include/odp_packet_io_internal.h @@ -18,6 +18,8 @@ extern "C" { #endif +#include <odp/config.h> + #include <odp/api/packet_io.h> #include <odp/api/plat/pktio_inlines.h> #include <odp/api/spinlock.h> @@ -34,6 +36,7 @@ extern "C" { #include <string.h> #include <net/if.h> #include <linux/if_ether.h> +#include <sys/select.h> #define PKTIO_MAX_QUEUES 64 diff --git a/platform/linux-generic/include/odp_schedule_if.h b/platform/linux-generic/include/odp_schedule_if.h index 88f1ea022..ef1bbf33b 100644 --- a/platform/linux-generic/include/odp_schedule_if.h +++ b/platform/linux-generic/include/odp_schedule_if.h @@ -87,9 +87,7 @@ int sched_cb_pktin_poll_one(int pktio_index, int rx_queue, odp_event_t evts[]); void sched_cb_pktio_stop_finalize(int pktio_index); /* For debugging */ -#ifdef ODP_DEBUG extern int _odp_schedule_configured; -#endif /* API functions */ typedef struct { diff --git a/platform/linux-generic/odp_atomic.c b/platform/linux-generic/odp_atomic.c index 79b967494..32ddc95c2 100644 --- a/platform/linux-generic/odp_atomic.c +++ b/platform/linux-generic/odp_atomic.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp/api/atomic.h> int odp_atomic_lock_free_u64(odp_atomic_op_t *atomic_op) diff --git a/platform/linux-generic/odp_atomic_api.c b/platform/linux-generic/odp_atomic_api.c index 72b55a8f1..c56f2c53f 100644 --- a/platform/linux-generic/odp_atomic_api.c +++ b/platform/linux-generic/odp_atomic_api.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp/api/atomic.h> /* Include non-inlined versions of API functions */ diff --git a/platform/linux-generic/odp_barrier.c b/platform/linux-generic/odp_barrier.c index 132ba370e..3747713f6 100644 --- a/platform/linux-generic/odp_barrier.c +++ b/platform/linux-generic/odp_barrier.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp/api/barrier.h> #include <odp/api/sync.h> #include <odp/api/cpu.h> diff --git a/platform/linux-generic/odp_bitmap.c b/platform/linux-generic/odp_bitmap.c index 09de8733a..aa8734686 100644 --- a/platform/linux-generic/odp_bitmap.c +++ b/platform/linux-generic/odp_bitmap.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <string.h> #include <unistd.h> #include <odp/api/std_types.h> diff --git a/platform/linux-generic/odp_buffer.c b/platform/linux-generic/odp_buffer.c index f3864bfda..67f0d4e26 100644 --- a/platform/linux-generic/odp_buffer.c +++ b/platform/linux-generic/odp_buffer.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp/api/buffer.h> #include <odp_pool_internal.h> #include <odp_buffer_internal.h> diff --git a/platform/linux-generic/odp_byteorder_api.c b/platform/linux-generic/odp_byteorder_api.c index 7d8c9516d..4b9f0da7a 100644 --- a/platform/linux-generic/odp_byteorder_api.c +++ b/platform/linux-generic/odp_byteorder_api.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp/api/byteorder.h> /* Include non-inlined versions of API functions */ diff --git a/platform/linux-generic/odp_classification.c b/platform/linux-generic/odp_classification.c index e3f1cc6e0..9bf104e3b 100644 --- a/platform/linux-generic/odp_classification.c +++ b/platform/linux-generic/odp_classification.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp/api/classification.h> #include <odp/api/align.h> #include <odp/api/queue.h> diff --git a/platform/linux-generic/odp_comp.c b/platform/linux-generic/odp_comp.c index 25ed11f55..a5dfb4aa7 100644 --- a/platform/linux-generic/odp_comp.c +++ b/platform/linux-generic/odp_comp.c @@ -3,7 +3,6 @@ * * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" #include <string.h> diff --git a/platform/linux-generic/odp_cpu_api.c b/platform/linux-generic/odp_cpu_api.c index 2e856ec25..503fbd4c7 100644 --- a/platform/linux-generic/odp_cpu_api.c +++ b/platform/linux-generic/odp_cpu_api.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp/api/cpu.h> /* Non-inlined functions for ABI compat mode */ diff --git a/platform/linux-generic/odp_cpumask.c b/platform/linux-generic/odp_cpumask.c index 551a80d82..b8b9f325c 100644 --- a/platform/linux-generic/odp_cpumask.c +++ b/platform/linux-generic/odp_cpumask.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp_posix_extensions.h> #include <sched.h> diff --git a/platform/linux-generic/odp_cpumask_task.c b/platform/linux-generic/odp_cpumask_task.c index c269116ce..70b85f1cb 100644 --- a/platform/linux-generic/odp_cpumask_task.c +++ b/platform/linux-generic/odp_cpumask_task.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp_posix_extensions.h> #include <sched.h> diff --git a/platform/linux-generic/odp_crypto_null.c b/platform/linux-generic/odp_crypto_null.c index 4dd1f8325..c19cb6824 100644 --- a/platform/linux-generic/odp_crypto_null.c +++ b/platform/linux-generic/odp_crypto_null.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp_posix_extensions.h> #include <odp/api/crypto.h> #include <odp_init_internal.h> diff --git a/platform/linux-generic/odp_crypto_openssl.c b/platform/linux-generic/odp_crypto_openssl.c index 3f03b63fa..3911b8f4a 100644 --- a/platform/linux-generic/odp_crypto_openssl.c +++ b/platform/linux-generic/odp_crypto_openssl.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp_posix_extensions.h> #include <odp/api/crypto.h> #include <odp_init_internal.h> diff --git a/platform/linux-generic/odp_errno.c b/platform/linux-generic/odp_errno.c index 071ca6060..38c26d6d4 100644 --- a/platform/linux-generic/odp_errno.c +++ b/platform/linux-generic/odp_errno.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp/api/errno.h> #include <string.h> #include <stdio.h> diff --git a/platform/linux-generic/odp_event.c b/platform/linux-generic/odp_event.c index efcbc1e26..6f6b3aa0b 100644 --- a/platform/linux-generic/odp_event.c +++ b/platform/linux-generic/odp_event.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp/api/event.h> #include <odp/api/buffer.h> #include <odp/api/crypto.h> diff --git a/platform/linux-generic/odp_event_api.c b/platform/linux-generic/odp_event_api.c index ea9e61106..4fbc98ddf 100644 --- a/platform/linux-generic/odp_event_api.c +++ b/platform/linux-generic/odp_event_api.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp/api/event.h> /* Non-inlined functions for ABI compat mode */ diff --git a/platform/linux-generic/odp_fdserver.c b/platform/linux-generic/odp_fdserver.c index 232d7f4e0..97f0e9ba0 100644 --- a/platform/linux-generic/odp_fdserver.c +++ b/platform/linux-generic/odp_fdserver.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - /* * This file implements a file descriptor sharing server enabling * sharing of file descriptors between processes, regardless of fork time. diff --git a/platform/linux-generic/odp_hash_crc32c.c b/platform/linux-generic/odp_hash_crc32c.c index 9e3e7d8fe..304b8e2a5 100644 --- a/platform/linux-generic/odp_hash_crc32c.c +++ b/platform/linux-generic/odp_hash_crc32c.c @@ -37,8 +37,6 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "config.h" - #include <odp/api/hash.h> #include <odp/api/std_types.h> diff --git a/platform/linux-generic/odp_impl.c b/platform/linux-generic/odp_impl.c index 227d50005..855f29358 100644 --- a/platform/linux-generic/odp_impl.c +++ b/platform/linux-generic/odp_impl.c @@ -4,7 +4,7 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" +#include <odp/config.h> #include <odp/api/version.h> #define ODP_VERSION_IMPL 0 diff --git a/platform/linux-generic/odp_init.c b/platform/linux-generic/odp_init.c index a09583ee5..7d2477b0b 100644 --- a/platform/linux-generic/odp_init.c +++ b/platform/linux-generic/odp_init.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp_posix_extensions.h> #include <odp/api/init.h> diff --git a/platform/linux-generic/odp_ipsec.c b/platform/linux-generic/odp_ipsec.c index cd1baa51a..5511989c2 100644 --- a/platform/linux-generic/odp_ipsec.c +++ b/platform/linux-generic/odp_ipsec.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp/api/ipsec.h> #include <odp/api/chksum.h> diff --git a/platform/linux-generic/odp_ipsec_events.c b/platform/linux-generic/odp_ipsec_events.c index c1d153c09..cbeb43780 100644 --- a/platform/linux-generic/odp_ipsec_events.c +++ b/platform/linux-generic/odp_ipsec_events.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp/api/ipsec.h> #include <odp/api/shared_memory.h> diff --git a/platform/linux-generic/odp_ipsec_sad.c b/platform/linux-generic/odp_ipsec_sad.c index 6eb12f95f..1fb814c5b 100644 --- a/platform/linux-generic/odp_ipsec_sad.c +++ b/platform/linux-generic/odp_ipsec_sad.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp/api/atomic.h> #include <odp/api/ipsec.h> #include <odp/api/random.h> diff --git a/platform/linux-generic/odp_ishm.c b/platform/linux-generic/odp_ishm.c index aa4d497a5..cd483d146 100644 --- a/platform/linux-generic/odp_ishm.c +++ b/platform/linux-generic/odp_ishm.c @@ -5,8 +5,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - /* This file handles the internal shared memory: internal shared memory * is memory which is sharable by all ODP threads regardless of how the * ODP thread is implemented (pthread or process) and regardless of fork() diff --git a/platform/linux-generic/odp_ishmphy.c b/platform/linux-generic/odp_ishmphy.c index 65e0cc826..64eb2a732 100644 --- a/platform/linux-generic/odp_ishmphy.c +++ b/platform/linux-generic/odp_ishmphy.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - /* * This file handles the lower end of the ishm memory allocator: * It performs the physical mappings. diff --git a/platform/linux-generic/odp_ishmpool.c b/platform/linux-generic/odp_ishmpool.c index 9a4e08fab..e6cb5fcff 100644 --- a/platform/linux-generic/odp_ishmpool.c +++ b/platform/linux-generic/odp_ishmpool.c @@ -41,7 +41,6 @@ * The second one regroups the functions needed by the slab allocator. * The third section regroups the common functions exported externally. */ -#include "config.h" #include <odp_posix_extensions.h> #include <odp/api/spinlock.h> diff --git a/platform/linux-generic/odp_libconfig.c b/platform/linux-generic/odp_libconfig.c index 014409e2b..8b061f5fa 100644 --- a/platform/linux-generic/odp_libconfig.c +++ b/platform/linux-generic/odp_libconfig.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <stdlib.h> #include <string.h> #include <libconfig.h> diff --git a/platform/linux-generic/odp_name_table.c b/platform/linux-generic/odp_name_table.c index 233f6f74b..b4825fa18 100644 --- a/platform/linux-generic/odp_name_table.c +++ b/platform/linux-generic/odp_name_table.c @@ -6,8 +6,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <stdint.h> #include <string.h> #include <malloc.h> diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index be62557d5..d2327cff1 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -4,7 +4,7 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" +#include <odp/config.h> #include <odp/api/packet.h> #include <odp/api/plat/packet_inlines.h> diff --git a/platform/linux-generic/odp_packet_api.c b/platform/linux-generic/odp_packet_api.c index 6bc37db47..6f81f4ce4 100644 --- a/platform/linux-generic/odp_packet_api.c +++ b/platform/linux-generic/odp_packet_api.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp/api/packet.h> #include <odp_packet_internal.h> #include <odp_debug_internal.h> diff --git a/platform/linux-generic/odp_packet_flags.c b/platform/linux-generic/odp_packet_flags.c index 48ebab107..bb5c26792 100644 --- a/platform/linux-generic/odp_packet_flags.c +++ b/platform/linux-generic/odp_packet_flags.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp/api/plat/packet_flag_inlines.h> #include <odp/api/packet_flags.h> #include <odp_packet_internal.h> diff --git a/platform/linux-generic/odp_packet_flags_api.c b/platform/linux-generic/odp_packet_flags_api.c index a4ecbc634..e77f22c3e 100644 --- a/platform/linux-generic/odp_packet_flags_api.c +++ b/platform/linux-generic/odp_packet_flags_api.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp/api/packet_flags.h> #include <odp_packet_internal.h> diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c index 91555c680..0710b718a 100644 --- a/platform/linux-generic/odp_packet_io.c +++ b/platform/linux-generic/odp_packet_io.c @@ -5,10 +5,9 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp_posix_extensions.h> +#include <odp/config.h> #include <odp/api/packet_io.h> #include <odp/api/plat/pktio_inlines.h> #include <odp_packet_io_internal.h> diff --git a/platform/linux-generic/odp_pcapng.c b/platform/linux-generic/odp_pcapng.c index b6d91fbc8..09cb91b1d 100644 --- a/platform/linux-generic/odp_pcapng.c +++ b/platform/linux-generic/odp_pcapng.c @@ -5,7 +5,7 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" +#include <odp/config.h> #if defined(_ODP_PCAPNG) && _ODP_PCAPNG == 1 diff --git a/platform/linux-generic/odp_pkt_queue.c b/platform/linux-generic/odp_pkt_queue.c index 010856f28..edc82803b 100644 --- a/platform/linux-generic/odp_pkt_queue.c +++ b/platform/linux-generic/odp_pkt_queue.c @@ -6,8 +6,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <stdint.h> #include <string.h> #include <malloc.h> diff --git a/platform/linux-generic/odp_pktio_api.c b/platform/linux-generic/odp_pktio_api.c index 16c30743c..42c75f84a 100644 --- a/platform/linux-generic/odp_pktio_api.c +++ b/platform/linux-generic/odp_pktio_api.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp/api/packet_io.h> /* Include non-inlined versions of API functions */ diff --git a/platform/linux-generic/odp_pool.c b/platform/linux-generic/odp_pool.c index f021d903d..67b1e7fb9 100644 --- a/platform/linux-generic/odp_pool.c +++ b/platform/linux-generic/odp_pool.c @@ -5,8 +5,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp/api/pool.h> #include <odp/api/shared_memory.h> #include <odp/api/align.h> diff --git a/platform/linux-generic/odp_queue_api.c b/platform/linux-generic/odp_queue_api.c index 343118573..495cf8746 100644 --- a/platform/linux-generic/odp_queue_api.c +++ b/platform/linux-generic/odp_queue_api.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp/api/queue.h> /* Non-inlined functions for ABI compat mode */ diff --git a/platform/linux-generic/odp_queue_basic.c b/platform/linux-generic/odp_queue_basic.c index 4ec564d69..73749c66a 100644 --- a/platform/linux-generic/odp_queue_basic.c +++ b/platform/linux-generic/odp_queue_basic.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp/api/queue.h> #include <odp_queue_basic_internal.h> #include <odp_queue_if.h> diff --git a/platform/linux-generic/odp_queue_if.c b/platform/linux-generic/odp_queue_if.c index 5ff8bbac5..f9df5c763 100644 --- a/platform/linux-generic/odp_queue_if.c +++ b/platform/linux-generic/odp_queue_if.c @@ -4,7 +4,7 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" +#include <odp/config.h> #include <odp_queue_if.h> #include <odp_init_internal.h> diff --git a/platform/linux-generic/odp_queue_lf.c b/platform/linux-generic/odp_queue_lf.c index 3e156a086..5f8c55e36 100644 --- a/platform/linux-generic/odp_queue_lf.c +++ b/platform/linux-generic/odp_queue_lf.c @@ -12,7 +12,6 @@ #include <string.h> #include <stdio.h> -#include "config.h" #include <odp_debug_internal.h> #define RING_LF_SIZE 32 diff --git a/platform/linux-generic/odp_queue_scalable.c b/platform/linux-generic/odp_queue_scalable.c index 862122123..6095e3cd6 100644 --- a/platform/linux-generic/odp_queue_scalable.c +++ b/platform/linux-generic/odp_queue_scalable.c @@ -5,7 +5,6 @@ * * SPDX-License-Identifier: BSD-3-Clause */ -#include <config.h> #include <odp/api/hints.h> #include <odp/api/ticketlock.h> diff --git a/platform/linux-generic/odp_queue_spsc.c b/platform/linux-generic/odp_queue_spsc.c index 002561a49..8bf2c3ddc 100644 --- a/platform/linux-generic/odp_queue_spsc.c +++ b/platform/linux-generic/odp_queue_spsc.c @@ -9,7 +9,6 @@ #include <odp_queue_basic_internal.h> #include <odp_pool_internal.h> -#include "config.h" #include <odp_debug_internal.h> static inline void buffer_index_from_buf(uint32_t buffer_index[], diff --git a/platform/linux-generic/odp_random_null.c b/platform/linux-generic/odp_random_null.c index d8ed78fea..2cedde3f8 100644 --- a/platform/linux-generic/odp_random_null.c +++ b/platform/linux-generic/odp_random_null.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp_posix_extensions.h> #include <stdint.h> #include <stdlib.h> diff --git a/platform/linux-generic/odp_random_openssl.c b/platform/linux-generic/odp_random_openssl.c index 9c3006c6d..bf1a329e5 100644 --- a/platform/linux-generic/odp_random_openssl.c +++ b/platform/linux-generic/odp_random_openssl.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp_posix_extensions.h> #include <stdint.h> #include <odp/api/random.h> diff --git a/platform/linux-generic/odp_rwlock.c b/platform/linux-generic/odp_rwlock.c index e027a23b5..74f5307aa 100644 --- a/platform/linux-generic/odp_rwlock.c +++ b/platform/linux-generic/odp_rwlock.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <stdbool.h> #include <odp/api/atomic.h> #include <odp/api/rwlock.h> diff --git a/platform/linux-generic/odp_rwlock_recursive.c b/platform/linux-generic/odp_rwlock_recursive.c index dac9ad196..d7bbf3c8b 100644 --- a/platform/linux-generic/odp_rwlock_recursive.c +++ b/platform/linux-generic/odp_rwlock_recursive.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp/api/rwlock_recursive.h> #include <odp/api/thread.h> #include <odp/api/plat/thread_inlines.h> diff --git a/platform/linux-generic/odp_schedule_basic.c b/platform/linux-generic/odp_schedule_basic.c index b814c09cc..9908dd1c7 100644 --- a/platform/linux-generic/odp_schedule_basic.c +++ b/platform/linux-generic/odp_schedule_basic.c @@ -5,9 +5,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - -#include <string.h> #include <odp/api/schedule.h> #include <odp_schedule_if.h> #include <odp/api/align.h> @@ -31,6 +28,8 @@ #include <odp_libconfig_internal.h> #include <odp/api/plat/queue_inlines.h> +#include <string.h> + /* No synchronization context */ #define NO_SYNC_CONTEXT ODP_SCHED_SYNC_PARALLEL diff --git a/platform/linux-generic/odp_schedule_if.c b/platform/linux-generic/odp_schedule_if.c index ba903e581..083950844 100644 --- a/platform/linux-generic/odp_schedule_if.c +++ b/platform/linux-generic/odp_schedule_if.c @@ -4,7 +4,7 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" +#include <odp/config.h> #include <odp_schedule_if.h> #include <odp_init_internal.h> diff --git a/platform/linux-generic/odp_schedule_scalable.c b/platform/linux-generic/odp_schedule_scalable.c index df8fee552..e993f2963 100644 --- a/platform/linux-generic/odp_schedule_scalable.c +++ b/platform/linux-generic/odp_schedule_scalable.c @@ -5,7 +5,6 @@ * * SPDX-License-Identifier: BSD-3-Clause */ -#include <config.h> #include <odp/api/align.h> #include <odp/api/atomic.h> diff --git a/platform/linux-generic/odp_schedule_scalable_ordered.c b/platform/linux-generic/odp_schedule_scalable_ordered.c index e01120f1d..c70b225a8 100644 --- a/platform/linux-generic/odp_schedule_scalable_ordered.c +++ b/platform/linux-generic/odp_schedule_scalable_ordered.c @@ -5,7 +5,6 @@ * * SPDX-License-Identifier: BSD-3-Clause */ -#include <config.h> #include <odp/api/shared_memory.h> #include <odp/api/cpu.h> diff --git a/platform/linux-generic/odp_schedule_sp.c b/platform/linux-generic/odp_schedule_sp.c index a47899208..b65dc6cb8 100644 --- a/platform/linux-generic/odp_schedule_sp.c +++ b/platform/linux-generic/odp_schedule_sp.c @@ -5,9 +5,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - -#include <string.h> #include <odp/api/ticketlock.h> #include <odp/api/thread.h> #include <odp/api/plat/thread_inlines.h> @@ -23,6 +20,8 @@ #include <odp_timer_internal.h> #include <odp_queue_basic_internal.h> +#include <string.h> + #define NUM_THREAD ODP_THREAD_COUNT_MAX #define NUM_QUEUE CONFIG_MAX_SCHED_QUEUES #define NUM_PKTIO ODP_CONFIG_PKTIO_ENTRIES diff --git a/platform/linux-generic/odp_shared_memory.c b/platform/linux-generic/odp_shared_memory.c index d92b22587..ee47b7e96 100644 --- a/platform/linux-generic/odp_shared_memory.c +++ b/platform/linux-generic/odp_shared_memory.c @@ -5,8 +5,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp_config_internal.h> #include <odp/api/debug.h> #include <odp/api/std_types.h> diff --git a/platform/linux-generic/odp_sorted_list.c b/platform/linux-generic/odp_sorted_list.c index e17f93840..042818c83 100644 --- a/platform/linux-generic/odp_sorted_list.c +++ b/platform/linux-generic/odp_sorted_list.c @@ -6,8 +6,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <stdint.h> #include <string.h> #include <malloc.h> diff --git a/platform/linux-generic/odp_spinlock.c b/platform/linux-generic/odp_spinlock.c index 54b7c713b..b38cc6a3a 100644 --- a/platform/linux-generic/odp_spinlock.c +++ b/platform/linux-generic/odp_spinlock.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp/api/spinlock.h> #include <odp/api/cpu.h> #include <odp_atomic_internal.h> diff --git a/platform/linux-generic/odp_spinlock_recursive.c b/platform/linux-generic/odp_spinlock_recursive.c index 593742685..6363a3838 100644 --- a/platform/linux-generic/odp_spinlock_recursive.c +++ b/platform/linux-generic/odp_spinlock_recursive.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp/api/spinlock_recursive.h> #include <odp/api/thread.h> #include <odp/api/plat/thread_inlines.h> diff --git a/platform/linux-generic/odp_std_clib_api.c b/platform/linux-generic/odp_std_clib_api.c index faa378473..a0ba25ae8 100644 --- a/platform/linux-generic/odp_std_clib_api.c +++ b/platform/linux-generic/odp_std_clib_api.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp/api/std_clib.h> /* Include non-inlined versions of API functions */ diff --git a/platform/linux-generic/odp_sync_api.c b/platform/linux-generic/odp_sync_api.c index 6e91209a8..56c86db14 100644 --- a/platform/linux-generic/odp_sync_api.c +++ b/platform/linux-generic/odp_sync_api.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp/api/sync.h> /* Include non-inlined versions of API functions */ diff --git a/platform/linux-generic/odp_system_info.c b/platform/linux-generic/odp_system_info.c index a7a78d27f..028ef8668 100644 --- a/platform/linux-generic/odp_system_info.c +++ b/platform/linux-generic/odp_system_info.c @@ -11,8 +11,6 @@ * All rights reserved. */ -#include "config.h" - #include <odp_posix_extensions.h> #include <odp/api/system_info.h> diff --git a/platform/linux-generic/odp_thread.c b/platform/linux-generic/odp_thread.c index b30174dde..0ff0dc821 100644 --- a/platform/linux-generic/odp_thread.c +++ b/platform/linux-generic/odp_thread.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp_posix_extensions.h> #include <sched.h> diff --git a/platform/linux-generic/odp_thread_api.c b/platform/linux-generic/odp_thread_api.c index cfce705dd..470a82de7 100644 --- a/platform/linux-generic/odp_thread_api.c +++ b/platform/linux-generic/odp_thread_api.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp/api/thread.h> #include <odp/api/cpu.h> diff --git a/platform/linux-generic/odp_thrmask.c b/platform/linux-generic/odp_thrmask.c index 51986805c..f8704a0dd 100644 --- a/platform/linux-generic/odp_thrmask.c +++ b/platform/linux-generic/odp_thrmask.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp/api/thrmask.h> #include <odp/api/cpumask.h> diff --git a/platform/linux-generic/odp_ticketlock_api.c b/platform/linux-generic/odp_ticketlock_api.c index ebbb8657e..8995dd555 100644 --- a/platform/linux-generic/odp_ticketlock_api.c +++ b/platform/linux-generic/odp_ticketlock_api.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp/api/ticketlock.h> #include <odp/api/plat/atomic_inlines.h> diff --git a/platform/linux-generic/odp_time.c b/platform/linux-generic/odp_time.c index 97886d6a5..87ee6adc9 100644 --- a/platform/linux-generic/odp_time.c +++ b/platform/linux-generic/odp_time.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp_posix_extensions.h> #include <time.h> diff --git a/platform/linux-generic/odp_time_api.c b/platform/linux-generic/odp_time_api.c index cd547b238..d906e14b8 100644 --- a/platform/linux-generic/odp_time_api.c +++ b/platform/linux-generic/odp_time_api.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp/api/time.h> /* Non-inlined functions for ABI compat mode */ diff --git a/platform/linux-generic/odp_timer.c b/platform/linux-generic/odp_timer.c index e55c68873..3b9200c4d 100644 --- a/platform/linux-generic/odp_timer.c +++ b/platform/linux-generic/odp_timer.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - /** * @file * diff --git a/platform/linux-generic/odp_timer_wheel.c b/platform/linux-generic/odp_timer_wheel.c index 0320103d7..84640d215 100644 --- a/platform/linux-generic/odp_timer_wheel.c +++ b/platform/linux-generic/odp_timer_wheel.c @@ -6,8 +6,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <stdint.h> #include <string.h> #include <malloc.h> diff --git a/platform/linux-generic/odp_traffic_mngr.c b/platform/linux-generic/odp_traffic_mngr.c index 19fdd7797..9d19ac3c2 100644 --- a/platform/linux-generic/odp_traffic_mngr.c +++ b/platform/linux-generic/odp_traffic_mngr.c @@ -6,7 +6,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" #include <odp_posix_extensions.h> #include <stdint.h> diff --git a/platform/linux-generic/odp_version.c b/platform/linux-generic/odp_version.c index d46fddba6..baa336839 100644 --- a/platform/linux-generic/odp_version.c +++ b/platform/linux-generic/odp_version.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp/api/version.h> const char *odp_version_api_str(void) diff --git a/platform/linux-generic/odp_weak.c b/platform/linux-generic/odp_weak.c index 6632707f6..9e1c9da6a 100644 --- a/platform/linux-generic/odp_weak.c +++ b/platform/linux-generic/odp_weak.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp/api/debug.h> #include <odp_debug_internal.h> #include <odp/api/hints.h> diff --git a/platform/linux-generic/pktio/dpdk.c b/platform/linux-generic/pktio/dpdk.c index 77e42b094..23fae748b 100644 --- a/platform/linux-generic/pktio/dpdk.c +++ b/platform/linux-generic/pktio/dpdk.c @@ -4,7 +4,7 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" +#include <odp/config.h> #ifdef ODP_PKTIO_DPDK diff --git a/platform/linux-generic/pktio/dpdk_parse.c b/platform/linux-generic/pktio/dpdk_parse.c index 5f2b31d08..3dee44b87 100644 --- a/platform/linux-generic/pktio/dpdk_parse.c +++ b/platform/linux-generic/pktio/dpdk_parse.c @@ -4,7 +4,7 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" +#include <odp/config.h> #ifdef ODP_PKTIO_DPDK diff --git a/platform/linux-generic/pktio/ethtool_rss.c b/platform/linux-generic/pktio/ethtool_rss.c index 1ad9c970f..b66a385b9 100644 --- a/platform/linux-generic/pktio/ethtool_rss.c +++ b/platform/linux-generic/pktio/ethtool_rss.c @@ -4,7 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" #include <odp_posix_extensions.h> #include <stdio.h> diff --git a/platform/linux-generic/pktio/io_ops.c b/platform/linux-generic/pktio/io_ops.c index ae3daa661..e183058d8 100644 --- a/platform/linux-generic/pktio/io_ops.c +++ b/platform/linux-generic/pktio/io_ops.c @@ -4,8 +4,7 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - +#include <odp/config.h> #include <odp_packet_io_internal.h> /* Ops for all implementation of pktio. diff --git a/platform/linux-generic/pktio/ipc.c b/platform/linux-generic/pktio/ipc.c index cd438ad3d..45d95bc11 100644 --- a/platform/linux-generic/pktio/ipc.c +++ b/platform/linux-generic/pktio/ipc.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp_packet_io_ipc_internal.h> #include <odp_debug_internal.h> #include <odp_packet_io_internal.h> diff --git a/platform/linux-generic/pktio/loop.c b/platform/linux-generic/pktio/loop.c index 206f43f6c..9dc6b5f94 100644 --- a/platform/linux-generic/pktio/loop.c +++ b/platform/linux-generic/pktio/loop.c @@ -5,8 +5,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp_api.h> #include <odp_packet_internal.h> #include <odp_packet_io_internal.h> diff --git a/platform/linux-generic/pktio/netmap.c b/platform/linux-generic/pktio/netmap.c index 8b38c08db..9767de2f2 100644 --- a/platform/linux-generic/pktio/netmap.c +++ b/platform/linux-generic/pktio/netmap.c @@ -5,7 +5,7 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" +#include <odp/config.h> #ifdef ODP_NETMAP diff --git a/platform/linux-generic/pktio/null.c b/platform/linux-generic/pktio/null.c index 2f1757b6c..bb7f85c9b 100644 --- a/platform/linux-generic/pktio/null.c +++ b/platform/linux-generic/pktio/null.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp_api.h> #include <odp_packet_io_internal.h> diff --git a/platform/linux-generic/pktio/pcap.c b/platform/linux-generic/pktio/pcap.c index 9f7834033..e5709e5fb 100644 --- a/platform/linux-generic/pktio/pcap.c +++ b/platform/linux-generic/pktio/pcap.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - /** * @file * diff --git a/platform/linux-generic/pktio/pktio_common.c b/platform/linux-generic/pktio/pktio_common.c index f0abadd1b..b19a6f647 100644 --- a/platform/linux-generic/pktio/pktio_common.c +++ b/platform/linux-generic/pktio/pktio_common.c @@ -5,8 +5,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp_packet_io_internal.h> #include <errno.h> diff --git a/platform/linux-generic/pktio/ring.c b/platform/linux-generic/pktio/ring.c index 2cf0231cd..903e2c9f1 100644 --- a/platform/linux-generic/pktio/ring.c +++ b/platform/linux-generic/pktio/ring.c @@ -69,8 +69,6 @@ * ***************************************************************************/ -#include "config.h" - #include <odp_api.h> #include <fcntl.h> #include <stdio.h> diff --git a/platform/linux-generic/pktio/socket.c b/platform/linux-generic/pktio/socket.c index 7e195580c..e7e0971c9 100644 --- a/platform/linux-generic/pktio/socket.c +++ b/platform/linux-generic/pktio/socket.c @@ -5,8 +5,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp_posix_extensions.h> #include <sys/socket.h> diff --git a/platform/linux-generic/pktio/socket_common.c b/platform/linux-generic/pktio/socket_common.c index 7dbba6d27..4fbf2f041 100644 --- a/platform/linux-generic/pktio/socket_common.c +++ b/platform/linux-generic/pktio/socket_common.c @@ -4,7 +4,7 @@ * * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" + #include <odp_posix_extensions.h> #include <stdio.h> diff --git a/platform/linux-generic/pktio/socket_mmap.c b/platform/linux-generic/pktio/socket_mmap.c index 6535bc72c..17bebe9a0 100644 --- a/platform/linux-generic/pktio/socket_mmap.c +++ b/platform/linux-generic/pktio/socket_mmap.c @@ -5,7 +5,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" #include <odp_posix_extensions.h> diff --git a/platform/linux-generic/pktio/stats/ethtool_stats.c b/platform/linux-generic/pktio/stats/ethtool_stats.c index bfc2a60ca..1ac3f6db2 100644 --- a/platform/linux-generic/pktio/stats/ethtool_stats.c +++ b/platform/linux-generic/pktio/stats/ethtool_stats.c @@ -4,7 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" #include <odp_posix_extensions.h> #include <sys/ioctl.h> diff --git a/platform/linux-generic/pktio/stats/packet_io_stats.c b/platform/linux-generic/pktio/stats/packet_io_stats.c index be87b5191..abeec0799 100644 --- a/platform/linux-generic/pktio/stats/packet_io_stats.c +++ b/platform/linux-generic/pktio/stats/packet_io_stats.c @@ -4,13 +4,12 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - -#include <string.h> #include <odp_packet_io_stats.h> #include <odp_ethtool_stats.h> #include <odp_sysfs_stats.h> +#include <string.h> + int sock_stats_reset_fd(pktio_entry_t *pktio_entry, int fd) { int err = 0; diff --git a/platform/linux-generic/pktio/stats/sysfs_stats.c b/platform/linux-generic/pktio/stats/sysfs_stats.c index e5fa55442..2de2bb131 100644 --- a/platform/linux-generic/pktio/stats/sysfs_stats.c +++ b/platform/linux-generic/pktio/stats/sysfs_stats.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp_api.h> #include <odp_sysfs_stats.h> #include <odp_errno_define.h> diff --git a/platform/linux-generic/pktio/tap.c b/platform/linux-generic/pktio/tap.c index 19067969f..638edec94 100644 --- a/platform/linux-generic/pktio/tap.c +++ b/platform/linux-generic/pktio/tap.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - /** * @file * diff --git a/platform/linux-generic/test/ring/ring_main.c b/platform/linux-generic/test/ring/ring_main.c index 9b08b634d..8d0f07527 100644 --- a/platform/linux-generic/test/ring/ring_main.c +++ b/platform/linux-generic/test/ring/ring_main.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include "ring_suites.h" int main(int argc, char *argv[]) diff --git a/platform/linux-generic/test/validation/api/shmem/shmem_linux.c b/platform/linux-generic/test/validation/api/shmem/shmem_linux.c index 6b09c1dea..43a640c49 100644 --- a/platform/linux-generic/test/validation/api/shmem/shmem_linux.c +++ b/platform/linux-generic/test/validation/api/shmem/shmem_linux.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - /* this test makes sure that odp shared memory created with the ODP_SHM_PROC * flag is visible under linux, and checks that memory created with the * ODP_SHM_EXPORT flag is visible by other ODP instances. diff --git a/platform/linux-generic/test/validation/api/shmem/shmem_odp1.c b/platform/linux-generic/test/validation/api/shmem/shmem_odp1.c index d44e94c3e..ca28c805c 100644 --- a/platform/linux-generic/test/validation/api/shmem/shmem_odp1.c +++ b/platform/linux-generic/test/validation/api/shmem/shmem_odp1.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp.h> #include <linux/limits.h> #include <sys/types.h> diff --git a/platform/linux-generic/test/validation/api/shmem/shmem_odp2.c b/platform/linux-generic/test/validation/api/shmem/shmem_odp2.c index 7573644c9..2aaa70ac2 100644 --- a/platform/linux-generic/test/validation/api/shmem/shmem_odp2.c +++ b/platform/linux-generic/test/validation/api/shmem/shmem_odp2.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp.h> #include <linux/limits.h> #include <sys/types.h> diff --git a/test/common/mask_common.c b/test/common/mask_common.c index aa003119d..3b6b44102 100644 --- a/test/common/mask_common.c +++ b/test/common/mask_common.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp_api.h> #include "odp_cunit_common.h" diff --git a/test/performance/odp_crypto.c b/test/performance/odp_crypto.c index 665268be0..ded97c03e 100644 --- a/test/performance/odp_crypto.c +++ b/test/performance/odp_crypto.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif /* _GNU_SOURCE */ diff --git a/test/performance/odp_ipsec.c b/test/performance/odp_ipsec.c index e388916c4..efdef0749 100644 --- a/test/performance/odp_ipsec.c +++ b/test/performance/odp_ipsec.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif /* _GNU_SOURCE */ diff --git a/test/validation/api/atomic/atomic.c b/test/validation/api/atomic/atomic.c index 9530df9ca..914e0257e 100644 --- a/test/validation/api/atomic/atomic.c +++ b/test/validation/api/atomic/atomic.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <malloc.h> #include <odp_api.h> #include <odp/helper/odph_api.h> diff --git a/test/validation/api/barrier/barrier.c b/test/validation/api/barrier/barrier.c index 806f2486a..c03151765 100644 --- a/test/validation/api/barrier/barrier.c +++ b/test/validation/api/barrier/barrier.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <malloc.h> #include <odp_api.h> #include <odp/helper/odph_api.h> diff --git a/test/validation/api/buffer/buffer.c b/test/validation/api/buffer/buffer.c index 9f2049034..2d665279a 100644 --- a/test/validation/api/buffer/buffer.c +++ b/test/validation/api/buffer/buffer.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp_api.h> #include "odp_cunit_common.h" diff --git a/test/validation/api/classification/classification.c b/test/validation/api/classification/classification.c index d4285411f..59d9ec00e 100644 --- a/test/validation/api/classification/classification.c +++ b/test/validation/api/classification/classification.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp_api.h> #include <odp_cunit_common.h> #include "odp_classification_testsuites.h" diff --git a/test/validation/api/classification/odp_classification_basic.c b/test/validation/api/classification/odp_classification_basic.c index 8a4e21d3c..c001445e7 100644 --- a/test/validation/api/classification/odp_classification_basic.c +++ b/test/validation/api/classification/odp_classification_basic.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp_cunit_common.h> #include "odp_classification_testsuites.h" #include "classification.h" diff --git a/test/validation/api/classification/odp_classification_test_pmr.c b/test/validation/api/classification/odp_classification_test_pmr.c index 55a86f5bc..bdf9ccf45 100644 --- a/test/validation/api/classification/odp_classification_test_pmr.c +++ b/test/validation/api/classification/odp_classification_test_pmr.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include "odp_classification_testsuites.h" #include "classification.h" #include <odp_cunit_common.h> diff --git a/test/validation/api/classification/odp_classification_tests.c b/test/validation/api/classification/odp_classification_tests.c index 3951d8bed..c58f5e68f 100644 --- a/test/validation/api/classification/odp_classification_tests.c +++ b/test/validation/api/classification/odp_classification_tests.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include "odp_classification_testsuites.h" #include "classification.h" #include <odp_cunit_common.h> diff --git a/test/validation/api/comp/comp.c b/test/validation/api/comp/comp.c index e84764f71..490d5577e 100644 --- a/test/validation/api/comp/comp.c +++ b/test/validation/api/comp/comp.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp_api.h> #include <odp_cunit_common.h> #include "test_vectors.h" diff --git a/test/validation/api/cpumask/cpumask.c b/test/validation/api/cpumask/cpumask.c index a67a81a27..eb131a142 100644 --- a/test/validation/api/cpumask/cpumask.c +++ b/test/validation/api/cpumask/cpumask.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp_api.h> #include "odp_cunit_common.h" diff --git a/test/validation/api/crypto/odp_crypto_test_inp.c b/test/validation/api/crypto/odp_crypto_test_inp.c index faf4dba83..f0aa366cb 100644 --- a/test/validation/api/crypto/odp_crypto_test_inp.c +++ b/test/validation/api/crypto/odp_crypto_test_inp.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp_api.h> #include <odp/helper/odph_api.h> #include <CUnit/Basic.h> diff --git a/test/validation/api/errno/errno.c b/test/validation/api/errno/errno.c index e407382e6..ed2ab391d 100644 --- a/test/validation/api/errno/errno.c +++ b/test/validation/api/errno/errno.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp_api.h> #include "odp_cunit_common.h" diff --git a/test/validation/api/event/event.c b/test/validation/api/event/event.c index 52ae4f67b..fbd360350 100644 --- a/test/validation/api/event/event.c +++ b/test/validation/api/event/event.c @@ -4,7 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" #include <odp_api.h> #include <odp_cunit_common.h> diff --git a/test/validation/api/hash/hash.c b/test/validation/api/hash/hash.c index 4edcb08aa..b4f22d609 100644 --- a/test/validation/api/hash/hash.c +++ b/test/validation/api/hash/hash.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp_api.h> #include <odp_cunit_common.h> diff --git a/test/validation/api/init/init_main.c b/test/validation/api/init/init_main.c index 742f02522..6878d36db 100644 --- a/test/validation/api/init/init_main.c +++ b/test/validation/api/init/init_main.c @@ -5,8 +5,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp_api.h> #include <odp_cunit_common.h> diff --git a/test/validation/api/ipsec/ipsec.c b/test/validation/api/ipsec/ipsec.c index 1b17f082e..580190502 100644 --- a/test/validation/api/ipsec/ipsec.c +++ b/test/validation/api/ipsec/ipsec.c @@ -5,8 +5,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp_api.h> #include <odp_cunit_common.h> #include <unistd.h> diff --git a/test/validation/api/ipsec/ipsec_async.c b/test/validation/api/ipsec/ipsec_async.c index 0e9797724..db5c0e58a 100644 --- a/test/validation/api/ipsec/ipsec_async.c +++ b/test/validation/api/ipsec/ipsec_async.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include "ipsec.h" static int ipsec_async_init(odp_instance_t *inst) diff --git a/test/validation/api/ipsec/ipsec_inline_in.c b/test/validation/api/ipsec/ipsec_inline_in.c index e2415d1bc..073922072 100644 --- a/test/validation/api/ipsec/ipsec_inline_in.c +++ b/test/validation/api/ipsec/ipsec_inline_in.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include "ipsec.h" static int ipsec_sync_init(odp_instance_t *inst) diff --git a/test/validation/api/ipsec/ipsec_inline_out.c b/test/validation/api/ipsec/ipsec_inline_out.c index a9d1e222e..d799ca34d 100644 --- a/test/validation/api/ipsec/ipsec_inline_out.c +++ b/test/validation/api/ipsec/ipsec_inline_out.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include "ipsec.h" static int ipsec_sync_init(odp_instance_t *inst) diff --git a/test/validation/api/ipsec/ipsec_sync.c b/test/validation/api/ipsec/ipsec_sync.c index 49c596018..1c41ec7d1 100644 --- a/test/validation/api/ipsec/ipsec_sync.c +++ b/test/validation/api/ipsec/ipsec_sync.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include "ipsec.h" static int ipsec_sync_init(odp_instance_t *inst) diff --git a/test/validation/api/ipsec/ipsec_test_in.c b/test/validation/api/ipsec/ipsec_test_in.c index 515331483..0e23c3681 100644 --- a/test/validation/api/ipsec/ipsec_test_in.c +++ b/test/validation/api/ipsec/ipsec_test_in.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include "ipsec.h" #include "test_vectors.h" diff --git a/test/validation/api/ipsec/ipsec_test_out.c b/test/validation/api/ipsec/ipsec_test_out.c index ee3fd43fb..48a6b80cd 100644 --- a/test/validation/api/ipsec/ipsec_test_out.c +++ b/test/validation/api/ipsec/ipsec_test_out.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include "ipsec.h" #include "test_vectors.h" diff --git a/test/validation/api/lock/lock.c b/test/validation/api/lock/lock.c index b8502f011..33698d6ef 100644 --- a/test/validation/api/lock/lock.c +++ b/test/validation/api/lock/lock.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <malloc.h> #include <odp_api.h> #include <odp/helper/odph_api.h> diff --git a/test/validation/api/packet/packet.c b/test/validation/api/packet/packet.c index 352fa62c9..a12ad13eb 100644 --- a/test/validation/api/packet/packet.c +++ b/test/validation/api/packet/packet.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <stdlib.h> #include <odp_api.h> diff --git a/test/validation/api/pktio/parser.c b/test/validation/api/pktio/parser.c index db37c1c5b..e23e7d0c4 100644 --- a/test/validation/api/pktio/parser.c +++ b/test/validation/api/pktio/parser.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp_api.h> #include <odp_cunit_common.h> #include <test_packet_parser.h> diff --git a/test/validation/api/pktio/pktio.c b/test/validation/api/pktio/pktio.c index ae7ccbb6b..f035b8cd4 100644 --- a/test/validation/api/pktio/pktio.c +++ b/test/validation/api/pktio/pktio.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp_api.h> #include <odp_cunit_common.h> diff --git a/test/validation/api/pool/pool.c b/test/validation/api/pool/pool.c index c3def1b05..ec1b2ff5d 100644 --- a/test/validation/api/pool/pool.c +++ b/test/validation/api/pool/pool.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp_api.h> #include "odp_cunit_common.h" diff --git a/test/validation/api/queue/queue.c b/test/validation/api/queue/queue.c index b58ccfb15..807ca5291 100644 --- a/test/validation/api/queue/queue.c +++ b/test/validation/api/queue/queue.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp_api.h> #include <odp_cunit_common.h> diff --git a/test/validation/api/random/random.c b/test/validation/api/random/random.c index 9026ba9a8..cf7163e2d 100644 --- a/test/validation/api/random/random.c +++ b/test/validation/api/random/random.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp_api.h> #include <odp_cunit_common.h> diff --git a/test/validation/api/scheduler/scheduler.c b/test/validation/api/scheduler/scheduler.c index bcee0d193..6332302b9 100644 --- a/test/validation/api/scheduler/scheduler.c +++ b/test/validation/api/scheduler/scheduler.c @@ -5,8 +5,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp_api.h> #include "odp_cunit_common.h" #include <odp/helper/odph_api.h> diff --git a/test/validation/api/shmem/shmem.c b/test/validation/api/shmem/shmem.c index 4e2c13a22..c5a161319 100644 --- a/test/validation/api/shmem/shmem.c +++ b/test/validation/api/shmem/shmem.c @@ -5,8 +5,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp_api.h> #include <odp_cunit_common.h> #include <stdlib.h> diff --git a/test/validation/api/std_clib/std_clib.c b/test/validation/api/std_clib/std_clib.c index ccae54127..35ad6f92b 100644 --- a/test/validation/api/std_clib/std_clib.c +++ b/test/validation/api/std_clib/std_clib.c @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" - #include <odp_api.h> #include <odp_cunit_common.h> diff --git a/test/validation/api/time/time.c b/test/validation/api/time/time.c index 2113c5461..3add81976 100644 --- a/test/validation/api/time/time.c +++ b/test/validation/api/time/time.c @@ -4,11 +4,14 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include "config.h" +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif + +#include <time.h> #include <odp_api.h> #include "odp_cunit_common.h" -#include <time.h> #define BUSY_LOOP_CNT 30000000 /* used for t > min resolution */ #define BUSY_LOOP_CNT_LONG 6000000000 /* used for t > 4 sec */ ----------------------------------------------------------------------- Summary of changes: .gitignore | 4 ++-- configure.ac | 2 +- helper/chksum.c | 2 -- helper/cuckootable.c | 2 -- helper/eth.c | 2 -- helper/hashtable.c | 2 -- helper/include/odp/helper/odph_debug.h | 2 +- helper/ip.c | 2 -- helper/iplookuptable.c | 2 -- helper/lineartable.c | 2 -- helper/linux/thread.c | 2 -- helper/test/chksum.c | 2 -- helper/test/cuckootable.c | 2 -- helper/test/debug.c | 2 +- helper/test/iplookuptable.c | 2 -- helper/test/linux/process.c | 2 -- helper/test/linux/pthread.c | 2 -- helper/test/odpthreads.c | 2 -- helper/test/parse.c | 2 -- helper/test/table.c | 2 -- helper/test/version.c | 2 -- helper/threads.c | 2 -- include/Makefile.am | 1 + platform/linux-generic/arch/aarch64/odp_global_time.c | 2 -- platform/linux-generic/arch/aarch64/odp_sysinfo_parse.c | 1 - platform/linux-generic/arch/default/odp_cpu_cycles.c | 2 -- platform/linux-generic/arch/default/odp_sysinfo_parse.c | 2 -- platform/linux-generic/arch/mips64/odp_cpu_cycles.c | 2 -- platform/linux-generic/arch/mips64/odp_sysinfo_parse.c | 2 -- platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c | 2 -- platform/linux-generic/arch/x86/cpu_flags.c | 2 -- platform/linux-generic/arch/x86/odp_global_time.c | 2 -- platform/linux-generic/arch/x86/odp_sysinfo_parse.c | 2 -- platform/linux-generic/include/odp_debug_internal.h | 7 +++++-- platform/linux-generic/include/odp_packet_io_internal.h | 3 +++ platform/linux-generic/include/odp_schedule_if.h | 2 -- platform/linux-generic/odp_atomic.c | 2 -- platform/linux-generic/odp_atomic_api.c | 2 -- platform/linux-generic/odp_barrier.c | 2 -- platform/linux-generic/odp_bitmap.c | 2 -- platform/linux-generic/odp_buffer.c | 2 -- platform/linux-generic/odp_byteorder_api.c | 2 -- platform/linux-generic/odp_classification.c | 2 -- platform/linux-generic/odp_comp.c | 1 - platform/linux-generic/odp_cpu_api.c | 2 -- platform/linux-generic/odp_cpumask.c | 2 -- platform/linux-generic/odp_cpumask_task.c | 2 -- platform/linux-generic/odp_crypto_null.c | 2 -- platform/linux-generic/odp_crypto_openssl.c | 2 -- platform/linux-generic/odp_errno.c | 2 -- platform/linux-generic/odp_event.c | 2 -- platform/linux-generic/odp_event_api.c | 2 -- platform/linux-generic/odp_fdserver.c | 2 -- platform/linux-generic/odp_hash_crc32c.c | 2 -- platform/linux-generic/odp_impl.c | 2 +- platform/linux-generic/odp_init.c | 2 -- platform/linux-generic/odp_ipsec.c | 2 -- platform/linux-generic/odp_ipsec_events.c | 2 -- platform/linux-generic/odp_ipsec_sad.c | 2 -- platform/linux-generic/odp_ishm.c | 2 -- platform/linux-generic/odp_ishmphy.c | 2 -- platform/linux-generic/odp_ishmpool.c | 1 - platform/linux-generic/odp_libconfig.c | 2 -- platform/linux-generic/odp_name_table.c | 2 -- platform/linux-generic/odp_packet.c | 2 +- platform/linux-generic/odp_packet_api.c | 2 -- platform/linux-generic/odp_packet_flags.c | 2 -- platform/linux-generic/odp_packet_flags_api.c | 2 -- platform/linux-generic/odp_packet_io.c | 3 +-- platform/linux-generic/odp_pcapng.c | 2 +- platform/linux-generic/odp_pkt_queue.c | 2 -- platform/linux-generic/odp_pktio_api.c | 2 -- platform/linux-generic/odp_pool.c | 2 -- platform/linux-generic/odp_queue_api.c | 2 -- platform/linux-generic/odp_queue_basic.c | 2 -- platform/linux-generic/odp_queue_if.c | 2 +- platform/linux-generic/odp_queue_lf.c | 1 - platform/linux-generic/odp_queue_scalable.c | 1 - platform/linux-generic/odp_queue_spsc.c | 1 - platform/linux-generic/odp_random_null.c | 2 -- platform/linux-generic/odp_random_openssl.c | 2 -- platform/linux-generic/odp_rwlock.c | 2 -- platform/linux-generic/odp_rwlock_recursive.c | 2 -- platform/linux-generic/odp_schedule_basic.c | 5 ++--- platform/linux-generic/odp_schedule_if.c | 2 +- platform/linux-generic/odp_schedule_scalable.c | 1 - platform/linux-generic/odp_schedule_scalable_ordered.c | 1 - platform/linux-generic/odp_schedule_sp.c | 5 ++--- platform/linux-generic/odp_shared_memory.c | 2 -- platform/linux-generic/odp_sorted_list.c | 2 -- platform/linux-generic/odp_spinlock.c | 2 -- platform/linux-generic/odp_spinlock_recursive.c | 2 -- platform/linux-generic/odp_std_clib_api.c | 2 -- platform/linux-generic/odp_sync_api.c | 2 -- platform/linux-generic/odp_system_info.c | 2 -- platform/linux-generic/odp_thread.c | 2 -- platform/linux-generic/odp_thread_api.c | 2 -- platform/linux-generic/odp_thrmask.c | 2 -- platform/linux-generic/odp_ticketlock_api.c | 2 -- platform/linux-generic/odp_time.c | 2 -- platform/linux-generic/odp_time_api.c | 2 -- platform/linux-generic/odp_timer.c | 2 -- platform/linux-generic/odp_timer_wheel.c | 2 -- platform/linux-generic/odp_traffic_mngr.c | 1 - platform/linux-generic/odp_version.c | 2 -- platform/linux-generic/odp_weak.c | 2 -- platform/linux-generic/pktio/dpdk.c | 2 +- platform/linux-generic/pktio/dpdk_parse.c | 2 +- platform/linux-generic/pktio/ethtool_rss.c | 1 - platform/linux-generic/pktio/io_ops.c | 3 +-- platform/linux-generic/pktio/ipc.c | 2 -- platform/linux-generic/pktio/loop.c | 2 -- platform/linux-generic/pktio/netmap.c | 2 +- platform/linux-generic/pktio/null.c | 2 -- platform/linux-generic/pktio/pcap.c | 2 -- platform/linux-generic/pktio/pktio_common.c | 2 -- platform/linux-generic/pktio/ring.c | 2 -- platform/linux-generic/pktio/socket.c | 2 -- platform/linux-generic/pktio/socket_common.c | 2 +- platform/linux-generic/pktio/socket_mmap.c | 1 - platform/linux-generic/pktio/stats/ethtool_stats.c | 1 - platform/linux-generic/pktio/stats/packet_io_stats.c | 5 ++--- platform/linux-generic/pktio/stats/sysfs_stats.c | 2 -- platform/linux-generic/pktio/tap.c | 2 -- platform/linux-generic/test/ring/ring_main.c | 2 -- platform/linux-generic/test/validation/api/shmem/shmem_linux.c | 2 -- platform/linux-generic/test/validation/api/shmem/shmem_odp1.c | 2 -- platform/linux-generic/test/validation/api/shmem/shmem_odp2.c | 2 -- test/common/mask_common.c | 2 -- test/performance/odp_crypto.c | 2 -- test/performance/odp_ipsec.c | 2 -- test/validation/api/atomic/atomic.c | 2 -- test/validation/api/barrier/barrier.c | 2 -- test/validation/api/buffer/buffer.c | 2 -- test/validation/api/classification/classification.c | 2 -- test/validation/api/classification/odp_classification_basic.c | 2 -- test/validation/api/classification/odp_classification_test_pmr.c | 2 -- test/validation/api/classification/odp_classification_tests.c | 2 -- test/validation/api/comp/comp.c | 2 -- test/validation/api/cpumask/cpumask.c | 2 -- test/validation/api/crypto/odp_crypto_test_inp.c | 2 -- test/validation/api/errno/errno.c | 2 -- test/validation/api/event/event.c | 1 - test/validation/api/hash/hash.c | 2 -- test/validation/api/init/init_main.c | 2 -- test/validation/api/ipsec/ipsec.c | 2 -- test/validation/api/ipsec/ipsec_async.c | 2 -- test/validation/api/ipsec/ipsec_inline_in.c | 2 -- test/validation/api/ipsec/ipsec_inline_out.c | 2 -- test/validation/api/ipsec/ipsec_sync.c | 2 -- test/validation/api/ipsec/ipsec_test_in.c | 2 -- test/validation/api/ipsec/ipsec_test_out.c | 2 -- test/validation/api/lock/lock.c | 2 -- test/validation/api/packet/packet.c | 2 -- test/validation/api/pktio/parser.c | 2 -- test/validation/api/pktio/pktio.c | 2 -- test/validation/api/pool/pool.c | 2 -- test/validation/api/queue/queue.c | 2 -- test/validation/api/random/random.c | 2 -- test/validation/api/scheduler/scheduler.c | 2 -- test/validation/api/shmem/shmem.c | 2 -- test/validation/api/std_clib/std_clib.c | 2 -- test/validation/api/time/time.c | 7 +++++-- 163 files changed, 36 insertions(+), 300 deletions(-) hooks/post-receive --
5 years, 3 months
1
0
0
0
[COMMIT] branch master updated. v1.21.0.0-209-g235478efa
by git@git-us.linaro.org
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(a)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(a)nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen(a)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(a)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(a)nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen(a)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(a)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(a)nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen(a)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(a)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(a)nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen(a)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(a)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(a)nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen(a)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(a)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(a)nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen(a)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 --
5 years, 3 months
1
0
0
0
[COMMIT] branch master updated. v1.21.0.0-203-g5a63614fd
by git@git-us.linaro.org
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 5a63614fd03e4fafe24ea576790c44792d998a1c (commit) via ccb26bd2248598b5f6327ff1f7f335f1827475e7 (commit) via 440c1585eef9f5b6d27bae422bfac36c15094101 (commit) via 7459f7cc1eb2235f283ef18e69567e2da6eea035 (commit) via 00707d7ce917a860f29e4a55e82d95cc6a849d4e (commit) from c6d92eeac0e503d53a8e805635ec78a9e9e31338 (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 5a63614fd03e4fafe24ea576790c44792d998a1c Author: Matias Elo <matias.elo(a)nokia.com> Date: Thu Sep 12 12:42:57 2019 +0300 linux-gen: README: add documentation for pktio type specification Document how to explicitly specify the used implementation internal pktio type. Includes also additional cleanup. Signed-off-by: Matias Elo <matias.elo(a)nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen(a)nokia.com> diff --git a/platform/linux-generic/README b/platform/linux-generic/README index 532f3768f..04267909b 100644 --- a/platform/linux-generic/README +++ b/platform/linux-generic/README @@ -1,17 +1,43 @@ Copyright (c) 2014-2018, Linaro Limited +Copyright (c) 2019, Nokia All rights reserved. SPDX-License-Identifier: BSD-3-Clause 1. Intro - -OpenDataPlane implementation for Linux generic. Directory linux-generic contains ODP headers and implementation -for linux-generic target. This drop does not target high -performance. It is rather proof of ODP API functionality. It still uses -linux-generic's SW scheduler. + OpenDataPlane API generic Linux implementation. Directory linux-generic + contains the header and source files and additional platform test scripts + for ODP linux-generic implementation. 2. Build -# To compile ODP -./bootstrap -./configure -make + See DEPENDENCIES file about system requirements and dependencies to external + libraries/packages. It contains also more detailed build instructions. + + Generally, ODP is built with these three steps: + ./bootstrap + ./configure + make + +3. Configuration file + See config/README for application runtime configuration options. + +4. Packet I/O + When passing a packet I/O device name to odp_pktio_open() one can explicitly + specify the used implementation internal pktio type. The pktio type can be + selected by adding a pktio type prefix to the device name separated by a + colon (<pktio_type>:<if_name>). + + E.g. + socket:eth1 + netmap:eth2 + + The supported pktio types are: + dpdk + ipc + loop + netmap + null + pcap + socket + socket_mmap + tap commit ccb26bd2248598b5f6327ff1f7f335f1827475e7 Author: Matias Elo <matias.elo(a)nokia.com> Date: Thu Sep 12 10:59:05 2019 +0300 linux-gen: pktio: explicitly define pktio type for validation tests Signed-off-by: Matias Elo <matias.elo(a)nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen(a)nokia.com> diff --git a/platform/linux-generic/test/validation/api/pktio/pktio_run_dpdk.sh b/platform/linux-generic/test/validation/api/pktio/pktio_run_dpdk.sh index 6140fb4c9..39b540228 100755 --- a/platform/linux-generic/test/validation/api/pktio/pktio_run_dpdk.sh +++ b/platform/linux-generic/test/validation/api/pktio/pktio_run_dpdk.sh @@ -75,8 +75,8 @@ run() if [ "$ODP_PKTIO_IF0" = "" ]; then setup_pktio_env clean export ODP_PKTIO_DPDK_PARAMS="--no-pci --vdev net_pcap0,iface=$IF0 --vdev net_pcap1,iface=$IF1" - export ODP_PKTIO_IF0=0 - export ODP_PKTIO_IF1=1 + export ODP_PKTIO_IF0=dpdk:0 + export ODP_PKTIO_IF1=dpdk:1 fi run_test diff --git a/platform/linux-generic/test/validation/api/pktio/pktio_run_netmap.sh b/platform/linux-generic/test/validation/api/pktio/pktio_run_netmap.sh index 2b58f28f0..f4851483b 100755 --- a/platform/linux-generic/test/validation/api/pktio/pktio_run_netmap.sh +++ b/platform/linux-generic/test/validation/api/pktio/pktio_run_netmap.sh @@ -84,8 +84,8 @@ run_test_veth() fi setup_pktio_env clean - export ODP_PKTIO_IF0=$IF0 - export ODP_PKTIO_IF1=$IF1 + export ODP_PKTIO_IF0=netmap:$IF0 + export ODP_PKTIO_IF1=netmap:$IF1 run_test return $? } commit 440c1585eef9f5b6d27bae422bfac36c15094101 Author: Matias Elo <matias.elo(a)nokia.com> Date: Wed Sep 11 17:17:30 2019 +0300 linux-gen: pktio: enable explicit pktio type definition Previously, the odp_pktio_open() implementation called open() for all implementation internal pktio types in predefined order until the call succeeded or all pktio types failed. Add option to explicitly define the used pktio type per device. This enables the user to use multiple pktio types within a single application. The pktio type is selected by adding pktio_type prefix in front of device name separated by a colon (<pktio_type>:<if_name>). E.g. socket:eth1 netmap:eth2 Signed-off-by: Matias Elo <matias.elo(a)nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen(a)nokia.com> Suggested-by: Risto Teittinen <risto.teittinen(a)nokia-bell-labs.com> diff --git a/platform/linux-generic/include/odp_packet_io_internal.h b/platform/linux-generic/include/odp_packet_io_internal.h index 40f5f5a3e..18bbf6de8 100644 --- a/platform/linux-generic/include/odp_packet_io_internal.h +++ b/platform/linux-generic/include/odp_packet_io_internal.h @@ -1,4 +1,5 @@ /* Copyright (c) 2013-2018, Linaro Limited + * Copyright (c) 2019, Nokia * All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause @@ -93,8 +94,10 @@ struct pktio_entry { odp_proto_chksums_t in_chksums; /**< Checksums validation settings */ pktio_stats_type_t stats_type; char name[PKTIO_NAME_LEN]; /**< name of pktio provided to - pktio_open() */ - + internal pktio_open() calls */ + char full_name[PKTIO_NAME_LEN]; /**< original pktio name passed to + odp_pktio_open() and returned by + odp_pktio_info() */ odp_pool_t pool; odp_pktio_param_t param; odp_pktio_capability_t capa; /**< Packet IO capabilities */ diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c index bb3c46a7b..91555c680 100644 --- a/platform/linux-generic/odp_packet_io.c +++ b/platform/linux-generic/odp_packet_io.c @@ -195,6 +195,56 @@ static odp_pktio_t alloc_lock_pktio_entry(void) return ODP_PKTIO_INVALID; } +/** + * Strip optional pktio type from device name by moving start pointer + * + * @param name Packet IO device name + * @param[out] type_out Optional char array (len = PKTIO_NAME_LEN) for storing + * pktio type. Ignored when NULL. + * + * @return Pointer to the beginning of device name + */ +static const char *strip_pktio_type(const char *name, char *type_out) +{ + const char *if_name; + + if (type_out) + type_out[0] = '\0'; + + /* Strip pktio type prefix <pktio_type>:<if_name> */ + if_name = strchr(name, ':'); + + if (if_name) { + int pktio_if; + int type_len = if_name - name; + char pktio_type[type_len + 1]; + + strncpy(pktio_type, name, type_len); + pktio_type[type_len] = '\0'; + + /* Remove colon */ + if_name++; + + /* Match if_type to enabled pktio devices */ + for (pktio_if = 0; pktio_if_ops[pktio_if]; pktio_if++) { + if (!strcmp(pktio_type, pktio_if_ops[pktio_if]->name)) { + if (type_out) + strcpy(type_out, pktio_type); + /* Some pktio devices expect device names to + * begin with pktio type */ + if (!strcmp(pktio_type, "ipc") || + !strcmp(pktio_type, "null") || + !strcmp(pktio_type, "pcap") || + !strcmp(pktio_type, "tap")) + return name; + + return if_name; + } + } + } + return name; +} + static odp_pktio_t setup_pktio_entry(const char *name, odp_pool_t pool, const odp_pktio_param_t *param) { @@ -202,6 +252,8 @@ static odp_pktio_t setup_pktio_entry(const char *name, odp_pool_t pool, pktio_entry_t *pktio_entry; int ret = -1; int pktio_if; + char pktio_type[PKTIO_NAME_LEN]; + const char *if_name; if (strlen(name) >= PKTIO_NAME_LEN - 1) { /* ioctl names limitation */ @@ -210,6 +262,8 @@ static odp_pktio_t setup_pktio_entry(const char *name, odp_pool_t pool, return ODP_PKTIO_INVALID; } + if_name = strip_pktio_type(name, pktio_type); + hdl = alloc_lock_pktio_entry(); if (hdl == ODP_PKTIO_INVALID) { ODP_ERR("No resources available.\n"); @@ -230,7 +284,12 @@ static odp_pktio_t setup_pktio_entry(const char *name, odp_pool_t pool, odp_pktio_config_init(&pktio_entry->s.config); for (pktio_if = 0; pktio_if_ops[pktio_if]; ++pktio_if) { - ret = pktio_if_ops[pktio_if]->open(hdl, pktio_entry, name, + /* Only use explicitly defined pktio type */ + if (strlen(pktio_type) && + strcmp(pktio_if_ops[pktio_if]->name, pktio_type)) + continue; + + ret = pktio_if_ops[pktio_if]->open(hdl, pktio_entry, if_name, pool); if (!ret) break; @@ -244,7 +303,9 @@ static odp_pktio_t setup_pktio_entry(const char *name, odp_pool_t pool, } snprintf(pktio_entry->s.name, - sizeof(pktio_entry->s.name), "%s", name); + sizeof(pktio_entry->s.name), "%s", if_name); + snprintf(pktio_entry->s.full_name, + sizeof(pktio_entry->s.full_name), "%s", name); pktio_entry->s.state = PKTIO_STATE_OPENED; pktio_entry->s.ops = pktio_if_ops[pktio_if]; unlock_entry(pktio_entry); @@ -588,8 +649,11 @@ odp_pktio_t odp_pktio_lookup(const char *name) { odp_pktio_t hdl = ODP_PKTIO_INVALID; pktio_entry_t *entry; + const char *ifname; int i; + ifname = strip_pktio_type(name, NULL); + odp_spinlock_lock(&pktio_tbl->lock); for (i = 0; i < ODP_CONFIG_PKTIO_ENTRIES; ++i) { @@ -600,7 +664,7 @@ odp_pktio_t odp_pktio_lookup(const char *name) lock_entry(entry); if (entry->s.state >= PKTIO_STATE_ACTIVE && - strncmp(entry->s.name, name, sizeof(entry->s.name)) == 0) + strncmp(entry->s.name, ifname, sizeof(entry->s.name)) == 0) hdl = _odp_cast_scalar(odp_pktio_t, i + 1); unlock_entry(entry); @@ -1139,7 +1203,7 @@ int odp_pktio_info(odp_pktio_t hdl, odp_pktio_info_t *info) } memset(info, 0, sizeof(odp_pktio_info_t)); - info->name = entry->s.name; + info->name = entry->s.full_name; info->drv_name = entry->s.ops->name; info->pool = entry->s.pool; memcpy(&info->param, &entry->s.param, sizeof(odp_pktio_param_t)); commit 7459f7cc1eb2235f283ef18e69567e2da6eea035 Author: Matias Elo <matias.elo(a)nokia.com> Date: Fri Sep 13 10:49:20 2019 +0300 linux-gen: netmap: lower interface MTU if necessary Netmap has introduced additional check to nm_open() to verify that interface MTU <= netmap buffer size. To pass this check interface MTU may have to be lowered before nm_open() call. Signed-off-by: Matias Elo <matias.elo(a)nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen(a)nokia.com> diff --git a/platform/linux-generic/pktio/netmap.c b/platform/linux-generic/pktio/netmap.c index 8fb231534..8b38c08db 100644 --- a/platform/linux-generic/pktio/netmap.c +++ b/platform/linux-generic/pktio/netmap.c @@ -1,4 +1,5 @@ /* Copyright (c) 2015-2018, Linaro Limited + * Copyright (c) 2019, Nokia * All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause @@ -34,7 +35,6 @@ #include <odp_classification_internal.h> #include <odp_libconfig_internal.h> - #include <inttypes.h> /* Disable netmap debug prints */ @@ -52,6 +52,8 @@ #define NM_MAX_DESC 64 +#define NM_BUF_SIZE "/sys/module/netmap/parameters/buf_size" + /** netmap runtime configuration options */ typedef struct { int nr_rx_slots; @@ -114,6 +116,29 @@ static inline pkt_netmap_t *pkt_priv(pktio_entry_t *pktio_entry) static int disable_pktio; /** !0 this pktio disabled, 0 enabled */ static int netmap_stats_reset(pktio_entry_t *pktio_entry); +static int read_netmap_buf_size(void) +{ + FILE *file; + char str[128]; + int size = 0; + + file = fopen(NM_BUF_SIZE, "rt"); + if (file == NULL) { + /* File not found */ + return 0; + } + + if (fgets(str, sizeof(str), file) != NULL) { + /* Read netmap buffer size */ + if (sscanf(str, "%i", &size) != 1) + size = 0; + } + + fclose(file); + + return size; +} + static int lookup_opt(const char *opt_name, const char *drv_name, int *val) { const char *base = "pktio_netmap"; @@ -443,10 +468,9 @@ static int netmap_open(odp_pktio_t id ODP_UNUSED, pktio_entry_t *pktio_entry, int sockfd; const char *prefix; uint32_t mtu; - uint32_t buf_size; + uint32_t nm_buf_size; pkt_netmap_t *pkt_nm = pkt_priv(pktio_entry); struct nm_desc *desc; - struct netmap_ring *ring; odp_pktin_hash_proto_t hash_proto; odp_pktio_stats_t cur_stats; @@ -480,6 +504,39 @@ static int netmap_open(odp_pktio_t id ODP_UNUSED, pktio_entry_t *pktio_entry, return -1; } + /* Read netmap buffer size */ + nm_buf_size = read_netmap_buf_size(); + if (!nm_buf_size) { + ODP_ERR("Unable to read netmap buf size\n"); + return -1; + } + + if (!pkt_nm->is_virtual) { + sockfd = socket(AF_INET, SOCK_DGRAM, 0); + if (sockfd == -1) { + ODP_ERR("Cannot get device control socket\n"); + return -1; + } + pkt_nm->sockfd = sockfd; + + /* Use either interface MTU or netmap buffer size as MTU, + * whichever is smaller. */ + mtu = mtu_get_fd(pkt_nm->sockfd, pkt_nm->if_name); + if (mtu == 0) { + ODP_ERR("Unable to read interface MTU\n"); + goto error; + } + pkt_nm->mtu = (mtu < nm_buf_size) ? mtu : nm_buf_size; + + /* Netmap requires that interface MTU size <= nm buf size */ + if (mtu > nm_buf_size) { + if (mtu_set_fd(pkt_nm->sockfd, pkt_nm->if_name, + nm_buf_size)) { + ODP_ERR("Unable to set interface MTU\n"); + goto error; + } + } + } /* Dummy open here to check if netmap module is available and to read * capability info. */ desc = nm_open(pkt_nm->nm_name, NULL, 0, NULL); @@ -492,8 +549,6 @@ static int netmap_open(odp_pktio_t id ODP_UNUSED, pktio_entry_t *pktio_entry, netmap_init_capability(pktio_entry); - ring = NETMAP_RXRING(desc->nifp, desc->cur_rx_ring); - buf_size = ring->nr_buf_size; nm_close(desc); for (i = 0; i < PKTIO_MAX_QUEUES; i++) { @@ -511,7 +566,7 @@ static int netmap_open(odp_pktio_t id ODP_UNUSED, pktio_entry_t *pktio_entry, pktio_entry->s.capa.max_input_queues = 1; pktio_entry->s.capa.set_op.op.promisc_mode = 0; - pkt_nm->mtu = buf_size; + pkt_nm->mtu = nm_buf_size; pktio_entry->s.stats_type = STATS_UNSUPPORTED; /* Set MAC address for virtual interface */ pkt_nm->if_mac[0] = 0x2; @@ -524,24 +579,9 @@ static int netmap_open(odp_pktio_t id ODP_UNUSED, pktio_entry_t *pktio_entry, return 0; } - sockfd = socket(AF_INET, SOCK_DGRAM, 0); - if (sockfd == -1) { - ODP_ERR("Cannot get device control socket\n"); - goto error; - } - pkt_nm->sockfd = sockfd; - - /* Use either interface MTU or netmap buffer size as MTU, whichever is - * smaller. */ - mtu = mtu_get_fd(pkt_priv(pktio_entry)->sockfd, pkt_nm->if_name); - if (mtu == 0) { - ODP_ERR("Unable to read interface MTU\n"); - goto error; - } - pkt_nm->mtu = (mtu < buf_size) ? mtu : buf_size; - /* Check if RSS is supported. If not, set 'max_input_queues' to 1. */ - if (rss_conf_get_supported_fd(sockfd, netdev, &hash_proto) == 0) { + if (rss_conf_get_supported_fd(pkt_nm->sockfd, netdev, + &hash_proto) == 0) { ODP_DBG("RSS not supported\n"); pktio_entry->s.capa.max_input_queues = 1; } @@ -552,13 +592,12 @@ static int netmap_open(odp_pktio_t id ODP_UNUSED, pktio_entry_t *pktio_entry, if ((pkt_nm->if_flags & IFF_UP) == 0) ODP_DBG("%s is down\n", pkt_nm->if_name); - err = mac_addr_get_fd(sockfd, netdev, pkt_nm->if_mac); + err = mac_addr_get_fd(pkt_nm->sockfd, netdev, pkt_nm->if_mac); if (err) goto error; /* netmap uses only ethtool to get statistics counters */ - err = ethtool_stats_get_fd(pkt_priv(pktio_entry)->sockfd, - pkt_nm->if_name, &cur_stats); + err = ethtool_stats_get_fd(pkt_nm->sockfd, pkt_nm->if_name, &cur_stats); if (err) { ODP_ERR("netmap pktio %s does not support statistics counters\n", pkt_nm->if_name); commit 00707d7ce917a860f29e4a55e82d95cc6a849d4e Author: Matias Elo <matias.elo(a)nokia.com> Date: Fri Sep 13 10:48:45 2019 +0300 linux-gen: pktio: add helper function for setting interface mtu Signed-off-by: Matias Elo <matias.elo(a)nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen(a)nokia.com> diff --git a/platform/linux-generic/include/odp_socket_common.h b/platform/linux-generic/include/odp_socket_common.h index 4c6b3e636..afce0f55d 100644 --- a/platform/linux-generic/include/odp_socket_common.h +++ b/platform/linux-generic/include/odp_socket_common.h @@ -1,4 +1,5 @@ /* Copyright (c) 2018, Linaro Limited + * Copyright (c) 2019, Nokia * All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause @@ -36,6 +37,11 @@ int mac_addr_get_fd(int fd, const char *name, unsigned char mac_dst[]); */ uint32_t mtu_get_fd(int fd, const char *name); +/** + * Set a packet socket MTU + */ +int mtu_set_fd(int fd, const char *name, int mtu); + /** * Enable/Disable promisc mode for a packet socket */ diff --git a/platform/linux-generic/pktio/socket_common.c b/platform/linux-generic/pktio/socket_common.c index f5bf9e008..7dbba6d27 100644 --- a/platform/linux-generic/pktio/socket_common.c +++ b/platform/linux-generic/pktio/socket_common.c @@ -1,4 +1,5 @@ /* Copyright (c) 2018, Linaro Limited + * Copyright (c) 2019, Nokia * All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause @@ -66,6 +67,27 @@ uint32_t mtu_get_fd(int fd, const char *name) return ifr.ifr_mtu + _ODP_ETHHDR_LEN; } +/* + * ODP_PACKET_NETMAP: + */ +int mtu_set_fd(int fd, const char *name, int mtu) +{ + struct ifreq ifr; + int ret; + + snprintf(ifr.ifr_name, IF_NAMESIZE, "%s", name); + ifr.ifr_mtu = mtu; + + ret = ioctl(fd, SIOCSIFMTU, &ifr); + if (ret < 0) { + __odp_errno = errno; + ODP_DBG("ioctl(SIOCSIFMTU): %s: \"%s\".\n", strerror(errno), + ifr.ifr_name); + return -1; + } + return 0; +} + /* * ODP_PACKET_SOCKET_MMSG: * ODP_PACKET_SOCKET_MMAP: ----------------------------------------------------------------------- Summary of changes: platform/linux-generic/README | 44 ++++++++--- .../linux-generic/include/odp_packet_io_internal.h | 7 +- platform/linux-generic/include/odp_socket_common.h | 6 ++ platform/linux-generic/odp_packet_io.c | 72 ++++++++++++++++- platform/linux-generic/pktio/netmap.c | 91 +++++++++++++++------- platform/linux-generic/pktio/socket_common.c | 22 ++++++ .../test/validation/api/pktio/pktio_run_dpdk.sh | 4 +- .../test/validation/api/pktio/pktio_run_netmap.sh | 4 +- 8 files changed, 205 insertions(+), 45 deletions(-) hooks/post-receive --
5 years, 3 months
1
0
0
0
[COMMIT] branch master updated. v1.21.0.0-198-gc6d92eeac
by git@git-us.linaro.org
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 c6d92eeac0e503d53a8e805635ec78a9e9e31338 (commit) via f2ed58011a827959eb81452a99845278acc8a3fb (commit) via 8994bbabb8efb58822b82ad6f03a4f0f332f81cf (commit) via 48e1788231127fd184203d842c95f1560328c7fe (commit) via 7131ada262e45f059b67d5492511a60a3303785a (commit) via ca1003ba1b45a356301587ac31dfca108bf1edcb (commit) via 321f9c88c709c992d395ccff73141d3fa737ab79 (commit) via 77f8e112e5e72d8e6e5bd1c530fccb7557b56124 (commit) via b60c92e93885de2f2b051648632a27413809a01f (commit) via 5355304a9650a2929f080ff66fafeb2792632f06 (commit) from c8d22107bd8b64efc91bc064fe20e7aeeac7efff (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 c6d92eeac0e503d53a8e805635ec78a9e9e31338 Author: Petri Savolainen <petri.savolainen(a)nokia.com> Date: Thu Sep 12 10:59:17 2019 +0300 linux-gen: socket_mmap: move locks into ring struct Locks need to be on separate cachelines to avoid false sharing. Added lock into the ring structure, so that the lock and data it protects are co-located. FD set function still uses the pktio level lock as it does not touch ring structures. Signed-off-by: Petri Savolainen <petri.savolainen(a)nokia.com> Reviewed-by: Matias Elo <matias.elo(a)nokia.com> diff --git a/platform/linux-generic/pktio/socket_mmap.c b/platform/linux-generic/pktio/socket_mmap.c index ca58eb39a..6535bc72c 100644 --- a/platform/linux-generic/pktio/socket_mmap.c +++ b/platform/linux-generic/pktio/socket_mmap.c @@ -59,6 +59,7 @@ /** packet mmap ring */ struct ring { + odp_ticketlock_t lock; struct iovec *rd; unsigned int frame_num; int rd_num; @@ -565,6 +566,8 @@ static int sock_mmap_open(odp_pktio_t id ODP_UNUSED, pkt_sock->frame_offset = 0; pkt_sock->pool = pool; + odp_ticketlock_init(&pkt_sock->rx_ring.lock); + odp_ticketlock_init(&pkt_sock->tx_ring.lock); pkt_sock->rx_ring.shm = ODP_SHM_INVALID; pkt_sock->tx_ring.shm = ODP_SHM_INVALID; pkt_sock->sockfd = mmap_pkt_socket(); @@ -649,10 +652,10 @@ static int sock_mmap_recv(pktio_entry_t *pktio_entry, int index ODP_UNUSED, pkt_sock_mmap_t *const pkt_sock = pkt_priv(pktio_entry); int ret; - odp_ticketlock_lock(&pktio_entry->s.rxl); + odp_ticketlock_lock(&pkt_sock->rx_ring.lock); ret = pkt_mmap_v2_rx(pktio_entry, pkt_sock, pkt_table, num, pkt_sock->if_mac); - odp_ticketlock_unlock(&pktio_entry->s.rxl); + odp_ticketlock_unlock(&pkt_sock->rx_ring.lock); return ret; } @@ -748,10 +751,10 @@ static int sock_mmap_send(pktio_entry_t *pktio_entry, int index ODP_UNUSED, int ret; pkt_sock_mmap_t *const pkt_sock = pkt_priv(pktio_entry); - odp_ticketlock_lock(&pktio_entry->s.txl); + odp_ticketlock_lock(&pkt_sock->tx_ring.lock); ret = pkt_mmap_v2_tx(pkt_sock->tx_ring.sock, &pkt_sock->tx_ring, pkt_table, num); - odp_ticketlock_unlock(&pktio_entry->s.txl); + odp_ticketlock_unlock(&pkt_sock->tx_ring.lock); return ret; } commit f2ed58011a827959eb81452a99845278acc8a3fb Author: Petri Savolainen <petri.savolainen(a)nokia.com> Date: Thu Sep 12 10:21:59 2019 +0300 linux-gen: socket_mmap: remove redundant header file Remove odp_packet_socket.h as it is only used by socket_mmap.c. Move relevant content to the c file. Signed-off-by: Petri Savolainen <petri.savolainen(a)nokia.com> Reviewed-by: Matias Elo <matias.elo(a)nokia.com> diff --git a/platform/linux-generic/Makefile.am b/platform/linux-generic/Makefile.am index 517ea258b..9f24bc829 100644 --- a/platform/linux-generic/Makefile.am +++ b/platform/linux-generic/Makefile.am @@ -111,7 +111,6 @@ noinst_HEADERS = \ include/odp_packet_io_internal.h \ include/odp_packet_io_ipc_internal.h \ include/odp_packet_io_ring_internal.h \ - include/odp_packet_socket.h \ include/odp_socket_common.h \ include/odp_packet_io_stats_common.h \ include/odp_packet_io_stats.h \ diff --git a/platform/linux-generic/include/odp_packet_socket.h b/platform/linux-generic/include/odp_packet_socket.h deleted file mode 100644 index 16cee16bc..000000000 --- a/platform/linux-generic/include/odp_packet_socket.h +++ /dev/null @@ -1,62 +0,0 @@ -/* Copyright (c) 2013-2018, Linaro Limited - * Copyright (c) 2013, Nokia Solutions and Networks - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#ifndef ODP_PACKET_SOCKET_H -#define ODP_PACKET_SOCKET_H - -#include <linux/if_packet.h> -#include <linux/if_ether.h> -#include <sys/socket.h> -#include <string.h> -#include <stddef.h> - -#include <odp/api/align.h> -#include <odp/api/buffer.h> -#include <odp/api/debug.h> -#include <odp/api/pool.h> -#include <odp/api/packet.h> -#include <odp/api/packet_io.h> -#include <odp/api/shared_memory.h> - -#include <linux/version.h> - -/* - * Packet socket config: - */ - -/* - * This makes sure that building for kernels older than 3.1 works - * and a fanout requests fails (for invalid packet socket option) - * in runtime if requested - */ -#ifndef PACKET_FANOUT -#define PACKET_FANOUT 18 -#define PACKET_FANOUT_HASH 0 -#endif /* PACKET_FANOUT */ - -/** packet mmap ring */ -struct ring { - struct iovec *rd; - unsigned frame_num; - int rd_num; - - odp_shm_t shm; - int sock; - int type; - int version; - uint8_t *mm_space; - size_t mm_len; - size_t rd_len; - int flen; - - struct tpacket_req req; -}; - -ODP_STATIC_ASSERT(offsetof(struct ring, mm_space) <= ODP_CACHE_LINE_SIZE, - "ERR_STRUCT_RING"); - -#endif diff --git a/platform/linux-generic/pktio/socket.c b/platform/linux-generic/pktio/socket.c index cae838e83..7e195580c 100644 --- a/platform/linux-generic/pktio/socket.c +++ b/platform/linux-generic/pktio/socket.c @@ -35,7 +35,6 @@ #include <linux/sockios.h> #include <odp_api.h> -#include <odp_packet_socket.h> #include <odp_socket_common.h> #include <odp_packet_internal.h> #include <odp_packet_io_internal.h> diff --git a/platform/linux-generic/pktio/socket_mmap.c b/platform/linux-generic/pktio/socket_mmap.c index 54fc7367e..ca58eb39a 100644 --- a/platform/linux-generic/pktio/socket_mmap.c +++ b/platform/linux-generic/pktio/socket_mmap.c @@ -24,10 +24,10 @@ #include <sys/ioctl.h> #include <errno.h> #include <time.h> +#include <linux/if_packet.h> #include <odp_api.h> #include <odp/api/plat/packet_inlines.h> -#include <odp_packet_socket.h> #include <odp_socket_common.h> #include <odp_packet_internal.h> #include <odp_packet_io_internal.h> @@ -47,6 +47,37 @@ #define FRAME_MEM_SIZE (4 * 1024 * 1024) #define BLOCK_SIZE (4 * 1024) +/* + * This makes sure that building for kernels older than 3.1 works + * and a fanout requests fails (for invalid packet socket option) + * in runtime if requested + */ +#ifndef PACKET_FANOUT +#define PACKET_FANOUT 18 +#define PACKET_FANOUT_HASH 0 +#endif + +/** packet mmap ring */ +struct ring { + struct iovec *rd; + unsigned int frame_num; + int rd_num; + + odp_shm_t shm; + int sock; + int type; + int version; + uint8_t *mm_space; + size_t mm_len; + size_t rd_len; + int flen; + + struct tpacket_req req; +}; + +ODP_STATIC_ASSERT(offsetof(struct ring, mm_space) <= ODP_CACHE_LINE_SIZE, + "ERR_STRUCT_RING"); + /** Packet socket using mmap rings for both Rx and Tx */ typedef struct { /** Packet mmap ring for Rx */ commit 8994bbabb8efb58822b82ad6f03a4f0f332f81cf Author: Petri Savolainen <petri.savolainen(a)nokia.com> Date: Wed Sep 11 16:58:44 2019 +0300 linux-gen: remove mmap_vlan_ins test Remove redundant test case for VLAN insertion feature, which was removed. Signed-off-by: Petri Savolainen <petri.savolainen(a)nokia.com> Reviewed-by: Matias Elo <matias.elo(a)nokia.com> diff --git a/platform/linux-generic/m4/configure.m4 b/platform/linux-generic/m4/configure.m4 index 3ab01f2b7..461dfc0fb 100644 --- a/platform/linux-generic/m4/configure.m4 +++ b/platform/linux-generic/m4/configure.m4 @@ -38,7 +38,6 @@ AC_CONFIG_FILES([platform/linux-generic/Makefile platform/linux-generic/test/Makefile platform/linux-generic/test/validation/api/shmem/Makefile platform/linux-generic/test/validation/api/pktio/Makefile - platform/linux-generic/test/mmap_vlan_ins/Makefile platform/linux-generic/test/pktio_ipc/Makefile platform/linux-generic/test/ring/Makefile]) ]) diff --git a/platform/linux-generic/test/Makefile.am b/platform/linux-generic/test/Makefile.am index f2ffe995a..d3193b5e9 100644 --- a/platform/linux-generic/test/Makefile.am +++ b/platform/linux-generic/test/Makefile.am @@ -23,15 +23,11 @@ test_SCRIPTS = $(dist_check_SCRIPTS) SUBDIRS += validation/api/pktio\ validation/api/shmem\ - mmap_vlan_ins\ pktio_ipc\ ring if HAVE_PCAP TESTS += validation/api/pktio/pktio_run_pcap.sh - -TESTS += mmap_vlan_ins/mmap_vlan_ins.sh -SUBDIRS += mmap_vlan_ins endif if netmap_support TESTS += validation/api/pktio/pktio_run_netmap.sh diff --git a/platform/linux-generic/test/mmap_vlan_ins/.gitignore b/platform/linux-generic/test/mmap_vlan_ins/.gitignore deleted file mode 100644 index 755fa2ed5..000000000 --- a/platform/linux-generic/test/mmap_vlan_ins/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -*.pcap -plat_mmap_vlan_ins diff --git a/platform/linux-generic/test/mmap_vlan_ins/Makefile.am b/platform/linux-generic/test/mmap_vlan_ins/Makefile.am deleted file mode 100644 index 8559e55b5..000000000 --- a/platform/linux-generic/test/mmap_vlan_ins/Makefile.am +++ /dev/null @@ -1,16 +0,0 @@ -include $(top_srcdir)/test/Makefile.inc -TESTS_ENVIRONMENT += TEST_DIR=${top_builddir}/test/validation - -dist_check_SCRIPTS = \ - mmap_vlan_ins.sh \ - pktio_env - -dist_check_DATA = vlan.pcap - -test_SCRIPTS = $(dist_check_SCRIPTS) -test_DATA = $(dist_check_DATA) - -test_PROGRAMS = plat_mmap_vlan_ins - -# Clonned from example odp_l2fwd simple -plat_mmap_vlan_ins_SOURCES = mmap_vlan_ins.c diff --git a/platform/linux-generic/test/mmap_vlan_ins/mmap_vlan_ins.c b/platform/linux-generic/test/mmap_vlan_ins/mmap_vlan_ins.c deleted file mode 100644 index 563d3d649..000000000 --- a/platform/linux-generic/test/mmap_vlan_ins/mmap_vlan_ins.c +++ /dev/null @@ -1,250 +0,0 @@ -/* Copyright (c) 2016-2018, Linaro Limited - * All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#include "config.h" - -#include <stdlib.h> -#include <stdio.h> -#include <getopt.h> -#include <signal.h> - -#include <odp_api.h> -#include <odp/helper/odph_api.h> - -#define POOL_NUM_PKT 100 -#define POOL_SEG_LEN 1500 -#define MAX_PKT_BURST 32 -#define MAX_WORKERS 1 - -typedef struct { - odp_pktio_t if0, if1; - odp_pktin_queue_t if0in, if1in; - odp_pktout_queue_t if0out, if1out; - odph_ethaddr_t src, dst; - int g_ret; -} global_data_t; - -static global_data_t *global; - -static odp_pktio_t create_pktio(const char *name, odp_pool_t pool, - odp_pktin_queue_t *pktin, - odp_pktout_queue_t *pktout) -{ - odp_pktio_param_t pktio_param; - odp_pktin_queue_param_t in_queue_param; - odp_pktout_queue_param_t out_queue_param; - odp_pktio_t pktio; - - odp_pktio_param_init(&pktio_param); - - pktio = odp_pktio_open(name, pool, &pktio_param); - if (pktio == ODP_PKTIO_INVALID) { - printf("Failed to open %s\n", name); - exit(1); - } - - odp_pktin_queue_param_init(&in_queue_param); - odp_pktout_queue_param_init(&out_queue_param); - - in_queue_param.op_mode = ODP_PKTIO_OP_MT_UNSAFE; - - if (odp_pktin_queue_config(pktio, &in_queue_param)) { - printf("Failed to config input queue for %s\n", name); - exit(1); - } - - out_queue_param.op_mode = ODP_PKTIO_OP_MT_UNSAFE; - - if (odp_pktout_queue_config(pktio, &out_queue_param)) { - printf("Failed to config output queue for %s\n", name); - exit(1); - } - - if (odp_pktin_queue(pktio, pktin, 1) != 1) { - printf("pktin queue query failed for %s\n", name); - exit(1); - } - if (odp_pktout_queue(pktio, pktout, 1) != 1) { - printf("pktout queue query failed for %s\n", name); - exit(1); - } - return pktio; -} - -static int run_worker(void *arg ODP_UNUSED) -{ - odp_packet_t pkt_tbl[MAX_PKT_BURST]; - int pkts, sent, tx_drops, i; - int total_pkts = 0; - uint64_t wait_time = odp_pktin_wait_time(2 * ODP_TIME_SEC_IN_NS); - - if (odp_pktio_start(global->if0)) { - printf("unable to start input interface\n"); - exit(1); - } - printf("started input interface\n"); - if (odp_pktio_start(global->if1)) { - printf("unable to start output interface\n"); - exit(1); - } - printf("started output interface\n"); - printf("started all\n"); - - while (1) { - pkts = odp_pktin_recv_tmo(global->if0in, pkt_tbl, MAX_PKT_BURST, - wait_time); - if (odp_unlikely(pkts <= 0)) { - printf("recv tmo!\n"); - break; - } - - for (i = 0; i < pkts; i++) { - odp_packet_t pkt = pkt_tbl[i]; - odph_ethhdr_t *eth; - - if (odp_unlikely(!odp_packet_has_eth(pkt))) { - printf("warning: packet has no eth header\n"); - return 0; - } - eth = (odph_ethhdr_t *)odp_packet_l2_ptr(pkt, NULL); - eth->src = global->src; - eth->dst = global->dst; - } - sent = odp_pktout_send(global->if1out, pkt_tbl, pkts); - if (sent < 0) - sent = 0; - total_pkts += sent; - tx_drops = pkts - sent; - if (odp_unlikely(tx_drops)) - odp_packet_free_multi(&pkt_tbl[sent], tx_drops); - } - - printf("Total send packets: %d\n", total_pkts); - - if (total_pkts < 10) - global->g_ret = -1; - - return 0; -} - -int main(int argc, char **argv) -{ - odp_pool_t pool; - odp_pool_param_t params; - odp_cpumask_t cpumask; - odph_helper_options_t helper_options; - odph_odpthread_t thd[MAX_WORKERS]; - odp_instance_t instance; - odp_init_t init_param; - odph_odpthread_params_t thr_params; - odp_shm_t shm; - int ret; - - /* Let helper collect its own arguments (e.g. --odph_proc) */ - argc = odph_parse_options(argc, argv); - if (odph_options(&helper_options)) { - printf("Error: reading ODP helper options failed.\n"); - exit(EXIT_FAILURE); - } - - if (argc < 3) { - printf("Too few arguments (%i).\n" - "Two interface names needed as arguments.\n", argc); - exit(0); - } - - odp_init_param_init(&init_param); - init_param.mem_model = helper_options.mem_model; - - if (odp_init_global(&instance, &init_param, NULL)) { - printf("Error: ODP global init failed.\n"); - exit(1); - } - - if (odp_init_local(instance, ODP_THREAD_CONTROL)) { - printf("Error: ODP local init failed.\n"); - exit(1); - } - - /* Reserve memory for args from shared mem */ - shm = odp_shm_reserve("_appl_global_data", sizeof(global_data_t), - ODP_CACHE_LINE_SIZE, 0); - if (shm == ODP_SHM_INVALID) { - printf("Error: shared mem alloc failed.\n"); - exit(EXIT_FAILURE); - } - - global = odp_shm_addr(shm); - if (global == NULL) { - printf("Error: shared mem alloc failed.\n"); - exit(EXIT_FAILURE); - } - - memset(global, 0, sizeof(global_data_t)); - - /* Create packet pool */ - odp_pool_param_init(¶ms); - params.pkt.seg_len = POOL_SEG_LEN; - params.pkt.len = POOL_SEG_LEN; - params.pkt.num = POOL_NUM_PKT; - params.type = ODP_POOL_PACKET; - - pool = odp_pool_create("packet pool", ¶ms); - - if (pool == ODP_POOL_INVALID) { - printf("Error: packet pool create failed.\n"); - exit(1); - } - - global->if0 = create_pktio(argv[1], pool, &global->if0in, - &global->if0out); - global->if1 = create_pktio(argv[2], pool, &global->if1in, - &global->if1out); - - odp_cpumask_default_worker(&cpumask, MAX_WORKERS); - - memset(&thr_params, 0, sizeof(thr_params)); - thr_params.start = run_worker; - thr_params.arg = NULL; - thr_params.thr_type = ODP_THREAD_WORKER; - thr_params.instance = instance; - - odph_odpthreads_create(thd, &cpumask, &thr_params); - odph_odpthreads_join(thd); - - ret = global->g_ret; - - if (odp_pktio_stop(global->if0) || odp_pktio_close(global->if0)) { - printf("Error: failed to close interface %s\n", argv[1]); - exit(EXIT_FAILURE); - } - if (odp_pktio_stop(global->if1) || odp_pktio_close(global->if1)) { - printf("Error: failed to close interface %s\n", argv[2]); - exit(EXIT_FAILURE); - } - - if (odp_pool_destroy(pool)) { - printf("Error: pool destroy\n"); - exit(EXIT_FAILURE); - } - - if (odp_shm_free(shm)) { - printf("Error: shm free global data\n"); - exit(EXIT_FAILURE); - } - - if (odp_term_local()) { - printf("Error: term local\n"); - exit(EXIT_FAILURE); - } - - if (odp_term_global(instance)) { - printf("Error: term global\n"); - exit(EXIT_FAILURE); - } - - return ret; -} diff --git a/platform/linux-generic/test/mmap_vlan_ins/mmap_vlan_ins.sh b/platform/linux-generic/test/mmap_vlan_ins/mmap_vlan_ins.sh deleted file mode 100755 index b0eb046b0..000000000 --- a/platform/linux-generic/test/mmap_vlan_ins/mmap_vlan_ins.sh +++ /dev/null @@ -1,78 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2016-2018, Linaro Limited -# All rights reserved. -# -# SPDX-License-Identifier: BSD-3-Clause -# - -# -# This test is intend to test pkt_mmap_vlan_insert() feature for -# linux-generic packet mmap pktio. -# -# -export ODP_PKTIO_DISABLE_SOCKET_MMSG=1 - -# directory where platform test sources are, including scripts -TEST_SRC_DIR=$(dirname $0) - -# exit codes expected by automake for skipped tests -TEST_SKIPPED=77 - -# directories where binary can be found: -# -in the validation dir when running make check (intree or out of tree) -# -in the script directory, when running after 'make install', or -# -in the validation when running standalone intree. -# -in the current directory. -# running stand alone out of tree requires setting PATH -PATH=${TEST_DIR}/../mmap_vlan_ins:$PATH -PATH=`pwd`/mmap_vlan_ins:$PATH -PATH=$(dirname $0):$PATH -PATH=.:$PATH - -bin_path=$(which plat_mmap_vlan_ins${EXEEXT}) -if [ -x "$bin_path" ] ; then - echo "running with plat_mmap_vlan_ins: $bin_path" -else - echo "cannot find plat_mmap_vlan_ins: please set you PATH for it." - pwd - exit 1 -fi - - -# Use installed pktio env or for make check take it from platform directory -if [ -f "./pktio_env" ]; then - . ./pktio_env -elif [ -f ${TEST_SRC_DIR}/pktio_env ]; then - . ${TEST_SRC_DIR}/pktio_env -else - echo "BUG: unable to find pktio_env!" - echo "pktio_env has to be in current directory or" - echo " in platform/\$ODP_PLATFORM/test." - echo "ODP_PLATFORM=\"$ODP_PLATFORM\"" - exit 1 -fi - -setup_pktio_env -if [ $? -ne 0 ]; then - return 77 # Skip the test -fi - -PCAP_IN=`find . ${TEST_DIR} $(dirname $0) -name vlan.pcap -print -quit` -echo "using PCAP_IN = ${PCAP_IN}" -PCAP_OUT=vlan_out.pcap - -# Listen on veth pipe and write to pcap Send pcap -plat_mmap_vlan_ins${EXEEXT} pktiop0p1 pcap:out=${PCAP_OUT} \ - 00:02:03:04:05:06 00:08:09:0a:0b:0c & -# Send pcap file to veth interface -plat_mmap_vlan_ins${EXEEXT} pcap:in=${PCAP_IN} pktiop1p0 \ - 01:02:03:04:05:06 01:08:09:0a:0b:0c - -# Wait both processes to exit before removing the interfaces -wait $! - -rm -f ${PCAP_OUT} -cleanup_pktio_env - -exit 0 diff --git a/platform/linux-generic/test/mmap_vlan_ins/pktio_env b/platform/linux-generic/test/mmap_vlan_ins/pktio_env deleted file mode 100644 index ba9998e6a..000000000 --- a/platform/linux-generic/test/mmap_vlan_ins/pktio_env +++ /dev/null @@ -1,120 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2015-2018, Linaro Limited -# All rights reserved. -# -# SPDX-License-Identifier: BSD-3-Clause -# -# Test script wrapper for running ODP pktio apps on linux-generic. -# -# For linux-generic the default behavior is to create two pairs of -# virtual Ethernet interfaces and provide the names of these via -# environment variables to pktio apps, the interfaces will be removed -# before the script exits. -# -# Note that the creation of virtual Ethernet devices depends on having -# CONFIG_VETH enabled in the kernel, if not enabled the env setup will be skipped. -# -# Network set up -# IF0 <---> IF1 -# IF2 <---> IF3 -IF0=pktiop0p1 -IF1=pktiop1p0 -IF2=pktiop2p3 -IF3=pktiop3p2 - -if [ "$0" = "$BASH_SOURCE" ]; then - echo "Error: Platform specific env file has to be sourced." -fi - -check_for_root() -{ - if [ "$(id -u)" != "0" ]; then - echo "check_for_root(): need to be root to setup VETH" - return 1 - fi - return 0 -} - -# wait for a network interface's operational state to be "up" -wait_for_iface_up() -{ - iface=$1 - cnt=0 - - while [ $cnt -lt 50 ]; do - read operstate < /sys/class/net/$iface/operstate - - if [ $? -ne 0 ]; then - break - elif [ "$operstate" = "up" ]; then - return 0 - fi - - sleep 0.1 - cnt=`expr $cnt + 1` - done - - return 1 -} - -setup_pktio_env() -{ - echo "pktio: setting up test interfaces $IF0, $IF1, $IF2, $IF3." - - check_for_root - if [ $? -ne 0 ]; then - return 1 - fi - - for iface in $IF0 $IF1 $IF2 $IF3; do - ip link show $iface 2> /dev/null - if [ $? -eq 0 ]; then - echo "pktio: interface $iface already exist $?" - return 2 - fi - done - - if [ "$1" = "clean" ]; then - trap cleanup_pktio_env EXIT - fi - - ip link add $IF0 type veth peer name $IF1 - if [ $? -ne 0 ]; then - echo "pktio: error: unable to create veth pair" - return 3 - fi - ip link add $IF2 type veth peer name $IF3 - if [ $? -ne 0 ]; then - echo "pktio: error: unable to create veth pair" - return 4 - fi - - for iface in $IF0 $IF1 $IF2 $IF3; do - ip link set $iface mtu 9216 up - ifconfig $iface -arp - done - - # check that the interface has come up before starting the test - for iface in $IF0 $IF1 $IF2 $IF3; do - wait_for_iface_up $iface - if [ $? -ne 0 ]; then - echo "pktio: interface $iface failed to come up" - return 5 - fi - done -} - -cleanup_pktio_env() -{ - echo "pktio: removing test interfaces $IF0, $IF1, $IF2, $IF3" - check_for_root - if [ $? -ne 0 ]; then - return 1 - fi - - for iface in $IF0 $IF1 $IF2 $IF3; do - ip link del $iface 2> /dev/null - done - return 0 -} diff --git a/platform/linux-generic/test/mmap_vlan_ins/vlan.pcap b/platform/linux-generic/test/mmap_vlan_ins/vlan.pcap deleted file mode 100644 index 106ccb682..000000000 Binary files a/platform/linux-generic/test/mmap_vlan_ins/vlan.pcap and /dev/null differ commit 48e1788231127fd184203d842c95f1560328c7fe Author: Petri Savolainen <petri.savolainen(a)nokia.com> Date: Wed Sep 11 16:31:21 2019 +0300 linux-gen: socket_mmap: break receive loop on empty pool Break packet receive loop, when pool gets empty. Leave the packet into the ring, so that the next receive call may try to receive it again. Signed-off-by: Petri Savolainen <petri.savolainen(a)nokia.com> Reviewed-by: Matias Elo <matias.elo(a)nokia.com> diff --git a/platform/linux-generic/pktio/socket_mmap.c b/platform/linux-generic/pktio/socket_mmap.c index 0a11c1d25..54fc7367e 100644 --- a/platform/linux-generic/pktio/socket_mmap.c +++ b/platform/linux-generic/pktio/socket_mmap.c @@ -137,6 +137,7 @@ static inline unsigned pkt_mmap_v2_rx(pktio_entry_t *pktio_entry, unsigned i; unsigned nb_rx; struct ring *ring; + odp_pool_t pool = pkt_sock->pool; if (pktio_entry->s.config.pktin.bit.ts_all || pktio_entry->s.config.pktin.bit.ts_ptp) @@ -151,7 +152,6 @@ static inline unsigned pkt_mmap_v2_rx(pktio_entry_t *pktio_entry, odp_packet_t pkt; odp_packet_hdr_t *hdr; odp_packet_hdr_t parsed_hdr; - odp_pool_t pool = pkt_sock->pool; int ret; tp_hdr = (void *)next_ptr; @@ -177,10 +177,19 @@ static inline unsigned pkt_mmap_v2_rx(pktio_entry_t *pktio_entry, continue; } + ret = packet_alloc_multi(pool, pkt_len, &pkt, 1); + + if (odp_unlikely(ret != 1)) { + /* Stop receiving packets when pool is empty. Leave + * the current frame into the ring. */ + break; + } + /* Don't receive packets sent by ourselves */ eth_hdr = (struct ethhdr *)pkt_buf; if (odp_unlikely(ethaddrs_equal(if_mac, eth_hdr->h_source))) { + odp_packet_free(pkt); tp_hdr->tp_status = TP_STATUS_KERNEL; frame_num = next_frame_num; continue; @@ -190,20 +199,13 @@ static inline unsigned pkt_mmap_v2_rx(pktio_entry_t *pktio_entry, if (cls_classify_packet(pktio_entry, pkt_buf, pkt_len, pkt_len, &pool, &parsed_hdr, true)) { + odp_packet_free(pkt); tp_hdr->tp_status = TP_STATUS_KERNEL; frame_num = next_frame_num; continue; } } - ret = packet_alloc_multi(pool, pkt_len, &pkt, 1); - - if (odp_unlikely(ret != 1)) { - tp_hdr->tp_status = TP_STATUS_KERNEL; - frame_num = next_frame_num; - continue; - } - hdr = packet_hdr(pkt); ret = odp_packet_copy_from_mem(pkt, 0, pkt_len, pkt_buf); if (ret != 0) { commit 7131ada262e45f059b67d5492511a60a3303785a Author: Petri Savolainen <petri.savolainen(a)nokia.com> Date: Wed Sep 11 15:30:11 2019 +0300 linux-gen: socket_mmap: remove vlan insertion Remove redundant VLAN insertion from packet receive. This function assumed that TP_STATUS_VLAN_VALID status bit is set when Linux has removed VLAN header from packet. This is not always the case. VLAN header is removed also when flag is not set. Also, if user has set up a VLAN interface in Linux, the assumption is that all received packets (from the interface) belong to the VLAN and do not carry VLAN header. Signed-off-by: Petri Savolainen <petri.savolainen(a)nokia.com> Reviewed-by: Matias Elo <matias.elo(a)nokia.com> diff --git a/platform/linux-generic/pktio/socket_mmap.c b/platform/linux-generic/pktio/socket_mmap.c index 35f259087..0a11c1d25 100644 --- a/platform/linux-generic/pktio/socket_mmap.c +++ b/platform/linux-generic/pktio/socket_mmap.c @@ -118,37 +118,6 @@ static int mmap_pkt_socket(void) return sock; } -static uint8_t *pkt_mmap_vlan_insert(uint8_t *l2_hdr_ptr, - uint16_t mac_offset, - uint16_t vlan_tci, - int *pkt_len_ptr) -{ - _odp_ethhdr_t *eth_hdr; - _odp_vlanhdr_t *vlan_hdr; - uint8_t *new_l2_ptr; - int orig_pkt_len; - - /* First try to see if the mac_offset is large enough to accommodate - * shifting the Ethernet header down to open up space for the IEEE - * 802.1Q vlan header. - */ - if (_ODP_VLANHDR_LEN < mac_offset) { - orig_pkt_len = *pkt_len_ptr; - new_l2_ptr = l2_hdr_ptr - _ODP_VLANHDR_LEN; - memmove(new_l2_ptr, l2_hdr_ptr, _ODP_ETHHDR_LEN); - - eth_hdr = (_odp_ethhdr_t *)new_l2_ptr; - vlan_hdr = (_odp_vlanhdr_t *)(new_l2_ptr + _ODP_ETHHDR_LEN); - vlan_hdr->tci = odp_cpu_to_be_16(vlan_tci); - vlan_hdr->type = eth_hdr->type; - eth_hdr->type = odp_cpu_to_be_16(_ODP_ETHTYPE_VLAN); - *pkt_len_ptr = orig_pkt_len + _ODP_VLANHDR_LEN; - return new_l2_ptr; - } - - return l2_hdr_ptr; -} - static inline unsigned next_frame(unsigned cur_frame, unsigned frame_count) { return odp_unlikely(cur_frame + 1 >= frame_count) ? 0 : cur_frame + 1; @@ -217,12 +186,6 @@ static inline unsigned pkt_mmap_v2_rx(pktio_entry_t *pktio_entry, continue; } - if (tp_hdr->tp_status & TP_STATUS_VLAN_VALID) - pkt_buf = pkt_mmap_vlan_insert(pkt_buf, - tp_hdr->tp_mac, - tp_hdr->tp_vlan_tci, - &pkt_len); - if (pktio_cls_enabled(pktio_entry)) { if (cls_classify_packet(pktio_entry, pkt_buf, pkt_len, pkt_len, &pool, &parsed_hdr, commit ca1003ba1b45a356301587ac31dfca108bf1edcb Author: Petri Savolainen <petri.savolainen(a)nokia.com> Date: Tue Sep 10 17:33:36 2019 +0300 linux-gen: socket_mmap: prefetch frame header Prefetch next frame header and first bytes of data. Also cleaned rx side packet handle usage. Signed-off-by: Petri Savolainen <petri.savolainen(a)nokia.com> Reviewed-by: Matias Elo <matias.elo(a)nokia.com> diff --git a/platform/linux-generic/pktio/socket_mmap.c b/platform/linux-generic/pktio/socket_mmap.c index a9fb44c45..35f259087 100644 --- a/platform/linux-generic/pktio/socket_mmap.c +++ b/platform/linux-generic/pktio/socket_mmap.c @@ -162,13 +162,12 @@ static inline unsigned pkt_mmap_v2_rx(pktio_entry_t *pktio_entry, odp_time_t ts_val; odp_time_t *ts = NULL; unsigned frame_num, next_frame_num; - uint8_t *pkt_buf; + uint8_t *pkt_buf, *next_ptr; int pkt_len; struct ethhdr *eth_hdr; unsigned i; unsigned nb_rx; struct ring *ring; - int ret; if (pktio_entry->s.config.pktin.bit.ts_all || pktio_entry->s.config.pktin.bit.ts_ptp) @@ -176,24 +175,29 @@ static inline unsigned pkt_mmap_v2_rx(pktio_entry_t *pktio_entry, ring = &pkt_sock->rx_ring; frame_num = ring->frame_num; + next_ptr = ring->rd[frame_num].iov_base; for (i = 0, nb_rx = 0; i < num; i++) { struct tpacket2_hdr *tp_hdr; + odp_packet_t pkt; odp_packet_hdr_t *hdr; odp_packet_hdr_t parsed_hdr; odp_pool_t pool = pkt_sock->pool; - int pkts; + int ret; - tp_hdr = ring->rd[frame_num].iov_base; + tp_hdr = (void *)next_ptr; if (tp_hdr->tp_status == TP_STATUS_KERNEL) break; + next_frame_num = next_frame(frame_num, ring->rd_num); + next_ptr = ring->rd[next_frame_num].iov_base; + odp_prefetch(next_ptr); + odp_prefetch(next_ptr + ODP_CACHE_LINE_SIZE); + if (ts != NULL) ts_val = odp_time_global(); - next_frame_num = next_frame(frame_num, ring->rd_num); - pkt_buf = (uint8_t *)(void *)tp_hdr + tp_hdr->tp_mac; pkt_len = tp_hdr->tp_snaplen; @@ -229,19 +233,18 @@ static inline unsigned pkt_mmap_v2_rx(pktio_entry_t *pktio_entry, } } - pkts = packet_alloc_multi(pool, pkt_len, &pkt_table[nb_rx], 1); + ret = packet_alloc_multi(pool, pkt_len, &pkt, 1); - if (odp_unlikely(pkts != 1)) { - pkt_table[nb_rx] = ODP_PACKET_INVALID; + if (odp_unlikely(ret != 1)) { tp_hdr->tp_status = TP_STATUS_KERNEL; frame_num = next_frame_num; continue; } - hdr = packet_hdr(pkt_table[nb_rx]); - ret = odp_packet_copy_from_mem(pkt_table[nb_rx], 0, - pkt_len, pkt_buf); + + hdr = packet_hdr(pkt); + ret = odp_packet_copy_from_mem(pkt, 0, pkt_len, pkt_buf); if (ret != 0) { - odp_packet_free(pkt_table[nb_rx]); + odp_packet_free(pkt); tp_hdr->tp_status = TP_STATUS_KERNEL; frame_num = next_frame_num; continue; @@ -260,6 +263,7 @@ static inline unsigned pkt_mmap_v2_rx(pktio_entry_t *pktio_entry, tp_hdr->tp_status = TP_STATUS_KERNEL; frame_num = next_frame_num; + pkt_table[nb_rx] = pkt; nb_rx++; } @@ -272,21 +276,23 @@ static inline int pkt_mmap_v2_tx(int sock, struct ring *ring, uint32_t num) { uint32_t i, pkt_len, num_tx; - uint32_t first_frame_num, frame_num, frame_count; + uint32_t first_frame_num, frame_num, next_frame_num, frame_count; int ret; uint8_t *buf; + void *next_ptr; struct tpacket2_hdr *tp_hdr[num]; int total_len = 0; - first_frame_num = ring->frame_num; - frame_num = first_frame_num; + frame_num = ring->frame_num; + first_frame_num = frame_num; frame_count = ring->rd_num; + next_ptr = ring->rd[frame_num].iov_base; if (num > frame_count) num = frame_count; for (i = 0; i < num; i++) { - tp_hdr[i] = ring->rd[frame_num].iov_base; + tp_hdr[i] = next_ptr; if (tp_hdr[i]->tp_status != TP_STATUS_AVAILABLE) { if (tp_hdr[i]->tp_status == TP_STATUS_WRONG_FORMAT) { @@ -297,6 +303,10 @@ static inline int pkt_mmap_v2_tx(int sock, struct ring *ring, break; } + next_frame_num = next_frame(frame_num, frame_count); + next_ptr = ring->rd[next_frame_num].iov_base; + odp_prefetch(next_ptr); + pkt_len = odp_packet_len(pkt_table[i]); tp_hdr[i]->tp_len = pkt_len; total_len += pkt_len; @@ -307,7 +317,7 @@ static inline int pkt_mmap_v2_tx(int sock, struct ring *ring, tp_hdr[i]->tp_status = TP_STATUS_SEND_REQUEST; - frame_num = next_frame(frame_num, frame_count); + frame_num = next_frame_num; } num = i; commit 321f9c88c709c992d395ccff73141d3fa737ab79 Author: Petri Savolainen <petri.savolainen(a)nokia.com> Date: Mon Sep 9 15:37:38 2019 +0300 linux-gen: socket_mmap: remove redundant union Clean up receive function code by pointing directly to tpacket2_hdr structure. Signed-off-by: Petri Savolainen <petri.savolainen(a)nokia.com> Reviewed-by: Matias Elo <matias.elo(a)nokia.com> diff --git a/platform/linux-generic/pktio/socket_mmap.c b/platform/linux-generic/pktio/socket_mmap.c index 06f80d360..a9fb44c45 100644 --- a/platform/linux-generic/pktio/socket_mmap.c +++ b/platform/linux-generic/pktio/socket_mmap.c @@ -95,16 +95,6 @@ static int set_pkt_sock_fanout_mmap(pkt_sock_mmap_t *const pkt_sock, return 0; } -union frame_map { - struct { - struct tpacket2_hdr ODP_ALIGNED(TPACKET_ALIGNMENT) tp_h; - struct sockaddr_ll ODP_ALIGNED(TPACKET_ALIGN(sizeof(struct - tpacket2_hdr))) s_ll; - } *v2; - - void *raw; -}; - static int mmap_pkt_socket(void) { int ver = TPACKET_V2; @@ -128,16 +118,6 @@ static int mmap_pkt_socket(void) return sock; } -static inline int mmap_rx_kernel_ready(struct tpacket2_hdr *hdr) -{ - return ((hdr->tp_status & TP_STATUS_USER) == TP_STATUS_USER); -} - -static inline void mmap_rx_user_ready(struct tpacket2_hdr *hdr) -{ - hdr->tp_status = TP_STATUS_KERNEL; -} - static uint8_t *pkt_mmap_vlan_insert(uint8_t *l2_hdr_ptr, uint16_t mac_offset, uint16_t vlan_tci, @@ -179,7 +159,6 @@ static inline unsigned pkt_mmap_v2_rx(pktio_entry_t *pktio_entry, odp_packet_t pkt_table[], unsigned num, unsigned char if_mac[]) { - union frame_map ppd; odp_time_t ts_val; odp_time_t *ts = NULL; unsigned frame_num, next_frame_num; @@ -199,14 +178,15 @@ static inline unsigned pkt_mmap_v2_rx(pktio_entry_t *pktio_entry, frame_num = ring->frame_num; for (i = 0, nb_rx = 0; i < num; i++) { + struct tpacket2_hdr *tp_hdr; odp_packet_hdr_t *hdr; odp_packet_hdr_t parsed_hdr; odp_pool_t pool = pkt_sock->pool; int pkts; - ppd.raw = ring->rd[frame_num].iov_base; + tp_hdr = ring->rd[frame_num].iov_base; - if (!mmap_rx_kernel_ready(ppd.raw)) + if (tp_hdr->tp_status == TP_STATUS_KERNEL) break; if (ts != NULL) @@ -214,11 +194,11 @@ static inline unsigned pkt_mmap_v2_rx(pktio_entry_t *pktio_entry, next_frame_num = next_frame(frame_num, ring->rd_num); - pkt_buf = (uint8_t *)ppd.raw + ppd.v2->tp_h.tp_mac; - pkt_len = ppd.v2->tp_h.tp_snaplen; + pkt_buf = (uint8_t *)(void *)tp_hdr + tp_hdr->tp_mac; + pkt_len = tp_hdr->tp_snaplen; if (odp_unlikely(pkt_len > pkt_sock->mtu)) { - mmap_rx_user_ready(ppd.raw); + tp_hdr->tp_status = TP_STATUS_KERNEL; frame_num = next_frame_num; ODP_DBG("dropped oversized packet\n"); continue; @@ -228,22 +208,22 @@ static inline unsigned pkt_mmap_v2_rx(pktio_entry_t *pktio_entry, eth_hdr = (struct ethhdr *)pkt_buf; if (odp_unlikely(ethaddrs_equal(if_mac, eth_hdr->h_source))) { - mmap_rx_user_ready(ppd.raw); /* drop */ + tp_hdr->tp_status = TP_STATUS_KERNEL; frame_num = next_frame_num; continue; } - if (ppd.v2->tp_h.tp_status & TP_STATUS_VLAN_VALID) + if (tp_hdr->tp_status & TP_STATUS_VLAN_VALID) pkt_buf = pkt_mmap_vlan_insert(pkt_buf, - ppd.v2->tp_h.tp_mac, - ppd.v2->tp_h.tp_vlan_tci, + tp_hdr->tp_mac, + tp_hdr->tp_vlan_tci, &pkt_len); if (pktio_cls_enabled(pktio_entry)) { if (cls_classify_packet(pktio_entry, pkt_buf, pkt_len, pkt_len, &pool, &parsed_hdr, true)) { - mmap_rx_user_ready(ppd.raw); /* drop */ + tp_hdr->tp_status = TP_STATUS_KERNEL; frame_num = next_frame_num; continue; } @@ -253,7 +233,7 @@ static inline unsigned pkt_mmap_v2_rx(pktio_entry_t *pktio_entry, if (odp_unlikely(pkts != 1)) { pkt_table[nb_rx] = ODP_PACKET_INVALID; - mmap_rx_user_ready(ppd.raw); /* drop */ + tp_hdr->tp_status = TP_STATUS_KERNEL; frame_num = next_frame_num; continue; } @@ -262,7 +242,7 @@ static inline unsigned pkt_mmap_v2_rx(pktio_entry_t *pktio_entry, pkt_len, pkt_buf); if (ret != 0) { odp_packet_free(pkt_table[nb_rx]); - mmap_rx_user_ready(ppd.raw); /* drop */ + tp_hdr->tp_status = TP_STATUS_KERNEL; frame_num = next_frame_num; continue; } @@ -277,7 +257,7 @@ static inline unsigned pkt_mmap_v2_rx(pktio_entry_t *pktio_entry, packet_set_ts(hdr, ts); - mmap_rx_user_ready(ppd.raw); + tp_hdr->tp_status = TP_STATUS_KERNEL; frame_num = next_frame_num; nb_rx++; commit 77f8e112e5e72d8e6e5bd1c530fccb7557b56124 Author: Petri Savolainen <petri.savolainen(a)nokia.com> Date: Mon Sep 9 14:24:20 2019 +0300 linux-gen: socket_mmap: reserve 4MB memory for blocks Use fixed 4MB memory allocation for RX/TX blocks. Disable (redundant) fanout configuration. Effective fanout usage would require that each worker (process) creates a socket. Currently, only single socket is created and protected with a lock. Signed-off-by: Petri Savolainen <petri.savolainen(a)nokia.com> Reviewed-by: Matias Elo <matias.elo(a)nokia.com> diff --git a/platform/linux-generic/pktio/socket_mmap.c b/platform/linux-generic/pktio/socket_mmap.c index 1f56773c7..06f80d360 100644 --- a/platform/linux-generic/pktio/socket_mmap.c +++ b/platform/linux-generic/pktio/socket_mmap.c @@ -43,8 +43,9 @@ #include <protocols/eth.h> #include <protocols/ip.h> -/* Maximum number of packets to store in each RX/TX block */ -#define MAX_PKTS_PER_BLOCK 512 +/* Reserve 4MB memory for frames in a RX/TX ring */ +#define FRAME_MEM_SIZE (4 * 1024 * 1024) +#define BLOCK_SIZE (4 * 1024) /** Packet socket using mmap rings for both Rx and Tx */ typedef struct { @@ -381,65 +382,58 @@ static inline int pkt_mmap_v2_tx(int sock, struct ring *ring, return num_tx; } -static void mmap_fill_ring(struct ring *ring, odp_pool_t pool_hdl, int fanout) +static int mmap_setup_ring(pkt_sock_mmap_t *pkt_sock, struct ring *ring, + int type) { - uint32_t num_frames; - int pz = getpagesize(); - pool_t *pool; + odp_shm_t shm; + uint32_t block_size, block_nr, frame_size, frame_nr; + uint32_t ring_size; + int flags; + int sock = pkt_sock->sockfd; + int mtu = pkt_sock->mtu; + int ret = 0; - if (pool_hdl == ODP_POOL_INVALID) - ODP_ABORT("Invalid pool handle\n"); + ring->sock = sock; + ring->type = type; + ring->version = TPACKET_V2; - pool = pool_entry_from_hdl(pool_hdl); + frame_size = ROUNDUP_POWER2_U32(mtu + TPACKET_HDRLEN + + TPACKET_ALIGNMENT); + block_size = BLOCK_SIZE; + if (frame_size > block_size) + block_size = frame_size; - /* Frame has to capture full packet which can fit to the pool block.*/ - ring->req.tp_frame_size = (pool->headroom + pool->seg_len + - pool->tailroom + TPACKET_HDRLEN + - TPACKET_ALIGNMENT + (pz - 1)) & (-pz); + block_nr = FRAME_MEM_SIZE / block_size; + frame_nr = (block_size / frame_size) * block_nr; + ring_size = frame_nr * sizeof(struct iovec); + flags = 0; - /* Calculate how many pages we need to hold at most MAX_PKTS_PER_BLOCK - * packets and align size to page boundary. - */ - num_frames = pool->num < MAX_PKTS_PER_BLOCK ? pool->num : - MAX_PKTS_PER_BLOCK; - ring->req.tp_block_size = (ring->req.tp_frame_size * num_frames + - (pz - 1)) & (-pz); - - if (!fanout) { - /* Single socket is in use. Use 1 block with buf_num frames. */ - ring->req.tp_block_nr = 1; - } else { - /* Fanout is in use, more likely taffic split accodring to - * number of cpu threads. Use cpu blocks and buf_num frames. */ - ring->req.tp_block_nr = odp_cpu_count(); + if (odp_global_ro.shm_single_va) + flags += ODP_SHM_SINGLE_VA; + + shm = odp_shm_reserve(NULL, ring_size, ODP_CACHE_LINE_SIZE, flags); + + if (shm == ODP_SHM_INVALID) { + ODP_ERR("Reserving shm failed\n"); + return -1; } + ring->shm = shm; - ring->req.tp_frame_nr = ring->req.tp_block_size / - ring->req.tp_frame_size * ring->req.tp_block_nr; + ring->req.tp_block_size = block_size; + ring->req.tp_block_nr = block_nr; + ring->req.tp_frame_size = frame_size; + ring->req.tp_frame_nr = frame_nr; ring->mm_len = ring->req.tp_block_size * ring->req.tp_block_nr; ring->rd_num = ring->req.tp_frame_nr; - ring->flen = ring->req.tp_frame_size; -} - -static int mmap_setup_ring(int sock, struct ring *ring, int type, - odp_pool_t pool_hdl, int fanout) -{ - int ret = 0; - int flags = 0; - odp_shm_t shm; - - ring->sock = sock; - ring->type = type; - ring->version = TPACKET_V2; - - mmap_fill_ring(ring, pool_hdl, fanout); + ring->flen = ring->req.tp_frame_size; + ring->rd_len = ring_size; ODP_DBG(" tp_block_size %u\n", ring->req.tp_block_size); ODP_DBG(" tp_block_nr %u\n", ring->req.tp_block_nr); ODP_DBG(" tp_frame_size %u\n", ring->req.tp_frame_size); ODP_DBG(" tp_frame_nr %u\n", ring->req.tp_frame_nr); - ODP_DBG(" fanout %i\n", fanout); + ODP_DBG(" fanout %i\n", pkt_sock->fanout); ret = setsockopt(sock, SOL_PACKET, type, &ring->req, sizeof(ring->req)); if (ret == -1) { @@ -448,19 +442,6 @@ static int mmap_setup_ring(int sock, struct ring *ring, int type, return -1; } - ring->rd_len = ring->rd_num * sizeof(*ring->rd); - - if (odp_global_ro.shm_single_va) - flags += ODP_SHM_SINGLE_VA; - - shm = odp_shm_reserve(NULL, ring->rd_len, ODP_CACHE_LINE_SIZE, flags); - - if (shm == ODP_SHM_INVALID) { - ODP_ERR("Reserving shm failed\n"); - return -1; - } - ring->shm = shm; - ring->rd = odp_shm_addr(shm); if (!ring->rd) { ODP_ERR("Reading shm addr failed\n"); @@ -516,11 +497,17 @@ static int mmap_sock(pkt_sock_mmap_t *pkt_sock) static int mmap_unmap_sock(pkt_sock_mmap_t *pkt_sock) { + int ret = 0; + if (pkt_sock->rx_ring.shm != ODP_SHM_INVALID) odp_shm_free(pkt_sock->rx_ring.shm); if (pkt_sock->tx_ring.shm != ODP_SHM_INVALID) odp_shm_free(pkt_sock->tx_ring.shm); - return munmap(pkt_sock->mmap_base, pkt_sock->mmap_len); + + if (pkt_sock->mmap_base != MAP_FAILED) + ret = munmap(pkt_sock->mmap_base, pkt_sock->mmap_len); + + return ret; } static int mmap_bind_sock(pkt_sock_mmap_t *pkt_sock, const char *netdev) @@ -576,12 +563,14 @@ static int sock_mmap_open(odp_pktio_t id ODP_UNUSED, return -1; pkt_sock_mmap_t *const pkt_sock = pkt_priv(pktio_entry); - int fanout = 1; + int fanout = 0; /* Init pktio entry */ memset(pkt_sock, 0, sizeof(*pkt_sock)); /* set sockfd to -1, because a valid socked might be initialized to 0 */ pkt_sock->sockfd = -1; + pkt_sock->mmap_base = MAP_FAILED; + pkt_sock->fanout = fanout; if (pool == ODP_POOL_INVALID) return -1; @@ -600,15 +589,19 @@ static int sock_mmap_open(odp_pktio_t id ODP_UNUSED, if (ret != 0) goto error; + pkt_sock->mtu = mtu_get_fd(pkt_sock->sockfd, netdev); + if (!pkt_sock->mtu) + goto error; + + ODP_DBG("MTU size: %i\n", pkt_sock->mtu); + ODP_DBG("TX ring setup:\n"); - ret = mmap_setup_ring(pkt_sock->sockfd, &pkt_sock->tx_ring, - PACKET_TX_RING, pool, fanout); + ret = mmap_setup_ring(pkt_sock, &pkt_sock->tx_ring, PACKET_TX_RING); if (ret != 0) goto error; ODP_DBG("RX ring setup:\n"); - ret = mmap_setup_ring(pkt_sock->sockfd, &pkt_sock->rx_ring, - PACKET_RX_RING, pool, fanout); + ret = mmap_setup_ring(pkt_sock, &pkt_sock->rx_ring, PACKET_RX_RING); if (ret != 0) goto error; @@ -620,10 +613,6 @@ static int sock_mmap_open(odp_pktio_t id ODP_UNUSED, if (ret != 0) goto error; - pkt_sock->mtu = mtu_get_fd(pkt_sock->sockfd, netdev); - if (!pkt_sock->mtu) - goto error; - if_idx = if_nametoindex(netdev); if (if_idx == 0) { __odp_errno = errno; @@ -631,7 +620,6 @@ static int sock_mmap_open(odp_pktio_t id ODP_UNUSED, goto error; } - pkt_sock->fanout = fanout; if (fanout) { ret = set_pkt_sock_fanout_mmap(pkt_sock, if_idx); if (ret != 0) commit b60c92e93885de2f2b051648632a27413809a01f Author: Petri Savolainen <petri.savolainen(a)nokia.com> Date: Thu Sep 5 10:31:42 2019 +0300 linux-gen: socket_mmap: sync_synchronize not needed Extra memory barrier is not needed on each receive frame status update. The receive function is guarded by a ticketlock which includes necessary memory barriers. Signed-off-by: Petri Savolainen <petri.savolainen(a)nokia.com> Reviewed-by: Matias Elo <matias.elo(a)nokia.com> diff --git a/platform/linux-generic/pktio/socket_mmap.c b/platform/linux-generic/pktio/socket_mmap.c index f64d5bd68..1f56773c7 100644 --- a/platform/linux-generic/pktio/socket_mmap.c +++ b/platform/linux-generic/pktio/socket_mmap.c @@ -135,7 +135,6 @@ static inline int mmap_rx_kernel_ready(struct tpacket2_hdr *hdr) static inline void mmap_rx_user_ready(struct tpacket2_hdr *hdr) { hdr->tp_status = TP_STATUS_KERNEL; - __sync_synchronize(); } static uint8_t *pkt_mmap_vlan_insert(uint8_t *l2_hdr_ptr, @@ -204,13 +203,14 @@ static inline unsigned pkt_mmap_v2_rx(pktio_entry_t *pktio_entry, odp_pool_t pool = pkt_sock->pool; int pkts; - if (!mmap_rx_kernel_ready(ring->rd[frame_num].iov_base)) + ppd.raw = ring->rd[frame_num].iov_base; + + if (!mmap_rx_kernel_ready(ppd.raw)) break; if (ts != NULL) ts_val = odp_time_global(); - ppd.raw = ring->rd[frame_num].iov_base; next_frame_num = next_frame(frame_num, ring->rd_num); pkt_buf = (uint8_t *)ppd.raw + ppd.v2->tp_h.tp_mac; commit 5355304a9650a2929f080ff66fafeb2792632f06 Author: Petri Savolainen <petri.savolainen(a)nokia.com> Date: Thu Sep 5 10:05:25 2019 +0300 linux-gen: socket_mmap: fix tx side throughput collapse Fix packet transmit side issue which caused packet rate to collapse on an overloaded system. Apparently tp_status got out of sync between ODP and kernel. Signed-off-by: Petri Savolainen <petri.savolainen(a)nokia.com> Reviewed-by: Matias Elo <matias.elo(a)nokia.com> Reported-by: Jari Mustajärvi <jari.mustajarvi(a)nokia-bell-labs.com> diff --git a/platform/linux-generic/pktio/socket_mmap.c b/platform/linux-generic/pktio/socket_mmap.c index 861152288..f64d5bd68 100644 --- a/platform/linux-generic/pktio/socket_mmap.c +++ b/platform/linux-generic/pktio/socket_mmap.c @@ -43,12 +43,6 @@ #include <protocols/eth.h> #include <protocols/ip.h> -/* Maximum number of retries per sock_mmap_send() call */ -#define TX_RETRIES 10 - -/* Number of nanoseconds to wait between TX retries */ -#define TX_RETRY_NSEC 1000 - /* Maximum number of packets to store in each RX/TX block */ #define MAX_PKTS_PER_BLOCK 512 @@ -144,17 +138,6 @@ static inline void mmap_rx_user_ready(struct tpacket2_hdr *hdr) __sync_synchronize(); } -static inline int mmap_tx_kernel_ready(struct tpacket2_hdr *hdr) -{ - return !(hdr->tp_status & (TP_STATUS_SEND_REQUEST | TP_STATUS_SENDING)); -} - -static inline void mmap_tx_user_ready(struct tpacket2_hdr *hdr) -{ - hdr->tp_status = TP_STATUS_SEND_REQUEST; - __sync_synchronize(); -} - static uint8_t *pkt_mmap_vlan_insert(uint8_t *l2_hdr_ptr, uint16_t mac_offset, uint16_t vlan_tci, @@ -303,118 +286,99 @@ static inline unsigned pkt_mmap_v2_rx(pktio_entry_t *pktio_entry, return nb_rx; } -static unsigned handle_pending_frames(int sock, struct ring *ring, int frames) -{ - int i; - int retry = 0; - unsigned nb_tx = 0; - unsigned frame_num; - unsigned frame_count = ring->rd_num; - unsigned first_frame_num = ring->frame_num; - - for (frame_num = first_frame_num, i = 0; i < frames; i++) { - struct tpacket2_hdr *hdr = ring->rd[frame_num].iov_base; - - if (odp_likely(hdr->tp_status == TP_STATUS_AVAILABLE || - hdr->tp_status == TP_STATUS_SENDING)) { - nb_tx++; - } else if (hdr->tp_status == TP_STATUS_SEND_REQUEST) { - if (retry++ < TX_RETRIES) { - struct timespec ts = { .tv_nsec = TX_RETRY_NSEC, - .tv_sec = 0 }; - - sendto(sock, NULL, 0, MSG_DONTWAIT, NULL, 0); - nanosleep(&ts, NULL); - i--; - continue; - } else { - hdr->tp_status = TP_STATUS_AVAILABLE; - } - } else { /* TP_STATUS_WRONG_FORMAT */ - /* Don't try re-sending frames after failure */ - for (; i < frames; i++) { - hdr = ring->rd[frame_num].iov_base; - hdr->tp_status = TP_STATUS_AVAILABLE; - frame_num = next_frame(frame_num, frame_count); - } - break; - } - frame_num = next_frame(frame_num, frame_count); - } - - ring->frame_num = next_frame(first_frame_num + nb_tx - 1, frame_count); - - return nb_tx; -} - -static inline unsigned pkt_mmap_v2_tx(int sock, struct ring *ring, - const odp_packet_t pkt_table[], - unsigned num) +static inline int pkt_mmap_v2_tx(int sock, struct ring *ring, + const odp_packet_t pkt_table[], + uint32_t num) { - union frame_map ppd; - uint32_t pkt_len; - unsigned first_frame_num, frame_num, frame_count; + uint32_t i, pkt_len, num_tx; + uint32_t first_frame_num, frame_num, frame_count; int ret; uint8_t *buf; - unsigned i = 0; - unsigned nb_tx = 0; - int send_errno; + struct tpacket2_hdr *tp_hdr[num]; int total_len = 0; first_frame_num = ring->frame_num; frame_num = first_frame_num; frame_count = ring->rd_num; - while (i < num) { - ppd.raw = ring->rd[frame_num].iov_base; - if (!odp_unlikely(mmap_tx_kernel_ready(ppd.raw))) + if (num > frame_count) + num = frame_count; + + for (i = 0; i < num; i++) { + tp_hdr[i] = ring->rd[frame_num].iov_base; + + if (tp_hdr[i]->tp_status != TP_STATUS_AVAILABLE) { + if (tp_hdr[i]->tp_status == TP_STATUS_WRONG_FORMAT) { + ODP_ERR("Socket mmap: wrong format\n"); + return -1; + } + break; + } pkt_len = odp_packet_len(pkt_table[i]); - ppd.v2->tp_h.tp_snaplen = pkt_len; - ppd.v2->tp_h.tp_len = pkt_len; + tp_hdr[i]->tp_len = pkt_len; total_len += pkt_len; - buf = (uint8_t *)ppd.raw + TPACKET2_HDRLEN - + buf = (uint8_t *)(void *)tp_hdr[i] + TPACKET2_HDRLEN - sizeof(struct sockaddr_ll); odp_packet_copy_to_mem(pkt_table[i], 0, pkt_len, buf); - mmap_tx_user_ready(ppd.raw); + tp_hdr[i]->tp_status = TP_STATUS_SEND_REQUEST; frame_num = next_frame(frame_num, frame_count); - i++; } - ret = sendto(sock, NULL, 0, MSG_DONTWAIT, NULL, 0); - send_errno = errno; + num = i; + num_tx = num; - /* On success, the return value indicates the number of bytes sent. On - * failure a value of -1 is returned, even if the failure occurred - * after some of the packets in the ring have already been sent, so we - * need to inspect the packet status to determine which were sent. */ - if (odp_likely(ret == total_len)) { - nb_tx = i; - ring->frame_num = frame_num; - } else { - nb_tx = handle_pending_frames(sock, ring, i); - - if (odp_unlikely(ret == -1 && nb_tx == 0 && - SOCK_ERR_REPORT(send_errno))) { - __odp_errno = send_errno; - /* ENOBUFS indicates that the transmit queue is full, - * which will happen regularly when overloaded so don't - * print it */ - if (errno != ENOBUFS) - ODP_ERR("sendto(pkt mmap): %s\n", - strerror(send_errno)); + /* Ping kernel to send packets */ + ret = send(sock, NULL, 0, MSG_DONTWAIT); + + ring->frame_num = frame_num; + + if (odp_unlikely(ret != total_len)) { + uint32_t tp_status, frame_sum; + + /* Returns -1 when nothing is sent (send() would block) */ + if (ret < 0 && errno != EWOULDBLOCK) { + ODP_ERR("Socket mmap: send failed, ret %i, errno %i\n", + ret, errno); return -1; } + + /* Check how many first packets have been sent + * (TP_STATUS_AVAILABLE or TP_STATUS_SENDING). Assuming that + * the rest will not be sent. */ + for (i = 0; i < num; i++) { + tp_status = tp_hdr[i]->tp_status; + + if (tp_status == TP_STATUS_SEND_REQUEST) + break; + + if (tp_status == TP_STATUS_WRONG_FORMAT) { + ODP_ERR("Socket mmap: wrong format\n"); + break; + } + } + + num_tx = i; + + /* Clear status of not sent packets */ + for (i = num_tx; i < num; i++) + tp_hdr[i]->tp_status = TP_STATUS_AVAILABLE; + + frame_sum = first_frame_num + num_tx; + ring->frame_num = frame_sum; + + if (frame_sum >= frame_count) + ring->frame_num = frame_sum - frame_count; } - for (i = 0; i < nb_tx; ++i) - odp_packet_free(pkt_table[i]); + /* Free sent packets */ + odp_packet_free_multi(pkt_table, num_tx); - return nb_tx; + return num_tx; } static void mmap_fill_ring(struct ring *ring, odp_pool_t pool_hdl, int fanout) @@ -471,6 +435,12 @@ static int mmap_setup_ring(int sock, struct ring *ring, int type, mmap_fill_ring(ring, pool_hdl, fanout); + ODP_DBG(" tp_block_size %u\n", ring->req.tp_block_size); + ODP_DBG(" tp_block_nr %u\n", ring->req.tp_block_nr); + ODP_DBG(" tp_frame_size %u\n", ring->req.tp_frame_size); + ODP_DBG(" tp_frame_nr %u\n", ring->req.tp_frame_nr); + ODP_DBG(" fanout %i\n", fanout); + ret = setsockopt(sock, SOL_PACKET, type, &ring->req, sizeof(ring->req)); if (ret == -1) { __odp_errno = errno; @@ -630,11 +600,13 @@ static int sock_mmap_open(odp_pktio_t id ODP_UNUSED, if (ret != 0) goto error; + ODP_DBG("TX ring setup:\n"); ret = mmap_setup_ring(pkt_sock->sockfd, &pkt_sock->tx_ring, PACKET_TX_RING, pool, fanout); if (ret != 0) goto error; + ODP_DBG("RX ring setup:\n"); ret = mmap_setup_ring(pkt_sock->sockfd, &pkt_sock->rx_ring, PACKET_RX_RING, pool, fanout); if (ret != 0) ----------------------------------------------------------------------- Summary of changes: platform/linux-generic/Makefile.am | 1 - platform/linux-generic/include/odp_packet_socket.h | 62 --- platform/linux-generic/m4/configure.m4 | 1 - platform/linux-generic/pktio/socket.c | 1 - platform/linux-generic/pktio/socket_mmap.c | 469 +++++++++------------ platform/linux-generic/test/Makefile.am | 4 - .../linux-generic/test/mmap_vlan_ins/.gitignore | 2 - .../linux-generic/test/mmap_vlan_ins/Makefile.am | 16 - .../test/mmap_vlan_ins/mmap_vlan_ins.c | 250 ----------- .../test/mmap_vlan_ins/mmap_vlan_ins.sh | 78 ---- .../linux-generic/test/mmap_vlan_ins/pktio_env | 120 ------ .../linux-generic/test/mmap_vlan_ins/vlan.pcap | Bin 9728 -> 0 bytes 12 files changed, 209 insertions(+), 795 deletions(-) delete mode 100644 platform/linux-generic/include/odp_packet_socket.h delete mode 100644 platform/linux-generic/test/mmap_vlan_ins/.gitignore delete mode 100644 platform/linux-generic/test/mmap_vlan_ins/Makefile.am delete mode 100644 platform/linux-generic/test/mmap_vlan_ins/mmap_vlan_ins.c delete mode 100755 platform/linux-generic/test/mmap_vlan_ins/mmap_vlan_ins.sh delete mode 100644 platform/linux-generic/test/mmap_vlan_ins/pktio_env delete mode 100644 platform/linux-generic/test/mmap_vlan_ins/vlan.pcap hooks/post-receive --
5 years, 4 months
1
0
0
0
← Newer
1
Older →
Jump to page:
1
Results per page:
10
25
50
100
200