More Related Content
Similar to My First XDP (eXpress Data Path) (20)
More from Naoto MATSUMOTO (20)
My First XDP (eXpress Data Path)
- 1. My First XDP (eXpress Data Path)
2018/02/10 SAKURA Internet, Inc. Research Center SR / Naoto MATSUMOTO
(C) Copyright 1996-2017 SAKURA Internet Inc
- 2. My First XDP (eXpress Data Path)
2
# uname -sr; cat /etc/lsb-release
Linux 4.13.0-21-generic
DISTRIB_DESCRIPTION="Ubuntu 17.10"
# apt install -y make gcc libssl-dev bc libelf-dev libcap-dev clang
# apt install -y gcc-multilib llvm libncurses5-dev git bison flex pkg-config
# apt install -y libmnl0 libmnl-dev clang libasm1 libasm-dev
# mkdir /usr/local/include/asm
# ln -s /usr/include/x86_64-linux-gnu/asm/* /usr/local/include/asm
# git clone git://git.kernel.org/pub/scm/linux/kernel/git/shemminger/iproute2.git
# cd iproute2/
# ./configure --prefix=/sbin
# make; make install
# vi xdp_example.c
#include <linux/bpf.h>
#ifndef __section
# define __section(NAME) __attribute__((section(NAME), used))
#endif
__section("prog")
int xdp_drop(struct xdp_md *ctx)
{
return XDP_DROP;
}
char __license[] __section("license") = "GPL";
# clang -O2 -Wall -target bpf -c xdp_example.c -o xdp_example.o
# ip link set dev eth0 xdp obj xdp_example.o
# ip link set dev eth0 xdp of
SOURCE: https://github.com/torvalds/linux/tree/master/samples/bpf,
http://cilium.readthedocs.io/en/latest/bpf/#llvm,
http://vger.kernel.org/netconf2017_files/XDP_devel_update_NetConf2017_Seoul.pdf,
http://prototype-kernel.readthedocs.io/en/latest/blogposts/xdp25_eval_generic_xdp_tx.html,
https://netdevconf.org/1.2/slides/oct7/10_nic_viljoen_eBPF_Offload_to_Hardware__cls_bpf_and_XDP_finalised.pdf,
https://people.netfilter.org/hawk/presentations/NetDev2.2_2017/XDP_for_the_Rest_of_Us_Part_2.pdf,
XDP – eXpress Data Path