staging: rtl8192u: remove redundant assignment to pointer crypt
[linux/fpc-iii.git] / tools / testing / selftests / bpf / progs / test_adjust_tail.c
blob4cd5e860c9035e16cf140694ae3186a2b8008eea
1 /* SPDX-License-Identifier: GPL-2.0
2 * Copyright (c) 2018 Facebook
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of version 2 of the GNU General Public
6 * License as published by the Free Software Foundation.
7 */
8 #include <linux/bpf.h>
9 #include <linux/if_ether.h>
10 #include "bpf_helpers.h"
12 int _version SEC("version") = 1;
14 SEC("xdp_adjust_tail")
15 int _xdp_adjust_tail(struct xdp_md *xdp)
17 void *data_end = (void *)(long)xdp->data_end;
18 void *data = (void *)(long)xdp->data;
19 int offset = 0;
21 if (data_end - data == 54)
22 offset = 256;
23 else
24 offset = 20;
25 if (bpf_xdp_adjust_tail(xdp, 0 - offset))
26 return XDP_DROP;
27 return XDP_TX;
30 char _license[] SEC("license") = "GPL";