On Tue, 19 Mar 2019 15:12:51 +0800 Xiaolong Ye <xiaolong...@intel.com> wrote:
> Add a new PMD driver for AF_XDP which is a proposed faster version of > AF_PACKET interface in Linux. More info about AF_XDP, please refer to [1] > [2]. > > This is the vanilla version PMD which just uses a raw buffer registered as > the umem. > > [1] https://fosdem.org/2018/schedule/event/af_xdp/ > [2] https://lwn.net/Articles/745934/ > > Signed-off-by: Xiaolong Ye <xiaolong...@intel.com> > --- > MAINTAINERS | 6 + > config/common_base | 5 + > config/common_linux | 1 + > doc/guides/nics/af_xdp.rst | 45 + > doc/guides/nics/features/af_xdp.ini | 11 + > doc/guides/nics/index.rst | 1 + > doc/guides/rel_notes/release_19_05.rst | 7 + > drivers/net/Makefile | 1 + > drivers/net/af_xdp/Makefile | 33 + > drivers/net/af_xdp/meson.build | 21 + > drivers/net/af_xdp/rte_eth_af_xdp.c | 930 ++++++++++++++++++ > drivers/net/af_xdp/rte_pmd_af_xdp_version.map | 3 + > drivers/net/meson.build | 1 + > mk/rte.app.mk | 1 + > 14 files changed, 1066 insertions(+) > create mode 100644 doc/guides/nics/af_xdp.rst > create mode 100644 doc/guides/nics/features/af_xdp.ini > create mode 100644 drivers/net/af_xdp/Makefile > create mode 100644 drivers/net/af_xdp/meson.build > create mode 100644 drivers/net/af_xdp/rte_eth_af_xdp.c > create mode 100644 drivers/net/af_xdp/rte_pmd_af_xdp_version.map > > diff --git a/MAINTAINERS b/MAINTAINERS > index 452b8eb82..1cc54b439 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -468,6 +468,12 @@ M: John W. Linville <linvi...@tuxdriver.com> > F: drivers/net/af_packet/ > F: doc/guides/nics/features/afpacket.ini > > +Linux AF_XDP > +M: Xiaolong Ye <xiaolong...@intel.com> > +M: Qi Zhang <qi.z.zh...@intel.com> > +F: drivers/net/af_xdp/ > +F: doc/guides/nics/features/af_xdp.rst > + > Amazon ENA > M: Marcin Wojtas <m...@semihalf.com> > M: Michal Krawczyk <m...@semihalf.com> > diff --git a/config/common_base b/config/common_base > index 0b09a9348..4044de205 100644 > --- a/config/common_base > +++ b/config/common_base > @@ -416,6 +416,11 @@ CONFIG_RTE_LIBRTE_VMXNET3_DEBUG_TX_FREE=n > # > CONFIG_RTE_LIBRTE_PMD_AF_PACKET=n > > +# > +# Compile software PMD backed by AF_XDP sockets (Linux only) > +# > +CONFIG_RTE_LIBRTE_PMD_AF_XDP=n > + > # > # Compile link bonding PMD library > # > diff --git a/config/common_linux b/config/common_linux > index 75334273d..0b1249da0 100644 > --- a/config/common_linux > +++ b/config/common_linux > @@ -19,6 +19,7 @@ CONFIG_RTE_LIBRTE_VHOST_POSTCOPY=n > CONFIG_RTE_LIBRTE_PMD_VHOST=y > CONFIG_RTE_LIBRTE_IFC_PMD=y > CONFIG_RTE_LIBRTE_PMD_AF_PACKET=y > +CONFIG_RTE_LIBRTE_PMD_AF_XDP=y > CONFIG_RTE_LIBRTE_PMD_SOFTNIC=y > CONFIG_RTE_LIBRTE_PMD_TAP=y > CONFIG_RTE_LIBRTE_AVP_PMD=y > diff --git a/doc/guides/nics/af_xdp.rst b/doc/guides/nics/af_xdp.rst > new file mode 100644 > index 000000000..dd5654dd1 > --- /dev/null > +++ b/doc/guides/nics/af_xdp.rst > @@ -0,0 +1,45 @@ > +.. SPDX-License-Identifier: BSD-3-Clause > + Copyright(c) 2018 Intel Corporation. > + > +AF_XDP Poll Mode Driver > +========================== > + > +AF_XDP is an address family that is optimized for high performance > +packet processing. AF_XDP sockets enable the possibility for XDP program to > +redirect packets to a memory buffer in userspace. > + > +For the full details behind AF_XDP socket, you can refer to > +`AF_XDP documentation in the Kernel > +<https://www.kernel.org/doc/Documentation/networking/af_xdp.rst>`_. > + > +This Linux-specific PMD driver creates the AF_XDP socket and binds it to a > +specific netdev queue, it allows a DPDK application to send and receive raw > +packets through the socket which would bypass the kernel network stack. > +Current implementation only supports single queue, multi-queues feature will > +be added later. > + > +Options > +------- > + > +The following options can be provided to set up an af_xdp port in DPDK. > + > +* ``iface`` - name of the Kernel interface to attach to (required); > +* ``queue`` - netdev queue id (optional, default 0); > + > +Prerequisites > +------------- > + > +This is a Linux-specific PMD, thus the following prerequisites apply: > + > +* A Linux Kernel (version > 4.18) with XDP sockets configuration enabled; > +* libbpf (within kernel version > 5.1) with latest af_xdp support installed > +* A Kernel bound interface to attach to. > + > +Set up an af_xdp interface > +----------------------------- > + > +The following example will set up an af_xdp interface in DPDK: > + > +.. code-block:: console > + > + --vdev eth_af_xdp,iface=ens786f1,queue=0 > diff --git a/doc/guides/nics/features/af_xdp.ini > b/doc/guides/nics/features/af_xdp.ini > new file mode 100644 > index 000000000..7b8fcce00 > --- /dev/null > +++ b/doc/guides/nics/features/af_xdp.ini > @@ -0,0 +1,11 @@ > +; > +; Supported features of the 'af_xdp' network poll mode driver. > +; > +; Refer to default.ini for the full list of available PMD features. > +; > +[Features] > +Link status = Y > +MTU update = Y > +Promiscuous mode = Y > +Stats per queue = Y > +x86-64 = Y > \ No newline at end of file This is bad. Configure your editor to always put newline at end of file. In .emacs (setq require-final-newline t)