netronome / bpf-samples Goto Github PK
View Code? Open in Web Editor NEWSample BPF offload apps.
License: Other
Sample BPF offload apps.
License: Other
Hi
AFter make with latest libbpf and test i get this error:
libbpf: failed to create map (name: 'ctrl_map'): Invalid argument(-22)
libbpf: failed to load object 'rss_kern.o'
Err: Cannot load file
Hi,
I am trying to setup the programmable rss demo app using the master branch from https://github.com/libbpf/libbpf
:
git clone https://github.com/Netronome/bpf-samples.git
cd programmable_rss/
make clean && make
cd ../libbpf/src/ && make clean;
make[1]: Entering directory '/opt/bpf-samples/libbpf/src'
rm -f *.o *.a *.so
make[1]: Leaving directory '/opt/bpf-samples/libbpf/src'
rm -f rss
rm -f rss_kern.o
rm -f rss_user.o
rm -f *.ll
make[1]: Entering directory '/opt/bpf-samples/libbpf/src'
cc -I. -I../include -I../include/uapi -DCOMPAT_NEED_REALLOCARRAY -g -O2 -Werror -Wall -c bpf.c -o bpf.o
cc -I. -I../include -I../include/uapi -DCOMPAT_NEED_REALLOCARRAY -g -O2 -Werror -Wall -c btf.c -o btf.o
cc -I. -I../include -I../include/uapi -DCOMPAT_NEED_REALLOCARRAY -g -O2 -Werror -Wall -c libbpf.c -o libbpf.o
cc -I. -I../include -I../include/uapi -DCOMPAT_NEED_REALLOCARRAY -g -O2 -Werror -Wall -c libbpf_errno.c -o libbpf_errno.o
cc -I. -I../include -I../include/uapi -DCOMPAT_NEED_REALLOCARRAY -g -O2 -Werror -Wall -c netlink.c -o netlink.o
cc -I. -I../include -I../include/uapi -DCOMPAT_NEED_REALLOCARRAY -g -O2 -Werror -Wall -c nlattr.c -o nlattr.o
cc -I. -I../include -I../include/uapi -DCOMPAT_NEED_REALLOCARRAY -g -O2 -Werror -Wall -c str_error.c -o str_error.o
cc -I. -I../include -I../include/uapi -DCOMPAT_NEED_REALLOCARRAY -g -O2 -Werror -Wall -c libbpf_probes.c -o libbpf_probes.o
ar rcs libbpf.a bpf.o btf.o libbpf.o libbpf_errno.o netlink.o nlattr.o str_error.o libbpf_probes.o
make[1]: Leaving directory '/opt/bpf-samples/libbpf/src'
make[1]: Entering directory '/opt/bpf-samples/libbpf/src'
if [ ! -d 'root/usr/include/bpf' ]; then install -d -m 755 'root/usr/include/bpf'; fi; install bpf.h libbpf.h btf.h -m 644 'root/usr/include/bpf'
make[1]: Leaving directory '/opt/bpf-samples/libbpf/src'
cc -I../libbpf/src//root/usr/include/ -I../headers/ -L../libbpf/src/ -o rss rss_user.c -lbpf -lelf
clang -S \
-D __BPF_TRACING__ \
-I../libbpf/src//root/usr/include/ -I../headers/ \
-Wall \
-Wno-unused-value -Wno-pointer-sign \
-Wno-compare-distinct-pointer-types \
-Werror \
-O2 -emit-llvm -c -g rss_kern.c
llc -march=bpf -filetype=obj -o rss_kern.o rss_kern.ll
llc: rss_kern.ll:2:1: error: expected top-level entity
source_filename = "rss_kern.c"
^
Makefile:56: recipe for target 'rss_kern.o' failed
make: *** [rss_kern.o] Error 1
Was just wondering if i am not missing something?
The the number of cpus are more than 127, then it hits assert, and upon checking we can see it is hitting following error:
If the key is 128 or more then the bpf syscall is failing.
bpf(BPF_MAP_UPDATE_ELEM, {map_fd=3, key=0x7fffae9f9478, value=0x7fffae9f9474, flags=BPF_ANY}, 72) = -1 E2BIG (Argument list too long)
I have verified the same key value works using linux bpf self test test_maps.
test_hashmap(unsigned int task, void *data)
38 {
39 long long key, next_key, first_key, value;
40 int fd;
41
42 fd = bpf_create_map(BPF_MAP_TYPE_HASH, sizeof(key), sizeof(value),
43 2, map_flags);
44 if (fd < 0) {
45 printf("Failed to create hashmap '%s'!\n", strerror(errno));
46 exit(1);
47 }
48
49 key = 128;
50 value = 1234;
51 /* Insert key=1 element. */
52 printf("insert key 128 and value 1234\n");
53 assert(bpf_map_update_elem(fd, &key, &value, BPF_ANY) == 0);
54 printf("no assert\n");
I am trying to run l4lb but when I run ./l4lb_stats.py -I ens4np0 to see the Load balancer outbound statistics, all the statistics are 0.
When I sniff on the interface with XDP program I can see the incoming traffic. So I think there is a problem with l4lb_stats.py file.
Once in a while, there is a https://github.com/Netronome/bpf-samples/blob/master/nat sample in this BPF sample repo.
$ ls nat
demo Makefile nat nat_common.h nat_kern.c nat_kern.ll nat_kern.o nat_user.c README.rst
Does it seem gone right now? Where can I find it?
Hi there,
Newbie for bpf and xdp here and I like ur great repo very much.
I just found two methods for BPF verifier, which confuses me a lot:
void *data_end = (void *)(long)ctx->data_end;
void *data = (void *)(long)ctx->data;
struct ethhdr *eth = data;
...
// use the offset
off = sizeof(struct ethhdr);
if (data + off > data_end)
return XDP_PASS;
struct tcphdr *tcp;
tcp = data + off;
if (tcp + 1 > data_end)
return false;
I learn that they are both for BPF verifier and I am wondering what's the difference between them, and when should I use one of them?
Feel free to correct me if I misunderstood something.
Look forwarding to your reply.
I found that the xdp return code of l4lb_xdp.c finally is XDP_TX. However , The XDP_TX return code only support to send the packets to the same NIC card .
XDP_REDIRECT can send the received packets to another NIC . So if there any possibility to implement this load balance using XDP_REDIRECT ?
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.