aboutsummaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
authorMatias Elo <matias.elo@nokia.com>2024-03-11 16:39:27 +0200
committerGitHub <noreply@github.com>2024-03-11 16:39:27 +0200
commit8063101c4fac56e16c5a2bb9843f2fd9c5acbfd7 (patch)
tree63e2500c41ea7d1e4714236561be641b1639f287 /example
parentc00ef7d6bce1e483c4cf1bb3cdf6cd629530d795 (diff)
parent9ff786ed3d9d553f8e108eff4ee4ceec4adb585e (diff)
Merge ODP v1.44.0.0v1.44.0.0_DPDK_22.11
Merge ODP linux-generic v1.44.0.0 into linux-dpdk.
Diffstat (limited to 'example')
-rw-r--r--example/classifier/odp_classifier.c16
-rwxr-xr-xexample/classifier/odp_classifier_run.sh6
-rw-r--r--example/cli/odp_cli.c12
-rwxr-xr-xexample/cli/odp_cli_run.sh6
-rw-r--r--example/debug/odp_debug.c120
-rwxr-xr-xexample/generator/generator_run.sh6
-rw-r--r--example/generator/odp_generator.c12
-rw-r--r--example/hello/odp_hello.c13
-rw-r--r--example/ipfragreass/odp_ipfragreass.c12
-rw-r--r--example/ipfragreass/odp_ipfragreass_fragment.c8
-rw-r--r--example/ipfragreass/odp_ipfragreass_fragment.h8
-rw-r--r--example/ipfragreass/odp_ipfragreass_helpers.c8
-rw-r--r--example/ipfragreass/odp_ipfragreass_helpers.h8
-rw-r--r--example/ipfragreass/odp_ipfragreass_ip.h8
-rw-r--r--example/ipfragreass/odp_ipfragreass_reassemble.c8
-rw-r--r--example/ipfragreass/odp_ipfragreass_reassemble.h8
-rw-r--r--example/ipsec_api/README8
-rw-r--r--example/ipsec_api/odp_ipsec.c12
-rw-r--r--example/ipsec_api/odp_ipsec_cache.c8
-rw-r--r--example/ipsec_api/odp_ipsec_cache.h8
-rw-r--r--example/ipsec_crypto/README6
-rw-r--r--example/ipsec_crypto/odp_ipsec.c20
-rw-r--r--example/ipsec_crypto/odp_ipsec_cache.c8
-rw-r--r--example/ipsec_crypto/odp_ipsec_cache.h8
-rw-r--r--example/ipsec_crypto/odp_ipsec_fwd_db.c8
-rw-r--r--example/ipsec_crypto/odp_ipsec_fwd_db.h8
-rw-r--r--example/ipsec_crypto/odp_ipsec_misc.h8
-rw-r--r--example/ipsec_crypto/odp_ipsec_sa_db.c8
-rw-r--r--example/ipsec_crypto/odp_ipsec_sa_db.h8
-rw-r--r--example/ipsec_crypto/odp_ipsec_sp_db.c8
-rw-r--r--example/ipsec_crypto/odp_ipsec_sp_db.h8
-rw-r--r--example/ipsec_crypto/odp_ipsec_stream.c8
-rw-r--r--example/ipsec_crypto/odp_ipsec_stream.h8
-rwxr-xr-xexample/l2fwd_simple/l2fwd_simple_run.sh6
-rw-r--r--example/l2fwd_simple/odp_l2fwd_simple.c12
-rw-r--r--example/l3fwd/odp_l3fwd.c12
-rw-r--r--example/l3fwd/odp_l3fwd_db.c8
-rw-r--r--example/l3fwd/odp_l3fwd_db.h8
-rw-r--r--example/l3fwd/odp_l3fwd_lpm.c9
-rw-r--r--example/l3fwd/odp_l3fwd_lpm.h8
-rwxr-xr-xexample/l3fwd/odp_l3fwd_run.sh6
-rw-r--r--example/packet/Makefile.am2
-rw-r--r--example/packet/odp_packet_dump.c94
-rw-r--r--example/packet/odp_pktio.c20
-rwxr-xr-xexample/packet/packet_dump_run.sh6
-rwxr-xr-xexample/packet/pktio_run.sh16
-rw-r--r--example/ping/odp_ping.c10
-rwxr-xr-xexample/ping/ping_run.sh6
-rw-r--r--example/simple_pipeline/odp_simple_pipeline.c17
-rwxr-xr-xexample/simple_pipeline/simple_pipeline_run.sh6
-rw-r--r--example/switch/odp_switch.c14
-rwxr-xr-xexample/switch/switch_run.sh6
-rw-r--r--example/sysinfo/odp_sysinfo.c50
-rw-r--r--example/time/Makefile.am2
-rw-r--r--example/time/odp_time_global_test.c (renamed from example/time/time_global_test.c)12
-rw-r--r--example/timer/Makefile.am2
-rw-r--r--example/timer/odp_timer_accuracy.c29
-rwxr-xr-xexample/timer/odp_timer_accuracy_run.sh6
-rw-r--r--example/timer/odp_timer_simple.c21
-rw-r--r--example/timer/odp_timer_test.c19
-rw-r--r--example/traffic_mgmt/odp_traffic_mgmt.c40
61 files changed, 527 insertions, 329 deletions
diff --git a/example/classifier/odp_classifier.c b/example/classifier/odp_classifier.c
index 4f71c835b..f4218fd9c 100644
--- a/example/classifier/odp_classifier.c
+++ b/example/classifier/odp_classifier.c
@@ -1,9 +1,15 @@
-/* Copyright (c) 2015-2018, Linaro Limited
- * Copyright (c) 2019-2022, Nokia
- * Copyright (c) 2020, Marvell
- * All rights reserved.
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2015-2018 Linaro Limited
+ * Copyright (c) 2019-2022 Nokia
+ * Copyright (c) 2020 Marvell
+ */
+
+/**
+ * @example odp_classifier.c
+ *
+ * Classifier API example application
*
- * SPDX-License-Identifier: BSD-3-Clause
+ * @cond _ODP_HIDE_FROM_DOXYGEN_
*/
#include <stdlib.h>
diff --git a/example/classifier/odp_classifier_run.sh b/example/classifier/odp_classifier_run.sh
index 2b5fe7ebb..ad0c3a76a 100755
--- a/example/classifier/odp_classifier_run.sh
+++ b/example/classifier/odp_classifier_run.sh
@@ -1,9 +1,7 @@
#!/bin/bash
#
-# Copyright (c) 2020, Marvell
-# All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright (c) 2020 Marvell
#
if [ -f ./pktio_env ]; then
diff --git a/example/cli/odp_cli.c b/example/cli/odp_cli.c
index 5f87b2a78..381fc8a59 100644
--- a/example/cli/odp_cli.c
+++ b/example/cli/odp_cli.c
@@ -1,15 +1,15 @@
-/* Copyright (c) 2021, Nokia
- * All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2021 Nokia
*/
-/*
- * ODP CLI Helper Example
+/**
+ * @example odp_cli.c
*
* This example shows how to start and stop ODP CLI using the CLI helper
* API functions. This example application can also be used to try out
* the CLI by connecting to a running application with a telnet client.
+ *
+ * @cond _ODP_HIDE_FROM_DOXYGEN_
*/
#include <odp_api.h>
diff --git a/example/cli/odp_cli_run.sh b/example/cli/odp_cli_run.sh
index 0dc00b793..bb212fffb 100755
--- a/example/cli/odp_cli_run.sh
+++ b/example/cli/odp_cli_run.sh
@@ -1,9 +1,7 @@
#!/bin/bash
#
-# Copyright (c) 2021, Nokia
-# All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright (c) 2021 Nokia
#
./odp_cli${EXEEXT} -t 2
diff --git a/example/debug/odp_debug.c b/example/debug/odp_debug.c
index a2f322e09..79107ca8f 100644
--- a/example/debug/odp_debug.c
+++ b/example/debug/odp_debug.c
@@ -1,7 +1,13 @@
-/* Copyright (c) 2020-2022, Nokia
- * All rights reserved.
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2020-2022 Nokia
+ */
+
+/**
+ * @example odp_debug.c
*
- * SPDX-License-Identifier: BSD-3-Clause
+ * This example application demonstrates the usage of various debug print functions of ODP API.
+ *
+ * @cond _ODP_HIDE_FROM_DOXYGEN_
*/
#include <stdlib.h>
@@ -14,6 +20,8 @@
#include <odp_api.h>
#include <odp/helper/odph_api.h>
+#define MAX_NAME_LEN 128
+
typedef struct test_global_t {
int system;
int shm;
@@ -23,6 +31,7 @@ typedef struct test_global_t {
int ipsec;
int timer;
int stash;
+ char pktio_name[MAX_NAME_LEN];
} test_global_t;
@@ -35,35 +44,37 @@ static void print_usage(void)
"are called when no options are given.\n"
"\n"
"OPTIONS:\n"
- " -S, --system Call odp_sys_info_print() and odp_sys_config_print()\n"
- " -s, --shm Create a SHM and call odp_shm_print()\n"
- " -p, --pool Create various types of pools and call odp_pool_print()\n"
- " -q, --queue Create various types of queues and call odp_queue_print()\n"
- " -i, --interface Create packet IO interface (loop), and call both odp_pktio_print()\n"
- " and odp_pktio_extra_stats_print()\n"
- " -I, --ipsec Call odp_ipsec_print()\n"
- " -t, --timer Call timer pool, timer and timeout print functions\n"
- " -a, --stash Create stash and call odp_stash_print()\n"
- " -h, --help Display help and exit.\n\n");
+ " -S, --system Call odp_sys_info_print() and odp_sys_config_print()\n"
+ " -s, --shm Create a SHM and call odp_shm_print()\n"
+ " -p, --pool Create various types of pools and call odp_pool_print()\n"
+ " -q, --queue Create various types of queues and call odp_queue_print()\n"
+ " -i, --interface <name> Start a packet IO interface, and call odp_pktio_print(),\n"
+ " odp_pktio_extra_stats_print(), etc. Uses loop interface by default.\n"
+ " -I, --ipsec Call odp_ipsec_print()\n"
+ " -t, --timer Call timer pool, timer and timeout print functions\n"
+ " -a, --stash Create stash and call odp_stash_print()\n"
+ " -h, --help Display help and exit.\n\n");
}
static int parse_options(int argc, char *argv[], test_global_t *global)
{
int opt, long_index;
+ char *str;
+ uint32_t str_len = 0;
const struct option longopts[] = {
{"system", no_argument, NULL, 'S'},
{"shm", no_argument, NULL, 's'},
{"pool", no_argument, NULL, 'p'},
{"queue", no_argument, NULL, 'q'},
- {"interface", no_argument, NULL, 'i'},
+ {"interface", required_argument, NULL, 'i'},
{"ipsec", no_argument, NULL, 'I'},
{"timer", no_argument, NULL, 't'},
{"stash", no_argument, NULL, 'a'},
{"help", no_argument, NULL, 'h'},
{NULL, 0, NULL, 0}
};
- const char *shortopts = "+SspqiItah";
+ const char *shortopts = "+Sspqi:Itah";
int ret = 0;
while (1) {
@@ -87,6 +98,11 @@ static int parse_options(int argc, char *argv[], test_global_t *global)
break;
case 'i':
global->pktio = 1;
+ str = optarg;
+ str_len = strlen(str);
+
+ if (str_len && str_len < MAX_NAME_LEN)
+ strcpy(global->pktio_name, str);
break;
case 'I':
global->ipsec = 1;
@@ -104,6 +120,11 @@ static int parse_options(int argc, char *argv[], test_global_t *global)
}
}
+ if (global->pktio && (str_len == 0 || str_len >= MAX_NAME_LEN)) {
+ ODPH_ERR("Bad interface name length: %u\n", str_len);
+ ret = -1;
+ }
+
return ret;
}
@@ -314,11 +335,13 @@ static int queue_debug(void)
return 0;
}
-static int pktio_debug(void)
+static int pktio_debug(test_global_t *global)
{
odp_pool_t pool;
odp_pool_param_t pool_param;
odp_pktio_t pktio;
+ odp_pktio_link_info_t info;
+ uint8_t mac[ODPH_ETHADDR_LEN];
int pkt_len = 100;
odp_pool_param_init(&pool_param);
@@ -333,19 +356,79 @@ static int pktio_debug(void)
return -1;
}
- pktio = odp_pktio_open("loop", pool, NULL);
+ pktio = odp_pktio_open(global->pktio_name, pool, NULL);
if (pktio == ODP_PKTIO_INVALID) {
ODPH_ERR("Pktio open failed\n");
return -1;
}
+ /* Start interface with default config */
+ if (odp_pktin_queue_config(pktio, NULL)) {
+ ODPH_ERR("Packet input queue config failed\n");
+ return -1;
+ }
+
+ if (odp_pktout_queue_config(pktio, NULL)) {
+ ODPH_ERR("Packet output queue config failed\n");
+ return -1;
+ }
+
+ if (odp_pktio_start(pktio)) {
+ ODPH_ERR("Pktio start failed\n");
+ return -1;
+ }
+
+ printf("\nWaiting link up");
+
+ /* Wait max 5 seconds for link up */
+ for (int i = 0; i < 25; i++) {
+ if (odp_pktio_link_status(pktio) == ODP_PKTIO_LINK_STATUS_UP)
+ break;
+
+ odp_time_wait_ns(200 * ODP_TIME_MSEC_IN_NS);
+ printf(".");
+ fflush(NULL);
+ }
+
+ printf("\n\n");
+
+ printf("Packet IO\n---------\n");
+ printf(" index: %i\n", odp_pktio_index(pktio));
+ printf(" handle: 0x%" PRIx64 "\n", odp_pktio_to_u64(pktio));
+
+ if (odp_pktio_mac_addr(pktio, mac, ODPH_ETHADDR_LEN) == ODPH_ETHADDR_LEN) {
+ printf(" mac address: %02x:%02x:%02x:%02x:%02x:%02x\n", mac[0], mac[1], mac[2],
+ mac[3], mac[4], mac[5]);
+ }
+
+ printf(" input maxlen: %u\n", odp_pktin_maxlen(pktio));
+ printf(" output maxlen: %u\n", odp_pktout_maxlen(pktio));
+ printf(" promisc mode: %i\n", odp_pktio_promisc_mode(pktio));
+ printf(" timestamp res: %" PRIu64 " Hz\n\n", odp_pktio_ts_res(pktio));
+
+ if (odp_pktio_link_info(pktio, &info) == 0) {
+ printf("Link info\n---------\n");
+ printf(" auto neg: %i\n", info.autoneg);
+ printf(" duplex: %i\n", info.duplex);
+ printf(" media: %s\n", info.media);
+ printf(" pause_rx: %i\n", info.pause_rx);
+ printf(" pause_tx: %i\n", info.pause_tx);
+ printf(" speed: %u Mbit/s\n", info.speed);
+ printf(" status: %i\n", info.status);
+ }
+
printf("\n");
odp_pktio_print(pktio);
printf("\n");
odp_pktio_extra_stats_print(pktio);
+ if (odp_pktio_stop(pktio)) {
+ ODPH_ERR("Pktio stop failed\n");
+ return -1;
+ }
+
if (odp_pktio_close(pktio)) {
ODPH_ERR("Pktio close failed\n");
return -1;
@@ -562,6 +645,7 @@ int main(int argc, char *argv[])
global->ipsec = 1;
global->timer = 1;
global->stash = 1;
+ strcpy(global->pktio_name, "loop");
} else {
if (parse_options(argc, argv, global))
exit(EXIT_FAILURE);
@@ -606,7 +690,7 @@ int main(int argc, char *argv[])
exit(EXIT_FAILURE);
}
- if (global->pktio && pktio_debug()) {
+ if (global->pktio && pktio_debug(global)) {
ODPH_ERR("Packet debug failed.\n");
exit(EXIT_FAILURE);
}
diff --git a/example/generator/generator_run.sh b/example/generator/generator_run.sh
index 528c1b595..ca69b53bd 100755
--- a/example/generator/generator_run.sh
+++ b/example/generator/generator_run.sh
@@ -1,9 +1,7 @@
#!/bin/bash
#
-# Copyright (c) 2020, Marvell
-# All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright (c) 2020 Marvell
#
if [ -f ./pktio_env ]; then
diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c
index 95ba04c1e..6ec19d0ea 100644
--- a/example/generator/odp_generator.c
+++ b/example/generator/odp_generator.c
@@ -1,7 +1,13 @@
-/* Copyright (c) 2014-2018, Linaro Limited
- * All rights reserved.
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2014-2018 Linaro Limited
+ */
+
+/**
+ * @example odp_generator.c
+ *
+ * Traffic generator and loopback demo application
*
- * SPDX-License-Identifier: BSD-3-Clause
+ * @cond _ODP_HIDE_FROM_DOXYGEN_
*/
/** enable strtok */
diff --git a/example/hello/odp_hello.c b/example/hello/odp_hello.c
index 391406946..58cc35502 100644
--- a/example/hello/odp_hello.c
+++ b/example/hello/odp_hello.c
@@ -1,13 +1,16 @@
-/* Copyright (c) 2016-2018, Linaro Limited
- * All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2016-2018 Linaro Limited
*/
-/* This is a minimal application which demonstrates the startup and shutdown
+/**
+ * @example odp_hello.c
+ *
+ * This is a minimal application which demonstrates the startup and shutdown
* steps of an ODP application. It can be also used to debug API related
* build problems, etc. It does not use helpers to minimize dependency to
* anything else than the ODP API header file.
+ *
+ * @cond _ODP_HIDE_FROM_DOXYGEN_
*/
#include <stdio.h>
diff --git a/example/ipfragreass/odp_ipfragreass.c b/example/ipfragreass/odp_ipfragreass.c
index 55c76d7cc..2b7df861e 100644
--- a/example/ipfragreass/odp_ipfragreass.c
+++ b/example/ipfragreass/odp_ipfragreass.c
@@ -1,13 +1,13 @@
-/* Copyright (c) 2017-2018, Linaro Limited
- * All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2017-2018 Linaro Limited
*/
/**
- * @file
+ * @example odp_ipfragreass.c
+ *
+ * IPv4 lock-free fragmentation and reassembly example application
*
- * @example odp_ipfragreass.c ODP IPv4 lock-free fragmentation and reassembly
+ * @cond _ODP_HIDE_FROM_DOXYGEN_
*/
#include <stdio.h>
diff --git a/example/ipfragreass/odp_ipfragreass_fragment.c b/example/ipfragreass/odp_ipfragreass_fragment.c
index 2cce75e91..2e9d9ad64 100644
--- a/example/ipfragreass/odp_ipfragreass_fragment.c
+++ b/example/ipfragreass/odp_ipfragreass_fragment.c
@@ -1,9 +1,9 @@
-/* Copyright (c) 2017-2018, Linaro Limited
- * All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2017-2018 Linaro Limited
*/
+/** @cond _ODP_HIDE_FROM_DOXYGEN_ */
+
#include <stdio.h>
#include <assert.h>
diff --git a/example/ipfragreass/odp_ipfragreass_fragment.h b/example/ipfragreass/odp_ipfragreass_fragment.h
index e0e8cfea7..748f84186 100644
--- a/example/ipfragreass/odp_ipfragreass_fragment.h
+++ b/example/ipfragreass/odp_ipfragreass_fragment.h
@@ -1,9 +1,9 @@
-/* Copyright (c) 2017-2018, Linaro Limited
- * All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2017-2018 Linaro Limited
*/
+/** @cond _ODP_HIDE_FROM_DOXYGEN_ */
+
#ifndef ODP_FRAGREASS_PP_FRAG_H_
#define ODP_FRAGREASS_PP_FRAG_H_
diff --git a/example/ipfragreass/odp_ipfragreass_helpers.c b/example/ipfragreass/odp_ipfragreass_helpers.c
index ac737fe44..a48157fcf 100644
--- a/example/ipfragreass/odp_ipfragreass_helpers.c
+++ b/example/ipfragreass/odp_ipfragreass_helpers.c
@@ -1,9 +1,9 @@
-/* Copyright (c) 2017-2018, Linaro Limited
- * All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2017-2018 Linaro Limited
*/
+/** @cond _ODP_HIDE_FROM_DOXYGEN_ */
+
#include <stdio.h>
#include <stdlib.h>
diff --git a/example/ipfragreass/odp_ipfragreass_helpers.h b/example/ipfragreass/odp_ipfragreass_helpers.h
index af47e326c..9f89ca4c4 100644
--- a/example/ipfragreass/odp_ipfragreass_helpers.h
+++ b/example/ipfragreass/odp_ipfragreass_helpers.h
@@ -1,9 +1,9 @@
-/* Copyright (c) 2017-2018, Linaro Limited
- * All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2017-2018 Linaro Limited
*/
+/** @cond _ODP_HIDE_FROM_DOXYGEN_ */
+
#ifndef ODP_FRAGREASS_PP_HELPERS_H_
#define ODP_FRAGREASS_PP_HELPERS_H_
diff --git a/example/ipfragreass/odp_ipfragreass_ip.h b/example/ipfragreass/odp_ipfragreass_ip.h
index 9c8f2a5f7..97e68324c 100644
--- a/example/ipfragreass/odp_ipfragreass_ip.h
+++ b/example/ipfragreass/odp_ipfragreass_ip.h
@@ -1,9 +1,9 @@
-/* Copyright (c) 2017-2018, Linaro Limited
- * All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2017-2018 Linaro Limited
*/
+/** @cond _ODP_HIDE_FROM_DOXYGEN_ */
+
#ifndef ODP_FRAGREASS_PP_IP_H_
#define ODP_FRAGREASS_PP_IP_H_
diff --git a/example/ipfragreass/odp_ipfragreass_reassemble.c b/example/ipfragreass/odp_ipfragreass_reassemble.c
index 2542a3b97..55ee42504 100644
--- a/example/ipfragreass/odp_ipfragreass_reassemble.c
+++ b/example/ipfragreass/odp_ipfragreass_reassemble.c
@@ -1,9 +1,9 @@
-/* Copyright (c) 2017-2018, Linaro Limited
- * All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2017-2018 Linaro Limited
*/
+/** @cond _ODP_HIDE_FROM_DOXYGEN_ */
+
#include <odp_api.h>
#include <stdio.h>
diff --git a/example/ipfragreass/odp_ipfragreass_reassemble.h b/example/ipfragreass/odp_ipfragreass_reassemble.h
index 1fb71284e..b00f3825e 100644
--- a/example/ipfragreass/odp_ipfragreass_reassemble.h
+++ b/example/ipfragreass/odp_ipfragreass_reassemble.h
@@ -1,9 +1,9 @@
-/* Copyright (c) 2017-2018, Linaro Limited
- * All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2017-2018 Linaro Limited
*/
+/** @cond _ODP_HIDE_FROM_DOXYGEN_ */
+
#ifndef ODP_FRAGREASS_PP_REASSEMBLE_H_
#define ODP_FRAGREASS_PP_REASSEMBLE_H_
diff --git a/example/ipsec_api/README b/example/ipsec_api/README
index f7ea93e59..7a392a728 100644
--- a/example/ipsec_api/README
+++ b/example/ipsec_api/README
@@ -1,8 +1,6 @@
-Copyright (c) 2014-2018, Linaro Limited
-Copyright (c) 2020, Nokia
-All rights reserved.
-
-SPDX-License-Identifier: BSD-3-Clause
+SPDX-License-Identifier: BSD-3-Clause
+Copyright (c) 2014-2018 Linaro Limited
+Copyright (c) 2020 Nokia
1. Intro
diff --git a/example/ipsec_api/odp_ipsec.c b/example/ipsec_api/odp_ipsec.c
index 524b1ae76..a67a3a1e8 100644
--- a/example/ipsec_api/odp_ipsec.c
+++ b/example/ipsec_api/odp_ipsec.c
@@ -1,13 +1,13 @@
-/* Copyright (c) 2013-2018, Linaro Limited
- * All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2013-2018 Linaro Limited
*/
/**
- * @file
+ * @example ipsec_api/odp_ipsec.c
+ *
+ * IPsec example application using ODP IPsec API
*
- * @example odp_example_ipsec.c ODP basic packet IO cross connect with IPsec test application
+ * @cond _ODP_HIDE_FROM_DOXYGEN_
*/
/* enable strtok */
diff --git a/example/ipsec_api/odp_ipsec_cache.c b/example/ipsec_api/odp_ipsec_cache.c
index c16c71115..827c9dce2 100644
--- a/example/ipsec_api/odp_ipsec_cache.c
+++ b/example/ipsec_api/odp_ipsec_cache.c
@@ -1,9 +1,9 @@
-/* Copyright (c) 2014-2018, Linaro Limited
- * All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2014-2018 Linaro Limited
*/
+/** @cond _ODP_HIDE_FROM_DOXYGEN_ */
+
#include <stdlib.h>
#include <string.h>
diff --git a/example/ipsec_api/odp_ipsec_cache.h b/example/ipsec_api/odp_ipsec_cache.h
index b0e1fa3f0..5dd0c80b3 100644
--- a/example/ipsec_api/odp_ipsec_cache.h
+++ b/example/ipsec_api/odp_ipsec_cache.h
@@ -1,9 +1,9 @@
-/* Copyright (c) 2014-2018, Linaro Limited
- * All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2014-2018 Linaro Limited
*/
+/** @cond _ODP_HIDE_FROM_DOXYGEN_ */
+
#ifndef ODP_IPSEC_CACHE_H_
#define ODP_IPSEC_CACHE_H_
diff --git a/example/ipsec_crypto/README b/example/ipsec_crypto/README
index 8e66372b5..0411396a1 100644
--- a/example/ipsec_crypto/README
+++ b/example/ipsec_crypto/README
@@ -1,7 +1,5 @@
-Copyright (c) 2014-2018, Linaro Limited
-All rights reserved.
-
-SPDX-License-Identifier: BSD-3-Clause
+SPDX-License-Identifier: BSD-3-Clause
+Copyright (c) 2014-2018 Linaro Limited
1. Intro
diff --git a/example/ipsec_crypto/odp_ipsec.c b/example/ipsec_crypto/odp_ipsec.c
index 06d52c311..92e32d301 100644
--- a/example/ipsec_crypto/odp_ipsec.c
+++ b/example/ipsec_crypto/odp_ipsec.c
@@ -1,14 +1,14 @@
-/* Copyright (c) 2013-2018, Linaro Limited
- * Copyright (c) 2021-2022, Nokia
- * All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2013-2018 Linaro Limited
+ * Copyright (c) 2021-2022 Nokia
*/
/**
- * @file
+ * @example ipsec_crypto/odp_ipsec.c
+ *
+ * IPsec example application using ODP crypto API
*
- * @example odp_example_ipsec.c ODP basic packet IO cross connect with IPsec test application
+ * @cond _ODP_HIDE_FROM_DOXYGEN_
*/
/* enable strtok */
@@ -975,10 +975,10 @@ pkt_disposition_e do_ipsec_out_seq(odp_packet_t *pkt,
esp->seq_no = odp_cpu_to_be_32((*ctx->ipsec.esp_seq)++);
}
if (ctx->ipsec.tun_hdr_offset) {
- odph_ipv4hdr_t *ip;
+ odph_ipv4hdr_t *ip_tun;
- ip = (odph_ipv4hdr_t *)(ctx->ipsec.tun_hdr_offset + buf);
- ip->id = odp_cpu_to_be_16((*ctx->ipsec.tun_hdr_id)++);
+ ip_tun = (odph_ipv4hdr_t *)(ctx->ipsec.tun_hdr_offset + buf);
+ ip_tun->id = odp_cpu_to_be_16((*ctx->ipsec.tun_hdr_id)++);
}
/* Issue crypto request */
diff --git a/example/ipsec_crypto/odp_ipsec_cache.c b/example/ipsec_crypto/odp_ipsec_cache.c
index 65a51bd1d..0461d4fbf 100644
--- a/example/ipsec_crypto/odp_ipsec_cache.c
+++ b/example/ipsec_crypto/odp_ipsec_cache.c
@@ -1,9 +1,9 @@
-/* Copyright (c) 2014-2018, Linaro Limited
- * All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2014-2018 Linaro Limited
*/
+/** @cond _ODP_HIDE_FROM_DOXYGEN_ */
+
#include <stdlib.h>
#include <string.h>
diff --git a/example/ipsec_crypto/odp_ipsec_cache.h b/example/ipsec_crypto/odp_ipsec_cache.h
index b1e3e7ac1..29c1b983a 100644
--- a/example/ipsec_crypto/odp_ipsec_cache.h
+++ b/example/ipsec_crypto/odp_ipsec_cache.h
@@ -1,9 +1,9 @@
-/* Copyright (c) 2014-2018, Linaro Limited
- * All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2014-2018 Linaro Limited
*/
+/** @cond _ODP_HIDE_FROM_DOXYGEN_ */
+
#ifndef ODP_IPSEC_CACHE_H_
#define ODP_IPSEC_CACHE_H_
diff --git a/example/ipsec_crypto/odp_ipsec_fwd_db.c b/example/ipsec_crypto/odp_ipsec_fwd_db.c
index 9bd399ca9..292d9c7c6 100644
--- a/example/ipsec_crypto/odp_ipsec_fwd_db.c
+++ b/example/ipsec_crypto/odp_ipsec_fwd_db.c
@@ -1,9 +1,9 @@
-/* Copyright (c) 2014-2018, Linaro Limited
- * All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2014-2018 Linaro Limited
*/
+/** @cond _ODP_HIDE_FROM_DOXYGEN_ */
+
/* enable strtok */
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
diff --git a/example/ipsec_crypto/odp_ipsec_fwd_db.h b/example/ipsec_crypto/odp_ipsec_fwd_db.h
index c6d9c6c99..d9c84b29b 100644
--- a/example/ipsec_crypto/odp_ipsec_fwd_db.h
+++ b/example/ipsec_crypto/odp_ipsec_fwd_db.h
@@ -1,9 +1,9 @@
-/* Copyright (c) 2014-2018, Linaro Limited
- * All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2014-2018 Linaro Limited
*/
+/** @cond _ODP_HIDE_FROM_DOXYGEN_ */
+
#ifndef ODP_IPSEC_FWD_DB_H_
#define ODP_IPSEC_FWD_DB_H_
diff --git a/example/ipsec_crypto/odp_ipsec_misc.h b/example/ipsec_crypto/odp_ipsec_misc.h
index 69788d115..921c4e3c0 100644
--- a/example/ipsec_crypto/odp_ipsec_misc.h
+++ b/example/ipsec_crypto/odp_ipsec_misc.h
@@ -1,9 +1,9 @@
-/* Copyright (c) 2014-2018, Linaro Limited
- * All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2014-2018 Linaro Limited
*/
+/** @cond _ODP_HIDE_FROM_DOXYGEN_ */
+
#ifndef ODP_IPSEC_MISC_H_
#define ODP_IPSEC_MISC_H_
diff --git a/example/ipsec_crypto/odp_ipsec_sa_db.c b/example/ipsec_crypto/odp_ipsec_sa_db.c
index 9d3418681..9ddbc1152 100644
--- a/example/ipsec_crypto/odp_ipsec_sa_db.c
+++ b/example/ipsec_crypto/odp_ipsec_sa_db.c
@@ -1,9 +1,9 @@
-/* Copyright (c) 2014-2018, Linaro Limited
- * All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2014-2018 Linaro Limited
*/
+/** @cond _ODP_HIDE_FROM_DOXYGEN_ */
+
/* enable strtok */
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
diff --git a/example/ipsec_crypto/odp_ipsec_sa_db.h b/example/ipsec_crypto/odp_ipsec_sa_db.h
index 72231369f..83f103af3 100644
--- a/example/ipsec_crypto/odp_ipsec_sa_db.h
+++ b/example/ipsec_crypto/odp_ipsec_sa_db.h
@@ -1,9 +1,9 @@
-/* Copyright (c) 2014-2018, Linaro Limited
- * All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2014-2018 Linaro Limited
*/
+/** @cond _ODP_HIDE_FROM_DOXYGEN_ */
+
#ifndef ODP_IPSEC_SA_DB_H_
#define ODP_IPSEC_SA_DB_H_
diff --git a/example/ipsec_crypto/odp_ipsec_sp_db.c b/example/ipsec_crypto/odp_ipsec_sp_db.c
index 3ead3b0a3..956fb212d 100644
--- a/example/ipsec_crypto/odp_ipsec_sp_db.c
+++ b/example/ipsec_crypto/odp_ipsec_sp_db.c
@@ -1,9 +1,9 @@
-/* Copyright (c) 2014-2018, Linaro Limited
- * All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2014-2018 Linaro Limited
*/
+/** @cond _ODP_HIDE_FROM_DOXYGEN_ */
+
/* enable strtok */
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
diff --git a/example/ipsec_crypto/odp_ipsec_sp_db.h b/example/ipsec_crypto/odp_ipsec_sp_db.h
index b71ea9377..ac6c0c896 100644
--- a/example/ipsec_crypto/odp_ipsec_sp_db.h
+++ b/example/ipsec_crypto/odp_ipsec_sp_db.h
@@ -1,9 +1,9 @@
-/* Copyright (c) 2014-2018, Linaro Limited
- * All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2014-2018 Linaro Limited
*/
+/** @cond _ODP_HIDE_FROM_DOXYGEN_ */
+
#ifndef ODP_IPSEC_SP_DB_H_
#define ODP_IPSEC_SP_DB_H_
diff --git a/example/ipsec_crypto/odp_ipsec_stream.c b/example/ipsec_crypto/odp_ipsec_stream.c
index f8bc64eae..330b4cc54 100644
--- a/example/ipsec_crypto/odp_ipsec_stream.c
+++ b/example/ipsec_crypto/odp_ipsec_stream.c
@@ -1,9 +1,9 @@
-/* Copyright (c) 2014-2018, Linaro Limited
- * All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2014-2018 Linaro Limited
*/
+/** @cond _ODP_HIDE_FROM_DOXYGEN_ */
+
/* enable strtok */
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
diff --git a/example/ipsec_crypto/odp_ipsec_stream.h b/example/ipsec_crypto/odp_ipsec_stream.h
index 2055d3f00..8e1e936dd 100644
--- a/example/ipsec_crypto/odp_ipsec_stream.h
+++ b/example/ipsec_crypto/odp_ipsec_stream.h
@@ -1,9 +1,9 @@
-/* Copyright (c) 2014-2018, Linaro Limited
- * All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2014-2018 Linaro Limited
*/
+/** @cond _ODP_HIDE_FROM_DOXYGEN_ */
+
#ifndef ODP_IPSEC_STREAM_H_
#define ODP_IPSEC_STREAM_H_
diff --git a/example/l2fwd_simple/l2fwd_simple_run.sh b/example/l2fwd_simple/l2fwd_simple_run.sh
index b44e10ae1..741240e27 100755
--- a/example/l2fwd_simple/l2fwd_simple_run.sh
+++ b/example/l2fwd_simple/l2fwd_simple_run.sh
@@ -1,9 +1,7 @@
#!/bin/bash
#
-# Copyright (c) 2016-2018, Linaro Limited
-# All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright (c) 2016-2018 Linaro Limited
#
if [ -f ./pktio_env ]; then
diff --git a/example/l2fwd_simple/odp_l2fwd_simple.c b/example/l2fwd_simple/odp_l2fwd_simple.c
index c9ae94c12..5d9aaec87 100644
--- a/example/l2fwd_simple/odp_l2fwd_simple.c
+++ b/example/l2fwd_simple/odp_l2fwd_simple.c
@@ -1,7 +1,13 @@
-/* Copyright (c) 2016-2018, Linaro Limited
- * All rights reserved.
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2016-2018 Linaro Limited
+ */
+
+/**
+ * @example odp_l2fwd_simple.c
+ *
+ * Minimal L2 forwarding example application
*
- * SPDX-License-Identifier: BSD-3-Clause
+ * @cond _ODP_HIDE_FROM_DOXYGEN_
*/
#include <stdlib.h>
diff --git a/example/l3fwd/odp_l3fwd.c b/example/l3fwd/odp_l3fwd.c
index 7d6b15af0..c74c7d4d6 100644
--- a/example/l3fwd/odp_l3fwd.c
+++ b/example/l3fwd/odp_l3fwd.c
@@ -1,7 +1,13 @@
-/* Copyright (c) 2016-2018, Linaro Limited
- * All rights reserved.
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2016-2018 Linaro Limited
+ */
+
+/**
+ * @example odp_l3fwd.c
+ *
+ * L3 forwarding example application
*
- * SPDX-License-Identifier: BSD-3-Clause
+ * @cond _ODP_HIDE_FROM_DOXYGEN_
*/
#include <stdlib.h>
diff --git a/example/l3fwd/odp_l3fwd_db.c b/example/l3fwd/odp_l3fwd_db.c
index a4e4681f6..7d82695be 100644
--- a/example/l3fwd/odp_l3fwd_db.c
+++ b/example/l3fwd/odp_l3fwd_db.c
@@ -1,9 +1,9 @@
-/* Copyright (c) 2016-2018, Linaro Limited
- * All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2016-2018 Linaro Limited
*/
+/** @cond _ODP_HIDE_FROM_DOXYGEN_ */
+
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
diff --git a/example/l3fwd/odp_l3fwd_db.h b/example/l3fwd/odp_l3fwd_db.h
index b26c67e44..5c9d63e6e 100644
--- a/example/l3fwd/odp_l3fwd_db.h
+++ b/example/l3fwd/odp_l3fwd_db.h
@@ -1,9 +1,9 @@
-/* Copyright (c) 2016-2018, Linaro Limited
- * All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2016-2018 Linaro Limited
*/
+/** @cond _ODP_HIDE_FROM_DOXYGEN_ */
+
#ifndef _ODP_L3FWD_DB_H_
#define _ODP_L3FWD_DB_H_
diff --git a/example/l3fwd/odp_l3fwd_lpm.c b/example/l3fwd/odp_l3fwd_lpm.c
index 7eb32b5d0..41572d179 100644
--- a/example/l3fwd/odp_l3fwd_lpm.c
+++ b/example/l3fwd/odp_l3fwd_lpm.c
@@ -1,8 +1,9 @@
-/* Copyright (c) 2016-2018, Linaro Limited
- * All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2016-2018 Linaro Limited
*/
+
+/** @cond _ODP_HIDE_FROM_DOXYGEN_ */
+
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
diff --git a/example/l3fwd/odp_l3fwd_lpm.h b/example/l3fwd/odp_l3fwd_lpm.h
index 4f2b9ad7f..bc3382532 100644
--- a/example/l3fwd/odp_l3fwd_lpm.h
+++ b/example/l3fwd/odp_l3fwd_lpm.h
@@ -1,9 +1,9 @@
-/* Copyright (c) 2016-2018, Linaro Limited
- * All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2016-2018 Linaro Limited
*/
+/** @cond _ODP_HIDE_FROM_DOXYGEN_ */
+
#ifndef _ODP_L3FWD_LPM_H_
#define _ODP_L3FWD_LPM_H_
diff --git a/example/l3fwd/odp_l3fwd_run.sh b/example/l3fwd/odp_l3fwd_run.sh
index 89be1510f..0b39d5a52 100755
--- a/example/l3fwd/odp_l3fwd_run.sh
+++ b/example/l3fwd/odp_l3fwd_run.sh
@@ -1,9 +1,7 @@
#!/bin/bash
#
-# Copyright (c) 2016-2018, Linaro Limited
-# All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright (c) 2016-2018 Linaro Limited
#
if [ -f ./pktio_env ]; then
diff --git a/example/packet/Makefile.am b/example/packet/Makefile.am
index cf33b2ef7..5e4d9f5ea 100644
--- a/example/packet/Makefile.am
+++ b/example/packet/Makefile.am
@@ -35,5 +35,3 @@ clean-local:
rm -f $(builddir)/$$f; \
done \
fi
-
-.NOTPARALLEL:
diff --git a/example/packet/odp_packet_dump.c b/example/packet/odp_packet_dump.c
index 6d00c237e..2e16861d9 100644
--- a/example/packet/odp_packet_dump.c
+++ b/example/packet/odp_packet_dump.c
@@ -1,7 +1,14 @@
-/* Copyright (c) 2018, Linaro Limited
- * All rights reserved.
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2018 Linaro Limited
+ * Copyright (c) 2024 Nokia
+ */
+
+/**
+ * @example odp_packet_dump.c
+ *
+ * Packet dump example application which prints received packets to terminal
*
- * SPDX-License-Identifier: BSD-3-Clause
+ * @cond _ODP_HIDE_FROM_DOXYGEN_
*/
#include <stdio.h>
@@ -13,6 +20,7 @@
#include <getopt.h>
#include <odp_api.h>
+#include <odp/helper/odph_api.h>
#define MAX_PKTIOS 32
#define MAX_PKTIO_NAME 255
@@ -85,8 +93,7 @@ static int parse_int_list(char *str, int integer[], int max_num)
str[len] = 0;
if (i == max_num) {
- printf("Error: maximum number of options is %i\n",
- max_num);
+ ODPH_ERR("Maximum number of options is %i\n", max_num);
return -1;
}
@@ -155,14 +162,13 @@ static int parse_options(int argc, char *argv[], test_global_t *global)
str_len -= len + 1;
if (i == MAX_PKTIOS) {
- printf("Error: Too many interfaces\n");
+ ODPH_ERR("Too many interfaces\n");
ret = -1;
break;
}
if (len > MAX_PKTIO_NAME) {
- printf("Error: Too long interface name %s\n",
- str);
+ ODPH_ERR("Too long interface name %s\n", str);
ret = -1;
break;
}
@@ -196,7 +202,7 @@ static int parse_options(int argc, char *argv[], test_global_t *global)
}
if (global->opt.num_pktio == 0) {
- printf("Error: At least one pktio interface needed.\n");
+ ODPH_ERR("At least one pktio interface needed\n");
ret = -1;
}
@@ -208,6 +214,7 @@ static int open_pktios(test_global_t *global)
odp_pool_param_t pool_param;
odp_pktio_param_t pktio_param;
odp_pool_t pool;
+ odp_pktio_capability_t pktio_capa;
odp_pool_capability_t pool_capa;
odp_pktio_t pktio;
odp_pktio_config_t pktio_config;
@@ -219,7 +226,7 @@ static int open_pktios(test_global_t *global)
num_pktio = global->opt.num_pktio;
if (odp_pool_capability(&pool_capa)) {
- printf("Error: Pool capability failed.\n");
+ ODPH_ERR("Pool capability failed\n");
return -1;
}
@@ -235,7 +242,7 @@ static int open_pktios(test_global_t *global)
global->pool = pool;
if (pool == ODP_POOL_INVALID) {
- printf("Error: Pool create.\n");
+ ODPH_ERR("Pool create failed\n");
return -1;
}
@@ -252,16 +259,21 @@ static int open_pktios(test_global_t *global)
pktio = odp_pktio_open(name, pool, &pktio_param);
if (pktio == ODP_PKTIO_INVALID) {
- printf("Error (%s): Pktio open failed.\n", name);
+ ODPH_ERR("Pktio open failed for %s\n", name);
return -1;
}
global->pktio[i].pktio = pktio;
+ if (odp_pktio_capability(pktio, &pktio_capa)) {
+ ODPH_ERR("Pktio capability failed for %s\n", name);
+ return -1;
+ }
+
odp_pktio_print(pktio);
odp_pktio_config_init(&pktio_config);
- pktio_config.pktin.bit.ts_all = 1;
+ pktio_config.pktin.bit.ts_all = pktio_capa.config.pktin.bit.ts_all;
pktio_config.parser.layer = ODP_PROTO_LAYER_ALL;
odp_pktio_config(pktio, &pktio_config);
@@ -274,7 +286,7 @@ static int open_pktios(test_global_t *global)
pktin_param.num_queues = 1;
if (odp_pktin_queue_config(pktio, &pktin_param)) {
- printf("Error (%s): Pktin config failed.\n", name);
+ ODPH_ERR("Pktin config failed for %s\n", name);
return -1;
}
}
@@ -288,8 +300,7 @@ static int start_pktios(test_global_t *global)
for (i = 0; i < global->opt.num_pktio; i++) {
if (odp_pktio_start(global->pktio[i].pktio)) {
- printf("Error (%s): Pktio start failed.\n",
- global->opt.pktio_name[i]);
+ ODPH_ERR("Pktio start failed for %s\n", global->opt.pktio_name[i]);
return -1;
}
@@ -312,8 +323,7 @@ static int stop_pktios(test_global_t *global)
continue;
if (odp_pktio_stop(pktio)) {
- printf("Error (%s): Pktio stop failed.\n",
- global->opt.pktio_name[i]);
+ ODPH_ERR("Pktio stop failed for %s\n", global->opt.pktio_name[i]);
ret = -1;
}
}
@@ -350,8 +360,7 @@ static int close_pktios(test_global_t *global)
continue;
if (odp_pktio_close(pktio)) {
- printf("Error (%s): Pktio close failed.\n",
- global->opt.pktio_name[i]);
+ ODPH_ERR("Pktio close failed for %s\n", global->opt.pktio_name[i]);
ret = -1;
}
}
@@ -362,7 +371,7 @@ static int close_pktios(test_global_t *global)
return ret;
if (odp_pool_destroy(pool)) {
- printf("Error: Pool destroy failed.\n");
+ ODPH_ERR("Pool destroy failed\n");
ret = -1;
}
@@ -429,9 +438,9 @@ static void print_data(odp_packet_t pkt, uint32_t offset, uint32_t len)
static int print_packet(test_global_t *global, odp_packet_t pkt,
uint64_t num_packet)
{
- odp_pktio_t pktio;
+ odp_pktio_t pktio = odp_packet_input(pkt);
odp_pktio_info_t pktio_info;
- odp_time_t time;
+ odp_time_t pktio_time, time;
uint64_t sec, nsec;
uint32_t offset;
int i, type, match;
@@ -448,10 +457,13 @@ static int print_packet(test_global_t *global, odp_packet_t pkt,
int icmp = odp_packet_has_icmp(pkt);
int ipv4 = odp_packet_has_ipv4(pkt);
- if (odp_packet_has_ts(pkt))
+ if (odp_packet_has_ts(pkt)) {
+ pktio_time = odp_pktio_time(pktio, NULL);
time = odp_packet_ts(pkt);
- else
+ } else {
time = odp_time_local();
+ pktio_time = ODP_TIME_NULL;
+ }
/* Filter based on L3 type */
if (num_filter_l3) {
@@ -490,15 +502,23 @@ static int print_packet(test_global_t *global, odp_packet_t pkt,
nsec = odp_time_to_ns(time);
sec = nsec / ODP_TIME_SEC_IN_NS;
nsec = nsec - (sec * ODP_TIME_SEC_IN_NS);
- pktio = odp_packet_input(pkt);
if (odp_pktio_info(pktio, &pktio_info)) {
- printf("Error: odp_pktio_info() failed\n");
+ ODPH_ERR("Pktio info failed\n");
return -1;
}
printf("PACKET [%" PRIu64 "]\n", num_packet);
printf(" time: %" PRIu64 ".%09" PRIu64 " sec\n", sec, nsec);
+
+ if (odp_time_cmp(pktio_time, ODP_TIME_NULL)) {
+ nsec = odp_time_to_ns(pktio_time);
+ sec = nsec / ODP_TIME_SEC_IN_NS;
+ nsec = nsec - (sec * ODP_TIME_SEC_IN_NS);
+ printf(" pktio time: %" PRIu64 ".%09" PRIu64 " sec\n", sec, nsec);
+ printf(" input delay: %" PRIu64 " nsec\n", odp_time_diff_ns(pktio_time, time));
+ }
+
printf(" interface name: %s\n", pktio_info.name);
printf(" packet length: %u bytes\n", odp_packet_len(pkt));
@@ -645,7 +665,7 @@ static int receive_packets(test_global_t *global)
continue;
if (odp_event_type(ev) != ODP_EVENT_PACKET) {
- printf("Bad event type: %i\n", odp_event_type(ev));
+ ODPH_ERR("Bad event type: %i\n", odp_event_type(ev));
odp_event_free(ev);
continue;
}
@@ -688,13 +708,13 @@ int main(int argc, char *argv[])
/* Init ODP before calling anything else */
if (odp_init_global(&instance, NULL, NULL)) {
- printf("Error: Global init failed.\n");
+ ODPH_ERR("Global init failed\n");
return -1;
}
/* Init this thread */
if (odp_init_local(instance, ODP_THREAD_CONTROL)) {
- printf("Error: Local init failed.\n");
+ ODPH_ERR("Local init failed\n");
return -1;
}
@@ -705,39 +725,39 @@ int main(int argc, char *argv[])
odp_sys_info_print();
if (open_pktios(global)) {
- printf("Error: pktio open failed\n");
+ ODPH_ERR("Pktio open failed\n");
return -1;
}
if (start_pktios(global)) {
- printf("Error: pktio start failed\n");
+ ODPH_ERR("Pktio start failed\n");
return -1;
}
if (receive_packets(global)) {
- printf("Error: packet receive failed\n");
+ ODPH_ERR("Packet receive failed\n");
return -1;
}
if (stop_pktios(global)) {
- printf("Error: pktio stop failed\n");
+ ODPH_ERR("Pktio stop failed\n");
return -1;
}
empty_queues();
if (close_pktios(global)) {
- printf("Error: pktio close failed\n");
+ ODPH_ERR("Pktio close failed\n");
return -1;
}
if (odp_term_local()) {
- printf("Error: term local failed.\n");
+ ODPH_ERR("Term local failed\n");
return -1;
}
if (odp_term_global(instance)) {
- printf("Error: term global failed.\n");
+ ODPH_ERR("Term global failed\n");
return -1;
}
diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c
index 191d9fdb6..a82537fe7 100644
--- a/example/packet/odp_pktio.c
+++ b/example/packet/odp_pktio.c
@@ -1,7 +1,13 @@
-/* Copyright (c) 2013-2018, Linaro Limited
- * All rights reserved.
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2013-2018 Linaro Limited
+ */
+
+/**
+ * @example odp_pktio.c
+ *
+ * Basic packet IO loopback example application
*
- * SPDX-License-Identifier: BSD-3-Clause
+ * @cond _ODP_HIDE_FROM_DOXYGEN_
*/
#include <stdlib.h>
@@ -66,7 +72,7 @@ typedef struct {
char **if_names; /**< Array of pointers to interface names */
int mode; /**< Packet IO mode */
char *if_str; /**< Storage for interface names */
- int time; /**< Time to run app */
+ double time; /**< Time to run app */
} appl_args_t;
/**
@@ -473,7 +479,7 @@ int main(int argc, char *argv[])
odp_pktio_stop(pktio);
}
/* use delay to let workers clean up queues */
- odp_time_wait_ns(ODP_TIME_SEC_IN_NS);
+ odp_time_wait_ns(100 * ODP_TIME_MSEC_IN_NS);
odp_atomic_store_u32(&args->exit_threads, 1);
}
@@ -609,7 +615,7 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args)
appl_args->cpu_count = atoi(optarg);
break;
case 't':
- appl_args->time = atoi(optarg);
+ appl_args->time = atof(optarg);
break;
/* parse packet-io interface names */
case 'i':
@@ -736,7 +742,7 @@ static void usage(char *progname)
"\n"
"Optional OPTIONS\n"
" -c, --count <number> CPU count, 0=all available, default=1\n"
- " -t, --time <seconds> Number of seconds to run.\n"
+ " -t, --time <seconds> Number of seconds to run (e.g. 0.1).\n"
" -m, --mode 0: Receive and send directly (no queues)\n"
" 1: Receive and send via queues.\n"
" 2: Receive via scheduler, send via queues.\n"
diff --git a/example/packet/packet_dump_run.sh b/example/packet/packet_dump_run.sh
index 4e7861b1c..fea5d8b3c 100755
--- a/example/packet/packet_dump_run.sh
+++ b/example/packet/packet_dump_run.sh
@@ -1,9 +1,7 @@
#!/bin/bash
#
-# Copyright (c) 2018, Linaro Limited
-# All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright (c) 2018 Linaro Limited
#
if [ -f ./pktio_env ]; then
diff --git a/example/packet/pktio_run.sh b/example/packet/pktio_run.sh
index 33115b41f..f08c45936 100755
--- a/example/packet/pktio_run.sh
+++ b/example/packet/pktio_run.sh
@@ -1,11 +1,11 @@
#!/bin/bash
#
-# Copyright (c) 2016-2018, Linaro Limited
-# All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright (c) 2016-2018 Linaro Limited
#
+TEST_TIME=0.1
+
if [ -f ./pktio_env ]; then
. ./pktio_env
else
@@ -17,7 +17,7 @@ fi
setup_interfaces
# burst mode
-./odp_pktio${EXEEXT} -i $IF1 -t 1 -m 0
+./odp_pktio${EXEEXT} -i $IF1 -t $TEST_TIME -m 0
STATUS=$?
if [ ${STATUS} -ne 0 ]; then
echo "Error: status ${STATUS}"
@@ -28,7 +28,7 @@ validate_result
echo "Pass -m 0: status ${STATUS}"
# queue mode
-./odp_pktio${EXEEXT} -i $IF1 -t 1 -m 1
+./odp_pktio${EXEEXT} -i $IF1 -t $TEST_TIME -m 1
STATUS=$?
if [ ${STATUS} -ne 0 ]; then
@@ -40,7 +40,7 @@ validate_result
echo "Pass -m 1: status ${STATUS}"
# sched/queue mode
-./odp_pktio${EXEEXT} -i $IF1 -t 1 -m 2
+./odp_pktio${EXEEXT} -i $IF1 -t $TEST_TIME -m 2
STATUS=$?
if [ ${STATUS} -ne 0 ]; then
@@ -52,7 +52,7 @@ validate_result
echo "Pass -m 2: status ${STATUS}"
# cpu number option test 1
-./odp_pktio${EXEEXT} -i $IF1 -t 1 -m 0 -c 1
+./odp_pktio${EXEEXT} -i $IF1 -t $TEST_TIME -m 0 -c 1
STATUS=$?
if [ ${STATUS} -ne 0 ]; then
diff --git a/example/ping/odp_ping.c b/example/ping/odp_ping.c
index dbe453319..97b856895 100644
--- a/example/ping/odp_ping.c
+++ b/example/ping/odp_ping.c
@@ -2,6 +2,16 @@
* Copyright (c) 2019-2023 Nokia
*/
+/**
+ * @example odp_ping.c
+ *
+ * This application replies to IPv4 ping requests. It can be used to test
+ * connectivity with standard ping utility. ARP table needs to be setup manually
+ * on the sender side as the application does not reply to ARP requests.
+ *
+ * @cond _ODP_HIDE_FROM_DOXYGEN_
+ */
+
#include <stdio.h>
#include <string.h>
#include <signal.h>
diff --git a/example/ping/ping_run.sh b/example/ping/ping_run.sh
index 0017c4ce0..9598db70a 100755
--- a/example/ping/ping_run.sh
+++ b/example/ping/ping_run.sh
@@ -1,9 +1,7 @@
#!/bin/bash
#
-# Copyright (c) 2019, Nokia
-# All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright (c) 2019 Nokia
#
if [ -f ./pktio_env ]; then
diff --git a/example/simple_pipeline/odp_simple_pipeline.c b/example/simple_pipeline/odp_simple_pipeline.c
index b8fb2d0be..ad80bc394 100644
--- a/example/simple_pipeline/odp_simple_pipeline.c
+++ b/example/simple_pipeline/odp_simple_pipeline.c
@@ -1,9 +1,18 @@
-/* Copyright (c) 2019, Nokia
- * All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2019 Nokia
*/
+ /**
+ * @example odp_simple_pipeline.c
+ *
+ * Simple pipeline example application which receives packets from one
+ * interface and passes them through 0-N worker stages before outputting them
+ * from a second network interface. The RX, worker, and TX stages are connected
+ * using plain queues and each stage is run on a separate CPU thread.
+ *
+ * @cond _ODP_HIDE_FROM_DOXYGEN_
+ */
+
#include <stdlib.h>
#include <stdio.h>
#include <getopt.h>
diff --git a/example/simple_pipeline/simple_pipeline_run.sh b/example/simple_pipeline/simple_pipeline_run.sh
index f9248c42d..ba66e506e 100755
--- a/example/simple_pipeline/simple_pipeline_run.sh
+++ b/example/simple_pipeline/simple_pipeline_run.sh
@@ -1,9 +1,7 @@
#!/bin/bash
#
-# Copyright (c) 2019, Nokia
-# All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright (c) 2019 Nokia
#
# Exit code expected by automake for skipped tests
diff --git a/example/switch/odp_switch.c b/example/switch/odp_switch.c
index ae12b0b11..0160c2d0a 100644
--- a/example/switch/odp_switch.c
+++ b/example/switch/odp_switch.c
@@ -1,8 +1,14 @@
-/* Copyright (c) 2016-2018, Linaro Limited
- * Copyright (c) 2020, Nokia
- * All rights reserved.
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2016-2018 Linaro Limited
+ * Copyright (c) 2020 Nokia
+ */
+
+/**
+ * @example odp_switch.c
+ *
+ * Minimal learning Ethernet switch example application
*
- * SPDX-License-Identifier: BSD-3-Clause
+ * @cond _ODP_HIDE_FROM_DOXYGEN_
*/
#include <stdio.h>
diff --git a/example/switch/switch_run.sh b/example/switch/switch_run.sh
index 489b17de5..c01c505ba 100755
--- a/example/switch/switch_run.sh
+++ b/example/switch/switch_run.sh
@@ -1,9 +1,7 @@
#!/bin/bash
#
-# Copyright (c) 2016-2018, Linaro Limited
-# All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright (c) 2016-2018 Linaro Limited
#
RETVAL=0
diff --git a/example/sysinfo/odp_sysinfo.c b/example/sysinfo/odp_sysinfo.c
index 151388263..df33f45cf 100644
--- a/example/sysinfo/odp_sysinfo.c
+++ b/example/sysinfo/odp_sysinfo.c
@@ -1,10 +1,17 @@
-/* Copyright (c) 2018, Linaro Limited
- * Copyright (c) 2022-2023, Nokia
- * All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2018 Linaro Limited
+ * Copyright (c) 2022-2023 Nokia
*/
+ /**
+ * @example odp_sysinfo.c
+ *
+ * Example application which queries and prints out various system information
+ * and capabilities which are available through ODP APIs.
+ *
+ * @cond _ODP_HIDE_FROM_DOXYGEN_
+ */
+
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
@@ -739,6 +746,7 @@ int main(int argc, char **argv)
odp_ipsec_capability_t ipsec_capa;
odp_schedule_capability_t schedule_capa;
odp_stash_capability_t stash_capa;
+ odp_ml_capability_t ml_capa;
appl_args_t appl_args;
uint64_t huge_page[MAX_HUGE_PAGES];
char ava_mask_str[ODP_CPUMASK_STR_SIZE];
@@ -854,6 +862,11 @@ int main(int argc, char **argv)
exit(EXIT_FAILURE);
}
+ if (odp_ml_capability(&ml_capa)) {
+ ODPH_ERR("ml capability failed\n");
+ exit(EXIT_FAILURE);
+ }
+
crypto_ret = odp_crypto_capability(&crypto_capa);
if (crypto_ret < 0)
ODPH_ERR("crypto capability failed\n");
@@ -1066,6 +1079,33 @@ int main(int argc, char **argv)
printf(" max_put_batch: %u\n", stash_capa.max_put_batch);
printf(" stats: 0x%" PRIx64 "\n", stash_capa.stats.all);
+ printf("\n");
+ printf(" ML\n");
+ printf(" max_models: %u\n", ml_capa.max_models);
+ printf(" max_models_loaded: %u\n", ml_capa.max_models_loaded);
+ printf(" max_model_size: %" PRIu64 "B\n", ml_capa.max_model_size);
+ printf(" max_compl_id: %u\n", ml_capa.max_compl_id);
+ printf(" max_inputs: %u\n", ml_capa.max_inputs);
+ printf(" max_outputs: %u\n", ml_capa.max_outputs);
+ printf(" max_segs_per_input: %u\n", ml_capa.max_segs_per_input);
+ printf(" max_segs_per_output: %u\n", ml_capa.max_segs_per_output);
+ printf(" min_input_align: %u\n", ml_capa.min_input_align);
+ printf(" min_output_align: %u\n", ml_capa.min_output_align);
+ printf(" packed_input_data: %u\n", ml_capa.packed_input_data);
+ printf(" packed_output_data: %u\n", ml_capa.packed_output_data);
+ printf(" load.compl_mode_mask: 0x%x\n", ml_capa.load.compl_mode_mask);
+ printf(" load.compl_queue_plain: %i\n", ml_capa.load.compl_queue_plain);
+ printf(" load.compl_queue_sched: %i\n", ml_capa.load.compl_queue_sched);
+ printf(" run.compl_mode_mask: 0x%x\n", ml_capa.run.compl_mode_mask);
+ printf(" run.compl_queue_plain: %i\n", ml_capa.run.compl_queue_plain);
+ printf(" run.compl_queue_sched: %i\n", ml_capa.run.compl_queue_sched);
+ printf(" pool.max_pools: %u\n", ml_capa.pool.max_pools);
+ printf(" pool.max_num: %u\n", ml_capa.pool.max_num);
+ printf(" pool.max_uarea_size: %u B\n", ml_capa.pool.max_uarea_size);
+ printf(" pool.uarea_persistence: %u\n", ml_capa.pool.uarea_persistence);
+ printf(" pool.min_cache_size: %u\n", ml_capa.pool.min_cache_size);
+ printf(" pool.max_cache_size: %u\n", ml_capa.pool.max_cache_size);
+
print_timer_capa(&appl_args);
if (crypto_ret == 0) {
diff --git a/example/time/Makefile.am b/example/time/Makefile.am
index 5621ef99e..b5a1ad35d 100644
--- a/example/time/Makefile.am
+++ b/example/time/Makefile.am
@@ -6,4 +6,4 @@ if test_example
TESTS = odp_time_global
endif
-odp_time_global_SOURCES = time_global_test.c
+odp_time_global_SOURCES = odp_time_global_test.c
diff --git a/example/time/time_global_test.c b/example/time/odp_time_global_test.c
index 2357f25d6..7c1409abf 100644
--- a/example/time/time_global_test.c
+++ b/example/time/odp_time_global_test.c
@@ -1,7 +1,13 @@
-/* Copyright (c) 2015-2018, Linaro Limited
- * All rights reserved.
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2015-2018 Linaro Limited
+ */
+
+/**
+ * @example odp_time_global_test.c
+ *
+ * Time API test application
*
- * SPDX-License-Identifier: BSD-3-Clause
+ * @cond _ODP_HIDE_FROM_DOXYGEN_
*/
#include <inttypes.h>
diff --git a/example/timer/Makefile.am b/example/timer/Makefile.am
index da85be233..66cf0edfb 100644
--- a/example/timer/Makefile.am
+++ b/example/timer/Makefile.am
@@ -16,5 +16,3 @@ TESTS = odp_timer_accuracy_run.sh \
endif
EXTRA_DIST = odp_timer_accuracy_run.sh
-
-.NOTPARALLEL:
diff --git a/example/timer/odp_timer_accuracy.c b/example/timer/odp_timer_accuracy.c
index 23c40e66f..e5df1c24e 100644
--- a/example/timer/odp_timer_accuracy.c
+++ b/example/timer/odp_timer_accuracy.c
@@ -1,8 +1,14 @@
-/* Copyright (c) 2018, Linaro Limited
- * Copyright (c) 2019-2023, Nokia
- * All rights reserved.
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2018 Linaro Limited
+ * Copyright (c) 2019-2023 Nokia
+ */
+
+/**
+ * @example odp_timer_accuracy.c
*
- * SPDX-License-Identifier: BSD-3-Clause
+ * ODP timer accuracy test application
+ *
+ * @cond _ODP_HIDE_FROM_DOXYGEN_
*/
#include <errno.h>
@@ -761,7 +767,7 @@ static int start_timers(test_global_t *test_global)
odp_timer_start_t start_param;
if (mode == MODE_PERIODIC) {
- odp_timer_periodic_start_t start_param;
+ odp_timer_periodic_start_t periodic_start;
nsec = offset_ns + (j * burst_gap);
@@ -775,13 +781,13 @@ static int start_timers(test_global_t *test_global)
ctx->first_period = start_tick +
odp_timer_ns_to_tick(timer_pool,
test_global->period_dbl + 0.5);
- start_param.freq_multiplier = test_global->opt.multiplier;
- start_param.first_tick = 0;
+ periodic_start.freq_multiplier = test_global->opt.multiplier;
+ periodic_start.first_tick = 0;
if (nsec)
- start_param.first_tick =
+ periodic_start.first_tick =
start_tick + odp_timer_ns_to_tick(timer_pool, nsec);
- start_param.tmo_ev = ctx->event;
- retval = odp_timer_periodic_start(ctx->timer, &start_param);
+ periodic_start.tmo_ev = ctx->event;
+ retval = odp_timer_periodic_start(ctx->timer, &periodic_start);
} else {
nsec = offset_ns + (i * period_ns) + (j * burst_gap);
ctx->nsec = start_ns + nsec;
@@ -869,7 +875,6 @@ static void print_nsec_error(const char *str, int64_t nsec, double res_ns,
static void print_stat(test_global_t *test_global)
{
- uint64_t i;
test_stat_t test_stat;
test_stat_t *stat = &test_stat;
uint64_t tot_timers;
@@ -937,7 +942,7 @@ static void print_stat(test_global_t *test_global)
fprintf(file, " Timer thread tmo(ns) diff(ns)\n");
- for (i = 0; i < tot_timers; i++) {
+ for (uint64_t i = 0; i < tot_timers; i++) {
fprintf(file, "%8" PRIu64 " %7u %12" PRIu64 " %10"
PRIi64 "\n", i, log[i].tid, log[i].tmo_ns, log[i].diff_ns);
}
diff --git a/example/timer/odp_timer_accuracy_run.sh b/example/timer/odp_timer_accuracy_run.sh
index 3b29191c4..1c879f4e6 100755
--- a/example/timer/odp_timer_accuracy_run.sh
+++ b/example/timer/odp_timer_accuracy_run.sh
@@ -1,9 +1,7 @@
#!/bin/bash
#
-# Copyright (c) 2022, Nokia
-# All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright (c) 2022 Nokia
#
./odp_timer_accuracy${EXEEXT} -p 100000000 -n 10
diff --git a/example/timer/odp_timer_simple.c b/example/timer/odp_timer_simple.c
index 681f95714..ceba66c62 100644
--- a/example/timer/odp_timer_simple.c
+++ b/example/timer/odp_timer_simple.c
@@ -1,13 +1,13 @@
-/* Copyright (c) 2016-2018, Linaro Limited
- * All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2016-2018 Linaro Limited
*/
+
/**
- * @file
+ * @example odp_timer_simple.c
+ *
+ * Minimal example application demonstrating ODP timer API usage
*
- * @example odp_timer_simple.c ODP simple example to schedule timer
- * action for 1 second.
+ * @cond _ODP_HIDE_FROM_DOXYGEN_
*/
#include <string.h>
@@ -121,9 +121,8 @@ int main(int argc ODP_UNUSED, char *argv[] ODP_UNUSED)
ev = odp_timeout_to_event(tmo);
- /* Calculate period for timer in uint64_t value, in current case
- * we will schedule timer for 1 second */
- period = odp_timer_ns_to_tick(timer_pool, 1 * ODP_TIME_SEC_IN_NS);
+ /* Calculate timer period in ticks */
+ period = odp_timer_ns_to_tick(timer_pool, 100 * ODP_TIME_MSEC_IN_NS);
/* Wait time to return from odp_schedule() if there are no
* events
@@ -159,7 +158,7 @@ int main(int argc ODP_UNUSED, char *argv[] ODP_UNUSED)
i, odp_time_to_ns(time));
/* Do not free current event, just go back to loop and program
- * timeout to next second.
+ * the next timeout.
*/
}
diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c
index a397a6ac9..674d4f4ce 100644
--- a/example/timer/odp_timer_test.c
+++ b/example/timer/odp_timer_test.c
@@ -1,7 +1,13 @@
-/* Copyright (c) 2013-2018, Linaro Limited
- * All rights reserved.
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2013-2018 Linaro Limited
+ */
+
+/**
+ * @example odp_timer_test.c
*
- * SPDX-License-Identifier: BSD-3-Clause
+ * Timer test application
+ *
+ * @cond _ODP_HIDE_FROM_DOXYGEN_
*/
#include <string.h>
@@ -161,7 +167,7 @@ static void test_abs_timeouts(int thr, test_globals_t *gbls)
ODPH_ABORT("Unexpected event type (%u) received\n",
odp_event_type(ev));
}
- odp_timeout_t tmo = odp_timeout_from_event(ev);
+ tmo = odp_timeout_from_event(ev);
tick = odp_timeout_tick(tmo);
ttp = odp_timeout_user_ptr(tmo);
ttp->ev = ev;
@@ -178,7 +184,10 @@ static void test_abs_timeouts(int thr, test_globals_t *gbls)
continue;
odp_event_free(ttp->ev);
- odp_timer_free(ttp->tim);
+
+ if (odp_timer_free(ttp->tim))
+ ODPH_ABORT("Timer free failed (%" PRIu64 ")\n", odp_timer_to_u64(ttp->tim));
+
ttp = NULL;
}
diff --git a/example/traffic_mgmt/odp_traffic_mgmt.c b/example/traffic_mgmt/odp_traffic_mgmt.c
index 5c97c5433..4ed4f2044 100644
--- a/example/traffic_mgmt/odp_traffic_mgmt.c
+++ b/example/traffic_mgmt/odp_traffic_mgmt.c
@@ -1,12 +1,17 @@
-/* Copyright 2015 EZchip Semiconductor Ltd. All Rights Reserved.
- *
- * Copyright (c) 2015-2018, Linaro Limited
- * Copyright (c) 2022, Marvell
- * All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2015 EZchip Semiconductor Ltd.
+ * Copyright (c) 2015-2018 Linaro Limited
+ * Copyright (c) 2022 Marvell
*/
+ /**
+ * @example odp_traffic_mgmt.c
+ *
+ * Traffic manager API example application
+ *
+ * @cond _ODP_HIDE_FROM_DOXYGEN_
+ */
+
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
@@ -287,7 +292,7 @@ static uint32_t next_rand_byte;
static odp_atomic_u32_t atomic_pkts_into_tm;
static odp_atomic_u32_t atomic_pkts_from_tm;
-static uint32_t g_num_pkts_to_send = 1000;
+static uint32_t g_num_pkts_to_send = 100;
static uint8_t g_print_tm_stats = TRUE;
static void tester_egress_fcn(odp_packet_t odp_pkt);
@@ -632,20 +637,19 @@ static int create_and_config_tm(void)
tm_shaper_max_burst = tm_capa.per_level[0].max_burst;
for (level = 1; level < tm_capa.max_levels; level++) {
- odp_tm_level_capabilities_t *per_level =
- &tm_capa.per_level[level];
+ odp_tm_level_capabilities_t *level_capa = &tm_capa.per_level[level];
- if (per_level->min_rate > tm_shaper_min_rate)
- tm_shaper_min_rate = per_level->min_rate;
+ if (level_capa->min_rate > tm_shaper_min_rate)
+ tm_shaper_min_rate = level_capa->min_rate;
- if (per_level->min_burst > tm_shaper_min_burst)
- tm_shaper_min_burst = per_level->min_burst;
+ if (level_capa->min_burst > tm_shaper_min_burst)
+ tm_shaper_min_burst = level_capa->min_burst;
- if (per_level->max_rate < tm_shaper_max_rate)
- tm_shaper_max_rate = per_level->max_rate;
+ if (level_capa->max_rate < tm_shaper_max_rate)
+ tm_shaper_max_rate = level_capa->max_rate;
- if (per_level->max_burst < tm_shaper_max_burst)
- tm_shaper_max_burst = per_level->max_burst;
+ if (level_capa->max_burst < tm_shaper_max_burst)
+ tm_shaper_max_burst = level_capa->max_burst;
}
if (tm_shaper_min_rate > tm_shaper_max_rate ||