Hi William and Mihai
I am trying to use p4x-xdp to make a simple loadbalancer. I found the stack increases if I change the "reject" to "accept" in parser. The stack increase from from 248byte to 440byte. It means I can only process one or two type of packets
I am not sure if it is llvm issue. Did you found a workaround for it?
parser Parser(packet_in packet, out Headers hd) {
state start {
packet.extract(hd.ethernet);
transition select(hd.ethernet.protocol) {
ETH_P_IPV4: parse_ipv4;
default: accept; //change reject to accept, the stack size increase from 248 to 440
}
}
state parse_ipv4 {
packet.extract(hd.ipv4);
transition select(hd.ipv4.protocol) {
IPPROTO_TCP: parse_tcp;
default: reject;
}
}
state parse_tcp {
packet.extract(hd.tcp);
transition accept;
}
}
the entire p4 example(
xdp_test.txt
) is uploaded. Please rename xdp_test.txt to xdp_test.p4.
The following command I used to compiled and load:
~/work/p4c_view1/p4c/extensions/p4c-xdp/p4c-xdp --target xdp -o ./xdp_test.c xdp_test.p4 && clang -g -D__KERNEL__ -D__ASM_SYSREG_H -Wno-unused-value -Wno-pointer-sign -Wno-compare-distinct-pointer-types -Wno-gnu-variable-sized-type-not-at-end -Wno-tautological-compare -O2 -emit-llvm -c /root/work/p4_vgw/xdp_test.c -o -| llc -march=bpf -filetype=obj -o ./xdp_test.o && ip -force link set dev ens160 xdp obj ./xdp_test.o verb
My env is :
Ubuntu 18.04
root@gzhenyu-ubuntu:~/work/p4_vgw# llc --version
LLVM (http://llvm.org/):
LLVM version 6.0.0
Optimized build.
Default target: x86_64-pc-linux-gnu
Host CPU: sandybridge
root@gzhenyu-ubuntu:~/work/p4_vgw# clang --version
clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Hi William and Mihai
I am trying to use p4x-xdp to make a simple loadbalancer. I found the stack increases if I change the "reject" to "accept" in parser. The stack increase from from 248byte to 440byte. It means I can only process one or two type of packets
I am not sure if it is llvm issue. Did you found a workaround for it?
the entire p4 example(
xdp_test.txt
) is uploaded. Please rename xdp_test.txt to xdp_test.p4.
The following command I used to compiled and load:
My env is :
Ubuntu 18.04