EAL Thread TLS API enhancements
v2 cover EAL Thread TLS API enhancements
Enhancements to the TLS API.
---
v2: Rename key to avoid redundancy[MortenB].
---
Tal Shnaiderman (2):
eal: error number enhancement for thread TLS API
eal: rename key opaque pointer in TLS API
drivers/net/mlx5/linux/mlx5_flow_os.c | 2 +- drivers/net/mlx5/windows/mlx5_flow_os.c | 2 +- lib/librte_eal/include/rte_thread.h | 19 ++++++++++--------- lib/librte_eal/unix/rte_thread.c | 14 ++++++++++---- lib/librte_eal/windows/rte_thread.c | 16 +++++++++++----- 5 files changed, 33 insertions(+), 20 deletions(-)
Signature · 1 line
2.16.1.windows.4
PATCH v2 1/2 eal: error number enhancement for thread TLS API
add error number reporting to rte_errno in all
functions in the rte_thread_tls_* API.
--- lib/librte_eal/include/rte_thread.h | 6 +++--- lib/librte_eal/unix/rte_thread.c | 6 ++++++ lib/librte_eal/windows/rte_thread.c | 8 +++++++- 3 files changed, 16 insertions(+), 4 deletions(-)
lib/librte_eal/include/rte_thread.h +3 -3
@@ -59,7 +59,7 @@ void rte_thread_get_affinity(rte_cpuset_t *cpusetp);* * @return * On success, zero. -* On failure, a negative number. +* On failure, a negative number and an error number is set in rte_errno. */ __rte_experimental
@@ -73,7 +73,7 @@ int rte_thread_tls_key_create(rte_tls_key *key, void (*destructor)(void *));* * @return * On success, zero. -* On failure, a negative number. +* On failure, a negative number and an error number is set in rte_errno. */ __rte_experimental int rte_thread_tls_key_delete(rte_tls_key key);
@@ -88,7 +88,7 @@ int rte_thread_tls_key_delete(rte_tls_key key);* * @return * On success, zero. -* On failure, a negative number. +* On failure, a negative number and an error number is set in rte_errno. */ __rte_experimental int rte_thread_tls_value_set(rte_tls_key key, const void *value);
lib/librte_eal/unix/rte_thread.c +6 -0
@@ -24,6 +24,7 @@ rte_thread_tls_key_create(rte_tls_key *key, void (*destructor)(void *)) *key =malloc (sizeof (**key));if ((*key) ==NULL ) {RTE_LOG (DEBUG ,EAL ,"Cannot allocate TLS key.\n" ); + rte_errno =ENOMEM ;return -1 ; } err =pthread_key_create (&((*key)->thread_index), destructor);
@@ -31,6 +32,7 @@ rte_thread_tls_key_create(rte_tls_key *key, void (*destructor)(void *))RTE_LOG (DEBUG ,EAL ,"pthread_key_create failed: %s\n" ,strerror (err));free (*key); + rte_errno = err;return -1 ; }return 0 ;
@@ -43,6 +45,7 @@ rte_thread_tls_key_delete(rte_tls_key key)if (!key) {RTE_LOG (DEBUG ,EAL ,"Invalid TLS key.\n" ); + rte_errno =EINVAL ;return -1 ; } err =pthread_key_delete (key->thread_index);
@@ -50,6 +53,7 @@ rte_thread_tls_key_delete(rte_tls_key key)RTE_LOG (DEBUG ,EAL ,"pthread_key_delete failed: %s\n" ,strerror (err));free (key); + rte_errno = err;return -1 ; }free (key);
@@ -63,12 +67,14 @@ rte_thread_tls_value_set(rte_tls_key key, const void *value)if (!key) {RTE_LOG (DEBUG ,EAL ,"Invalid TLS key.\n" ); + rte_errno =EINVAL ;return -1 ; } err =pthread_setspecific (key->thread_index, value);if (err) {RTE_LOG (DEBUG ,EAL ,"pthread_setspecific failed: %s\n" ,strerror (err)); + rte_errno = err;return -1 ; }return 0 ;
lib/librte_eal/windows/rte_thread.c +7 -1
@@ -18,12 +18,14 @@ rte_thread_tls_key_create(rte_tls_key *key, *key =malloc (sizeof (**key));if ((*key) ==NULL ) {RTE_LOG (DEBUG ,EAL ,"Cannot allocate TLS key.\n" ); + rte_errno =ENOMEM ;return -1 ; } (*key)->thread_index =TlsAlloc ();if ((*key)->thread_index ==TLS_OUT_OF_INDEXES ) {RTE_LOG_WIN32_ERR ("TlsAlloc()" );free (*key); + rte_errno =GetLastError ();return -1 ; }return 0 ;
@@ -34,11 +36,13 @@ rte_thread_tls_key_delete(rte_tls_key key) {if (!key) {RTE_LOG (DEBUG ,EAL ,"Invalid TLS key.\n" ); + rte_errno =EINVAL ;return -1 ; }if (!TlsFree (key->thread_index)) {RTE_LOG_WIN32_ERR ("TlsFree()" );free (key); + rte_errno =GetLastError ();return -1 ; }free (key);
@@ -52,12 +56,14 @@ rte_thread_tls_value_set(rte_tls_key key, const void *value)if (!key) {RTE_LOG (DEBUG ,EAL ,"Invalid TLS key.\n" ); + rte_errno =EINVAL ;return -1 ; }/* discard const qualifier */ p = (char *) (uintptr_t ) value;if (!TlsSetValue (key->thread_index, p)) {RTE_LOG_WIN32_ERR ("TlsSetValue()" ); + rte_errno =GetLastError ();return -1 ; }return 0 ;
@@ -76,7 +82,7 @@ rte_thread_tls_value_get(rte_tls_key key) output =TlsGetValue (key->thread_index);if (GetLastError () !=ERROR_SUCCESS ) {RTE_LOG_WIN32_ERR ("TlsGetValue()" ); - rte_errno =ENOEXEC ; + rte_errno =GetLastError ();return NULL ; }return output;
Signature · 1 line
2.16.1.windows.4
Re: [dpdk-dev] [PATCH v2 1/2] eal: error number enhancement for thread TLS API
2021-03-02 17:26, Tal Shnaiderman:
Quoted 10 lines
add error number reporting to
rte_errnoin all
functions in the rte_thread_tls_* API.Suggested-by Anatoly Burakov <[email protected]>Signed-off-by Tal Shnaiderman <[email protected]>--- lib/librte_eal/include/rte_thread.h | 6 +++--- lib/librte_eal/unix/rte_thread.c | 6 ++++++ lib/librte_eal/windows/rte_thread.c | 8 +++++++- 3 files changed, 16 insertions(+), 4 deletions(-)
Using OS error codes for rte_errno isn't the right thing to do: this way callers cannot write a portable check of rte_thread_*() result. Consider returning some suitable stable values. OS-specific error info can be logged at debug level, as it is already is some places.
Re: [dpdk-dev] [PATCH v2 1/2] eal: error number enhancement for thread TLS API
Quoted 18 lines
Subject: Re: [PATCH v2 1/2] eal: error number enhancement for thread TLS API
External email: Use caution opening links or attachments
2021-03-02 17:26, Tal Shnaiderman:
Quoted 10 lines
add error number reporting to
rte_errnoin all functions in the rte_thread_tls_* API.Suggested-by Anatoly Burakov <[email protected]>Signed-off-by Tal Shnaiderman <[email protected]>--- lib/librte_eal/include/rte_thread.h | 6 +++--- lib/librte_eal/unix/rte_thread.c | 6 ++++++ lib/librte_eal/windows/rte_thread.c | 8 +++++++- 3 files changed, 16 insertions(+), 4 deletions(-)
Quoted 4 lines
Using OS error codes for
rte_errnoisn't the right thing to do: this way callers cannot write a portable check of rte_thread_*() result. Consider returning some suitable stable values. OS-specific error info can be logged at debug level, as it is already is some places.
In Linux the error codes return are not OS specific (namely EAGAIN, ENOMEM and EINVAL).
The problem is that documentation on Windows doesn't publish which error code can be returned from GetLastError() for the TLS functions.
Or do we want to use the same errno for both OSs in case the functions fail regardless to the failure reason?
Re: [dpdk-dev] [PATCH v2 1/2] eal: error number enhancement for thread TLS API
2021-03-03 10:37, Tal Shnaiderman:
Quoted 23 lines
Quoted 18 lines
Subject: Re: [PATCH v2 1/2] eal: error number enhancement for thread TLS API
External email: Use caution opening links or attachments
2021-03-02 17:26, Tal Shnaiderman:
Quoted 10 lines
add error number reporting to
rte_errnoin all functions in the rte_thread_tls_* API.Suggested-by Anatoly Burakov <[email protected]>Signed-off-by Tal Shnaiderman <[email protected]>--- lib/librte_eal/include/rte_thread.h | 6 +++--- lib/librte_eal/unix/rte_thread.c | 6 ++++++ lib/librte_eal/windows/rte_thread.c | 8 +++++++- 3 files changed, 16 insertions(+), 4 deletions(-)Quoted 4 lines
Using OS error codes for
rte_errnoisn't the right thing to do: this way callers cannot write a portable check of rte_thread_*() result. Consider returning some suitable stable values. OS-specific error info can be logged at debug level, as it is already is some places.
Quoted 5 lines
In Linux the error codes return are not OS specific (namely EAGAIN, ENOMEM and EINVAL).
The problem is that documentation on Windows doesn't publish which error code can be returned from
GetLastError()for the TLS functions.Or do we want to use the same errno for both OSs in case the functions fail regardless to the failure reason?
Yes, so that callers know which codes to check against regardless of the OS.
Re: [dpdk-dev] [PATCH v2 1/2] eal: error number enhancement for thread TLS API
Quoted 33 lines
Subject: Re: [PATCH v2 1/2] eal: error number enhancement for thread TLS API
External email: Use caution opening links or attachments
2021-03-03 10:37, Tal Shnaiderman:
Quoted 18 lines
Quoted 18 lines
Subject: Re: [PATCH v2 1/2] eal: error number enhancement for thread TLS API
External email: Use caution opening links or attachments
2021-03-02 17:26, Tal Shnaiderman:
Quoted 10 lines
add error number reporting to
rte_errnoin all functions in the rte_thread_tls_* API.Suggested-by Anatoly Burakov <[email protected]>Signed-off-by Tal Shnaiderman <[email protected]>--- lib/librte_eal/include/rte_thread.h | 6 +++--- lib/librte_eal/unix/rte_thread.c | 6 ++++++ lib/librte_eal/windows/rte_thread.c | 8 +++++++- 3 files changed, 16 insertions(+), 4 deletions(-)Quoted 6 lines
Quoted 4 lines
Using OS error codes for
rte_errnoisn't the right thing to do: this way callers cannot write a portable check of rte_thread_*() result. Consider returning some suitable stable values. OS-specific error info can be logged at debug level, as it is already is some places.In Linux the error codes return are not OS specific (namely EAGAIN,
ENOMEM and EINVAL).
Quoted 1 line
Quoted 7 lines
Quoted 1 line
The problem is that documentation on Windows doesn't publish which
error code can be returned from
GetLastError()for the TLS functions.Quoted 2 lines
Or do we want to use the same errno for both OSs in case the functions fail
regardless to the failure reason?
Yes, so that callers know which codes to check against regardless of the OS.
This is different from Anatoly's original suggestion that values would be potentially different on different OS's.
Anatoly, is the approach suggested by Dmitry fine with you?
v3 cover EAL Thread TLS API enhancements
In reply to Tal Shnaiderman---
v3: -Unify rte_errno values to a generic errno for OS compatibility [DmitryK]
-Rename the TLS function to avoid redundancy[MortenB].
v2: Rename key to avoid redundancy[MortenB].
---
Tal Shnaiderman (2):
eal: error number enhancement for thread TLS API
eal: rename key opaque pointer and functions in TLS API
drivers/net/mlx5/linux/mlx5_flow_os.c | 10 +++++----- drivers/net/mlx5/windows/mlx5_flow_os.c | 12 ++++++------ lib/librte_eal/include/rte_thread.h | 33 +++++++++++++++++++++------------ lib/librte_eal/rte_eal_exports.def | 8 ++++---- lib/librte_eal/unix/rte_thread.c | 14 ++++++++++---- lib/librte_eal/version.map | 8 ++++---- lib/librte_eal/windows/rte_thread.c | 16 +++++++++++----- 7 files changed, 61 insertions(+), 40 deletions(-)
Signature · 1 line
2.16.1.windows.4
PATCH v3 1/2 eal: error number enhancement for thread TLS API
add error number reporting to rte_errno in all
functions in the rte_thread_tls_* API.
--- lib/librte_eal/include/rte_thread.h | 14 +++++++++++--- lib/librte_eal/unix/rte_thread.c | 6 ++++++ lib/librte_eal/windows/rte_thread.c | 8 +++++++- 3 files changed, 24 insertions(+), 4 deletions(-)
lib/librte_eal/include/rte_thread.h +11 -3
@@ -59,7 +59,9 @@ void rte_thread_get_affinity(rte_cpuset_t *cpusetp);* * @return * On success, zero. -* On failure, a negative number. +* On failure, a negative number and an error number is set in rte_errno. +* rte_errno can be set to: ENOMEM - Memory allocation error. +* EOTHER - Specific OS error. */ __rte_experimental
@@ -73,7 +75,9 @@ int rte_thread_tls_key_create(rte_tls_key *key, void (*destructor)(void *));* * @return * On success, zero. -* On failure, a negative number. +* On failure, a negative number and an error number is set in rte_errno. +* rte_errno can be set to: EINVAL - Invalid parameter passed. +* EOTHER - Specific OS error. */ __rte_experimental int rte_thread_tls_key_delete(rte_tls_key key);
@@ -88,7 +92,9 @@ int rte_thread_tls_key_delete(rte_tls_key key);* * @return * On success, zero. -* On failure, a negative number. +* On failure, a negative number and an error number is set in rte_errno. +* rte_errno can be set to: EINVAL - Invalid parameter passed. +* EOTHER - Specific OS error. */ __rte_experimental int rte_thread_tls_value_set(rte_tls_key key, const void *value);
@@ -102,6 +108,8 @@ int rte_thread_tls_value_set(rte_tls_key key, const void *value);* @return * On success, value data pointer (can also be NULL). * On failure, NULL and an error number is set in rte_errno. +* rte_errno can be set to: EINVAL - Invalid parameter passed. +* EOTHER - Specific OS error. */ __rte_experimental void *rte_thread_tls_value_get(rte_tls_key key);
lib/librte_eal/unix/rte_thread.c +6 -0
@@ -24,6 +24,7 @@ rte_thread_tls_key_create(rte_tls_key *key, void (*destructor)(void *)) *key =malloc (sizeof (**key));if ((*key) ==NULL ) {RTE_LOG (DEBUG ,EAL ,"Cannot allocate TLS key.\n" ); + rte_errno =ENOMEM ;return -1 ; } err =pthread_key_create (&((*key)->thread_index), destructor);
@@ -31,6 +32,7 @@ rte_thread_tls_key_create(rte_tls_key *key, void (*destructor)(void *))RTE_LOG (DEBUG ,EAL ,"pthread_key_create failed: %s\n" ,strerror (err));free (*key); + rte_errno =EOTHER ;return -1 ; }return 0 ;
@@ -43,6 +45,7 @@ rte_thread_tls_key_delete(rte_tls_key key)if (!key) {RTE_LOG (DEBUG ,EAL ,"Invalid TLS key.\n" ); + rte_errno =EINVAL ;return -1 ; } err =pthread_key_delete (key->thread_index);
@@ -50,6 +53,7 @@ rte_thread_tls_key_delete(rte_tls_key key)RTE_LOG (DEBUG ,EAL ,"pthread_key_delete failed: %s\n" ,strerror (err));free (key); + rte_errno =EOTHER ;return -1 ; }free (key);
@@ -63,12 +67,14 @@ rte_thread_tls_value_set(rte_tls_key key, const void *value)if (!key) {RTE_LOG (DEBUG ,EAL ,"Invalid TLS key.\n" ); + rte_errno =EINVAL ;return -1 ; } err =pthread_setspecific (key->thread_index, value);if (err) {RTE_LOG (DEBUG ,EAL ,"pthread_setspecific failed: %s\n" ,strerror (err)); + rte_errno =EOTHER ;return -1 ; }return 0 ;
lib/librte_eal/windows/rte_thread.c +7 -1
@@ -18,12 +18,14 @@ rte_thread_tls_key_create(rte_tls_key *key, *key =malloc (sizeof (**key));if ((*key) ==NULL ) {RTE_LOG (DEBUG ,EAL ,"Cannot allocate TLS key.\n" ); + rte_errno =ENOMEM ;return -1 ; } (*key)->thread_index =TlsAlloc ();if ((*key)->thread_index ==TLS_OUT_OF_INDEXES ) {RTE_LOG_WIN32_ERR ("TlsAlloc()" );free (*key); + rte_errno =EOTHER ;return -1 ; }return 0 ;
@@ -34,11 +36,13 @@ rte_thread_tls_key_delete(rte_tls_key key) {if (!key) {RTE_LOG (DEBUG ,EAL ,"Invalid TLS key.\n" ); + rte_errno =EINVAL ;return -1 ; }if (!TlsFree (key->thread_index)) {RTE_LOG_WIN32_ERR ("TlsFree()" );free (key); + rte_errno =EOTHER ;return -1 ; }free (key);
@@ -52,12 +56,14 @@ rte_thread_tls_value_set(rte_tls_key key, const void *value)if (!key) {RTE_LOG (DEBUG ,EAL ,"Invalid TLS key.\n" ); + rte_errno =EINVAL ;return -1 ; }/* discard const qualifier */ p = (char *) (uintptr_t ) value;if (!TlsSetValue (key->thread_index, p)) {RTE_LOG_WIN32_ERR ("TlsSetValue()" ); + rte_errno =EOTHER ;return -1 ; }return 0 ;
@@ -76,7 +82,7 @@ rte_thread_tls_value_get(rte_tls_key key) output =TlsGetValue (key->thread_index);if (GetLastError () !=ERROR_SUCCESS ) {RTE_LOG_WIN32_ERR ("TlsGetValue()" ); - rte_errno =ENOEXEC ; + rte_errno =EOTHER ;return NULL ; }return output;
Signature · 1 line
2.16.1.windows.4
v4 cover EAL Thread TLS API enhancements
---
v4: replace errno EOTHER with ENOEXEC as EOTHER is undefined in unix.
v3: -Unify rte_errno values to a generic errno for OS compatibility [DmitryK]
-Rename the TLS function to avoid redundancy[MortenB].
v2: Rename key to avoid redundancy[MortenB].
---
Tal Shnaiderman (2):
eal: error number enhancement for thread TLS API
eal: rename key opaque pointer and functions in TLS API
drivers/net/mlx5/linux/mlx5_flow_os.c | 10 +++++----- drivers/net/mlx5/windows/mlx5_flow_os.c | 12 ++++++------ lib/librte_eal/include/rte_thread.h | 33 +++++++++++++++++++++------------ lib/librte_eal/rte_eal_exports.def | 8 ++++---- lib/librte_eal/unix/rte_thread.c | 14 ++++++++++---- lib/librte_eal/version.map | 8 ++++---- lib/librte_eal/windows/rte_thread.c | 14 ++++++++++---- 7 files changed, 60 insertions(+), 39 deletions(-)
Signature · 1 line
2.16.1.windows.4
PATCH v4 1/2 eal: error number enhancement for thread TLS API
add error number reporting to rte_errno in all
functions in the rte_thread_tls_* API.
--- lib/librte_eal/include/rte_thread.h | 14 +++++++++++--- lib/librte_eal/unix/rte_thread.c | 6 ++++++ lib/librte_eal/windows/rte_thread.c | 6 ++++++ 3 files changed, 23 insertions(+), 3 deletions(-)
lib/librte_eal/include/rte_thread.h +11 -3
@@ -59,7 +59,9 @@ void rte_thread_get_affinity(rte_cpuset_t *cpusetp);* * @return * On success, zero. -* On failure, a negative number. +* On failure, a negative number and an error number is set in rte_errno. +* rte_errno can be set to: ENOMEM - Memory allocation error. +* ENOEXEC - Specific OS error. */ __rte_experimental
@@ -73,7 +75,9 @@ int rte_thread_tls_key_create(rte_tls_key *key, void (*destructor)(void *));* * @return * On success, zero. -* On failure, a negative number. +* On failure, a negative number and an error number is set in rte_errno. +* rte_errno can be set to: EINVAL - Invalid parameter passed. +* ENOEXEC - Specific OS error. */ __rte_experimental int rte_thread_tls_key_delete(rte_tls_key key);
@@ -88,7 +92,9 @@ int rte_thread_tls_key_delete(rte_tls_key key);* * @return * On success, zero. -* On failure, a negative number. +* On failure, a negative number and an error number is set in rte_errno. +* rte_errno can be set to: EINVAL - Invalid parameter passed. +* ENOEXEC - Specific OS error. */ __rte_experimental int rte_thread_tls_value_set(rte_tls_key key, const void *value);
@@ -102,6 +108,8 @@ int rte_thread_tls_value_set(rte_tls_key key, const void *value);* @return * On success, value data pointer (can also be NULL). * On failure, NULL and an error number is set in rte_errno. +* rte_errno can be set to: EINVAL - Invalid parameter passed. +* ENOEXEC - Specific OS error. */ __rte_experimental void *rte_thread_tls_value_get(rte_tls_key key);
lib/librte_eal/unix/rte_thread.c +6 -0
@@ -24,6 +24,7 @@ rte_thread_tls_key_create(rte_tls_key *key, void (*destructor)(void *)) *key =malloc (sizeof (**key));if ((*key) ==NULL ) {RTE_LOG (DEBUG ,EAL ,"Cannot allocate TLS key.\n" ); + rte_errno =ENOMEM ;return -1 ; } err =pthread_key_create (&((*key)->thread_index), destructor);
@@ -31,6 +32,7 @@ rte_thread_tls_key_create(rte_tls_key *key, void (*destructor)(void *))RTE_LOG (DEBUG ,EAL ,"pthread_key_create failed: %s\n" ,strerror (err));free (*key); + rte_errno =ENOEXEC ;return -1 ; }return 0 ;
@@ -43,6 +45,7 @@ rte_thread_tls_key_delete(rte_tls_key key)if (!key) {RTE_LOG (DEBUG ,EAL ,"Invalid TLS key.\n" ); + rte_errno =EINVAL ;return -1 ; } err =pthread_key_delete (key->thread_index);
@@ -50,6 +53,7 @@ rte_thread_tls_key_delete(rte_tls_key key)RTE_LOG (DEBUG ,EAL ,"pthread_key_delete failed: %s\n" ,strerror (err));free (key); + rte_errno =ENOEXEC ;return -1 ; }free (key);
@@ -63,12 +67,14 @@ rte_thread_tls_value_set(rte_tls_key key, const void *value)if (!key) {RTE_LOG (DEBUG ,EAL ,"Invalid TLS key.\n" ); + rte_errno =EINVAL ;return -1 ; } err =pthread_setspecific (key->thread_index, value);if (err) {RTE_LOG (DEBUG ,EAL ,"pthread_setspecific failed: %s\n" ,strerror (err)); + rte_errno =ENOEXEC ;return -1 ; }return 0 ;
lib/librte_eal/windows/rte_thread.c +6 -0
@@ -18,12 +18,14 @@ rte_thread_tls_key_create(rte_tls_key *key, *key =malloc (sizeof (**key));if ((*key) ==NULL ) {RTE_LOG (DEBUG ,EAL ,"Cannot allocate TLS key.\n" ); + rte_errno =ENOMEM ;return -1 ; } (*key)->thread_index =TlsAlloc ();if ((*key)->thread_index ==TLS_OUT_OF_INDEXES ) {RTE_LOG_WIN32_ERR ("TlsAlloc()" );free (*key); + rte_errno =ENOEXEC ;return -1 ; }return 0 ;
@@ -34,11 +36,13 @@ rte_thread_tls_key_delete(rte_tls_key key) {if (!key) {RTE_LOG (DEBUG ,EAL ,"Invalid TLS key.\n" ); + rte_errno =EINVAL ;return -1 ; }if (!TlsFree (key->thread_index)) {RTE_LOG_WIN32_ERR ("TlsFree()" );free (key); + rte_errno =ENOEXEC ;return -1 ; }free (key);
@@ -52,12 +56,14 @@ rte_thread_tls_value_set(rte_tls_key key, const void *value)if (!key) {RTE_LOG (DEBUG ,EAL ,"Invalid TLS key.\n" ); + rte_errno =EINVAL ;return -1 ; }/* discard const qualifier */ p = (char *) (uintptr_t ) value;if (!TlsSetValue (key->thread_index, p)) {RTE_LOG_WIN32_ERR ("TlsSetValue()" ); + rte_errno =ENOEXEC ;return -1 ; }return 0 ;
Signature · 1 line
2.16.1.windows.4
Re: [dpdk-dev] [PATCH v4 1/2] eal: error number enhancement for thread TLS API
lib/librte_eal/include/rte_thread.h
Quoted 12 lines · Tal Shnaiderman
add error number reporting to
rte_errnoin all
functions in the rte_thread_tls_* API.Suggested-by Anatoly Burakov <[email protected]>Signed-off-by Tal Shnaiderman <[email protected]>--- lib/librte_eal/include/rte_thread.h | 14 +++++++++++--- lib/librte_eal/unix/rte_thread.c | 6 ++++++ lib/librte_eal/windows/rte_thread.c | 6 ++++++ 3 files changed, 23 insertions(+), 3 deletions(-)lib/librte_eal/include/rte_thread.h +0
-0
After we introduce a translation function to map from Windows error codes to errno style codes (as part of EAL threads API),
should we change this to directly return the error code from the functions? Or do we follow the pattern of setting rte_errno?
Re: [dpdk-dev] [PATCH v4 1/2] eal: error number enhancement for thread TLS API
Quoted 15 lines
Subject: Re: [PATCH v4 1/2] eal: error number enhancement for thread TLS API
Quoted 11 lines · Tal Shnaiderman
add error number reporting to
rte_errnoin all functions in the rte_thread_tls_* API.Suggested-by Anatoly Burakov <[email protected]>Signed-off-by Tal Shnaiderman <[email protected]>--- lib/librte_eal/include/rte_thread.h | 14 +++++++++++--- lib/librte_eal/unix/rte_thread.c | 6 ++++++ lib/librte_eal/windows/rte_thread.c | 6 ++++++ 3 files changed, 23 insertions(+), 3 deletions(-)
Quoted 7 lines
lib/librte_eal/include/rte_thread.h
Quoted 2 lines
lib/librte_eal/include/rte_thread.h +0
-0After we introduce a translation function to map from Windows error codes to errno style codes (as part of EAL threads API), should we change this to directly return the error code from the functions?
Or do we follow the pattern of settingrte_errno?
Sorry for the late reply,
I'd stick to errors in rte_errno, note that in cases like rte_thread_value_get the only way to get the errors is with rte_errno since it's returning the value itself.
BTW will you also add translation function for the UNIX errors to get identical errors?
Re: [dpdk-dev] [PATCH v4 1/2] eal: error number enhancement for thread TLS API
In reply to Tal Shnaiderman2021-03-10 14:48 (UTC+0200), Tal Shnaiderman:
Quoted 5 lines
add error number reporting to
rte_errnoin all
functions in the rte_thread_tls_* API.Suggested-by Anatoly Burakov <[email protected]>Signed-off-by Tal Shnaiderman <[email protected]>
Re: [dpdk-dev] [PATCH v4 1/2] eal: error number enhancement for thread TLS API
In reply to Tal Shnaiderman10/03/2021 13:48, Tal Shnaiderman:
Quoted 36 lines
lib/librte_eal/include/rte_thread.h +9
-3@@ -59,7 +59,9 @@ void rte_thread_get_affinity(rte_cpuset_t *cpusetp);* * @return * On success, zero. -* On failure, a negative number. +* On failure, a negative number and an error number is set in rte_errno. +* rte_errno can be set to: ENOMEM - Memory allocation error. +* ENOEXEC - Specific OS error. */ __rte_experimental@@ -73,7 +75,9 @@ int rte_thread_tls_key_create(rte_tls_key *key, void (*destructor)(void *));* * @return * On success, zero. -* On failure, a negative number. +* On failure, a negative number and an error number is set in rte_errno. +* rte_errno can be set to: EINVAL - Invalid parameter passed. +* ENOEXEC - Specific OS error. */ __rte_experimental int rte_thread_tls_key_delete(rte_tls_key key);@@ -88,7 +92,9 @@ int rte_thread_tls_key_delete(rte_tls_key key);* * @return * On success, zero. -* On failure, a negative number. +* On failure, a negative number and an error number is set in rte_errno. +* rte_errno can be set to: EINVAL - Invalid parameter passed. +* ENOEXEC - Specific OS error. */ __rte_experimental int rte_thread_tls_value_set(rte_tls_key key, const void *value);
lib/librte_eal/include/rte_thread.h int rte_thread_tls_value_set(rte_tls_key key, const void *value); · line 112
Quoted 5 lines
lib/librte_eal/include/rte_thread.h +2
-0@@ -102,6 +108,8 @@ int rte_thread_tls_value_set(rte_tls_key key, const void *value);* @return * On success, value data pointer (can also be NULL). * On failure, NULL and an error number is set in rte_errno. +* rte_errno can be set to: EINVAL - Invalid parameter passed. +* ENOEXEC - Specific OS error.
Shorter (and less confusing): "rte_errno can be:"
v5 cover EAL Thread TLS API enhancements
In reply to Tal Shnaiderman---
v5: shorten docu comment on rte_errno and add ABI change info to release note [Thomas]
v4: replace errno EOTHER with ENOEXEC as EOTHER is undefined in unix.
v3: -Unify rte_errno values to a generic errno for OS compatibility [DmitryK]
-Rename the TLS function to avoid redundancy[MortenB].
v2: Rename key to avoid redundancy[MortenB].
---
Tal Shnaiderman (2):
eal: error number enhancement for thread TLS API
eal: rename key opaque pointer and functions in TLS API
doc/guides/rel_notes/release_21_05.rst | 3 +++ drivers/net/mlx5/linux/mlx5_flow_os.c | 10 +++++----- drivers/net/mlx5/windows/mlx5_flow_os.c | 12 ++++++------ lib/librte_eal/include/rte_thread.h | 33 +++++++++++++++++++++------------ lib/librte_eal/rte_eal_exports.def | 8 ++++---- lib/librte_eal/unix/rte_thread.c | 14 ++++++++++---- lib/librte_eal/version.map | 8 ++++---- lib/librte_eal/windows/rte_thread.c | 14 ++++++++++---- 8 files changed, 63 insertions(+), 39 deletions(-)
Signature · 1 line
2.16.1.windows.4
PATCH v5 1/2 eal: error number enhancement for thread TLS API
add error number reporting to rte_errno in all functions in the rte_thread_tls_* API.
--- lib/librte_eal/include/rte_thread.h | 14 +++++++++++--- lib/librte_eal/unix/rte_thread.c | 6 ++++++ lib/librte_eal/windows/rte_thread.c | 6 ++++++ 3 files changed, 23 insertions(+), 3 deletions(-)
lib/librte_eal/include/rte_thread.h +11 -3
@@ -59,7 +59,9 @@ void rte_thread_get_affinity(rte_cpuset_t *cpusetp);* * @return * On success, zero. -* On failure, a negative number. +* On failure, a negative number and an error number is set in rte_errno. +* rte_errno can be: ENOMEM - Memory allocation error. +* ENOEXEC - Specific OS error. */ __rte_experimental
@@ -73,7 +75,9 @@ int rte_thread_tls_key_create(rte_tls_key *key, void (*destructor)(void *));* * @return * On success, zero. -* On failure, a negative number. +* On failure, a negative number and an error number is set in rte_errno. +* rte_errno can be: EINVAL - Invalid parameter passed. +* ENOEXEC - Specific OS error. */ __rte_experimental int rte_thread_tls_key_delete(rte_tls_key key);
@@ -88,7 +92,9 @@ int rte_thread_tls_key_delete(rte_tls_key key);* * @return * On success, zero. -* On failure, a negative number. +* On failure, a negative number and an error number is set in rte_errno. +* rte_errno can be: EINVAL - Invalid parameter passed. +* ENOEXEC - Specific OS error. */ __rte_experimental int rte_thread_tls_value_set(rte_tls_key key, const void *value);
@@ -102,6 +108,8 @@ int rte_thread_tls_value_set(rte_tls_key key, const void *value);* @return * On success, value data pointer (can also be NULL). * On failure, NULL and an error number is set in rte_errno. +* rte_errno can be: EINVAL - Invalid parameter passed. +* ENOEXEC - Specific OS error. */ __rte_experimental void *rte_thread_tls_value_get(rte_tls_key key);
lib/librte_eal/unix/rte_thread.c +6 -0
@@ -24,6 +24,7 @@ rte_thread_tls_key_create(rte_tls_key *key, void (*destructor)(void *)) *key =malloc (sizeof (**key));if ((*key) ==NULL ) {RTE_LOG (DEBUG ,EAL ,"Cannot allocate TLS key.\n" ); + rte_errno =ENOMEM ;return -1 ; } err =pthread_key_create (&((*key)->thread_index), destructor);
@@ -31,6 +32,7 @@ rte_thread_tls_key_create(rte_tls_key *key, void (*destructor)(void *))RTE_LOG (DEBUG ,EAL ,"pthread_key_create failed: %s\n" ,strerror (err));free (*key); + rte_errno =ENOEXEC ;return -1 ; }return 0 ;
@@ -43,6 +45,7 @@ rte_thread_tls_key_delete(rte_tls_key key)if (!key) {RTE_LOG (DEBUG ,EAL ,"Invalid TLS key.\n" ); + rte_errno =EINVAL ;return -1 ; } err =pthread_key_delete (key->thread_index);
@@ -50,6 +53,7 @@ rte_thread_tls_key_delete(rte_tls_key key)RTE_LOG (DEBUG ,EAL ,"pthread_key_delete failed: %s\n" ,strerror (err));free (key); + rte_errno =ENOEXEC ;return -1 ; }free (key);
@@ -63,12 +67,14 @@ rte_thread_tls_value_set(rte_tls_key key, const void *value)if (!key) {RTE_LOG (DEBUG ,EAL ,"Invalid TLS key.\n" ); + rte_errno =EINVAL ;return -1 ; } err =pthread_setspecific (key->thread_index, value);if (err) {RTE_LOG (DEBUG ,EAL ,"pthread_setspecific failed: %s\n" ,strerror (err)); + rte_errno =ENOEXEC ;return -1 ; }return 0 ;
lib/librte_eal/windows/rte_thread.c +6 -0
@@ -18,12 +18,14 @@ rte_thread_tls_key_create(rte_tls_key *key, *key =malloc (sizeof (**key));if ((*key) ==NULL ) {RTE_LOG (DEBUG ,EAL ,"Cannot allocate TLS key.\n" ); + rte_errno =ENOMEM ;return -1 ; } (*key)->thread_index =TlsAlloc ();if ((*key)->thread_index ==TLS_OUT_OF_INDEXES ) {RTE_LOG_WIN32_ERR ("TlsAlloc()" );free (*key); + rte_errno =ENOEXEC ;return -1 ; }return 0 ;
@@ -34,11 +36,13 @@ rte_thread_tls_key_delete(rte_tls_key key) {if (!key) {RTE_LOG (DEBUG ,EAL ,"Invalid TLS key.\n" ); + rte_errno =EINVAL ;return -1 ; }if (!TlsFree (key->thread_index)) {RTE_LOG_WIN32_ERR ("TlsFree()" );free (key); + rte_errno =ENOEXEC ;return -1 ; }free (key);
@@ -52,12 +56,14 @@ rte_thread_tls_value_set(rte_tls_key key, const void *value)if (!key) {RTE_LOG (DEBUG ,EAL ,"Invalid TLS key.\n" ); + rte_errno =EINVAL ;return -1 ; }/* discard const qualifier */ p = (char *) (uintptr_t ) value;if (!TlsSetValue (key->thread_index, p)) {RTE_LOG_WIN32_ERR ("TlsSetValue()" ); + rte_errno =ENOEXEC ;return -1 ; }return 0 ;
Signature · 1 line
2.16.1.windows.4
v6 cover EAL Thread TLS API enhancements
---
v6: fix misalignment in comment fix from v5 and missing NL in RN [Thomas]
v5: shorten docu comment on rte_errno and add ABI change info to release note [Thomas]
v4: replace errno EOTHER with ENOEXEC as EOTHER is undefined in unix.
v3: -Unify rte_errno values to a generic errno for OS compatibility [DmitryK]
-Rename the TLS function to avoid redundancy[MortenB].
v2: Rename key to avoid redundancy[MortenB].
---
Tal Shnaiderman (2):
eal: error number enhancement for thread TLS API
eal: rename key opaque pointer and functions in TLS API
doc/guides/rel_notes/release_21_05.rst | 4 ++++ drivers/net/mlx5/linux/mlx5_flow_os.c | 10 +++++----- drivers/net/mlx5/windows/mlx5_flow_os.c | 12 ++++++------ lib/librte_eal/include/rte_thread.h | 33 +++++++++++++++++++++------------ lib/librte_eal/rte_eal_exports.def | 8 ++++---- lib/librte_eal/unix/rte_thread.c | 14 ++++++++++---- lib/librte_eal/version.map | 8 ++++---- lib/librte_eal/windows/rte_thread.c | 14 ++++++++++---- 8 files changed, 64 insertions(+), 39 deletions(-)
Signature · 1 line
2.16.1.windows.4
PATCH v6 1/2 eal: error number enhancement for thread TLS API
add error number reporting to rte_errno in all functions in the rte_thread_tls_* API.
--- lib/librte_eal/include/rte_thread.h | 14 +++++++++++--- lib/librte_eal/unix/rte_thread.c | 6 ++++++ lib/librte_eal/windows/rte_thread.c | 6 ++++++ 3 files changed, 23 insertions(+), 3 deletions(-)
lib/librte_eal/include/rte_thread.h +11 -3
@@ -59,7 +59,9 @@ void rte_thread_get_affinity(rte_cpuset_t *cpusetp);* * @return * On success, zero. -* On failure, a negative number. +* On failure, a negative number and an error number is set in rte_errno. +* rte_errno can be: ENOMEM - Memory allocation error. +* ENOEXEC - Specific OS error. */ __rte_experimental
@@ -73,7 +75,9 @@ int rte_thread_tls_key_create(rte_tls_key *key, void (*destructor)(void *));* * @return * On success, zero. -* On failure, a negative number. +* On failure, a negative number and an error number is set in rte_errno. +* rte_errno can be: EINVAL - Invalid parameter passed. +* ENOEXEC - Specific OS error. */ __rte_experimental int rte_thread_tls_key_delete(rte_tls_key key);
@@ -88,7 +92,9 @@ int rte_thread_tls_key_delete(rte_tls_key key);* * @return * On success, zero. -* On failure, a negative number. +* On failure, a negative number and an error number is set in rte_errno. +* rte_errno can be: EINVAL - Invalid parameter passed. +* ENOEXEC - Specific OS error. */ __rte_experimental int rte_thread_tls_value_set(rte_tls_key key, const void *value);
@@ -102,6 +108,8 @@ int rte_thread_tls_value_set(rte_tls_key key, const void *value);* @return * On success, value data pointer (can also be NULL). * On failure, NULL and an error number is set in rte_errno. +* rte_errno can be: EINVAL - Invalid parameter passed. +* ENOEXEC - Specific OS error. */ __rte_experimental void *rte_thread_tls_value_get(rte_tls_key key);
lib/librte_eal/unix/rte_thread.c +6 -0
@@ -24,6 +24,7 @@ rte_thread_tls_key_create(rte_tls_key *key, void (*destructor)(void *)) *key =malloc (sizeof (**key));if ((*key) ==NULL ) {RTE_LOG (DEBUG ,EAL ,"Cannot allocate TLS key.\n" ); + rte_errno =ENOMEM ;return -1 ; } err =pthread_key_create (&((*key)->thread_index), destructor);
@@ -31,6 +32,7 @@ rte_thread_tls_key_create(rte_tls_key *key, void (*destructor)(void *))RTE_LOG (DEBUG ,EAL ,"pthread_key_create failed: %s\n" ,strerror (err));free (*key); + rte_errno =ENOEXEC ;return -1 ; }return 0 ;
@@ -43,6 +45,7 @@ rte_thread_tls_key_delete(rte_tls_key key)if (!key) {RTE_LOG (DEBUG ,EAL ,"Invalid TLS key.\n" ); + rte_errno =EINVAL ;return -1 ; } err =pthread_key_delete (key->thread_index);
@@ -50,6 +53,7 @@ rte_thread_tls_key_delete(rte_tls_key key)RTE_LOG (DEBUG ,EAL ,"pthread_key_delete failed: %s\n" ,strerror (err));free (key); + rte_errno =ENOEXEC ;return -1 ; }free (key);
@@ -63,12 +67,14 @@ rte_thread_tls_value_set(rte_tls_key key, const void *value)if (!key) {RTE_LOG (DEBUG ,EAL ,"Invalid TLS key.\n" ); + rte_errno =EINVAL ;return -1 ; } err =pthread_setspecific (key->thread_index, value);if (err) {RTE_LOG (DEBUG ,EAL ,"pthread_setspecific failed: %s\n" ,strerror (err)); + rte_errno =ENOEXEC ;return -1 ; }return 0 ;
lib/librte_eal/windows/rte_thread.c +6 -0
@@ -18,12 +18,14 @@ rte_thread_tls_key_create(rte_tls_key *key, *key =malloc (sizeof (**key));if ((*key) ==NULL ) {RTE_LOG (DEBUG ,EAL ,"Cannot allocate TLS key.\n" ); + rte_errno =ENOMEM ;return -1 ; } (*key)->thread_index =TlsAlloc ();if ((*key)->thread_index ==TLS_OUT_OF_INDEXES ) {RTE_LOG_WIN32_ERR ("TlsAlloc()" );free (*key); + rte_errno =ENOEXEC ;return -1 ; }return 0 ;
@@ -34,11 +36,13 @@ rte_thread_tls_key_delete(rte_tls_key key) {if (!key) {RTE_LOG (DEBUG ,EAL ,"Invalid TLS key.\n" ); + rte_errno =EINVAL ;return -1 ; }if (!TlsFree (key->thread_index)) {RTE_LOG_WIN32_ERR ("TlsFree()" );free (key); + rte_errno =ENOEXEC ;return -1 ; }free (key);
@@ -52,12 +56,14 @@ rte_thread_tls_value_set(rte_tls_key key, const void *value)if (!key) {RTE_LOG (DEBUG ,EAL ,"Invalid TLS key.\n" ); + rte_errno =EINVAL ;return -1 ; }/* discard const qualifier */ p = (char *) (uintptr_t ) value;if (!TlsSetValue (key->thread_index, p)) {RTE_LOG_WIN32_ERR ("TlsSetValue()" ); + rte_errno =ENOEXEC ;return -1 ; }return 0 ;
Signature · 1 line
2.16.1.windows.4
PATCH v6 2/2 eal: rename key opaque pointer and functions in TLS API
In reply to Tal Shnaidermanrename the key opaque pointer from rte_tls_key to rte_thread_key to avoid confusion with transport layer security.
Also rename and remove the "_tls" term from the following functions to avoid redundancy:
rte_thread_tls_key_createrte_thread_tls_key_deleterte_thread_tls_value_setrte_thread_tls_value_get
--- doc/guides/rel_notes/release_21_05.rst | 4 ++++ drivers/net/mlx5/linux/mlx5_flow_os.c | 10 +++++----- drivers/net/mlx5/windows/mlx5_flow_os.c | 12 ++++++------ lib/librte_eal/include/rte_thread.h | 19 ++++++++++--------- lib/librte_eal/rte_eal_exports.def | 8 ++++---- lib/librte_eal/unix/rte_thread.c | 8 ++++---- lib/librte_eal/version.map | 8 ++++---- lib/librte_eal/windows/rte_thread.c | 8 ++++---- 8 files changed, 41 insertions(+), 36 deletions(-)
doc/guides/rel_notes/release_21_05.rst +4 -0
@@ -112,6 +112,10 @@ API Changes Also, make sure to start the actual text at the margin. ======================================================= +* eal: The experimental TLS API added in ``rte_thread.h`` has been renamed + from ``rte_thread_tls_*`` to ``rte_thread_*`` to avoid naming redundancy + and confusion with the transport layer security term. + ABI Changes -----------
drivers/net/mlx5/linux/mlx5_flow_os.c +5 -5
@@ -7,12 +7,12 @@#include <rte_thread.h> /* Key of thread specific flow workspace data. */ -static rte_tls_key key_workspace; +static rte_thread_key key_workspace;int mlx5_flow_os_init_workspace_once (void ) { -if (rte_thread_tls_key_create (&key_workspace, flow_release_workspace)) { +if (rte_thread_key_create (&key_workspace, flow_release_workspace)) {DRV_LOG (ERR ,"Can't create flow workspace data thread key." );return -ENOMEM ; }
@@ -22,17 +22,17 @@ mlx5_flow_os_init_workspace_once(void)void *mlx5_flow_os_get_specific_workspace (void ) { -return rte_thread_tls_value_get (key_workspace); +return rte_thread_value_get (key_workspace); }int mlx5_flow_os_set_specific_workspace (struct mlx5_flow_workspace *data) { -return rte_thread_tls_value_set (key_workspace, data); +return rte_thread_value_set (key_workspace, data); }void mlx5_flow_os_release_workspace (void ) { -rte_thread_tls_key_delete (key_workspace); +rte_thread_key_delete (key_workspace); }
drivers/net/mlx5/windows/mlx5_flow_os.c +6 -6
@@ -252,7 +252,7 @@ struct mlx5_workspace_thread {*/ static struct mlx5_workspace_thread *curr;static struct mlx5_workspace_thread *first; -rte_tls_key ws_tls_index; +rte_thread_key ws_tls_index;static pthread_mutex_t lock_thread_list; static bool
@@ -329,7 +329,7 @@ mlx5_flow_os_release_workspace(void)flow_release_workspace (first->mlx5_ws);free (first); } -rte_thread_tls_key_delete (ws_tls_index); +rte_thread_key_delete (ws_tls_index);pthread_mutex_destroy (&lock_thread_list); }
@@ -368,7 +368,7 @@ mlx5_add_workspace_to_list(struct mlx5_flow_workspace *data)int mlx5_flow_os_init_workspace_once (void ) { -int err =rte_thread_tls_key_create (&ws_tls_index,NULL ); +int err =rte_thread_key_create (&ws_tls_index,NULL );if (err) {DRV_LOG (ERR ,"Can't create flow workspace data thread key." );
@@ -381,7 +381,7 @@ mlx5_flow_os_init_workspace_once(void)void *mlx5_flow_os_get_specific_workspace (void ) { -return rte_thread_tls_value_get (ws_tls_index); +return rte_thread_value_get (ws_tls_index); }int
@@ -391,7 +391,7 @@ mlx5_flow_os_set_specific_workspace(struct mlx5_flow_workspace *data)int old_err = rte_errno; rte_errno =0 ; -if (!rte_thread_tls_value_get (ws_tls_index)) { +if (!rte_thread_value_get (ws_tls_index)) {if (rte_errno) {DRV_LOG (ERR ,"Failed checking specific workspace." ); rte_errno = old_err;
@@ -409,7 +409,7 @@ mlx5_flow_os_set_specific_workspace(struct mlx5_flow_workspace *data)return -1 ; } } -if (rte_thread_tls_value_set (ws_tls_index, data)) { +if (rte_thread_value_set (ws_tls_index, data)) {DRV_LOG (ERR ,"Failed setting specific workspace." ); err =-1 ; }
lib/librte_eal/include/rte_thread.h +10 -9
@@ -23,7 +23,7 @@ extern "C" {/** * TLS key type, an opaque pointer. */ -typedef struct eal_tls_key *rte_tls_key ; +typedef struct eal_tls_key *rte_thread_key ;/** * Set core affinity of the current thread.
@@ -65,13 +65,14 @@ void rte_thread_get_affinity(rte_cpuset_t *cpusetp);*/ __rte_experimental -int rte_thread_tls_key_create(rte_tls_key *key, void (*destructor)(void *)); +int rte_thread_key_create(rte_thread_key *key, +void (*destructor)(void *));/** * Delete a TLS data key visible to all threads in the process. * * @param key -* The key allocated by rte_thread_tls_key_create(). +* The key allocated by rte_thread_key_create(). * * @return * On success, zero.
@@ -80,15 +81,15 @@ int rte_thread_tls_key_create(rte_tls_key *key, void (*destructor)(void *));* ENOEXEC - Specific OS error. */ __rte_experimental -int rte_thread_tls_key_delete(rte_tls_key key); +int rte_thread_key_delete(rte_thread_key key);/** * Set value bound to the TLS key on behalf of the calling thread. * * @param key -* The key allocated by rte_thread_tls_key_create(). +* The key allocated by rte_thread_key_create(). * @param value -* The value bound to the rte_tls_key key for the calling thread. +* The value bound to the rte_thread_key key for the calling thread. * * @return * On success, zero.
@@ -97,13 +98,13 @@ int rte_thread_tls_key_delete(rte_tls_key key);* ENOEXEC - Specific OS error. */ __rte_experimental -int rte_thread_tls_value_set(rte_tls_key key, const void *value); +int rte_thread_value_set(rte_thread_key key, const void *value);/** * Get value bound to the TLS key on behalf of the calling thread. * * @param key -* The key allocated by rte_thread_tls_key_create(). +* The key allocated by rte_thread_key_create(). * * @return * On success, value data pointer (can also be NULL).
@@ -112,7 +113,7 @@ int rte_thread_tls_value_set(rte_tls_key key, const void *value);* ENOEXEC - Specific OS error. */ __rte_experimental -void *rte_thread_tls_value_get(rte_tls_key key); +void *rte_thread_value_get(rte_thread_key key); #ifdef __cplusplus }
lib/librte_eal/rte_eal_exports.def +4 -4
@@ -325,10 +325,10 @@ EXPORTS rte_vect_get_max_simd_bitwidth rte_vect_set_max_simd_bitwidth - rte_thread_tls_key_create - rte_thread_tls_key_delete - rte_thread_tls_value_get - rte_thread_tls_value_set + rte_thread_key_create + rte_thread_key_delete + rte_thread_value_get + rte_thread_value_set rte_mem_lock rte_mem_map
lib/librte_eal/unix/rte_thread.c +4 -4
@@ -17,7 +17,7 @@ struct eal_tls_key { };int -rte_thread_tls_key_create (rte_tls_key *key,void (*destructor)(void *)) +rte_thread_key_create (rte_thread_key *key,void (*destructor)(void *)) {int err;
@@ -39,7 +39,7 @@ rte_thread_tls_key_create(rte_tls_key *key, void (*destructor)(void *)) }int -rte_thread_tls_key_delete (rte_tls_key key) +rte_thread_key_delete (rte_thread_key key) {int err;
@@ -61,7 +61,7 @@ rte_thread_tls_key_delete(rte_tls_key key) }int -rte_thread_tls_value_set (rte_tls_key key,const void *value) +rte_thread_value_set (rte_thread_key key,const void *value) {int err;
@@ -81,7 +81,7 @@ rte_thread_tls_value_set(rte_tls_key key, const void *value) }void * -rte_thread_tls_value_get (rte_tls_key key) +rte_thread_value_get (rte_thread_key key) {if (!key) {RTE_LOG (DEBUG ,EAL ,"Invalid TLS key.\n" );
lib/librte_eal/version.map +4 -4
@@ -408,10 +408,10 @@ EXPERIMENTAL { rte_power_monitor; rte_power_monitor_wakeup; rte_power_pause; - rte_thread_tls_key_create; - rte_thread_tls_key_delete; - rte_thread_tls_value_get; - rte_thread_tls_value_set; + rte_thread_key_create; + rte_thread_key_delete; + rte_thread_value_get; + rte_thread_value_set; }; INTERNAL {
lib/librte_eal/windows/rte_thread.c +4 -4
@@ -12,7 +12,7 @@ struct eal_tls_key { };int -rte_thread_tls_key_create (rte_tls_key *key, +rte_thread_key_create (rte_thread_key *key, __rte_unused void (*destructor)(void *)) { *key =malloc (sizeof (**key));
@@ -32,7 +32,7 @@ rte_thread_tls_key_create(rte_tls_key *key, }int -rte_thread_tls_key_delete (rte_tls_key key) +rte_thread_key_delete (rte_thread_key key) {if (!key) {RTE_LOG (DEBUG ,EAL ,"Invalid TLS key.\n" );
@@ -50,7 +50,7 @@ rte_thread_tls_key_delete(rte_tls_key key) }int -rte_thread_tls_value_set (rte_tls_key key,const void *value) +rte_thread_value_set (rte_thread_key key,const void *value) {char *p;
@@ -70,7 +70,7 @@ rte_thread_tls_value_set(rte_tls_key key, const void *value) }void * -rte_thread_tls_value_get (rte_tls_key key) +rte_thread_value_get (rte_thread_key key) {void *output;
Signature · 1 line
2.16.1.windows.4
Thomas Monjalon
Applied16/03/2021 14:28, Tal Shnaiderman:
Quoted 9 lines
---
v6: fix misalignment in comment fix from v5 and missing NL in RN [Thomas]
v5: shorten docu comment onrte_errnoand add ABI change info to release note [Thomas]
v4: replace errno EOTHER with ENOEXEC as EOTHER is undefined in unix.
v3: -Unifyrte_errnovalues to a generic errno for OS compatibility [DmitryK]
-Rename the TLS function to avoid redundancy[MortenB].
v2: Rename key to avoid redundancy[MortenB].
---
Quoted 3 lines
Tal Shnaiderman (2):
eal: error number enhancement for thread TLS API
eal: rename key opaque pointer and functions in TLS API
Applied, thanks
PATCH v5 2/2 eal: rename key opaque pointer and functions in TLS API
In reply to Tal Shnaidermanrename the key opaque pointer from rte_tls_key to rte_thread_key to avoid confusion with transport layer security.
Also rename and remove the "_tls" term from the following functions to avoid redundancy:
rte_thread_tls_key_createrte_thread_tls_key_deleterte_thread_tls_value_setrte_thread_tls_value_get
--- doc/guides/rel_notes/release_21_05.rst | 3 +++ drivers/net/mlx5/linux/mlx5_flow_os.c | 10 +++++----- drivers/net/mlx5/windows/mlx5_flow_os.c | 12 ++++++------ lib/librte_eal/include/rte_thread.h | 19 ++++++++++--------- lib/librte_eal/rte_eal_exports.def | 8 ++++---- lib/librte_eal/unix/rte_thread.c | 8 ++++---- lib/librte_eal/version.map | 8 ++++---- lib/librte_eal/windows/rte_thread.c | 8 ++++---- 8 files changed, 40 insertions(+), 36 deletions(-)
doc/guides/rel_notes/release_21_05.rst +3 -0
@@ -112,6 +112,9 @@ API Changes Also, make sure to start the actual text at the margin. ======================================================= +* eal: The experimental TLS API added in ``rte_thread.h`` has been renamed + from ``rte_thread_tls_*`` to ``rte_thread_*`` to avoid naming redundancy + and confusion with the transport layer security term. ABI Changes -----------
drivers/net/mlx5/linux/mlx5_flow_os.c +5 -5
@@ -7,12 +7,12 @@#include <rte_thread.h> /* Key of thread specific flow workspace data. */ -static rte_tls_key key_workspace; +static rte_thread_key key_workspace;int mlx5_flow_os_init_workspace_once (void ) { -if (rte_thread_tls_key_create (&key_workspace, flow_release_workspace)) { +if (rte_thread_key_create (&key_workspace, flow_release_workspace)) {DRV_LOG (ERR ,"Can't create flow workspace data thread key." );return -ENOMEM ; }
@@ -22,17 +22,17 @@ mlx5_flow_os_init_workspace_once(void)void *mlx5_flow_os_get_specific_workspace (void ) { -return rte_thread_tls_value_get (key_workspace); +return rte_thread_value_get (key_workspace); }int mlx5_flow_os_set_specific_workspace (struct mlx5_flow_workspace *data) { -return rte_thread_tls_value_set (key_workspace, data); +return rte_thread_value_set (key_workspace, data); }void mlx5_flow_os_release_workspace (void ) { -rte_thread_tls_key_delete (key_workspace); +rte_thread_key_delete (key_workspace); }
drivers/net/mlx5/windows/mlx5_flow_os.c +6 -6
@@ -252,7 +252,7 @@ struct mlx5_workspace_thread {*/ static struct mlx5_workspace_thread *curr;static struct mlx5_workspace_thread *first; -rte_tls_key ws_tls_index; +rte_thread_key ws_tls_index;static pthread_mutex_t lock_thread_list; static bool
@@ -329,7 +329,7 @@ mlx5_flow_os_release_workspace(void)flow_release_workspace (first->mlx5_ws);free (first); } -rte_thread_tls_key_delete (ws_tls_index); +rte_thread_key_delete (ws_tls_index);pthread_mutex_destroy (&lock_thread_list); }
@@ -368,7 +368,7 @@ mlx5_add_workspace_to_list(struct mlx5_flow_workspace *data)int mlx5_flow_os_init_workspace_once (void ) { -int err =rte_thread_tls_key_create (&ws_tls_index,NULL ); +int err =rte_thread_key_create (&ws_tls_index,NULL );if (err) {DRV_LOG (ERR ,"Can't create flow workspace data thread key." );
@@ -381,7 +381,7 @@ mlx5_flow_os_init_workspace_once(void)void *mlx5_flow_os_get_specific_workspace (void ) { -return rte_thread_tls_value_get (ws_tls_index); +return rte_thread_value_get (ws_tls_index); }int
@@ -391,7 +391,7 @@ mlx5_flow_os_set_specific_workspace(struct mlx5_flow_workspace *data)int old_err = rte_errno; rte_errno =0 ; -if (!rte_thread_tls_value_get (ws_tls_index)) { +if (!rte_thread_value_get (ws_tls_index)) {if (rte_errno) {DRV_LOG (ERR ,"Failed checking specific workspace." ); rte_errno = old_err;
@@ -409,7 +409,7 @@ mlx5_flow_os_set_specific_workspace(struct mlx5_flow_workspace *data)return -1 ; } } -if (rte_thread_tls_value_set (ws_tls_index, data)) { +if (rte_thread_value_set (ws_tls_index, data)) {DRV_LOG (ERR ,"Failed setting specific workspace." ); err =-1 ; }
lib/librte_eal/include/rte_thread.h +10 -9
@@ -23,7 +23,7 @@ extern "C" {/** * TLS key type, an opaque pointer. */ -typedef struct eal_tls_key *rte_tls_key ; +typedef struct eal_tls_key *rte_thread_key ;/** * Set core affinity of the current thread.
@@ -65,13 +65,14 @@ void rte_thread_get_affinity(rte_cpuset_t *cpusetp);*/ __rte_experimental -int rte_thread_tls_key_create(rte_tls_key *key, void (*destructor)(void *)); +int rte_thread_key_create(rte_thread_key *key, +void (*destructor)(void *));/** * Delete a TLS data key visible to all threads in the process. * * @param key -* The key allocated by rte_thread_tls_key_create(). +* The key allocated by rte_thread_key_create(). * * @return * On success, zero.
@@ -80,15 +81,15 @@ int rte_thread_tls_key_create(rte_tls_key *key, void (*destructor)(void *));* ENOEXEC - Specific OS error. */ __rte_experimental -int rte_thread_tls_key_delete(rte_tls_key key); +int rte_thread_key_delete(rte_thread_key key);/** * Set value bound to the TLS key on behalf of the calling thread. * * @param key -* The key allocated by rte_thread_tls_key_create(). +* The key allocated by rte_thread_key_create(). * @param value -* The value bound to the rte_tls_key key for the calling thread. +* The value bound to the rte_thread_key key for the calling thread. * * @return * On success, zero.
@@ -97,13 +98,13 @@ int rte_thread_tls_key_delete(rte_tls_key key);* ENOEXEC - Specific OS error. */ __rte_experimental -int rte_thread_tls_value_set(rte_tls_key key, const void *value); +int rte_thread_value_set(rte_thread_key key, const void *value);/** * Get value bound to the TLS key on behalf of the calling thread. * * @param key -* The key allocated by rte_thread_tls_key_create(). +* The key allocated by rte_thread_key_create(). * * @return * On success, value data pointer (can also be NULL).
@@ -112,7 +113,7 @@ int rte_thread_tls_value_set(rte_tls_key key, const void *value);* ENOEXEC - Specific OS error. */ __rte_experimental -void *rte_thread_tls_value_get(rte_tls_key key); +void *rte_thread_value_get(rte_thread_key key); #ifdef __cplusplus }
lib/librte_eal/rte_eal_exports.def +4 -4
@@ -325,10 +325,10 @@ EXPORTS rte_vect_get_max_simd_bitwidth rte_vect_set_max_simd_bitwidth - rte_thread_tls_key_create - rte_thread_tls_key_delete - rte_thread_tls_value_get - rte_thread_tls_value_set + rte_thread_key_create + rte_thread_key_delete + rte_thread_value_get + rte_thread_value_set rte_mem_lock rte_mem_map
lib/librte_eal/unix/rte_thread.c +4 -4
@@ -17,7 +17,7 @@ struct eal_tls_key { };int -rte_thread_tls_key_create (rte_tls_key *key,void (*destructor)(void *)) +rte_thread_key_create (rte_thread_key *key,void (*destructor)(void *)) {int err;
@@ -39,7 +39,7 @@ rte_thread_tls_key_create(rte_tls_key *key, void (*destructor)(void *)) }int -rte_thread_tls_key_delete (rte_tls_key key) +rte_thread_key_delete (rte_thread_key key) {int err;
@@ -61,7 +61,7 @@ rte_thread_tls_key_delete(rte_tls_key key) }int -rte_thread_tls_value_set (rte_tls_key key,const void *value) +rte_thread_value_set (rte_thread_key key,const void *value) {int err;
@@ -81,7 +81,7 @@ rte_thread_tls_value_set(rte_tls_key key, const void *value) }void * -rte_thread_tls_value_get (rte_tls_key key) +rte_thread_value_get (rte_thread_key key) {if (!key) {RTE_LOG (DEBUG ,EAL ,"Invalid TLS key.\n" );
lib/librte_eal/version.map +4 -4
@@ -408,10 +408,10 @@ EXPERIMENTAL { rte_power_monitor; rte_power_monitor_wakeup; rte_power_pause; - rte_thread_tls_key_create; - rte_thread_tls_key_delete; - rte_thread_tls_value_get; - rte_thread_tls_value_set; + rte_thread_key_create; + rte_thread_key_delete; + rte_thread_value_get; + rte_thread_value_set; }; INTERNAL {
lib/librte_eal/windows/rte_thread.c +4 -4
@@ -12,7 +12,7 @@ struct eal_tls_key { };int -rte_thread_tls_key_create (rte_tls_key *key, +rte_thread_key_create (rte_thread_key *key, __rte_unused void (*destructor)(void *)) { *key =malloc (sizeof (**key));
@@ -32,7 +32,7 @@ rte_thread_tls_key_create(rte_tls_key *key, }int -rte_thread_tls_key_delete (rte_tls_key key) +rte_thread_key_delete (rte_thread_key key) {if (!key) {RTE_LOG (DEBUG ,EAL ,"Invalid TLS key.\n" );
@@ -50,7 +50,7 @@ rte_thread_tls_key_delete(rte_tls_key key) }int -rte_thread_tls_value_set (rte_tls_key key,const void *value) +rte_thread_value_set (rte_thread_key key,const void *value) {char *p;
@@ -70,7 +70,7 @@ rte_thread_tls_value_set(rte_tls_key key, const void *value) }void * -rte_thread_tls_value_get (rte_tls_key key) +rte_thread_value_get (rte_thread_key key) {void *output;
Signature · 1 line
2.16.1.windows.4
PATCH v4 2/2 eal: rename key opaque pointer and functions in TLS API
In reply to Tal Shnaidermanrename the key opaque pointer from rte_tls_key to rte_thread_key to avoid confusion with transport layer security.
Also rename and remove the "_tls" term from the following functions to avoid redundancy:
rte_thread_tls_key_createrte_thread_tls_key_deleterte_thread_tls_value_setrte_thread_tls_value_get
--- drivers/net/mlx5/linux/mlx5_flow_os.c | 10 +++++----- drivers/net/mlx5/windows/mlx5_flow_os.c | 12 ++++++------ lib/librte_eal/include/rte_thread.h | 19 ++++++++++--------- lib/librte_eal/rte_eal_exports.def | 8 ++++---- lib/librte_eal/unix/rte_thread.c | 8 ++++---- lib/librte_eal/version.map | 8 ++++---- lib/librte_eal/windows/rte_thread.c | 8 ++++---- 7 files changed, 37 insertions(+), 36 deletions(-)
drivers/net/mlx5/linux/mlx5_flow_os.c +5 -5
@@ -7,12 +7,12 @@#include <rte_thread.h> /* Key of thread specific flow workspace data. */ -static rte_tls_key key_workspace; +static rte_thread_key key_workspace;int mlx5_flow_os_init_workspace_once (void ) { -if (rte_thread_tls_key_create (&key_workspace, flow_release_workspace)) { +if (rte_thread_key_create (&key_workspace, flow_release_workspace)) {DRV_LOG (ERR ,"Can't create flow workspace data thread key." );return -ENOMEM ; }
@@ -22,17 +22,17 @@ mlx5_flow_os_init_workspace_once(void)void *mlx5_flow_os_get_specific_workspace (void ) { -return rte_thread_tls_value_get (key_workspace); +return rte_thread_value_get (key_workspace); }int mlx5_flow_os_set_specific_workspace (struct mlx5_flow_workspace *data) { -return rte_thread_tls_value_set (key_workspace, data); +return rte_thread_value_set (key_workspace, data); }void mlx5_flow_os_release_workspace (void ) { -rte_thread_tls_key_delete (key_workspace); +rte_thread_key_delete (key_workspace); }
drivers/net/mlx5/windows/mlx5_flow_os.c +6 -6
@@ -252,7 +252,7 @@ struct mlx5_workspace_thread {*/ static struct mlx5_workspace_thread *curr;static struct mlx5_workspace_thread *first; -rte_tls_key ws_tls_index; +rte_thread_key ws_tls_index;static pthread_mutex_t lock_thread_list; static bool
@@ -329,7 +329,7 @@ mlx5_flow_os_release_workspace(void)flow_release_workspace (first->mlx5_ws);free (first); } -rte_thread_tls_key_delete (ws_tls_index); +rte_thread_key_delete (ws_tls_index);pthread_mutex_destroy (&lock_thread_list); }
@@ -368,7 +368,7 @@ mlx5_add_workspace_to_list(struct mlx5_flow_workspace *data)int mlx5_flow_os_init_workspace_once (void ) { -int err =rte_thread_tls_key_create (&ws_tls_index,NULL ); +int err =rte_thread_key_create (&ws_tls_index,NULL );if (err) {DRV_LOG (ERR ,"Can't create flow workspace data thread key." );
@@ -381,7 +381,7 @@ mlx5_flow_os_init_workspace_once(void)void *mlx5_flow_os_get_specific_workspace (void ) { -return rte_thread_tls_value_get (ws_tls_index); +return rte_thread_value_get (ws_tls_index); }int
@@ -391,7 +391,7 @@ mlx5_flow_os_set_specific_workspace(struct mlx5_flow_workspace *data)int old_err = rte_errno; rte_errno =0 ; -if (!rte_thread_tls_value_get (ws_tls_index)) { +if (!rte_thread_value_get (ws_tls_index)) {if (rte_errno) {DRV_LOG (ERR ,"Failed checking specific workspace." ); rte_errno = old_err;
@@ -409,7 +409,7 @@ mlx5_flow_os_set_specific_workspace(struct mlx5_flow_workspace *data)return -1 ; } } -if (rte_thread_tls_value_set (ws_tls_index, data)) { +if (rte_thread_value_set (ws_tls_index, data)) {DRV_LOG (ERR ,"Failed setting specific workspace." ); err =-1 ; }
lib/librte_eal/include/rte_thread.h +10 -9
@@ -23,7 +23,7 @@ extern "C" {/** * TLS key type, an opaque pointer. */ -typedef struct eal_tls_key *rte_tls_key ; +typedef struct eal_tls_key *rte_thread_key ;/** * Set core affinity of the current thread.
@@ -65,13 +65,14 @@ void rte_thread_get_affinity(rte_cpuset_t *cpusetp);*/ __rte_experimental -int rte_thread_tls_key_create(rte_tls_key *key, void (*destructor)(void *)); +int rte_thread_key_create(rte_thread_key *key, +void (*destructor)(void *));/** * Delete a TLS data key visible to all threads in the process. * * @param key -* The key allocated by rte_thread_tls_key_create(). +* The key allocated by rte_thread_key_create(). * * @return * On success, zero.
@@ -80,15 +81,15 @@ int rte_thread_tls_key_create(rte_tls_key *key, void (*destructor)(void *));* ENOEXEC - Specific OS error. */ __rte_experimental -int rte_thread_tls_key_delete(rte_tls_key key); +int rte_thread_key_delete(rte_thread_key key);/** * Set value bound to the TLS key on behalf of the calling thread. * * @param key -* The key allocated by rte_thread_tls_key_create(). +* The key allocated by rte_thread_key_create(). * @param value -* The value bound to the rte_tls_key key for the calling thread. +* The value bound to the rte_thread_key key for the calling thread. * * @return * On success, zero.
@@ -97,13 +98,13 @@ int rte_thread_tls_key_delete(rte_tls_key key);* ENOEXEC - Specific OS error. */ __rte_experimental -int rte_thread_tls_value_set(rte_tls_key key, const void *value); +int rte_thread_value_set(rte_thread_key key, const void *value);/** * Get value bound to the TLS key on behalf of the calling thread. * * @param key -* The key allocated by rte_thread_tls_key_create(). +* The key allocated by rte_thread_key_create(). * * @return * On success, value data pointer (can also be NULL).
@@ -112,7 +113,7 @@ int rte_thread_tls_value_set(rte_tls_key key, const void *value);* ENOEXEC - Specific OS error. */ __rte_experimental -void *rte_thread_tls_value_get(rte_tls_key key); +void *rte_thread_value_get(rte_thread_key key); #ifdef __cplusplus }
lib/librte_eal/rte_eal_exports.def +4 -4
@@ -325,10 +325,10 @@ EXPORTS rte_vect_get_max_simd_bitwidth rte_vect_set_max_simd_bitwidth - rte_thread_tls_key_create - rte_thread_tls_key_delete - rte_thread_tls_value_get - rte_thread_tls_value_set + rte_thread_key_create + rte_thread_key_delete + rte_thread_value_get + rte_thread_value_set rte_mem_lock rte_mem_map
lib/librte_eal/unix/rte_thread.c +4 -4
@@ -17,7 +17,7 @@ struct eal_tls_key { };int -rte_thread_tls_key_create (rte_tls_key *key,void (*destructor)(void *)) +rte_thread_key_create (rte_thread_key *key,void (*destructor)(void *)) {int err;
@@ -39,7 +39,7 @@ rte_thread_tls_key_create(rte_tls_key *key, void (*destructor)(void *)) }int -rte_thread_tls_key_delete (rte_tls_key key) +rte_thread_key_delete (rte_thread_key key) {int err;
@@ -61,7 +61,7 @@ rte_thread_tls_key_delete(rte_tls_key key) }int -rte_thread_tls_value_set (rte_tls_key key,const void *value) +rte_thread_value_set (rte_thread_key key,const void *value) {int err;
@@ -81,7 +81,7 @@ rte_thread_tls_value_set(rte_tls_key key, const void *value) }void * -rte_thread_tls_value_get (rte_tls_key key) +rte_thread_value_get (rte_thread_key key) {if (!key) {RTE_LOG (DEBUG ,EAL ,"Invalid TLS key.\n" );
lib/librte_eal/version.map +4 -4
@@ -408,10 +408,10 @@ EXPERIMENTAL { rte_power_monitor; rte_power_monitor_wakeup; rte_power_pause; - rte_thread_tls_key_create; - rte_thread_tls_key_delete; - rte_thread_tls_value_get; - rte_thread_tls_value_set; + rte_thread_key_create; + rte_thread_key_delete; + rte_thread_value_get; + rte_thread_value_set; }; INTERNAL {
lib/librte_eal/windows/rte_thread.c +4 -4
@@ -12,7 +12,7 @@ struct eal_tls_key { };int -rte_thread_tls_key_create (rte_tls_key *key, +rte_thread_key_create (rte_thread_key *key, __rte_unused void (*destructor)(void *)) { *key =malloc (sizeof (**key));
@@ -32,7 +32,7 @@ rte_thread_tls_key_create(rte_tls_key *key, }int -rte_thread_tls_key_delete (rte_tls_key key) +rte_thread_key_delete (rte_thread_key key) {if (!key) {RTE_LOG (DEBUG ,EAL ,"Invalid TLS key.\n" );
@@ -50,7 +50,7 @@ rte_thread_tls_key_delete(rte_tls_key key) }int -rte_thread_tls_value_set (rte_tls_key key,const void *value) +rte_thread_value_set (rte_thread_key key,const void *value) {char *p;
@@ -70,7 +70,7 @@ rte_thread_tls_value_set(rte_tls_key key, const void *value) }void * -rte_thread_tls_value_get (rte_tls_key key) +rte_thread_value_get (rte_thread_key key) {void *output;
Signature · 1 line
2.16.1.windows.4
Re: [dpdk-dev] [PATCH v4 2/2] eal: rename key opaque pointer and functions in TLS API
10/03/2021 13:48, Tal Shnaiderman:
Quoted 15 lines
rename the key opaque pointer from
rte_tls_keytorte_thread_keyto avoid confusion with transport layer security.Also rename and remove the "
_tls" term from the following functions to avoid redundancy:
rte_thread_tls_key_createrte_thread_tls_key_deleterte_thread_tls_value_setrte_thread_tls_value_getSuggested-by Vladimir Medvedkin <[email protected]>Suggested-by Morten Brørup <[email protected]>Signed-off-by Tal Shnaiderman <[email protected]>Acked-by Morten Brørup <[email protected]>
Quoted 9 lines
--- drivers/net/mlx5/linux/mlx5_flow_os.c | 10 +++++----- drivers/net/mlx5/windows/mlx5_flow_os.c | 12 ++++++------ lib/librte_eal/include/rte_thread.h | 19 ++++++++++--------- lib/librte_eal/rte_eal_exports.def | 8 ++++---- lib/librte_eal/unix/rte_thread.c | 8 ++++---- lib/librte_eal/version.map | 8 ++++---- lib/librte_eal/windows/rte_thread.c | 8 ++++---- 7 files changed, 37 insertions(+), 36 deletions(-)
Updating an API, even experimental, requires an entry in the release notes.
Re: [dpdk-dev] [PATCH v4 2/2] eal: rename key opaque pointer and functions in TLS API
Quoted 32 lines
Subject: Re: [dpdk-dev] [PATCH v4 2/2] eal: rename key opaque pointer and functions in TLS API
External email: Use caution opening links or attachments
10/03/2021 13:48, Tal Shnaiderman:
Quoted 15 lines
rename the key opaque pointer from
rte_tls_keytorte_thread_keyto avoid confusion with transport layer security.Also rename and remove the "
_tls" term from the following functions to avoid redundancy:
rte_thread_tls_key_createrte_thread_tls_key_deleterte_thread_tls_value_setrte_thread_tls_value_getSuggested-by Vladimir Medvedkin <[email protected]>Suggested-by Morten Brørup <[email protected]>Signed-off-by Tal Shnaiderman <[email protected]>Acked-by Morten Brørup <[email protected]>Quoted 9 lines
--- drivers/net/mlx5/linux/mlx5_flow_os.c | 10 +++++----- drivers/net/mlx5/windows/mlx5_flow_os.c | 12 ++++++------ lib/librte_eal/include/rte_thread.h | 19 ++++++++++--------- lib/librte_eal/rte_eal_exports.def | 8 ++++---- lib/librte_eal/unix/rte_thread.c | 8 ++++---- lib/librte_eal/version.map | 8 ++++---- lib/librte_eal/windows/rte_thread.c | 8 ++++---- 7 files changed, 37 insertions(+), 36 deletions(-)
Quoted 3 lines
Updating an API, even experimental, requires an entry in the release notes.
Thanks Thomas, will add in v5.
PATCH v3 2/2 eal: rename key opaque pointer and functions in TLS API
In reply to Tal Shnaidermanrename the key opaque pointer from rte_tls_key to rte_thread_key to avoid confusion with transport layer security.
Also rename and remove the "_tls" term from the following functions to avoid redundancy:
rte_thread_tls_key_createrte_thread_tls_key_deleterte_thread_tls_value_setrte_thread_tls_value_get
--- drivers/net/mlx5/linux/mlx5_flow_os.c | 10 +++++----- drivers/net/mlx5/windows/mlx5_flow_os.c | 12 ++++++------ lib/librte_eal/include/rte_thread.h | 19 ++++++++++--------- lib/librte_eal/rte_eal_exports.def | 8 ++++---- lib/librte_eal/unix/rte_thread.c | 8 ++++---- lib/librte_eal/version.map | 8 ++++---- lib/librte_eal/windows/rte_thread.c | 8 ++++---- 7 files changed, 37 insertions(+), 36 deletions(-)
drivers/net/mlx5/linux/mlx5_flow_os.c +5 -5
@@ -7,12 +7,12 @@#include <rte_thread.h> /* Key of thread specific flow workspace data. */ -static rte_tls_key key_workspace; +static rte_thread_key key_workspace;int mlx5_flow_os_init_workspace_once (void ) { -if (rte_thread_tls_key_create (&key_workspace, flow_release_workspace)) { +if (rte_thread_key_create (&key_workspace, flow_release_workspace)) {DRV_LOG (ERR ,"Can't create flow workspace data thread key." );return -ENOMEM ; }
@@ -22,17 +22,17 @@ mlx5_flow_os_init_workspace_once(void)void *mlx5_flow_os_get_specific_workspace (void ) { -return rte_thread_tls_value_get (key_workspace); +return rte_thread_value_get (key_workspace); }int mlx5_flow_os_set_specific_workspace (struct mlx5_flow_workspace *data) { -return rte_thread_tls_value_set (key_workspace, data); +return rte_thread_value_set (key_workspace, data); }void mlx5_flow_os_release_workspace (void ) { -rte_thread_tls_key_delete (key_workspace); +rte_thread_key_delete (key_workspace); }
drivers/net/mlx5/windows/mlx5_flow_os.c +6 -6
@@ -252,7 +252,7 @@ struct mlx5_workspace_thread {*/ static struct mlx5_workspace_thread *curr;static struct mlx5_workspace_thread *first; -rte_tls_key ws_tls_index; +rte_thread_key ws_tls_index;static pthread_mutex_t lock_thread_list; static bool
@@ -329,7 +329,7 @@ mlx5_flow_os_release_workspace(void)flow_release_workspace (first->mlx5_ws);free (first); } -rte_thread_tls_key_delete (ws_tls_index); +rte_thread_key_delete (ws_tls_index);pthread_mutex_destroy (&lock_thread_list); }
@@ -368,7 +368,7 @@ mlx5_add_workspace_to_list(struct mlx5_flow_workspace *data)int mlx5_flow_os_init_workspace_once (void ) { -int err =rte_thread_tls_key_create (&ws_tls_index,NULL ); +int err =rte_thread_key_create (&ws_tls_index,NULL );if (err) {DRV_LOG (ERR ,"Can't create flow workspace data thread key." );
@@ -381,7 +381,7 @@ mlx5_flow_os_init_workspace_once(void)void *mlx5_flow_os_get_specific_workspace (void ) { -return rte_thread_tls_value_get (ws_tls_index); +return rte_thread_value_get (ws_tls_index); }int
@@ -391,7 +391,7 @@ mlx5_flow_os_set_specific_workspace(struct mlx5_flow_workspace *data)int old_err = rte_errno; rte_errno =0 ; -if (!rte_thread_tls_value_get (ws_tls_index)) { +if (!rte_thread_value_get (ws_tls_index)) {if (rte_errno) {DRV_LOG (ERR ,"Failed checking specific workspace." ); rte_errno = old_err;
@@ -409,7 +409,7 @@ mlx5_flow_os_set_specific_workspace(struct mlx5_flow_workspace *data)return -1 ; } } -if (rte_thread_tls_value_set (ws_tls_index, data)) { +if (rte_thread_value_set (ws_tls_index, data)) {DRV_LOG (ERR ,"Failed setting specific workspace." ); err =-1 ; }
lib/librte_eal/include/rte_thread.h +10 -9
@@ -23,7 +23,7 @@ extern "C" {/** * TLS key type, an opaque pointer. */ -typedef struct eal_tls_key *rte_tls_key ; +typedef struct eal_tls_key *rte_thread_key ;/** * Set core affinity of the current thread.
@@ -65,13 +65,14 @@ void rte_thread_get_affinity(rte_cpuset_t *cpusetp);*/ __rte_experimental -int rte_thread_tls_key_create(rte_tls_key *key, void (*destructor)(void *)); +int rte_thread_key_create(rte_thread_key *key, +void (*destructor)(void *));/** * Delete a TLS data key visible to all threads in the process. * * @param key -* The key allocated by rte_thread_tls_key_create(). +* The key allocated by rte_thread_key_create(). * * @return * On success, zero.
@@ -80,15 +81,15 @@ int rte_thread_tls_key_create(rte_tls_key *key, void (*destructor)(void *));* EOTHER - Specific OS error. */ __rte_experimental -int rte_thread_tls_key_delete(rte_tls_key key); +int rte_thread_key_delete(rte_thread_key key);/** * Set value bound to the TLS key on behalf of the calling thread. * * @param key -* The key allocated by rte_thread_tls_key_create(). +* The key allocated by rte_thread_key_create(). * @param value -* The value bound to the rte_tls_key key for the calling thread. +* The value bound to the rte_thread_key key for the calling thread. * * @return * On success, zero.
@@ -97,13 +98,13 @@ int rte_thread_tls_key_delete(rte_tls_key key);* EOTHER - Specific OS error. */ __rte_experimental -int rte_thread_tls_value_set(rte_tls_key key, const void *value); +int rte_thread_value_set(rte_thread_key key, const void *value);/** * Get value bound to the TLS key on behalf of the calling thread. * * @param key -* The key allocated by rte_thread_tls_key_create(). +* The key allocated by rte_thread_key_create(). * * @return * On success, value data pointer (can also be NULL).
@@ -112,7 +113,7 @@ int rte_thread_tls_value_set(rte_tls_key key, const void *value);* EOTHER - Specific OS error. */ __rte_experimental -void *rte_thread_tls_value_get(rte_tls_key key); +void *rte_thread_value_get(rte_thread_key key); #ifdef __cplusplus }
lib/librte_eal/rte_eal_exports.def +4 -4
@@ -325,10 +325,10 @@ EXPORTS rte_vect_get_max_simd_bitwidth rte_vect_set_max_simd_bitwidth - rte_thread_tls_key_create - rte_thread_tls_key_delete - rte_thread_tls_value_get - rte_thread_tls_value_set + rte_thread_key_create + rte_thread_key_delete + rte_thread_value_get + rte_thread_value_set rte_mem_lock rte_mem_map
lib/librte_eal/unix/rte_thread.c +4 -4
@@ -17,7 +17,7 @@ struct eal_tls_key { };int -rte_thread_tls_key_create (rte_tls_key *key,void (*destructor)(void *)) +rte_thread_key_create (rte_thread_key *key,void (*destructor)(void *)) {int err;
@@ -39,7 +39,7 @@ rte_thread_tls_key_create(rte_tls_key *key, void (*destructor)(void *)) }int -rte_thread_tls_key_delete (rte_tls_key key) +rte_thread_key_delete (rte_thread_key key) {int err;
@@ -61,7 +61,7 @@ rte_thread_tls_key_delete(rte_tls_key key) }int -rte_thread_tls_value_set (rte_tls_key key,const void *value) +rte_thread_value_set (rte_thread_key key,const void *value) {int err;
@@ -81,7 +81,7 @@ rte_thread_tls_value_set(rte_tls_key key, const void *value) }void * -rte_thread_tls_value_get (rte_tls_key key) +rte_thread_value_get (rte_thread_key key) {if (!key) {RTE_LOG (DEBUG ,EAL ,"Invalid TLS key.\n" );
lib/librte_eal/version.map +4 -4
@@ -408,10 +408,10 @@ EXPERIMENTAL { rte_power_monitor; rte_power_monitor_wakeup; rte_power_pause; - rte_thread_tls_key_create; - rte_thread_tls_key_delete; - rte_thread_tls_value_get; - rte_thread_tls_value_set; + rte_thread_key_create; + rte_thread_key_delete; + rte_thread_value_get; + rte_thread_value_set; }; INTERNAL {
lib/librte_eal/windows/rte_thread.c +4 -4
@@ -12,7 +12,7 @@ struct eal_tls_key { };int -rte_thread_tls_key_create (rte_tls_key *key, +rte_thread_key_create (rte_thread_key *key, __rte_unused void (*destructor)(void *)) { *key =malloc (sizeof (**key));
@@ -32,7 +32,7 @@ rte_thread_tls_key_create(rte_tls_key *key, }int -rte_thread_tls_key_delete (rte_tls_key key) +rte_thread_key_delete (rte_thread_key key) {if (!key) {RTE_LOG (DEBUG ,EAL ,"Invalid TLS key.\n" );
@@ -50,7 +50,7 @@ rte_thread_tls_key_delete(rte_tls_key key) }int -rte_thread_tls_value_set (rte_tls_key key,const void *value) +rte_thread_value_set (rte_thread_key key,const void *value) {char *p;
@@ -70,7 +70,7 @@ rte_thread_tls_value_set(rte_tls_key key, const void *value) }void * -rte_thread_tls_value_get (rte_tls_key key) +rte_thread_value_get (rte_thread_key key) {void *output;
Signature · 1 line
2.16.1.windows.4
Re: [dpdk-dev] [PATCH v3 2/2] eal: rename key opaque pointer and functions in TLS API
Quoted 339 lines
From: dev [mailto:[email protected]] On Behalf Of Tal Shnaiderman
Sent: Wednesday, March 10, 2021 1:07 PMrename the key opaque pointer from
rte_tls_keytorte_thread_keyto avoid confusion with transport layer security.Also rename and remove the "
_tls" term from the following functions to avoid redundancy:
rte_thread_tls_key_createrte_thread_tls_key_deleterte_thread_tls_value_setrte_thread_tls_value_getSuggested-by Vladimir Medvedkin <[email protected]>Suggested-by Morten Brørup <[email protected]>Signed-off-by Tal Shnaiderman <[email protected]>--- drivers/net/mlx5/linux/mlx5_flow_os.c | 10 +++++----- drivers/net/mlx5/windows/mlx5_flow_os.c | 12 ++++++------ lib/librte_eal/include/rte_thread.h | 19 ++++++++++--------- lib/librte_eal/rte_eal_exports.def | 8 ++++---- lib/librte_eal/unix/rte_thread.c | 8 ++++---- lib/librte_eal/version.map | 8 ++++---- lib/librte_eal/windows/rte_thread.c | 8 ++++---- 7 files changed, 37 insertions(+), 36 deletions(-)drivers/net/mlx5/linux/mlx5_flow_os.c +2
-2@@ -7,12 +7,12 @@#include <rte_thread.h> /* Key of thread specific flow workspace data. */ -static rte_tls_key key_workspace; +static rte_thread_key key_workspace;int mlx5_flow_os_init_workspace_once (void ) { -if (rte_thread_tls_key_create (&key_workspace, flow_release_workspace)) { +if (rte_thread_key_create (&key_workspace, flow_release_workspace)) { DRV_LOG(ERR, "Can't create flow workspace data threadkey.");
drivers/net/mlx5/linux/mlx5_flow_os.c +3
-3return -ENOMEM ; }@@ -22,17 +22,17 @@ mlx5_flow_os_init_workspace_once(void)void *mlx5_flow_os_get_specific_workspace (void ) { -return rte_thread_tls_value_get (key_workspace); +return rte_thread_value_get (key_workspace); }int mlx5_flow_os_set_specific_workspace (struct mlx5_flow_workspace *data) { -return rte_thread_tls_value_set (key_workspace, data); +return rte_thread_value_set (key_workspace, data); }void mlx5_flow_os_release_workspace (void ) { -rte_thread_tls_key_delete (key_workspace); +rte_thread_key_delete (key_workspace); }drivers/net/mlx5/windows/mlx5_flow_os.c +3
-3@@ -252,7 +252,7 @@ struct mlx5_workspace_thread {*/ static struct mlx5_workspace_thread *curr;static struct mlx5_workspace_thread *first; -rte_tls_key ws_tls_index; +rte_thread_key ws_tls_index;static pthread_mutex_t lock_thread_list; static bool@@ -329,7 +329,7 @@ mlx5_flow_os_release_workspace(void)flow_release_workspace (first->mlx5_ws);free (first); } -rte_thread_tls_key_delete (ws_tls_index); +rte_thread_key_delete (ws_tls_index);pthread_mutex_destroy (&lock_thread_list); }@@ -368,7 +368,7 @@ mlx5_add_workspace_to_list(struct mlx5_flow_workspace *data)int mlx5_flow_os_init_workspace_once (void ) { -int err =rte_thread_tls_key_create (&ws_tls_index,NULL ); +int err =rte_thread_key_create (&ws_tls_index,NULL );if (err) {DRV_LOG(ERR, "Can't create flow workspace data thread
key.");drivers/net/mlx5/windows/mlx5_flow_os.c +2
-2@@ -381,7 +381,7 @@ mlx5_flow_os_init_workspace_once(void)void *mlx5_flow_os_get_specific_workspace (void ) { -return rte_thread_tls_value_get (ws_tls_index); +return rte_thread_value_get (ws_tls_index); }int @@ -391,7 +391,7 @@ mlx5_flow_os_set_specific_workspace(struct mlx5_flow_workspace *data)int old_err = rte_errno; rte_errno =0 ; -if (!rte_thread_tls_value_get (ws_tls_index)) { +if (!rte_thread_value_get (ws_tls_index)) {if (rte_errno) {DRV_LOG (ERR ,"Failed checking specific workspace." );drivers/net/mlx5/windows/mlx5_flow_os.c +1
-1rte_errno = old_err;@@ -409,7 +409,7 @@ mlx5_flow_os_set_specific_workspace(struct mlx5_flow_workspace *data)return -1 ; } } -if (rte_thread_tls_value_set (ws_tls_index, data)) { +if (rte_thread_value_set (ws_tls_index, data)) {DRV_LOG (ERR ,"Failed setting specific workspace." ); err =-1 ;drivers/net/mlx5/windows/mlx5_flow_os.c +0
-0}lib/librte_eal/include/rte_thread.h +4
-3@@ -23,7 +23,7 @@ extern "C" {/** * TLS key type, an opaque pointer. */ -typedef struct eal_tls_key *rte_tls_key ; +typedef struct eal_tls_key *rte_thread_key ;/** * Set core affinity of the current thread. @@ -65,13 +65,14 @@ void rte_thread_get_affinity(rte_cpuset_t*cpusetp); */ __rte_experimental -int rte_thread_tls_key_create(rte_tls_key *key, void (*destructor)(void *)); +int rte_thread_key_create (rte_thread_key *key, +void (*destructor)(void *));/** * Delete a TLS data key visible to all threads in the process. * * @param key -* The key allocated by rte_thread_tls_key_create(). +* The key allocated by rte_thread_key_create(). * * @return
* On success, zero.lib/librte_eal/include/rte_thread.h +3
-3@@ -80,15 +81,15 @@ int rte_thread_tls_key_create(rte_tls_key *key,void (*destructor)(void *)); * EOTHER - Specific OS error. */ __rte_experimental -int rte_thread_tls_key_delete(rte_tls_key key); +int rte_thread_key_delete(rte_thread_key key);/** * Set value bound to the TLS key on behalf of the calling thread. * * @param key -* The key allocated by rte_thread_tls_key_create(). +* The key allocated by rte_thread_key_create(). * @param value -* The value bound to the rte_tls_key key for the calling thread. +* The value bound to the rte_thread_key key for the calling thread. * * @return * On success, zero.
lib/librte_eal/include/rte_thread.h +3
-3@@ -97,13 +98,13 @@ int rte_thread_tls_key_delete(rte_tls_key key);* EOTHER - Specific OS error. */ __rte_experimental -int rte_thread_tls_value_set(rte_tls_key key, const void *value); +int rte_thread_value_set(rte_thread_key key, const void *value);/** * Get value bound to the TLS key on behalf of the calling thread. * * @param key -* The key allocated by rte_thread_tls_key_create(). +* The key allocated by rte_thread_key_create(). * * @return * On success, value data pointer (can also be NULL). @@ -112,7 +113,7 @@ int rte_thread_tls_value_set(rte_tls_key key, constvoid *value); * EOTHER - Specific OS error. */ __rte_experimental -void *rte_thread_tls_value_get(rte_tls_key key); +void *rte_thread_value_get(rte_thread_key key);#ifdef __cplusplus}
lib/librte_eal/rte_eal_exports.def +4
-4@@ -325,10 +325,10 @@ EXPORTS rte_vect_get_max_simd_bitwidth rte_vect_set_max_simd_bitwidth - rte_thread_tls_key_create - rte_thread_tls_key_delete - rte_thread_tls_value_get - rte_thread_tls_value_set + rte_thread_key_create + rte_thread_key_delete + rte_thread_value_get + rte_thread_value_set rte_mem_lock rte_mem_maplib/librte_eal/unix/rte_thread.c +4
-4@@ -17,7 +17,7 @@ struct eal_tls_key { };int -rte_thread_tls_key_create (rte_tls_key *key,void (*destructor)(void *)) +rte_thread_key_create (rte_thread_key *key,void (*destructor)(void *)) {int err;@@ -39,7 +39,7 @@ rte_thread_tls_key_create(rte_tls_key *key, void (*destructor)(void *)) }int -rte_thread_tls_key_delete (rte_tls_key key) +rte_thread_key_delete (rte_thread_key key) {int err;@@ -61,7 +61,7 @@ rte_thread_tls_key_delete(rte_tls_key key) }int -rte_thread_tls_value_set (rte_tls_key key,const void *value) +rte_thread_value_set (rte_thread_key key,const void *value) {int err;@@ -81,7 +81,7 @@ rte_thread_tls_value_set(rte_tls_key key, const void *value) }void * -rte_thread_tls_value_get (rte_tls_key key) +rte_thread_value_get (rte_thread_key key) {if (!key) {lib/librte_eal/unix/rte_thread.c +0
-0RTE_LOG (DEBUG ,EAL ,"Invalid TLS key.\n" );lib/librte_eal/version.map +4
-4@@ -408,10 +408,10 @@ EXPERIMENTAL { rte_power_monitor; rte_power_monitor_wakeup; rte_power_pause; - rte_thread_tls_key_create; - rte_thread_tls_key_delete; - rte_thread_tls_value_get; - rte_thread_tls_value_set; + rte_thread_key_create; + rte_thread_key_delete; + rte_thread_value_get; + rte_thread_value_set; }; INTERNAL {lib/librte_eal/windows/rte_thread.c +4
-5@@ -12,7 +12,7 @@ struct eal_tls_key { };int -rte_thread_tls_key_create (rte_tls_key *key, +rte_thread_key_create (rte_thread_key *key, __rte_unused void (*destructor)(void *)) { *key =malloc (sizeof (**key));@@ -32,7 +32,7 @@ rte_thread_tls_key_create(rte_tls_key *key, }int -rte_thread_tls_key_delete (rte_tls_key key) +rte_thread_key_delete (rte_thread_key key) {if (!key) {RTE_LOG (DEBUG ,EAL ,"Invalid TLS key.\n" );@@ -50,7 +50,7 @@ rte_thread_tls_key_delete(rte_tls_key key) }int -rte_thread_tls_value_set (rte_tls_key key,const void *value) +rte_thread_value_set (rte_thread_key key,const void *value) {char *p;@@ -70,7 +70,7 @@ rte_thread_tls_value_set(rte_tls_key key, const void *value) }void * -rte_thread_tls_value_get (rte_tls_key key) +rte_thread_value_get (rte_thread_key key) {void *output; --
Quoted 2 lines
2.16.1.windows.4
PATCH v2 2/2 eal: rename key opaque pointer in TLS API
In reply to Tal Shnaidermanrename the key opaque pointer from rte_tls_key to rte_thread_key to avoid confusion with transport layer security.
--- drivers/net/mlx5/linux/mlx5_flow_os.c | 2 +- drivers/net/mlx5/windows/mlx5_flow_os.c | 2 +- lib/librte_eal/include/rte_thread.h | 13 +++++++------ lib/librte_eal/unix/rte_thread.c | 8 ++++---- lib/librte_eal/windows/rte_thread.c | 8 ++++---- 5 files changed, 17 insertions(+), 16 deletions(-)
drivers/net/mlx5/linux/mlx5_flow_os.c +1 -1
@@ -7,7 +7,7 @@#include <rte_thread.h> /* Key of thread specific flow workspace data. */ -static rte_tls_key key_workspace; +static rte_thread_key key_workspace;int mlx5_flow_os_init_workspace_once (void )
drivers/net/mlx5/windows/mlx5_flow_os.c +1 -1
@@ -252,7 +252,7 @@ struct mlx5_workspace_thread {*/ static struct mlx5_workspace_thread *curr;static struct mlx5_workspace_thread *first; -rte_tls_key ws_tls_index; +rte_thread_key ws_tls_index;static pthread_mutex_t lock_thread_list; static bool
lib/librte_eal/include/rte_thread.h +7 -6
@@ -23,7 +23,7 @@ extern "C" {/** * TLS key type, an opaque pointer. */ -typedef struct eal_tls_key *rte_tls_key ; +typedef struct eal_tls_key *rte_thread_key ;/** * Set core affinity of the current thread.
@@ -63,7 +63,8 @@ void rte_thread_get_affinity(rte_cpuset_t *cpusetp);*/ __rte_experimental -int rte_thread_tls_key_create(rte_tls_key *key, void (*destructor)(void *)); +int rte_thread_tls_key_create(rte_thread_key *key, +void (*destructor)(void *));/** * Delete a TLS data key visible to all threads in the process.
@@ -76,7 +77,7 @@ int rte_thread_tls_key_create(rte_tls_key *key, void (*destructor)(void *));* On failure, a negative number and an error number is set in rte_errno. */ __rte_experimental -int rte_thread_tls_key_delete(rte_tls_key key); +int rte_thread_tls_key_delete(rte_thread_key key);/** * Set value bound to the TLS key on behalf of the calling thread.
@@ -84,14 +85,14 @@ int rte_thread_tls_key_delete(rte_tls_key key);* @param key * The key allocated by rte_thread_tls_key_create(). * @param value -* The value bound to the rte_tls_key key for the calling thread. +* The value bound to the rte_thread_key key for the calling thread. * * @return * On success, zero. * On failure, a negative number and an error number is set in rte_errno. */ __rte_experimental -int rte_thread_tls_value_set(rte_tls_key key, const void *value); +int rte_thread_tls_value_set(rte_thread_key key, const void *value);/** * Get value bound to the TLS key on behalf of the calling thread.
@@ -104,7 +105,7 @@ int rte_thread_tls_value_set(rte_tls_key key, const void *value);* On failure, NULL and an error number is set in rte_errno. */ __rte_experimental -void *rte_thread_tls_value_get(rte_tls_key key); +void *rte_thread_tls_value_get(rte_thread_key key); #ifdef __cplusplus }
lib/librte_eal/unix/rte_thread.c +4 -4
@@ -17,7 +17,7 @@ struct eal_tls_key { };int -rte_thread_tls_key_create (rte_tls_key *key,void (*destructor)(void *)) +rte_thread_tls_key_create (rte_thread_key *key,void (*destructor)(void *)) {int err;
@@ -39,7 +39,7 @@ rte_thread_tls_key_create(rte_tls_key *key, void (*destructor)(void *)) }int -rte_thread_tls_key_delete (rte_tls_key key) +rte_thread_tls_key_delete (rte_thread_key key) {int err;
@@ -61,7 +61,7 @@ rte_thread_tls_key_delete(rte_tls_key key) }int -rte_thread_tls_value_set (rte_tls_key key,const void *value) +rte_thread_tls_value_set (rte_thread_key key,const void *value) {int err;
@@ -81,7 +81,7 @@ rte_thread_tls_value_set(rte_tls_key key, const void *value) }void * -rte_thread_tls_value_get (rte_tls_key key) +rte_thread_tls_value_get (rte_thread_key key) {if (!key) {RTE_LOG (DEBUG ,EAL ,"Invalid TLS key.\n" );
lib/librte_eal/windows/rte_thread.c +4 -4
@@ -12,7 +12,7 @@ struct eal_tls_key { };int -rte_thread_tls_key_create (rte_tls_key *key, +rte_thread_tls_key_create (rte_thread_key *key, __rte_unused void (*destructor)(void *)) { *key =malloc (sizeof (**key));
@@ -32,7 +32,7 @@ rte_thread_tls_key_create(rte_tls_key *key, }int -rte_thread_tls_key_delete (rte_tls_key key) +rte_thread_tls_key_delete (rte_thread_key key) {if (!key) {RTE_LOG (DEBUG ,EAL ,"Invalid TLS key.\n" );
@@ -50,7 +50,7 @@ rte_thread_tls_key_delete(rte_tls_key key) }int -rte_thread_tls_value_set (rte_tls_key key,const void *value) +rte_thread_tls_value_set (rte_thread_key key,const void *value) {char *p;
@@ -70,7 +70,7 @@ rte_thread_tls_value_set(rte_tls_key key, const void *value) }void * -rte_thread_tls_value_get (rte_tls_key key) +rte_thread_tls_value_get (rte_thread_key key) {void *output;
Signature · 1 line
2.16.1.windows.4
Re: [dpdk-dev] [PATCH v2 2/2] eal: rename key opaque pointer in TLS API
Quoted 8 lines
From: Tal Shnaiderman [mailto:[email protected]]
Sent: Tuesday, March 2, 2021 4:27 PMrename the key opaque pointer from
rte_tls_keytorte_thread_keyto avoid confusion with transport layer security.Suggested-by Vladimir Medvedkin <[email protected]>Signed-off-by Tal Shnaiderman <[email protected]>
[...]
lib/librte_eal/include/rte_thread.h extern "C" { · line 26
Quoted 11 lines
lib/librte_eal/include/rte_thread.h +1
-1@@ -23,7 +23,7 @@ extern "C" {/** * TLS key type, an opaque pointer. */ -typedef struct eal_tls_key *rte_tls_key ; +typedef struct eal_tls_key *rte_thread_key ;
Yes.
lib/librte_eal/include/rte_thread.h void rte_thread_get_affinity(rte_cpuset_t *cpusetp); · line 69
Quoted 12 lines
lib/librte_eal/include/rte_thread.h +2
-1/** * Set core affinity of the current thread. @@ -63,7 +63,8 @@ void rte_thread_get_affinity(rte_cpuset_t *cpusetp);*/ __rte_experimental -int rte_thread_tls_key_create(rte_tls_key *key, void (*destructor)(void *)); +int rte_thread_tls_key_create (rte_thread_key *key, +void (*destructor)(void *));
Also get rid of the redundant name in the functions:
rte_thread_tls_xyz() -> rte_thread_xyz()
Re: [dpdk-dev] [PATCH v2 2/2] eal: rename key opaque pointer in TLS API
Quoted 45 lines
Subject: RE: [PATCH v2 2/2] eal: rename key opaque pointer in TLS API
External email: Use caution opening links or attachments
Quoted 8 lines
From: Tal Shnaiderman [mailto:[email protected]]
Sent: Tuesday, March 2, 2021 4:27 PMrename the key opaque pointer from
rte_tls_keytorte_thread_keyto avoid confusion with transport layer security.Suggested-by Vladimir Medvedkin <[email protected]>Signed-off-by Tal Shnaiderman <[email protected]>[...]
lib/librte_eal/include/rte_thread.h extern "C" { · line 26
Quoted 11 lines
lib/librte_eal/include/rte_thread.h +1
-1@@ -23,7 +23,7 @@ extern "C" {/** * TLS key type, an opaque pointer. */ -typedef struct eal_tls_key *rte_tls_key ; +typedef struct eal_tls_key *rte_thread_key ;Yes.
lib/librte_eal/include/rte_thread.h void rte_thread_get_affinity(rte_cpuset_t *cpusetp); · line 69
Quoted 12 lines
lib/librte_eal/include/rte_thread.h +2
-1/** * Set core affinity of the current thread. @@ -63,7 +63,8 @@ void rte_thread_get_affinity(rte_cpuset_t *cpusetp);*/ __rte_experimental -int rte_thread_tls_key_create(rte_tls_key *key, void (*destructor)(void *)); +int rte_thread_tls_key_create (rte_thread_key *key, +void (*destructor)(void *));Also get rid of the redundant name in the functions:
Quoted 1 line
rte_thread_tls_xyz()->rte_thread_xyz()
Right, will modify in v3, thanks.