linux_dsm_epyc7002/drivers/net/ethernet
Jesper Dangaard Brouer 99c07c43c4 xdp: tracking page_pool resources and safe removal
This patch is needed before we can allow drivers to use page_pool for
DMA-mappings. Today with page_pool and XDP return API, it is possible to
remove the page_pool object (from rhashtable), while there are still
in-flight packet-pages. This is safely handled via RCU and failed lookups in
__xdp_return() fallback to call put_page(), when page_pool object is gone.
In-case page is still DMA mapped, this will result in page note getting
correctly DMA unmapped.

To solve this, the page_pool is extended with tracking in-flight pages. And
XDP disconnect system queries page_pool and waits, via workqueue, for all
in-flight pages to be returned.

To avoid killing performance when tracking in-flight pages, the implement
use two (unsigned) counters, that in placed on different cache-lines, and
can be used to deduct in-flight packets. This is done by mapping the
unsigned "sequence" counters onto signed Two's complement arithmetic
operations. This is e.g. used by kernel's time_after macros, described in
kernel commit 1ba3aab303 and 5a581b367b, and also explained in RFC1982.

The trick is these two incrementing counters only need to be read and
compared, when checking if it's safe to free the page_pool structure. Which
will only happen when driver have disconnected RX/alloc side. Thus, on a
non-fast-path.

It is chosen that page_pool tracking is also enabled for the non-DMA
use-case, as this can be used for statistics later.

After this patch, using page_pool requires more strict resource "release",
e.g. via page_pool_release_page() that was introduced in this patchset, and
previous patches implement/fix this more strict requirement.

Drivers no-longer call page_pool_destroy(). Drivers already call
xdp_rxq_info_unreg() which call xdp_rxq_info_unreg_mem_model(), which will
attempt to disconnect the mem id, and if attempt fails schedule the
disconnect for later via delayed workqueue.

Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-06-19 11:23:13 -04:00
..
3com treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
8390 net: phy: rename Asix Electronics PHY driver 2019-06-09 13:24:17 -07:00
adaptec treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
aeroflex treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
agere treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
alacritech treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
allwinner treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
alteon treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
altera treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 201 2019-05-30 11:29:52 -07:00
amazon net: ena: update driver version from 2.0.3 to 2.1.0 2019-06-12 11:23:45 -07:00
amd treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 400 2019-06-05 17:37:13 +02:00
apm treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 13 2019-05-21 11:28:45 +02:00
apple treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
aquantia SPDX update for 5.2-rc4 2019-06-08 12:52:42 -07:00
arc treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
atheros Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2019-06-07 11:00:14 -07:00
aurora treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
broadcom tg3: Use napi_alloc_frag() 2019-06-09 19:40:10 -07:00
brocade treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 292 2019-06-05 17:36:38 +02:00
cadence macb: Add support for SiFive FU540-C000 2019-06-18 22:02:27 -04:00
calxeda treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 201 2019-05-30 11:29:52 -07:00
cavium treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 206 2019-05-30 11:29:53 -07:00
chelsio Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2019-06-17 20:20:36 -07:00
cirrus treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
cisco treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
cortina net: gemini: remove unnecessary assert 2019-04-18 17:06:15 -07:00
davicom treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
dec SPDX update for 5.2-rc3, round 1 2019-05-31 08:34:32 -07:00
dlink treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
emulex Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2019-06-17 15:55:34 -07:00
ezchip treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 291 2019-06-05 17:36:38 +02:00
faraday treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 61 2019-05-24 17:36:45 +02:00
freescale Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2019-06-17 20:20:36 -07:00
fujitsu treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
hisilicon net: hns3: Add missing newline at end of file 2019-06-18 20:56:42 -04:00
hp treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 86 2019-05-24 17:37:52 +02:00
huawei hinic: add support for rss parameters with ethtool 2019-06-18 21:52:27 -04:00
i825xx treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
ibm ibmvnic: Fix unchecked return codes of memory allocations 2019-06-09 19:51:28 -07:00
intel iavf: allow null RX descriptors 2019-06-17 15:39:26 -07:00
marvell net: mvpp2: cls: Add steering based on vlan Id and priority. 2019-06-18 22:26:05 -04:00
mediatek Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2019-06-17 20:20:36 -07:00
mellanox xdp: tracking page_pool resources and safe removal 2019-06-19 11:23:13 -04:00
micrel treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 176 2019-05-30 11:29:19 -07:00
microchip treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
moxa treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
mscc ocelot: remove unused variable 'rc' in vcap_cmd() 2019-06-09 20:11:53 -07:00
myricom treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
natsemi treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 13 2019-05-21 11:28:45 +02:00
neterion treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
netronome Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2019-06-17 20:20:36 -07:00
ni treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
nuvoton treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 441 2019-06-05 17:37:17 +02:00
nvidia treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 13 2019-05-21 11:28:45 +02:00
nxp treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
oki-semi treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 340 2019-06-05 17:37:07 +02:00
packetengines treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
pasemi treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
qlogic qed: Fix -Wmaybe-uninitialized false positive 2019-06-18 10:44:21 -07:00
qualcomm Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2019-06-17 20:20:36 -07:00
rdc treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 1 2019-05-21 11:28:39 +02:00
realtek r8169: improve handling of Abit Fatal1ty F-190HD 2019-06-15 14:04:34 -07:00
renesas net: sh_eth: fix mdio access in sh_eth_close() for R-Car Gen2 and RZ/A1 SoCs 2019-05-29 13:24:54 -07:00
rocker Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2019-06-07 11:00:14 -07:00
samsung treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
seeq treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
sfc treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
sgi treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
silan treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
sis treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
smsc treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 13 2019-05-21 11:28:45 +02:00
socionext net: netsec: remove loops in napi Rx process 2019-06-19 10:28:20 -04:00
stmicro net: stmmac: add sanity check to device_property_read_u32_array call 2019-06-18 21:03:38 -04:00
sun net: remove 'fallback' argument from dev->ndo_select_queue() 2019-03-20 11:18:55 -07:00
synopsys treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
tehuti treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
ti net: ethernet: ti: davinci_cpdma: use idled submit 2019-06-16 14:03:25 -07:00
toshiba ps3_gelic: Use [] to denote a flexible array member 2019-06-18 10:43:20 -07:00
tundra treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
via net: ipv4: provide __rcu annotation for ifa_list 2019-06-02 18:08:36 -07:00
wiznet net: ethernet: wiznet: w5X00 add device tree support 2019-06-12 09:52:04 -07:00
xilinx net: axienet: move use of resource after validity check 2019-06-13 22:41:24 -07:00
xircom treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
xscale treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 206 2019-05-30 11:29:53 -07:00
dnet.c
dnet.h
ec_bhf.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 282 2019-06-05 17:36:37 +02:00
ethoc.c net: ethernet: support of_get_mac_address new ERR_PTR error 2019-05-07 12:22:47 -07:00
fealnx.c net: fealnx: replace dev_kfree_skb_irq by dev_consume_skb_irq for drop profiles 2019-02-13 20:50:42 -08:00
jme.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 195 2019-05-30 11:29:22 -07:00
jme.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 195 2019-05-30 11:29:22 -07:00
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
korina.c
lantiq_etop.c lantiq_etop: pass struct device to DMA API functions 2019-02-12 12:09:23 -05:00
lantiq_xrx200.c net: ethernet: support of_get_mac_address new ERR_PTR error 2019-05-07 12:22:47 -07:00
Makefile
netx-eth.c