From: Tal Shnaiderman <talshn@nvidia.com>
To: dev@dpdk.org
Cc: thomas@monjalon.net, pallavi.kadam@intel.com,
dmitry.kozliuk@gmail.com, navasile@linux.microsoft.com,
dmitrym@microsoft.com, david.marchand@redhat.com,
anatoly.burakov@intel.com, vladimir.medvedkin@intel.com,
mb@smartsharesystems.com
Subject: [dpdk-dev] [PATCH v5 2/2] eal: rename key opaque pointer and functions in TLS API
Date: Tue, 16 Mar 2021 11:15:42 +0200 [thread overview]
Message-ID: <20210316091542.7224-3-talshn@nvidia.com> (raw)
In-Reply-To: <20210316091542.7224-1-talshn@nvidia.com>
rename 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_create
rte_thread_tls_key_delete
rte_thread_tls_value_set
rte_thread_tls_value_get
Suggested-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
Suggested-by: Morten Brørup <mb@smartsharesystems.com>
Signed-off-by: Tal Shnaiderman <talshn@nvidia.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
---
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(-)
diff --git a/doc/guides/rel_notes/release_21_05.rst b/doc/guides/rel_notes/release_21_05.rst
index 21dc6d2342..914b176793 100644
--- a/doc/guides/rel_notes/release_21_05.rst
+++ b/doc/guides/rel_notes/release_21_05.rst
@@ -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
-----------
diff --git a/drivers/net/mlx5/linux/mlx5_flow_os.c b/drivers/net/mlx5/linux/mlx5_flow_os.c
index 732b1b2dd8..893f00b824 100644
--- a/drivers/net/mlx5/linux/mlx5_flow_os.c
+++ b/drivers/net/mlx5/linux/mlx5_flow_os.c
@@ -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);
}
diff --git a/drivers/net/mlx5/windows/mlx5_flow_os.c b/drivers/net/mlx5/windows/mlx5_flow_os.c
index 2cc02df322..c4d5790726 100644
--- a/drivers/net/mlx5/windows/mlx5_flow_os.c
+++ b/drivers/net/mlx5/windows/mlx5_flow_os.c
@@ -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;
}
diff --git a/lib/librte_eal/include/rte_thread.h b/lib/librte_eal/include/rte_thread.h
index e8f9365953..2d1aaeedf4 100644
--- a/lib/librte_eal/include/rte_thread.h
+++ b/lib/librte_eal/include/rte_thread.h
@@ -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
}
diff --git a/lib/librte_eal/rte_eal_exports.def b/lib/librte_eal/rte_eal_exports.def
index 474cf123fa..c320077547 100644
--- a/lib/librte_eal/rte_eal_exports.def
+++ b/lib/librte_eal/rte_eal_exports.def
@@ -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
diff --git a/lib/librte_eal/unix/rte_thread.c b/lib/librte_eal/unix/rte_thread.c
index b187c69a4c..c72d619ec1 100644
--- a/lib/librte_eal/unix/rte_thread.c
+++ b/lib/librte_eal/unix/rte_thread.c
@@ -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");
diff --git a/lib/librte_eal/version.map b/lib/librte_eal/version.map
index fce90a112f..c07aab176c 100644
--- a/lib/librte_eal/version.map
+++ b/lib/librte_eal/version.map
@@ -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 {
diff --git a/lib/librte_eal/windows/rte_thread.c b/lib/librte_eal/windows/rte_thread.c
index fa9e360855..667287c387 100644
--- a/lib/librte_eal/windows/rte_thread.c
+++ b/lib/librte_eal/windows/rte_thread.c
@@ -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;
--
2.16.1.windows.4
next prev parent reply other threads:[~2021-03-16 9:18 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-02 15:26 [dpdk-dev] [PATCH v2 0/2] EAL Thread TLS API enhancements Tal Shnaiderman
2021-03-02 15:26 ` [dpdk-dev] [PATCH v2 1/2] eal: error number enhancement for thread TLS API Tal Shnaiderman
2021-03-02 17:09 ` Dmitry Kozlyuk
2021-03-03 10:37 ` Tal Shnaiderman
2021-03-03 11:10 ` Dmitry Kozlyuk
2021-03-03 11:53 ` Tal Shnaiderman
2021-03-10 12:06 ` [dpdk-dev] [PATCH v3 0/2] EAL Thread TLS API enhancements Tal Shnaiderman
2021-03-10 12:06 ` [dpdk-dev] [PATCH v3 1/2] eal: error number enhancement for thread TLS API Tal Shnaiderman
2021-03-10 12:48 ` [dpdk-dev] [PATCH v4 0/2] EAL Thread TLS API enhancements Tal Shnaiderman
2021-03-10 12:48 ` [dpdk-dev] [PATCH v4 1/2] eal: error number enhancement for thread TLS API Tal Shnaiderman
2021-03-10 19:45 ` Narcisa Ana Maria Vasile
2021-03-15 15:37 ` Tal Shnaiderman
2021-03-13 2:29 ` Dmitry Kozlyuk
2021-03-15 23:14 ` Thomas Monjalon
2021-03-16 9:15 ` [dpdk-dev] [PATCH v5 0/2] EAL Thread TLS API enhancements Tal Shnaiderman
2021-03-16 9:15 ` [dpdk-dev] [PATCH v5 1/2] eal: error number enhancement for thread TLS API Tal Shnaiderman
2021-03-16 13:28 ` [dpdk-dev] [PATCH v6 0/2] EAL Thread TLS API enhancements Tal Shnaiderman
2021-03-16 13:28 ` [dpdk-dev] [PATCH v6 1/2] eal: error number enhancement for thread TLS API Tal Shnaiderman
2021-03-16 13:28 ` [dpdk-dev] [PATCH v6 2/2] eal: rename key opaque pointer and functions in " Tal Shnaiderman
2021-03-26 8:24 ` [dpdk-dev] [PATCH v6 0/2] EAL Thread TLS API enhancements Thomas Monjalon
2021-03-16 9:15 ` Tal Shnaiderman [this message]
2021-03-10 12:48 ` [dpdk-dev] [PATCH v4 2/2] eal: rename key opaque pointer and functions in TLS API Tal Shnaiderman
2021-03-15 23:16 ` Thomas Monjalon
2021-03-16 9:17 ` Tal Shnaiderman
2021-03-10 12:06 ` [dpdk-dev] [PATCH v3 " Tal Shnaiderman
2021-03-10 12:22 ` Morten Brørup
2021-03-02 15:26 ` [dpdk-dev] [PATCH v2 2/2] eal: rename key opaque pointer " Tal Shnaiderman
2021-03-02 15:36 ` Morten Brørup
2021-03-04 11:16 ` Tal Shnaiderman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210316091542.7224-3-talshn@nvidia.com \
--to=talshn@nvidia.com \
--cc=anatoly.burakov@intel.com \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=dmitry.kozliuk@gmail.com \
--cc=dmitrym@microsoft.com \
--cc=mb@smartsharesystems.com \
--cc=navasile@linux.microsoft.com \
--cc=pallavi.kadam@intel.com \
--cc=thomas@monjalon.net \
--cc=vladimir.medvedkin@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).