linux_dsm_epyc7002/drivers/net/ethernet/mellanox/mlx4
Daniel Borkmann de8f3a83b0 bpf: add meta pointer for direct access
This work enables generic transfer of metadata from XDP into skb. The
basic idea is that we can make use of the fact that the resulting skb
must be linear and already comes with a larger headroom for supporting
bpf_xdp_adjust_head(), which mangles xdp->data. Here, we base our work
on a similar principle and introduce a small helper bpf_xdp_adjust_meta()
for adjusting a new pointer called xdp->data_meta. Thus, the packet has
a flexible and programmable room for meta data, followed by the actual
packet data. struct xdp_buff is therefore laid out that we first point
to data_hard_start, then data_meta directly prepended to data followed
by data_end marking the end of packet. bpf_xdp_adjust_head() takes into
account whether we have meta data already prepended and if so, memmove()s
this along with the given offset provided there's enough room.

xdp->data_meta is optional and programs are not required to use it. The
rationale is that when we process the packet in XDP (e.g. as DoS filter),
we can push further meta data along with it for the XDP_PASS case, and
give the guarantee that a clsact ingress BPF program on the same device
can pick this up for further post-processing. Since we work with skb
there, we can also set skb->mark, skb->priority or other skb meta data
out of BPF, thus having this scratch space generic and programmable
allows for more flexibility than defining a direct 1:1 transfer of
potentially new XDP members into skb (it's also more efficient as we
don't need to initialize/handle each of such new members). The facility
also works together with GRO aggregation. The scratch space at the head
of the packet can be multiple of 4 byte up to 32 byte large. Drivers not
yet supporting xdp->data_meta can simply be set up with xdp->data_meta
as xdp->data + 1 as bpf_xdp_adjust_meta() will detect this and bail out,
such that the subsequent match against xdp->data for later access is
guaranteed to fail.

The verifier treats xdp->data_meta/xdp->data the same way as we treat
xdp->data/xdp->data_end pointer comparisons. The requirement for doing
the compare against xdp->data is that it hasn't been modified from it's
original address we got from ctx access. It may have a range marking
already from prior successful xdp->data/xdp->data_end pointer comparisons
though.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-09-26 13:36:44 -07:00
..
alloc.c mlx4: sizeof style usage 2017-08-16 11:01:57 -07:00
catas.c drivers: net: mlx4: use setup_timer() helper. 2017-09-21 11:44:42 -07:00
cmd.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2017-09-06 14:45:08 -07:00
cq.c (IB, net)/mlx4: Add resource utilization support 2017-07-24 10:41:35 -04:00
en_clock.c net/mlx4_en: fix overflow in mlx4_en_init_timestamp() 2017-02-26 15:39:43 -05:00
en_cq.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2017-09-06 14:45:08 -07:00
en_dcb_nl.c net/mlx4_en: Do not allocate redundant TX queues when TC is disabled 2017-06-29 15:56:15 -04:00
en_ethtool.c net/mlx4_en: Fix wrong indication of Wake-on-LAN (WoL) support 2017-08-02 10:44:09 -07:00
en_main.c mlx4_en: remove unnecessary error check 2017-07-24 17:26:32 -07:00
en_netdev.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2017-09-06 14:45:08 -07:00
en_port.c mlx4: add rx_alloc_pages counter in ethtool -S 2017-03-09 09:54:46 -08:00
en_port.h net/mlx4_en: Check the enabling pptx/pprx flags in SET_PORT wrapper flow 2017-01-30 15:26:43 -05:00
en_resources.c mlx4: sizeof style usage 2017-08-16 11:01:57 -07:00
en_rx.c bpf: add meta pointer for direct access 2017-09-26 13:36:44 -07:00
en_selftest.c networking: make skb_put & friends return void pointers 2017-06-16 11:48:39 -04:00
en_tx.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2017-09-06 14:45:08 -07:00
eq.c net/mlx4_core: Fix misplaced brackets of sizeof 2017-08-29 14:58:32 -07:00
fw_qos.c net/mlx4: fix spelling mistake: "availible" -> "available" 2017-08-16 14:23:45 -07:00
fw_qos.h net/mlx4: fix spelling mistake: "availible" -> "available" 2017-08-16 14:23:45 -07:00
fw.c net/mlx4_core: Use ARRAY_SIZE macro 2017-09-05 11:49:16 -07:00
fw.h net/mlx4_core: Dynamically allocate structs at mlx4_slave_cap 2017-08-29 14:58:32 -07:00
icm.c mlx4: sizeof style usage 2017-08-16 11:01:57 -07:00
icm.h mlx4: sizeof style usage 2017-08-16 11:01:57 -07:00
intf.c mlx4: sizeof style usage 2017-08-16 11:01:57 -07:00
Kconfig ptp_clock: Allow for it to be optional 2016-11-16 09:26:34 +01:00
main.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2017-09-06 14:45:08 -07:00
Makefile net/mlx4: New file for QoS related firmware commands 2015-04-02 16:25:02 -04:00
mcg.c mlx4: sizeof style usage 2017-08-16 11:01:57 -07:00
mlx4_en.h mlx4_en: remove unnecessary returned value 2017-07-24 16:29:55 -07:00
mlx4_stats.h mlx4: add rx_alloc_pages counter in ethtool -S 2017-03-09 09:54:46 -08:00
mlx4.h Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2017-09-06 14:45:08 -07:00
mr.c mlx4: sizeof style usage 2017-08-16 11:01:57 -07:00
pd.c io-mapping: Specify mapping size for io_mapping_map_wc() 2016-04-28 12:17:32 +01:00
port.c net/mlx4: Add user mac FW update support 2017-08-29 14:58:32 -07:00
profile.c net/mlx4_core: use swap() in mlx4_make_profile() 2015-06-11 15:19:41 -07:00
qp.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2017-09-06 14:45:08 -07:00
reset.c net/mlx4_core: Maintain a persistent memory for mlx4 device 2015-01-25 14:43:13 -08:00
resource_tracker.c mlx4: sizeof style usage 2017-08-16 11:01:57 -07:00
sense.c
srq.c {net, IB}/mlx4: Remove gfp flags argument 2017-07-17 21:21:24 -04:00