pinggit / dpdk-contrail-book

contrail dpdk day one book
9 stars 3 forks source link

is queue in NIC (physical device) itself or main memory? #2

Closed pinggit closed 3 years ago

pinggit commented 4 years ago

term "queue" is mentioned in different context.

  1. sometime it is mem/buf allocated to each CPU.
  2. sometime it is buffer in the NIC.

for me the main memory and NIC sounds 2 different things. kind of confusing hence needs confirmation.

I guess it's the same queue in main memory only, queue is an allocated buf in main memory, which is shared by CPU, NIC and all processes. need confirmation.

it is also possible that queue exists in both places, there is queue in NIC, and queue in main memory for vCPU (lcore).

Queue packets processing consists in :

- queues: in a network interface
- pthreads (lcore): for packet enqueue or dequeue (packet polling)
- descriptor rings (TX/RX): for packet transfer between interface queue and host memory (mbuf)
- memory spaces (mempool)
pinggit commented 4 years ago

answer from laurent:


ANSWER (LD): A queue is a concept ... that not accurately defined. In a short, this is a buffer in which incoming packets and outgoing ones are stored.

A queue has 2 directions:

So, for DPDK and VirtIO a queue is made of:

But sometimes, we are also speaking about a Q for each single direction .... So, Q depends of what you are telling about:

Threads is a different concept. The thread is the program which is processing the Q (dequeueing packets or enqueueing packets). Thread is a programming concept (parallel processing). Indeed you have a single polling thread per Q

This is why we are most often mixing this two concepts.

Keep in mind DPDK concept:

This is why we a binding a single Thread (named LCORE in DPDK ...) onto a single CPU. CPU is loaded at 100% because the (single - due to pinning and isolation rules) running on it is continuously polling the Q ... what ever a packet has been received in the Q or not (there is no interruption mechanism that could allow DPDK thread to sleep because there is no packet in the Q - this is a per design choice).

ldurandadomia commented 4 years ago

term "queue" is mentioned in different context.

  1. sometime it is mem/buf allocated to each CPU.
  2. sometime it is buffer in the NIC.

for me the main memory and NIC sounds 2 different things. kind of confusing hence needs confirmation.

I guess it's the same queue in main memory only, queue is an allocated buf in main memory, which is shared by CPU, NIC and all processes. need confirmation.

it is also possible that queue exists in both places, there is queue in NIC, and queue in main memory for vCPU (lcore).

Queue packets processing consists in :

- queues: in a network interface
- pthreads (lcore): for packet enqueue or dequeue (packet polling)
- descriptor rings (TX/RX): for packet transfer between interface queue and host memory (mbuf)
- memory spaces (mempool)

Q (ping): is a queue an structure in MEMORY, or in NIC, or in BOTH place? A (LD); We have to make distinction between several kind of queues:

  • NIC Physical Q: these Q are stored inside NIC physical memory.
  • DPDK Q (for physical NIC): which are Q created by DPDK application into Host memory.
  • VM queues: which are Q created in host memory by QEMU virtio.

Next you have to consider the packet flow between Q (from Physical to VM).

pinggit commented 4 years ago

nice! so let me see if I caught it exactly: image

FROM NOW DPDK APPLICATION CODE IS INVOLVED _ HERE THE DPDK VROUTER IS ENTERING IN ACTION

image

ldurandadomia commented 4 years ago

Yes correct. Small remark. If VM is DPDK, "VM is dpdk, then repeat above (but with is on internal rings)"

I do not think so. I guess, rings are the same :-) (virtio rings = DPDK rings) VM DPDK application is polling directly virtio rings.

pinggit commented 3 years ago

to close this issue:

image

so I'd like to carefully use these terms:

let's talk about from packet path perpsective:

we can say: we are not quite sure how the "hardware queue" (inside NIC) is organized, and we don't care, but we know how the DPDK queue organized. and whenever you talk about DMA and RSS, it is between pNIC "hardware queue" in NIC, and "dpdk queue" in memory

"but NIC and DPDK queues are quite the same. Because DPDK and PMD take care what you have on NIC memory is replicated in host memory in real DPDK rings."