diff mbox

[API-NEXT,PATCHv2,3/4] linux-generic: pool: implement numa socket functions

Message ID 1458771569-17717-3-git-send-email-bill.fischofer@linaro.org
State New
Headers show

Commit Message

Bill Fischofer March 23, 2016, 10:19 p.m. UTC
Add default numa socket support including the functions
odp_cpu_socket_id() and odp_cpu_socket_id_cpu()

Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>
---
 platform/linux-generic/include/odp/api/plat/pool_types.h |  2 ++
 platform/linux-generic/odp_pool.c                        |  1 +
 platform/linux-generic/odp_thread.c                      | 11 +++++++++++
 3 files changed, 14 insertions(+)

Comments

Maxim Uvarov March 24, 2016, 8:55 a.m. UTC | #1
On 03/24/16 01:19, Bill Fischofer wrote:
> Add default numa socket support including the functions
> odp_cpu_socket_id() and odp_cpu_socket_id_cpu()
>
> Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>
> ---
>   platform/linux-generic/include/odp/api/plat/pool_types.h |  2 ++
>   platform/linux-generic/odp_pool.c                        |  1 +
>   platform/linux-generic/odp_thread.c                      | 11 +++++++++++
>   3 files changed, 14 insertions(+)
>
> diff --git a/platform/linux-generic/include/odp/api/plat/pool_types.h b/platform/linux-generic/include/odp/api/plat/pool_types.h
> index 1ca8f02..8bbd6e1 100644
> --- a/platform/linux-generic/include/odp/api/plat/pool_types.h
> +++ b/platform/linux-generic/include/odp/api/plat/pool_types.h
> @@ -30,6 +30,8 @@ typedef ODP_HANDLE_T(odp_pool_t);
>   
>   #define ODP_POOL_INVALID _odp_cast_scalar(odp_pool_t, 0xffffffff)
>   
> +#define ODP_SOCKET_ID_ANY -1
> +
>   /**
>    * Pool type
>    */
> diff --git a/platform/linux-generic/odp_pool.c b/platform/linux-generic/odp_pool.c
> index f6fa8f5..15405d0 100644
> --- a/platform/linux-generic/odp_pool.c
> +++ b/platform/linux-generic/odp_pool.c
> @@ -696,4 +696,5 @@ odp_pool_t odp_buffer_pool(odp_buffer_t buf)
>   void odp_pool_param_init(odp_pool_param_t *params)
>   {
>   	memset(params, 0, sizeof(odp_pool_param_t));
> +	params->socket_id = ODP_SOCKET_ID_ANY;
>   }
> diff --git a/platform/linux-generic/odp_thread.c b/platform/linux-generic/odp_thread.c
> index 420e4eb..19c3d65 100644
> --- a/platform/linux-generic/odp_thread.c
> +++ b/platform/linux-generic/odp_thread.c
> @@ -16,6 +16,7 @@
>   #include <odp/api/shared_memory.h>
>   #include <odp/api/align.h>
>   #include <odp/api/cpu.h>
> +#include <odp/api/pool.h>
>   
>   #include <string.h>
>   #include <stdio.h>
> @@ -217,6 +218,16 @@ int odp_cpu_id(void)
>   	return this_thread->cpu;
>   }
>   
> +uint32_t odp_cpu_socket_id(void)
> +{
> +	return ODP_SOCKET_ID_ANY;
> +}
> +
> +uint32_t odp_cpu_socket_id_cpu(int cpu_id ODP_UNUSED)
> +{
> +	return ODP_SOCKET_ID_ANY;
is that ok that you return -1 in uint32_t ?

Maxim.
> +}
> +
>   int odp_thrmask_worker(odp_thrmask_t *mask)
>   {
>   	odp_thrmask_copy(mask, &thread_globals->worker);
Bill Fischofer March 24, 2016, 11:08 a.m. UTC | #2
#defines are untyped so it's just 0xffffffff.  I picked -1 because that's
the value DPDK uses. It can be changed if others would prefer that.

On Thu, Mar 24, 2016 at 3:55 AM, Maxim Uvarov <maxim.uvarov@linaro.org>
wrote:

> On 03/24/16 01:19, Bill Fischofer wrote:

>

>> Add default numa socket support including the functions

>> odp_cpu_socket_id() and odp_cpu_socket_id_cpu()

>>

>> Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>

>> ---

>>   platform/linux-generic/include/odp/api/plat/pool_types.h |  2 ++

>>   platform/linux-generic/odp_pool.c                        |  1 +

>>   platform/linux-generic/odp_thread.c                      | 11

>> +++++++++++

>>   3 files changed, 14 insertions(+)

>>

>> diff --git a/platform/linux-generic/include/odp/api/plat/pool_types.h

>> b/platform/linux-generic/include/odp/api/plat/pool_types.h

>> index 1ca8f02..8bbd6e1 100644

>> --- a/platform/linux-generic/include/odp/api/plat/pool_types.h

>> +++ b/platform/linux-generic/include/odp/api/plat/pool_types.h

>> @@ -30,6 +30,8 @@ typedef ODP_HANDLE_T(odp_pool_t);

>>     #define ODP_POOL_INVALID _odp_cast_scalar(odp_pool_t, 0xffffffff)

>>   +#define ODP_SOCKET_ID_ANY -1

>> +

>>   /**

>>    * Pool type

>>    */

>> diff --git a/platform/linux-generic/odp_pool.c

>> b/platform/linux-generic/odp_pool.c

>> index f6fa8f5..15405d0 100644

>> --- a/platform/linux-generic/odp_pool.c

>> +++ b/platform/linux-generic/odp_pool.c

>> @@ -696,4 +696,5 @@ odp_pool_t odp_buffer_pool(odp_buffer_t buf)

>>   void odp_pool_param_init(odp_pool_param_t *params)

>>   {

>>         memset(params, 0, sizeof(odp_pool_param_t));

>> +       params->socket_id = ODP_SOCKET_ID_ANY;

>>   }

>> diff --git a/platform/linux-generic/odp_thread.c

>> b/platform/linux-generic/odp_thread.c

>> index 420e4eb..19c3d65 100644

>> --- a/platform/linux-generic/odp_thread.c

>> +++ b/platform/linux-generic/odp_thread.c

>> @@ -16,6 +16,7 @@

>>   #include <odp/api/shared_memory.h>

>>   #include <odp/api/align.h>

>>   #include <odp/api/cpu.h>

>> +#include <odp/api/pool.h>

>>     #include <string.h>

>>   #include <stdio.h>

>> @@ -217,6 +218,16 @@ int odp_cpu_id(void)

>>         return this_thread->cpu;

>>   }

>>   +uint32_t odp_cpu_socket_id(void)

>> +{

>> +       return ODP_SOCKET_ID_ANY;

>> +}

>> +

>> +uint32_t odp_cpu_socket_id_cpu(int cpu_id ODP_UNUSED)

>> +{

>> +       return ODP_SOCKET_ID_ANY;

>>

> is that ok that you return -1 in uint32_t ?

>

> Maxim.

>

>> +}

>> +

>>   int odp_thrmask_worker(odp_thrmask_t *mask)

>>   {

>>         odp_thrmask_copy(mask, &thread_globals->worker);

>>

>

> _______________________________________________

> lng-odp mailing list

> lng-odp@lists.linaro.org

> https://lists.linaro.org/mailman/listinfo/lng-odp

>
diff mbox

Patch

diff --git a/platform/linux-generic/include/odp/api/plat/pool_types.h b/platform/linux-generic/include/odp/api/plat/pool_types.h
index 1ca8f02..8bbd6e1 100644
--- a/platform/linux-generic/include/odp/api/plat/pool_types.h
+++ b/platform/linux-generic/include/odp/api/plat/pool_types.h
@@ -30,6 +30,8 @@  typedef ODP_HANDLE_T(odp_pool_t);
 
 #define ODP_POOL_INVALID _odp_cast_scalar(odp_pool_t, 0xffffffff)
 
+#define ODP_SOCKET_ID_ANY -1
+
 /**
  * Pool type
  */
diff --git a/platform/linux-generic/odp_pool.c b/platform/linux-generic/odp_pool.c
index f6fa8f5..15405d0 100644
--- a/platform/linux-generic/odp_pool.c
+++ b/platform/linux-generic/odp_pool.c
@@ -696,4 +696,5 @@  odp_pool_t odp_buffer_pool(odp_buffer_t buf)
 void odp_pool_param_init(odp_pool_param_t *params)
 {
 	memset(params, 0, sizeof(odp_pool_param_t));
+	params->socket_id = ODP_SOCKET_ID_ANY;
 }
diff --git a/platform/linux-generic/odp_thread.c b/platform/linux-generic/odp_thread.c
index 420e4eb..19c3d65 100644
--- a/platform/linux-generic/odp_thread.c
+++ b/platform/linux-generic/odp_thread.c
@@ -16,6 +16,7 @@ 
 #include <odp/api/shared_memory.h>
 #include <odp/api/align.h>
 #include <odp/api/cpu.h>
+#include <odp/api/pool.h>
 
 #include <string.h>
 #include <stdio.h>
@@ -217,6 +218,16 @@  int odp_cpu_id(void)
 	return this_thread->cpu;
 }
 
+uint32_t odp_cpu_socket_id(void)
+{
+	return ODP_SOCKET_ID_ANY;
+}
+
+uint32_t odp_cpu_socket_id_cpu(int cpu_id ODP_UNUSED)
+{
+	return ODP_SOCKET_ID_ANY;
+}
+
 int odp_thrmask_worker(odp_thrmask_t *mask)
 {
 	odp_thrmask_copy(mask, &thread_globals->worker);