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 a97db1b8b46b9656f964ccf09ce28941ae062507 (commit) via d1d06aa241b97e2f1919ee990168a21319a66143 (commit) via c2784fbafbf8a29b6daa48429133e25b777536cf (commit) via 9f0f2b86309aa8021ec937e7c0ee1d6f48b0d769 (commit) from c03685af2895b20a5e8a046ea910254a96ab15c4 (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 a97db1b8b46b9656f964ccf09ce28941ae062507 Author: Petri Savolainen petri.savolainen@nokia.com Date: Mon Jul 4 18:42:26 2016 +0300
example: hello: add hello world example application
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.
Signed-off-by: Petri Savolainen petri.savolainen@nokia.com Reviewed-and-tested-by: Bill Fischofer bill.fischofer@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/example/Makefile.am b/example/Makefile.am index 7f82c4d..37542af 100644 --- a/example/Makefile.am +++ b/example/Makefile.am @@ -1 +1 @@ -SUBDIRS = classifier generator ipsec packet time timer traffic_mgmt l2fwd_simple switch +SUBDIRS = classifier generator ipsec packet time timer traffic_mgmt l2fwd_simple switch hello diff --git a/example/hello/.gitignore b/example/hello/.gitignore new file mode 100644 index 0000000..7c11c4c --- /dev/null +++ b/example/hello/.gitignore @@ -0,0 +1,3 @@ +odp_hello +*.log +*.trs diff --git a/example/hello/Makefile.am b/example/hello/Makefile.am new file mode 100644 index 0000000..2e4e0ce --- /dev/null +++ b/example/hello/Makefile.am @@ -0,0 +1,11 @@ +include $(top_srcdir)/example/Makefile.inc + +bin_PROGRAMS = odp_hello$(EXEEXT) +odp_hello_LDFLAGS = $(AM_LDFLAGS) -static +odp_hello_CFLAGS = $(AM_CFLAGS) -I${top_srcdir}/example + +dist_odp_hello_SOURCES = odp_hello.c + +if test_example +TESTS = odp_hello +endif diff --git a/example/hello/odp_hello.c b/example/hello/odp_hello.c new file mode 100644 index 0000000..6d114ee --- /dev/null +++ b/example/hello/odp_hello.c @@ -0,0 +1,107 @@ +/* Copyright (c) 2016, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/* 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. + */ + +/* Linux CPU affinity */ +#define _GNU_SOURCE +#include <sched.h> + +/* Linux PID */ +#include <sys/types.h> +#include <unistd.h> + +#include <stdio.h> +#include <string.h> + +#include <odp_api.h> + +typedef struct { + int cpu; + int num; +} options_t; + +static int parse_args(int argc, char *argv[], options_t *opt) +{ + static const char * const args[] = {"-c", "-n"}; + int i, tmp; + + for (i = 1; i < argc; i++) { + if ((strcmp(argv[i], args[0]) == 0) && + (sscanf(argv[i + 1], "%i", &tmp) == 1)) { + opt->cpu = tmp; + i++; + } else if ((strcmp(argv[i], args[1]) == 0) && + (sscanf(argv[i + 1], "%i", &tmp) == 1)) { + opt->num = tmp; + i++; + } else { + printf("\nUsage:\n" + " %s CPU number\n" + " %s Number of iterations\n\n", + args[0], args[1]); + return -1; + } + } + + return 0; +} + +int main(int argc, char *argv[]) +{ + odp_instance_t inst; + options_t opt; + pid_t pid; + cpu_set_t cpu_set; + int i; + + memset(&opt, 0, sizeof(opt)); + opt.cpu = 0; + opt.num = 1; + + if (parse_args(argc, argv, &opt)) + return -1; + + pid = getpid(); + CPU_ZERO(&cpu_set); + CPU_SET(opt.cpu, &cpu_set); + + if (sched_setaffinity(pid, sizeof(cpu_set_t), &cpu_set)) { + printf("Set CPU affinity failed.\n"); + return -1; + } + + if (odp_init_global(&inst, NULL, NULL)) { + printf("Global init failed.\n"); + return -1; + } + + if (odp_init_local(inst, ODP_THREAD_CONTROL)) { + printf("Local init failed.\n"); + return -1; + } + + for (i = 0; i < opt.num; i++) { + printf("Hello world from CPU %i!\n", odp_cpu_id()); + odp_time_wait_ns(ODP_TIME_SEC_IN_NS); + } + + if (odp_term_local()) { + printf("Local term failed.\n"); + return -1; + } + + if (odp_term_global(inst)) { + printf("Global term failed.\n"); + return -1; + } + + return 0; +} diff --git a/example/m4/configure.m4 b/example/m4/configure.m4 index 9731d81..bbda38f 100644 --- a/example/m4/configure.m4 +++ b/example/m4/configure.m4 @@ -19,4 +19,5 @@ AC_CONFIG_FILES([example/classifier/Makefile example/timer/Makefile example/traffic_mgmt/Makefile example/l2fwd_simple/Makefile - example/switch/Makefile]) + example/switch/Makefile + example/hello/Makefile])
commit d1d06aa241b97e2f1919ee990168a21319a66143 Author: Petri Savolainen petri.savolainen@nokia.com Date: Mon Jul 4 18:42:25 2016 +0300
linux-gen: std_types: remove extra c headers
Removed C header includes which are not needed for API definitions. ODP API depends on uint64_t, etc types in stdint.h, but not other C headers. As an exception, stdbool.h remains since 'true' and 'false' definitions may be used with odp_bool_t. It could be also removed later since true/false are not part of the API (where as uint64_t, etc types).
Application needs to include other C library headers directly. ODP API does not specify which headers are included by odp_api.h.
Signed-off-by: Petri Savolainen petri.savolainen@nokia.com Reviewed-and-tested-by: Bill Fischofer bill.fischofer@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/example/classifier/odp_classifier.c b/example/classifier/odp_classifier.c index 20e64ec..1bd2414 100644 --- a/example/classifier/odp_classifier.c +++ b/example/classifier/odp_classifier.c @@ -8,6 +8,7 @@ #include <string.h> #include <getopt.h> #include <unistd.h> +#include <inttypes.h> #include <example_debug.h>
#include <odp_api.h> diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index 8393244..3fea112 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -13,6 +13,7 @@ #include <stdlib.h> #include <getopt.h> #include <unistd.h> +#include <inttypes.h> #include <sys/time.h>
#include <example_debug.h> diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c index 451bb2d..d8ca791 100644 --- a/example/ipsec/odp_ipsec.c +++ b/example/ipsec/odp_ipsec.c @@ -18,6 +18,7 @@ #include <stdlib.h> #include <getopt.h> #include <unistd.h> +#include <inttypes.h>
#include <example_debug.h>
diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c index 564c63a..6e14abb 100644 --- a/example/packet/odp_pktio.c +++ b/example/packet/odp_pktio.c @@ -8,6 +8,7 @@ #include <string.h> #include <getopt.h> #include <unistd.h> +#include <inttypes.h>
#include <example_debug.h>
diff --git a/example/switch/odp_switch.c b/example/switch/odp_switch.c index 09835c0..5ce71a9 100644 --- a/example/switch/odp_switch.c +++ b/example/switch/odp_switch.c @@ -7,6 +7,8 @@ #include <stdio.h> #include <getopt.h> #include <unistd.h> +#include <stdlib.h> +#include <inttypes.h>
#include <odp_api.h> #include <odp/helper/linux.h> diff --git a/example/time/time_global_test.c b/example/time/time_global_test.c index 372d96b..380ec52 100644 --- a/example/time/time_global_test.c +++ b/example/time/time_global_test.c @@ -7,6 +7,7 @@ #include <odp_api.h> #include <example_debug.h> #include <odp/helper/linux.h> +#include <inttypes.h>
#define MAX_WORKERS 32 #define ITERATION_NUM 2048 diff --git a/example/timer/odp_timer_simple.c b/example/timer/odp_timer_simple.c index f33add9..98c08ce 100644 --- a/example/timer/odp_timer_simple.c +++ b/example/timer/odp_timer_simple.c @@ -12,6 +12,7 @@
#include <string.h> #include <stdlib.h> +#include <inttypes.h> #include <example_debug.h>
/* ODP main header */ diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c index cb58dfe..035ab2e 100644 --- a/example/timer/odp_timer_test.c +++ b/example/timer/odp_timer_test.c @@ -6,6 +6,7 @@
#include <string.h> #include <stdlib.h> +#include <inttypes.h>
#include <example_debug.h>
diff --git a/helper/chksum.c b/helper/chksum.c index 859d1ec..8f18881 100644 --- a/helper/chksum.c +++ b/helper/chksum.c @@ -9,6 +9,8 @@ #include <odp/helper/udp.h> #include <odp/helper/tcp.h> #include <odp/helper/chksum.h> +#include <stddef.h> +#include <stdbool.h>
/* The following union type is used to "view" an ordered set of bytes (either * 2 or 4) as 1 or 2 16-bit quantities - using host endian order. */ diff --git a/helper/linux.c b/helper/linux.c index a1dbe52..bb4b22c 100644 --- a/helper/linux.c +++ b/helper/linux.c @@ -17,6 +17,7 @@ #include <stdlib.h> #include <string.h> #include <stdio.h> +#include <stdbool.h>
#include <odp_api.h> #include <odp/helper/linux.h> diff --git a/platform/linux-generic/include/odp/api/std_types.h b/platform/linux-generic/include/odp/api/std_types.h index d4eeb5d..b61f33f 100644 --- a/platform/linux-generic/include/odp/api/std_types.h +++ b/platform/linux-generic/include/odp/api/std_types.h @@ -17,13 +17,11 @@ extern "C" { #endif
-#include <stdlib.h> +/* uint64_t, uint32_t, etc */ #include <stdint.h> -#include <stddef.h> + +/* true and false for odp_bool_t */ #include <stdbool.h> -#include <stdint.h> -#include <inttypes.h> -#include <limits.h>
/** @addtogroup odp_system ODP SYSTEM * @{ diff --git a/platform/linux-generic/include/odp_atomic_internal.h b/platform/linux-generic/include/odp_atomic_internal.h index 67e8f82..dca2175 100644 --- a/platform/linux-generic/include/odp_atomic_internal.h +++ b/platform/linux-generic/include/odp_atomic_internal.h @@ -20,6 +20,7 @@ #include <odp/api/align.h> #include <odp/api/hints.h> #include <odp/api/atomic.h> +#include <stdbool.h>
#ifdef __cplusplus extern "C" { diff --git a/platform/linux-generic/include/odp_buffer_internal.h b/platform/linux-generic/include/odp_buffer_internal.h index a427a80..f21364c 100644 --- a/platform/linux-generic/include/odp_buffer_internal.h +++ b/platform/linux-generic/include/odp_buffer_internal.h @@ -31,6 +31,7 @@ extern "C" { #include <odp/api/event.h> #include <odp_forward_typedefs_internal.h> #include <odp_schedule_if.h> +#include <stddef.h>
#define ODP_BITSIZE(x) \ ((x) <= 2 ? 1 : \ diff --git a/platform/linux-generic/include/odp_packet_socket.h b/platform/linux-generic/include/odp_packet_socket.h index 09a571b..ccff69a 100644 --- a/platform/linux-generic/include/odp_packet_socket.h +++ b/platform/linux-generic/include/odp_packet_socket.h @@ -12,6 +12,7 @@ #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> diff --git a/platform/linux-generic/odp_buffer.c b/platform/linux-generic/odp_buffer.c index 69f913d..e7e4d58 100644 --- a/platform/linux-generic/odp_buffer.c +++ b/platform/linux-generic/odp_buffer.c @@ -12,7 +12,7 @@
#include <string.h> #include <stdio.h> - +#include <inttypes.h>
odp_buffer_t odp_buffer_from_event(odp_event_t ev) { diff --git a/platform/linux-generic/odp_classification.c b/platform/linux-generic/odp_classification.c index 0602a62..027a7ce 100644 --- a/platform/linux-generic/odp_classification.c +++ b/platform/linux-generic/odp_classification.c @@ -21,6 +21,7 @@ #include <odp/helper/eth.h> #include <string.h> #include <errno.h> +#include <stdbool.h> #include <odp/api/spinlock.h>
#define LOCK(a) odp_spinlock_lock(a) diff --git a/platform/linux-generic/odp_hash.c b/platform/linux-generic/odp_hash.c index 0e09282..55876c3 100644 --- a/platform/linux-generic/odp_hash.c +++ b/platform/linux-generic/odp_hash.c @@ -40,6 +40,8 @@ #include <odp/api/hash.h> #include <odp/api/std_types.h>
+#include <stddef.h> + static const uint32_t crc32c_tables[8][256] = {{ 0x00000000, 0xF26B8303, 0xE13B70F7, 0x1350F3F4, 0xC79A971F, 0x35F1141C, 0x26A1E7E8, 0xD4CA64EB, 0x8AD958CF, 0x78B2DBCC, 0x6BE22838, 0x9989AB3B, diff --git a/platform/linux-generic/odp_packet.c b/platform/linux-generic/odp_packet.c index 9f81073..0a868e9 100644 --- a/platform/linux-generic/odp_packet.c +++ b/platform/linux-generic/odp_packet.c @@ -18,6 +18,7 @@ #include <errno.h> #include <string.h> #include <stdio.h> +#include <inttypes.h>
/* * diff --git a/platform/linux-generic/odp_packet_io.c b/platform/linux-generic/odp_packet_io.c index 5b202e7..0b9939b 100644 --- a/platform/linux-generic/odp_packet_io.c +++ b/platform/linux-generic/odp_packet_io.c @@ -24,6 +24,7 @@ #include <odp/api/time.h>
#include <string.h> +#include <inttypes.h> #include <sys/ioctl.h> #include <ifaddrs.h> #include <errno.h> diff --git a/platform/linux-generic/odp_pkt_queue.c b/platform/linux-generic/odp_pkt_queue.c index cbe1e74..7734ee9 100644 --- a/platform/linux-generic/odp_pkt_queue.c +++ b/platform/linux-generic/odp_pkt_queue.c @@ -10,6 +10,7 @@ #include <string.h> #include <malloc.h> #include <stdio.h> +#include <inttypes.h> #include <odp_api.h> #include <odp_pkt_queue_internal.h> #include <odp_debug_internal.h> diff --git a/platform/linux-generic/odp_pool.c b/platform/linux-generic/odp_pool.c index 5ed7080..ec6d86a 100644 --- a/platform/linux-generic/odp_pool.c +++ b/platform/linux-generic/odp_pool.c @@ -22,7 +22,7 @@
#include <string.h> #include <stdlib.h> - +#include <inttypes.h>
#if ODP_CONFIG_POOLS > ODP_BUFFER_MAX_POOLS #error ODP_CONFIG_POOLS > ODP_BUFFER_MAX_POOLS diff --git a/platform/linux-generic/odp_queue.c b/platform/linux-generic/odp_queue.c index 1166a72..bec1e51 100644 --- a/platform/linux-generic/odp_queue.c +++ b/platform/linux-generic/odp_queue.c @@ -42,7 +42,7 @@ #endif
#include <string.h> - +#include <inttypes.h>
typedef struct queue_table_t { queue_entry_t queue[ODP_CONFIG_QUEUES]; diff --git a/platform/linux-generic/odp_shared_memory.c b/platform/linux-generic/odp_shared_memory.c index f432cf9..550af27 100644 --- a/platform/linux-generic/odp_shared_memory.c +++ b/platform/linux-generic/odp_shared_memory.c @@ -26,6 +26,7 @@ #include <stdio.h> #include <string.h> #include <errno.h> +#include <inttypes.h>
ODP_STATIC_ASSERT(ODP_CONFIG_SHM_BLOCKS >= ODP_CONFIG_POOLS, "ODP_CONFIG_SHM_BLOCKS < ODP_CONFIG_POOLS"); diff --git a/platform/linux-generic/odp_sorted_list.c b/platform/linux-generic/odp_sorted_list.c index 554494b..8a1dc3a 100644 --- a/platform/linux-generic/odp_sorted_list.c +++ b/platform/linux-generic/odp_sorted_list.c @@ -10,6 +10,7 @@ #include <string.h> #include <malloc.h> #include <stdio.h> +#include <inttypes.h> #include <odp_debug_internal.h> #include <odp_sorted_list_internal.h>
diff --git a/platform/linux-generic/odp_system_info.c b/platform/linux-generic/odp_system_info.c index fca35ce..bbe5358 100644 --- a/platform/linux-generic/odp_system_info.c +++ b/platform/linux-generic/odp_system_info.c @@ -15,6 +15,7 @@ #include <sched.h> #include <string.h> #include <stdio.h> +#include <inttypes.h>
/* sysconf */ #include <unistd.h> diff --git a/platform/linux-generic/odp_timer.c b/platform/linux-generic/odp_timer.c index 996edf0..becea9d 100644 --- a/platform/linux-generic/odp_timer.c +++ b/platform/linux-generic/odp_timer.c @@ -28,6 +28,7 @@ #include <pthread.h> #include <unistd.h> #include <sys/syscall.h> +#include <inttypes.h>
#include <odp/api/align.h> #include <odp_align_internal.h> diff --git a/platform/linux-generic/odp_timer_wheel.c b/platform/linux-generic/odp_timer_wheel.c index 865dd7e..f2c802a 100644 --- a/platform/linux-generic/odp_timer_wheel.c +++ b/platform/linux-generic/odp_timer_wheel.c @@ -10,6 +10,7 @@ #include <string.h> #include <malloc.h> #include <stdio.h> +#include <inttypes.h> #include <odp_timer_wheel_internal.h> #include <odp_traffic_mngr_internal.h> #include <odp_debug_internal.h> diff --git a/platform/linux-generic/odp_traffic_mngr.c b/platform/linux-generic/odp_traffic_mngr.c index 681df00..9cfa1fc 100644 --- a/platform/linux-generic/odp_traffic_mngr.c +++ b/platform/linux-generic/odp_traffic_mngr.c @@ -11,6 +11,8 @@ #include <string.h> #include <malloc.h> #include <stdio.h> +#include <stdbool.h> +#include <inttypes.h> #include <sys/types.h> #include <sys/stat.h> #include <sched.h> diff --git a/platform/linux-generic/pktio/loop.c b/platform/linux-generic/pktio/loop.c index dce33e5..1febacd 100644 --- a/platform/linux-generic/pktio/loop.c +++ b/platform/linux-generic/pktio/loop.c @@ -16,6 +16,8 @@ #include <odp/helper/ip.h>
#include <errno.h> +#include <inttypes.h> +#include <limits.h>
/* MAC address for the "loop" interface */ static const char pktio_loop_mac[] = {0x02, 0xe9, 0x34, 0x80, 0x73, 0x01}; diff --git a/platform/linux-generic/pktio/netmap.c b/platform/linux-generic/pktio/netmap.c index 847250b..08e49f4 100644 --- a/platform/linux-generic/pktio/netmap.c +++ b/platform/linux-generic/pktio/netmap.c @@ -22,6 +22,8 @@ #include <odp_classification_inlines.h> #include <odp_classification_internal.h>
+#include <inttypes.h> + /* Disable netmap debug prints */ #ifndef ND #define ND(_fmt, ...) do {} while (0) diff --git a/platform/linux-generic/pktio/ring.c b/platform/linux-generic/pktio/ring.c index ec27f2c..3024f4a 100644 --- a/platform/linux-generic/pktio/ring.c +++ b/platform/linux-generic/pktio/ring.c @@ -73,6 +73,8 @@ #include <fcntl.h> #include <stdio.h> #include <string.h> +#include <stdbool.h> +#include <inttypes.h> #include "odph_debug.h" #include <odp_packet_io_ring_internal.h> #include <odp_internal.h> diff --git a/platform/linux-generic/pktio/sysfs.c b/platform/linux-generic/pktio/sysfs.c index 7aadc14..be0822d 100644 --- a/platform/linux-generic/pktio/sysfs.c +++ b/platform/linux-generic/pktio/sysfs.c @@ -8,6 +8,7 @@ #include <odp_packet_io_internal.h> #include <errno.h> #include <string.h> +#include <inttypes.h>
static int sysfs_get_val(const char *fname, uint64_t *val) { diff --git a/platform/linux-generic/pktio/tap.c b/platform/linux-generic/pktio/tap.c index 8ba7bed..a9a8886 100644 --- a/platform/linux-generic/pktio/tap.c +++ b/platform/linux-generic/pktio/tap.c @@ -33,6 +33,7 @@ #include <fcntl.h> #include <unistd.h> #include <stdio.h> +#include <stdbool.h> #include <sys/ioctl.h> #include <sys/socket.h> #include <sys/types.h> diff --git a/test/performance/odp_l2fwd.c b/test/performance/odp_l2fwd.c index 2ceee74..164f7f5 100644 --- a/test/performance/odp_l2fwd.c +++ b/test/performance/odp_l2fwd.c @@ -19,6 +19,7 @@ #include <getopt.h> #include <unistd.h> #include <errno.h> +#include <inttypes.h>
#include <test_debug.h>
diff --git a/test/performance/odp_pktio_perf.c b/test/performance/odp_pktio_perf.c index 98ec681..18a1aa2 100644 --- a/test/performance/odp_pktio_perf.c +++ b/test/performance/odp_pktio_perf.c @@ -31,6 +31,7 @@ #include <stdlib.h> #include <stdio.h> #include <string.h> +#include <inttypes.h> #include <test_debug.h>
#define PKT_BUF_NUM 8192 diff --git a/test/performance/odp_scheduling.c b/test/performance/odp_scheduling.c index c575b70..bd37f9b 100644 --- a/test/performance/odp_scheduling.c +++ b/test/performance/odp_scheduling.c @@ -12,6 +12,7 @@
#include <string.h> #include <stdlib.h> +#include <inttypes.h>
#include <test_debug.h>
diff --git a/test/platform/linux-generic/pktio_ipc/ipc_common.h b/test/platform/linux-generic/pktio_ipc/ipc_common.h index 7bc483f..a6b7c58 100644 --- a/test/platform/linux-generic/pktio_ipc/ipc_common.h +++ b/test/platform/linux-generic/pktio_ipc/ipc_common.h @@ -6,6 +6,7 @@
#define _POSIX_C_SOURCE 200809L #include <stdlib.h> +#include <inttypes.h> #include <string.h> #include <getopt.h> #include <unistd.h> diff --git a/test/validation/classification/odp_classification_testsuites.h b/test/validation/classification/odp_classification_testsuites.h index 023a267..aea3de1 100644 --- a/test/validation/classification/odp_classification_testsuites.h +++ b/test/validation/classification/odp_classification_testsuites.h @@ -9,6 +9,7 @@
#include <odp_api.h> #include <odp_cunit_common.h> +#include <stdbool.h>
extern odp_testinfo_t classification_suite[]; extern odp_testinfo_t classification_suite_basic[]; diff --git a/test/validation/common/mask_common.c b/test/validation/common/mask_common.c index 5001364..b31534c 100644 --- a/test/validation/common/mask_common.c +++ b/test/validation/common/mask_common.c @@ -9,6 +9,8 @@ #include "odp_cunit_common.h" #include "mask_common.h"
+#include <stdlib.h> + /* * The following strings are used to build masks with odp_*mask_from_str(). * Both 0x prefixed and non prefixed hex values are supported. diff --git a/test/validation/common/odp_cunit_common.h b/test/validation/common/odp_cunit_common.h index 52fe203..486a5ec 100644 --- a/test/validation/common/odp_cunit_common.h +++ b/test/validation/common/odp_cunit_common.h @@ -14,6 +14,7 @@ #define ODP_CUNICT_COMMON_H
#include <stdint.h> +#include <inttypes.h> #include "CUnit/Basic.h" #include "CUnit/TestDB.h" #include <odp_api.h>
commit c2784fbafbf8a29b6daa48429133e25b777536cf Author: Petri Savolainen petri.savolainen@nokia.com Date: Mon Jul 4 18:42:24 2016 +0300
linux-gen: byteorder: remove dependency to linux headers
Platform specific API files included endian.h and asm/byteorder.h. These are Linux headers and should not be visible to application through odp_api.h.
Used __ORDER_LITTLE_ENDIAN__, etc instead which are supported by both gcc and clang.
Signed-off-by: Petri Savolainen petri.savolainen@nokia.com Reviewed-and-tested-by: Bill Fischofer bill.fischofer@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/platform/linux-generic/include/odp/api/plat/byteorder_types.h b/platform/linux-generic/include/odp/api/plat/byteorder_types.h index 0a8e409..679d4cf 100644 --- a/platform/linux-generic/include/odp/api/plat/byteorder_types.h +++ b/platform/linux-generic/include/odp/api/plat/byteorder_types.h @@ -18,15 +18,15 @@ extern "C" { #endif
-#ifndef __BYTE_ORDER +#ifndef __BYTE_ORDER__ #error __BYTE_ORDER not defined! #endif
-#ifndef __BIG_ENDIAN +#ifndef __ORDER_BIG_ENDIAN__ #error __BIG_ENDIAN not defined! #endif
-#ifndef __LITTLE_ENDIAN +#ifndef __ORDER_LITTLE_ENDIAN__ #error __LITTLE_ENDIAN not defined! #endif
@@ -48,23 +48,16 @@ extern "C" { /** @addtogroup odp_compiler_optim * @{ */ - -#define ODP_BIG_ENDIAN __BIG_ENDIAN - -#define ODP_LITTLE_ENDIAN __LITTLE_ENDIAN - -#ifdef __BIG_ENDIAN_BITFIELD -#define ODP_BIG_ENDIAN_BITFIELD -#endif - -#ifdef __LITTLE_ENDIAN_BITFIELD -#define ODP_LITTLE_ENDIAN_BITFIELD -#endif - -#if __BYTE_ORDER == __LITTLE_ENDIAN -#define ODP_BYTE_ORDER ODP_LITTLE_ENDIAN -#elif __BYTE_ORDER == __BIG_ENDIAN -#define ODP_BYTE_ORDER ODP_BIG_ENDIAN +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ + #define ODP_LITTLE_ENDIAN 1 + #define ODP_BIG_ENDIAN 0 + #define ODP_BYTE_ORDER ODP_LITTLE_ENDIAN + #define ODP_LITTLE_ENDIAN_BITFIELD +#else + #define ODP_LITTLE_ENDIAN 0 + #define ODP_BIG_ENDIAN 1 + #define ODP_BYTE_ORDER ODP_BIG_ENDIAN + #define ODP_BIG_ENDIAN_BITFIELD #endif
typedef uint16_t __odp_bitwise odp_u16le_t; diff --git a/platform/linux-generic/include/odp/api/std_types.h b/platform/linux-generic/include/odp/api/std_types.h index 5737e43..d4eeb5d 100644 --- a/platform/linux-generic/include/odp/api/std_types.h +++ b/platform/linux-generic/include/odp/api/std_types.h @@ -17,8 +17,6 @@ extern "C" { #endif
-#include <endian.h> -#include <asm/byteorder.h> #include <stdlib.h> #include <stdint.h> #include <stddef.h>
commit 9f0f2b86309aa8021ec937e7c0ee1d6f48b0d769 Author: Petri Savolainen petri.savolainen@nokia.com Date: Mon Jul 4 18:42:23 2016 +0300
linux-gen: cpumask: remove dependency to sched.h
Platform specific API files included sched.h for accessing cpu_set_t. This is problematic since application may need to include it also and possibly with GNU extension (with #define _GNU_SOURCE). Application should be able to include odp_api.h in any order relative to other headers, and with or without any (e.g. GNU) extensions.
The odp_cpumask_t is defined with equal (or larger) size to Linux cpu_set_t and this is verified with build time asserts. Linux CPU_SET macros are used to access the mask as before.
Signed-off-by: Petri Savolainen petri.savolainen@nokia.com Reviewed-and-tested-by: Bill Fischofer bill.fischofer@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/platform/linux-generic/include/odp/api/cpumask.h b/platform/linux-generic/include/odp/api/cpumask.h index 15bf25e..325ea52 100644 --- a/platform/linux-generic/include/odp/api/cpumask.h +++ b/platform/linux-generic/include/odp/api/cpumask.h @@ -17,10 +17,6 @@ extern "C" { #endif
-#include <string.h> -#include <sched.h> - -#include <odp/api/std_types.h> #include <odp/api/plat/cpumask_types.h>
#include <odp/api/spec/cpumask.h> diff --git a/platform/linux-generic/include/odp/api/plat/cpumask_types.h b/platform/linux-generic/include/odp/api/plat/cpumask_types.h index c59f407..c2727a4 100644 --- a/platform/linux-generic/include/odp/api/plat/cpumask_types.h +++ b/platform/linux-generic/include/odp/api/plat/cpumask_types.h @@ -23,6 +23,7 @@ extern "C" { */
#include <odp/api/std_types.h> +#include <odp/api/align.h>
#define ODP_CPUMASK_SIZE 1024
@@ -34,8 +35,13 @@ extern "C" { * Don't access directly, use access functions. */ typedef struct odp_cpumask_t { - cpu_set_t set; /**< @private Mask*/ -} odp_cpumask_t; + /** @private CPU mask storage + * + * This is private to the implementation. + * Don't access directly, use access functions. + */ + uint8_t _u8[ODP_CPUMASK_SIZE / 8]; +} odp_cpumask_t ODP_ALIGNED(8);
/** * @} diff --git a/platform/linux-generic/include/odp/api/std_clib.h b/platform/linux-generic/include/odp/api/std_clib.h index 1578d09..40c0ea8 100644 --- a/platform/linux-generic/include/odp/api/std_clib.h +++ b/platform/linux-generic/include/odp/api/std_clib.h @@ -12,6 +12,7 @@ extern "C" { #endif
#include <odp/api/spec/std_types.h> +#include <string.h>
static inline void *odp_memcpy(void *dst, const void *src, size_t num) { diff --git a/platform/linux-generic/odp_cpumask.c b/platform/linux-generic/odp_cpumask.c index 3d35ade..6bf2632 100644 --- a/platform/linux-generic/odp_cpumask.c +++ b/platform/linux-generic/odp_cpumask.c @@ -20,9 +20,13 @@ #include <errno.h> #include <sys/types.h>
-/** @internal Compile time assert */ -ODP_STATIC_ASSERT(CPU_SETSIZE >= ODP_CPUMASK_SIZE, - "ODP_CPUMASK_SIZE__SIZE_ERROR"); +/* Check that mask can hold all system CPUs*/ +ODP_STATIC_ASSERT(ODP_CPUMASK_SIZE >= CPU_SETSIZE, + "ODP_CPUMASK_SIZE_TOO_SMALL"); + +/* Check that mask type is large enough */ +ODP_STATIC_ASSERT(sizeof(odp_cpumask_t) >= sizeof(cpu_set_t), + "ODP_CPUMASK_T_TOO_SMALL");
void odp_cpumask_from_str(odp_cpumask_t *mask, const char *str_in) { @@ -66,7 +70,7 @@ void odp_cpumask_from_str(odp_cpumask_t *mask, const char *str_in) }
/* Copy the computed mask */ - memcpy(&mask->set, &cpuset, sizeof(cpuset)); + memcpy(mask, &cpuset, sizeof(cpuset)); }
int32_t odp_cpumask_to_str(const odp_cpumask_t *mask, char *str, int32_t len) @@ -106,7 +110,7 @@ int32_t odp_cpumask_to_str(const odp_cpumask_t *mask, char *str, int32_t len) value = 0; do { /* Set bit to go into the current nibble */ - if (CPU_ISSET(cpu, &mask->set)) + if (CPU_ISSET(cpu, (const cpu_set_t *)mask)) value |= 1 << (cpu % 4);
/* If we are on a nibble boundary flush value to string */ @@ -126,12 +130,12 @@ int32_t odp_cpumask_to_str(const odp_cpumask_t *mask, char *str, int32_t len)
void odp_cpumask_zero(odp_cpumask_t *mask) { - CPU_ZERO(&mask->set); + CPU_ZERO((cpu_set_t *)mask); }
void odp_cpumask_set(odp_cpumask_t *mask, int cpu) { - CPU_SET(cpu, &mask->set); + CPU_SET(cpu, (cpu_set_t *)mask); }
void odp_cpumask_setall(odp_cpumask_t *mask) @@ -139,51 +143,54 @@ void odp_cpumask_setall(odp_cpumask_t *mask) int cpu;
for (cpu = 0; cpu < CPU_SETSIZE; cpu++) - CPU_SET(cpu, &mask->set); + CPU_SET(cpu, (cpu_set_t *)mask); }
void odp_cpumask_clr(odp_cpumask_t *mask, int cpu) { - CPU_CLR(cpu, &mask->set); + CPU_CLR(cpu, (cpu_set_t *)mask); }
int odp_cpumask_isset(const odp_cpumask_t *mask, int cpu) { - return CPU_ISSET(cpu, &mask->set); + return CPU_ISSET(cpu, (const cpu_set_t *)mask); }
int odp_cpumask_count(const odp_cpumask_t *mask) { - return CPU_COUNT(&mask->set); + return CPU_COUNT((const cpu_set_t *)mask); }
void odp_cpumask_and(odp_cpumask_t *dest, const odp_cpumask_t *src1, const odp_cpumask_t *src2) { - CPU_AND(&dest->set, &src1->set, &src2->set); + CPU_AND((cpu_set_t *)dest, (const cpu_set_t *)src1, + (const cpu_set_t *)src2); }
void odp_cpumask_or(odp_cpumask_t *dest, const odp_cpumask_t *src1, const odp_cpumask_t *src2) { - CPU_OR(&dest->set, &src1->set, &src2->set); + CPU_OR((cpu_set_t *)dest, (const cpu_set_t *)src1, + (const cpu_set_t *)src2); }
void odp_cpumask_xor(odp_cpumask_t *dest, const odp_cpumask_t *src1, const odp_cpumask_t *src2) { - CPU_XOR(&dest->set, &src1->set, &src2->set); + CPU_XOR((cpu_set_t *)dest, (const cpu_set_t *)src1, + (const cpu_set_t *)src2); }
int odp_cpumask_equal(const odp_cpumask_t *mask1, const odp_cpumask_t *mask2) { - return CPU_EQUAL(&mask1->set, &mask2->set); + return CPU_EQUAL((const cpu_set_t *)mask1, (const cpu_set_t *)mask2); }
void odp_cpumask_copy(odp_cpumask_t *dest, const odp_cpumask_t *src) { - memcpy(&dest->set, &src->set, sizeof(src->set)); + memcpy(dest, src, sizeof(odp_cpumask_t)); }
int odp_cpumask_first(const odp_cpumask_t *mask) diff --git a/platform/linux-generic/odp_init.c b/platform/linux-generic/odp_init.c index f58f410..f534759 100644 --- a/platform/linux-generic/odp_init.c +++ b/platform/linux-generic/odp_init.c @@ -9,6 +9,7 @@ #include <unistd.h> #include <odp_internal.h> #include <odp_schedule_if.h> +#include <string.h>
struct odp_global_data_s odp_global_data;
-----------------------------------------------------------------------
Summary of changes: example/Makefile.am | 2 +- example/classifier/odp_classifier.c | 1 + example/generator/odp_generator.c | 1 + {test/validation => example/hello}/.gitignore | 1 + example/hello/Makefile.am | 11 +++ example/hello/odp_hello.c | 107 +++++++++++++++++++++ example/ipsec/odp_ipsec.c | 1 + example/m4/configure.m4 | 3 +- example/packet/odp_pktio.c | 1 + example/switch/odp_switch.c | 2 + example/time/time_global_test.c | 1 + example/timer/odp_timer_simple.c | 1 + example/timer/odp_timer_test.c | 1 + helper/chksum.c | 2 + helper/linux.c | 1 + platform/linux-generic/include/odp/api/cpumask.h | 4 - .../include/odp/api/plat/byteorder_types.h | 33 +++---- .../include/odp/api/plat/cpumask_types.h | 10 +- platform/linux-generic/include/odp/api/std_clib.h | 1 + platform/linux-generic/include/odp/api/std_types.h | 10 +- .../linux-generic/include/odp_atomic_internal.h | 1 + .../linux-generic/include/odp_buffer_internal.h | 1 + platform/linux-generic/include/odp_packet_socket.h | 1 + platform/linux-generic/odp_buffer.c | 2 +- platform/linux-generic/odp_classification.c | 1 + platform/linux-generic/odp_cpumask.c | 39 +++++--- platform/linux-generic/odp_hash.c | 2 + platform/linux-generic/odp_init.c | 1 + platform/linux-generic/odp_packet.c | 1 + platform/linux-generic/odp_packet_io.c | 1 + platform/linux-generic/odp_pkt_queue.c | 1 + platform/linux-generic/odp_pool.c | 2 +- platform/linux-generic/odp_queue.c | 2 +- platform/linux-generic/odp_shared_memory.c | 1 + platform/linux-generic/odp_sorted_list.c | 1 + platform/linux-generic/odp_system_info.c | 1 + platform/linux-generic/odp_timer.c | 1 + platform/linux-generic/odp_timer_wheel.c | 1 + platform/linux-generic/odp_traffic_mngr.c | 2 + platform/linux-generic/pktio/loop.c | 2 + platform/linux-generic/pktio/netmap.c | 2 + platform/linux-generic/pktio/ring.c | 2 + platform/linux-generic/pktio/sysfs.c | 1 + platform/linux-generic/pktio/tap.c | 1 + test/performance/odp_l2fwd.c | 1 + test/performance/odp_pktio_perf.c | 1 + test/performance/odp_scheduling.c | 1 + test/platform/linux-generic/pktio_ipc/ipc_common.h | 1 + .../classification/odp_classification_testsuites.h | 1 + test/validation/common/mask_common.c | 2 + test/validation/common/odp_cunit_common.h | 1 + 51 files changed, 218 insertions(+), 54 deletions(-) copy {test/validation => example/hello}/.gitignore (54%) create mode 100644 example/hello/Makefile.am create mode 100644 example/hello/odp_hello.c
hooks/post-receive