This adds XDP support to BCC as currently supported in net-next.
Concretely, it adds two functions to bcc, namely: `attach_xdp` and `remove_xdp` which allows to attach an XDP program to a device (given via its name, e.g., en0) (in the future this might change to a specific queue on a device once the kernel offers this interface) and `remove_xdp` removes a XDP program from a device. Please note that there can currently be only one program attached to the device and attaching another program replaces the previous. One example is available to test XDP, in networking/xdp which drops all packets an counts for which protocol a packet was dropped (this is taken from the kernel xdp1 example). Please note that you cannot use the network headers defined in <bcc/proto.h> as they cause llvm/clang to generate instructions not available on XDP layer. On XDP layer you do not have an skb yet, so you are operating on the bare packet data. XDP support is currently limited to only some network adapters, there is the `mlx4` and there is also a patch available for the `e1000` driver.
Showing
Please register or sign in to comment