aregm / nff-go

NFF-Go -Network Function Framework for GO (former YANFF)
BSD 3-Clause "New" or "Revised" License
1.38k stars 156 forks source link

Added AF_XDP input/output. Added ctrl-C handling #602

Closed ifilippov closed 4 years ago

ifilippov commented 5 years ago

This is not ready-to-use code - this is a proposal. Questions to solve:

1) libbpf is now a dependence. It should be downloaded (git clone https://github.com/libbpf/libbpf.git) and then installed in default location. How should we handle this?

2) AF_XDP setups BPF program to sockets. This program is not removed after finishing application, no new AF_XDP can be setup. This patch introduces handling application interruption by ctrl-C and release all used AF_XDP after this. However framework can fail with an error in other places. In this case user should explicitly run command "bpf_set_link_xdp_fd(interface, -1, XDP_FLAGS_UPDATE_IF_NOEXIST);" to release socket.

3) Current implementation is like "one AF_XDP functionality per port". AF_XDP queues are single producer/consumer. For receive send to one port we should introduce combined function. We need some documentation for this - no API documentation currently available.

4) This patch is combination of DPDK patch https://git.dpdk.org/dpdk/tree/drivers/net/af_xdp/rte_eth_af_xdp.c and Linux example samples/bpf/xdpsock_user.c which is under GPL license - need to do something with this.

5) This patch was created and tested with Linux kernel 5.1 (not released yet)

6) This patch doesn't contain error handling - need documentation for this

7) AF_XDP has a little bit unstable fluky behavior 5% cases. Wasn't investigated at this stage.

gshimansky commented 5 years ago

Can we submodule libbpf along with dpdk?

gshimansky commented 4 years ago

AF_XDP sockets support was implemented in pull request #643