diff mbox

[03/11] api: cpumask: added cpumask_setall

Message ID 1436449585-23252-4-git-send-email-maxim.uvarov@linaro.org
State Accepted
Commit c9bde28c25cb9c901be46d4abf14fdda3845c3c1
Headers show

Commit Message

Maxim Uvarov July 9, 2015, 1:46 p.m. UTC
From: Petri Savolainen <petri.savolainen@nokia.com>

The call sets all possible CPUs in the mask. It's system specific which
CPUs are actually available to the application.

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>
---
 include/odp/api/cpumask.h            | 15 +++++++++++++--
 platform/linux-generic/odp_cpumask.c |  8 ++++++++
 2 files changed, 21 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/include/odp/api/cpumask.h b/include/odp/api/cpumask.h
index dbac7b9..1fdbfb4 100644
--- a/include/odp/api/cpumask.h
+++ b/include/odp/api/cpumask.h
@@ -65,6 +65,17 @@  void odp_cpumask_zero(odp_cpumask_t *mask);
 void odp_cpumask_set(odp_cpumask_t *mask, int cpu);
 
 /**
+ * Set all CPUs in mask
+ *
+ * Set all possible CPUs in the mask. All CPUs from 0 to odp_cpumask_count()
+ * minus one are set, regardless of which CPUs are actually available to
+ * the application.
+ *
+ * @param mask  CPU mask to set
+ */
+void odp_cpumask_setall(odp_cpumask_t *mask);
+
+/**
  * Remove CPU from mask
  * @param mask  CPU mask to update
  * @param cpu   CPU number
@@ -82,7 +93,7 @@  void odp_cpumask_clr(odp_cpumask_t *mask, int cpu);
 int odp_cpumask_isset(const odp_cpumask_t *mask, int cpu);
 
 /**
- * Count number of CPU's in mask
+ * Count number of CPUs set in mask
  *
  * @param mask  CPU mask
  * @return population count
@@ -120,7 +131,7 @@  void odp_cpumask_xor(odp_cpumask_t *dest, const odp_cpumask_t *src1,
 		     const odp_cpumask_t *src2);
 
 /**
- * Test if two CPU masks contain the same CPU's
+ * Test if two CPU masks contain the same CPUs
  *
  * @param mask1    CPU mask 1
  * @param mask2    CPU mask 2
diff --git a/platform/linux-generic/odp_cpumask.c b/platform/linux-generic/odp_cpumask.c
index 0ca1071..a89c3b6 100644
--- a/platform/linux-generic/odp_cpumask.c
+++ b/platform/linux-generic/odp_cpumask.c
@@ -125,6 +125,14 @@  void odp_cpumask_set(odp_cpumask_t *mask, int cpu)
 	CPU_SET(cpu, &mask->set);
 }
 
+void odp_cpumask_setall(odp_cpumask_t *mask)
+{
+	int cpu;
+
+	for (cpu = 0; cpu < CPU_SETSIZE; cpu++)
+		CPU_SET(cpu, &mask->set);
+}
+
 void odp_cpumask_clr(odp_cpumask_t *mask, int cpu)
 {
 	CPU_CLR(cpu, &mask->set);