diff mbox

[API-NEXT,v2,3/3] api: config: removed ODP_CONFIG_MAX_THREADS

Message ID A400FC85CF2669428A5A081F01B94F531E452AB9@DEMUMBX002.nsn-intra.net
State New
Headers show

Commit Message

Savolainen, Petri (Nokia - FI/Espoo) Sept. 15, 2015, 10:42 a.m. UTC
From: EXT Bill Fischofer [mailto:bill.fischofer@linaro.org]

Sent: Friday, September 11, 2015 6:55 PM
To: Savolainen, Petri (Nokia - FI/Espoo)
Cc: LNG ODP Mailman List
Subject: Re: [lng-odp] [API-NEXT PATCH v2 3/3] api: config: removed ODP_CONFIG_MAX_THREADS



On Fri, Sep 11, 2015 at 7:55 AM, Petri Savolainen <petri.savolainen@nokia.com<mailto:petri.savolainen@nokia.com>> wrote:
New thread API call odp_thread_count_max() replaces the
preprocessor macro in the API. A macro is still used
internally.

Signed-off-by: Petri Savolainen <petri.savolainen@nokia.com<mailto:petri.savolainen@nokia.com>>

---
 include/odp/api/config.h                           |  5 ---
 .../linux-generic/include/odp/plat/cpumask_types.h |  3 +-
 .../include/odp/plat/rwlock_recursive_types.h      |  4 +--
 .../linux-generic/include/odp_buffer_internal.h    |  3 +-
 .../linux-generic/include/odp_config_internal.h    | 29 ++++++++++++++++
 platform/linux-generic/odp_thread.c                |  9 ++---
 platform/linux-generic/odp_thrmask.c               |  4 +--
 test/performance/odp_pktio_perf.c                  | 40 +++++++++++++++++++---
 test/validation/thread/thread.c                    |  2 +-
 9 files changed, 78 insertions(+), 21 deletions(-)
 create mode 100644 platform/linux-generic/include/odp_config_internal.h

+#define __ODP_CONFIG_MAX_THREADS  128

We've been using one leading underscore for internal APIs.  Should we be consistent here for internal constants?

Changed to _ODP_INTERNAL_MAX_THREADS to highlight that this is internal define. It’s visible through odp.h, so must be clearly visible that it’s not part of API.


-Petri
diff mbox

Patch

diff --git a/include/odp/api/config.h b/include/odp/api/config.h
index 302eaf5..bf88be8 100644
--- a/include/odp/api/config.h
+++ b/include/odp/api/config.h
@@ -24,11 +24,6 @@  extern "C" {
  */

 /**
- * Maximum number of threads
- */
-#define ODP_CONFIG_MAX_THREADS  128
-
-/**
  * Maximum number of pools
  */
 #define ODP_CONFIG_POOLS        16
diff --git a/platform/linux-generic/include/odp/plat/cpumask_types.h b/platform/linux-generic/include/odp/plat/cpumask_types.h
index 6fba832..d3bf988 100644
--- a/platform/linux-generic/include/odp/plat/cpumask_types.h
+++ b/platform/linux-generic/include/odp/plat/cpumask_types.h
@@ -23,11 +23,12 @@  extern "C" {
  */

 #include <odp/std_types.h>
+#include <odp_config_internal.h>

 /**
  * Minimum size of output buffer for odp_cpumask_to_str()
  */
-#define ODP_CPUMASK_STR_SIZE ((ODP_CONFIG_MAX_THREADS + 3) / 4 + 3)
+#define ODP_CPUMASK_STR_SIZE ((__ODP_CONFIG_MAX_THREADS + 3) / 4 + 3)

 /**
  * CPU mask
diff --git a/platform/linux-generic/include/odp/plat/rwlock_recursive_types.h b/platform/linux-generic/include/odp/plat/rwlock_recursive_types.h
index 9e220f5..0e20b40 100644
--- a/platform/linux-generic/include/odp/plat/rwlock_recursive_types.h
+++ b/platform/linux-generic/include/odp/plat/rwlock_recursive_types.h
@@ -19,7 +19,7 @@  extern "C" {

 #include <odp/rwlock.h>
 #include <odp/std_types.h>
-#include <odp/config.h>
+#include <odp_config_internal.h>

 /**
  * @internal
@@ -29,7 +29,7 @@  struct odp_rwlock_recursive_s {
        odp_rwlock_t lock;                       /**< the lock */
        int wr_owner;                            /**< write owner thread */
        uint32_t wr_cnt;                         /**< write recursion count */
-       uint8_t  rd_cnt[ODP_CONFIG_MAX_THREADS]; /**< read recursion count */
+       uint8_t  rd_cnt[__ODP_CONFIG_MAX_THREADS]; /**< read recursion count */
 };

 /** @addtogroup odp_synchronizers
diff --git a/platform/linux-generic/include/odp_buffer_internal.h b/platform/linux-generic/include/odp_buffer_internal.h
index 4cacca1..7671ea7 100644
--- a/platform/linux-generic/include/odp_buffer_internal.h
+++ b/platform/linux-generic/include/odp_buffer_internal.h
@@ -30,6 +30,7 @@  extern "C" {
 #include <odp/thread.h>
 #include <odp/event.h>
 #include <odp_forward_typedefs_internal.h>
+#include <odp_config_internal.h>

 #define ODP_BITSIZE(x) \
        ((x) <=     2 ?  1 : \
@@ -143,7 +144,7 @@  struct odp_buffer_hdr_t {

 /** @internal Compile time assert that the
  * allocator field can handle any allocator id*/
-_ODP_STATIC_ASSERT(INT16_MAX >= ODP_CONFIG_MAX_THREADS,
+_ODP_STATIC_ASSERT(INT16_MAX >= __ODP_CONFIG_MAX_THREADS,
                   "ODP_BUFFER_HDR_T__ALLOCATOR__SIZE_ERROR");

 typedef struct odp_buffer_hdr_stride {
diff --git a/platform/linux-generic/include/odp_config_internal.h b/platform/linux-generic/include/odp_config_internal.h
new file mode 100644
index 0000000..c60ec66
--- /dev/null
+++ b/platform/linux-generic/include/odp_config_internal.h
@@ -0,0 +1,29 @@ 
+/* Copyright (c) 2015, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+/**
+ * @file
+ *
+ * Linux-generic platform internal configuration
+ */
+
+#ifndef ODP_INTERNAL_CONFIG_H_
+#define ODP_INTERNAL_CONFIG_H_

The file is named odp_config_internal so shouldn't this be ODP_CONFIG_INTERNAL_H_ ?


OK.


+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Maximum number of threads
+ */