Projectname large_stringclasses 15
values | Filepath large_stringlengths 4 106 ⌀ | Function large_stringlengths 11 3.45k | Label list |
|---|---|---|---|
Linux Kernel | tools/testing/selftests/bpf/prog_tests/unpriv_bpf_disabled.c |
static void process_perfbuf(void *ctx, int cpu, void *data, __u32 len) {
if (ASSERT_EQ(len, sizeof(__u32), "perfbuf_size_valid"))
got_perfbuf_val = *(__u32 *)data;
} | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/prog_tests/uprobe_autoattach.c | void test_uprobe_autoattach(void) {
struct test_uprobe_autoattach *skel;
int trigger_val = 100, trigger_ret;
size_t malloc_sz = 1;
char *mem;
skel = test_uprobe_autoattach__open_and_load();
if (!ASSERT_OK_PTR(skel, "skel_open"))
return;
if (!ASSERT_OK(test_uprobe_autoattach__attach(skel), "skel_atta... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/prog_tests/usdt.c | static void __always_inline f300(int x) { STAP_PROBE1(test, usdt_300, x); } | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/prog_tests/user_ringbuf.c |
static void drain_current_samples(void) { syscall(__NR_getpgid); } | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/prog_tests/user_ringbuf.c | static int
load_skel_create_ringbufs(struct user_ringbuf_success **skel_out,
struct ring_buffer **kern_ringbuf_out,
ring_buffer_sample_fn callback,
struct user_ring_buffer **user_ringbuf_out) {
struct user_ringbuf_success *skel;
struct ri... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/prog_tests/user_ringbuf.c | static void test_user_ringbuf_discards_properly_ignored(void) {
struct user_ringbuf_success *skel;
struct user_ring_buffer *ringbuf;
int err, num_discarded = 0;
__u64 *token;
err = load_skel_create_user_ringbuf(&skel, &ringbuf);
if (err)
return;
ASSERT_EQ(skel->bss->read, 0, "num_samples_read_before... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/prog_tests/user_ringbuf.c | static void test_user_ringbuf_loop(void) {
struct user_ringbuf_success *skel;
struct user_ring_buffer *ringbuf;
uint32_t total_samples = 8192;
uint32_t remaining_samples = total_samples;
int err;
BUILD_BUG_ON(total_samples <= c_max_entries);
err = load_skel_create_user_ringbuf(&skel, &ringbuf);
if (err... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/prog_tests/user_ringbuf.c |
static int handle_kernel_msg(void *ctx, void *data, size_t len) {
struct user_ringbuf_success *skel = ctx;
struct test_msg *msg = data;
switch (msg->msg_op) {
case TEST_MSG_OP_INC64:
skel->bss->user_mutated += msg->operand_64;
return 0;
case TEST_MSG_OP_INC32:
skel->bss->user_mutated += msg->ope... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/prog_tests/user_ringbuf.c |
static void verify_fail(const char *prog_name, const char *expected_err_msg) {
LIBBPF_OPTS(bpf_object_open_opts, opts);
struct bpf_program *prog;
struct user_ringbuf_fail *skel;
int err;
opts.kernel_log_buf = obj_log_buf;
opts.kernel_log_size = log_buf_sz;
opts.kernel_log_level = 1;
skel = user_ringb... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/prog_tests/verify_pkcs7_sig.c |
static int populate_data_item_str(const char *tmp_dir, struct data *data_item) {
struct stat st;
char data_template[] = "/tmp/dataXXXXXX";
char path[PATH_MAX];
int ret, fd, child_status, child_pid;
data_item->data_len = 4;
memcpy(data_item->data, "test", data_item->data_len);
fd = mkstemp(data_template... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/prog_tests/xdp_adjust_tail.c | static void test_xdp_adjust_tail_shrink(void) {
const char *file = "./test_xdp_adjust_tail_shrink.bpf.o";
__u32 expect_sz;
struct bpf_object *obj;
int err, prog_fd;
char buf[128];
LIBBPF_OPTS(bpf_test_run_opts, topts, .data_in = &pkt_v4,
.data_size_in = sizeof(pkt_v4), .data_out = buf,
... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/prog_tests/xdp_adjust_tail.c |
void test_xdp_adjust_tail(void) {
if (test__start_subtest("xdp_adjust_tail_shrink"))
test_xdp_adjust_tail_shrink();
if (test__start_subtest("xdp_adjust_tail_grow"))
test_xdp_adjust_tail_grow();
if (test__start_subtest("xdp_adjust_tail_grow2"))
test_xdp_adjust_tail_grow2();
if (test__start_subtest("... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/prog_tests/xdp_bonding.c |
static int setns_by_name(char *name) {
int nsfd, err;
char nspath[PATH_MAX];
snprintf(nspath, sizeof(nspath), "%s/%s", "/var/run/netns", name);
nsfd = open(nspath, O_RDONLY | O_CLOEXEC);
if (nsfd < 0)
return -1;
err = setns(nsfd, CLONE_NEWNET);
close(nsfd);
return err;
} | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/prog_tests/xdp_bonding.c |
static void test_xdp_bonding_with_mode(struct skeletons *skeletons, int mode,
int xmit_policy) {
int bond1_rx;
if (bonding_setup(skeletons, mode, xmit_policy, BOND_BOTH_AND_ATTACH))
goto out;
if (send_udp_packets(xmit_policy != BOND_XMIT_POLICY_LAYER34))
goto out;... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/prog_tests/xdp_bonding.c |
static int libbpf_debug_print(enum libbpf_print_level level, const char *format,
va_list args) {
if (level != LIBBPF_WARN)
vprintf(format, args);
return 0;
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/prog_tests/xdp_bpf2bpf.c |
static void on_sample(void *ctx, int cpu, void *data, __u32 size) {
struct meta *meta = (struct meta *)data;
struct ipv4_packet *trace_pkt_v4 = data + sizeof(*meta);
unsigned char *raw_pkt = data + sizeof(*meta);
struct test_ctx_s *tst_ctx = ctx;
ASSERT_GE(size, sizeof(pkt_v4) + sizeof(*meta), "check_size")... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/prog_tests/xdp_bpf2bpf.c | static void run_xdp_bpf2bpf_pkt_size(int pkt_fd, struct perf_buffer *pb,
struct test_xdp_bpf2bpf *ftrace_skel,
int pkt_size) {
__u8 *buf, *buf_in;
int err;
LIBBPF_OPTS(bpf_test_run_opts, topts);
if (!ASSERT_LE(pkt_size, BUF_SZ, "pkt_size... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/prog_tests/xdp_cpumap_attach.c | static void test_xdp_with_cpumap_frags_helpers(void) {
struct test_xdp_with_cpumap_frags_helpers *skel;
struct bpf_prog_info info = {};
__u32 len = sizeof(info);
struct bpf_cpumap_val val = {
.qsize = 192,
};
int err, frags_prog_fd, map_fd;
__u32 idx = 0;
skel = test_xdp_with_cpumap_frags_helpers... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/prog_tests/xdp_cpumap_attach.c |
void serial_test_xdp_cpumap_attach(void) {
if (test__start_subtest("CPUMAP with programs in entries"))
test_xdp_with_cpumap_helpers();
if (test__start_subtest("CPUMAP with frags programs in entries"))
test_xdp_with_cpumap_frags_helpers();
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/prog_tests/xdp_devmap_attach.c |
void serial_test_xdp_devmap_attach(void) {
if (test__start_subtest("DEVMAP with programs in entries"))
test_xdp_with_devmap_helpers();
if (test__start_subtest("DEVMAP with frags programs in entries"))
test_xdp_with_devmap_frags_helpers();
if (test__start_subtest("Verifier check of DEVMAP programs"))
... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/prog_tests/xdp_do_redirect.c | static int attach_tc_prog(struct bpf_tc_hook *hook, int fd) {
DECLARE_LIBBPF_OPTS(bpf_tc_opts, opts, .handle = 1, .priority = 1,
.prog_fd = fd);
int ret;
ret = bpf_tc_hook_create(hook);
if (!ASSERT_OK(ret, "create tc hook"))
return ret;
ret = bpf_tc_attach(hook, &opts);
if (!ASSE... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/prog_tests/xdp_do_redirect.c | static void test_max_pkt_size(int fd) {
char data[MAX_PKT_SIZE + 1] = {};
int err;
DECLARE_LIBBPF_OPTS(bpf_test_run_opts, opts, .data_in = &data,
.data_size_in = MAX_PKT_SIZE,
.flags = BPF_F_TEST_XDP_LIVE_FRAMES, .repeat = 1, );
err = bpf_prog_test_run_opts(fd, &opts)... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/prog_tests/xdp_perf.c |
void test_xdp_perf(void) {
const char *file = "./xdp_dummy.bpf.o";
struct bpf_object *obj;
char in[128], out[128];
int err, prog_fd;
LIBBPF_OPTS(bpf_test_run_opts, topts, .data_in = in,
.data_size_in = sizeof(in), .data_out = out,
.data_size_out = sizeof(out), .repeat = 1000000, )... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/prog_tests/xfrm_info.c |
static void cleanup(void) {
SYS_NOFAIL("test -f /var/run/netns/" NS0 " && ip netns delete " NS0);
SYS_NOFAIL("test -f /var/run/netns/" NS1 " && ip netns delete " NS1);
SYS_NOFAIL("test -f /var/run/netns/" NS2 " && ip netns delete " NS2);
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/prog_tests/xfrm_info.c |
static int setup_xfrm_tunnel(const char *ns_a, const char *ns_b,
const char *ipv4_a, const char *ipv4_b,
int if_id_a, int if_id_b) {
return setup_xfrm_tunnel_ns(ns_a, ipv4_a, ipv4_b, if_id_a) ||
setup_xfrm_tunnel_ns(ns_b, ipv4_b, ipv4_a, if_id_b);
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/prog_tests/xfrm_info.c |
static struct rtattr *rtattr_add(struct nlmsghdr *nh, unsigned short type,
unsigned short len) {
struct rtattr *rta =
(struct rtattr *)((uint8_t *)nh + RTA_ALIGN(nh->nlmsg_len));
rta->rta_type = type;
rta->rta_len = RTA_LENGTH(len);
nh->nlmsg_len = RTA_ALIGN(nh->nlmsg_len... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/prog_tests/xfrm_info.c |
static struct rtattr *rtattr_add_str(struct nlmsghdr *nh, unsigned short type,
const char *s) {
struct rtattr *rta = rtattr_add(nh, type, strlen(s));
memcpy(RTA_DATA(rta), s, strlen(s));
return rta;
} | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/prog_tests/xfrm_info.c |
static int test_xfrm_ping(struct xfrm_info *skel, u32 if_id) {
skel->bss->req_if_id = if_id;
SYS("ping -i 0.01 -c 3 -w 10 -q 192.168.1.200 > /dev/null");
if (!ASSERT_EQ(skel->bss->resp_if_id, if_id, "if_id"))
goto fail;
return 0;
fail:
return -1;
} | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/prog_tests/xfrm_info.c |
void test_xfrm_info(void) {
cleanup();
if (!ASSERT_OK(config_underlay(), "config_underlay"))
goto done;
if (!ASSERT_OK(config_overlay(), "config_overlay"))
goto done;
if (test__start_subtest("xfrm_info"))
_test_xfrm_info();
done:
cleanup();
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/task_local_storage_helpers.h |
static inline int sys_pidfd_open(pid_t pid, unsigned int flags) {
return syscall(__NR_pidfd_open, pid, flags);
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_flow_dissector.c |
static void util_printaddr(const char *msg, struct sockaddr *addr) {
unsigned long off = 0;
char nbuf[INET6_ADDRSTRLEN];
switch (addr->sa_family) {
case PF_INET:
off = __builtin_offsetof(struct sockaddr_in, sin_addr);
break;
case PF_INET6:
off = __builtin_offsetof(struct sockaddr_in6, sin6_addr)... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_flow_dissector.c |
static void build_ipv4_header(void *header, uint8_t proto, uint32_t src,
uint32_t dst, int payload_len, uint8_t tos) {
struct iphdr *iph = header;
iph->ihl = 5;
iph->version = 4;
iph->tos = tos;
iph->ttl = 8;
iph->tot_len = htons(sizeof(*iph) + payload_len);
iph->id = htons... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_flow_dissector.c |
static void build_ipv6_header(void *header, uint8_t proto,
struct sockaddr_in6 *src,
struct sockaddr_in6 *dst, int payload_len,
uint8_t dsfield) {
struct ipv6hdr *ip6h = header;
ip6h->version = 6;
ip6h->payload_len = htons... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_flow_dissector.c |
static int l3_length(int family) {
if (family == AF_INET)
return sizeof(struct iphdr);
else
return sizeof(struct ipv6hdr);
} | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_flow_dissector.c |
static int do_poll(int fd, short events, int timeout) {
struct pollfd pfd;
int ret;
pfd.fd = fd;
pfd.events = events;
ret = poll(&pfd, 1, timeout);
if (ret == -1)
error(1, errno, "poll");
if (ret && !(pfd.revents & POLLIN))
error(1, errno, "poll: unexpected event 0x%x\n", pfd.revents);
retur... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_flow_dissector.c |
static void parse_addr(int family, void *addr, const char *optarg) {
int ret;
ret = inet_pton(family, optarg, addr);
if (ret == -1)
error(1, errno, "inet_pton");
if (ret == 0)
error(1, 0, "inet_pton: bad string");
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_flow_dissector.c |
static void parse_addr6(struct sockaddr_in6 *addr, const char *optarg) {
parse_addr(AF_INET6, &addr->sin6_addr, optarg);
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_flow_dissector.c |
static int parse_protocol_family(const char *filepath, const char *optarg) {
if (!strcmp(optarg, "4"))
return PF_INET;
if (!strcmp(optarg, "6"))
return PF_INET6;
usage(filepath);
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_lpm_map.c | static struct tlpm_node *tlpm_match(struct tlpm_node *list, const uint8_t *key,
size_t n_bits) {
struct tlpm_node *best = NULL;
size_t i;
for (; list; list = list->next) {
for (i = 0; i < n_bits && i < list->n_bits; ++i) {
if ((key[i / 8] & (1 << (7 - i % 8))) !=
... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_lpm_map.c | static void test_lpm_multi_thread(void) {
LIBBPF_OPTS(bpf_map_create_opts, opts, .map_flags = BPF_F_NO_PREALLOC);
struct lpm_mt_test_info info[4];
size_t key_size, value_size;
pthread_t thread_id[4];
int i, map_fd;
void *ret;
value_size = sizeof(__u32);
key_size = sizeof(struct bpf_lpm_trie_key) + valu... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_lru_map.c |
static int map_subset(int map0, int map1) {
unsigned long long next_key = 0;
unsigned long long value0[nr_cpus], value1[nr_cpus];
int ret;
while (!bpf_map_get_next_key(map1, &next_key, &next_key)) {
assert(!bpf_map_lookup_elem(map1, &next_key, value1));
ret = bpf_map_lookup_elem(map0, &next_key, value... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_lru_map.c |
static int sched_next_online(int pid, int *next_to_try) {
cpu_set_t cpuset;
int next = *next_to_try;
int ret = -1;
while (next < nr_cpus) {
CPU_ZERO(&cpuset);
CPU_SET(next++, &cpuset);
if (!sched_setaffinity(pid, sizeof(cpuset), &cpuset)) {
ret = 0;
break;
}
}
*next_to_try = n... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_lru_map.c | static void test_lru_sanity4(int map_type, int map_flags,
unsigned int tgt_free) {
int lru_map_fd, expected_map_fd;
unsigned long long key, value[nr_cpus];
unsigned long long end_key;
int next_cpu = 0;
printf("%s (map_type:%d map_flags:0x%X): ", __func__, map_type, map_flags);
... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_lru_map.c | int main(int argc, char **argv) {
int map_types[] = {BPF_MAP_TYPE_LRU_HASH, BPF_MAP_TYPE_LRU_PERCPU_HASH};
int map_flags[] = {0, BPF_F_NO_COMMON_LRU};
int t, f;
setbuf(stdout, NULL);
nr_cpus = bpf_num_possible_cpus();
assert(nr_cpus != -1);
printf("nr_cpus:%d\n\n", nr_cpus);
libbpf_set_strict_mode(LI... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_maps.c | static int helper_fill_hashmap(int max_entries) {
int i, fd, ret;
long long key, value[VALUE_SIZE] = {};
fd = bpf_map_create(BPF_MAP_TYPE_HASH, NULL, sizeof(key), sizeof(value),
max_entries, &map_opts);
CHECK(fd < 0, "failed to create hashmap", "err: %s, flags: 0x%x\n",
strerror(e... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_maps.c |
static void test_hashmap_walk(unsigned int task, void *data) {
int fd, i, max_entries = 10000;
long long key, value[VALUE_SIZE], next_key;
bool next_key_valid = true;
fd = helper_fill_hashmap(max_entries);
for (i = 0; bpf_map_get_next_key(fd, !i ? NULL : &key, &next_key) == 0; i++) {
key = next_key;
... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_maps.c | static void test_map_large(void) {
struct bigkey {
int a;
char b[4096];
long long c;
} key;
int fd, i, value;
fd = bpf_map_create(BPF_MAP_TYPE_HASH, NULL, sizeof(key), sizeof(value),
MAP_SIZE, &map_opts);
if (fd < 0) {
printf("Failed to create large map '%s'!\n", strerr... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_maps.c |
static void __run_parallel(unsigned int tasks,
void (*fn)(unsigned int task, void *data),
void *data) {
pid_t pid[tasks];
int i;
fflush(stdout);
for (i = 0; i < tasks; i++) {
pid[i] = fork();
if (pid[i] == 0) {
fn(i, data);
exit(0);
... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_maps.c |
static void test_map_stress(void) {
run_parallel(100, test_hashmap_walk, NULL);
run_parallel(100, test_hashmap, NULL);
run_parallel(100, test_hashmap_percpu, NULL);
run_parallel(100, test_hashmap_sizes, NULL);
run_parallel(100, test_arraymap, NULL);
run_parallel(100, test_arraymap_percpu, NULL);
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_maps.c | static void test_map_parallel(void) {
int i, fd, key = 0, value = 0, j = 0;
int data[2];
fd = bpf_map_create(BPF_MAP_TYPE_HASH, NULL, sizeof(key), sizeof(value),
MAP_SIZE, &map_opts);
if (fd < 0) {
printf("Failed to create map for parallel test '%s'!\n", strerror(errno));
exit(1);... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_maps.c | static void test_map_rdonly(void) {
int fd, key = 0, value = 0;
__u32 old_flags;
old_flags = map_opts.map_flags;
map_opts.map_flags |= BPF_F_RDONLY;
fd = bpf_map_create(BPF_MAP_TYPE_HASH, NULL, sizeof(key), sizeof(value),
MAP_SIZE, &map_opts);
map_opts.map_flags = old_flags;
if (fd ... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_maps.c | static void test_map_wronly_hash(void) {
int fd, key = 0, value = 0;
__u32 old_flags;
old_flags = map_opts.map_flags;
map_opts.map_flags |= BPF_F_WRONLY;
fd = bpf_map_create(BPF_MAP_TYPE_HASH, NULL, sizeof(key), sizeof(value),
MAP_SIZE, &map_opts);
map_opts.map_flags = old_flags;
if... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_maps.c |
static void test_map_wronly(void) {
test_map_wronly_hash();
test_map_wronly_stack_or_queue(BPF_MAP_TYPE_STACK);
test_map_wronly_stack_or_queue(BPF_MAP_TYPE_QUEUE);
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_maps.c |
int main(void) {
srand(time(NULL));
libbpf_set_strict_mode(LIBBPF_STRICT_ALL);
map_opts.map_flags = 0;
run_all_tests();
map_opts.map_flags = BPF_F_NO_PREALLOC;
run_all_tests();
#define DEFINE_TEST(name) test_##name();
#include <map_tests/tests.h>
#undef DEFINE_TEST
printf("test_maps: OK, %d SKIPPED\... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_progs.c | static void stdio_restore_cleanup(void) {
#ifdef __GLIBC__
if (verbose() && env.worker_id == -1) {
return;
}
fflush(stdout);
if (env.subtest_state) {
fclose(env.subtest_state->stdout);
env.subtest_state->stdout = NULL;
stdout = env.test_state->stdout;
stderr = env.test_state->stdout;
} ... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_progs.c |
static char *test_result(bool failed, bool skipped) {
return failed ? "FAIL" : (skipped ? "SKIP" : "OK");
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_progs.c |
bool test__start_subtest(const char *subtest_name) {
struct prog_test_def *test = env.test;
struct test_state *state = env.test_state;
struct subtest_state *subtest_state;
size_t sub_state_size = sizeof(*subtest_state);
if (env.subtest_state)
test__end_subtest();
state->subtest_num++;
state->subtes... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_progs.c |
void test__skip(void) {
if (env.subtest_state)
env.subtest_state->skipped = true;
else
env.test_state->skip_cnt++;
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_progs.c |
void test__fail(void) {
if (env.subtest_state)
env.subtest_state->error_cnt++;
else
env.test_state->error_cnt++;
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_progs.c |
int extract_build_id(char *build_id, size_t size) {
FILE *fp;
char *line = NULL;
size_t len = 0;
fp = popen("readelf -n ./urandom_read | grep 'Build ID'", "r");
if (fp == NULL)
return -1;
if (getline(&line, &len, fp) == -1)
goto err;
pclose(fp);
if (len > size)
len = size;
memcpy(build... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_progs.c | int kern_sync_rcu(void) {
return syscall(__NR_membarrier, MEMBARRIER_CMD_SHARED, 0, 0);
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_progs.c |
static int libbpf_print_fn(enum libbpf_print_level level, const char *format,
va_list args) {
if (env.verbosity < VERBOSE_VERY && level == LIBBPF_DEBUG)
return 0;
vfprintf(stdout, format, args);
return 0;
} | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_progs.c |
static void free_test_filter_set(const struct test_filter_set *set) {
int i, j;
if (!set)
return;
for (i = 0; i < set->cnt; i++) {
free((void *)set->tests[i].name);
for (j = 0; j < set->tests[i].subtest_cnt; j++)
free((void *)set->tests[i].subtests[j]);
free((void *)set->tests[i].subtest... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_progs.c |
int trigger_module_test_read(int read_sz) {
int fd, err;
fd = open(BPF_TESTMOD_TEST_FILE, O_RDONLY);
err = -errno;
if (!ASSERT_GE(fd, 0, "testmod_file_open"))
return err;
read(fd, NULL, read_sz);
close(fd);
return 0;
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_progs.c |
static inline const char *str_msg(const struct msg *msg, char *buf) {
switch (msg->type) {
case MSG_DO_TEST:
sprintf(buf, "MSG_DO_TEST %d", msg->do_test.num);
break;
case MSG_TEST_DONE:
sprintf(buf, "MSG_TEST_DONE %d (log: %d)", msg->test_done.num,
msg->test_done.have_log);
break;
c... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_progs.c |
static int send_message(int sock, const struct msg *msg) {
char buf[256];
if (env.debug)
fprintf(stderr, "Sending msg: %s\n", str_msg(msg, buf));
return send(sock, msg, sizeof(*msg), 0);
} | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_progs.c | static void run_one_test(int test_num) {
struct prog_test_def *test = &prog_test_defs[test_num];
struct test_state *state = &test_states[test_num];
env.test = test;
env.test_state = state;
stdio_hijack(&state->log_buf, &state->log_cnt);
if (test->run_test)
test->run_test();
else if (test->run_seria... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_progs.c | static int worker_main_send_subtests(int sock, struct test_state *state) {
int i, result = 0;
struct msg msg;
struct subtest_state *subtest_state;
memset(&msg, 0, sizeof(msg));
msg.type = MSG_SUBTEST_DONE;
for (i = 0; i < state->subtest_num; i++) {
subtest_state = &state->subtest_states[i];
msg.s... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_skb_cgroup_id_user.c |
static int mk_dst_addr(const char *ip, const char *iface,
struct sockaddr_in6 *dst) {
memset(dst, 0, sizeof(*dst));
dst->sin6_family = AF_INET6;
dst->sin6_port = htons(1025);
if (inet_pton(AF_INET6, ip, &dst->sin6_addr) != 1) {
log_err("Invalid IPv6: %s", ip);
return -1;
}
... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_sock.c |
static int load_sock_prog(const struct bpf_insn *prog,
enum bpf_attach_type attach_type) {
LIBBPF_OPTS(bpf_prog_load_opts, opts);
int ret, insn_cnt;
insn_cnt = probe_prog_length(prog);
opts.expected_attach_type = attach_type;
opts.log_buf = bpf_log_buf;
opts.log_size = BPF_LOG_B... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_sock.c | static int bind_sock(int domain, int type, const char *ip, unsigned short port,
unsigned short port_retry) {
struct sockaddr_storage addr;
struct sockaddr_in6 *addr6;
struct sockaddr_in *addr4;
int sockfd = -1;
socklen_t len;
int res = SUCCESS;
sockfd = socket(domain, type, 0);
if ... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_sockmap.c |
static int test_start_subtest(const struct _test *t,
struct sockmap_options *o) {
env.type = o->map;
env.subtest = t->title;
env.prepend = o->prepend;
env.test_num++;
env.subtest_num = 0;
env.fail_last = env.fail_cnt;
test_reset();
return 0;
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_sockmap.c |
static void test_print_results(void) {
fprintf(stdout, "Pass: %d Fail: %d\n", env.succ_cnt, env.fail_cnt);
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_sockmap.c |
static int msg_loop_sendpage(int fd, int iov_length, int cnt,
struct msg_stats *s, struct sockmap_options *opt) {
bool drop = opt->drop_expected;
unsigned char k = 0;
FILE *file;
int i, fp;
file = tmpfile();
if (!file) {
perror("create file for sendpage");
return 1;
... | [
1,
0
] |
Chromium | third_party/libwebp/src/dsp/enc_sse2.c |
static WEBP_INLINE void DC8uvNoLeft_SSE2(uint8_t *dst, const uint8_t *top) {
const __m128i zero = _mm_setzero_si128();
const __m128i top_values = _mm_loadl_epi64((const __m128i *)top);
const __m128i sum = _mm_sad_epu8(top_values, zero);
const int DC = _mm_cvtsi128_si32(sum) + 4;
Put8x8uv_SSE2(DC >> 3, dst);
... | [
0,
0
] |
Chromium | third_party/libwebp/src/dsp/enc_sse2.c | static WEBP_INLINE void DC8uvMode_SSE2(uint8_t *dst, const uint8_t *left,
const uint8_t *top) {
if (top != NULL) {
if (left != NULL) {
DC8uv_SSE2(dst, left, top);
} else { // top, but no left
DC8uvNoLeft_SSE2(dst, top);
}
} else if (left != NULL) { // l... | [
0,
0
] |
Chromium | third_party/libwebp/src/dsp/enc_sse2.c |
static WEBP_INLINE void DC16NoLeft_SSE2(uint8_t *dst, const uint8_t *top) {
const __m128i top_row = _mm_load_si128((const __m128i *)top);
const int DC = VP8HorizontalAdd8b(&top_row) + 8;
Put16_SSE2(DC >> 4, dst);
} | [
0,
0
] |
Chromium | third_party/libwebp/src/dsp/enc_sse2.c |
static WEBP_INLINE void DC16NoTopLeft_SSE2(uint8_t *dst) {
Put16_SSE2(0x80, dst);
} | [
0,
0
] |
Chromium | third_party/libwebp/src/dsp/enc_sse2.c | static void IntraChromaPreds_SSE2(uint8_t *dst, const uint8_t *left,
const uint8_t *top) {
DC8uvMode_SSE2(C8DC8 + dst, left, top);
VerticalPred_SSE2(C8VE8 + dst, top, 8);
HorizontalPred_SSE2(C8HE8 + dst, left, 8);
TrueMotion_SSE2(C8TM8 + dst, left, top, 8);
// V block
dst ... | [
1,
0
] |
Chromium | third_party/libwebp/src/dsp/enc_sse2.c |
static WEBP_INLINE int SSE_16xN_SSE2(const uint8_t *a, const uint8_t *b,
int num_pairs) {
__m128i sum = _mm_setzero_si128();
int32_t tmp[4];
int i;
for (i = 0; i < num_pairs; ++i) {
const __m128i a0 = _mm_loadu_si128((const __m128i *)&a[BPS * 0]);
const __m128i b0 ... | [
0,
0
] |
Chromium | third_party/libwebp/src/dsp/enc_sse2.c |
static int SSE16x8_SSE2(const uint8_t *a, const uint8_t *b) {
return SSE_16xN_SSE2(a, b, 4);
}
#define LOAD_8x16b(ptr) \
_mm_unpacklo_epi8(_mm_loadl_epi64((const __m128i *)(ptr)), zero) | [
0,
0
] |
Chromium | third_party/libwebp/src/dsp/enc_sse41.c | WEBP_TSAN_IGNORE_FUNCTION void VP8EncDspInitSSE41(void) {
VP8CollectHistogram = CollectHistogram_SSE41;
VP8EncQuantizeBlock = QuantizeBlock_SSE41;
VP8EncQuantize2Blocks = Quantize2Blocks_SSE41;
VP8EncQuantizeBlockWHT = QuantizeBlockWHT_SSE41;
VP8TDisto4x4 = Disto4x4_SSE41;
VP8TDisto16x16 = Disto16x16_SSE41;... | [
0,
0
] |
Chromium | third_party/libwebp/src/dsp/filters.c | static void HorizontalFilter_C(const uint8_t *data, int width, int height,
int stride, uint8_t *filtered_data) {
DoHorizontalFilter_C(data, width, height, stride, 0, height, 0,
filtered_data);
} | [
0,
0
] |
Chromium | third_party/libwebp/src/dsp/filters.c |
static void VerticalFilter_C(const uint8_t *data, int width, int height,
int stride, uint8_t *filtered_data) {
DoVerticalFilter_C(data, width, height, stride, 0, height, 0, filtered_data);
} | [
0,
0
] |
Chromium | third_party/libwebp/src/dsp/filters.c | static void GradientUnfilter_C(const uint8_t *prev, const uint8_t *in,
uint8_t *out, int width) {
if (prev == NULL) {
HorizontalUnfilter_C(NULL, in, out, width);
} else {
uint8_t top = prev[0], top_left = top, left = top;
int i;
for (i = 0; i < width; ++i) {
top ... | [
0,
0
] |
Chromium | third_party/libwebp/src/dsp/filters_mips_dsp_r2.c | static void HorizontalUnfilter_MIPSdspR2(const uint8_t *prev, const uint8_t *in,
uint8_t *out, int width) {
out[0] = in[0] + (prev == NULL ? 0 : prev[0]);
DO_PREDICT_LINE(in + 1, out + 1, width - 1, 1);
} | [
0,
0
] |
Chromium | third_party/libwebp/src/dsp/filters_msa.c | static void HorizontalFilter_MSA(const uint8_t *data, int width, int height,
int stride, uint8_t *filtered_data) {
const uint8_t *preds = data;
const uint8_t *in = data;
uint8_t *out = filtered_data;
int row = 1;
SANITY_CHECK(in, out);
out[0] = in[0];
PredictLineInverse0(... | [
0,
0
] |
Chromium | third_party/libwebp/src/dsp/filters_msa.c | static void GradientFilter_MSA(const uint8_t *data, int width, int height,
int stride, uint8_t *filtered_data) {
const uint8_t *in = data;
const uint8_t *preds = data;
uint8_t *out = filtered_data;
int row = 1;
SANITY_CHECK(in, out);
out[0] = in[0];
PredictLineInverse0(in +... | [
0,
0
] |
Chromium | third_party/libwebp/src/dsp/filters_neon.c | static WEBP_INLINE void DoHorizontalFilter_NEON(const uint8_t *in, int width,
int height, int stride, int row,
int num_rows, uint8_t *out) {
const size_t start_offset = row * stride;
const int last_row = row + num_rows;
... | [
0,
0
] |
Chromium | third_party/libwebp/src/dsp/filters_neon.c |
static void GradientPredictDirect_NEON(const uint8_t *const row,
const uint8_t *const top,
uint8_t *const out, int length) {
int i;
for (i = 0; i + 8 <= length; i += 8) {
const uint8x8_t A = vld1_u8(&row[i - 1]);
const uint8x8_t ... | [
1,
0
] |
Chromium | third_party/libwebp/src/dsp/filters_neon.c |
static void GradientFilter_NEON(const uint8_t *data, int width, int height,
int stride, uint8_t *filtered_data) {
DoGradientFilter_NEON(data, width, height, stride, 0, height, filtered_data);
}
#undef SANITY_CHECK | [
0,
0
] |
Chromium | third_party/libwebp/src/dsp/filters_neon.c | static void VerticalUnfilter_NEON(const uint8_t *prev, const uint8_t *in,
uint8_t *out, int width) {
if (prev == NULL) {
HorizontalUnfilter_NEON(NULL, in, out, width);
} else {
int i;
assert(width >= 0);
for (i = 0; i + 16 <= width; i += 16) {
const uint8x16_t... | [
1,
0
] |
Chromium | third_party/libwebp/src/dsp/filters_sse2.c | static void PredictLineLeft_SSE2(const uint8_t *src, uint8_t *dst, int length) {
int i;
const int max_pos = length & ~31;
assert(length >= 0);
for (i = 0; i < max_pos; i += 32) {
const __m128i A0 = _mm_loadu_si128((const __m128i *)(src + i + 0));
const __m128i B0 = _mm_loadu_si128((const __m128i *)(src ... | [
1,
0
] |
Chromium | third_party/libwebp/src/dsp/filters_sse2.c | static void HorizontalUnfilter_SSE2(const uint8_t *prev, const uint8_t *in,
uint8_t *out, int width) {
int i;
__m128i last;
out[0] = (uint8_t)(in[0] + (prev == NULL ? 0 : prev[0]));
if (width <= 1)
return;
last = _mm_set_epi32(0, 0, 0, out[0]);
for (i = 1; i + 8 <= wi... | [
1,
0
] |
Chromium | third_party/libwebp/src/dsp/filters_sse2.c |
static void VerticalUnfilter_SSE2(const uint8_t *prev, const uint8_t *in,
uint8_t *out, int width) {
if (prev == NULL) {
HorizontalUnfilter_SSE2(NULL, in, out, width);
} else {
int i;
const int max_pos = width & ~31;
assert(width >= 0);
for (i = 0; i < max_pos;... | [
0,
0
] |
Chromium | third_party/libwebp/src/dsp/filters_sse2.c | static void GradientUnfilter_SSE2(const uint8_t *prev, const uint8_t *in,
uint8_t *out, int width) {
if (prev == NULL) {
HorizontalUnfilter_SSE2(NULL, in, out, width);
} else {
out[0] = (uint8_t)(in[0] + prev[0]);
GradientPredictInverse_SSE2(in + 1, prev + 1, out + 1, w... | [
0,
0
] |
Chromium | third_party/libwebp/src/dsp/filters_sse2.c | WEBP_TSAN_IGNORE_FUNCTION void VP8FiltersInitSSE2(void) {
WebPUnfilters[WEBP_FILTER_HORIZONTAL] = HorizontalUnfilter_SSE2;
// WebPUnfilters[WEBP_FILTER_VERTICAL] = VerticalUnfilter_SSE2;
(void)VerticalUnfilter_SSE2;
WebPUnfilters[WEBP_FILTER_GRADIENT] = GradientUnfilter_SSE2;
WebPFilters[WEBP_FILTER_HORIZON... | [
0,
0
] |
Chromium | third_party/libwebp/src/dsp/lossless.c | static WEBP_INLINE uint32_t Clip255(uint32_t a) {
if (a < 256) {
return a;
}
// return 255, when a is positive.
return ~a >> 24;
} | [
0,
0
] |
Chromium | third_party/libwebp/src/dsp/lossless.c |
static WEBP_INLINE uint32_t Select(uint32_t a, uint32_t b, uint32_t c) {
const int pa_minus_pb =
Sub3((a >> 24), (b >> 24), (c >> 24)) +
Sub3((a >> 16) & 0xff, (b >> 16) & 0xff, (c >> 16) & 0xff) +
Sub3((a >> 8) & 0xff, (b >> 8) & 0xff, (c >> 8) & 0xff) +
Sub3((a) & 0xff, (b) & 0xff, (c) & 0x... | [
0,
0
] |
Chromium | third_party/libwebp/src/dsp/lossless.c | static uint32_t Predictor2_C(uint32_t left, const uint32_t *const top) {
(void)left;
return top[0];
} | [
0,
0
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.