veth: Add driver XDP
Toshiaki Makita authored

This is the basic implementation of veth driver XDP.

Incoming packets are sent from the peer veth device in the form of skb,
so this is generally doing the same thing as generic XDP.

This itself is not so useful, but a starting point to implement other
useful veth XDP features like TX and REDIRECT.

This introduces NAPI when XDP is enabled, because XDP is now heavily
relies on NAPI context. Use ptr_ring to emulate NIC ring. Tx function
enqueues packets to the ring and peer NAPI handler drains the ring.

Currently only one ring is allocated for each veth device, so it does
not scale on multiqueue env. This can be resolved by allocating rings
on the per-queue basis later.

Note that NAPI is not used but netif_rx is used when XDP is not loaded,
so this does not change the default behaviour.

v6:
- Check skb->len only when allocation is needed.
- Add __GFP_NOWARN to alloc_page() as it can be triggered by external
  events.

v3:
- Fix race on closing the device.
- Add extack messages in ndo_bpf.

v2:
- Squashed with the patch adding NAPI.
- Implement adjust_tail.
- Don't acquire consumer lock because it is guarded by NAPI.
- Make poll_controller noop since it is unnecessary.
- Register rxq_info on enabling XDP rather than on opening the device.
Signed-off-by: default avatarToshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
948d4f21
Name Last commit Last update
Documentation dt-bindings: net: stmmac: Add the bindings documentation for XGMAC2.
LICENSES LICENSES: Add Linux-OpenIB license text
arch Merge ra.kernel.org:/pub/scm/linux/kernel/git/davem/net
block Partially revert "block: fail op_is_write() requests to read-only partitions"
certs certs/blacklist: fix const confusion
crypto net: simplify sock_poll_wait
drivers veth: Add driver XDP
firmware kbuild: remove all dummy assignments to obj-
fs Merge ra.kernel.org:/pub/scm/linux/kernel/git/davem/net
include net: Export skb_headers_offset_update
init Merge tag 'kbuild-fixes-v4.18' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild
ipc Merge ra.kernel.org:/pub/scm/linux/kernel/git/davem/net
kernel Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next
lib Merge ra.kernel.org:/pub/scm/linux/kernel/git/davem/net
mm ipc/shm.c add ->pagesize function to shm_vm_ops
net net: Export skb_headers_offset_update
samples samples/bpf: xdp_redirect_cpu load balance like Suricata
scripts Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
security net: sched: introduce chain object to uapi
sound ALSA: hda/realtek - Yet another Clevo P950 quirk entry
tools selftests: mlxsw: Add TC flower test for Spectrum-2
usr kbuild: rename built-in.o to built-in.a
virt Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm
.clang-format clang-format: add configuration file
.cocciconfig scripts: add Linux .cocciconfig for coccinelle
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS
Makefile
README
Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.
See Documentation/00-INDEX for a list of what is contained in each file.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.