yanet-platform / yanet

A high performance framework for forwarding traffic based on DPDK
Other
165 stars 17 forks source link

Add symmetric mode #52

Closed taitov closed 9 months ago

taitov commented 9 months ago

In the current architecture, each RX queue binds to exactly one worker (one CPU core), and the number of TX queues is equal to the number of all workers (including slowworker). But in some cases, the same number of RX and TX queues is required. For example, virtual device or hardware without RSS.

Now you can specify the option symmetric_mode: true on the port, which will create the same number of RX queues as on TX.

1 core per port:

symmetric_mode: false (default)

port0_rx0 ------> worker0 ---+--> port0_tx0
                  (core0)    \--> port1_tx0

port1_rx0 ------> worker1 ---+--> port0_tx1
                  (core1)    \--> port1_tx1

kernel ------> slowworker ---+--> port0_tx2
               (core2)       \--> port1_tx2

total: RX 1, TX 3 per port
symmetric_mode: true

port0_rx0 ---+--> worker0 ---+--> port0_tx0
port0_rx1 ---|    (core0)    \--> port1_tx0
port0_rx2 ---/

port1_rx0 ---+--> worker1 ---+--> port0_tx1
port1_rx1 ---|    (core1)    \--> port1_tx1
port1_rx2 ---/

kernel ------> slowworker ---+--> port0_tx2
               (core2)       \--> port1_tx2

total: RX 3, TX 3 per port

2 cores per port:

symmetric_mode: false (default)

port0_rx0 ------> worker0 ---+--> port0_tx0
                  (core0)    \--> port1_tx0

port0_rx1 ------> worker1 ---+--> port0_tx1
                  (core1)    \--> port1_tx1

port1_rx0 ------> worker2 ---+--> port0_tx2
                  (core2)    \--> port1_tx2

port1_rx1 ------> worker3 ---+--> port0_tx3
                  (core3)    \--> port1_tx3

kernel ------> slowworker ---+--> port0_tx4
               (core4)       \--> port1_tx4

total: RX 2, TX 5 per port
symmetric_mode: true

port0_rx0 ---+--> worker0 ---+--> port0_tx0
port0_rx2 ---|    (core0)    \--> port1_tx0
port0_rx4 ---/

port0_rx1 ---+--> worker1 ---+--> port0_tx1
port0_rx3 ---/    (core1)    \--> port1_tx1

port1_rx0 ---+--> worker2 ---+--> port0_tx2
port1_rx2 ---|    (core2)    \--> port1_tx2
port1_rx4 ---/

port1_rx1 ---+--> worker3 ---+--> port0_tx3
port1_rx3 ---/    (core3)    \--> port1_tx3

kernel ------> slowworker ---+--> port0_tx4
               (core4)       \--> port1_tx4

total: RX 5, TX 5 per port