libbpf: add support for using AF_XDP sockets
authorMagnus Karlsson <magnus.karlsson@intel.com>
Thu, 21 Feb 2019 09:21:26 +0000 (10:21 +0100)
committerDaniel Borkmann <daniel@iogearbox.net>
Mon, 25 Feb 2019 22:21:42 +0000 (23:21 +0100)
commit1cad078842396f0047a796694b6130fc096d97e2
tree17bdbf4dc7906bfe97c019532da2952327c11750
parent740f8a6572213a677c7916b12a11d831373722ce
libbpf: add support for using AF_XDP sockets

This commit adds AF_XDP support to libbpf. The main reason for this is
to facilitate writing applications that use AF_XDP by offering
higher-level APIs that hide many of the details of the AF_XDP
uapi. This is in the same vein as libbpf facilitates XDP adoption by
offering easy-to-use higher level interfaces of XDP
functionality. Hopefully this will facilitate adoption of AF_XDP, make
applications using it simpler and smaller, and finally also make it
possible for applications to benefit from optimizations in the AF_XDP
user space access code. Previously, people just copied and pasted the
code from the sample application into their application, which is not
desirable.

The interface is composed of two parts:

* Low-level access interface to the four rings and the packet
* High-level control plane interface for creating and setting
  up umems and af_xdp sockets as well as a simple XDP program.

Tested-by: Björn Töpel <bjorn.topel@intel.com>
Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
tools/include/uapi/linux/ethtool.h [new file with mode: 0644]
tools/include/uapi/linux/if_xdp.h [new file with mode: 0644]
tools/lib/bpf/Build
tools/lib/bpf/Makefile
tools/lib/bpf/README.rst
tools/lib/bpf/libbpf.map
tools/lib/bpf/xsk.c [new file with mode: 0644]
tools/lib/bpf/xsk.h [new file with mode: 0644]