From f3ba917e5c38483e6d9c628d70780cb61ec634ba Mon Sep 17 00:00:00 2001 From: Alireza Karami Date: Thu, 9 Nov 2023 20:47:27 +0330 Subject: [PATCH] Fix compile issue and Documentation improvement Fix name of balancer and healthchecking bpf files in `Makefile-bpf` to fix `build_katran.sh` issue and Documentations --- DEVELOPING.md | 6 +++--- EXAMPLE.md | 4 ++-- example/KatranSimpleServer.cpp | 2 +- example_grpc/katran_server.cpp | 2 +- katran/lib/Makefile-bpf | 4 ++-- katran/lib/testing/katran_tester.cpp | 2 +- os_run_tester.sh | 2 +- start_katran_grpc_server.sh | 2 +- start_katran_simple_server.sh | 2 +- tools/start_katran/README.md | 6 +++--- 10 files changed, 16 insertions(+), 16 deletions(-) diff --git a/DEVELOPING.md b/DEVELOPING.md index 2722a37b2..674400d68 100644 --- a/DEVELOPING.md +++ b/DEVELOPING.md @@ -27,7 +27,7 @@ is located at `deps/linux/` (__Note:__ It is automatically installed there with The result of this script will be object files w/ BPF programs, which are going to be located in `deps/linux/bpfprog/bpf/`. These files are: -1. __`balancer_kern.o`__ - object file w/ main BPF program for forwarding +1. __`balancer.bpf.o`__ - object file w/ main BPF program for forwarding 2. __`healthchecking_ipip.o`__ - object file w/ BPF program for the forwarding of healthchecks @@ -78,9 +78,9 @@ you just need to run `./os_run_tester.sh` script (this script requires root priv $ ./os_run_tester.sh ++ pwd ++ pwd -+ sudo sh -c '/home/username/katran_oss/build/katran/lib/testing/katran_tester -balancer_prog /home/username/katran_oss/deps/linux/bpfprog/bpf/balancer_kern.o -test_from_fixtures=true ' ++ sudo sh -c '/home/username/katran_oss/build/katran/lib/testing/katran_tester -balancer_prog /home/username/katran_oss/deps/linux/bpfprog/bpf/balancer.bpf.o -test_from_fixtures=true ' E0318 15:21:07.659436 28440 BpfLoader.cpp:144] Can't read section size for index: 2 -I0318 15:21:07.659950 28440 BpfLoader.cpp:419] Skipping section: 2 of file: /home/username/katran_oss/deps/linux/bpfprog/bpf/balancer_kern.o +I0318 15:21:07.659950 28440 BpfLoader.cpp:419] Skipping section: 2 of file: /home/username/katran_oss/deps/linux/bpfprog/bpf/balancer.bpf.o I0318 15:21:07.692260 28440 BpfLoader.cpp:338] relocation for non existing prog w/ idx 10 I0318 15:21:07.692790 28440 BpfLoader.cpp:338] relocation for non existing prog w/ idx 14 I0318 15:21:07.693243 28440 BpfLoader.cpp:338] relocation for non existing prog w/ idx 16 diff --git a/EXAMPLE.md b/EXAMPLE.md index 08eac820e..75279aaf7 100644 --- a/EXAMPLE.md +++ b/EXAMPLE.md @@ -154,7 +154,7 @@ standalone mode is when katran is attached to the interface directly (and you wo be able to run any other XDP program on this interface) ``` -$ sudo ./build/example_grpc/katran_server_grpc -balancer_prog ./deps/bpfprog/bpf/balancer_kern.o -default_mac 52:54:00:12:35:02 -forwarding_cores=0 -healthchecker_prog ./deps/bpfprog/bpf/healthchecking_ipip.o -intf=enp0s3 -ipip_intf=ipip0 -ipip6_intf=ipip60 -lru_size=10000 +$ sudo ./build/example_grpc/katran_server_grpc -balancer_prog ./deps/bpfprog/bpf/balancer.bpf.o -default_mac 52:54:00:12:35:02 -forwarding_cores=0 -healthchecker_prog ./deps/bpfprog/bpf/healthchecking_ipip.o -intf=enp0s3 -ipip_intf=ipip0 -ipip6_intf=ipip60 -lru_size=10000 ``` In this example: @@ -207,7 +207,7 @@ if needed, in front of load balancer. ``` -$ sudo ./build/example_grpc/katran_server_grpc -balancer_prog ./deps/bpfprog/bpf/balancer_kern.o -default_mac 52:54:00:12:35:02 -forwarding_cores=0 -healthchecker_prog ./deps/bpfprog/bpf/healthchecking_ipip.o -intf=enp0s3 -ipip_intf=ipip0 -ipip6_intf=ipip60 -lru_size=10000 -map_path /sys/fs/bpf/jmp_eth0 -prog_pos=2 +$ sudo ./build/example_grpc/katran_server_grpc -balancer_prog ./deps/bpfprog/bpf/balancer.bpf.o -default_mac 52:54:00:12:35:02 -forwarding_cores=0 -healthchecker_prog ./deps/bpfprog/bpf/healthchecking_ipip.o -intf=enp0s3 -ipip_intf=ipip0 -ipip6_intf=ipip60 -lru_size=10000 -map_path /sys/fs/bpf/jmp_eth0 -prog_pos=2 ``` ### Configuring healthchecks forwarding diff --git a/example/KatranSimpleServer.cpp b/example/KatranSimpleServer.cpp index 7b607c635..c766fcce6 100644 --- a/example/KatranSimpleServer.cpp +++ b/example/KatranSimpleServer.cpp @@ -39,7 +39,7 @@ DEFINE_int32(num_io_threads, 1, "number of IO threads for thrift server"); DEFINE_string(intf, "eth0", "main interface"); DEFINE_string(ipip_intf, "ipip0", "ipip (v4) encap interface"); DEFINE_string(ipip6_intf, "ipip60", "ip(6)ip6 (v6) encap interface"); -DEFINE_string(balancer_prog, "./balancer_kern.o", "path to balancer bpf prog"); +DEFINE_string(balancer_prog, "./balancer.bpf.o", "path to balancer bpf prog"); DEFINE_string( healthchecker_prog, "./healthchecking_ipip.o", diff --git a/example_grpc/katran_server.cpp b/example_grpc/katran_server.cpp index 1b60e792d..8077a4de0 100644 --- a/example_grpc/katran_server.cpp +++ b/example_grpc/katran_server.cpp @@ -40,7 +40,7 @@ DEFINE_string(intf, "eth0", "main interface"); DEFINE_string(hc_intf, "", "interface for healthchecking"); DEFINE_string(ipip_intf, "ipip0", "ipip (v4) encap interface"); DEFINE_string(ipip6_intf, "ipip60", "ip(6)ip6 (v6) encap interface"); -DEFINE_string(balancer_prog, "./balancer_kern.o", "path to balancer bpf prog"); +DEFINE_string(balancer_prog, "./balancer.bpf.o", "path to balancer bpf prog"); DEFINE_string( healthchecker_prog, "./healthchecking_ipip.o", diff --git a/katran/lib/Makefile-bpf b/katran/lib/Makefile-bpf index 7a2f37e52..27a12200c 100644 --- a/katran/lib/Makefile-bpf +++ b/katran/lib/Makefile-bpf @@ -12,9 +12,9 @@ INCLUDEFLAGS = -I$(obj)/usr/include \ -always = bpf/balancer_kern.o +always = bpf/balancer.bpf.o always += bpf/healthchecking_ipip.o -always += bpf/healthchecking_kern.o +always += bpf/healthchecking.bpf.o always += bpf/xdp_pktcntr.o always += bpf/xdp_root.o diff --git a/katran/lib/testing/katran_tester.cpp b/katran/lib/testing/katran_tester.cpp index b2d7996ac..39543e35c 100644 --- a/katran/lib/testing/katran_tester.cpp +++ b/katran/lib/testing/katran_tester.cpp @@ -45,7 +45,7 @@ DEFINE_string( monitor_output, "/tmp/katran_pcap", "output file for katran monitoring"); -DEFINE_string(balancer_prog, "./balancer_kern.o", "path to balancer bpf prog"); +DEFINE_string(balancer_prog, "./balancer.bpf.o", "path to balancer bpf prog"); DEFINE_string( reloaded_balancer_prog, "", diff --git a/os_run_tester.sh b/os_run_tester.sh index 1458cb0f4..dad46ed98 100755 --- a/os_run_tester.sh +++ b/os_run_tester.sh @@ -28,4 +28,4 @@ then DEPS_DIR=$(pwd)/_build/deps fi -sudo sh -c "${KATRAN_BUILD_DIR}/katran/lib/testing/katran_tester -balancer_prog ${DEPS_DIR}/bpfprog/bpf/balancer_kern.o -test_from_fixtures=true $1" +sudo sh -c "${KATRAN_BUILD_DIR}/katran/lib/testing/katran_tester -balancer_prog ${DEPS_DIR}/bpfprog/bpf/balancer.bpf.o -test_from_fixtures=true $1" diff --git a/start_katran_grpc_server.sh b/start_katran_grpc_server.sh index 8d21ae0e0..9d7522d1d 100755 --- a/start_katran_grpc_server.sh +++ b/start_katran_grpc_server.sh @@ -35,4 +35,4 @@ then fi ./install_xdproot.sh -b "${KATRAN_BUILD_DIR}" -d "${DEPS_DIR}" -sudo sh -c "${KATRAN_BUILD_DIR}/example_grpc/katran_server_grpc -balancer_prog=${DEPS_DIR}/bpfprog/bpf/balancer_kern.o -intf=${KATRAN_INTERFACE} -hc_forwarding=false -map_path=/sys/fs/bpf/jmp_${KATRAN_INTERFACE} -prog_pos=2" +sudo sh -c "${KATRAN_BUILD_DIR}/example_grpc/katran_server_grpc -balancer_prog=${DEPS_DIR}/bpfprog/bpf/balancer.bpf.o -intf=${KATRAN_INTERFACE} -hc_forwarding=false -map_path=/sys/fs/bpf/jmp_${KATRAN_INTERFACE} -prog_pos=2" diff --git a/start_katran_simple_server.sh b/start_katran_simple_server.sh index f718fb46d..4586227db 100755 --- a/start_katran_simple_server.sh +++ b/start_katran_simple_server.sh @@ -35,4 +35,4 @@ then fi ./install_xdproot.sh -b "${KATRAN_BUILD_DIR}" -d "${DEPS_DIR}" -sudo sh -c "${KATRAN_BUILD_DIR}/example/simple_katran_server -balancer_prog=${DEPS_DIR}/bpfprog/bpf/balancer_kern.o -intf=${KATRAN_INTERFACE} -hc_forwarding=false -map_path=/sys/fs/bpf/jmp_${KATRAN_INTERFACE} -prog_pos=2" +sudo sh -c "${KATRAN_BUILD_DIR}/example/simple_katran_server -balancer_prog=${DEPS_DIR}/bpfprog/bpf/balancer.bpf.o -intf=${KATRAN_INTERFACE} -hc_forwarding=false -map_path=/sys/fs/bpf/jmp_${KATRAN_INTERFACE} -prog_pos=2" diff --git a/tools/start_katran/README.md b/tools/start_katran/README.md index 29047c5c5..1a173a344 100644 --- a/tools/start_katran/README.md +++ b/tools/start_katran/README.md @@ -64,16 +64,16 @@ few exceptions are: ### example of output on start: ``` -sudo ./start_katran -affinitize -balancer_bpf ~/katran/deps/bpfprog/bpf/balancer_kern.o -binary ~/katran/build/example_grpc/katran_server_grpc -map_path /sys/fs/bpf/jmp_enp0s3 -lru_size 1000 -run +sudo ./start_katran -affinitize -balancer_bpf ~/katran/deps/bpfprog/bpf/balancer.bpf.o -binary ~/katran/build/example_grpc/katran_server_grpc -map_path /sys/fs/bpf/jmp_enp0s3 -lru_size 1000 -run number of CPUs 3 2019/01/28 14:19:51 affinitizing irq 19 to cpu 0 mask 00000001 number of CPUs 3 number of CPUs 3 --balancer_prog=/home/tehnerd/katran/deps/bpfprog/bpf/balancer_kern.o -intf=enp0s3 -hc_forwarding=false -map_path=/sys/fs/bpf/jmp_enp0s3 -prog_pos=2 -ipip_intf=ipip0 -ipip6_intf=ipip60 -priority=2307 -lru_size=1000 -shutdown_delay=1000 -forwarding_cores=0 -numa_nodes=0 +-balancer_prog=/home/tehnerd/katran/deps/bpfprog/bpf/balancer.bpf.o -intf=enp0s3 -hc_forwarding=false -map_path=/sys/fs/bpf/jmp_enp0s3 -prog_pos=2 -ipip_intf=ipip0 -ipip6_intf=ipip60 -priority=2307 -lru_size=1000 -shutdown_delay=1000 -forwarding_cores=0 -numa_nodes=0 2019/01/28 14:19:51 cannot reach katran server. retrying in one second I0128 14:19:51.431486 391 KatranGrpcService.cpp:67] Starting Katran E0128 14:19:51.431856 391 BpfLoader.cpp:166] Can't read section size for index: 2 -I0128 14:19:51.431871 391 BpfLoader.cpp:448] Skipping section: 2 of file: /home/tehnerd/katran/deps/bpfprog/bpf/balancer_kern.o +I0128 14:19:51.431871 391 BpfLoader.cpp:448] Skipping section: 2 of file: /home/tehnerd/katran/deps/bpfprog/bpf/balancer.bpf.o I0128 14:19:51.485374 391 BpfLoader.cpp:367] relocation for non existing prog w/ idx 10 I0128 14:19:51.485419 391 BpfLoader.cpp:367] relocation for non existing prog w/ idx 14 I0128 14:19:51.485424 391 BpfLoader.cpp:367] relocation for non existing prog w/ idx 16