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 03aafc317489232bab7e9048f9bd96a24e6f598d (commit) via 19a457a86880a6bc33afe891a6204752bde70088 (commit) via 7025b1b430237cddc10a0338c7b120d23b7985a8 (commit) via 0f18e317ede15081828deca1ff61d65b72e12926 (commit) from 3875d6ebf690e07b69f11621caefab1afc58e100 (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 03aafc317489232bab7e9048f9bd96a24e6f598d Author: Mike Holmes mike.holmes@linaro.org Date: Fri Jan 20 15:32:03 2017 -0500
helper: remove dependence on test dir
There is no reason that the helpers need to depend on the test directory so remove the offending links
Signed-off-by: Mike Holmes mike.holmes@linaro.org Reviewed-by: Christophe Milard christophe.milard@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/helper/test/Makefile.am b/helper/test/Makefile.am index 7d55ae6..1c50282 100644 --- a/helper/test/Makefile.am +++ b/helper/test/Makefile.am @@ -1,9 +1,25 @@ -include $(top_srcdir)/test/Makefile.inc +include $(top_srcdir)/platform/@with_platform@/Makefile.inc
-AM_CFLAGS += -I$(srcdir)/common -AM_LDFLAGS += -static +LIB = $(top_builddir)/lib + +#in the following line, the libs using the symbols should come before +#the libs containing them! The includer is given a chance to add things +#before libodp by setting PRE_LDADD before the inclusion. +LDADD = $(PRE_LDADD) $(LIB)/libodphelper-@with_helper_platform@.la $(LIB)/libodp-linux.la + +INCFLAGS = \ + -I$(top_builddir)/platform/@with_platform@/include \ + -I$(top_srcdir)/helper/include \ + -I$(top_srcdir)/helper/platform/@with_helper_platform@/include \ + -I$(top_srcdir)/include \ + -I$(top_srcdir)/platform/@with_platform@/include \ + -I$(top_builddir)/include \ + -I$(top_srcdir)/helper
-TESTS_ENVIRONMENT += TEST_DIR=${builddir} +ODP_PLATFORM=${with_platform} + +AM_CFLAGS += $(INCFLAGS) +AM_LDFLAGS += -static
EXECUTABLES = chksum$(EXEEXT) \ cuckootable$(EXEEXT) \ @@ -38,7 +54,6 @@ EXTRA_DIST = odpthreads_as_processes odpthreads_as_pthreads dist_chksum_SOURCES = chksum.c dist_cuckootable_SOURCES = cuckootable.c dist_odpthreads_SOURCES = odpthreads.c -odpthreads_LDADD = $(LIB)/libodphelper-@with_helper_platform@.la $(LIB)/libodp-linux.la dist_parse_SOURCES = parse.c dist_table_SOURCES = table.c dist_iplookuptable_SOURCES = iplookuptable.c diff --git a/helper/test/chksum.c b/helper/test/chksum.c index 749d495..7c572ae 100644 --- a/helper/test/chksum.c +++ b/helper/test/chksum.c @@ -4,7 +4,7 @@ * SPDX-License-Identifier: BSD-3-Clause */
-#include <test_debug.h> +#include "odph_debug.h" #include <odp_api.h> #include <odp/helper/eth.h> #include <odp/helper/ip.h> @@ -21,7 +21,7 @@ struct udata_struct { };
/* Create additional dataplane threads */ -int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) +int main(int argc ODPH_UNUSED, char *argv[] ODPH_UNUSED) { odp_instance_t instance; int status = 0; @@ -41,17 +41,17 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) odp_pool_capability_t capa;
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); }
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); }
if (odp_pool_capability(&capa) < 0) { - LOG_ERR("Error: ODP global init failed.\n"); + ODPH_ERR("Error: ODP global init failed.\n"); exit(EXIT_FAILURE); }
@@ -91,12 +91,12 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) eth->type = odp_cpu_to_be_16(ODPH_ETHTYPE_IPV4);
if (odph_ipv4_addr_parse(&dstip, "192.168.0.1")) { - LOG_ERR("Error: parse ip\n"); + ODPH_ERR("Error: parse ip\n"); return -1; }
if (odph_ipv4_addr_parse(&srcip, "192.168.0.2")) { - LOG_ERR("Error: parse ip\n"); + ODPH_ERR("Error: parse ip\n"); return -1; }
@@ -139,12 +139,12 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) return -1;
if (odp_term_local()) { - LOG_ERR("Error: ODP local term failed.\n"); + ODPH_ERR("Error: ODP local term failed.\n"); exit(EXIT_FAILURE); }
if (odp_term_global(instance)) { - LOG_ERR("Error: ODP global term failed.\n"); + ODPH_ERR("Error: ODP global term failed.\n"); exit(EXIT_FAILURE); }
diff --git a/helper/test/cuckootable.c b/helper/test/cuckootable.c index 5b4333b..6736f2b 100644 --- a/helper/test/cuckootable.c +++ b/helper/test/cuckootable.c @@ -48,7 +48,7 @@ #include <time.h>
#include <odp_api.h> -#include <test_debug.h> +#include <odph_debug.h> #include <../odph_cuckootable.h>
/******************************************************************************* @@ -534,7 +534,7 @@ test_cuckoo_hash_table(void) return 0; }
-int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) +int main(int argc ODPH_UNUSED, char *argv[] ODPH_UNUSED) { odp_instance_t instance; int ret = 0; diff --git a/helper/test/iplookuptable.c b/helper/test/iplookuptable.c index e1d2820..86aa1b3 100644 --- a/helper/test/iplookuptable.c +++ b/helper/test/iplookuptable.c @@ -11,7 +11,7 @@ #include <errno.h>
#include <odp_api.h> -#include <test_debug.h> +#include <odph_debug.h> #include <../odph_iplookuptable.h> #include <odp/helper/ip.h>
@@ -138,7 +138,7 @@ static int test_ip_lookup_table(void) return 0; }
-int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) +int main(int argc ODPH_UNUSED, char *argv[] ODPH_UNUSED) { odp_instance_t instance; int ret = 0; diff --git a/helper/test/linux-generic/process.c b/helper/test/linux-generic/process.c index f641128..f9bdc3e 100644 --- a/helper/test/linux-generic/process.c +++ b/helper/test/linux-generic/process.c @@ -4,13 +4,13 @@ * SPDX-License-Identifier: BSD-3-Clause */
-#include <test_debug.h> +#include <odph_debug.h> #include <odp_api.h> #include <odp/helper/platform/linux-generic/threads_extn.h>
#define NUMBER_WORKERS 16 /* 0 = max */
-static void *worker_fn(void *arg TEST_UNUSED) +static void *worker_fn(void *arg ODPH_UNUSED) { /* depend on the odp helper to call odp_init_local */ printf("Worker thread on CPU %d\n", odp_cpu_id()); @@ -19,7 +19,7 @@ static void *worker_fn(void *arg TEST_UNUSED) }
/* Create additional dataplane processes */ -int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) +int main(int argc ODPH_UNUSED, char *argv[] ODPH_UNUSED) { odp_cpumask_t cpu_mask; int num_workers; @@ -31,12 +31,12 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) odph_linux_thr_params_t thr_params;
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); }
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); }
@@ -71,7 +71,7 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) ret = odph_linux_process_fork_n(proc, &cpu_mask, &thr_params);
if (ret < 0) { - LOG_ERR("Fork workers failed %i\n", ret); + ODPH_ERR("Fork workers failed %i\n", ret); return -1; }
@@ -83,7 +83,7 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) odph_linux_process_wait_n(proc, num_workers);
if (odp_term_global(instance)) { - LOG_ERR("Error: ODP global term failed.\n"); + ODPH_ERR("Error: ODP global term failed.\n"); exit(EXIT_FAILURE); } } diff --git a/helper/test/linux-generic/thread.c b/helper/test/linux-generic/thread.c index f1ca1b7..919f00e 100644 --- a/helper/test/linux-generic/thread.c +++ b/helper/test/linux-generic/thread.c @@ -4,12 +4,12 @@ * SPDX-License-Identifier: BSD-3-Clause */
-#include <test_debug.h> +#include <odph_debug.h> #include <odp_api.h> #include <odp/helper/platform/linux-generic/threads_extn.h>
#define NUMBER_WORKERS 16 -static void *worker_fn(void *arg TEST_UNUSED) +static void *worker_fn(void *arg ODPH_UNUSED) { /* depend on the odp helper to call odp_init_local */
@@ -21,7 +21,7 @@ static void *worker_fn(void *arg TEST_UNUSED) }
/* Create additional dataplane threads */ -int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) +int main(int argc ODPH_UNUSED, char *argv[] ODPH_UNUSED) { odph_linux_pthread_t thread_tbl[NUMBER_WORKERS]; odp_cpumask_t cpu_mask; @@ -32,12 +32,12 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) odph_linux_thr_params_t thr_params;
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); }
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); }
@@ -74,12 +74,12 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) odph_linux_pthread_join(thread_tbl, num_workers);
if (odp_term_local()) { - LOG_ERR("Error: ODP local term failed.\n"); + ODPH_ERR("Error: ODP local term failed.\n"); exit(EXIT_FAILURE); }
if (odp_term_global(instance)) { - LOG_ERR("Error: ODP global term failed.\n"); + ODPH_ERR("Error: ODP global term failed.\n"); exit(EXIT_FAILURE); }
diff --git a/helper/test/odpthreads.c b/helper/test/odpthreads.c index 216bccd..4bb3c3b 100644 --- a/helper/test/odpthreads.c +++ b/helper/test/odpthreads.c @@ -13,7 +13,7 @@ #include <unistd.h> #include <stdlib.h>
-#include <test_debug.h> +#include <odph_debug.h> #include <odp_api.h> #include <odp/helper/threads.h>
@@ -25,7 +25,7 @@ static void main_exit(void); /* ODP application instance */ static odp_instance_t odp_instance;
-static int worker_fn(void *arg TEST_UNUSED) +static int worker_fn(void *arg ODPH_UNUSED) { int cpu; odp_cpumask_t workers; @@ -74,12 +74,12 @@ int main(int argc, char *argv[]) odph_parse_options(argc, argv, NULL, NULL);
if (odp_init_global(&odp_instance, NULL, NULL)) { - LOG_ERR("Error: ODP global init failed.\n"); + ODPH_ERR("Error: ODP global init failed.\n"); exit(EXIT_FAILURE); }
if (odp_init_local(odp_instance, ODP_THREAD_CONTROL)) { - LOG_ERR("Error: ODP local init failed.\n"); + ODPH_ERR("Error: ODP local init failed.\n"); exit(EXIT_FAILURE); }
@@ -89,13 +89,13 @@ int main(int argc, char *argv[]) odp_cpumask_zero(&cpu_mask); /* allocate the 1st available control cpu to main process */ if (odp_cpumask_default_control(&cpu_mask, 1) != 1) { - LOG_ERR("Allocate main process CPU core failed.\n"); + ODPH_ERR("Allocate main process CPU core failed.\n"); exit(EXIT_FAILURE); }
cpu = odp_cpumask_first(&cpu_mask); if (odph_odpthread_setaffinity(cpu) != 0) { - LOG_ERR("Set main process affinify to " + ODPH_ERR("Set main process affinify to " "cpu(%d) failed.\n", cpu); exit(EXIT_FAILURE); } @@ -103,7 +103,7 @@ int main(int argc, char *argv[]) /* read back affinity to verify */ affinity = odph_odpthread_getaffinity(); if ((affinity < 0) || (cpu != affinity)) { - LOG_ERR("Verify main process affinity failed: " + ODPH_ERR("Verify main process affinity failed: " "set(%d) read(%d).\n", cpu, affinity); exit(EXIT_FAILURE); } @@ -152,12 +152,12 @@ int main(int argc, char *argv[]) static void main_exit(void) { if (odp_term_local()) { - LOG_ERR("Error: ODP local term failed.\n"); + ODPH_ERR("Error: ODP local term failed.\n"); _exit(EXIT_FAILURE); }
if (odp_term_global(odp_instance)) { - LOG_ERR("Error: ODP global term failed.\n"); + ODPH_ERR("Error: ODP global term failed.\n"); _exit(EXIT_FAILURE); } } diff --git a/helper/test/parse.c b/helper/test/parse.c index b5a4ab4..26dfc68 100644 --- a/helper/test/parse.c +++ b/helper/test/parse.c @@ -4,7 +4,7 @@ * SPDX-License-Identifier: BSD-3-Clause */
-#include <test_debug.h> +#include <odph_debug.h>
#include <odp_api.h> #include <odp/helper/eth.h> @@ -42,37 +42,37 @@ static int test_mac(void)
/* String must not start with other chars */ if (!odph_eth_addr_parse(&mac, "foo 01:02:03:04:05:06")) { - LOG_ERR("Accepted bad string\n"); + ODPH_ERR("Accepted bad string\n"); return -1; }
/* Missing digit */ if (!odph_eth_addr_parse(&mac, "01:02:03:04:05:")) { - LOG_ERR("Accepted bad string\n"); + ODPH_ERR("Accepted bad string\n"); return -1; }
/* Missing colon */ if (!odph_eth_addr_parse(&mac, "01:02:03:04:05 06")) { - LOG_ERR("Accepted bad string\n"); + ODPH_ERR("Accepted bad string\n"); return -1; }
/* Too large value */ if (!odph_eth_addr_parse(&mac, "01:02:03:04:05:1ff")) { - LOG_ERR("Accepted bad string\n"); + ODPH_ERR("Accepted bad string\n"); return -1; }
/* Negative value */ if (!odph_eth_addr_parse(&mac, "-1:02:03:04:05:06")) { - LOG_ERR("Accepted bad string\n"); + ODPH_ERR("Accepted bad string\n"); return -1; }
/* Failed function call must not store address */ if (different_mac(&mac, &ref)) { - LOG_ERR("Modified address when failed\n"); + ODPH_ERR("Modified address when failed\n"); return -1; }
@@ -86,36 +86,36 @@ static int test_mac(void) /* Zero pre-fixed */ memset(&mac, 0, sizeof(odph_ethaddr_t)); if (odph_eth_addr_parse(&mac, "01:02:03:04:05:06")) { - LOG_ERR("Parse call failed\n"); + ODPH_ERR("Parse call failed\n"); return -1; }
if (different_mac(&mac, &ref)) { - LOG_ERR("Bad parse result\n"); + ODPH_ERR("Bad parse result\n"); return -1; }
/* Not zero pre-fixed */ memset(&mac, 0, sizeof(odph_ethaddr_t)); if (odph_eth_addr_parse(&mac, "1:2:3:4:5:6")) { - LOG_ERR("Parse call failed\n"); + ODPH_ERR("Parse call failed\n"); return -1; }
if (different_mac(&mac, &ref)) { - LOG_ERR("Bad parse result\n"); + ODPH_ERR("Bad parse result\n"); return -1; }
/* String may continue with other chars */ memset(&mac, 0, sizeof(odph_ethaddr_t)); if (odph_eth_addr_parse(&mac, "01:02:03:04:05:06 foobar")) { - LOG_ERR("Parse call failed\n"); + ODPH_ERR("Parse call failed\n"); return -1; }
if (different_mac(&mac, &ref)) { - LOG_ERR("Bad parse result\n"); + ODPH_ERR("Bad parse result\n"); return -1; }
@@ -129,24 +129,24 @@ static int test_mac(void) /* Zero pre-fixed */ memset(&mac, 0, sizeof(odph_ethaddr_t)); if (odph_eth_addr_parse(&mac, "0a:0b:0c:0d:0e:0f")) { - LOG_ERR("Parse call failed\n"); + ODPH_ERR("Parse call failed\n"); return -1; }
if (different_mac(&mac, &ref)) { - LOG_ERR("Bad parse result\n"); + ODPH_ERR("Bad parse result\n"); return -1; }
/* Not zero pre-fixed */ memset(&mac, 0, sizeof(odph_ethaddr_t)); if (odph_eth_addr_parse(&mac, "a:b:c:d:e:f")) { - LOG_ERR("Parse call failed\n"); + ODPH_ERR("Parse call failed\n"); return -1; }
if (different_mac(&mac, &ref)) { - LOG_ERR("Bad parse result\n"); + ODPH_ERR("Bad parse result\n"); return -1; }
@@ -160,12 +160,12 @@ static int test_mac(void) /* Dual digits */ memset(&mac, 0, sizeof(odph_ethaddr_t)); if (odph_eth_addr_parse(&mac, "1a:2b:3c:4d:5e:6f")) { - LOG_ERR("Parse call failed\n"); + ODPH_ERR("Parse call failed\n"); return -1; }
if (different_mac(&mac, &ref)) { - LOG_ERR("Bad parse result\n"); + ODPH_ERR("Bad parse result\n"); return -1; }
@@ -174,12 +174,12 @@ static int test_mac(void) /* All zeros */ memset(&mac, 0, sizeof(odph_ethaddr_t)); if (odph_eth_addr_parse(&mac, "00:00:00:00:00:00")) { - LOG_ERR("Parse call failed\n"); + ODPH_ERR("Parse call failed\n"); return -1; }
if (different_mac(&mac, &ref)) { - LOG_ERR("Bad parse result\n"); + ODPH_ERR("Bad parse result\n"); return -1; }
@@ -188,12 +188,12 @@ static int test_mac(void) /* All ones */ memset(&mac, 0, sizeof(odph_ethaddr_t)); if (odph_eth_addr_parse(&mac, "ff:ff:ff:ff:ff:ff")) { - LOG_ERR("Parse call failed\n"); + ODPH_ERR("Parse call failed\n"); return -1; }
if (different_mac(&mac, &ref)) { - LOG_ERR("Bad parse result\n"); + ODPH_ERR("Bad parse result\n"); return -1; }
@@ -215,37 +215,37 @@ static int test_ipv4(void)
/* String must not start with other chars */ if (!odph_ipv4_addr_parse(&ip_addr, "foo 1.2.3.4")) { - LOG_ERR("Accepted bad string\n"); + ODPH_ERR("Accepted bad string\n"); return -1; }
/* Missing digit */ if (!odph_ipv4_addr_parse(&ip_addr, "1.2.3.")) { - LOG_ERR("Accepted bad string\n"); + ODPH_ERR("Accepted bad string\n"); return -1; }
/* Missing dot */ if (!odph_ipv4_addr_parse(&ip_addr, "1.2.3 4")) { - LOG_ERR("Accepted bad string\n"); + ODPH_ERR("Accepted bad string\n"); return -1; }
/* Too large value */ if (!odph_ipv4_addr_parse(&ip_addr, "1.2.3.256")) { - LOG_ERR("Accepted bad string\n"); + ODPH_ERR("Accepted bad string\n"); return -1; }
/* Negative value */ if (!odph_ipv4_addr_parse(&ip_addr, "-1.2.3.4")) { - LOG_ERR("Accepted bad string\n"); + ODPH_ERR("Accepted bad string\n"); return -1; }
/* Failed function call must not store address */ if (different_ipv4(&ip_addr, &ref)) { - LOG_ERR("Modified address when failed\n"); + ODPH_ERR("Modified address when failed\n"); return -1; }
@@ -254,36 +254,36 @@ static int test_ipv4(void) /* Zero pre-fixed */ ip_addr = 0; if (odph_ipv4_addr_parse(&ip_addr, "001.002.003.004")) { - LOG_ERR("Parse call failed\n"); + ODPH_ERR("Parse call failed\n"); return -1; }
if (different_ipv4(&ip_addr, &ref)) { - LOG_ERR("Bad parse result\n"); + ODPH_ERR("Bad parse result\n"); return -1; }
/* Not zero pre-fixed */ ip_addr = 0; if (odph_ipv4_addr_parse(&ip_addr, "1.2.3.4")) { - LOG_ERR("Parse call failed\n"); + ODPH_ERR("Parse call failed\n"); return -1; }
if (different_ipv4(&ip_addr, &ref)) { - LOG_ERR("Bad parse result\n"); + ODPH_ERR("Bad parse result\n"); return -1; }
/* String may continue with other chars */ ip_addr = 0; if (odph_ipv4_addr_parse(&ip_addr, "1.2.3.4 foobar")) { - LOG_ERR("Parse call failed\n"); + ODPH_ERR("Parse call failed\n"); return -1; }
if (different_ipv4(&ip_addr, &ref)) { - LOG_ERR("Bad parse result\n"); + ODPH_ERR("Bad parse result\n"); return -1; }
@@ -292,12 +292,12 @@ static int test_ipv4(void) /* Dual digits */ ip_addr = 0; if (odph_ipv4_addr_parse(&ip_addr, "26.43.60.77")) { - LOG_ERR("Parse call failed\n"); + ODPH_ERR("Parse call failed\n"); return -1; }
if (different_ipv4(&ip_addr, &ref)) { - LOG_ERR("Bad parse result\n"); + ODPH_ERR("Bad parse result\n"); return -1; }
@@ -306,12 +306,12 @@ static int test_ipv4(void) /* Triple digits */ ip_addr = 0; if (odph_ipv4_addr_parse(&ip_addr, "161.178.195.212")) { - LOG_ERR("Parse call failed\n"); + ODPH_ERR("Parse call failed\n"); return -1; }
if (different_ipv4(&ip_addr, &ref)) { - LOG_ERR("Bad parse result\n"); + ODPH_ERR("Bad parse result\n"); return -1; }
@@ -320,12 +320,12 @@ static int test_ipv4(void) /* All zeros */ ip_addr = 0; if (odph_ipv4_addr_parse(&ip_addr, "0.0.0.0")) { - LOG_ERR("Parse call failed\n"); + ODPH_ERR("Parse call failed\n"); return -1; }
if (different_ipv4(&ip_addr, &ref)) { - LOG_ERR("Bad parse result\n"); + ODPH_ERR("Bad parse result\n"); return -1; }
@@ -334,12 +334,12 @@ static int test_ipv4(void) /* All ones */ ip_addr = 0; if (odph_ipv4_addr_parse(&ip_addr, "255.255.255.255")) { - LOG_ERR("Parse call failed\n"); + ODPH_ERR("Parse call failed\n"); return -1; }
if (different_ipv4(&ip_addr, &ref)) { - LOG_ERR("Bad parse result\n"); + ODPH_ERR("Bad parse result\n"); return -1; }
diff --git a/helper/test/table.c b/helper/test/table.c index abb5b3b..3b74b22 100644 --- a/helper/test/table.c +++ b/helper/test/table.c @@ -4,7 +4,7 @@ * SPDX-License-Identifier:BSD-3-Clause */
-#include <test_debug.h> +#include <odph_debug.h> #include <../odph_hashtable.h> #include <../odph_lineartable.h> #include <odp_api.h> @@ -25,7 +25,7 @@ * value (data): MAC address of the next hop station (6 bytes). */
-int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) +int main(int argc ODPH_UNUSED, char *argv[] ODPH_UNUSED) { odp_instance_t instance; int ret = 0; @@ -43,12 +43,12 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED)
ret = odp_init_global(&instance, NULL, NULL); if (ret != 0) { - LOG_ERR("odp_shm_init_global fail\n"); + ODPH_ERR("odp_shm_init_global fail\n"); exit(EXIT_FAILURE); } ret = odp_init_local(instance, ODP_THREAD_WORKER); if (ret != 0) { - LOG_ERR("odp_shm_init_local fail\n"); + ODPH_ERR("odp_shm_init_local fail\n"); exit(EXIT_FAILURE); }
@@ -121,12 +121,12 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED) printf("all test finished success!!\n");
if (odp_term_local()) { - LOG_ERR("Error: ODP local term failed.\n"); + ODPH_ERR("Error: ODP local term failed.\n"); exit(EXIT_FAILURE); }
if (odp_term_global(instance)) { - LOG_ERR("Error: ODP global term failed.\n"); + ODPH_ERR("Error: ODP global term failed.\n"); exit(EXIT_FAILURE); }
commit 19a457a86880a6bc33afe891a6204752bde70088 Author: Mike Holmes mike.holmes@linaro.org Date: Fri Jan 20 15:32:02 2017 -0500
helper: move thread implementation under platform
Only the portable api is built by default, use --enable-helper-extn to enable non portable APIs for a helper platform
Signed-off-by: Mike Holmes mike.holmes@linaro.org Reviewed-by: Christophe Milard christophe.milard@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/configure.ac b/configure.ac index 1384130..2cf6536 100644 --- a/configure.ac +++ b/configure.ac @@ -138,6 +138,18 @@ AC_SUBST([with_platform]) AC_SUBST([platform_with_platform], ["platform/${with_platform}"])
########################################################################## +# Determine which helper platform to build for +########################################################################## +AC_ARG_WITH([helper_platform], + [AS_HELP_STRING([--with-helper_platform=platform], + [select helper platform to be used, default linux-generic])], + [], + [with_helper_platform=${with_platform} + ]) + +AC_SUBST([with_helper_platform]) + +########################################################################## # Run platform specific checks and settings ########################################################################## IMPLEMENTATION_NAME="" @@ -202,6 +214,7 @@ AM_CONDITIONAL([test_example], [test x$test_example = xyes ]) AM_CONDITIONAL([HAVE_DOXYGEN], [test "x${DOXYGEN}" = "xdoxygen"]) AM_CONDITIONAL([user_guide], [test "x${user_guides}" = "xyes" ]) AM_CONDITIONAL([HAVE_MSCGEN], [test "x${MSCGEN}" = "xmscgen"]) +AM_CONDITIONAL([helper_extn], [test x$helper_extn = xyes ])
########################################################################## # Setup doxygen documentation @@ -295,7 +308,7 @@ AM_CXXFLAGS="-std=c++11"
AC_CONFIG_FILES([Makefile pkgconfig/libodp-linux.pc - pkgconfig/libodphelper-linux.pc + pkgconfig/libodphelper-linux-generic.pc ])
AC_SEARCH_LIBS([timer_create],[rt posix4]) @@ -322,6 +335,8 @@ AC_MSG_RESULT([ implementation_name: ${IMPLEMENTATION_NAME} ARCH_DIR ${ARCH_DIR} with_platform: ${with_platform} + with_helper_platform: ${with_helper_platform} + helper_extn: ${helper_extn} prefix: ${prefix} sysconfdir: ${sysconfdir} libdir: ${libdir} diff --git a/example/Makefile.inc b/example/Makefile.inc index 19d3994..ea596d5 100644 --- a/example/Makefile.inc +++ b/example/Makefile.inc @@ -1,6 +1,6 @@ include $(top_srcdir)/platform/@with_platform@/Makefile.inc LIB = $(top_builddir)/lib -LDADD = $(LIB)/libodp-linux.la $(LIB)/libodphelper-linux.la +LDADD = $(LIB)/libodp-linux.la $(LIB)/libodphelper-@with_helper_platform@.la AM_CFLAGS += \ -I$(srcdir) \ -I$(top_srcdir)/example \ diff --git a/helper/Makefile.am b/helper/Makefile.am index 62e55cc..9b2f18a 100644 --- a/helper/Makefile.am +++ b/helper/Makefile.am @@ -1,7 +1,7 @@ include $(top_srcdir)/platform/@with_platform@/Makefile.inc
pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = $(top_builddir)/pkgconfig/libodphelper-linux.pc +pkgconfig_DATA = $(top_builddir)/pkgconfig/libodphelper-linux-generic.pc
LIB = $(top_builddir)/lib AM_CFLAGS = -I$(srcdir)/include @@ -25,6 +25,11 @@ helperinclude_HEADERS = \ $(srcdir)/include/odp/helper/threads.h \ $(srcdir)/include/odp/helper/udp.h
+if helper_extn +helperinclude_HEADERS += \ + $(srcdir)/include/odp/helper/platform/@with_helper_platform@/threads_extn.h +endif + noinst_HEADERS = \ $(srcdir)/odph_debug.h \ $(srcdir)/odph_hashtable.h \ @@ -33,7 +38,7 @@ noinst_HEADERS = \ $(srcdir)/odph_list_internal.h \ $(srcdir)/odph_iplookuptable.h
-__LIB__libodphelper_linux_la_SOURCES = \ +__LIB__libodphelper_@with_platform@_la_SOURCES = \ eth.c \ ip.c \ chksum.c \ @@ -43,4 +48,9 @@ __LIB__libodphelper_linux_la_SOURCES = \ iplookuptable.c \ threads.c
-lib_LTLIBRARIES = $(LIB)/libodphelper-linux.la +if helper_extn +__LIB__libodphelper_@with_platform@_la_SOURCES += \ + platform/@with_helper_platform@/thread.c +endif + +lib_LTLIBRARIES = $(LIB)/libodphelper-@with_platform@.la diff --git a/helper/include/odp/helper/platform/linux-generic/threads_extn.h b/helper/include/odp/helper/platform/linux-generic/threads_extn.h new file mode 100644 index 0000000..1d4036d --- /dev/null +++ b/helper/include/odp/helper/platform/linux-generic/threads_extn.h @@ -0,0 +1,112 @@ +/* Copyright (c) 2016, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +/** + * @file + * + * ODP Linux helper extension API + * + * This file is an optional helper to odp.h APIs. These functions are provided + * to ease common setups in a Linux system. User is free to implement the same + * setups in otherways (not via this API). + */ + +#ifndef ODPH_LINUX_EXT_H_ +#define ODPH_LINUX_EXT_H_ + +#include <odp/helper/threads.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/** @addtogroup odph_linux ODPH LINUX + * @{ + */ + +/** + * Creates and launches pthreads + * + * Creates, pins and launches threads to separate CPU's based on the cpumask. + * + * @param[out] pthread_tbl Table of pthread state information records. Table + * must have at least as many entries as there are + * CPUs in the CPU mask. + * @param mask CPU mask + * @param thr_params Linux helper thread parameters + * + * @return Number of threads created + */ +int odph_linux_pthread_create(odph_linux_pthread_t *pthread_tbl, + const odp_cpumask_t *mask, + const odph_linux_thr_params_t *thr_params); + +/** + * Waits pthreads to exit + * + * Returns when all threads have been exit. + * + * @param thread_tbl Thread table + * @param num Number of threads to create + * + */ +void odph_linux_pthread_join(odph_linux_pthread_t *thread_tbl, int num); + +/** + * Fork a process + * + * Forks and sets CPU affinity for the child process. Ignores 'start' and 'arg' + * thread parameters. + * + * @param[out] proc Pointer to process state info (for output) + * @param cpu Destination CPU for the child process + * @param thr_params Linux helper thread parameters + * + * @return On success: 1 for the parent, 0 for the child + * On failure: -1 for the parent, -2 for the child + */ +int odph_linux_process_fork(odph_linux_process_t *proc, int cpu, + const odph_linux_thr_params_t *thr_params); + +/** + * Fork a number of processes + * + * Forks and sets CPU affinity for child processes. Ignores 'start' and 'arg' + * thread parameters. + * + * @param[out] proc_tbl Process state info table (for output) + * @param mask CPU mask of processes to create + * @param thr_params Linux helper thread parameters + * + * @return On success: 1 for the parent, 0 for the child + * On failure: -1 for the parent, -2 for the child + */ +int odph_linux_process_fork_n(odph_linux_process_t *proc_tbl, + const odp_cpumask_t *mask, + const odph_linux_thr_params_t *thr_params); + +/** + * Wait for a number of processes + * + * Waits for a number of child processes to terminate. Records process state + * change status into the process state info structure. + * + * @param proc_tbl Process state info table (previously filled by fork) + * @param num Number of processes to wait + * + * @return 0 on success, -1 on failure + */ +int odph_linux_process_wait_n(odph_linux_process_t *proc_tbl, int num); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/helper/include/odp/helper/threads.h b/helper/include/odp/helper/threads.h index b8d975a..5682bab 100644 --- a/helper/include/odp/helper/threads.h +++ b/helper/include/odp/helper/threads.h @@ -93,82 +93,6 @@ typedef struct { } odph_odpthread_t;
/** - * Creates and launches pthreads - * - * Creates, pins and launches threads to separate CPU's based on the cpumask. - * - * @param[out] pthread_tbl Table of pthread state information records. Table - * must have at least as many entries as there are - * CPUs in the CPU mask. - * @param mask CPU mask - * @param thr_params Linux helper thread parameters - * - * @return Number of threads created - */ -int odph_linux_pthread_create(odph_linux_pthread_t *pthread_tbl, - const odp_cpumask_t *mask, - const odph_linux_thr_params_t *thr_params); - -/** - * Waits pthreads to exit - * - * Returns when all threads have been exit. - * - * @param thread_tbl Thread table - * @param num Number of threads to create - * - */ -void odph_linux_pthread_join(odph_linux_pthread_t *thread_tbl, int num); - -/** - * Fork a process - * - * Forks and sets CPU affinity for the child process. Ignores 'start' and 'arg' - * thread parameters. - * - * @param[out] proc Pointer to process state info (for output) - * @param cpu Destination CPU for the child process - * @param thr_params Linux helper thread parameters - * - * @return On success: 1 for the parent, 0 for the child - * On failure: -1 for the parent, -2 for the child - */ -int odph_linux_process_fork(odph_linux_process_t *proc, int cpu, - const odph_linux_thr_params_t *thr_params); - - -/** - * Fork a number of processes - * - * Forks and sets CPU affinity for child processes. Ignores 'start' and 'arg' - * thread parameters. - * - * @param[out] proc_tbl Process state info table (for output) - * @param mask CPU mask of processes to create - * @param thr_params Linux helper thread parameters - * - * @return On success: 1 for the parent, 0 for the child - * On failure: -1 for the parent, -2 for the child - */ -int odph_linux_process_fork_n(odph_linux_process_t *proc_tbl, - const odp_cpumask_t *mask, - const odph_linux_thr_params_t *thr_params); - - -/** - * Wait for a number of processes - * - * Waits for a number of child processes to terminate. Records process state - * change status into the process state info structure. - * - * @param proc_tbl Process state info table (previously filled by fork) - * @param num Number of processes to wait - * - * @return 0 on success, -1 on failure - */ -int odph_linux_process_wait_n(odph_linux_process_t *proc_tbl, int num); - -/** * Creates and launches odpthreads (as linux threads or processes) * * Creates, pins and launches threads to separate CPU's based on the cpumask. diff --git a/helper/m4/configure.m4 b/helper/m4/configure.m4 index 7b208fa..38c95d9 100644 --- a/helper/m4/configure.m4 +++ b/helper/m4/configure.m4 @@ -8,5 +8,16 @@ AC_ARG_ENABLE([test-helper], test_helper=yes fi])
+########################################################################## +# Enable/disable helper-ext +# platform specific non portable extensions +########################################################################## +helper_extn=no +AC_ARG_ENABLE([helper-extn], + [ --enable-helper-extn build helper platform extensions (not portable)], + [if test "x$enableval" = "xyes"; then + helper_extn=yes + fi]) + AC_CONFIG_FILES([helper/Makefile helper/test/Makefile]) diff --git a/helper/platform/linux-generic/thread.c b/helper/platform/linux-generic/thread.c new file mode 100644 index 0000000..90fa42a --- /dev/null +++ b/helper/platform/linux-generic/thread.c @@ -0,0 +1,313 @@ +/* Copyright (c) 2016, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif +#include <sched.h> +#include <unistd.h> +#include <sys/types.h> +#include <sys/wait.h> +#include <sys/prctl.h> +#include <sys/syscall.h> + +#include <stdlib.h> +#include <string.h> +#include <stdio.h> +#include <stdbool.h> + +#include <odp_api.h> +#include <odp/helper/platform/linux-generic/threads_extn.h> +#include "odph_debug.h" + +static void *_odph_run_start_routine(void *arg) +{ + odph_linux_thr_params_t *thr_params = arg; + + /* ODP thread local init */ + if (odp_init_local(thr_params->instance, thr_params->thr_type)) { + ODPH_ERR("Local init failed\n"); + return NULL; + } + + void *ret_ptr = thr_params->start(thr_params->arg); + int ret = odp_term_local(); + + if (ret < 0) + ODPH_ERR("Local term failed\n"); + + return ret_ptr; +} + +static void *_odph_thread_run_start_routine(void *arg) +{ + int status; + int ret; + odph_odpthread_params_t *thr_params; + + odph_odpthread_start_args_t *start_args = arg; + + thr_params = &start_args->thr_params; + + /* ODP thread local init */ + if (odp_init_local(thr_params->instance, thr_params->thr_type)) { + ODPH_ERR("Local init failed\n"); + if (start_args->linuxtype == ODPTHREAD_PROCESS) + _exit(EXIT_FAILURE); + return (void *)-1; + } + + ODPH_DBG("helper: ODP %s thread started as linux %s. (pid=%d)\n", + thr_params->thr_type == ODP_THREAD_WORKER ? + "worker" : "control", + (start_args->linuxtype == ODPTHREAD_PTHREAD) ? + "pthread" : "process", + (int)getpid()); + + status = thr_params->start(thr_params->arg); + ret = odp_term_local(); + + if (ret < 0) + ODPH_ERR("Local term failed\n"); + + /* for process implementation of odp threads, just return status... */ + if (start_args->linuxtype == ODPTHREAD_PROCESS) + _exit(status); + + /* threads implementation return void* pointers: cast status to that. */ + return (void *)(intptr_t)status; +} + +int odph_linux_pthread_create(odph_linux_pthread_t *pthread_tbl, + const odp_cpumask_t *mask, + const odph_linux_thr_params_t *thr_params) +{ + int i; + int num; + int cpu_count; + int cpu; + int ret; + + num = odp_cpumask_count(mask); + + memset(pthread_tbl, 0, num * sizeof(odph_linux_pthread_t)); + + cpu_count = odp_cpu_count(); + + if (num < 1 || num > cpu_count) { + ODPH_ERR("Invalid number of threads:%d (%d cores available)\n", + num, cpu_count); + return 0; + } + + cpu = odp_cpumask_first(mask); + for (i = 0; i < num; i++) { + cpu_set_t cpu_set; + + CPU_ZERO(&cpu_set); + CPU_SET(cpu, &cpu_set); + + pthread_attr_init(&pthread_tbl[i].attr); + + pthread_tbl[i].cpu = cpu; + + pthread_attr_setaffinity_np(&pthread_tbl[i].attr, + sizeof(cpu_set_t), &cpu_set); + + pthread_tbl[i].thr_params.start = thr_params->start; + pthread_tbl[i].thr_params.arg = thr_params->arg; + pthread_tbl[i].thr_params.thr_type = thr_params->thr_type; + pthread_tbl[i].thr_params.instance = thr_params->instance; + + ret = pthread_create(&pthread_tbl[i].thread, + &pthread_tbl[i].attr, + _odph_run_start_routine, + &pthread_tbl[i].thr_params); + if (ret != 0) { + ODPH_ERR("Failed to start thread on cpu #%d\n", cpu); + break; + } + + cpu = odp_cpumask_next(mask, cpu); + } + + return i; +} + +void odph_linux_pthread_join(odph_linux_pthread_t *thread_tbl, int num) +{ + int i; + int ret; + + for (i = 0; i < num; i++) { + /* Wait thread to exit */ + ret = pthread_join(thread_tbl[i].thread, NULL); + if (ret != 0) { + ODPH_ERR("Failed to join thread from cpu #%d\n", + thread_tbl[i].cpu); + } + pthread_attr_destroy(&thread_tbl[i].attr); + } +} + +int odph_linux_process_fork_n(odph_linux_process_t *proc_tbl, + const odp_cpumask_t *mask, + const odph_linux_thr_params_t *thr_params) +{ + pid_t pid; + int num; + int cpu_count; + int cpu; + int i; + + num = odp_cpumask_count(mask); + + memset(proc_tbl, 0, num * sizeof(odph_linux_process_t)); + + cpu_count = odp_cpu_count(); + + if (num < 1 || num > cpu_count) { + ODPH_ERR("Bad num\n"); + return -1; + } + + cpu = odp_cpumask_first(mask); + for (i = 0; i < num; i++) { + cpu_set_t cpu_set; + + CPU_ZERO(&cpu_set); + CPU_SET(cpu, &cpu_set); + + pid = fork(); + + if (pid < 0) { + ODPH_ERR("fork() failed\n"); + return -1; + } + + /* Parent continues to fork */ + if (pid > 0) { + proc_tbl[i].pid = pid; + proc_tbl[i].cpu = cpu; + + cpu = odp_cpumask_next(mask, cpu); + continue; + } + + /* Child process */ + + /* Request SIGTERM if parent dies */ + prctl(PR_SET_PDEATHSIG, SIGTERM); + /* Parent died already? */ + if (getppid() == 1) + kill(getpid(), SIGTERM); + + if (sched_setaffinity(0, sizeof(cpu_set_t), &cpu_set)) { + ODPH_ERR("sched_setaffinity() failed\n"); + return -2; + } + + if (odp_init_local(thr_params->instance, + thr_params->thr_type)) { + ODPH_ERR("Local init failed\n"); + return -2; + } + + return 0; + } + + return 1; +} + +int odph_linux_process_fork(odph_linux_process_t *proc, int cpu, + const odph_linux_thr_params_t *thr_params) +{ + odp_cpumask_t mask; + + odp_cpumask_zero(&mask); + odp_cpumask_set(&mask, cpu); + return odph_linux_process_fork_n(proc, &mask, thr_params); +} + +int odph_linux_process_wait_n(odph_linux_process_t *proc_tbl, int num) +{ + pid_t pid; + int i, j; + int status = 0; + + for (i = 0; i < num; i++) { + pid = wait(&status); + + if (pid < 0) { + ODPH_ERR("wait() failed\n"); + return -1; + } + + for (j = 0; j < num; j++) { + if (proc_tbl[j].pid == pid) { + proc_tbl[j].status = status; + break; + } + } + + if (j == num) { + ODPH_ERR("Bad pid:%d\n", (int)pid); + return -1; + } + + /* Examine the child process' termination status */ + if (WIFEXITED(status) && WEXITSTATUS(status) != EXIT_SUCCESS) { + ODPH_ERR("Child exit status:%d (pid:%d)\n", + WEXITSTATUS(status), (int)pid); + return -1; + } + if (WIFSIGNALED(status)) { + int signo = WTERMSIG(status); + + ODPH_ERR("Child term signo:%d - %s (pid:%d)\n", + signo, strsignal(signo), (int)pid); + return -1; + } + } + + return 0; +} + +/* + * Create a single ODPthread as a linux thread + */ +static int odph_linux_thread_create(odph_odpthread_t *thread_tbl, + int cpu, + const odph_odpthread_params_t *thr_params) +{ + int ret; + cpu_set_t cpu_set; + + CPU_ZERO(&cpu_set); + CPU_SET(cpu, &cpu_set); + + pthread_attr_init(&thread_tbl->thread.attr); + + thread_tbl->cpu = cpu; + + pthread_attr_setaffinity_np(&thread_tbl->thread.attr, + sizeof(cpu_set_t), &cpu_set); + + thread_tbl->start_args.thr_params = *thr_params; /* copy */ + thread_tbl->start_args.linuxtype = ODPTHREAD_PTHREAD; + + ret = pthread_create(&thread_tbl->thread.thread_id, + &thread_tbl->thread.attr, + _odph_thread_run_start_routine, + &thread_tbl->start_args); + if (ret != 0) { + ODPH_ERR("Failed to start thread on cpu #%d\n", cpu); + thread_tbl->start_args.linuxtype = ODPTHREAD_NOT_STARTED; + return ret; + } + + return 0; +} diff --git a/helper/test/Makefile.am b/helper/test/Makefile.am index 2bf6765..7d55ae6 100644 --- a/helper/test/Makefile.am +++ b/helper/test/Makefile.am @@ -7,12 +7,19 @@ TESTS_ENVIRONMENT += TEST_DIR=${builddir}
EXECUTABLES = chksum$(EXEEXT) \ cuckootable$(EXEEXT) \ - table$(EXEEXT) \ - thread$(EXEEXT) \ parse$(EXEEXT)\ - process$(EXEEXT) \ + table$(EXEEXT) \ iplookuptable$(EXEEXT)
+#These are platform specific extensions that are not portable +#They are a convenience to app writers who have chosen to +#restrict their application to Linux. + +if helper_extn +EXECUTABLES += @with_helper_platform@/thread$(EXEEXT) \ + @with_helper_platform@/process$(EXEEXT) +endif + COMPILE_ONLY = odpthreads
TESTSCRIPTS = odpthreads_as_processes \ @@ -31,11 +38,7 @@ EXTRA_DIST = odpthreads_as_processes odpthreads_as_pthreads dist_chksum_SOURCES = chksum.c dist_cuckootable_SOURCES = cuckootable.c dist_odpthreads_SOURCES = odpthreads.c -odpthreads_LDADD = $(LIB)/libodphelper-linux.la $(LIB)/libodp-linux.la -dist_thread_SOURCES = thread.c -thread_LDADD = $(LIB)/libodphelper-linux.la $(LIB)/libodp-linux.la -dist_process_SOURCES = process.c +odpthreads_LDADD = $(LIB)/libodphelper-@with_helper_platform@.la $(LIB)/libodp-linux.la dist_parse_SOURCES = parse.c -process_LDADD = $(LIB)/libodphelper-linux.la $(LIB)/libodp-linux.la dist_table_SOURCES = table.c dist_iplookuptable_SOURCES = iplookuptable.c diff --git a/helper/test/linux-generic/Makefile.am b/helper/test/linux-generic/Makefile.am new file mode 100644 index 0000000..28d54a8 --- /dev/null +++ b/helper/test/linux-generic/Makefile.am @@ -0,0 +1,5 @@ + +thread_LDADD = $(LIB)/libodphelper-@with_helper_platform@.la $(LIB)/libodp-linux.la +dist_thread_SOURCES = thread.c +dist_process_SOURCES = process.c +process_LDADD = $(LIB)/libodphelper-@with_helper_platform@.la $(LIB)/libodp-linux.la diff --git a/helper/test/process.c b/helper/test/linux-generic/process.c similarity index 97% rename from helper/test/process.c rename to helper/test/linux-generic/process.c index f3c6d50..f641128 100644 --- a/helper/test/process.c +++ b/helper/test/linux-generic/process.c @@ -6,7 +6,7 @@
#include <test_debug.h> #include <odp_api.h> -#include <odp/helper/threads.h> +#include <odp/helper/platform/linux-generic/threads_extn.h>
#define NUMBER_WORKERS 16 /* 0 = max */
diff --git a/helper/test/thread.c b/helper/test/linux-generic/thread.c similarity index 97% rename from helper/test/thread.c rename to helper/test/linux-generic/thread.c index da94b49..f1ca1b7 100644 --- a/helper/test/thread.c +++ b/helper/test/linux-generic/thread.c @@ -6,7 +6,7 @@
#include <test_debug.h> #include <odp_api.h> -#include <odp/helper/threads.h> +#include <odp/helper/platform/linux-generic/threads_extn.h>
#define NUMBER_WORKERS 16 static void *worker_fn(void *arg TEST_UNUSED) diff --git a/helper/threads.c b/helper/threads.c index 690b6ca..fe5d2bd 100644 --- a/helper/threads.c +++ b/helper/threads.c @@ -9,16 +9,10 @@ #endif #include <sched.h> #include <unistd.h> -#include <sys/types.h> #include <sys/wait.h> #include <sys/prctl.h> #include <sys/syscall.h>
-#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdbool.h> - #include <odp_api.h> #include <odp/helper/threads.h> #include "odph_debug.h" @@ -27,225 +21,11 @@ static struct { int proc; /* true when process mode is required, false otherwise */ } helper_options;
-static void *odp_run_start_routine(void *arg) -{ - odph_linux_thr_params_t *thr_params = arg; - - /* ODP thread local init */ - if (odp_init_local(thr_params->instance, thr_params->thr_type)) { - ODPH_ERR("Local init failed\n"); - return NULL; - } - - void *ret_ptr = thr_params->start(thr_params->arg); - int ret = odp_term_local(); - - if (ret < 0) - ODPH_ERR("Local term failed\n"); - - return ret_ptr; -} - -int odph_linux_pthread_create(odph_linux_pthread_t *pthread_tbl, - const odp_cpumask_t *mask, - const odph_linux_thr_params_t *thr_params) -{ - int i; - int num; - int cpu_count; - int cpu; - int ret; - - num = odp_cpumask_count(mask); - - memset(pthread_tbl, 0, num * sizeof(odph_linux_pthread_t)); - - cpu_count = odp_cpu_count(); - - if (num < 1 || num > cpu_count) { - ODPH_ERR("Invalid number of threads:%d (%d cores available)\n", - num, cpu_count); - return 0; - } - - cpu = odp_cpumask_first(mask); - for (i = 0; i < num; i++) { - cpu_set_t cpu_set; - - CPU_ZERO(&cpu_set); - CPU_SET(cpu, &cpu_set); - - pthread_attr_init(&pthread_tbl[i].attr); - - pthread_tbl[i].cpu = cpu; - - pthread_attr_setaffinity_np(&pthread_tbl[i].attr, - sizeof(cpu_set_t), &cpu_set); - - pthread_tbl[i].thr_params.start = thr_params->start; - pthread_tbl[i].thr_params.arg = thr_params->arg; - pthread_tbl[i].thr_params.thr_type = thr_params->thr_type; - pthread_tbl[i].thr_params.instance = thr_params->instance; - - ret = pthread_create(&pthread_tbl[i].thread, - &pthread_tbl[i].attr, - odp_run_start_routine, - &pthread_tbl[i].thr_params); - if (ret != 0) { - ODPH_ERR("Failed to start thread on cpu #%d\n", cpu); - break; - } - - cpu = odp_cpumask_next(mask, cpu); - } - - return i; -} - -void odph_linux_pthread_join(odph_linux_pthread_t *thread_tbl, int num) -{ - int i; - int ret; - - for (i = 0; i < num; i++) { - /* Wait thread to exit */ - ret = pthread_join(thread_tbl[i].thread, NULL); - if (ret != 0) { - ODPH_ERR("Failed to join thread from cpu #%d\n", - thread_tbl[i].cpu); - } - pthread_attr_destroy(&thread_tbl[i].attr); - } -} - -int odph_linux_process_fork_n(odph_linux_process_t *proc_tbl, - const odp_cpumask_t *mask, - const odph_linux_thr_params_t *thr_params) -{ - pid_t pid; - int num; - int cpu_count; - int cpu; - int i; - - num = odp_cpumask_count(mask); - - memset(proc_tbl, 0, num * sizeof(odph_linux_process_t)); - - cpu_count = odp_cpu_count(); - - if (num < 1 || num > cpu_count) { - ODPH_ERR("Bad num\n"); - return -1; - } - - cpu = odp_cpumask_first(mask); - for (i = 0; i < num; i++) { - cpu_set_t cpu_set; - - CPU_ZERO(&cpu_set); - CPU_SET(cpu, &cpu_set); - - pid = fork(); - - if (pid < 0) { - ODPH_ERR("fork() failed\n"); - return -1; - } - - /* Parent continues to fork */ - if (pid > 0) { - proc_tbl[i].pid = pid; - proc_tbl[i].cpu = cpu; - - cpu = odp_cpumask_next(mask, cpu); - continue; - } - - /* Child process */ - - /* Request SIGTERM if parent dies */ - prctl(PR_SET_PDEATHSIG, SIGTERM); - /* Parent died already? */ - if (getppid() == 1) - kill(getpid(), SIGTERM); - - if (sched_setaffinity(0, sizeof(cpu_set_t), &cpu_set)) { - ODPH_ERR("sched_setaffinity() failed\n"); - return -2; - } - - if (odp_init_local(thr_params->instance, - thr_params->thr_type)) { - ODPH_ERR("Local init failed\n"); - return -2; - } - - return 0; - } - - return 1; -} - -int odph_linux_process_fork(odph_linux_process_t *proc, int cpu, - const odph_linux_thr_params_t *thr_params) -{ - odp_cpumask_t mask; - - odp_cpumask_zero(&mask); - odp_cpumask_set(&mask, cpu); - return odph_linux_process_fork_n(proc, &mask, thr_params); -} - -int odph_linux_process_wait_n(odph_linux_process_t *proc_tbl, int num) -{ - pid_t pid; - int i, j; - int status = 0; - - for (i = 0; i < num; i++) { - pid = wait(&status); - - if (pid < 0) { - ODPH_ERR("wait() failed\n"); - return -1; - } - - for (j = 0; j < num; j++) { - if (proc_tbl[j].pid == pid) { - proc_tbl[j].status = status; - break; - } - } - - if (j == num) { - ODPH_ERR("Bad pid:%d\n", (int)pid); - return -1; - } - - /* Examine the child process' termination status */ - if (WIFEXITED(status) && WEXITSTATUS(status) != EXIT_SUCCESS) { - ODPH_ERR("Child exit status:%d (pid:%d)\n", - WEXITSTATUS(status), (int)pid); - return -1; - } - if (WIFSIGNALED(status)) { - int signo = WTERMSIG(status); - - ODPH_ERR("Child term signo:%d - %s (pid:%d)\n", - signo, strsignal(signo), (int)pid); - return -1; - } - } - - return 0; -} - /* * wrapper for odpthreads, either implemented as linux threads or processes. * (in process mode, if start_routine returns NULL, the process return FAILURE). */ -static void *odpthread_run_start_routine(void *arg) +static void *_odph_thread_run_start_routine(void *arg) { int status; int ret; @@ -287,9 +67,9 @@ static void *odpthread_run_start_routine(void *arg) /* * Create a single ODPthread as a linux process */ -static int odph_linux_process_create(odph_odpthread_t *thread_tbl, - int cpu, - const odph_odpthread_params_t *thr_params) +static int _odph_linux_process_create(odph_odpthread_t *thread_tbl, + int cpu, + const odph_odpthread_params_t *thr_params) { cpu_set_t cpu_set; pid_t pid; @@ -327,7 +107,7 @@ static int odph_linux_process_create(odph_odpthread_t *thread_tbl, return -2; }
- odpthread_run_start_routine(&thread_tbl->start_args); + _odph_thread_run_start_routine(&thread_tbl->start_args);
return 0; /* never reached */ } @@ -357,7 +137,7 @@ static int odph_linux_thread_create(odph_odpthread_t *thread_tbl,
ret = pthread_create(&thread_tbl->thread.thread_id, &thread_tbl->thread.attr, - odpthread_run_start_routine, + _odph_thread_run_start_routine, &thread_tbl->start_args); if (ret != 0) { ODPH_ERR("Failed to start thread on cpu #%d\n", cpu); @@ -401,9 +181,9 @@ int odph_odpthreads_create(odph_odpthread_t *thread_tbl, thr_params)) break; } else { - if (odph_linux_process_create(&thread_tbl[i], - cpu, - thr_params)) + if (_odph_linux_process_create(&thread_tbl[i], + cpu, + thr_params)) break; }
diff --git a/pkgconfig/libodphelper-linux.pc.in b/pkgconfig/libodphelper-linux-generic.pc.in similarity index 72% rename from pkgconfig/libodphelper-linux.pc.in rename to pkgconfig/libodphelper-linux-generic.pc.in index 3987f4c..cab7be2 100644 --- a/pkgconfig/libodphelper-linux.pc.in +++ b/pkgconfig/libodphelper-linux-generic.pc.in @@ -3,9 +3,9 @@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@
-Name: libodphelper-linux +Name: libodphelper-linux-generic Description: Helper for the ODP packet processing engine Version: @PKGCONFIG_VERSION@ -Libs: -L${libdir} -lodphelper-linux +Libs: -L${libdir} -lodphelper-linux-generic Libs.private: Cflags: -I${includedir} diff --git a/test/Makefile.inc b/test/Makefile.inc index 1ebc047..243a616 100644 --- a/test/Makefile.inc +++ b/test/Makefile.inc @@ -4,7 +4,7 @@ LIB = $(top_builddir)/lib #in the following line, the libs using the symbols should come before #the libs containing them! The includer is given a chance to add things #before libodp by setting PRE_LDADD before the inclusion. -LDADD = $(PRE_LDADD) $(LIB)/libodphelper-linux.la $(LIB)/libodp-linux.la +LDADD = $(PRE_LDADD) $(LIB)/libodphelper-@with_helper_platform@.la $(LIB)/libodp-linux.la
INCFLAGS = \ -I$(top_builddir)/platform/@with_platform@/include \ diff --git a/test/common_plat/validation/api/Makefile.inc b/test/common_plat/validation/api/Makefile.inc index ffba620..a0afd26 100644 --- a/test/common_plat/validation/api/Makefile.inc +++ b/test/common_plat/validation/api/Makefile.inc @@ -13,4 +13,4 @@ AM_LDFLAGS += -static LIBCUNIT_COMMON = $(COMMON_DIR)/libcunit_common.la LIBCPUMASK_COMMON = $(COMMON_DIR)/libcpumask_common.la LIBTHRMASK_COMMON = $(COMMON_DIR)/libthrmask_common.la -LIBODP = $(LIB)/libodphelper-linux.la $(LIB)/libodp-linux.la +LIBODP = $(LIB)/libodphelper-@with_helper_platform@.la $(LIB)/libodp-linux.la diff --git a/test/linux-generic/Makefile.inc b/test/linux-generic/Makefile.inc index 36745fe..2a49076 100644 --- a/test/linux-generic/Makefile.inc +++ b/test/linux-generic/Makefile.inc @@ -6,7 +6,7 @@ AM_LDFLAGS += -static
LIBCUNIT_COMMON = $(top_builddir)/test/common_plat/common/libcunit_common.la LIB = $(top_builddir)/lib -LIBODP = $(LIB)/libodphelper-linux.la $(LIB)/libodp-linux.la +LIBODP = $(LIB)/libodphelper-@with_helper_platform@.la $(LIB)/libodp-linux.la
INCCUNIT_COMMON = -I$(top_srcdir)/test/common_plat/common INCODP = \
commit 7025b1b430237cddc10a0338c7b120d23b7985a8 Author: Mike Holmes mike.holmes@linaro.org Date: Fri Jan 20 15:32:01 2017 -0500
helper: cleanup Linux rename to thread
Remove the OS specific Linux filename and use the name of the generic apis it contains which is for odp_threads
Signed-off-by: Mike Holmes mike.holmes@linaro.org Reviewed-by: Christophe Milard christophe.milard@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 1bd2414..c2f69d4 100644 --- a/example/classifier/odp_classifier.c +++ b/example/classifier/odp_classifier.c @@ -12,9 +12,9 @@ #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/threads.h> #include <strings.h> #include <errno.h> #include <stdio.h> diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index ccd47f6..194c0a0 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -20,7 +20,7 @@
#include <odp_api.h>
-#include <odp/helper/linux.h> +#include <odp/helper/threads.h> #include <odp/helper/eth.h> #include <odp/helper/ip.h> #include <odp/helper/udp.h> diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c index 7e34d06..d686160 100644 --- a/example/ipsec/odp_ipsec.c +++ b/example/ipsec/odp_ipsec.c @@ -24,7 +24,7 @@
#include <odp_api.h>
-#include <odp/helper/linux.h> +#include <odp/helper/threads.h> #include <odp/helper/eth.h> #include <odp/helper/ip.h> #include <odp/helper/icmp.h> diff --git a/example/l2fwd_simple/odp_l2fwd_simple.c b/example/l2fwd_simple/odp_l2fwd_simple.c index 0682d2d..2473a11 100644 --- a/example/l2fwd_simple/odp_l2fwd_simple.c +++ b/example/l2fwd_simple/odp_l2fwd_simple.c @@ -10,9 +10,9 @@ #include <signal.h>
#include <odp_api.h> -#include <odp/helper/linux.h> #include <odp/helper/eth.h> #include <odp/helper/ip.h> +#include <odp/helper/threads.h>
#define POOL_NUM_PKT 8192 #define POOL_SEG_LEN 1856 diff --git a/example/l3fwd/odp_l3fwd.c b/example/l3fwd/odp_l3fwd.c index 441e812..4e35b64 100644 --- a/example/l3fwd/odp_l3fwd.c +++ b/example/l3fwd/odp_l3fwd.c @@ -14,11 +14,11 @@ #include <test_debug.h>
#include <odp_api.h> -#include <odp/helper/linux.h> #include <odp/helper/eth.h> #include <odp/helper/ip.h> #include <odp/helper/udp.h> #include <odp/helper/tcp.h> +#include <odp/helper/threads.h>
#include "odp_l3fwd_db.h" #include "odp_l3fwd_lpm.h" diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c index d1135cb..6e24deb 100644 --- a/example/packet/odp_pktio.c +++ b/example/packet/odp_pktio.c @@ -13,9 +13,9 @@ #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/threads.h>
/** @def MAX_WORKERS * @brief Maximum number of worker threads diff --git a/example/switch/odp_switch.c b/example/switch/odp_switch.c index f9c7176..2bbce10 100644 --- a/example/switch/odp_switch.c +++ b/example/switch/odp_switch.c @@ -11,9 +11,9 @@ #include <inttypes.h>
#include <odp_api.h> -#include <odp/helper/linux.h> #include <odp/helper/eth.h> #include <odp/helper/ip.h> +#include <odp/helper/threads.h>
/** Maximum number of worker threads */ #define MAX_WORKERS 32 diff --git a/example/time/time_global_test.c b/example/time/time_global_test.c index 380ec52..dd33949 100644 --- a/example/time/time_global_test.c +++ b/example/time/time_global_test.c @@ -4,10 +4,11 @@ * SPDX-License-Identifier: BSD-3-Clause */
+#include <inttypes.h> + #include <odp_api.h> #include <example_debug.h> -#include <odp/helper/linux.h> -#include <inttypes.h> +#include <odp/helper/threads.h>
#define MAX_WORKERS 32 #define ITERATION_NUM 2048 diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c index 035ab2e..b847e2b 100644 --- a/example/timer/odp_timer_test.c +++ b/example/timer/odp_timer_test.c @@ -14,7 +14,7 @@ #include <odp_api.h>
/* ODP helper for Linux apps */ -#include <odp/helper/linux.h> +#include <odp/helper/threads.h>
/* GNU lib C */ #include <getopt.h> diff --git a/helper/Makefile.am b/helper/Makefile.am index 9d0036d..62e55cc 100644 --- a/helper/Makefile.am +++ b/helper/Makefile.am @@ -14,7 +14,6 @@ AM_LDFLAGS += -version-number '$(ODPHELPER_LIBSO_VERSION)'
helperincludedir = $(includedir)/odp/helper/ helperinclude_HEADERS = \ - $(srcdir)/include/odp/helper/linux.h \ $(srcdir)/include/odp/helper/chksum.h\ $(srcdir)/include/odp/helper/eth.h\ $(srcdir)/include/odp/helper/icmp.h\ @@ -23,6 +22,7 @@ helperinclude_HEADERS = \ $(srcdir)/include/odp/helper/strong_types.h\ $(srcdir)/include/odp/helper/tcp.h\ $(srcdir)/include/odp/helper/table.h\ + $(srcdir)/include/odp/helper/threads.h \ $(srcdir)/include/odp/helper/udp.h
noinst_HEADERS = \ @@ -37,10 +37,10 @@ __LIB__libodphelper_linux_la_SOURCES = \ eth.c \ ip.c \ chksum.c \ - linux.c \ hashtable.c \ lineartable.c \ cuckootable.c \ - iplookuptable.c + iplookuptable.c \ + threads.c
lib_LTLIBRARIES = $(LIB)/libodphelper-linux.la diff --git a/helper/include/odp/helper/linux.h b/helper/include/odp/helper/threads.h similarity index 99% rename from helper/include/odp/helper/linux.h rename to helper/include/odp/helper/threads.h index 238bcf8..b8d975a 100644 --- a/helper/include/odp/helper/linux.h +++ b/helper/include/odp/helper/threads.h @@ -22,8 +22,6 @@ extern "C" { #endif
-#include <odp_api.h> - #include <pthread.h> #include <getopt.h> #include <sys/types.h> diff --git a/helper/test/odpthreads.c b/helper/test/odpthreads.c index 3d20eaa..216bccd 100644 --- a/helper/test/odpthreads.c +++ b/helper/test/odpthreads.c @@ -15,7 +15,7 @@
#include <test_debug.h> #include <odp_api.h> -#include <odp/helper/linux.h> +#include <odp/helper/threads.h>
#define NUMBER_WORKERS 16
diff --git a/helper/test/process.c b/helper/test/process.c index 0e04224..f3c6d50 100644 --- a/helper/test/process.c +++ b/helper/test/process.c @@ -6,7 +6,7 @@
#include <test_debug.h> #include <odp_api.h> -#include <odp/helper/linux.h> +#include <odp/helper/threads.h>
#define NUMBER_WORKERS 16 /* 0 = max */
diff --git a/helper/test/thread.c b/helper/test/thread.c index 8268d9f..da94b49 100644 --- a/helper/test/thread.c +++ b/helper/test/thread.c @@ -6,7 +6,7 @@
#include <test_debug.h> #include <odp_api.h> -#include <odp/helper/linux.h> +#include <odp/helper/threads.h>
#define NUMBER_WORKERS 16 static void *worker_fn(void *arg TEST_UNUSED) diff --git a/helper/linux.c b/helper/threads.c similarity index 99% rename from helper/linux.c rename to helper/threads.c index 1f009cd..690b6ca 100644 --- a/helper/linux.c +++ b/helper/threads.c @@ -20,7 +20,7 @@ #include <stdbool.h>
#include <odp_api.h> -#include <odp/helper/linux.h> +#include <odp/helper/threads.h> #include "odph_debug.h"
static struct { diff --git a/test/common_plat/common/odp_cunit_common.c b/test/common_plat/common/odp_cunit_common.c index 2337c92..6d18fa0 100644 --- a/test/common_plat/common/odp_cunit_common.c +++ b/test/common_plat/common/odp_cunit_common.c @@ -7,7 +7,7 @@ #include <string.h> #include <odp_api.h> #include <odp_cunit_common.h> -#include <odp/helper/linux.h> +#include <odp/helper/threads.h> /* Globals */ static odph_odpthread_t thread_tbl[MAX_WORKERS]; static odp_instance_t instance; diff --git a/test/common_plat/miscellaneous/odp_api_from_cpp.cpp b/test/common_plat/miscellaneous/odp_api_from_cpp.cpp index be74c27..2b30786 100644 --- a/test/common_plat/miscellaneous/odp_api_from_cpp.cpp +++ b/test/common_plat/miscellaneous/odp_api_from_cpp.cpp @@ -1,6 +1,6 @@ #include <cstdio> #include <odp_api.h> -#include <odp/helper/linux.h> +#include <odp/helper/threads.h>
int main(int argc ODP_UNUSED, const char *argv[] ODP_UNUSED) { diff --git a/test/common_plat/performance/odp_crypto.c b/test/common_plat/performance/odp_crypto.c index 9936288..bff20e5 100644 --- a/test/common_plat/performance/odp_crypto.c +++ b/test/common_plat/performance/odp_crypto.c @@ -17,7 +17,7 @@ #include <sys/resource.h>
#include <odp_api.h> -#include <odp/helper/linux.h> +#include <odp/helper/threads.h>
#define app_err(fmt, ...) \ fprintf(stderr, "%s:%d:%s(): Error: " fmt, __FILE__, \ diff --git a/test/common_plat/performance/odp_l2fwd.c b/test/common_plat/performance/odp_l2fwd.c index 82c3a25..fa59d5e 100644 --- a/test/common_plat/performance/odp_l2fwd.c +++ b/test/common_plat/performance/odp_l2fwd.c @@ -25,7 +25,7 @@ #include <test_debug.h>
#include <odp_api.h> -#include <odp/helper/linux.h> +#include <odp/helper/threads.h> #include <odp/helper/eth.h> #include <odp/helper/ip.h>
diff --git a/test/common_plat/performance/odp_pktio_perf.c b/test/common_plat/performance/odp_pktio_perf.c index 92d979d..ee3b8ab 100644 --- a/test/common_plat/performance/odp_pktio_perf.c +++ b/test/common_plat/performance/odp_pktio_perf.c @@ -25,7 +25,7 @@ #include <odp/helper/eth.h> #include <odp/helper/ip.h> #include <odp/helper/udp.h> -#include <odp/helper/linux.h> +#include <odp/helper/threads.h>
#include <getopt.h> #include <stdlib.h> diff --git a/test/common_plat/performance/odp_sched_latency.c b/test/common_plat/performance/odp_sched_latency.c index 063fb21..2066f91 100644 --- a/test/common_plat/performance/odp_sched_latency.c +++ b/test/common_plat/performance/odp_sched_latency.c @@ -20,7 +20,7 @@ #include <odp_api.h>
/* ODP helper for Linux apps */ -#include <odp/helper/linux.h> +#include <odp/helper/threads.h>
/* GNU lib C */ #include <getopt.h> diff --git a/test/common_plat/performance/odp_scheduling.c b/test/common_plat/performance/odp_scheduling.c index e2a49d3..713dba1 100644 --- a/test/common_plat/performance/odp_scheduling.c +++ b/test/common_plat/performance/odp_scheduling.c @@ -20,7 +20,7 @@ #include <odp_api.h>
/* ODP helper for Linux apps */ -#include <odp/helper/linux.h> +#include <odp/helper/threads.h>
/* Needs librt*/ #include <time.h> diff --git a/test/common_plat/validation/api/timer/timer.c b/test/common_plat/validation/api/timer/timer.c index 1945afa..304b1d5 100644 --- a/test/common_plat/validation/api/timer/timer.c +++ b/test/common_plat/validation/api/timer/timer.c @@ -15,7 +15,7 @@
#include <time.h> #include <odp.h> -#include <odp/helper/linux.h> +#include <odp/helper/threads.h> #include "odp_cunit_common.h" #include "test_debug.h" #include "timer.h" diff --git a/test/linux-generic/mmap_vlan_ins/mmap_vlan_ins.c b/test/linux-generic/mmap_vlan_ins/mmap_vlan_ins.c index b91eb53..a12eb3c 100644 --- a/test/linux-generic/mmap_vlan_ins/mmap_vlan_ins.c +++ b/test/linux-generic/mmap_vlan_ins/mmap_vlan_ins.c @@ -10,7 +10,7 @@ #include <signal.h>
#include <odp_api.h> -#include <odp/helper/linux.h> +#include <odp/helper/threads.h> #include <odp/helper/eth.h> #include <odp/helper/ip.h>
diff --git a/test/linux-generic/pktio_ipc/ipc_common.h b/test/linux-generic/pktio_ipc/ipc_common.h index 8804994..d2a355d 100644 --- a/test/linux-generic/pktio_ipc/ipc_common.h +++ b/test/linux-generic/pktio_ipc/ipc_common.h @@ -17,7 +17,7 @@ #include <example_debug.h>
#include <odp.h> -#include <odp/helper/linux.h> +#include <odp/helper/threads.h> #include <odp/helper/eth.h> #include <odp/helper/ip.h> #include <odp/helper/udp.h> diff --git a/test/linux-generic/ring/ring_stress.c b/test/linux-generic/ring/ring_stress.c index bc61c3e..19bd65b 100644 --- a/test/linux-generic/ring/ring_stress.c +++ b/test/linux-generic/ring/ring_stress.c @@ -18,7 +18,7 @@ #include <unistd.h>
#include <odp_api.h> -#include <odp/helper/linux.h> +#include <odp/helper/threads.h> #include <odp_packet_io_ring_internal.h> #include <test_debug.h> #include <odp_cunit_common.h>
commit 0f18e317ede15081828deca1ff61d65b72e12926 Author: Mike Holmes mike.holmes@linaro.org Date: Fri Jan 20 15:32:00 2017 -0500
configure: use helper configure.m4
Don't keep helper data in the main configure, split it to an m4 just like the other sub dirs
Signed-off-by: Mike Holmes mike.holmes@linaro.org Reviewed-by: Christophe Milard christophe.milard@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/configure.ac b/configure.ac index 67d60d2..1384130 100644 --- a/configure.ac +++ b/configure.ac @@ -294,8 +294,6 @@ AM_CFLAGS="$AM_CFLAGS $ODP_CFLAGS" AM_CXXFLAGS="-std=c++11"
AC_CONFIG_FILES([Makefile - helper/Makefile - helper/test/Makefile pkgconfig/libodp-linux.pc pkgconfig/libodphelper-linux.pc ]) diff --git a/helper/m4/configure.m4 b/helper/m4/configure.m4 index 480f79b..7b208fa 100644 --- a/helper/m4/configure.m4 +++ b/helper/m4/configure.m4 @@ -7,3 +7,6 @@ AC_ARG_ENABLE([test-helper], [if test "x$enableval" = "xyes"; then test_helper=yes fi]) + +AC_CONFIG_FILES([helper/Makefile + helper/test/Makefile])
-----------------------------------------------------------------------
Summary of changes: configure.ac | 19 +- example/Makefile.inc | 2 +- example/classifier/odp_classifier.c | 2 +- example/generator/odp_generator.c | 2 +- example/ipsec/odp_ipsec.c | 2 +- example/l2fwd_simple/odp_l2fwd_simple.c | 2 +- example/l3fwd/odp_l3fwd.c | 2 +- example/packet/odp_pktio.c | 2 +- example/switch/odp_switch.c | 2 +- example/time/time_global_test.c | 5 +- example/timer/odp_timer_test.c | 2 +- helper/Makefile.am | 22 +- .../helper/platform/linux-generic/threads_extn.h | 112 ++++++++ helper/include/odp/helper/{linux.h => threads.h} | 78 ----- helper/m4/configure.m4 | 14 + helper/platform/linux-generic/thread.c | 313 +++++++++++++++++++++ helper/test/Makefile.am | 42 ++- helper/test/chksum.c | 18 +- helper/test/cuckootable.c | 4 +- helper/test/iplookuptable.c | 4 +- helper/test/linux-generic/Makefile.am | 5 + helper/test/{ => linux-generic}/process.c | 16 +- helper/test/{ => linux-generic}/thread.c | 16 +- helper/test/odpthreads.c | 20 +- helper/test/parse.c | 86 +++--- helper/test/table.c | 12 +- helper/{linux.c => threads.c} | 240 +--------------- ...inux.pc.in => libodphelper-linux-generic.pc.in} | 4 +- test/Makefile.inc | 2 +- test/common_plat/common/odp_cunit_common.c | 2 +- .../common_plat/miscellaneous/odp_api_from_cpp.cpp | 2 +- test/common_plat/performance/odp_crypto.c | 2 +- test/common_plat/performance/odp_l2fwd.c | 2 +- test/common_plat/performance/odp_pktio_perf.c | 2 +- test/common_plat/performance/odp_sched_latency.c | 2 +- test/common_plat/performance/odp_scheduling.c | 2 +- test/common_plat/validation/api/Makefile.inc | 2 +- test/common_plat/validation/api/timer/timer.c | 2 +- test/linux-generic/Makefile.inc | 2 +- test/linux-generic/mmap_vlan_ins/mmap_vlan_ins.c | 2 +- test/linux-generic/pktio_ipc/ipc_common.h | 2 +- test/linux-generic/ring/ring_stress.c | 2 +- 42 files changed, 632 insertions(+), 444 deletions(-) create mode 100644 helper/include/odp/helper/platform/linux-generic/threads_extn.h rename helper/include/odp/helper/{linux.h => threads.h} (74%) create mode 100644 helper/platform/linux-generic/thread.c create mode 100644 helper/test/linux-generic/Makefile.am rename helper/test/{ => linux-generic}/process.c (84%) rename helper/test/{ => linux-generic}/thread.c (84%) rename helper/{linux.c => threads.c} (67%) rename pkgconfig/{libodphelper-linux.pc.in => libodphelper-linux-generic.pc.in} (72%)
hooks/post-receive