
Linux Kernel v4.8부터 merge
(https://kernelnewbies.org/Linux_4.8)된 (새로운 Address family 정의 AF_XDP의 경우
Linux Kernel v4.18부터 merge
(https://kernelnewbies.org/Linux_4.18)) eBPF 기반 고성능 Data 경로(Programmable 가능한 Network Data Path) 입니다.
netmap
(http://info.iet.unipi.it/~luigi/netmap/), DPDK(Data Plane Development Kit),
VPP(Vector Packet Processing)
(https://fd.io/),
PF_ring
(https://www.ntop.org/products/packet-capture/pf_ring/), manglev, Onload,
Snabb
(https://github.com/snabbco/snabb), ...)을 강구해왔습니다.
수신 루틴 초입
(https://github.com/torvalds/linux/blob/v4.14/drivers/net/ethernet/intel/i40e/i40e_txrx.c#L2124) (i40 driver의 경우 "i40e_run_xdp(rx_ring, &xdp)", Driver내에서 DMA sync 직후 최대한 빠른 실행 위치) 에서 프로그램을 실행하고 아니면
좀 더 위에서 실행
(https://github.com/torvalds/linux/blob/v4.14/net/core/dev.c#L3993) (netif_receive_skb() 에서 "do_xdp_generic(rcu_dereference(skb->dev->xdp_prog), skb);")한다고 이해하면 됩니다. (추가적으로 tc 에서도 실행될 수 있습니다. - "net/sched/" 에서 bpf_prog_run 함수 호출부분)
BPF and XDP Reference Guide
(https://docs.cilium.io/en/latest/bpf/)
BPF Documentation on kernel.org
(https://www.kernel.org/doc/html/latest/bpf/)
AF_XDP documentation
(https://www.kernel.org/doc/html/latest/networking/af_xdp.html)
eBPF Instruction Set
(https://www.kernel.org/doc/html/latest/bpf/standardization/instruction-set.html)
XDP Hands-On Tutorial
(https://github.com/xdp-project/xdp-tutorial)
Unofficial eBPF spec
(https://github.com/iovisor/bpf-docs/blob/master/eBPF.md),
The LLVM Target-Independent Code Generator
(https://llvm.org/docs/CodeGenerator.html#packet-data-access-bpf-abs-bpf-ind)

libbpf
(https://github.com/libbpf/libbpf/) 를 사용하여 BPF 프로그램을 만들고 이를 Kernel로 load 하도록 만드는 것에서부터 시작합니다.
LLVM
(https://llvm.org/) +
Clang
(https://clang.llvm.org/) (+ libelf + libpcap + ...) 환경은 주요 배포판에서 다음과 같이 패키지를 설치할 수 있습니다. 또한 자신의 타겟 실행 환경이 개발환경과 같거나 다른 경우등의 조건에 따라서 Kernel headers,
bpftool
(https://github.com/torvalds/linux/tree/master/tools/bpf/bpftool), perf 등을 설치할 수 있습니다. (참고:
https://github.com/xdp-project/xdp-tutorial/blob/master/setup_dependencies.org
)
$ sudo dnf install clang llvm $ sudo dnf install elfutils-libelf-devel libpcap-devel
$ sudo dnf install kernel-headers
$ sudo dnf install bpftool
$ sudo dnf install perf
$ sudo apt install clang llvm $ sudo apt install libelf-dev libpcap-dev gcc-multilib build-essential
$ sudo apt install linux-headers-$(uname -r)
$ sudo apt install linux-tools-common linux-tools-generic
$ sudo apt install linux-perf
$ sudo apt install linux-tools-$(uname -r)
$ sudo zypper install clang llvm $ sudo zypper install libelf-devel libpcap-devel
$ sudo zypper install kernel-devel
$ sudo zypper install bpftool
$ sudo zypper install perf
$ sudo apt install autoconf automake m4 $ sudo apt install pkg-config $ sudo apt install libtool $ sudo apt install cmake $ sudo apt install kernel-package $ sudo apt install iproute2 $ sudo apt install dwarves ...
sudo add-apt-repository ppa:cappelikan/ppa sudo apt install mainline sudo mainline --list sudo mainline --install <version string>
/* SPDX-License-Identifier: GPL-2.0 */
#include <linux/bpf.h>
#if 0L /* libbpf header 가 참조가능한 환경인 경우 */
#include <bpf/bpf_helpers.h>
#else /* no libbpf header */
# if !defined(SEC)
# define SEC(name) \
_Pragma("GCC diagnostic push") \
_Pragma("GCC diagnostic ignored \"-Wignored-attributes\"") \
__attribute__((section(name), used)) \
_Pragma("GCC diagnostic pop") \
# endif
#endif
SEC("prog")
int xdp_pass_func(struct xdp_md *ctx)
{
return XDP_PASS;
}
char _license[] SEC("license") = "GPL"; /* license 지정이 GPL인 경우와 아닌 경우에 따라서 사용할 수 있는 helpers 함수와 기능에 차이가 있을 수 있음 */
$ clang -target bpf -I "<libbpf의 header 위치>" -emit-llvm -c -o xdp-test.ll xdp-test.c $ llc -march bpf -filetype obj -o xdp-test.o xdp-test.ll
$ sudo ip link set dev "<인터페이스명>" xdp object xdp-test.o section "<section명>" verbose 또는 xdp-tools 를 받아서 설치한 환경인 경우 $ sudo xdp-loader load --verbose --mode native --section "<section명>" "<인터페이스명>" xdp-test.o
$ sudo ip link show dev "<인터페이스명>"
<ifindex>: <인터페이스명>: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 xdp qdisc fq_codel state UP mode DEFAULT group default qlen 1000
link/ether 52:54:00:a8:c3:19 brd ff:ff:ff:ff:ff:ff
prog/xdp id 19 tag b8a375b5b20c0074 jited
또는 xdp-tools 를 받아서 설치한 환경인 경우
$ sudo xdp-loader status "<인터페이스명>"
CURRENT XDP PROGRAM STATUS:
Interface Prio Program name Mode ID Tag Chain actions
--------------------------------------------------------------------------------------
<인터페이스명> native 19 b8a375b5b20c0074
$ sudo ip link set dev "<인터페이스명>" xdp off 또는 xdp-tools 를 받아서 설치한 환경인 경우 $ sudo xdp-loader unload --all --verbose "<인터페이스명>"
$ sudo cat /sys/kernel/debug/tracing/trace_pipe
$ readelf -a "<XDP program elf object>" $ llvm -D "<XDP program elf object>"
Linux Kernel v3.18
(https://kernelnewbies.org/Linux_3.18)부터 등장하였습니다. 현재는 cBPF 도 내부적으로 eBPF로 투명하게 변환되어 처리됩니다.
RISC(Reduced Instruction Set Computer)
(https://en.wikipedia.org/wiki/Reduced_instruction_set_computer) 명령어 세트이며 Compiler backend(예: LLVM)를 통해 BPF 명령어로 Compile될 수 있는 C의 하위 집합으로 프로그램을 작성하기 위해 설계되었습니다. Kernel은 내부 JIT(just-in-time) compiler를 통해 최적의 실행 성능을 위해 Native opcode에 대응할 수 있습니다.

eBPF Instruction Set
(https://www.kernel.org/doc/html/latest/bpf/instruction-set.html) 및
Unofficial eBPF spec
(https://github.com/iovisor/bpf-docs/blob/master/eBPF.md)을 참고할 수 있습니다.
| 32 ~ 63 (32 bits) (MSB) | 16 ~ 31 (16 bits) | 12 ~ 15 (4 bits) | 8 ~ 11 (4 bits) | 0 ~ 7 (8 bits) (LSB) |
| immediate (imm: signed immediate constant) | offset (off: signed offset) | source register (src_reg) | destination register (dst_reg) | opcode |
/* Linux kernel header : "include/uapi/linux/bpf.h" */
struct bpf_insn {
__u8 code; /* opcode */
__u8 dst_reg:4; /* dest register */
__u8 src_reg:4; /* source register */
__s16 off; /* signed offset */
__s32 imm; /* signed immediate constant */
};
| 4 bits (MSB) | 1 bit | 3 bits (LSB) |
| operation code | source | instruction class |
| code | 값 | 설명 | 비고 |
| BPF_ADD | 0x00 | dst += src | |
| BPF_SUB | 0x10 | dst -= src | |
| BPF_MUL | 0x20 | dst *= src | |
| BPF_DIV | 0x30 | dst /= src | |
| BPF_OR | 0x40 | dst |= src | |
| BPF_AND | 0x50 | dst &= src | |
| BPF_LSH | 0x60 | dst <<= src | |
| BPF_RSH | 0x70 | dst >>= src | |
| BPF_NEG | 0x80 | dst = ~src | |
| BPF_MOD | 0x90 | dst %= src | |
| BPF_XOR | 0xa0 | dst ^= src | |
| BPF_MOV | 0xb0 | dst = src | mov reg to reg |
| BPF_ARSH | 0xc0 | sign extending shift right | sign extending arithmetic shift right |
| BPF_END | 0xd0 | endianness conversion (flags for endianness conversion) | BPF_TO_LE/BPF_FROM_LE (0x00), BPF_TO_BE/BPF_FROM_BE (0x08) |
| code | 값 | 설명 | 비고 |
| BPF_JA | 0x00 | PC += off | BPF_JMP only |
| BPF_JEQ | 0x10 | PC += off if dst == src | |
| BPF_JGT | 0x20 | PC += off if dst > src | unsigned |
| BPF_JGE | 0x30 | PC += off if dst >= src | unsigned |
| BPF_JSET | 0x40 | PC += off if dst & src | |
| BPF_JNE | 0x50 | PC += off if dst != src | |
| BPF_JSGT | 0x60 | PC += off if dst > src | signed |
| BPF_JSGE | 0x70 | PC += off if dst >= src | signed |
| BPF_CALL | 0x80 | function call | |
| BPF_EXIT | 0x90 | function / program return (return r0) | BPF_JMP only |
| BPF_JLT | 0xa0 | PC += off if dst < src | unsigned |
| BPF_JLE | 0xb0 | PC += off if dst <= src | unsigned |
| BPF_JSLT | 0xc0 | PC += off if dst < src | signed |
| BPF_JSLE | 0xd0 | PC += off if dst <= src | signed |
| source | 값 | 설명 |
| BPF_K | 0x00 | use 32-bit immediate as source operand |
| BPF_X | 0x08 | use 'src_reg' register as source operand |
| 3 bits (MSB) | 2 bits | 3 bits (LSB) |
| mode | size | instruction class |
| size modifier | 값 | 설명 |
| BPF_W | 0x00 | word (4 bytes) |
| BPF_H | 0x08 | half word (2 bytes) |
| BPF_B | 0x10 | byte (1 byte) |
| BPF_DW | 0x18 | double word (8 bytes) |
| mode modifier | 값 | 설명 |
| BPF_IMM | 0x00 | used for 64-bit mov |
| BPF_ABS | 0x20 | legacy BPF packet access |
| BPF_IND | 0x40 | legacy BPF packet access |
| BPF_MEM | 0x60 | all normal load and store operations |
| (reserved) | 0x80 | reserved |
| (reserved) | 0xa0 | reserved |
| BPF_ATOMIC | 0xc0 | atomic operations (atomic memory ops - op type in immediate) |
| class | 값 | 설명 | 비고 |
| BPF_LD | 0x00 | non-standard load operations | Load instructions |
| BPF_LDX | 0x01 | load into register operations | Load instructions |
| BPF_ST | 0x02 | store from immediate operations | Store instructions |
| BPF_STX | 0x03 | store from register operations | Store instructions |
| BPF_ALU | 0x04 | 32-bit arithmetic operations | Arithmetic instructions |
| BPF_JMP | 0x05 | 64-bit jump operations | Jump instructions |
| BPF_JMP32 | 0x06 | 32-bit jump operations (Jump mode in word width) | Jump instructions |
| BPF_ALU64 | 0x07 | 64-bit arithmetic operations (ALU mode in double word width) | Arithmetic instructions |
=> "kernel/bpf/core.c" source 에서 ___bpf_prog_run() 함수구현 참고
#define BPF_ATOMIC_OP(SIZE, OP, DST, SRC, OFF) \
((struct bpf_insn) { \
.code = BPF_STX | BPF_SIZE(SIZE) | BPF_ATOMIC, \
.dst_reg = DST, \
.src_reg = SRC, \
.off = OFF, \
.imm = OP })
.imm = BPF_ADD, .code = BPF_ATOMIC | BPF_W | BPF_STX: lock xadd *(u32 *)(dst_reg + off16) += src_reg
BPF_ATOMIC_OP(sizeof(u32), BPF_ADD, <dst_reg>, <src_reg>, <off16>)
.imm = BPF_ADD, .code = BPF_ATOMIC | BPF_DW | BPF_STX: lock xadd *(u64 *)(dst_reg + off16) += src_reg
BPF_ATOMIC_OP(sizeof(u64), BPF_ADD, <dst_reg>, <src_reg>, <off16>)
| immediate | 값 | 설명 | 비고 |
| BPF_ADD | 0x00 | *(uint *) (dst_reg + off16) += src_reg | atomic_add(src_reg, dst_reg + off16) |
| BPF_AND | 0x50 | *(uint *) (dst_reg + off16) &= src_reg | atomic_and(src_reg, dst_reg + off16) |
| BPF_OR | 0x40 | *(uint *) (dst_reg + off16) |= src_reg | atomic_or(src_reg, dst_reg + off16) |
| BPF_XOR | 0xa0 | *(uint *) (dst_reg + off16) ^= src_reg | atomic_xor(src_reg, dst_reg + off16) |
| BPF_ADD | BPF_FETCH | 0x01 (0x00 | 0x01) | tmp = *(uint *) (dst_reg + off16), *(uint *) (dst_reg + off16) += src_reg, src_reg = tmp | src_reg = atomic_fetch_add(src_reg, dst_reg + off16) |
| BPF_AND | BPF_FETCH | 0x51 (0x50 | 0x01) | tmp = *(uint *) (dst_reg + off16), *(uint *) (dst_reg + off16) &= src_reg, src_reg = tmp | src_reg = atomic_fetch_and(src_reg, dst_reg + off16) |
| BPF_OR | BPF_FETCH | 0x41 (0x40 | 0x01) | tmp = *(uint *) (dst_reg + off16), *(uint *) (dst_reg + off16) |= src_reg, src_reg = tmp | src_reg = atomic_fetch_or(src_reg, dst_reg + off16) |
| BPF_XOR | BPF_FETCH | 0xa1 (0xa0 | 0x01) | tmp = *(uint *) (dst_reg + off16), *(uint *) (dst_reg + off16) ^= src_reg, src_reg = tmp | src_reg = atomic_fetch_xor(src_reg, dst_reg + off16) |
| BPF_XCHG (0xe0 | BPF_FETCH) | 0xe1 (0xe0 | 0x01) | tmp = *(uint *) (dst_reg + off16), *(uint *) (dst_reg + off16) = src_reg, src_reg = tmp | src_reg = atomic_xchg(dst_reg + off16, src_reg) |
| BPF_CMPXCHG (0xf0 | BPF_FETCH) | 0xf1 (0xf0 | 0x01) | (*(uint *) (dst_reg + off16) == r0) ? *(uint *) (dst_reg + off16) = src_reg : r0 = *(uint *) (dst_reg + off16) | r0 = atomic_cmpxchg(dst_reg + off16, r0, src_reg) |
/* r0 = Data in packet, r1 - r5 are clobbered, r6 = struct sk_buff pointer, src_reg + imm32 = struct sk_buff data offset */ r0 = ntohl(*(u32 *) (((struct sk_buff *) r6)->data + src_reg + imm32));

AF_XDP
(https://www.kernel.org/doc/html/latest/networking/af_xdp.html)는 고 성능의 패킷처리를 위해서 최적화된 Address family중에 하나입니다.
DPDK PMD for AF_XDP
(https://www.dpdk.org/wp-content/uploads/sites/35/2018/10/pm-06-DPDK-PMD-for-AF_XDP.pdf)) 에서 실행가능합니다.

__u32 n_umem_free_chunk;
__u32 n_chunk;
__u32 pos;
__u32 i;
n_umem_free_chunk = get_umem_free_chunks(); /* 여기서 get_umem_free_chunk 함수는 사용자가 구현하는 것으로 umem chunk 자원을 할당/해제하는 일련의 구현에서 해제된 사용가능한 chunk 개수를 반환하는 구현에 대응합니다. */
n_chunk = n_umem_free_chunk; /* 처음은 n_chunk 에 free chunk 수만큼을 대입하지만 이후 적절히 대입하는 구현이 고려되어야 합니다. */
for(;;) {
n_reserved = xsk_ring_prod__reserve(&xsk_ring_prod, n_chunk, &pos);
if(n_reserved == n_chunk) break; /* 채워넣을 Producer 공간의 예약이 되었으면 break */
/* Producer 예약이 요청한 갯수 n_chunk 만큼이 되지 않으면 */
if(xsk_ring_prod__need_wakeup(&xsk_ring_prod)) {
/* Producer 가 확보될 때까지 또는 일정시간 지연에 대한 구현 */
}
}
for(i = 0u;i < n_chunk;i++) {
/* CASE : 수신부 fill queue 목적인 경우 */
*xsk_ring_prod__fill_addr(&xsk_ring_prod /* umem_fq */, pos + i) = alloc_umem(); /* 여기서 alloc_umem 함수는 사용자가 구현하는 것으로 free umem chunk 로부터 1개의 chunk 를 할당하여 그 offset을 반환하는 구현에 대응합니다. */
/* CASE : 송신부 tx queue 목적인 경우 */
xsk_ring_prod__tx_desc(&xsk_ring_prod /* txq */, pos + i)->addr = <송신할 데이터가 채워진 chunk 주소>;
xsk_ring_prod__tx_desc(&xsk_ring_prod /* txq */, pos + i)->len = <송신할 데이터의 크기>;
}
xsk_ring_prod__submit(&xsk_ring_prod, n_chunk); /* 이제 Producer 로 제공된 할당된 umem chunk를 처리할 수 있습니다. */
/* CASE : 송신부 tx queue 목적인 경우 */
if(xsk_ring_prod_needs_wakeup(&xsk_ring_prod /* txq */)) {
sendto(xsk_socket__fd(xsk), NULL, 0, MSG_DONTWAIT, NULL, 0); /* txq가 채워졌다고 알아서 Tx 되는 것은 아니며 이 때 Signal 목적의 send 함수를 호출해주어야 Tx 가 Trigger 됩니다. */
}
__u32 n_cons_size;
__u32 pos;
__u32 n_chunk;
__u32 i;
n_cons_size = ...; /* 여기서 n_cons_size 는 xsk_ring_cons 가 담을 수 있는 최대 chunk 수 입니다. */
n_chunk = xsk_rin_cons__peek(&xsk_ring_cons, n_cons_size, &pos);
for(i = 0u;i < n_chunk;i++) {
/* CASE: Completion queue 목적인 경우 */
__u64 addr = *xsk_ring_cons__comp_addr(&xsk_ring_cons, pos + i); /* chunk offset 을 얻어옵니다. */
free_chunk(addr); /* 여기서 free_chunk 함수는 사용자가 구현하는 것으로 할당되었던 umem chunk인 addr을 umem chunk 로 반환하는 구현을 하게 됩니다. */
/* CASE: rx queue 목적인 경우 */
__u64 addr = xsk_ring_cons__rx_desc(&xsk_ring_cons, pos + i)->addr;
__u64 len = xsk_ring_cons__rx_desc(&xsk_ring_cons, pos + i)->len;
}
xsk_ring_cons__release(&xsk_ring_cons, n_chunk); /* Consumer 처리를 n_chunk 만큼 완료로 갱신합니다. */

JIT virtual machine
(https://en.wikipedia.org/wiki/Just-in-time_compilation))로 동작하게 됩니다.
Linux Kernel v3.18
(https://kernelnewbies.org/Linux_3.18)부터 등장하였습니다. 현재는 cBPF 도 내부적으로 eBPF로 투명하게 변환되어 처리됩니다.
LLVM
(https://llvm.org/) : (이전 이름: Low Level Virtual Machine => 지금은 LLVM그 자체가 이름임) 은 컴파일러의 기반구조. 언어에 가상 기계를 생성, 가상 기계가 언어에 독립적인 최적화를 실행
Clang
(https://clang.llvm.org/) : 클랭 - C, C++, 오브젝티브-C, 오브젝티브-C++ 프로그래밍 언어를 위한 컴파일러 프론트엔드. LLVM을 백엔드로 사용
make CC=clang
BCC
(https://github.com/iovisor/bcc) : BPF Compiler Collection
BCC is a toolkit for creating efficient kernel tracing and manipulation programs, and includes several useful tools and examples. It makes use of extended BPF (Berkeley Packet Filters), formally known as eBPF, a new feature that was first added to Linux 3.15. Much of what BCC uses requires Linux 4.1 and above.
XDP Project
(https://xdp-project.net/)
XDP Hands-On Tutorial
(https://github.com/xdp-project/xdp-tutorial)
xdp-tools - Library and utilities for use with XDP
(https://github.com/xdp-project/xdp-tools)
RaspberryPi 환경에서 빌드하는 경우 이슈 - "/usr/include/linux/types.h:5:10: fatal error: 'asm/types.h' file not found"
(https://giters.com/xdp-project/xdp-tools/issues/4)
XDP Paper
(https://github.com/xdp-project/xdp-paper)
The eXpress Data Path: Fast Programmable Packet Processing in the Operating System Kernel
(https://github.com/xdp-project/xdp-paper/blob/master/xdp-the-express-data-path.pdf)
AF_XDP documentation on kernel.org
(https://www.kernel.org/doc/html/latest/networking/af_xdp.html)
eBPF Instruction Set
(https://www.kernel.org/doc/html/latest/bpf/instruction-set.html)
VPP(Vector Packet Processing) - FD.io
(https://fd.io/)
Packet MMAP documentation on kernel.org
(https://www.kernel.org/doc/html/latest/networking/packet_mmap.html)
eBPF and XDP walkthrough and recent updates at FOSDEM 2017 by Daniel Borkmann, Cilium
(https://archive.fosdem.org/2017/schedule/event/ebpf_xdp/)
Fast Packet Processing in Linux with AF_XDP at FOSDEM 2018 by Magnus Karlsson, Intel
(https://archive.fosdem.org/2018/schedule/event/af_xdp/)
eBPF.io - Introduction, Tutorials & Community Resources
(https://ebpf.io/)
L4Drop: XDP DDoS Mitigations, Cloudflare
(https://blog.cloudflare.com/l4drop-xdp-ebpf-based-ddos-mitigations/)
Unimog: Cloudflare's edge load balancer, Cloudflare
(https://blog.cloudflare.com/unimog-cloudflares-edge-load-balancer/)
Open-sourcing Katran, a scalable network load balancer, Facebook
(https://code.fb.com/open-source/open-sourcing-katran-a-scalable-network-load-balancer/)
Cilium's L4LB: standalone XDP load balancer, Cilium
(https://cilium.io/blog/2021/05/20/cilium-110#standalonelb)
Kube-proxy replacement at the XDP layer, Cilium
(https://cilium.io/blog/2020/06/22/cilium-18#kube-proxy-replacement-at-the-xdp-layer)
Cilium Documentation - cilium.pdf
(https://buildmedia.readthedocs.org/media/pdf/cilium/minikube/cilium.pdf)
eCHO Podcast on XDP and load balancing
(https://github.com/isovalent/eCHO/tree/main/episodes/009)
BPF and XDP Reference Guide
(https://docs.cilium.io/en/latest/bpf/)
The Path to DPDK Speeds for AF XDP
(http://vger.kernel.org/lpc_net2018_talks/lpc18_paper_af_xdp_perf-v2.pdf)
XDP ACCELERATION USING NIC META DATA - Intel
(http://vger.kernel.org/lpc_net2018_talks/XDP_meta-data_LPC_final_final.pdf)
Low-Latency, Deterministic Networking with Standard Linux using XDP Sockets
(https://elinux.org/images/9/96/Elce-af_xdp-topel-v3.pdf)
Integrating AF_XDP into DPDK
(https://www.dpdk.org/wp-content/uploads/sites/35/2019/07/14-AF_XDP-dpdk-summit-china-2019.pdf)
XDP (eXpress Data Path) as a building block for other FOSS projects
(https://archive.fosdem.org/2019/schedule/event/xdp_overview_and_update/attachments/slides/2877/export/events/attachments/xdp_overview_and_update/slides/2877/xdp_building_block.pdf)
Express Data Path From Wikipedia
(https://en.wikipedia.org/wiki/Express_Data_Path)
LLVM From Wikipedia
(https://en.wikipedia.org/wiki/LLVM)
Clang From Wikipedia
(https://en.wikipedia.org/wiki/Clang)
Linux eBPF(Extended Berkeley Packet Filter)란?
(https://i5i5.tistory.com/401)
A thorough introduction to eBPF
(https://lwn.net/Articles/740157/)
XDP IO Visor Project
(https://www.iovisor.org/technology/xdp)
K8s 에서의 eBPF/XDP 기반 고성능 & 고가용성 NAT 시스템
(https://deview.kr/data/deview/session/attach/1000_T3_%EC%86%A1%EC%9D%B8%EC%A3%BC_Kubernetes%20%ED%81%B4%EB%9F%AC%EC%8A%A4%ED%84%B0%EC%97%90%EC%84%9C%EC%9D%98%20%EA%B3%A0%EC%84%B1%EB%8A%A5&%EA%B3%A0%EA%B0%80%EC%9A%A9%EC%84%B1%20NAT%20Networking%20%EC%8B%9C%EC%8A%A4%ED%85%9C.pdf)
Capturing network traffic in an eXpress Data Path (XDP) environment - RED HAT BLOG
(https://www.redhat.com/en/blog/capturing-network-traffic-express-data-path-xdp-environment)
BCC-Linux 성능 모니터링, 네트워킹 등을위한 동적 추적 도구
(https://ko.linux-console.net/?p=1876)
Express_Data_Path.pdf From iovisor
(https://github.com/iovisor/bpf-docs/blob/master/Express_Data_Path.pdf)
LWN - Implementing eBPF for Windows
(https://lwn.net/Articles/857215/)
LWN - Accelerating networking with AF_XDP
(https://lwn.net/Articles/750845/)
LWN - The BPF system call API, version 14
(https://lwn.net/Articles/612878/)
LWN - Zero-copy network transmission with io_uring
(https://lwn.net/Articles/879724/)
LWN - BPF: sockmap and sk redirect support
(https://lwn.net/Articles/731133/)
BPF-Based Linux Firewall "bpfilter" Shows Impressive Performance Potential
(https://www.phoronix.com/scan.php?page=news_item&px=BPFILTER-2021)
BPF / XDP 8월 세미나 KossLab
(https://www.slideshare.net/TaeungSong/bpf-xdp-8-kosslab)
Kernel bypass From Cloudflare
(https://blog.cloudflare.com/kernel-bypass/)
DPDK (Data Plane Development Kit) Project
(https://www.dpdk.org/)
Programmer’s Guide
(https://doc.dpdk.org/guides/prog_guide/index.html)
58. IPsec Packet Processing Library
(https://doc.dpdk.org/guides/prog_guide/ipsec_lib.html)
DPDK PMD for AF_XDP
(https://static.sched.com/hosted_files/dpdkuserspace2018/6a/pm%2006%20DPDK%20PMD%20for%20AF_XDP.pdf)
mTCP
(https://github.com/mtcp-stack/mtcp)
Snabb: Simple and fast packet networking
(https://github.com/snabbco/snabb)
netmap - the fast packet I/O framework
(http://info.iet.unipi.it/~luigi/netmap/)
How to drop 10 million packets per second From Cloudflare
(https://blog.cloudflare.com/how-to-drop-10-million-packets/)
XDP: A SIMPLE LIBRARY FOR TEACHING A DISTRIBUTED PROGRAMMING MODULE
(http://www.panix.com/~arnow/brooklyn_college/ED/xdp.html)
확장 BPF - 네트워크 언저리
(https://wariua.github.io/facility/extended-bpf.html)
The BSD Packet Filter: A New Architecture for User-level Packet Capture
(https://www.tcpdump.org/papers/bpf-usenix93.pdf)
Zero-Copy BPF
(http://www.watson.org/~robert/freebsd/2007asiabsdcon/20070309-devsummit-zerocopybpf.pdf)
Documentation/networking/packet mmap.txt
(https://wariua.cafe24.com/wiki/Documentation/networking/packet_mmap.txt)
Linux Socket Filtering aka Berkeley Packet Filter (BPF)
(https://www.kernel.org/doc/Documentation/networking/filter.txt)
Unofficial eBPF spec
(https://github.com/iovisor/bpf-docs/blob/master/eBPF.md)
tc-bpf(8) man page
(https://wariua.github.io/man-pages-ko/tc-bpf(8)/)
기술컬럼 - Linux 게임 서버 성능 분석에 eBPF + BCC 활용하기
(https://blog.ifunfactory.com/2018/03/29/linux-%EA%B2%8C%EC%9E%84-%EC%84%9C%EB%B2%84-%EC%84%B1%EB%8A%A5-%EB%B6%84%EC%84%9D%EC%97%90-ebpf-bcc-%ED%99%9C%EC%9A%A9%ED%95%98%EA%B8%B0/)
uBPF (Userspace eBPF VM)
(https://github.com/iovisor/ubpf)
eBPF를 통한 클라우드 네트워킹 성능 향상 - NETLOX (Loxilight)
(https://ko.netlox.io/post/ebpf%ED%81%B4%EB%9D%BC%EC%9A%B0%EB%93%9C%EB%84%A4%ED%8A%B8%EC%9B%8C%ED%82%B9)
Extending the matching abilities of OpenFlow
(https://netlab.dcs.gla.ac.uk/projects/openflow-bpf)
bpf(2) man page
(https://wariua.github.io/man-pages-ko/bpf(2)/)
The cornerstone of new Linux network technology -- ebpf and XDP
(https://javamana.com/2021/07/20210711122349998U.html)
eBPF Summit 2020 On Demand
(https://ebpf.io/summit-2020/)
XDP Forwarding
(https://github.com/gamemann/XDP-Forwarding)
Firewalling with BPF/XDP: Examples and Deep Dive
(https://arthurchiao.art/blog/firewalling-with-bpf-xdp/)
Awesome eBPF - A curated list of awesome projects related to eBPF
(https://project-awesome.org/zoidbergwill/awesome-ebpf)
XDP (eXpress Data Path) 기반 피어링 라우터 구축
(https://ichi.pro/ko/xdp-express-data-path-giban-pieoling-lauteo-guchug-36126204484198)
LLVM Documentation
(https://llvm.org/docs/index.html)
The LLVM Target-Independent Code Generator
(https://llvm.org/docs/CodeGenerator.html)
AF_XDPアプリケーション性能特性の定性的評価 〜レイテンシ編
(https://valinux.hatenablog.com/entry/20200924)
Linux tc and eBPF
(https://archive.fosdem.org/2016/schedule/event/ebpf/attachments/slides/1159/export/events/attachments/ebpf/slides/1159/ebpf.pdf)
Full introduction EBPF-Concept
(https://www.programmerall.com/article/35711068253/)
Introduction to eBPF and XDP - (mcorbin.fr)
(https://www.mcorbin.fr/pages/xdp-introduction/)
XDP program ip link error: Prog section rejected: Operation not permitted
(https://stackoverflow.com/questions/60322147/xdp-program-ip-link-error-prog-section-rejected-operation-not-permitted)
tc/BPF and XDP/BPF - Hangbin Liu
(https://liuhangbin.netlify.app/post/ebpf-and-xdp/)
https://legacy.netdevconf.info/0x14/pub/slides/54/[1]%20XDP%20meta%20data%20acceleration.pdf : XDP meta-data Acceleration - Saeed Mahameed
struct xdp_buff *xdp {
...
void *data_meta;
...
}
xdp_set_data_meta_invalid(&xdp);
int bpf_xdp_adjust_meta(struct xdp_buff *xdp_md, int delta);
int bpf_xdp_adjust_head(struct xdp_buff *xdp_md, int delta);
driver on XDP RX packet :
xdp_buff.data_meta = xdp_buff->data - sizeof(meta_data);
*xdp_buff.data_meta = meta_data;
XDP user program:
meta_data = (struct meta_data*)xdp_buff->data_meta;
...
AF-XDP: How do I get ctx->data_meta from kernel into user-space? - Stackoverflow
(https://stackoverflow.com/questions/60487925/af-xdp-how-do-i-get-ctx-data-meta-from-kernel-into-user-space)
BPF Features by Linux Kernel Version
(https://github.com/iovisor/bcc/blob/master/docs/kernel-versions.md)
libxdp - Man Page
(https://www.mankier.com/3/libxdp)
Kernel and BPF program feature compatibility
(https://www.mankier.com/3/libxdp#Kernel_and_BPF_program_feature_compatibility)
To get the full benefit of all features, libxdp needs to be used with kernel 5.10 or newer, unless the commits mentioned below have been backported. ...
libbpf documentation - readthedocs.io
(https://libbpf.readthedocs.io/en/latest/index.html)
Bringing TSO/GRO and Jumbo frames to XDP
(https://lpc.events/event/11/contributions/939/attachments/771/1551/xdp-multi-buff.pdf)
LWN - More flexible memory access for BPF programs
(https://lwn.net/SubscriberLink/910873/d20364e90112818c/)
Re: PATCHSET v6 sched: Implement BPF extensible scheduler class
(https://lore.kernel.org/bpf/CAHk-=wg8APE61e5Ddq5mwH55Eh0ZLDV4Tr+c6_gFS7g2AxnuHQ@mail.gmail.com/?fbclid=IwZXh0bgNhZW0CMTAAAR3DecBVmCYAnmG53A48nevNSTmrwDLJDKDkB6vCViNIbaIMcOH34_EpOOc_aem_AfaIRkBb70I2EAFZxgBaRQwzwM_k-AITBW2IaO7TlHj1d2Ms-fZ_3mukPfWLDkRg-398gzMvzBnF1MAO0prqSQ7Q)
| 참고 영상 |
Download xdp_building_block.pdf (https://archive.fosdem.org/2019/schedule/event/xdp_overview_and_update/attachments/slides/2877/export/events/attachments/xdp_overview_and_update/slides/2877/xdp_building_block.pdf) |
| 참고 영상 |
| 참고 영상 |
Slideshare: BPF Internals (eBPF) by Brendan Gregg (https://www.slideshare.net/brendangregg/bpf-internals-ebpf) |
| 참고 영상 |
| 참고 영상 |
| 참고 영상 |
| 참고 영상 |
| 참고 영상 |