aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetri Savolainen <petri.savolainen@nokia.com>2015-07-09 16:46:20 +0300
committerMaxim Uvarov <maxim.uvarov@linaro.org>2015-07-23 19:21:51 +0300
commit270af813121dd3ba67ce3ed082b49489c3c2dd35 (patch)
treeab8509f296dcb87036f730b704f7ca49955980d3
parentf97e134e3c599d03d56dd6a9820442374ef2f5a3 (diff)
api: helper: deleted odph_linux_cpumask_default
The linux specific helper was replaced by default cpumask calls (odp_cpumask_def_worker()) in the cpumask API. Signed-off-by: Petri Savolainen <petri.savolainen@nokia.com> Reviewed-by: Christophe Milard <christophe.milard@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org> Conflicts: helper/linux.c
-rw-r--r--example/classifier/odp_classifier.c7
-rw-r--r--example/generator/odp_generator.c7
-rw-r--r--example/ipsec/odp_ipsec.c7
-rw-r--r--example/packet/odp_pktio.c7
-rw-r--r--example/timer/odp_timer_test.c7
-rw-r--r--helper/include/odp/helper/linux.h11
-rw-r--r--helper/linux.c31
-rw-r--r--helper/test/odp_process.c2
-rw-r--r--helper/test/odp_thread.c2
-rw-r--r--test/api_test/odp_common.c2
-rw-r--r--test/performance/odp_atomic.c2
-rw-r--r--test/performance/odp_l2fwd.c7
-rw-r--r--test/performance/odp_pktio_perf.c4
-rw-r--r--test/performance/odp_scheduling.c7
-rw-r--r--test/validation/common/odp_cunit_common.c2
15 files changed, 21 insertions, 84 deletions
diff --git a/example/classifier/odp_classifier.c b/example/classifier/odp_classifier.c
index 884df6f2f..586105c06 100644
--- a/example/classifier/odp_classifier.c
+++ b/example/classifier/odp_classifier.c
@@ -422,11 +422,8 @@ int main(int argc, char *argv[])
if (args->cpu_count)
num_workers = args->cpu_count;
- /*
- * By default CPU #0 runs Linux kernel background tasks.
- * Start mapping thread from CPU #1
- */
- num_workers = odph_linux_cpumask_default(&cpumask, num_workers);
+ /* Get default worker cpumask */
+ num_workers = odp_cpumask_def_worker(&cpumask, num_workers);
(void)odp_cpumask_to_str(&cpumask, cpumaskstr, sizeof(cpumaskstr));
printf("num worker threads: %i\n", num_workers);
diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c
index c38f180e8..d6ec75863 100644
--- a/example/generator/odp_generator.c
+++ b/example/generator/odp_generator.c
@@ -637,11 +637,8 @@ int main(int argc, char *argv[])
if (args->appl.mode == APPL_MODE_PING)
num_workers = 2;
- /*
- * By default CPU #0 runs Linux kernel background tasks.
- * Start mapping thread from CPU #1
- */
- num_workers = odph_linux_cpumask_default(&cpumask, num_workers);
+ /* Get default worker cpumask */
+ num_workers = odp_cpumask_def_worker(&cpumask, num_workers);
(void)odp_cpumask_to_str(&cpumask, cpumaskstr, sizeof(cpumaskstr));
printf("num worker threads: %i\n", num_workers);
diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c
index 2d302ff42..a40bdee59 100644
--- a/example/ipsec/odp_ipsec.c
+++ b/example/ipsec/odp_ipsec.c
@@ -1277,11 +1277,8 @@ main(int argc, char *argv[])
if (args->appl.cpu_count)
num_workers = args->appl.cpu_count;
- /*
- * By default CPU #0 runs Linux kernel background tasks.
- * Start mapping thread from CPU #1
- */
- num_workers = odph_linux_cpumask_default(&cpumask, num_workers);
+ /* Get default worker cpumask */
+ num_workers = odp_cpumask_def_worker(&cpumask, num_workers);
(void)odp_cpumask_to_str(&cpumask, cpumaskstr, sizeof(cpumaskstr));
printf("num worker threads: %i\n", num_workers);
diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c
index 9bb295985..0db5a60f1 100644
--- a/example/packet/odp_pktio.c
+++ b/example/packet/odp_pktio.c
@@ -363,11 +363,8 @@ int main(int argc, char *argv[])
if (args->appl.cpu_count)
num_workers = args->appl.cpu_count;
- /*
- * By default CPU #0 runs Linux kernel background tasks.
- * Start mapping thread from CPU #1
- */
- num_workers = odph_linux_cpumask_default(&cpumask, num_workers);
+ /* Get default worker cpumask */
+ num_workers = odp_cpumask_def_worker(&cpumask, num_workers);
(void)odp_cpumask_to_str(&cpumask, cpumaskstr, sizeof(cpumaskstr));
printf("num worker threads: %i\n", num_workers);
diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c
index 456820257..44af5d173 100644
--- a/example/timer/odp_timer_test.c
+++ b/example/timer/odp_timer_test.c
@@ -371,11 +371,8 @@ int main(int argc, char *argv[])
if (gbls->args.cpu_count)
num_workers = gbls->args.cpu_count;
- /*
- * By default CPU #0 runs Linux kernel background tasks.
- * Start mapping thread from CPU #1
- */
- num_workers = odph_linux_cpumask_default(&cpumask, num_workers);
+ /* Get default worker cpumask */
+ num_workers = odp_cpumask_def_worker(&cpumask, num_workers);
(void)odp_cpumask_to_str(&cpumask, cpumaskstr, sizeof(cpumaskstr));
printf("num worker threads: %i\n", num_workers);
diff --git a/helper/include/odp/helper/linux.h b/helper/include/odp/helper/linux.h
index 44ee787a0..ce61fdf64 100644
--- a/helper/include/odp/helper/linux.h
+++ b/helper/include/odp/helper/linux.h
@@ -51,17 +51,6 @@ typedef struct {
} odph_linux_process_t;
/**
- * Creates default pthread/process cpumask
- *
- * Creates cpumask based on starting count, actual value returned
- *
- * @param mask CPU mask to initialize
- * @param num Number of threads to create, zero for all available
- * @return Actual values of CPUs used to create mask
- */
-int odph_linux_cpumask_default(odp_cpumask_t *mask, int num);
-
-/**
* Creates and launches pthreads
*
* Creates, pins and launches threads to separate CPU's based on the cpumask.
diff --git a/helper/linux.c b/helper/linux.c
index a2eacc199..4256f4315 100644
--- a/helper/linux.c
+++ b/helper/linux.c
@@ -22,37 +22,6 @@
#include <odp/system_info.h>
#include "odph_debug.h"
-int odph_linux_cpumask_default(odp_cpumask_t *mask, int num)
-{
- int ret, cpu, i;
- cpu_set_t cpuset;
-
- ret = pthread_getaffinity_np(pthread_self(),
- sizeof(cpu_set_t), &cpuset);
- if (ret != 0)
- ODPH_ABORT("failed to read CPU affinity value\n");
-
- odp_cpumask_zero(mask);
-
- /*
- * If no user supplied number or it's too large, then attempt
- * to use all CPUs
- */
- if (0 == num || CPU_SETSIZE < num)
- num = CPU_COUNT(&cpuset);
-
- /* build the mask, allocating down from highest numbered CPU */
- for (cpu = 0, i = CPU_SETSIZE-1; i >= 0 && cpu < num; --i) {
- if (CPU_ISSET(i, &cpuset)) {
- odp_cpumask_set(mask, i);
- cpu++;
- }
- }
-
- return cpu;
-}
-
-
static void *odp_run_start_routine(void *arg)
{
odp_start_args_t *start_args = arg;
diff --git a/helper/test/odp_process.c b/helper/test/odp_process.c
index 97f46691d..d3a594353 100644
--- a/helper/test/odp_process.c
+++ b/helper/test/odp_process.c
@@ -39,7 +39,7 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED)
}
/* discover how many processes this system can support */
- num_workers = odph_linux_cpumask_default(&cpu_mask, NUMBER_WORKERS);
+ num_workers = odp_cpumask_def_worker(&cpu_mask, NUMBER_WORKERS);
if (num_workers < NUMBER_WORKERS) {
printf("System can only support %d processes and not the %d requested\n",
num_workers, NUMBER_WORKERS);
diff --git a/helper/test/odp_thread.c b/helper/test/odp_thread.c
index 634be9621..1de30ab67 100644
--- a/helper/test/odp_thread.c
+++ b/helper/test/odp_thread.c
@@ -40,7 +40,7 @@ int main(int argc TEST_UNUSED, char *argv[] TEST_UNUSED)
}
/* discover how many threads this system can support */
- num_workers = odph_linux_cpumask_default(&cpu_mask, NUMBER_WORKERS);
+ num_workers = odp_cpumask_def_worker(&cpu_mask, NUMBER_WORKERS);
if (num_workers < NUMBER_WORKERS) {
printf("System can only support %d threads and not the %d requested\n",
num_workers, NUMBER_WORKERS);
diff --git a/test/api_test/odp_common.c b/test/api_test/odp_common.c
index 0677f9bf3..0dbefa5b0 100644
--- a/test/api_test/odp_common.c
+++ b/test/api_test/odp_common.c
@@ -74,7 +74,7 @@ int odp_test_thread_create(void *func_ptr(void *), pthrd_arg *arg)
odp_cpumask_t cpumask;
/* Create and init additional threads */
- odph_linux_cpumask_default(&cpumask, arg->numthrds);
+ odp_cpumask_def_worker(&cpumask, arg->numthrds);
odph_linux_pthread_create(thread_tbl, &cpumask, func_ptr,
(void *)arg);
diff --git a/test/performance/odp_atomic.c b/test/performance/odp_atomic.c
index 861ab830c..eefce06ce 100644
--- a/test/performance/odp_atomic.c
+++ b/test/performance/odp_atomic.c
@@ -284,7 +284,7 @@ int odp_test_thread_create(void *func_ptr(void *), pthrd_arg *arg)
odp_cpumask_t cpumask;
/* Create and init additional threads */
- odph_linux_cpumask_default(&cpumask, arg->numthrds);
+ odp_cpumask_def_worker(&cpumask, arg->numthrds);
odph_linux_pthread_create(thread_tbl, &cpumask, func_ptr,
(void *)arg);
diff --git a/test/performance/odp_l2fwd.c b/test/performance/odp_l2fwd.c
index c385444a2..157df3b17 100644
--- a/test/performance/odp_l2fwd.c
+++ b/test/performance/odp_l2fwd.c
@@ -399,11 +399,8 @@ int main(int argc, char *argv[])
if (gbl_args->appl.cpu_count)
num_workers = gbl_args->appl.cpu_count;
- /*
- * By default CPU #0 runs Linux kernel background tasks.
- * Start mapping thread from CPU #1
- */
- num_workers = odph_linux_cpumask_default(&cpumask, num_workers);
+ /* Get default worker cpumask */
+ num_workers = odp_cpumask_def_worker(&cpumask, num_workers);
(void)odp_cpumask_to_str(&cpumask, cpumaskstr, sizeof(cpumaskstr));
printf("num worker threads: %i\n", num_workers);
diff --git a/test/performance/odp_pktio_perf.c b/test/performance/odp_pktio_perf.c
index bebbe2222..08f13b628 100644
--- a/test/performance/odp_pktio_perf.c
+++ b/test/performance/odp_pktio_perf.c
@@ -543,8 +543,8 @@ static int setup_txrx_masks(odp_cpumask_t *thd_mask_tx,
int num_workers, num_tx_workers, num_rx_workers;
int i, cpu;
- num_workers = odph_linux_cpumask_default(&cpumask,
- gbl_args->args.cpu_count);
+ num_workers = odp_cpumask_def_worker(&cpumask,
+ gbl_args->args.cpu_count);
if (num_workers < 2) {
LOG_ERR("Need at least two cores\n");
return -1;
diff --git a/test/performance/odp_scheduling.c b/test/performance/odp_scheduling.c
index 99ff77244..8d388ff55 100644
--- a/test/performance/odp_scheduling.c
+++ b/test/performance/odp_scheduling.c
@@ -892,11 +892,8 @@ int main(int argc, char *argv[])
if (args.cpu_count)
num_workers = args.cpu_count;
- /*
- * By default CPU #0 runs Linux kernel background tasks.
- * Start mapping thread from CPU #1
- */
- num_workers = odph_linux_cpumask_default(&cpumask, num_workers);
+ /* Get default worker cpumask */
+ num_workers = odp_cpumask_def_worker(&cpumask, num_workers);
(void)odp_cpumask_to_str(&cpumask, cpumaskstr, sizeof(cpumaskstr));
printf("num worker threads: %i\n", num_workers);
diff --git a/test/validation/common/odp_cunit_common.c b/test/validation/common/odp_cunit_common.c
index 753405ade..807325b67 100644
--- a/test/validation/common/odp_cunit_common.c
+++ b/test/validation/common/odp_cunit_common.c
@@ -28,7 +28,7 @@ int odp_cunit_thread_create(void *func_ptr(void *), pthrd_arg *arg)
odp_cpumask_t cpumask;
/* Create and init additional threads */
- odph_linux_cpumask_default(&cpumask, arg->numthrds);
+ odp_cpumask_def_worker(&cpumask, arg->numthrds);
odph_linux_pthread_create(thread_tbl, &cpumask, func_ptr,
(void *)arg);