-
Notifications
You must be signed in to change notification settings - Fork 26
Error compiling control-plane user_xdp5.h #106
Comments
Hi, diff --git a/lib/libbpf.h b/lib/libbpf.h
index 1c874b8..ada1e31 100644
--- a/lib/libbpf.h
+++ b/lib/libbpf.h
@@ -4,19 +4,19 @@
struct bpf_insn;
-int bpf_create_map(enum bpf_map_type map_type, int key_size, int value_size,
+static int bpf_create_map(enum bpf_map_type map_type, int key_size, int value_size,
int max_entries);
-int bpf_update_elem(int fd, void *key, void *value, unsigned long long flags);
-int bpf_lookup_elem(int fd, void *key, void *value);
-int bpf_delete_elem(int fd, void *key);
-int bpf_get_next_key(int fd, void *key, void *next_key);
+static int bpf_update_elem(int fd, void *key, void *value, unsigned long long flags);
+static int bpf_lookup_elem(int fd, void *key, void *value);
+static int bpf_delete_elem(int fd, void *key);
+static int bpf_get_next_key(int fd, void *key, void *next_key);
-int bpf_prog_load(enum bpf_prog_type prog_type,
+static int bpf_prog_load(enum bpf_prog_type prog_type,
const struct bpf_insn *insns, int insn_len,
const char *license, int kern_version);
-int bpf_obj_pin(int fd, const char *pathname);
-int bpf_obj_get(const char *pathname);
+static int bpf_obj_pin(int fd, const char *pathname);
+static int bpf_obj_get(const char *pathname);
#define LOG_BUF_SIZE 262144
extern char bpf_log_buf[LOG_BUF_SIZE];
diff --git a/tests/user_xdp5.c b/tests/user_xdp5.c
index ca13f9d..32f2875 100644
--- a/tests/user_xdp5.c
+++ b/tests/user_xdp5.c
@@ -26,13 +26,10 @@ int main(void)
{
int ret;
int fd;
- struct dstmactable_key key;
- struct dstmactable_value value;
+ struct Ingress_dstmactable_key key;
+ struct Ingress_dstmactable_value value;
- /* populate the default table */
- initialize_tables();
-
- value.action = Fallback_action;
+ value.action = Ingress_Fallback_action;
key.field0 = 0x800; // IP packet
printf("=== Open BPF map: %s ===\n", MAP_PATH TABLE); and compile it with
|
@williamtu : do you want to push your changes to libbpf.h as a pull request? |
Actually when I update libbpf.h , I found that I can't run But it's all right. The control plane code just use libbpf.h code . And I delete the bpf_load.c , .h and dont use the bpfloader anymore. At the last . I think maybe you can maintain a copy of libbpf.h and libbpf.c with static in another folder like lib-control . And there is no effect on the /tests . And compile the control plane code with
|
Thanks for your help. I will work on a pull request. |
keep it open until fixed. |
Hi,
When I run the below command in the /p4c/extensions/p4c-xdp/tests :
# gcc -I ../lib/ ../lib/libbpf.o user_xdp5.c -o xdp5
there's an error that
In file included from xdp5.h:6:0, from user_xdp5.c:20: ebpf_xdp.h:24:25: fatal error: ebpf_kernel.h: No such file or directory #include "ebpf_kernel.h" ^ compilation terminated.
And then I found the header files to be included are in the /p4c/backends/ebpf/runtime/,
so I move the ebpf_kernel.h and ebpf_common.h into the /tests :
however, when I compile again , some other errors occured :
could you give me some advice?
Thanks.
The text was updated successfully, but these errors were encountered: