travelping / vpp

5G User Plane Function (UPF) based on VPP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Multi-thread support in UPF (flow table)

fdangtran opened this issue · comments

We encountered a problem related to setting workers (multi-threading). When number of workers is set, even 1, the following assert is hit in flow_entry_alloc
ASSERT (f->cpu_index == os_get_thread_index());

What is noted:

  • Flow_table_init:

Initializes flowtable per cpu, but the cpu_index is that of the main thread (?)
Flow_alloc_entry: asserts since the cpu_index of the allocated flow_entry is not that of the current thread (since we have a worker thread).

  • But can there be another issue:

The same flow_entry is used for both UL and DL packets of the ‘flow’ (src/dst IP and src/dst port).

upf_flow_process:
Retrieves a flow_entry (from the table, for the current cpu_index). But if the worker thread processing packets on DL is different from that of UL, there maybe be an issue.
VPP executes packets from one interface (or hw queue) on the same thread. But the UL and DL worker threads could be different. This configuration is desirable.

So far we have been running the UPF plugin with one worker only. There might be other race or multi thread problems with it.