treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / tools / testing / selftests / bpf / prog_tests / xdp_adjust_tail.c
blob3744196d7cba923d249bfe541679210ab09a78eb
1 // SPDX-License-Identifier: GPL-2.0
2 #include <test_progs.h>
4 void test_xdp_adjust_tail(void)
6 const char *file = "./test_adjust_tail.o";
7 struct bpf_object *obj;
8 char buf[128];
9 __u32 duration, retval, size;
10 int err, prog_fd;
12 err = bpf_prog_load(file, BPF_PROG_TYPE_XDP, &obj, &prog_fd);
13 if (CHECK_FAIL(err))
14 return;
16 err = bpf_prog_test_run(prog_fd, 1, &pkt_v4, sizeof(pkt_v4),
17 buf, &size, &retval, &duration);
19 CHECK(err || retval != XDP_DROP,
20 "ipv4", "err %d errno %d retval %d size %d\n",
21 err, errno, retval, size);
23 err = bpf_prog_test_run(prog_fd, 1, &pkt_v6, sizeof(pkt_v6),
24 buf, &size, &retval, &duration);
25 CHECK(err || retval != XDP_TX || size != 54,
26 "ipv6", "err %d errno %d retval %d size %d\n",
27 err, errno, retval, size);
28 bpf_object__close(obj);