Skip to content

Commit 08d4ae5

Browse files
author
Elena Crenguta Lindqvist
committed
-..
1 parent 5ac7430 commit 08d4ae5

File tree

2 files changed

+66
-11
lines changed

2 files changed

+66
-11
lines changed

itnot/index.html

Lines changed: 57 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,14 @@
239239
Openstack Cybborg
240240

241241

242-
Some smartNIC vendors use native virtio driver while other use proprietary
242+
Some smartNIC vendors might use native virtio driver while others use proprietary drivers.
243+
244+
A slide with the dropping traffic from having the same mac
245+
traffic reaches NIC in dut5 but is dropped, same mac?
246+
root@FPA1066GX-DA2:~# ovs-appctl dpif/dump-flows br0
247+
in_port(14),eth(src=68:05:ca:91:36:b5,dst=68:05:ca:91:36:b5),eth_type(0x0800),ipv4(src=192.168.0.1,dst=192.168.1.1,proto=6),tcp(src=1234,dst=5678), packets:0, bytes:0, used:7.340s, actions:drop
248+
249+
243250

244251
https://specs.openstack.org/openstack/nova-specs/specs/pike/implemented/netronome-smartnic-enablement.html
245252

@@ -265,7 +272,12 @@
265272
Why is the Linux kernel a problem when we talk about latency and performance ( with performance, I mean higher throughput at a lower CPU cost)?
266273
Well, the Linux kernel is monolithic, it's millions of lines of code.
267274
It contains lots of drivers which makes the Linux kernel work with any hw, not just your specific hw/smartNIC.
268-
It allows running many applications at the same time by using a time sharing layer. Resources like CPU, mem exposed by the kernel can be shared between all the processes running.
275+
It allows running many applications at the same time by using a time sharing layer. Resources like CPU, mem exposed by the kernel can be shared between all the processes running.
276+
277+
278+
How your operating system deals with data
279+
Data destined to a particular system is first received by the NIC and is stored in the ring buffer of the reception (RX) present in the NIC, which also has TX (for data transmission). Once the packet is accessible to the kernel, the device driver raises softirq (software interrupt), which makes the DMA (data memory access) of the system send that packet to the Linux kernel. The packet data in the Linux kernel gets stored in the sk_buff data structure to hold the packet up to MTU (maximum transfer unit). When all the packets are filled in the kernel buffer, they get sent to the upper processing layer – IP, TCP or UDP. The data then gets copied to the preferred data receiving process.
280+
Note: Initially, a hard interrupt is raised by the device driver to send data to the kernel, but since this is an expensive task, it is replaced by a software interrupt. This is handled by the NAPI (new API), which makes the processing of incoming packets more efficient by putting the device driver in polling mode.
269281

270282
The networking stack inside the Linux kernel limits how many packets per second it can process.
271283
Too many packets per second means CPUs get busy just receiving packets, then either the packets are dropped or we CPU starve the applications.
@@ -312,22 +324,59 @@
312324
XDP
313325
Another way to achieve high performance would be partially bypassing the Linux kernel, for example using XDP.
314326

315-
XDP DP (eXpress Data Path) is an eBPF based high performance data path merged in the Linux kernel.
327+
XDP (eXpress Data Path) is a component in the kernel that can be used for fast packet processing. It is an eBPF (I'll get back to explaining what eBPF is) based high performance data path merged in the Linux kernel.
316328

317329
XDP (eXpress Data Path) is shipped with the kernel since version 4.8 and it is enabled by default, with CONFIG_BPF_SYSCALL.
318330

319-
What the heck is eBPF ?
320-
eBPF stands for "enhanced Berkeley Packet Filter" it's a linux kernel technology
321-
which is an in-kernel virtual machine that was originally used for to run mini-filter programs efficiently,
322331

323-
To check if XDP it is enabled in the kernel, it's simply grepping for it in the kernel config file
332+
To check if XDP it is enabled in the kernel, it's as simply as grepping for it in the kernel config file
324333

325334
┌─(ecrehar@elxahkpv4m2:pts/5)────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────(~/Downloads)─┐
326335
└─(15:09:%)── grep CONFIG_BPF_SYSCALL /boot/config-4.15.0-46-generic ──(mån,06.03)─┘
327336
CONFIG_BPF_SYSCALL=y
328337

338+
The Linux kernel configuration item CONFIG_XDP_SOCKETS:
339+
340+
prompt: XDP sockets
341+
type: bool
342+
depends on: CONFIG_BPF_SYSCALL
343+
defined in net/xdp/Kconfig
344+
found in Linux kernels: 4.18–4.20, 5.0–5.1, 5.2-rc+HEAD
345+
346+
347+
348+
PICTURE OF XDP
349+
350+
So XDP is a hook in the Linux kernel, not a kernel bypass but a bypass of the network stack
351+
XDP operates directly on the packet buffer. (packets are deleted into sockets , decision taken 20 years ago, and this is not the fastest way)
352+
353+
DPDK steals the whole NIC, we dont do that with XDP , not taking the whole NIC.
354+
355+
a filter on receive but zero copy to user space
356+
357+
358+
XDP can be used in two ways:
359+
first mode
360+
Native mode XDP , a driver hook , before memory allocation , small no of instructions executed before we start processing packets
361+
limited number of drivers that support XDP
362+
363+
second mode
364+
generic mode
365+
works on any net device , driver independent , but larger number of instructions executed which mean lower performance than native mode, when it comes to packet processing
366+
367+
dataplane which is inside the kernel
368+
control plane in user space which is done from eBPF, userspace load eBPF program , everything goes through the BPF-syscall
369+
370+
the Native way is the way to go
371+
XDP driver hook
372+
373+
What the heck is eBPF ?
374+
eBPF stands for "enhanced Berkeley Packet Filter" it's a linux kernel technology that is used by e.g. tcpdump and other analysis tools.
375+
eBPF is used to extract millions of metrics from the kernel and applications for troubleshooting purposes, deep monitoring or exploring running software.
376+
eBPF is basically like a superpower.
377+
BPF was initially used for tools like tcpdump but Alexei Starovoitov introduced eBPF to be used for things like to NATing, routing, doing what iptables does for example.
378+
329379

330-
XDP is a hook in the Linux kernel.
331380

332381

333382
Jumping between kernel space and user space cost on performance - TO BE ADDED

itnot/notes

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,12 @@ https://blog.cloudflare.com/why-we-use-the-linux-kernels-tcp-stack/
254254
https://blogs.igalia.com/dpino/2019/01/07/a-brief-introduction-to-xdp-and-ebpf/
255255
https://blogs.igalia.com/dpino/2019/01/02/build-a-kernel/
256256
https://www.oreilly.com/ideas/ebpf-and-systems-performance
257-
258-
259-
257+
https://conferences.oreilly.com/velocity/vl-ca-2017/public/schedule/detail/59282
258+
https://cdn.oreillystatic.com/en/assets/1/event/244/Performance%20analysis%20superpowers%20with%20Linux%20eBPF%20Presentation.pdf
259+
https://www.youtube.com/watch?v=bj3qdEDbCD4 Brendan
260+
http://www.brendangregg.com/blog/2016-03-05/linux-bpf-superpowers.html
261+
https://www.youtube.com/watch?v=Efw1wWT6OMA Alexei
262+
https://cilium.io/blog/2018/11/20/fb-bpf-firewall/
263+
https://www.youtube.com/watch?v=Y103CWBa1BI XDP talk
264+
https://blogs.msdn.microsoft.com/peterwie/2006/03/09/what-is-dma-part-4-common-buffer/
265+
https://opensourceforu.com/2016/10/network-performance-monitoring/

0 commit comments

Comments
 (0)