History

Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next

Alexei Starovoitov says: ==================== pull-request: bpf-next 2019-02-16 The following pull-request contains BPF updates for your *net-next* tree. The main changes are: 1) numerous libbpf API improvements, from Andrii, Andrey, Yonghong. 2) test all bpf progs in alu32 mode, from Jiong. 3) skb->sk access and bpf_sk_fullsock(), bpf_tcp_sock() helpers, from Martin. 4) support for IP encap in lwt bpf progs, from Peter. 5) remove XDP_QUERY_XSK_UMEM dead code, from Jan. ====================

David S. Miller committed 7 years ago

Commit 885e6312 parents f186a82 5aab39292 files · +2576 −485Browse files

Showing the changes to include/uapi/linux (1 of 92 files). Show all

Unified · Split

include/uapi/linux/bpf.h+89−9
@@ -2016,6 +2016,19 @@ union bpf_attr { · 2015 unmodified lines
2016 * Only works if *skb* contains an IPv6 packet. Insert a2016 * Only works if *skb* contains an IPv6 packet. Insert a
2017 * Segment Routing Header (**struct ipv6_sr_hdr**) inside2017 * Segment Routing Header (**struct ipv6_sr_hdr**) inside
2018 * the IPv6 header.2018 * the IPv6 header.
2019 * **BPF_LWT_ENCAP_IP**
2020 * IP encapsulation (GRE/GUE/IPIP/etc). The outer header
2021 * must be IPv4 or IPv6, followed by zero or more
2022 * additional headers, up to LWT_BPF_MAX_HEADROOM total
2023 * bytes in all prepended headers. Please note that
2024 * if skb_is_gso(skb) is true, no more than two headers
2025 * can be prepended, and the inner header, if present,
2026 * should be either GRE or UDP/GUE.
2027 *
2028 * BPF_LWT_ENCAP_SEG6*** types can be called by bpf programs of
2029 * type BPF_PROG_TYPE_LWT_IN; BPF_LWT_ENCAP_IP type can be called
2030 * by bpf programs of types BPF_PROG_TYPE_LWT_IN and
2031 * BPF_PROG_TYPE_LWT_XMIT.
2019 *2032 *
2020 * A call to this helper is susceptible to change the underlaying2033 * A call to this helper is susceptible to change the underlaying
2021 * packet buffer. Therefore, at load time, all checks on pointers2034 * packet buffer. Therefore, at load time, all checks on pointers
@@ -2329,6 +2342,23 @@ union bpf_attr { · 307 unmodified lines
2329 * "**y**".2342 * "**y**".
2330 * Return2343 * Return
2331 * 02344 * 0
2345 *
2346 * struct bpf_sock *bpf_sk_fullsock(struct bpf_sock *sk)
2347 * Description
2348 * This helper gets a **struct bpf_sock** pointer such
2349 * that all the fields in bpf_sock can be accessed.
2350 * Return
2351 * A **struct bpf_sock** pointer on success, or NULL in
2352 * case of failure.
2353 *
2354 * struct bpf_tcp_sock *bpf_tcp_sock(struct bpf_sock *sk)
2355 * Description
2356 * This helper gets a **struct bpf_tcp_sock** pointer from a
2357 * **struct bpf_sock** pointer.
2358 *
2359 * Return
2360 * A **struct bpf_tcp_sock** pointer on success, or NULL in
2361 * case of failure.
2332 */2362 */
2333#define __BPF_FUNC_MAPPER(FN) \2363#define __BPF_FUNC_MAPPER(FN) \
2334 FN(unspec), \2364 FN(unspec), \
@@ -2425,7 +2455,9 @@ union bpf_attr { · 90 unmodified lines
2425 FN(msg_pop_data), \2455 FN(msg_pop_data), \
2426 FN(rc_pointer_rel), \2456 FN(rc_pointer_rel), \
2427 FN(spin_lock), \2457 FN(spin_lock), \
2428 FN(spin_unlock),2458 FN(spin_unlock), \
2459 FN(sk_fullsock), \
2460 FN(tcp_sock),
2429 2461
2430/* integer value in 'imm' field of BPF_CALL instruction selects which helper2462/* integer value in 'imm' field of BPF_CALL instruction selects which helper
2431 * function eBPF program intends to call2463 * function eBPF program intends to call
@@ -2498,7 +2530,8 @@ enum bpf_hdr_start_off { · 66 unmodified lines
2498/* Encapsulation type for BPF_FUNC_lwt_push_encap helper. */2530/* Encapsulation type for BPF_FUNC_lwt_push_encap helper. */
2499enum bpf_lwt_encap_mode {2531enum bpf_lwt_encap_mode {
2500 BPF_LWT_ENCAP_SEG6,2532 BPF_LWT_ENCAP_SEG6,
2501 BPF_LWT_ENCAP_SEG6_INLINE2533 BPF_LWT_ENCAP_SEG6_INLINE,
2534 BPF_LWT_ENCAP_IP,
2502};2535};
2503 2536
2504#define __bpf_md_ptr(type, name) \2537#define __bpf_md_ptr(type, name) \
@@ -2545,6 +2578,7 @@ struct __sk_buff { · 40 unmodified lines
2545 __u64 tstamp;2578 __u64 tstamp;
2546 __u32 wire_len;2579 __u32 wire_len;
2547 __u32 gso_segs;2580 __u32 gso_segs;
2581 __bpf_md_ptr(struct bpf_sock *, sk);
2548};2582};
2549 2583
2550struct bpf_tunnel_key {2584struct bpf_tunnel_key {
@@ -2586,7 +2620,15 @@ enum bpf_ret_code { · 35 unmodified lines
2586 BPF_DROP = 2,2620 BPF_DROP = 2,
2587 /* 3-6 reserved */2621 /* 3-6 reserved */
2588 BPF_REDIRECT = 7,2622 BPF_REDIRECT = 7,
2589 /* >127 are reserved for prog type specific return codes */2623 /* >127 are reserved for prog type specific return codes.
2624 *
2625 * BPF_LWT_REROUTE: used by BPF_PROG_TYPE_LWT_IN and
2626 * BPF_PROG_TYPE_LWT_XMIT to indicate that skb had been
2627 * changed and should be routed based on its new L3 header.
2628 * (This is an L3 redirect, as opposed to L2 redirect
2629 * represented by BPF_REDIRECT above).
2630 */
2631 BPF_LWT_REROUTE = 128,
2590};2632};
2591 2633
2592struct bpf_sock {2634struct bpf_sock {
@@ -2596,14 +2638,52 @@ struct bpf_sock { · 3 unmodified lines
2596 __u32 protocol;2638 __u32 protocol;
2597 __u32 mark;2639 __u32 mark;
2598 __u32 priority;2640 __u32 priority;
2599 __u32 src_ip4; /* Allows 1,2,4-byte read.2641 /* IP address also allows 1 and 2 bytes access */
2600 * Stored in network byte order.2642 __u32 src_ip4;
2643 __u32 src_ip6[4];
2644 __u32 src_port; /* host byte order */
2645 __u32 dst_port; /* network byte order */
2646 __u32 dst_ip4;
2647 __u32 dst_ip6[4];
2648 __u32 state;
2649};
2650
2651struct bpf_tcp_sock {
2652 __u32 snd_cwnd; /* Sending congestion window */
2653 __u32 srtt_us; /* smoothed round trip time << 3 in usecs */
2654 __u32 rtt_min;
2655 __u32 snd_ssthresh; /* Slow start size threshold */
2656 __u32 rcv_nxt; /* What we want to receive next */
2657 __u32 snd_nxt; /* Next sequence we send */
2658 __u32 snd_una; /* First byte we want an ack for */
2659 __u32 mss_cache; /* Cached effective mss, not including SACKS */
2660 __u32 ecn_flags; /* ECN status bits. */
2661 __u32 rate_delivered; /* saved rate sample: packets delivered */
2662 __u32 rate_interval_us; /* saved rate sample: time elapsed */
2663 __u32 packets_out; /* Packets which are "in flight" */
2664 __u32 retrans_out; /* Retransmitted packets out */
2665 __u32 total_retrans; /* Total retransmits for entire connection */
2666 __u32 segs_in; /* RFC4898 tcpEStatsPerfSegsIn
2667 * total number of segments in.
2601 */2668 */
2602 __u32 src_ip6[4]; /* Allows 1,2,4-byte read.2669 __u32 data_segs_in; /* RFC4898 tcpEStatsPerfDataSegsIn
2603 * Stored in network byte order.2670 * total number of data segments in.
2671 */
2672 __u32 segs_out; /* RFC4898 tcpEStatsPerfSegsOut
2673 * The total number of segments sent.
2674 */
2675 __u32 data_segs_out; /* RFC4898 tcpEStatsPerfDataSegsOut
2676 * total number of data segments sent.
2677 */
2678 __u32 lost_out; /* Lost packets */
2679 __u32 sacked_out; /* SACK'd packets */
2680 __u64 bytes_received; /* RFC4898 tcpEStatsAppHCThruOctetsReceived
2681 * sum(delta(rcv_nxt)), or how many bytes
2682 * were acked.
2604 */2683 */
2605 __u32 src_port; /* Allows 4-byte read.2684 __u64 bytes_acked; /* RFC4898 tcpEStatsAppHCThruOctetsAcked
2606 * Stored in host byte order2685 * sum(delta(snd_una)), or how many bytes
2686 * were acked.
2607 */2687 */
2608};2688};
2609 2689