Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1b80f86e authored by David S. Miller's avatar David S. Miller
Browse files
Daniel Borkmann says:

====================
pull-request: bpf-next 2018-04-21

The following pull-request contains BPF updates for your *net-next* tree.

The main changes are:

1) Initial work on BPF Type Format (BTF) is added, which is a meta
   data format which describes the data types of BPF programs / maps.
   BTF has its roots from CTF (Compact C-Type format) with a number
   of changes to it. First use case is to provide a generic pretty
   print capability for BPF maps inspection, later work will also
   add BTF to bpftool. pahole support to convert dwarf to BTF will
   be upstreamed as well (https://github.com/iamkafai/pahole/tree/btf

),
   from Martin.

2) Add a new xdp_bpf_adjust_tail() BPF helper for XDP that allows
   for changing the data_end pointer. Only shrinking is currently
   supported which helps for crafting ICMP control messages. Minor
   changes in drivers have been added where needed so they recalc
   the packet's length also when data_end was adjusted, from Nikita.

3) Improve bpftool to make it easier to feed hex bytes via cmdline
   for map operations, from Quentin.

4) Add support for various missing BPF prog types and attach types
   that have been added to kernel recently but neither to bpftool
   nor libbpf yet. Doc and bash completion updates have been added
   as well for bpftool, from Andrey.

5) Proper fix for avoiding to leak info stored in frame data on page
   reuse for the two bpf_xdp_adjust_{head,meta} helpers by disallowing
   to move the pointers into struct xdp_frame area, from Jesper.

6) Follow-up compile fix from BTF in order to include stdbool.h in
   libbpf, from Björn.

7) Few fixes in BPF sample code, that is, a typo on the netdevice
   in a comment and fixup proper dump of XDP action code in the
   tracepoint exception, from Wang and Jesper.
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents cf1a1e07 878a4d32
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -113,10 +113,10 @@ bool bnxt_rx_xdp(struct bnxt *bp, struct bnxt_rx_ring_info *rxr, u16 cons,
	if (tx_avail != bp->tx_ring_size)
		*event &= ~BNXT_RX_EVENT;

	*len = xdp.data_end - xdp.data;
	if (orig_data != xdp.data) {
		offset = xdp.data - xdp.data_hard_start;
		*data_ptr = xdp.data_hard_start + offset;
		*len = xdp.data_end - xdp.data;
	}
	switch (act) {
	case XDP_PASS:
+1 −1
Original line number Diff line number Diff line
@@ -538,9 +538,9 @@ static inline bool nicvf_xdp_rx(struct nicvf *nic, struct bpf_prog *prog,
	action = bpf_prog_run_xdp(prog, &xdp);
	rcu_read_unlock();

	len = xdp.data_end - xdp.data;
	/* Check if XDP program has changed headers */
	if (orig_data != xdp.data) {
		len = xdp.data_end - xdp.data;
		offset = orig_data - xdp.data;
		dma_addr -= offset;
	}
+1 −1
Original line number Diff line number Diff line
@@ -775,8 +775,8 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud

			act = bpf_prog_run_xdp(xdp_prog, &xdp);

			if (xdp.data != orig_data) {
			length = xdp.data_end - xdp.data;
			if (xdp.data != orig_data) {
				frags[0].page_offset = xdp.data -
					xdp.data_hard_start;
				va = xdp.data;
+1 −1
Original line number Diff line number Diff line
@@ -1722,7 +1722,7 @@ static int nfp_net_rx(struct nfp_net_rx_ring *rx_ring, int budget)

			act = bpf_prog_run_xdp(xdp_prog, &xdp);

			pkt_len -= xdp.data - orig_data;
			pkt_len = xdp.data_end - xdp.data;
			pkt_off += xdp.data - orig_data;

			switch (act) {
+2 −1
Original line number Diff line number Diff line
@@ -1690,6 +1690,7 @@ static struct sk_buff *tun_build_skb(struct tun_struct *tun,
			return NULL;
		case XDP_PASS:
			delta = orig_data - xdp.data;
			len = xdp.data_end - xdp.data;
			break;
		default:
			bpf_warn_invalid_xdp_action(act);
@@ -1710,7 +1711,7 @@ static struct sk_buff *tun_build_skb(struct tun_struct *tun,
	}

	skb_reserve(skb, pad - delta);
	skb_put(skb, len + delta);
	skb_put(skb, len);
	get_page(alloc_frag->page);
	alloc_frag->offset += buflen;

Loading