History

bpf: add bpf_skb_adjust_room encap flags

When pushing tunnel headers, annotate skbs in the same way as tunnel devices. For GSO packets, the network stack requires certain fields set to segment packets with tunnel headers. gro_gse_segment depends on transport and inner mac header, for instance. Add an option to pass this information. Remove the restriction on len_diff to network header length, which is too short, e.g., for GRE protocols. Changes v1->v2: - document new flags - BPF_F_ADJ_ROOM_MASK moved v2->v3: - BPF_F_ADJ_ROOM_ENCAP_L3_MASK moved

Willem de Bruijn committed 7 years ago

Commit 868d5231 parent 2278f6c2 files · +76 −6Browse files

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

Unified · Split

include/uapi/linux/bpf.h+15−1
@@ -1486,11 +1486,20 @@ union bpf_attr { · 1485 unmodified lines
1486 * * **BPF_ADJ_ROOM_NET**: Adjust room at the network layer1486 * * **BPF_ADJ_ROOM_NET**: Adjust room at the network layer
1487 * (room space is added or removed below the layer 3 header).1487 * (room space is added or removed below the layer 3 header).
1488 *1488 *
1489 * There is one supported flag at this time:1489 * The following flags are supported at this time:
1490 *1490 *
1491 * * **BPF_F_ADJ_ROOM_FIXED_GSO**: Do not adjust gso_size.1491 * * **BPF_F_ADJ_ROOM_FIXED_GSO**: Do not adjust gso_size.
1492 * Adjusting mss in this way is not allowed for datagrams.1492 * Adjusting mss in this way is not allowed for datagrams.
1493 *1493 *
1494 * * **BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 **:
1495 * * **BPF_F_ADJ_ROOM_ENCAP_L3_IPV6 **:
1496 * Any new space is reserved to hold a tunnel header.
1497 * Configure skb offsets and other fields accordingly.
1498 *
1499 * * **BPF_F_ADJ_ROOM_ENCAP_L4_GRE **:
1500 * * **BPF_F_ADJ_ROOM_ENCAP_L4_UDP **:
1501 * Use with ENCAP_L3 flags to further specify the tunnel type.
1502 *
1494 * A call to this helper is susceptible to change the underlaying1503 * A call to this helper is susceptible to change the underlaying
1495 * packet buffer. Therefore, at load time, all checks on pointers1504 * packet buffer. Therefore, at load time, all checks on pointers
1496 * previously done by the verifier are invalidated and must be1505 * previously done by the verifier are invalidated and must be
@@ -2632,6 +2641,11 @@ enum bpf_func_id { · 1135 unmodified lines
2632/* BPF_FUNC_skb_adjust_room flags. */2641/* BPF_FUNC_skb_adjust_room flags. */
2633#define BPF_F_ADJ_ROOM_FIXED_GSO (1ULL << 0)2642#define BPF_F_ADJ_ROOM_FIXED_GSO (1ULL << 0)
2634 2643
2644#define BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 (1ULL << 1)
2645#define BPF_F_ADJ_ROOM_ENCAP_L3_IPV6 (1ULL << 2)
2646#define BPF_F_ADJ_ROOM_ENCAP_L4_GRE (1ULL << 3)
2647#define BPF_F_ADJ_ROOM_ENCAP_L4_UDP (1ULL << 4)
2648
2635/* Mode for BPF_FUNC_skb_adjust_room helper. */2649/* Mode for BPF_FUNC_skb_adjust_room helper. */
2636enum bpf_adj_room_mode {2650enum bpf_adj_room_mode {
2637 BPF_ADJ_ROOM_NET,2651 BPF_ADJ_ROOM_NET,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t