|
239 | 239 | Openstack Cybborg
|
240 | 240 |
|
241 | 241 |
|
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 | + |
243 | 250 |
|
244 | 251 | https://specs.openstack.org/openstack/nova-specs/specs/pike/implemented/netronome-smartnic-enablement.html
|
245 | 252 |
|
|
265 | 272 | 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)?
|
266 | 273 | Well, the Linux kernel is monolithic, it's millions of lines of code.
|
267 | 274 | 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. |
269 | 281 |
|
270 | 282 | The networking stack inside the Linux kernel limits how many packets per second it can process.
|
271 | 283 | 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 | 324 | XDP
|
313 | 325 | Another way to achieve high performance would be partially bypassing the Linux kernel, for example using XDP.
|
314 | 326 |
|
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. |
316 | 328 |
|
317 | 329 | XDP (eXpress Data Path) is shipped with the kernel since version 4.8 and it is enabled by default, with CONFIG_BPF_SYSCALL.
|
318 | 330 |
|
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, |
322 | 331 |
|
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 |
324 | 333 |
|
325 | 334 | ┌─(ecrehar@elxahkpv4m2:pts/5)────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────(~/Downloads)─┐
|
326 | 335 | └─(15:09:%)── grep CONFIG_BPF_SYSCALL /boot/config-4.15.0-46-generic ──(mån,06.03)─┘
|
327 | 336 | CONFIG_BPF_SYSCALL=y
|
328 | 337 |
|
| 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 | + |
329 | 379 |
|
330 |
| -XDP is a hook in the Linux kernel. |
331 | 380 |
|
332 | 381 |
|
333 | 382 | Jumping between kernel space and user space cost on performance - TO BE ADDED
|
|
0 commit comments