[dpdk-dev] [PATCH 2/2] eal: rename key opaque pointer in TLS API

Tal Shnaiderman talshn at nvidia.com
Tue Mar 2 14:13:12 CET 2021


> Subject: RE: [dpdk-dev] [PATCH 2/2] eal: rename key opaque pointer in TLS
> API
> 
> External email: Use caution opening links or attachments
> 
> 
> > From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of Tal Shnaiderman
> > Sent: Tuesday, March 2, 2021 12:25 PM
> >
> > rename the key opaque pointer from rte_tls_key to rte_thread_tls_key
> > to avoid confusion with transport layer security.
> >
> 
> [...]
> 
> > diff --git a/lib/librte_eal/include/rte_thread.h
> > b/lib/librte_eal/include/rte_thread.h
> > index 39737d1829..90bcb02554 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_tls_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_tls_key *key,
> > +                     void (*destructor)(void *));
> >
> 
> I agree with your argument for TLS confusion.
> 
> How about rte_thread_key, instead of rte_thread_tls_key. Having both
> thread and tls seems redundant.
> 

Thanks for the input, make sense, I'll change the name to your suggestion.

> 
> Here are some more thoughts... It is meant as a provocation only, not a real
> suggestion:
> 
> The DPDK API often uses the term "lcore" as the abstraction for threads, e.g.
> rte_per_lcore.h refers to thread local storage using "per_lcore", while it is in
> fact "per thread". Why use another terminology in the API for thread keys,
> instead of sticking with the "lcore" naming tradition, e.g. struct
> rte_lcore_key?
> 

You're right, but then there are some functions in eal_common_thread.c which uses the 'thread' terminology, maybe it's a good idea to rework it all to a single accepted term.

> 
> Med venlig hilsen / kind regards
> - Morten Brørup
> 
> 



More information about the dev mailing list