linux-stable/drivers/net
Jesper Dangaard Brouer 039930945a xdp: transition into using xdp_frame for return API
Changing API xdp_return_frame() to take struct xdp_frame as argument,
seems like a natural choice. But there are some subtle performance
details here that needs extra care, which is a deliberate choice.

When de-referencing xdp_frame on a remote CPU during DMA-TX
completion, result in the cache-line is change to "Shared"
state. Later when the page is reused for RX, then this xdp_frame
cache-line is written, which change the state to "Modified".

This situation already happens (naturally) for, virtio_net, tun and
cpumap as the xdp_frame pointer is the queued object.  In tun and
cpumap, the ptr_ring is used for efficiently transferring cache-lines
(with pointers) between CPUs. Thus, the only option is to
de-referencing xdp_frame.

It is only the ixgbe driver that had an optimization, in which it can
avoid doing the de-reference of xdp_frame.  The driver already have
TX-ring queue, which (in case of remote DMA-TX completion) have to be
transferred between CPUs anyhow.  In this data area, we stored a
struct xdp_mem_info and a data pointer, which allowed us to avoid
de-referencing xdp_frame.

To compensate for this, a prefetchw is used for telling the cache
coherency protocol about our access pattern.  My benchmarks show that
this prefetchw is enough to compensate the ixgbe driver.

V7: Adjust for commit d9314c474d ("i40e: add support for XDP_REDIRECT")
V8: Adjust for commit bd658dda42 ("net/mlx5e: Separate dma base address
and offset in dma_sync call")

Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-04-17 10:50:29 -04:00
..
appletalk
arcnet
bonding Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2018-04-01 19:49:34 -04:00
caif drivers/net: Use octal not symbolic permissions 2018-03-26 12:07:49 -04:00
can Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2018-04-03 14:04:18 -07:00
dsa net: dsa: mt7530: Use NULL instead of plain integer 2018-04-04 11:15:49 -04:00
ethernet xdp: transition into using xdp_frame for return API 2018-04-17 10:50:29 -04:00
fddi
fjes
hamradio drivers/net: Use octal not symbolic permissions 2018-03-26 12:07:49 -04:00
hippi
hyperv hv_netvsc: Pass net_device parameter to revoke and teardown functions 2018-04-05 22:21:00 -04:00
ieee802154 Merge branch 'ieee802154-for-davem-2018-03-29' of git://git.kernel.org/pub/scm/linux/kernel/git/sschmidt/wpan-next 2018-03-30 13:00:11 -04:00
ipvlan net: Drop pernet_operations::async 2018-03-27 13:18:09 -04:00
netdevsim devlink: convert occ_get op to separate registration 2018-04-08 12:45:57 -04:00
phy dp83640: Ensure against premature access to PHY registers after reset 2018-04-08 19:58:52 -04:00
plip
ppp pptp: remove a buggy dst release in pptp_connect() 2018-04-04 11:17:55 -04:00
slip slip: Check if rstate is initialized before uncompressing 2018-04-11 10:33:46 -04:00
team Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2018-04-01 19:49:34 -04:00
usb lan78xx: Don't reset the interface on open 2018-04-11 14:44:45 -04:00
vmxnet3 vmxnet3: remove unused flag "rxcsum" from struct vmxnet3_adapter 2018-03-20 10:56:25 -04:00
wan
wimax net: drivers/net: Remove unnecessary skb_copy_expand OOM messages 2018-03-15 14:28:03 -04:00
wireless mac80211_hwsim: use DEFINE_IDA 2018-04-11 10:28:39 -07:00
xen-netback drivers/net: Use octal not symbolic permissions 2018-03-26 12:07:49 -04:00
dummy.c net: Do not take net_rwsem in __rtnl_link_unregister() 2018-03-31 22:24:58 -04:00
eql.c
geneve.c net: Drop pernet_operations::async 2018-03-27 13:18:09 -04:00
gtp.c net: Drop pernet_operations::async 2018-03-27 13:18:09 -04:00
ifb.c net: Do not take net_rwsem in __rtnl_link_unregister() 2018-03-31 22:24:58 -04:00
Kconfig netdevsim: Add simple FIB resource controller via devlink 2018-03-29 14:10:31 -04:00
LICENSE.SRC
loopback.c net: Drop pernet_operations::async 2018-03-27 13:18:09 -04:00
macsec.c macsec: missing dev_put() on error in macsec_newlink() 2018-03-22 14:30:36 -04:00
macvlan.c macvlan: filter out unsupported feature flags 2018-03-11 22:46:16 -04:00
macvtap.c
Makefile net: remove cris etrax ethernet driver 2018-03-26 15:56:24 +02:00
mdio.c
mii.c
netconsole.c
nlmon.c
ntb_netdev.c
rionet.c
sb1000.c
Space.c
sungem_phy.c
tap.c
thunderbolt.c
tun.c xdp: transition into using xdp_frame for return API 2018-04-17 10:50:29 -04:00
veth.c
virtio_net.c xdp: transition into using xdp_frame for return API 2018-04-17 10:50:29 -04:00
vrf.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2018-04-01 19:49:34 -04:00
vsockmon.c
vxlan.c net: Drop pernet_operations::async 2018-03-27 13:18:09 -04:00
xen-netfront.c drivers/net: Use octal not symbolic permissions 2018-03-26 12:07:49 -04:00