DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] eal: Clean up export of per_lcore__socket_id
@ 2015-02-25 14:34 Neil Horman
  2015-02-25 23:54 ` Liang, Cunming
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Neil Horman @ 2015-02-25 14:34 UTC (permalink / raw)
  To: dev

Theres no need to export this variable.  Its set and queried from an API call
that doesn't exist in the hot path.  Instead just export the rte_socket_id
symbol and make the variable private to protect it from type changes.  We should
do this with the other exported variables too, but I think its too late in the
release cycle to do that.

tested using distributor_autotest (which uses rte_socket_id), successfully.
Only tested on linux, as I don't currently have a bsd system spun up, but the
changes are symmetric, and should be fine

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
---
 lib/librte_eal/bsdapp/eal/eal_thread.c          | 5 +++++
 lib/librte_eal/bsdapp/eal/rte_eal_version.map   | 2 +-
 lib/librte_eal/common/eal_common_thread.c       | 2 ++
 lib/librte_eal/common/include/rte_lcore.h       | 7 +------
 lib/librte_eal/linuxapp/eal/eal_thread.c        | 5 +++++
 lib/librte_eal/linuxapp/eal/rte_eal_version.map | 2 +-
 6 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/lib/librte_eal/bsdapp/eal/eal_thread.c b/lib/librte_eal/bsdapp/eal/eal_thread.c
index ca95c72..5e6eea9 100644
--- a/lib/librte_eal/bsdapp/eal/eal_thread.c
+++ b/lib/librte_eal/bsdapp/eal/eal_thread.c
@@ -60,6 +60,11 @@ RTE_DEFINE_PER_LCORE(unsigned, _lcore_id) = LCORE_ID_ANY;
 RTE_DEFINE_PER_LCORE(unsigned, _socket_id) = (unsigned)SOCKET_ID_ANY;
 RTE_DEFINE_PER_LCORE(rte_cpuset_t, _cpuset);
 
+unsigned rte_socket_id(void)
+{
+	return RTE_PER_LCORE(_socket_id);
+}
+
 /*
  * Send a message to a slave lcore identified by slave_id to call a
  * function f with argument arg. Once the execution is done, the
diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
index 17515a9..d83524d 100644
--- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
@@ -10,7 +10,6 @@ DPDK_2.0 {
 	pci_driver_list;
 	per_lcore__lcore_id;
 	per_lcore__rte_errno;
-	per_lcore__socket_id;
 	rte_cpu_check_supported;
 	rte_cpu_get_flag_enabled;
 	rte_cycles_vmware_tsc_map;
@@ -82,6 +81,7 @@ DPDK_2.0 {
 	rte_set_log_level;
 	rte_set_log_type;
 	rte_snprintf;
+	rte_socket_id;
 	rte_strerror;
 	rte_strsplit;
 	rte_sys_gettid;
diff --git a/lib/librte_eal/common/eal_common_thread.c b/lib/librte_eal/common/eal_common_thread.c
index f4d9892..4010eab 100644
--- a/lib/librte_eal/common/eal_common_thread.c
+++ b/lib/librte_eal/common/eal_common_thread.c
@@ -46,6 +46,8 @@
 
 #include "eal_thread.h"
 
+RTE_DECLARE_PER_LCORE(unsigned , _socket_id);
+
 int eal_cpuset_socket_id(rte_cpuset_t *cpusetp)
 {
 	unsigned cpu = 0;
diff --git a/lib/librte_eal/common/include/rte_lcore.h b/lib/librte_eal/common/include/rte_lcore.h
index 20a58eb..e03264e 100644
--- a/lib/librte_eal/common/include/rte_lcore.h
+++ b/lib/librte_eal/common/include/rte_lcore.h
@@ -81,7 +81,6 @@ struct lcore_config {
 extern struct lcore_config lcore_config[RTE_MAX_LCORE];
 
 RTE_DECLARE_PER_LCORE(unsigned, _lcore_id);  /**< Per thread "lcore id". */
-RTE_DECLARE_PER_LCORE(unsigned, _socket_id); /**< Per thread "socket id". */
 RTE_DECLARE_PER_LCORE(rte_cpuset_t, _cpuset); /**< Per thread "cpuset". */
 
 /**
@@ -145,11 +144,7 @@ rte_lcore_index(int lcore_id)
  * @return
  *   the ID of current lcoreid's physical socket
  */
-static inline unsigned
-rte_socket_id(void)
-{
-	return RTE_PER_LCORE(_socket_id);
-}
+unsigned rte_socket_id(void);
 
 /**
  * Get the ID of the physical socket of the specified lcore
diff --git a/lib/librte_eal/linuxapp/eal/eal_thread.c b/lib/librte_eal/linuxapp/eal/eal_thread.c
index 5635c7d..9cacd86 100644
--- a/lib/librte_eal/linuxapp/eal/eal_thread.c
+++ b/lib/librte_eal/linuxapp/eal/eal_thread.c
@@ -60,6 +60,11 @@ RTE_DEFINE_PER_LCORE(unsigned, _lcore_id) = LCORE_ID_ANY;
 RTE_DEFINE_PER_LCORE(unsigned, _socket_id) = (unsigned)SOCKET_ID_ANY;
 RTE_DEFINE_PER_LCORE(rte_cpuset_t, _cpuset);
 
+unsigned rte_socket_id(void)
+{
+	return RTE_PER_LCORE(_socket_id);
+}
+
 /*
  * Send a message to a slave lcore identified by slave_id to call a
  * function f with argument arg. Once the execution is done, the
diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
index 17515a9..d83524d 100644
--- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
@@ -10,7 +10,6 @@ DPDK_2.0 {
 	pci_driver_list;
 	per_lcore__lcore_id;
 	per_lcore__rte_errno;
-	per_lcore__socket_id;
 	rte_cpu_check_supported;
 	rte_cpu_get_flag_enabled;
 	rte_cycles_vmware_tsc_map;
@@ -82,6 +81,7 @@ DPDK_2.0 {
 	rte_set_log_level;
 	rte_set_log_type;
 	rte_snprintf;
+	rte_socket_id;
 	rte_strerror;
 	rte_strsplit;
 	rte_sys_gettid;
-- 
2.1.0

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [dpdk-dev] [PATCH] eal: Clean up export of per_lcore__socket_id
  2015-02-25 14:34 [dpdk-dev] [PATCH] eal: Clean up export of per_lcore__socket_id Neil Horman
@ 2015-02-25 23:54 ` Liang, Cunming
  2015-02-26  0:42   ` Neil Horman
  2015-02-26 12:48 ` [dpdk-dev] [PATCH v2] " Neil Horman
  2015-02-27 12:33 ` [dpdk-dev] [PATCH v3] " Neil Horman
  2 siblings, 1 reply; 9+ messages in thread
From: Liang, Cunming @ 2015-02-25 23:54 UTC (permalink / raw)
  To: Neil Horman, dev

Hi Neil,

Thanks for the cleanup.
Does it better moving rte_socket_id() to eal_common_thread.c ?
As it simply returns _socket_id, it's not necessary to have two copy in both linux and bsd.

-Cunming

> -----Original Message-----
> From: Neil Horman [mailto:nhorman@tuxdriver.com]
> Sent: Wednesday, February 25, 2015 10:34 PM
> To: dev@dpdk.org
> Cc: thomas.monjalon@6wind.com; Liang, Cunming; Neil Horman
> Subject: [PATCH] eal: Clean up export of per_lcore__socket_id
> 
> Theres no need to export this variable.  Its set and queried from an API call
> that doesn't exist in the hot path.  Instead just export the rte_socket_id
> symbol and make the variable private to protect it from type changes.  We should
> do this with the other exported variables too, but I think its too late in the
> release cycle to do that.
> 
> tested using distributor_autotest (which uses rte_socket_id), successfully.
> Only tested on linux, as I don't currently have a bsd system spun up, but the
> changes are symmetric, and should be fine
> 
> Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
> ---
>  lib/librte_eal/bsdapp/eal/eal_thread.c          | 5 +++++
>  lib/librte_eal/bsdapp/eal/rte_eal_version.map   | 2 +-
>  lib/librte_eal/common/eal_common_thread.c       | 2 ++
>  lib/librte_eal/common/include/rte_lcore.h       | 7 +------
>  lib/librte_eal/linuxapp/eal/eal_thread.c        | 5 +++++
>  lib/librte_eal/linuxapp/eal/rte_eal_version.map | 2 +-
>  6 files changed, 15 insertions(+), 8 deletions(-)
> 
> diff --git a/lib/librte_eal/bsdapp/eal/eal_thread.c
> b/lib/librte_eal/bsdapp/eal/eal_thread.c
> index ca95c72..5e6eea9 100644
> --- a/lib/librte_eal/bsdapp/eal/eal_thread.c
> +++ b/lib/librte_eal/bsdapp/eal/eal_thread.c
> @@ -60,6 +60,11 @@ RTE_DEFINE_PER_LCORE(unsigned, _lcore_id) =
> LCORE_ID_ANY;
>  RTE_DEFINE_PER_LCORE(unsigned, _socket_id) = (unsigned)SOCKET_ID_ANY;
>  RTE_DEFINE_PER_LCORE(rte_cpuset_t, _cpuset);
> 
> +unsigned rte_socket_id(void)
> +{
> +	return RTE_PER_LCORE(_socket_id);
> +}
> +
>  /*
>   * Send a message to a slave lcore identified by slave_id to call a
>   * function f with argument arg. Once the execution is done, the
> diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map
> b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
> index 17515a9..d83524d 100644
> --- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map
> +++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
> @@ -10,7 +10,6 @@ DPDK_2.0 {
>  	pci_driver_list;
>  	per_lcore__lcore_id;
>  	per_lcore__rte_errno;
> -	per_lcore__socket_id;
>  	rte_cpu_check_supported;
>  	rte_cpu_get_flag_enabled;
>  	rte_cycles_vmware_tsc_map;
> @@ -82,6 +81,7 @@ DPDK_2.0 {
>  	rte_set_log_level;
>  	rte_set_log_type;
>  	rte_snprintf;
> +	rte_socket_id;
>  	rte_strerror;
>  	rte_strsplit;
>  	rte_sys_gettid;
> diff --git a/lib/librte_eal/common/eal_common_thread.c
> b/lib/librte_eal/common/eal_common_thread.c
> index f4d9892..4010eab 100644
> --- a/lib/librte_eal/common/eal_common_thread.c
> +++ b/lib/librte_eal/common/eal_common_thread.c
> @@ -46,6 +46,8 @@
> 
>  #include "eal_thread.h"
> 
> +RTE_DECLARE_PER_LCORE(unsigned , _socket_id);
> +
>  int eal_cpuset_socket_id(rte_cpuset_t *cpusetp)
>  {
>  	unsigned cpu = 0;
> diff --git a/lib/librte_eal/common/include/rte_lcore.h
> b/lib/librte_eal/common/include/rte_lcore.h
> index 20a58eb..e03264e 100644
> --- a/lib/librte_eal/common/include/rte_lcore.h
> +++ b/lib/librte_eal/common/include/rte_lcore.h
> @@ -81,7 +81,6 @@ struct lcore_config {
>  extern struct lcore_config lcore_config[RTE_MAX_LCORE];
> 
>  RTE_DECLARE_PER_LCORE(unsigned, _lcore_id);  /**< Per thread "lcore id". */
> -RTE_DECLARE_PER_LCORE(unsigned, _socket_id); /**< Per thread "socket id".
> */
>  RTE_DECLARE_PER_LCORE(rte_cpuset_t, _cpuset); /**< Per thread "cpuset". */
> 
>  /**
> @@ -145,11 +144,7 @@ rte_lcore_index(int lcore_id)
>   * @return
>   *   the ID of current lcoreid's physical socket
>   */
> -static inline unsigned
> -rte_socket_id(void)
> -{
> -	return RTE_PER_LCORE(_socket_id);
> -}
> +unsigned rte_socket_id(void);
> 
>  /**
>   * Get the ID of the physical socket of the specified lcore
> diff --git a/lib/librte_eal/linuxapp/eal/eal_thread.c
> b/lib/librte_eal/linuxapp/eal/eal_thread.c
> index 5635c7d..9cacd86 100644
> --- a/lib/librte_eal/linuxapp/eal/eal_thread.c
> +++ b/lib/librte_eal/linuxapp/eal/eal_thread.c
> @@ -60,6 +60,11 @@ RTE_DEFINE_PER_LCORE(unsigned, _lcore_id) =
> LCORE_ID_ANY;
>  RTE_DEFINE_PER_LCORE(unsigned, _socket_id) = (unsigned)SOCKET_ID_ANY;
>  RTE_DEFINE_PER_LCORE(rte_cpuset_t, _cpuset);
> 
> +unsigned rte_socket_id(void)
> +{
> +	return RTE_PER_LCORE(_socket_id);
> +}
> +
>  /*
>   * Send a message to a slave lcore identified by slave_id to call a
>   * function f with argument arg. Once the execution is done, the
> diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map
> b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
> index 17515a9..d83524d 100644
> --- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map
> +++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
> @@ -10,7 +10,6 @@ DPDK_2.0 {
>  	pci_driver_list;
>  	per_lcore__lcore_id;
>  	per_lcore__rte_errno;
> -	per_lcore__socket_id;
>  	rte_cpu_check_supported;
>  	rte_cpu_get_flag_enabled;
>  	rte_cycles_vmware_tsc_map;
> @@ -82,6 +81,7 @@ DPDK_2.0 {
>  	rte_set_log_level;
>  	rte_set_log_type;
>  	rte_snprintf;
> +	rte_socket_id;
>  	rte_strerror;
>  	rte_strsplit;
>  	rte_sys_gettid;
> --
> 2.1.0

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [dpdk-dev] [PATCH] eal: Clean up export of per_lcore__socket_id
  2015-02-25 23:54 ` Liang, Cunming
@ 2015-02-26  0:42   ` Neil Horman
  0 siblings, 0 replies; 9+ messages in thread
From: Neil Horman @ 2015-02-26  0:42 UTC (permalink / raw)
  To: Liang, Cunming; +Cc: dev

On Wed, Feb 25, 2015 at 11:54:51PM +0000, Liang, Cunming wrote:
> Hi Neil,
> 
> Thanks for the cleanup.
> Does it better moving rte_socket_id() to eal_common_thread.c ?
> As it simply returns _socket_id, it's not necessary to have two copy in both linux and bsd.
> 
> -Cunming
> 
Sure, I can respin this in the AM.
neil

> > -----Original Message-----
> > From: Neil Horman [mailto:nhorman@tuxdriver.com]
> > Sent: Wednesday, February 25, 2015 10:34 PM
> > To: dev@dpdk.org
> > Cc: thomas.monjalon@6wind.com; Liang, Cunming; Neil Horman
> > Subject: [PATCH] eal: Clean up export of per_lcore__socket_id
> > 
> > Theres no need to export this variable.  Its set and queried from an API call
> > that doesn't exist in the hot path.  Instead just export the rte_socket_id
> > symbol and make the variable private to protect it from type changes.  We should
> > do this with the other exported variables too, but I think its too late in the
> > release cycle to do that.
> > 
> > tested using distributor_autotest (which uses rte_socket_id), successfully.
> > Only tested on linux, as I don't currently have a bsd system spun up, but the
> > changes are symmetric, and should be fine
> > 
> > Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
> > ---
> >  lib/librte_eal/bsdapp/eal/eal_thread.c          | 5 +++++
> >  lib/librte_eal/bsdapp/eal/rte_eal_version.map   | 2 +-
> >  lib/librte_eal/common/eal_common_thread.c       | 2 ++
> >  lib/librte_eal/common/include/rte_lcore.h       | 7 +------
> >  lib/librte_eal/linuxapp/eal/eal_thread.c        | 5 +++++
> >  lib/librte_eal/linuxapp/eal/rte_eal_version.map | 2 +-
> >  6 files changed, 15 insertions(+), 8 deletions(-)
> > 
> > diff --git a/lib/librte_eal/bsdapp/eal/eal_thread.c
> > b/lib/librte_eal/bsdapp/eal/eal_thread.c
> > index ca95c72..5e6eea9 100644
> > --- a/lib/librte_eal/bsdapp/eal/eal_thread.c
> > +++ b/lib/librte_eal/bsdapp/eal/eal_thread.c
> > @@ -60,6 +60,11 @@ RTE_DEFINE_PER_LCORE(unsigned, _lcore_id) =
> > LCORE_ID_ANY;
> >  RTE_DEFINE_PER_LCORE(unsigned, _socket_id) = (unsigned)SOCKET_ID_ANY;
> >  RTE_DEFINE_PER_LCORE(rte_cpuset_t, _cpuset);
> > 
> > +unsigned rte_socket_id(void)
> > +{
> > +	return RTE_PER_LCORE(_socket_id);
> > +}
> > +
> >  /*
> >   * Send a message to a slave lcore identified by slave_id to call a
> >   * function f with argument arg. Once the execution is done, the
> > diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map
> > b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
> > index 17515a9..d83524d 100644
> > --- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map
> > +++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
> > @@ -10,7 +10,6 @@ DPDK_2.0 {
> >  	pci_driver_list;
> >  	per_lcore__lcore_id;
> >  	per_lcore__rte_errno;
> > -	per_lcore__socket_id;
> >  	rte_cpu_check_supported;
> >  	rte_cpu_get_flag_enabled;
> >  	rte_cycles_vmware_tsc_map;
> > @@ -82,6 +81,7 @@ DPDK_2.0 {
> >  	rte_set_log_level;
> >  	rte_set_log_type;
> >  	rte_snprintf;
> > +	rte_socket_id;
> >  	rte_strerror;
> >  	rte_strsplit;
> >  	rte_sys_gettid;
> > diff --git a/lib/librte_eal/common/eal_common_thread.c
> > b/lib/librte_eal/common/eal_common_thread.c
> > index f4d9892..4010eab 100644
> > --- a/lib/librte_eal/common/eal_common_thread.c
> > +++ b/lib/librte_eal/common/eal_common_thread.c
> > @@ -46,6 +46,8 @@
> > 
> >  #include "eal_thread.h"
> > 
> > +RTE_DECLARE_PER_LCORE(unsigned , _socket_id);
> > +
> >  int eal_cpuset_socket_id(rte_cpuset_t *cpusetp)
> >  {
> >  	unsigned cpu = 0;
> > diff --git a/lib/librte_eal/common/include/rte_lcore.h
> > b/lib/librte_eal/common/include/rte_lcore.h
> > index 20a58eb..e03264e 100644
> > --- a/lib/librte_eal/common/include/rte_lcore.h
> > +++ b/lib/librte_eal/common/include/rte_lcore.h
> > @@ -81,7 +81,6 @@ struct lcore_config {
> >  extern struct lcore_config lcore_config[RTE_MAX_LCORE];
> > 
> >  RTE_DECLARE_PER_LCORE(unsigned, _lcore_id);  /**< Per thread "lcore id". */
> > -RTE_DECLARE_PER_LCORE(unsigned, _socket_id); /**< Per thread "socket id".
> > */
> >  RTE_DECLARE_PER_LCORE(rte_cpuset_t, _cpuset); /**< Per thread "cpuset". */
> > 
> >  /**
> > @@ -145,11 +144,7 @@ rte_lcore_index(int lcore_id)
> >   * @return
> >   *   the ID of current lcoreid's physical socket
> >   */
> > -static inline unsigned
> > -rte_socket_id(void)
> > -{
> > -	return RTE_PER_LCORE(_socket_id);
> > -}
> > +unsigned rte_socket_id(void);
> > 
> >  /**
> >   * Get the ID of the physical socket of the specified lcore
> > diff --git a/lib/librte_eal/linuxapp/eal/eal_thread.c
> > b/lib/librte_eal/linuxapp/eal/eal_thread.c
> > index 5635c7d..9cacd86 100644
> > --- a/lib/librte_eal/linuxapp/eal/eal_thread.c
> > +++ b/lib/librte_eal/linuxapp/eal/eal_thread.c
> > @@ -60,6 +60,11 @@ RTE_DEFINE_PER_LCORE(unsigned, _lcore_id) =
> > LCORE_ID_ANY;
> >  RTE_DEFINE_PER_LCORE(unsigned, _socket_id) = (unsigned)SOCKET_ID_ANY;
> >  RTE_DEFINE_PER_LCORE(rte_cpuset_t, _cpuset);
> > 
> > +unsigned rte_socket_id(void)
> > +{
> > +	return RTE_PER_LCORE(_socket_id);
> > +}
> > +
> >  /*
> >   * Send a message to a slave lcore identified by slave_id to call a
> >   * function f with argument arg. Once the execution is done, the
> > diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map
> > b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
> > index 17515a9..d83524d 100644
> > --- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map
> > +++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
> > @@ -10,7 +10,6 @@ DPDK_2.0 {
> >  	pci_driver_list;
> >  	per_lcore__lcore_id;
> >  	per_lcore__rte_errno;
> > -	per_lcore__socket_id;
> >  	rte_cpu_check_supported;
> >  	rte_cpu_get_flag_enabled;
> >  	rte_cycles_vmware_tsc_map;
> > @@ -82,6 +81,7 @@ DPDK_2.0 {
> >  	rte_set_log_level;
> >  	rte_set_log_type;
> >  	rte_snprintf;
> > +	rte_socket_id;
> >  	rte_strerror;
> >  	rte_strsplit;
> >  	rte_sys_gettid;
> > --
> > 2.1.0
> 
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [dpdk-dev] [PATCH v2] eal: Clean up export of per_lcore__socket_id
  2015-02-25 14:34 [dpdk-dev] [PATCH] eal: Clean up export of per_lcore__socket_id Neil Horman
  2015-02-25 23:54 ` Liang, Cunming
@ 2015-02-26 12:48 ` Neil Horman
  2015-02-27  0:28   ` Liang, Cunming
  2015-02-27  6:22   ` David Marchand
  2015-02-27 12:33 ` [dpdk-dev] [PATCH v3] " Neil Horman
  2 siblings, 2 replies; 9+ messages in thread
From: Neil Horman @ 2015-02-26 12:48 UTC (permalink / raw)
  To: dev

Theres no need to export this variable.  Its set and queried from an API call
that doesn't exist in the hot path.  Instead just export the rte_socket_id
symbol and make the variable private to protect it from type changes.  We should
do this with the other exported variables too, but I think its too late in the
release cycle to do that.

tested using distributor_autotest (which uses rte_socket_id), successfully.
Only tested on linux, as I don't currently have a bsd system spun up, but the
changes are symmetric, and should be fine

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>

---
Change Notes:

v2) Moved rte_socket_id to be a common function
---
 lib/librte_eal/bsdapp/eal/eal_thread.c          | 1 -
 lib/librte_eal/bsdapp/eal/rte_eal_version.map   | 2 +-
 lib/librte_eal/common/eal_common_thread.c       | 7 +++++++
 lib/librte_eal/common/include/rte_lcore.h       | 7 +------
 lib/librte_eal/linuxapp/eal/eal_thread.c        | 1 -
 lib/librte_eal/linuxapp/eal/rte_eal_version.map | 2 +-
 6 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/lib/librte_eal/bsdapp/eal/eal_thread.c b/lib/librte_eal/bsdapp/eal/eal_thread.c
index ca95c72..3672cdb 100644
--- a/lib/librte_eal/bsdapp/eal/eal_thread.c
+++ b/lib/librte_eal/bsdapp/eal/eal_thread.c
@@ -59,7 +59,6 @@
 RTE_DEFINE_PER_LCORE(unsigned, _lcore_id) = LCORE_ID_ANY;
 RTE_DEFINE_PER_LCORE(unsigned, _socket_id) = (unsigned)SOCKET_ID_ANY;
 RTE_DEFINE_PER_LCORE(rte_cpuset_t, _cpuset);
-
 /*
  * Send a message to a slave lcore identified by slave_id to call a
  * function f with argument arg. Once the execution is done, the
diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
index 17515a9..d83524d 100644
--- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
@@ -10,7 +10,6 @@ DPDK_2.0 {
 	pci_driver_list;
 	per_lcore__lcore_id;
 	per_lcore__rte_errno;
-	per_lcore__socket_id;
 	rte_cpu_check_supported;
 	rte_cpu_get_flag_enabled;
 	rte_cycles_vmware_tsc_map;
@@ -82,6 +81,7 @@ DPDK_2.0 {
 	rte_set_log_level;
 	rte_set_log_type;
 	rte_snprintf;
+	rte_socket_id;
 	rte_strerror;
 	rte_strsplit;
 	rte_sys_gettid;
diff --git a/lib/librte_eal/common/eal_common_thread.c b/lib/librte_eal/common/eal_common_thread.c
index f4d9892..2405e93 100644
--- a/lib/librte_eal/common/eal_common_thread.c
+++ b/lib/librte_eal/common/eal_common_thread.c
@@ -46,6 +46,13 @@
 
 #include "eal_thread.h"
 
+RTE_DECLARE_PER_LCORE(unsigned , _socket_id);
+
+unsigned rte_socket_id(void)
+{
+	return RTE_PER_LCORE(_socket_id);
+}
+
 int eal_cpuset_socket_id(rte_cpuset_t *cpusetp)
 {
 	unsigned cpu = 0;
diff --git a/lib/librte_eal/common/include/rte_lcore.h b/lib/librte_eal/common/include/rte_lcore.h
index 20a58eb..e03264e 100644
--- a/lib/librte_eal/common/include/rte_lcore.h
+++ b/lib/librte_eal/common/include/rte_lcore.h
@@ -81,7 +81,6 @@ struct lcore_config {
 extern struct lcore_config lcore_config[RTE_MAX_LCORE];
 
 RTE_DECLARE_PER_LCORE(unsigned, _lcore_id);  /**< Per thread "lcore id". */
-RTE_DECLARE_PER_LCORE(unsigned, _socket_id); /**< Per thread "socket id". */
 RTE_DECLARE_PER_LCORE(rte_cpuset_t, _cpuset); /**< Per thread "cpuset". */
 
 /**
@@ -145,11 +144,7 @@ rte_lcore_index(int lcore_id)
  * @return
  *   the ID of current lcoreid's physical socket
  */
-static inline unsigned
-rte_socket_id(void)
-{
-	return RTE_PER_LCORE(_socket_id);
-}
+unsigned rte_socket_id(void);
 
 /**
  * Get the ID of the physical socket of the specified lcore
diff --git a/lib/librte_eal/linuxapp/eal/eal_thread.c b/lib/librte_eal/linuxapp/eal/eal_thread.c
index 5635c7d..65bcbe3 100644
--- a/lib/librte_eal/linuxapp/eal/eal_thread.c
+++ b/lib/librte_eal/linuxapp/eal/eal_thread.c
@@ -59,7 +59,6 @@
 RTE_DEFINE_PER_LCORE(unsigned, _lcore_id) = LCORE_ID_ANY;
 RTE_DEFINE_PER_LCORE(unsigned, _socket_id) = (unsigned)SOCKET_ID_ANY;
 RTE_DEFINE_PER_LCORE(rte_cpuset_t, _cpuset);
-
 /*
  * Send a message to a slave lcore identified by slave_id to call a
  * function f with argument arg. Once the execution is done, the
diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
index 17515a9..d83524d 100644
--- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
@@ -10,7 +10,6 @@ DPDK_2.0 {
 	pci_driver_list;
 	per_lcore__lcore_id;
 	per_lcore__rte_errno;
-	per_lcore__socket_id;
 	rte_cpu_check_supported;
 	rte_cpu_get_flag_enabled;
 	rte_cycles_vmware_tsc_map;
@@ -82,6 +81,7 @@ DPDK_2.0 {
 	rte_set_log_level;
 	rte_set_log_type;
 	rte_snprintf;
+	rte_socket_id;
 	rte_strerror;
 	rte_strsplit;
 	rte_sys_gettid;
-- 
2.1.0

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [dpdk-dev] [PATCH v2] eal: Clean up export of per_lcore__socket_id
  2015-02-26 12:48 ` [dpdk-dev] [PATCH v2] " Neil Horman
@ 2015-02-27  0:28   ` Liang, Cunming
  2015-02-27  6:22   ` David Marchand
  1 sibling, 0 replies; 9+ messages in thread
From: Liang, Cunming @ 2015-02-27  0:28 UTC (permalink / raw)
  To: Neil Horman, dev

Hi,

> -----Original Message-----
> From: Neil Horman [mailto:nhorman@tuxdriver.com]
> Sent: Thursday, February 26, 2015 8:48 PM
> To: dev@dpdk.org
> Cc: thomas.monjalon@6wind.com; Liang, Cunming; Neil Horman
> Subject: [PATCH v2] eal: Clean up export of per_lcore__socket_id
> 
> Theres no need to export this variable.  Its set and queried from an API call
> that doesn't exist in the hot path.  Instead just export the rte_socket_id
> symbol and make the variable private to protect it from type changes.  We should
> do this with the other exported variables too, but I think its too late in the
> release cycle to do that.
> 
> tested using distributor_autotest (which uses rte_socket_id), successfully.
> Only tested on linux, as I don't currently have a bsd system spun up, but the
> changes are symmetric, and should be fine
> 
> Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
> 
> ---
> Change Notes:
> 
> v2) Moved rte_socket_id to be a common function
> ---
>  lib/librte_eal/bsdapp/eal/eal_thread.c          | 1 -
>  lib/librte_eal/bsdapp/eal/rte_eal_version.map   | 2 +-
>  lib/librte_eal/common/eal_common_thread.c       | 7 +++++++
>  lib/librte_eal/common/include/rte_lcore.h       | 7 +------
>  lib/librte_eal/linuxapp/eal/eal_thread.c        | 1 -
>  lib/librte_eal/linuxapp/eal/rte_eal_version.map | 2 +-
>  6 files changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/lib/librte_eal/bsdapp/eal/eal_thread.c
> b/lib/librte_eal/bsdapp/eal/eal_thread.c
> index ca95c72..3672cdb 100644
> --- a/lib/librte_eal/bsdapp/eal/eal_thread.c
> +++ b/lib/librte_eal/bsdapp/eal/eal_thread.c
> @@ -59,7 +59,6 @@
>  RTE_DEFINE_PER_LCORE(unsigned, _lcore_id) = LCORE_ID_ANY;
>  RTE_DEFINE_PER_LCORE(unsigned, _socket_id) = (unsigned)SOCKET_ID_ANY;
>  RTE_DEFINE_PER_LCORE(rte_cpuset_t, _cpuset);
> -
>  /*
>   * Send a message to a slave lcore identified by slave_id to call a
>   * function f with argument arg. Once the execution is done, the
> diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map
> b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
> index 17515a9..d83524d 100644
> --- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map
> +++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
> @@ -10,7 +10,6 @@ DPDK_2.0 {
>  	pci_driver_list;
>  	per_lcore__lcore_id;
>  	per_lcore__rte_errno;
> -	per_lcore__socket_id;
>  	rte_cpu_check_supported;
>  	rte_cpu_get_flag_enabled;
>  	rte_cycles_vmware_tsc_map;
> @@ -82,6 +81,7 @@ DPDK_2.0 {
>  	rte_set_log_level;
>  	rte_set_log_type;
>  	rte_snprintf;
> +	rte_socket_id;
>  	rte_strerror;
>  	rte_strsplit;
>  	rte_sys_gettid;
> diff --git a/lib/librte_eal/common/eal_common_thread.c
> b/lib/librte_eal/common/eal_common_thread.c
> index f4d9892..2405e93 100644
> --- a/lib/librte_eal/common/eal_common_thread.c
> +++ b/lib/librte_eal/common/eal_common_thread.c
> @@ -46,6 +46,13 @@
> 
>  #include "eal_thread.h"
> 
> +RTE_DECLARE_PER_LCORE(unsigned , _socket_id);
> +
> +unsigned rte_socket_id(void)
> +{
> +	return RTE_PER_LCORE(_socket_id);
> +}
> +
>  int eal_cpuset_socket_id(rte_cpuset_t *cpusetp)
>  {
>  	unsigned cpu = 0;
> diff --git a/lib/librte_eal/common/include/rte_lcore.h
> b/lib/librte_eal/common/include/rte_lcore.h
> index 20a58eb..e03264e 100644
> --- a/lib/librte_eal/common/include/rte_lcore.h
> +++ b/lib/librte_eal/common/include/rte_lcore.h
> @@ -81,7 +81,6 @@ struct lcore_config {
>  extern struct lcore_config lcore_config[RTE_MAX_LCORE];
> 
>  RTE_DECLARE_PER_LCORE(unsigned, _lcore_id);  /**< Per thread "lcore id". */
> -RTE_DECLARE_PER_LCORE(unsigned, _socket_id); /**< Per thread "socket id".
> */
>  RTE_DECLARE_PER_LCORE(rte_cpuset_t, _cpuset); /**< Per thread "cpuset". */
> 
>  /**
> @@ -145,11 +144,7 @@ rte_lcore_index(int lcore_id)
>   * @return
>   *   the ID of current lcoreid's physical socket
>   */
> -static inline unsigned
> -rte_socket_id(void)
> -{
> -	return RTE_PER_LCORE(_socket_id);
> -}
> +unsigned rte_socket_id(void);
> 
>  /**
>   * Get the ID of the physical socket of the specified lcore
> diff --git a/lib/librte_eal/linuxapp/eal/eal_thread.c
> b/lib/librte_eal/linuxapp/eal/eal_thread.c
> index 5635c7d..65bcbe3 100644
> --- a/lib/librte_eal/linuxapp/eal/eal_thread.c
> +++ b/lib/librte_eal/linuxapp/eal/eal_thread.c
> @@ -59,7 +59,6 @@
>  RTE_DEFINE_PER_LCORE(unsigned, _lcore_id) = LCORE_ID_ANY;
>  RTE_DEFINE_PER_LCORE(unsigned, _socket_id) = (unsigned)SOCKET_ID_ANY;
>  RTE_DEFINE_PER_LCORE(rte_cpuset_t, _cpuset);
> -
>  /*
>   * Send a message to a slave lcore identified by slave_id to call a
>   * function f with argument arg. Once the execution is done, the
> diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map
> b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
> index 17515a9..d83524d 100644
> --- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map
> +++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
> @@ -10,7 +10,6 @@ DPDK_2.0 {
>  	pci_driver_list;
>  	per_lcore__lcore_id;
>  	per_lcore__rte_errno;
> -	per_lcore__socket_id;
>  	rte_cpu_check_supported;
>  	rte_cpu_get_flag_enabled;
>  	rte_cycles_vmware_tsc_map;
> @@ -82,6 +81,7 @@ DPDK_2.0 {
>  	rte_set_log_level;
>  	rte_set_log_type;
>  	rte_snprintf;
> +	rte_socket_id;
>  	rte_strerror;
>  	rte_strsplit;
>  	rte_sys_gettid;
> --
> 2.1.0

Acked-by:  Cunming Liang <cunming.liang@intel.com>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [dpdk-dev] [PATCH v2] eal: Clean up export of per_lcore__socket_id
  2015-02-26 12:48 ` [dpdk-dev] [PATCH v2] " Neil Horman
  2015-02-27  0:28   ` Liang, Cunming
@ 2015-02-27  6:22   ` David Marchand
  1 sibling, 0 replies; 9+ messages in thread
From: David Marchand @ 2015-02-27  6:22 UTC (permalink / raw)
  To: Neil Horman; +Cc: dev

Hello Neil,

On Thu, Feb 26, 2015 at 1:48 PM, Neil Horman <nhorman@tuxdriver.com> wrote:

> diff --git a/lib/librte_eal/bsdapp/eal/eal_thread.c
> b/lib/librte_eal/bsdapp/eal/eal_thread.c
> index ca95c72..3672cdb 100644
> --- a/lib/librte_eal/bsdapp/eal/eal_thread.c
> +++ b/lib/librte_eal/bsdapp/eal/eal_thread.c
> @@ -59,7 +59,6 @@
>  RTE_DEFINE_PER_LCORE(unsigned, _lcore_id) = LCORE_ID_ANY;
>  RTE_DEFINE_PER_LCORE(unsigned, _socket_id) = (unsigned)SOCKET_ID_ANY;
>  RTE_DEFINE_PER_LCORE(rte_cpuset_t, _cpuset);
> -
>  /*
>   * Send a message to a slave lcore identified by slave_id to call a
>   * function f with argument arg. Once the execution is done, the
>



> diff --git a/lib/librte_eal/linuxapp/eal/eal_thread.c
> b/lib/librte_eal/linuxapp/eal/eal_thread.c
> index 5635c7d..65bcbe3 100644
> --- a/lib/librte_eal/linuxapp/eal/eal_thread.c
> +++ b/lib/librte_eal/linuxapp/eal/eal_thread.c
> @@ -59,7 +59,6 @@
>  RTE_DEFINE_PER_LCORE(unsigned, _lcore_id) = LCORE_ID_ANY;
>  RTE_DEFINE_PER_LCORE(unsigned, _socket_id) = (unsigned)SOCKET_ID_ANY;
>  RTE_DEFINE_PER_LCORE(rte_cpuset_t, _cpuset);
> -
>  /*
>   * Send a message to a slave lcore identified by slave_id to call a
>   * function f with argument arg. Once the execution is done, the
>

Can you remove these two hunks ?
Then,
Acked-by: David Marchand <david.marchand@6wind.com>

-- 
David Marchand

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [dpdk-dev] [PATCH v3] eal: Clean up export of per_lcore__socket_id
  2015-02-25 14:34 [dpdk-dev] [PATCH] eal: Clean up export of per_lcore__socket_id Neil Horman
  2015-02-25 23:54 ` Liang, Cunming
  2015-02-26 12:48 ` [dpdk-dev] [PATCH v2] " Neil Horman
@ 2015-02-27 12:33 ` Neil Horman
  2015-02-28  1:51   ` Liang, Cunming
  2 siblings, 1 reply; 9+ messages in thread
From: Neil Horman @ 2015-02-27 12:33 UTC (permalink / raw)
  To: dev

Theres no need to export this variable.  Its set and queried from an API call
that doesn't exist in the hot path.  Instead just export the rte_socket_id
symbol and make the variable private to protect it from type changes.  We should
do this with the other exported variables too, but I think its too late in the
release cycle to do that.

tested using distributor_autotest (which uses rte_socket_id), successfully.
Only tested on linux, as I don't currently have a bsd system spun up, but the
changes are symmetric, and should be fine

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>

---
Change Notes:

v2) Moved rte_socket_id to be a common function

v3) replaced some previously removed spaces
---
 lib/librte_eal/bsdapp/eal/rte_eal_version.map   | 2 +-
 lib/librte_eal/common/eal_common_thread.c       | 7 +++++++
 lib/librte_eal/common/include/rte_lcore.h       | 7 +------
 lib/librte_eal/linuxapp/eal/rte_eal_version.map | 2 +-
 4 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
index 17515a9..d83524d 100644
--- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
@@ -10,7 +10,6 @@ DPDK_2.0 {
 	pci_driver_list;
 	per_lcore__lcore_id;
 	per_lcore__rte_errno;
-	per_lcore__socket_id;
 	rte_cpu_check_supported;
 	rte_cpu_get_flag_enabled;
 	rte_cycles_vmware_tsc_map;
@@ -82,6 +81,7 @@ DPDK_2.0 {
 	rte_set_log_level;
 	rte_set_log_type;
 	rte_snprintf;
+	rte_socket_id;
 	rte_strerror;
 	rte_strsplit;
 	rte_sys_gettid;
diff --git a/lib/librte_eal/common/eal_common_thread.c b/lib/librte_eal/common/eal_common_thread.c
index f4d9892..2405e93 100644
--- a/lib/librte_eal/common/eal_common_thread.c
+++ b/lib/librte_eal/common/eal_common_thread.c
@@ -46,6 +46,13 @@
 
 #include "eal_thread.h"
 
+RTE_DECLARE_PER_LCORE(unsigned , _socket_id);
+
+unsigned rte_socket_id(void)
+{
+	return RTE_PER_LCORE(_socket_id);
+}
+
 int eal_cpuset_socket_id(rte_cpuset_t *cpusetp)
 {
 	unsigned cpu = 0;
diff --git a/lib/librte_eal/common/include/rte_lcore.h b/lib/librte_eal/common/include/rte_lcore.h
index 20a58eb..e03264e 100644
--- a/lib/librte_eal/common/include/rte_lcore.h
+++ b/lib/librte_eal/common/include/rte_lcore.h
@@ -81,7 +81,6 @@ struct lcore_config {
 extern struct lcore_config lcore_config[RTE_MAX_LCORE];
 
 RTE_DECLARE_PER_LCORE(unsigned, _lcore_id);  /**< Per thread "lcore id". */
-RTE_DECLARE_PER_LCORE(unsigned, _socket_id); /**< Per thread "socket id". */
 RTE_DECLARE_PER_LCORE(rte_cpuset_t, _cpuset); /**< Per thread "cpuset". */
 
 /**
@@ -145,11 +144,7 @@ rte_lcore_index(int lcore_id)
  * @return
  *   the ID of current lcoreid's physical socket
  */
-static inline unsigned
-rte_socket_id(void)
-{
-	return RTE_PER_LCORE(_socket_id);
-}
+unsigned rte_socket_id(void);
 
 /**
  * Get the ID of the physical socket of the specified lcore
diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
index 17515a9..d83524d 100644
--- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map
+++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
@@ -10,7 +10,6 @@ DPDK_2.0 {
 	pci_driver_list;
 	per_lcore__lcore_id;
 	per_lcore__rte_errno;
-	per_lcore__socket_id;
 	rte_cpu_check_supported;
 	rte_cpu_get_flag_enabled;
 	rte_cycles_vmware_tsc_map;
@@ -82,6 +81,7 @@ DPDK_2.0 {
 	rte_set_log_level;
 	rte_set_log_type;
 	rte_snprintf;
+	rte_socket_id;
 	rte_strerror;
 	rte_strsplit;
 	rte_sys_gettid;
-- 
2.1.0

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [dpdk-dev] [PATCH v3] eal: Clean up export of per_lcore__socket_id
  2015-02-27 12:33 ` [dpdk-dev] [PATCH v3] " Neil Horman
@ 2015-02-28  1:51   ` Liang, Cunming
  2015-03-02 18:41     ` Thomas Monjalon
  0 siblings, 1 reply; 9+ messages in thread
From: Liang, Cunming @ 2015-02-28  1:51 UTC (permalink / raw)
  To: Neil Horman, dev

Hi,

> -----Original Message-----
> From: Neil Horman [mailto:nhorman@tuxdriver.com]
> Sent: Friday, February 27, 2015 8:33 PM
> To: dev@dpdk.org
> Cc: thomas.monjalon@6wind.com; Liang, Cunming; Neil Horman
> Subject: [PATCH v3] eal: Clean up export of per_lcore__socket_id
> 
> Theres no need to export this variable.  Its set and queried from an API call
> that doesn't exist in the hot path.  Instead just export the rte_socket_id
> symbol and make the variable private to protect it from type changes.  We should
> do this with the other exported variables too, but I think its too late in the
> release cycle to do that.
> 
> tested using distributor_autotest (which uses rte_socket_id), successfully.
> Only tested on linux, as I don't currently have a bsd system spun up, but the
> changes are symmetric, and should be fine
> 
> Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
> 
> ---
> Change Notes:
> 
> v2) Moved rte_socket_id to be a common function
> 
> v3) replaced some previously removed spaces
> ---
>  lib/librte_eal/bsdapp/eal/rte_eal_version.map   | 2 +-
>  lib/librte_eal/common/eal_common_thread.c       | 7 +++++++
>  lib/librte_eal/common/include/rte_lcore.h       | 7 +------
>  lib/librte_eal/linuxapp/eal/rte_eal_version.map | 2 +-
>  4 files changed, 10 insertions(+), 8 deletions(-)
> 
> diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map
> b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
> index 17515a9..d83524d 100644
> --- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map
> +++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map
> @@ -10,7 +10,6 @@ DPDK_2.0 {
>  	pci_driver_list;
>  	per_lcore__lcore_id;
>  	per_lcore__rte_errno;
> -	per_lcore__socket_id;
>  	rte_cpu_check_supported;
>  	rte_cpu_get_flag_enabled;
>  	rte_cycles_vmware_tsc_map;
> @@ -82,6 +81,7 @@ DPDK_2.0 {
>  	rte_set_log_level;
>  	rte_set_log_type;
>  	rte_snprintf;
> +	rte_socket_id;
>  	rte_strerror;
>  	rte_strsplit;
>  	rte_sys_gettid;
> diff --git a/lib/librte_eal/common/eal_common_thread.c
> b/lib/librte_eal/common/eal_common_thread.c
> index f4d9892..2405e93 100644
> --- a/lib/librte_eal/common/eal_common_thread.c
> +++ b/lib/librte_eal/common/eal_common_thread.c
> @@ -46,6 +46,13 @@
> 
>  #include "eal_thread.h"
> 
> +RTE_DECLARE_PER_LCORE(unsigned , _socket_id);
> +
> +unsigned rte_socket_id(void)
> +{
> +	return RTE_PER_LCORE(_socket_id);
> +}
> +
>  int eal_cpuset_socket_id(rte_cpuset_t *cpusetp)
>  {
>  	unsigned cpu = 0;
> diff --git a/lib/librte_eal/common/include/rte_lcore.h
> b/lib/librte_eal/common/include/rte_lcore.h
> index 20a58eb..e03264e 100644
> --- a/lib/librte_eal/common/include/rte_lcore.h
> +++ b/lib/librte_eal/common/include/rte_lcore.h
> @@ -81,7 +81,6 @@ struct lcore_config {
>  extern struct lcore_config lcore_config[RTE_MAX_LCORE];
> 
>  RTE_DECLARE_PER_LCORE(unsigned, _lcore_id);  /**< Per thread "lcore id". */
> -RTE_DECLARE_PER_LCORE(unsigned, _socket_id); /**< Per thread "socket id".
> */
>  RTE_DECLARE_PER_LCORE(rte_cpuset_t, _cpuset); /**< Per thread "cpuset". */
> 
>  /**
> @@ -145,11 +144,7 @@ rte_lcore_index(int lcore_id)
>   * @return
>   *   the ID of current lcoreid's physical socket
>   */
> -static inline unsigned
> -rte_socket_id(void)
> -{
> -	return RTE_PER_LCORE(_socket_id);
> -}
> +unsigned rte_socket_id(void);
> 
>  /**
>   * Get the ID of the physical socket of the specified lcore
> diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map
> b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
> index 17515a9..d83524d 100644
> --- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map
> +++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map
> @@ -10,7 +10,6 @@ DPDK_2.0 {
>  	pci_driver_list;
>  	per_lcore__lcore_id;
>  	per_lcore__rte_errno;
> -	per_lcore__socket_id;
>  	rte_cpu_check_supported;
>  	rte_cpu_get_flag_enabled;
>  	rte_cycles_vmware_tsc_map;
> @@ -82,6 +81,7 @@ DPDK_2.0 {
>  	rte_set_log_level;
>  	rte_set_log_type;
>  	rte_snprintf;
> +	rte_socket_id;
>  	rte_strerror;
>  	rte_strsplit;
>  	rte_sys_gettid;
> --
> 2.1.0

Acked-by:  Cunming Liang <cunming.liang@intel.com>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [dpdk-dev] [PATCH v3] eal: Clean up export of per_lcore__socket_id
  2015-02-28  1:51   ` Liang, Cunming
@ 2015-03-02 18:41     ` Thomas Monjalon
  0 siblings, 0 replies; 9+ messages in thread
From: Thomas Monjalon @ 2015-03-02 18:41 UTC (permalink / raw)
  To: Neil Horman; +Cc: dev

> > Theres no need to export this variable.  Its set and queried from an API call
> > that doesn't exist in the hot path.  Instead just export the rte_socket_id
> > symbol and make the variable private to protect it from type changes.  We should
> > do this with the other exported variables too, but I think its too late in the
> > release cycle to do that.
> > 
> > tested using distributor_autotest (which uses rte_socket_id), successfully.
> > Only tested on linux, as I don't currently have a bsd system spun up, but the
> > changes are symmetric, and should be fine
> > 
> > Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
> 
> Acked-by:  Cunming Liang <cunming.liang@intel.com>

Applied, thanks

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-03-02 18:42 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-25 14:34 [dpdk-dev] [PATCH] eal: Clean up export of per_lcore__socket_id Neil Horman
2015-02-25 23:54 ` Liang, Cunming
2015-02-26  0:42   ` Neil Horman
2015-02-26 12:48 ` [dpdk-dev] [PATCH v2] " Neil Horman
2015-02-27  0:28   ` Liang, Cunming
2015-02-27  6:22   ` David Marchand
2015-02-27 12:33 ` [dpdk-dev] [PATCH v3] " Neil Horman
2015-02-28  1:51   ` Liang, Cunming
2015-03-02 18:41     ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).