[dpdk-dev] [PATCH v6 0/5] Introduce AF_XDP PMD

Xiaolong Ye xiaolong.ye at intel.com
Tue Mar 26 13:20:24 CET 2019


This patchset adds a new PMD driver for AF_XDP which is a proposed
faster version of AF_PACKET interface in Linux, see below links [1] [2] for
details of AF_XDP introduction:

AF_XDP roadmap
- AF_XDP is included in upstream kernel since 4.18, and AF_XDP support
  in libbpf has been merged in v5.1-rc1.
- Now i40e and ixgbe drivers have supported zero copy mode.

Change logs


- remove the newline in AF_XDP_LOG definition to avoid double new lines


- disable AF_XDP pmd by default due to it requires kernel more recent
  than minimum kernel version supported by DPDK
- address other review comments of Maxime


- change vdev name to net_af_xdp
- adopt dynamic log type for all logging
- Fix other style issues raised by Stephen


- Fix all style issues pointed by Stephen, Mattias, David.
- Drop the testpmd change as we'll adopt Jerin's suggestion to add a new
  mempool driver to handle the application use of AF_XDP's zero copy feature.

- Fix a NULL pointer reference crash issue
- Fix txonly stop sending traffic in zc mode
- Refactor rte_mbuf.c to avoid ABI breakage.
- Fix multiple style issues pointed by Ferruh, David, Stephen, Luca.

changes vs RFC sent by Qi last Aug:

- Re-work base on AF_XDP's interface changes since the new libbpf has
  provided higher-level APIs that hide many of the details of the AP_XDP
  uapi. After the rework, it helps to reduce 300+ lines of code.

- multi-queues is not supported due to current libbpf doesn't support
  multi-sockets on a single umem.

- No extra steps to load xdp program manually, since the current behavior of
  libbpf would load a default xdp program when user calls xsk_socket__create.
  userspace application only needs to handle the cleanup.

How to try

1. take the kernel >= v5.1-rc1, build kernel and replace your host
   kernel with it.
   make sure you turn on XDP sockets when compiling

   Networking support -->
        Networking options -->
                [ * ] XDP sockets
2. build libbpf in tools/lib/bpf, and copy the libbpf.a and libbpf.so to /usr/lib64

   cd tools/lib/bpf

3. ethtool -L enp59s0f0 combined 1

4. extra step to build dpdk

   explicitly enable AF_XDP pmd by adding below line to


5. start testpmd

   ./build/app/testpmd -c 0xc -n 4 --vdev net_af_xdp,iface=enp59s0f0,queue=0 -- -i --rxq=1 --txq=1

    in this case, default xdp program will be loaded and linked to queue 0 of enp59s0f0,
    network traffics travel to queue 0 will be redirected to af_xdp socket.

Xiaolong Ye (5):
  net/af_xdp: introduce AF XDP PMD driver
  lib/mbuf: introduce helper to create mempool with flags
  lib/mempool: allow page size aligned mempool
  net/af_xdp: use mbuf mempool for buffer management
  net/af_xdp: enable zero copy

 MAINTAINERS                                   |    6 +
 config/common_base                            |    5 +
 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                   |   32 +
 drivers/net/af_xdp/meson.build                |   21 +
 drivers/net/af_xdp/rte_eth_af_xdp.c           | 1020 +++++++++++++++++
 drivers/net/af_xdp/rte_pmd_af_xdp_version.map |    3 +
 drivers/net/meson.build                       |    1 +
 lib/librte_mbuf/rte_mbuf.c                    |   29 +-
 lib/librte_mbuf/rte_mbuf.h                    |   45 +
 lib/librte_mbuf/rte_mbuf_version.map          |    1 +
 lib/librte_mempool/rte_mempool.c              |    3 +
 lib/librte_mempool/rte_mempool.h              |    1 +
 mk/rte.app.mk                                 |    1 +
 18 files changed, 1228 insertions(+), 5 deletions(-)
 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


More information about the dev mailing list