Hi Olivia, 

Inline.

> On Mar 29, 2021, at 8:19 AM, Olivia Dunham <theoliviadun...@gmail.com> wrote:
> 
> Dear All,
> 
> I have been reading VPP host stack and saw the example TCP proxy in 
> (src/plugins/hs_apps/proxy.c).
> I understand that the main thread handles the CLI command and the callbacks 
> are registered for TCP proxy by main thread.

That’s correct. To be very precise about it, the cli process (runs on main 
thread) initializes and registers the proxy as an application with the session 
layer (vnet_application_attach).

> Can anyone explain the thread/core ownership during packet processing using 
> sample TCP proxy as example?
> 
> 1. Is there a flow to worker core mapping or packets of same flow can be 
> processed by different worker cores? In the first case, does the worker core 
> that accepts the incoming TCP connection is set as the owner for the flow?

Flows are pinned to vpp workers and yes, the owner of a tcp connection is set 
on accept, for passive opens, and on syn-ack, for active opens. 

> 2. Where do the callback functions run? In the same worker core that triggers 
> the event or in main core?

For builtin applications, like the proxy, the callbacks run on the workers. For 
external applications (e.g., those that use vcl) the callbacks deliver 
notifications over shared memory to app workers which should not overlap vpp’s 
workers. 

> 3. Is it possible to avoid sharing between cores and keep everything in same 
> worker core. i.e. All packets for a given flow as well as callbacks to 
> execute in same worker core. 

Yup, that’s actually how vpp builtin applications work. In case of the proxy, 
note that the passive open leg and the active open leg need not be on the same 
worker. Also, the owner for a tcp connection is actually decided by rss 
hashing, so it’s not controlled by the application. 

Regards,
Florin

> 
> 

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#19046): https://lists.fd.io/g/vpp-dev/message/19046
Mute This Topic: https://lists.fd.io/mt/81698902/21656
Mute #hoststack:https://lists.fd.io/g/vpp-dev/mutehashtag/hoststack
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