NIKSS-vSwitch / nikss

Native In-Kernel P4-programmable Software Switch for Software-Defined Networking (previously PSA-eBPF)
Apache License 2.0
47 stars 4 forks source link

issues while trying to install nikss #109

Open Arishbiswas opened 4 months ago

Arishbiswas commented 4 months ago

hello, i am facing issues while trying to install nikss from source , i tried in both ubuntu 20.0 as well as ubuntu 22.0 , in the former one couldnot run the build.sh script it throws error but in ubuntu 22.0 i could run the build.sh but while i try to run the make file it generates lots of errors, as i am new , it would be a great help if anyone would let me know how to solve this issue.

This is the error messages that i got while trying to run the "make -j4" : arishmita@arishmita-VirtualBox:~/nikss/build$ make -j4

make[1]: Entering directory '/home/arishmita/nikss/build'

make[2]: Entering directory '/home/arishmita/nikss/build'

make[2]: Leaving directory '/home/arishmita/nikss/build'

make[2]: Entering directory '/home/arishmita/nikss/build'

[ 3%] Building C object CMakeFiles/nikss-ctl.dir/lib/btf.c.o

[ 7%] Building C object CMakeFiles/nikss-ctl.dir/lib/nikss_pre.c.o

[ 10%] Building C object CMakeFiles/nikss-ctl.dir/lib/common.c.o

[ 14%] Building C object CMakeFiles/nikss-ctl.dir/lib/nikss_digest.c.o

In file included from /home/arishmita/nikss/install/usr/include/bpf/bpf.h:26,

             from /home/arishmita/nikss/lib/nikss_pre.c:18:

/home/arishmita/nikss/install/usr/include/linux/bpf.h:1281:17: error: unknown type name ‘__aligned_u64’

1281 | __aligned_u64 key;

  |                 ^~~~~~~~~~~~~

/home/arishmita/nikss/install/usr/include/linux/bpf.h:1283:25: error: unknown type name ‘__aligned_u64’

1283 | __aligned_u64 value;

  |                         ^~~~~~~~~~~~~

/home/arishmita/nikss/install/usr/include/linux/bpf.h:1284:25: error: unknown type name ‘__aligned_u64’

1284 | __aligned_u64 next_key;

  |                         ^~~~~~~~~~~~~

/home/arishmita/nikss/install/usr/include/linux/bpf.h:1290:17: error: unknown type name ‘__aligned_u64’

1290 | __aligned_u64 in_batch; /* start batch,

  |                 ^~~~~~~~~~~~~

/home/arishmita/nikss/install/usr/include/linux/bpf.h:1293:17: error: unknown type name ‘__aligned_u64’

1293 | __aligned_u64 out_batch; / output: next start batch /

  |                 ^~~~~~~~~~~~~

/home/arishmita/nikss/install/usr/include/linux/bpf.h:1294:17: error: unknown type name ‘__aligned_u64’

1294 | __aligned_u64 keys;

  |                 ^~~~~~~~~~~~~

In file included from /home/arishmita/nikss/install/usr/include/bpf/bpf.h:26,

             from /home/arishmita/nikss/lib/nikss_digest.c:18:

/home/arishmita/nikss/install/usr/include/linux/bpf.h:1281:17: error: unknown type name ‘__aligned_u64’

1281 | __aligned_u64 key;

  |                 ^~~~~~~~~~~~~

/home/arishmita/nikss/install/usr/include/linux/bpf.h:1295:17: error: unknown type name ‘__aligned_u64’

1295 | __aligned_u64 values;

  |                 ^~~~~~~~~~~~~

/home/arishmita/nikss/install/usr/include/linux/bpf.h:1283:25: error: unknown type name ‘__aligned_u64’

1283 | __aligned_u64 value;

  |                         ^~~~~~~~~~~~~

  |         ^~~~~~~~~~~~~

/home/arishmita/nikss/install/usr/include/linux/bpf.h:5411:25: error: unknown type name ‘__be32’

thanks in advance

tatry commented 4 months ago

@Arishbiswas Did you call the build_libbpf.sh script? I'm not sure, but installing gcc-multilib can help in some cases.

Arishbiswas commented 4 months ago

yes now the problem is solved i could install nikss-ctl but, i am facing problem while trying to load a program to the ebpf subsystem. THIS IS THE UPF PROGRAM THAT I WAS TRYING TO LOAD INTO THE KERNEL

nikss-ctl pipeline load id 003 upf.o libbpf: elf: skipping unrecognized data section(9) .maps.clone_session_tbl_inner libbpf: elf: skipping unrecognized data section(10) .maps.clone_session_tbl libbpf: elf: skipping unrecognized data section(11) .maps.multicast_grp_tbl_inner libbpf: elf: skipping unrecognized data section(12) .maps.multicast_grp_tbl libbpf: elf: skipping unrecognized data section(13) .maps.ingress_ip_forward_ipv4_lpm libbpf: elf: skipping unrecognized data section(14) .maps.ingress_ip_forward_ipv4_lpm_defaultAction libbpf: elf: skipping unrecognized data section(15) .maps.ingress_upf_ingress_far_lookup libbpf: elf: skipping unrecognized data section(16) .maps.ingress_upf_ingress_far_lookup_defaultAction libbpf: elf: skipping unrecognized data section(17) .maps.ingress_upf_ingress_pdr_lookup_prefixes libbpf: elf: skipping unrecognized data section(18) .maps.ingress_upf_ingress_pdr_lookup_tuple libbpf: elf: skipping unrecognized data section(19) .maps.ingress_upf_ingress_pdr_lookup_tuples_map libbpf: elf: skipping unrecognized data section(20) .maps.ingress_upf_ingress_pdr_lookup_defaultAction libbpf: elf: skipping unrecognized data section(21) .maps.ingress_upf_ingress_session_lookup_by_teid libbpf: elf: skipping unrecognized data section(22) .maps.ingress_upf_ingress_session_lookup_by_teid_defaultAction libbpf: elf: skipping unrecognized data section(23) .maps.ingress_upf_ingress_session_lookup_by_ue_ip libbpf: elf: skipping unrecognized data section(24) .maps.ingress_upf_ingress_session_lookup_by_ue_ip_defaultAction libbpf: elf: skipping unrecognized data section(25) .maps.ingress_upf_ingress_source_interface_lookup_by_port libbpf: elf: skipping unrecognized data section(26) .maps.ingress_upf_ingress_source_interface_lookup_by_port_defaultAction libbpf: elf: skipping unrecognized data section(27) .maps.ingress_upf_process_ingress_l4port_ingress_l4_dst_port libbpf: elf: skipping unrecognized data section(28) .maps.ingress_upf_process_ingress_l4port_ingress_l4_dst_port_defaultAction libbpf: elf: skipping unrecognized data section(29) .maps.ingress_upf_process_ingress_l4port_ingress_l4_src_port libbpf: elf: skipping unrecognized data section(30) .maps.ingress_upf_process_ingress_l4port_ingress_l4_src_port_defaultAction libbpf: elf: skipping unrecognized data section(31) .maps.ingress_upf_process_ingress_l4port_ingress_l4port_fields libbpf: elf: skipping unrecognized data section(32) .maps.ingress_upf_process_ingress_l4port_ingress_l4port_fields_defaultAction libbpf: elf: skipping unrecognized data section(33) .maps.hdr_md_cpumap libbpf: elf: skipping unrecognized data section(34) .maps.crc_lookup_tbl libbpf: elf: skipping unrecognized data section(35) .rodata.cst32 libbpf: elf: skipping unrecognized data section(37) .rodata.cst16 libbpf: elf: skipping unrecognized data section(53) .eh_frame libbpf: elf: skipping relo section(54) .rel.eh_frame for section(53) .eh_frame libbpf: maps section in upf.o: "ingress_ip_forward_ipv4_lpm_defaultAction" has unrecognized, non-zero options cannot load the BPF program: No such file or directory An error occurred during pipeline load id 3

tatry commented 4 months ago

yes now the problem is solved

Could you share the solution? There is non-zero chance that it could impact on error you got.

cannot load the BPF program: No such file or directory An error occurred during pipeline load id 3

Looks like a problem with permissions (did you use root?) or something wrong with upf.o object program (how did you compile it?)

Arishbiswas commented 4 months ago

actually i was trying to install nikss in my VM and i was facing those errors , later i tried installng it in my host ubuntu 22.0 then automatically the problem got solved and i could install nikss-ctl

now, while loading the object file , i am facing issues, i compiled the program following these steps: $ p4c-ebpf --arch psa --target kernel -o upf.c upf.p4 $ clang -Ibackends/ebpf/runtime -Ibackends/ebpf/runtime/usr/include -O2 -g -c -emit-llvm -o upf.bc upf.c $ llc -march=bpf -mcpu=probe -filetype=obj -o upf.o upf.bc yes i used root, stll unable o load, could you please mention do i need to do something else or am i missing something

tatry commented 4 months ago

Add option -DBTF to your clang command, like in this makefile.

Arishbiswas commented 4 months ago

Thankyou so much for your suggestion, now the upf.o program is loaded successfully

but the other program bng.o shows this error:

BPF program is too large. Processed 1000001 insn processed 1000001 insns (limit 1000000) max_states_per_insn 25 total_states 32925 peak_states 4032 mark_read 329 libbpf: -- END LOG -- libbpf: failed to load program 'tc_ingress_func' libbpf: failed to load object 'bng.o' cannot load the BPF program: Unknown error 4007 An error occurred during pipeline load id 1 can you explain is this because of memory constraint of my system

tatry commented 4 months ago

Program is too big (in sense of number of instructions, not size of file, tables, etc.). This could be hard to fix directly, because it is more compiler dependent problem...

I don't know which C compiler you use, but clang-10 should work.

Arishbiswas commented 4 months ago

i use clang-14.. all others are working except for bng.p4 i also tried the mininet demo i faced issue in that too :

mininet> s1 nikss-ctl table get pipe 1 ingress_tbl_fwd key 00:04:00:00:00:01 failed to get entry: No such file or directory can you explain why is it showing this error while i try to configure the switch

tatry commented 4 months ago

mininet> s1 nikss-ctl table get pipe 1 ingress_tbl_fwd key 00:04:00:00:00:01 failed to get entry: No such file or directory can you explain why is it showing this error while i try to configure the switch

Probably such entry does not exist in the table, try without key to see all the entries and then fix key in your command.