Skip to content

Commit

Permalink
Fix compile issue and Documentation improved (#207)
Browse files Browse the repository at this point in the history
Summary:
Fix name of balancer and healthchecking bpf files in `Makefile-bpf` to fix `build_katran.sh` issue and improved documentation

Pull Request resolved: #207

Reviewed By: pdubovitsky

Differential Revision: D51163084

Pulled By: frankfeir

fbshipit-source-id: f208cdbdfc5b67e8fa20b5dc246d3b1e16895ee9
  • Loading branch information
AlirezaKm authored and facebook-github-bot committed Nov 10, 2023
1 parent 9ead449 commit 3f0883c
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 16 deletions.
6 changes: 3 additions & 3 deletions DEVELOPING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions EXAMPLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion example/KatranSimpleServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion example_grpc/katran_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions katran/lib/Makefile-bpf
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion katran/lib/testing/katran_tester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
"",
Expand Down
2 changes: 1 addition & 1 deletion os_run_tester.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
2 changes: 1 addition & 1 deletion start_katran_grpc_server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
2 changes: 1 addition & 1 deletion start_katran_simple_server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
6 changes: 3 additions & 3 deletions tools/start_katran/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3f0883c

Please sign in to comment.