1 // SPDX-License-Identifier: GPL-2.0
3 #include <bpf/bpf_helpers.h>
5 SEC("xdp_adjust_tail_grow")
6 int _xdp_adjust_tail_grow(struct xdp_md
*xdp
)
8 void *data_end
= (void *)(long)xdp
->data_end
;
9 void *data
= (void *)(long)xdp
->data
;
10 unsigned int data_len
;
13 /* Data length determine test case */
14 data_len
= data_end
- data
;
16 if (data_len
== 54) { /* sizeof(pkt_v4) */
17 offset
= 4096; /* test too large offset */
18 } else if (data_len
== 74) { /* sizeof(pkt_v6) */
20 } else if (data_len
== 64) {
22 } else if (data_len
== 128) {
23 offset
= 4096 - 256 - 320 - data_len
; /* Max tail grow 3520 */
25 return XDP_ABORTED
; /* No matching test */
28 if (bpf_xdp_adjust_tail(xdp
, offset
))
33 char _license
[] SEC("license") = "GPL";