treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / tools / testing / selftests / bpf / prog_tests / pkt_access.c
bloba2537dfa899c6707e6ac46d074de9621bc6d96f6
1 // SPDX-License-Identifier: GPL-2.0
2 #include <test_progs.h>
4 void test_pkt_access(void)
6 const char *file = "./test_pkt_access.o";
7 struct bpf_object *obj;
8 __u32 duration, retval;
9 int err, prog_fd;
11 err = bpf_prog_load(file, BPF_PROG_TYPE_SCHED_CLS, &obj, &prog_fd);
12 if (CHECK_FAIL(err))
13 return;
15 err = bpf_prog_test_run(prog_fd, 100000, &pkt_v4, sizeof(pkt_v4),
16 NULL, NULL, &retval, &duration);
17 CHECK(err || retval, "ipv4",
18 "err %d errno %d retval %d duration %d\n",
19 err, errno, retval, duration);
21 err = bpf_prog_test_run(prog_fd, 100000, &pkt_v6, sizeof(pkt_v6),
22 NULL, NULL, &retval, &duration);
23 CHECK(err || retval, "ipv6",
24 "err %d errno %d retval %d duration %d\n",
25 err, errno, retval, duration);
26 bpf_object__close(obj);