Re: Accessing TLS for EAL threads

2021-11-18 Thread Stephen Hemminger
On Tue, 16 Nov 2021 17:38:43 +
Antonio Di Bacco  wrote:

> I need to emulate the pthread_setspecific and pthread_getspecific for EAL 
> threads. I don't find any suitable APIs in the DPDK to access the TLS and get 
> and set keys.
> 
> I launched a number of threads using the rte_eal_remote launch but I don't 
> find any API that allows me to access the TLS for those threads.

There is not an API for a thread to access another threads local storage 
directly.
The DPDK TLS is wrapper around the glibc (and Windows) implementation of TLS.

For particular data structures, you can create a global data structure that is 
an
array of pointers indexed by lcore, and each lcore fills in itself.

Or do a more complex API via message passing.


Re: Accessing TLS for EAL threads

2021-11-17 Thread Pavel Vazharov
Hi there,

I think the DPDK uses the pthread_ functions to manages its threads. You
can see in `rte_eal_init` in `lib/librte_eal/linux/eal.c` that it "spawns"
the threads using
```
/* create a thread for each lcore */

ret = pthread_create(&lcore_config[i].thread_id, NULL,

 eal_thread_loop, NULL);
```
So I think you should be able to use other pthread_ functions without
problems from inside the EAL threads.
Hope that helps.

Regards,
Pavel.

On Thu, Nov 18, 2021 at 9:24 AM Antonio Di Bacco <
antonio.di-ba...@keysight.com> wrote:

> I need to emulate the pthread_setspecific and pthread_getspecific for EAL
> threads. I don’t find any suitable APIs in the DPDK to access the TLS and
> get and set keys.
>
>
>
> I launched a number of threads using the rte_eal_remote launch but I don’t
> find any API that allows me to access the TLS for those threads.
>
>
>
>
>
>
>
>
>