page_pool: refurbish version of page_pool code
authorJesper Dangaard Brouer <brouer@redhat.com>
Tue, 17 Apr 2018 14:46:17 +0000 (16:46 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 17 Apr 2018 14:50:29 +0000 (10:50 -0400)
commitff7d6b27f894f1469dc51ccb828b7363ccd9799f
tree933191e4e40bed2e547d4cce3ca7d00a536e1b01
parent8d5d88527587516bd58ff0f3810f07c38e65e2be
page_pool: refurbish version of page_pool code

Need a fast page recycle mechanism for ndo_xdp_xmit API for returning
pages on DMA-TX completion time, which have good cross CPU
performance, given DMA-TX completion time can happen on a remote CPU.

Refurbish my page_pool code, that was presented[1] at MM-summit 2016.
Adapted page_pool code to not depend the page allocator and
integration into struct page.  The DMA mapping feature is kept,
even-though it will not be activated/used in this patchset.

[1] http://people.netfilter.org/hawk/presentations/MM-summit2016/generic_page_pool_mm_summit2016.pdf

V2: Adjustments requested by Tariq
 - Changed page_pool_create return codes, don't return NULL, only
   ERR_PTR, as this simplifies err handling in drivers.

V4: many small improvements and cleanups
- Add DOC comment section, that can be used by kernel-doc
- Improve fallback mode, to work better with refcnt based recycling
  e.g. remove a WARN as pointed out by Tariq
  e.g. quicker fallback if ptr_ring is empty.

V5: Fixed SPDX license as pointed out by Alexei

V6: Adjustments requested by Eric Dumazet
 - Adjust ____cacheline_aligned_in_smp usage/placement
 - Move rcu_head in struct page_pool
 - Free pages quicker on destroy, minimize resources delayed an RCU period
 - Remove code for forward/backward compat ABI interface

V8: Issues found by kbuild test robot
 - Address sparse should be static warnings
 - Only compile+link when a driver use/select page_pool,
   mlx5 selects CONFIG_PAGE_POOL, although its first used in two patches

Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlx5/core/Kconfig
include/net/page_pool.h [new file with mode: 0644]
net/Kconfig
net/core/Makefile
net/core/page_pool.c [new file with mode: 0644]