Skip to content

Commit 1db04c3

Browse files
alan-maguireborkmann
authored andcommitted
bpf: sync bpf.h to tools/ for BPF_F_ADJ_ROOM_ENCAP_L2
Sync include/uapi/linux/bpf.h with tools/ equivalent to add BPF_F_ADJ_ROOM_ENCAP_L2(len) macro. Signed-off-by: Alan Maguire <alan.maguire@oracle.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
1 parent 58dfc90 commit 1db04c3

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

  • tools/include/uapi/linux

‎tools/include/uapi/linux/bpf.h‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1523,6 +1523,10 @@ union bpf_attr {
15231523
* * **BPF_F_ADJ_ROOM_ENCAP_L4_UDP **:
15241524
* Use with ENCAP_L3 flags to further specify the tunnel type.
15251525
*
1526+
* * **BPF_F_ADJ_ROOM_ENCAP_L2(len) **:
1527+
* Use with ENCAP_L3/L4 flags to further specify the tunnel
1528+
* type; **len** is the length of the inner MAC header.
1529+
*
15261530
* A call to this helper is susceptible to change the underlaying
15271531
* packet buffer. Therefore, at load time, all checks on pointers
15281532
* previously done by the verifier are invalidated and must be
@@ -2664,10 +2668,16 @@ enum bpf_func_id {
26642668
/* BPF_FUNC_skb_adjust_room flags. */
26652669
#define BPF_F_ADJ_ROOM_FIXED_GSO (1ULL << 0)
26662670

2671+
#define BPF_ADJ_ROOM_ENCAP_L2_MASK 0xff
2672+
#define BPF_ADJ_ROOM_ENCAP_L2_SHIFT 56
2673+
26672674
#define BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 (1ULL << 1)
26682675
#define BPF_F_ADJ_ROOM_ENCAP_L3_IPV6 (1ULL << 2)
26692676
#define BPF_F_ADJ_ROOM_ENCAP_L4_GRE (1ULL << 3)
26702677
#define BPF_F_ADJ_ROOM_ENCAP_L4_UDP (1ULL << 4)
2678+
#define BPF_F_ADJ_ROOM_ENCAP_L2(len) (((__u64)len & \
2679+
BPF_ADJ_ROOM_ENCAP_L2_MASK) \
2680+
<< BPF_ADJ_ROOM_ENCAP_L2_SHIFT)
26712681

26722682
/* Mode for BPF_FUNC_skb_adjust_room helper. */
26732683
enum bpf_adj_room_mode {

0 commit comments

Comments
 (0)