xdp-project / xdp-tutorial

XDP tutorial
2.43k stars 574 forks source link

When would you supply the code of advanced03-AF_XDP example ? #54

Closed hi-glenn closed 5 years ago

hi-glenn commented 5 years ago

As the title said.

Thanks a lot.

chaudron commented 5 years ago

I have a copy of the raw code in my private clone (chaudron). Will start cleaning it up once I return from PTO.

hi-glenn commented 5 years ago

I have a copy of the raw code in my private clone (chaudron). Will start cleaning it up once I return from PTO.

@chaudron

I have cloned it from your repository.

Thank you.

hi-glenn commented 5 years ago

Hi, @chaudron I have cloned your repo https://github.com/chaudron/xdp-tutorial But I don't compile them successfully. I just have a try basic01~basic04 . They all failed and got a same error:

**common_params.c:11:10: fatal error: linux/if_xdp.h: No such file or directory

include <linux/if_xdp.h>**

And then, I assumed MY_DIR = ../libbpf in the file Makefile of basic01 path. At the same time, I append CFLAGS += -I$(MY_DIR)/include/uapi/ after the line CFLAGS += -I../headers/ in the file common.mk.

The error still exist.

PhilippHomann commented 5 years ago

Looks to me as you don't have kernel headers installed properly. For Fedora install kernel-headers and kernel-devel, which will provide the missing file.

hi-glenn commented 5 years ago

Looks to me as you don't have kernel headers installed properly. For Fedora install kernel-headers and kernel-devel, which will provide the missing file.

@PhilippHomann

At the beginging, I think the same as you do.

However, xdp-tutorial is based on libbpf (https://github.com/libbpf/libbpf/tree/master).

I think if I use CFLAGS -I indicate the libbpf headers path, I will not depend on installing kernel-headers and kernel-devel to compile xdp-tutorial successfully .

And, my system is Ubuntu18.04 with linux kernal 4.19.56.

I don't know if I'm right.

PhilippHomann commented 5 years ago

Indeed it is based on libbpf, but you still need to have the kernel headers. See https://github.com/xdp-project/xdp-tutorial/blob/master/setup_dependencies.org

hi-glenn commented 5 years ago

Indeed it is based on libbpf, but you still need to have the kernel headers. See https://github.com/xdp-project/xdp-tutorial/blob/master/setup_dependencies.org

Thank you. I see.