> On 10 Mar 2020, at 17:39, visaev via Lists.Fd.Io 
> <visaev=netgate....@lists.fd.io> wrote:
> 
> Hi there,
> 
> There is a VPP APIs function sw_interface_set_rx_placement(). This function 
> allows us to set specific worker for the specified queue.
> And this function takes worker_id as an argument. worker_id is then 
> translated to thread_id by using following conversion:
>   if (is_main)
>     thread_index = 0;                    
>   else
>     thread_index += vdm->first_worker_thread_index;
> 
> thread_index here is a worker_id in reality. Thus before using 
> sw_interface_set_rx_placement() caller has to calculate worker_id. It is just 
> number of thread with type "workers" starting from zero. I also see that 
> there is a function inside VPP which converts thread_id to worker_id:
> always_inline u32
> vlib_get_worker_index (u32 thread_index)
> {
>   return thread_index - 1;
> }
> 

This is basically placeholder, as we currently doesn’t have other thread types 
except worker threads, but that may change in the future….

> 
> But it is not used anywhere and I am not sure if -1 will be correct in future 
> or in case if any plugin adds its own threads.
> Actually this function is the only API function which uses worker_id as an 
> argument. sw_interface_rx_placement_details() takes argument with name 
> worker_id but interprets it as thread_id (e.g. there is code like (worker_id 
> == 0) ? "main" : "worker" inside this function).
> 
> I think it is clear that worker_id is mixed with thread_id through all VPP 
> API code. In my opinion it is much more convenient for caller and developer 
> to use just thread_id for all VPP API functions.
> So I want to replace worker_id and is_main arguments with single thread_id 
> argument for sw_interface_set_rx_placement().
> 
> My question is: Is it allowed to change API function interface in VPP? 
> Because I do not see any robust way to use sw_interface_set_rx_placement() 
> function.
> 

It is intentionally done this way as we don’t want people to assign rx queues 
to threads which are not worker threads. I will prefer that this stays as it is…

— 
Damjan
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#15720): https://lists.fd.io/g/vpp-dev/message/15720
Mute This Topic: https://lists.fd.io/mt/71860601/21656
Mute #vpp: https://lists.fd.io/mk?hashtag=vpp&subid=1480452
Group Owner: vpp-dev+ow...@lists.fd.io
Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to