fedeparola / xsknf Goto Github PK
View Code? Open in Web Editor NEWSpeed up development of AF_XDP-based Network Functions
Speed up development of AF_XDP-based Network Functions
Loading custom eBPF programs...
libbpf: load bpf program failed: Permission denied
libbpf: -- BEGIN DUMP LOG ---
libbpf:
; void *data_end = (void *)(long)ctx->data_end;
0: (61) r2 = *(u32 *)(r1 +4)
; void *data = (void *)(long)ctx->data;
1: (7b) *(u64 *)(r10 -16) = r2
2: (61) r7 = *(u32 *)(r1 +0)
3: (b7) r6 = 0
; int zero = 0;
4: (63) *(u32 *)(r10 -4) = r6
last_idx 4 first_idx 0
regs=40 stack=0 before 3: (b7) r6 = 0
5: (bf) r2 = r10
;
6: (07) r2 += -4
; struct xdp_cpu_stats *stats = bpf_map_lookup_elem(&xdp_stats, &zero);
7: (18) r1 = 0xffff94f8488fc200
9: (85) call bpf_map_lookup_elem#1
; if (!stats) {
10: (15) if r0 == 0x0 goto pc+15
R0_w=map_value(id=0,off=0,ks=4,vs=16,imm=0) R6_w=invP0 R7_w=pkt(id=0,off=0,r=0,imm=0) R10=fp0 fp-8=mmmm???? fp-16_w=pkt_end
; stats->rx_npkts++;
11: (79) r1 = *(u64 *)(r0 +0)
R0_w=map_value(id=0,off=0,ks=4,vs=16,imm=0) R6_w=invP0 R7_w=pkt(id=0,off=0,r=0,imm=0) R10=fp0 fp-8=mmmm???? fp-16_w=pkt_end
12: (bf) r2 = r1
13: (07) r2 += 1
14: (7b) *(u64 *)(r0 +0) = r2
R0_w=map_value(id=0,off=0,ks=4,vs=16,imm=0) R1_w=inv(id=2) R2_w=inv(id=0) R6_w=invP0 R7_w=pkt(id=0,off=0,r=0,imm=0) R10=fp0 fp-8=mmmm???? fp-16_w=pkt_end
; if (stats->rx_npkts == 1) {
15: (55) if r1 != 0x0 goto pc+12
from 15 to 28: R0=map_value(id=0,off=0,ks=4,vs=16,imm=0) R1=inv(id=2) R2=inv(id=0) R6=invP0 R7=pkt(id=0,off=0,r=0,imm=0) R10=fp0 fp-8=mmmm???? fp-16=pkt_end
; if ((void *)(eth + 1) > data_end) {
28: (bf) r1 = r7
29: (07) r1 += 14
30: (b7) r6 = 0
; if ((void *)(eth + 1) > data_end) {
31: (79) r2 = *(u64 *)(r10 -16)
32: (2d) if r1 > r2 goto pc-7
R0=map_value(id=0,off=0,ks=4,vs=16,imm=0) R1_w=pkt(id=0,off=14,r=14,imm=0) R2_w=pkt_end(id=0,off=0,imm=0) R6_w=inv0 R7=pkt(id=0,off=0,r=14,imm=0) R10=fp0 fp-8=mmmm???? fp-16=pkt_end
; if (eth->h_proto != htons(ETH_P_IP)) {
33: (71) r1 = *(u8 *)(r7 +12)
34: (71) r2 = *(u8 *)(r7 +13)
35: (67) r2 <<= 8
36: (4f) r2 |= r1
37: (b7) r6 = 3
; if (eth->h_proto != htons(ETH_P_IP)) {
38: (55) if r2 != 0x8 goto pc-13
R0=map_value(id=0,off=0,ks=4,vs=16,imm=0) R1=inv(id=0,umax_value=255,var_off=(0x0; 0xff)) R2=inv8 R6=inv3 R7=pkt(id=0,off=0,r=14,imm=0) R10=fp0 fp-8=mmmm???? fp-16=pkt_end
; if ((void *)(ip + 1) > data_end) {
39: (bf) r1 = r7
40: (07) r1 += 34
41: (b7) r6 = 0
; if ((void *)(ip + 1) > data_end) {
42: (79) r2 = *(u64 *)(r10 -16)
43: (2d) if r1 > r2 goto pc-18
R0=map_value(id=0,off=0,ks=4,vs=16,imm=0) R1_w=pkt(id=0,off=34,r=34,imm=0) R2_w=pkt_end(id=0,off=0,imm=0) R6_w=inv0 R7=pkt(id=0,off=0,r=34,imm=0) R10=fp0 fp-8=mmmm???? fp-16=pkt_end
; if (ip->protocol != IPPROTO_UDP) {
44: (71) r1 = *(u8 *)(r7 +23)
45: (b7) r6 = 3
; if (ip->protocol != IPPROTO_UDP) {
46: (55) if r1 != 0x11 goto pc-21
R0=map_value(id=0,off=0,ks=4,vs=16,imm=0) R1=inv17 R2=pkt_end(id=0,off=0,imm=0) R6=inv3 R7=pkt(id=0,off=0,r=34,imm=0) R10=fp0 fp-8=mmmm???? fp-16=pkt_end
; struct udphdr *udp = (void *)ip + (ip->ihl << 2);
47: (bf) r1 = r7
48: (07) r1 += 14
49: (71) r5 = *(u8 *)(r7 +14)
; struct udphdr *udp = (void *)ip + (ip->ihl << 2);
50: (67) r5 <<= 2
51: (57) r5 &= 60
; struct udphdr *udp = (void *)ip + (ip->ihl << 2);
52: (0f) r1 += r5
last_idx 52 first_idx 46
regs=20 stack=0 before 51: (57) r5 &= 60
regs=20 stack=0 before 50: (67) r5 <<= 2
regs=20 stack=0 before 49: (71) r5 = *(u8 *)(r7 +14)
; if ((void *)(udp + 1) > data_end) {
53: (bf) r2 = r1
54: (07) r2 += 8
55: (b7) r6 = 0
; if ((void *)(udp + 1) > data_end) {
56: (79) r3 = *(u64 *)(r10 -16)
57: (2d) if r2 > r3 goto pc-32
R0=map_value(id=0,off=0,ks=4,vs=16,imm=0) R1_w=pkt(id=4,off=14,r=22,umax_value=60,var_off=(0x0; 0x3c)) R2_w=pkt(id=4,off=22,r=22,umax_value=60,var_off=(0x0; 0x3c)) R3_w=pkt_end(id=0,off=0,imm=0) R5_w=invP(id=0,umax_value=60,var_off=(0x0; 0x3c)) R6_w=inv0 R7=pkt(id=0,off=0,r=34,imm=0) R10=fp0 fp-8=mmmm???? fp-16=pkt_end
; csum_buffer += (uint16_t)ip->saddr;
58: (61) r2 = *(u32 *)(r7 +26)
; csum_buffer += (uint16_t)ip->saddr;
59: (bf) r3 = r2
60: (57) r3 &= 65535
; csum_buffer += (uint16_t)(ip->saddr >> 16);
61: (77) r2 >>= 16
; csum_buffer += (uint16_t)(ip->saddr >> 16);
62: (0f) r2 += r3
; csum_buffer += (uint16_t)ip->daddr;
63: (61) r4 = *(u32 *)(r7 +30)
64: (b7) r3 = 0
; udp->check = 0;
65: (6b) *(u16 *)(r1 +6) = r3
; csum_buffer += (uint16_t)ip->daddr;
66: (bf) r0 = r4
67: (57) r0 &= 65535
; csum_buffer += (uint16_t)ip->daddr;
68: (0f) r2 += r0
; csum_buffer += (uint16_t)(ip->daddr >> 16);
69: (77) r4 >>= 16
; csum_buffer += (uint16_t)(ip->daddr >> 16);
70: (0f) r2 += r4
; csum_buffer += udp->len;
71: (69) r4 = *(u16 *)(r1 +4)
; csum_buffer += (uint16_t)ip->protocol << 8;
72: (0f) r2 += r4
; csum_buffer += udp->len;
73: (07) r2 += 4352
74: (18) r4 = 0xffffa9a74013c000
76: (61) r4 = *(u32 *)(r4 +0)
R0_w=inv(id=0,umax_value=65535,var_off=(0x0; 0xffff)) R1_w=pkt(id=4,off=14,r=22,umax_value=60,var_off=(0x0; 0x3c)) R2_w=inv(id=0,umin_value=4352,umax_value=332027,var_off=(0x0; 0x7ffff)) R3_w=inv0 R4_w=map_value(id=0,off=0,ks=4,vs=8,imm=0) R5_w=invP(id=0,umax_value=60,var_off=(0x0; 0x3c)) R6_w=inv0 R7=pkt(id=0,off=0,r=34,imm=0) R10=fp0 fp-8=mmmm???? fp-16=pkt_end
77: (67) r4 <<= 32
78: (c7) r4 s>>= 32
79: (b7) r0 = 1
; for (int i = 0; i < MAX_CHECKSUM_ITERATIONS; i++) {
80: (6d) if r0 s> r4 goto pc+13
R0=inv1 R1=pkt(id=4,off=14,r=22,umax_value=60,var_off=(0x0; 0x3c)) R2=inv(id=0,umin_value=4352,umax_value=332027,var_off=(0x0; 0x7ffff)) R3=inv0 R4=inv(id=0,umin_value=1,umax_value=2147483647,var_off=(0x0; 0x7fffffff)) R5=invP(id=0,umax_value=60,var_off=(0x0; 0x3c)) R6=inv0 R7=pkt(id=0,off=0,r=34,imm=0) R10=fp0 fp-8=mmmm???? fp-16=pkt_end
81: (0f) r7 += r5
82: (bf) r5 = r1
83: (07) r5 += 2
84: (18) r9 = 0x100000000
86: (05) goto pc+14
; udp->check = csum;
101: (bf) r8 = r1
; for (int j = 0; j < MAX_UDP_LENGTH; j += 2) {
102: (79) r0 = *(u64 *)(r10 -16)
103: (2d) if r5 > r0 goto pc+19
R0=pkt_end(id=0,off=0,imm=0) R1=pkt(id=4,off=14,r=22,umax_value=60,var_off=(0x0; 0x3c)) R2=inv(id=0,umin_value=4352,umax_value=332027,var_off=(0x0; 0x7ffff)) R3=inv0 R4=inv(id=0,umin_value=1,umax_value=2147483647,var_off=(0x0; 0x7fffffff)) R5=pkt(id=4,off=16,r=22,umax_value=60,var_off=(0x0; 0x3c)) R6=inv0 R7=pkt(id=7,off=0,r=0,umax_value=60,var_off=(0x0; 0x3c)) R8=pkt(id=4,off=14,r=22,umax_value=60,var_off=(0x0; 0x3c)) R9=inv4294967296 R10=fp0 fp-8=mmmm???? fp-16=pkt_end
104: (b7) r9 = 0
105: (b7) r6 = 0
; csum_buffer += *payload;
106: (bf) r8 = r7
107: (0f) r8 += r9
last_idx 107 first_idx 103
regs=200 stack=0 before 106: (bf) r8 = r7
regs=200 stack=0 before 105: (b7) r6 = 0
regs=200 stack=0 before 104: (b7) r9 = 0
108: (69) r0 = *(u16 *)(r8 +14)
invalid access to packet, off=14 size=2, R8(id=7,off=14,r=0)
R8 offset is outside of the packet
processed 90 insns (limit 1000000) max_states_per_insn 0 total_states 6 peak_states 6 mark_read 1
libbpf: -- END LOG --
libbpf: failed to load program 'handle_xdp'
libbpf: failed to load object './checksummer_kern.o'
ERROR: unable to parse eBPF file
FRAMES_PER_SOCKET is 4096
conf.num_interfaces are 1
conf.xsk_frame_size is 2048
umem_bufsize is 8388608
umem_buf_flags is 34
mmap passed!
umem_bufsize is 8388608
pass one of umem creation
src/xsknf.c:xsk_configure_socket:144: errno: 95/"Operation not supported"
Segmentation fault
Linux ubuntu-jammy 5.15.0-76-generic #83-Ubuntu SMP Thu Jun 15 19:16:32 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/11/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 11.3.0-1ubuntu1~22.04.1' --with-bugurl=file:///usr/share/doc/gcc-11/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,m2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-11 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --enable-libphobos-checking=release --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --enable-cet --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-11-aYxV0E/gcc-11-11.3.0/debian/tmp-nvptx/usr,amdgcn-amdhsa=/build/gcc-11-aYxV0E/gcc-11-11.3.0/debian/tmp-gcn/usr --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --with-build-config=bootstrap-lto-lean --enable-link-serialization=2
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.3.0 (Ubuntu 11.3.0-1ubuntu1~22.04.1)
Ubuntu clang version 14.0.0-1ubuntu1
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/11
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/11
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.