Projectname large_stringclasses 15
values | Filepath large_stringlengths 4 106 ⌀ | Function large_stringlengths 11 3.45k | Label list |
|---|---|---|---|
Chromium | third_party/opus/src/silk/float/regularize_correlations_FLP.c | void silk_regularize_correlations_FLP(
silk_float *XX, silk_float *xx, /* I/O Correlation values */
const silk_float noise, /* I Noise energy to add */
const opus_int D /* I Dimension of XX */
) {
opus_int i;
for (i = 0; i < D; i++) {
matrix_ptr(&X... | [
0,
0
] |
Chromium | third_party/opus/src/silk/float/scale_copy_vector_FLP.c | void silk_scale_copy_vector_FLP(silk_float *data_out, const silk_float *data_in,
silk_float gain, opus_int dataSize) {
opus_int i, dataSize4;
dataSize4 = dataSize & 0xFFFC;
for (i = 0; i < dataSize4; i += 4) {
data_out[i + 0] = gain * data_in[i + 0];
data_out[i + 1] = gain... | [
1,
0
] |
Chromium | third_party/opus/src/silk/float/warped_autocorrelation_FLP.c | void silk_warped_autocorrelation_FLP(
silk_float *corr,
const silk_float *input, /* I Input data to correlate */
const silk_float warping, /* I Warping coefficient */
const opus_int length, /* I Length of input */
const opus_int order /* I Correlation order (even) ... | [
1,
0
] |
Chromium | third_party/opus/src/silk/init_encoder.c | opus_int silk_init_encoder(
silk_encoder_state_Fxx *psEnc, /* I/O Pointer to Silk FIX encoder state */
int arch /* I Run-time architecture */
) {
opus_int ret = 0;
/* Clear the entire encoder state */
silk_memset(psEnc, 0, sizeof(silk_encoder_state_Fxx));
... | [
1,
0
] |
Chromium | third_party/opus/src/silk/inner_prod_aligned.c | opus_int32 silk_inner_prod_aligned_scale(
const opus_int16 *const inVec1,
const opus_int16 *const inVec2, /* I input vector 2 */
const opus_int scale, /* I number of bits to shift */
const opus_int len /* I vector lengths */
) {
opus_int i;
opus... | [
0,
0
] |
Chromium | third_party/opus/src/silk/log2lin.c | opus_int32 silk_log2lin(const opus_int32 inLog_Q7) {
opus_int32 out, frac_Q7;
if (inLog_Q7 < 0) {
return 0;
} else if (inLog_Q7 >= 3967) {
return silk_int32_MAX;
}
out = silk_LSHIFT(1, silk_RSHIFT(inLog_Q7, 7));
frac_Q7 = inLog_Q7 & 0x7F;
if (inLog_Q7 < 2048) {
/* Piece-wise parabolic approx... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_sockmap.c |
static inline float sentBps(struct msg_stats s) {
return s.bytes_sent / (s.end.tv_sec - s.start.tv_sec);
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_sockmap.c |
static inline float recvdBps(struct msg_stats s) {
return s.bytes_recvd / (s.end.tv_sec - s.start.tv_sec);
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_sockmap.c |
static char *test_to_str(int test) {
switch (test) {
case SENDMSG:
return "sendmsg";
case SENDPAGE:
return "sendpage";
}
return "unknown";
} | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_sockmap.c | static void append_str(char *dst, const char *src, size_t dst_cap) {
size_t avail = dst_cap - strlen(dst);
if (avail <= 1)
return;
strncat(dst, src, avail - 1); /* strncat() adds + 1 for zero byte */
} | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_sockmap.c |
static void test_exec(int cgrp, struct sockmap_options *opt) {
int type = strcmp(opt->map, BPF_SOCKMAP_FILENAME);
int err;
if (type == 0) {
test_start();
err = __test_exec(cgrp, SENDMSG, opt);
if (err)
test_fail();
} else {
test_start();
err = __test_exec(cgrp, SENDPAGE, opt);
if... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_sockmap.c | static void test_txmsg_pull(int cgrp, struct sockmap_options *opt) {
txmsg_start = 1;
txmsg_end = 2;
test_send(opt, cgrp);
/* Test >4k pull */
txmsg_start = 4096;
txmsg_end = 9182;
test_send_large(opt, cgrp);
/* Test pull + redirect */
txmsg_redir = 0;
txmsg_start = 1;
txmsg_end = 2;
test_sen... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_sockmap.c | static void test_txmsg_push(int cgrp, struct sockmap_options *opt) {
txmsg_start_push = 1;
txmsg_end_push = 1;
test_send(opt, cgrp);
/* Test push 4kB >4k */
txmsg_start_push = 4096;
txmsg_end_push = 4096;
test_send_large(opt, cgrp);
/* Test push + redirect */
txmsg_redir = 1;
txmsg_start_push = 1... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_sockmap.c |
static void test_txmsg_push_pop(int cgrp, struct sockmap_options *opt) {
txmsg_start_push = 1;
txmsg_end_push = 10;
txmsg_start_pop = 5;
txmsg_pop = 4;
test_send_large(opt, cgrp);
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_sockmap.c |
static int populate_progs(char *bpf_file) {
struct bpf_program *prog;
struct bpf_object *obj;
int i = 0;
long err;
obj = bpf_object__open(bpf_file);
err = libbpf_get_error(obj);
if (err) {
char err_buf[256];
libbpf_strerror(err, err_buf, sizeof(err_buf));
printf("Unable to load eBPF objects... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_sock_addr.c |
static int load_insns(const struct sock_addr_test *test,
const struct bpf_insn *insns, size_t insns_cnt) {
LIBBPF_OPTS(bpf_prog_load_opts, opts);
int ret;
opts.expected_attach_type = test->expected_attach_type;
opts.log_buf = bpf_log_buf;
opts.log_size = BPF_LOG_BUF_SIZE;
ret = bpf_... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_sock_addr.c |
static int bind6_prog_load(const struct sock_addr_test *test) {
return load_path(test, BIND6_PROG_PATH);
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_sock_addr.c |
static int connect6_prog_load(const struct sock_addr_test *test) {
return load_path(test, CONNECT6_PROG_PATH);
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_sock_addr.c |
static int sendmsg6_rw_v4mapped_prog_load(const struct sock_addr_test *test) {
return sendmsg6_rw_dst_asm_prog_load(test, SERV6_V4MAPPED_IP);
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_sock_addr.c |
static int sendmsg6_rw_wildcard_prog_load(const struct sock_addr_test *test) {
return sendmsg6_rw_dst_asm_prog_load(test, WILDCARD6_IP);
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_sock_addr.c | static int cmp_local_addr(int sock1, const struct sockaddr_storage *addr2) {
return cmp_sock_addr(getsockname, sock1, addr2, 1);
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_sock_addr.c | static int fastconnect_to_server(const struct sockaddr_storage *addr,
socklen_t addr_len) {
int sendmsg_err;
return sendmsg_to_server(SOCK_STREAM, addr, addr_len, 0, MSG_FASTOPEN,
&sendmsg_err);
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_sock_addr.c |
static int init_addrs(const struct sock_addr_test *test,
struct sockaddr_storage *requested_addr,
struct sockaddr_storage *expected_addr,
struct sockaddr_storage *expected_src_addr) {
socklen_t addr_len = sizeof(struct sockaddr_storage);
if (mk_soc... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_sysctl.c |
static int load_sysctl_prog_insns(struct sysctl_test *test,
const char *sysctl_path) {
struct bpf_insn *prog = test->insns;
LIBBPF_OPTS(bpf_prog_load_opts, opts);
int ret, insn_cnt;
insn_cnt = probe_prog_length(prog);
if (test->fixup_value_insn) {
char buf[128];
ss... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_sysctl.c |
static int load_sysctl_prog_file(struct sysctl_test *test) {
struct bpf_object *obj;
int prog_fd;
if (bpf_prog_test_load(test->prog_file, BPF_PROG_TYPE_CGROUP_SYSCTL, &obj,
&prog_fd)) {
if (test->result != LOAD_REJECT)
log_err(">>> Loading program (%s) error.\n", test->prog_fi... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_sysctl.c |
static int access_sysctl(const char *sysctl_path,
const struct sysctl_test *test) {
int err = 0;
int fd;
fd = open(sysctl_path, test->open_flags | O_CLOEXEC);
if (fd < 0)
return fd;
if (test->seek && lseek(fd, test->seek, SEEK_SET) == -1) {
log_err("lseek(%d) failed", test-... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_tag.c |
static int bpf_try_load_prog(int insns, int fd_map,
void (*bpf_filler)(unsigned int insns,
int fd_map)) {
int fd_prog;
bpf_filler(insns, fd_map);
fd_prog = bpf_test_load_program(BPF_PROG_TYPE_SCHED_CLS, prog, insns, "", 0,
... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_tag.c |
static void tag_from_alg(int insns, uint8_t *tag, uint32_t len) {
static const struct sockaddr_alg alg = {
.salg_family = AF_ALG,
.salg_type = "hash",
.salg_name = "sha1",
};
int fd_base, fd_alg, ret;
ssize_t size;
fd_base = socket(AF_ALG, SOCK_SEQPACKET, 0);
assert(fd_base > 0);
ret ... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_tcpnotify_user.c |
void tcp_notifier_poller(struct perf_buffer *pb) {
int err;
while (1) {
err = perf_buffer__poll(pb, 100);
if (err < 0 && err != -EINTR) {
printf("failed perf_buffer__poll: %d\n", err);
return;
}
}
} | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_tcp_hdr_options.h |
static inline unsigned int tcp_hdrlen(const struct tcphdr *th) {
return th->doff << 2;
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_verifier.c |
static void bpf_fill_rand_ld_dw(struct bpf_test *self) {
struct bpf_insn *insn = self->fill_insns;
uint64_t res = 0;
int i = 0;
insn[i++] = BPF_MOV32_IMM(BPF_REG_0, 0);
while (i < self->retval) {
uint64_t val = bpf_semi_rand_get();
struct bpf_insn tmp[2] = {BPF_LD_IMM64(BPF_REG_1, val)};
res ^=... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_verifier.c |
static int bpf_fill_torturous_jumps_insn_2(struct bpf_insn *insn) {
unsigned int len = 4100, jmp_off = 2048;
int i, j;
insn[0] = BPF_EMIT_CALL(BPF_FUNC_get_prandom_u32);
for (i = 1; i <= jmp_off; i++) {
insn[i] = BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, i, jmp_off);
}
insn[i++] = BPF_JMP_A(jmp_off);
for (; i... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_verifier.c |
static void update_map(int fd, int index) {
struct test_val value = {
.index = (6 + 1) * sizeof(int),
.foo[6] = 0xabcdef12,
};
assert(!bpf_map_update_elem(fd, &index, &value, 0));
} | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_verifier.c |
static int create_prog_dummy_simple(enum bpf_prog_type prog_type, int ret) {
struct bpf_insn prog[] = {
BPF_MOV64_IMM(BPF_REG_0, ret),
BPF_EXIT_INSN(),
};
return bpf_prog_load(prog_type, NULL, "GPL", prog, ARRAY_SIZE(prog), NULL);
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_verifier.c |
static int create_map_in_map(void) {
LIBBPF_OPTS(bpf_map_create_opts, opts);
int inner_map_fd, outer_map_fd;
inner_map_fd = bpf_map_create(BPF_MAP_TYPE_ARRAY, NULL, sizeof(int),
sizeof(int), 1, NULL);
if (inner_map_fd < 0) {
if (skip_unsupported_map(BPF_MAP_TYPE_ARRAY))
... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_verifier.c |
static int create_cgroup_storage(bool percpu) {
enum bpf_map_type type =
percpu ? BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE : BPF_MAP_TYPE_CGROUP_STORAGE;
int fd;
fd = bpf_map_create(type, NULL, sizeof(struct bpf_cgroup_storage_key),
TEST_DATA_LEN, 0, NULL);
if (fd < 0) {
if (skip_uns... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_verifier.c |
static int load_btf_spec(__u32 *types, int types_len, const char *strings,
int strings_len) {
struct btf_header hdr = {
.magic = BTF_MAGIC,
.version = BTF_VERSION,
.hdr_len = sizeof(struct btf_header),
.type_len = types_len,
.str_off = types_len,
.str_len ... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_verifier.c |
static int load_btf(void) {
return load_btf_spec(btf_raw_types, sizeof(btf_raw_types), btf_str_sec,
sizeof(btf_str_sec));
} | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_verifier.c |
static int create_sk_storage_map(void) {
LIBBPF_OPTS(bpf_map_create_opts, opts, .map_flags = BPF_F_NO_PREALLOC,
.btf_key_type_id = 1, .btf_value_type_id = 3, );
int fd, btf_fd;
btf_fd = load_btf();
if (btf_fd < 0)
return -1;
opts.btf_fd = btf_fd;
fd = bpf_map_create(BPF_MAP_TYPE_SK_STORA... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_verifier.c |
static int create_map_kptr(void) {
LIBBPF_OPTS(bpf_map_create_opts, opts, .btf_key_type_id = 1,
.btf_value_type_id = 14, );
int fd, btf_fd;
btf_fd = load_btf();
if (btf_fd < 0)
return -1;
opts.btf_fd = btf_fd;
fd = bpf_map_create(BPF_MAP_TYPE_ARRAY, "test_map", 4, 24, 1, &opts);
if (f... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_verifier.c | static int do_prog_test_run(int fd_prog, bool unpriv, uint32_t expected_val,
void *data, size_t size_data) {
__u8 tmp[TEST_DATA_LEN << 2];
__u32 size_tmp = sizeof(tmp);
int err, saved_errno;
LIBBPF_OPTS(bpf_test_run_opts, topts, .data_in = data,
.data_size_in = size_dat... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_verifier.c |
static bool is_skip_insn(struct bpf_insn *insn) {
struct bpf_insn skip_insn = SKIP_INSNS();
return memcmp(insn, &skip_insn, sizeof(skip_insn)) == 0;
} | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_verifier.c |
static int find_skip_insn_marker(struct bpf_insn *seq, int len) {
int i;
for (i = 0; i < len; ++i)
if (is_skip_insn(&seq[i]))
return i;
return -1;
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_verifier.c |
static void print_insn(struct bpf_insn *buf, int cnt) {
int i;
printf(" addr op d s off imm\n");
for (i = 0; i < cnt; ++i) {
struct bpf_insn *insn = &buf[i];
if (is_null_insn(insn))
break;
if (is_skip_insn(insn))
printf(" ...\n");
else
printf(" %04x: %02x %1x %x %04hx %0... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_verifier.c | int main(int argc, char **argv) {
unsigned int from = 0, to = ARRAY_SIZE(tests);
bool unpriv = !is_admin();
int arg = 1;
if (argc > 1 && strcmp(argv[1], "-v") == 0) {
arg++;
verbose = true;
verif_log_level = 1;
argc--;
}
if (argc > 1 && strcmp(argv[1], "-vv") == 0) {
arg++;
verbose ... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_verifier_log.c |
static inline __u64 ptr_to_u64(const void *ptr) {
return (__u64)(unsigned long)ptr;
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/test_verifier_log.c |
static void test_log_bad(char *log, size_t log_len, int log_level) {
int ret;
ret = load(log, log_len, log_level);
check_ret(ret, EINVAL);
if (log)
check_ones(log, LOG_SIZE, "verifier touched log with bad parameters\n");
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/trace_helpers.c |
int load_kallsyms_refresh(void) {
FILE *f;
char func[256], buf[256];
char symbol;
void *addr;
int i = 0;
sym_cnt = 0;
f = fopen("/proc/kallsyms", "r");
if (!f)
return -ENOENT;
while (fgets(buf, sizeof(buf), f)) {
if (sscanf(buf, "%p %c %s", &addr, &symbol, func) != 3)
break;
if (... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/trace_helpers.c | ssize_t get_uprobe_offset(const void *addr) {
size_t start, end, base;
char buf[256];
bool found = false;
FILE *f;
f = fopen("/proc/self/maps", "r");
if (!f)
return -errno;
while (fscanf(f, "%zx-%zx %s %zx %*[^\n]\n", &start, &end, buf, &base) == 4) {
if (buf[2] == 'x' && (uintptr_t)addr >= star... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/urandom_read.c | int main(int argc, char *argv[]) {
int fd = open("/dev/urandom", O_RDONLY);
int count = 4;
bool report_pid = false;
if (fd < 0)
return 1;
if (argc >= 2)
count = atoi(argv[1]);
if (argc >= 3) {
report_pid = true;
signal(SIGPIPE, handle_sigpipe);
}
/* report PID and wait for parent pro... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/urandom_read_aux.c | void urand_read_without_sema(int iter_num, int iter_cnt, int read_sz) {
STAP_PROBE3(urand, read_without_sema, iter_num, iter_cnt, read_sz);
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/urandom_read_lib1.c |
void urandlib_read_with_sema(int iter_num, int iter_cnt, int read_sz) {
STAP_PROBE3(urandlib, read_with_sema, iter_num, iter_cnt, read_sz);
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/veristat.c | static int libbpf_print_fn(enum libbpf_print_level level, const char *format,
va_list args) {
if (!env.verbose)
return 0;
if (level == LIBBPF_DEBUG)
return 0;
return vfprintf(stderr, format, args);
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/veristat.c | static bool should_process_file_prog(const char *filename,
const char *prog_name) {
struct filter *f;
int i, allow_cnt = 0;
for (i = 0; i < env.deny_filter_cnt; i++) {
f = &env.deny_filters[i];
if (f->kind != FILTER_NAME)
continue;
if (f->any_glob && glob_m... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/veristat.c |
static int parse_stat(const char *stat_name, struct stat_specs *specs) {
int id;
bool has_order = false, is_asc = false;
size_t len = strlen(stat_name);
enum stat_variant var;
if (specs->spec_cnt >= ARRAY_SIZE(specs->ids)) {
fprintf(stderr, "Can't specify more than %zd stats\n",
ARRAY_SIZE(s... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/veristat.c |
static int parse_stats(const char *stats_str, struct stat_specs *specs) {
char *input, *state = NULL, *next;
int err;
input = strdup(stats_str);
if (!input)
return -ENOMEM;
while ((next = strtok_r(state ? NULL : input, ",", &state))) {
err = parse_stat(next, specs);
if (err)
return err;
... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/veristat.c |
static void free_verif_stats(struct verif_stats *stats, size_t stat_cnt) {
int i;
if (!stats)
return;
for (i = 0; i < stat_cnt; i++) {
free(stats[i].file_name);
free(stats[i].prog_name);
}
free(stats);
} | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/veristat.c |
static int cmp_stat(const struct verif_stats *s1, const struct verif_stats *s2,
enum stat_id id, bool asc) {
int cmp = 0;
switch (id) {
case FILE_NAME:
cmp = strcmp(s1->file_name, s2->file_name);
break;
case PROG_NAME:
cmp = strcmp(s1->prog_name, s2->prog_name);
break;
ca... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/veristat.c | static int cmp_join_stats(const void *v1, const void *v2) {
const struct verif_stats_join *s1 = v1, *s2 = v2;
int i, cmp;
for (i = 0; i < env.sort_spec.spec_cnt; i++) {
cmp = cmp_join_stat(s1, s2, env.sort_spec.ids[i], env.sort_spec.variants[i],
env.sort_spec.asc[i]);
if (cmp != 0... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/veristat.c |
static void output_headers(enum resfmt fmt) {
const char *fmt_str;
int i, len;
for (i = 0; i < env.output_spec.spec_cnt; i++) {
int id = env.output_spec.ids[i];
int *max_len = &env.output_spec.lens[i];
switch (fmt) {
case RESFMT_TABLE_CALCLEN:
len = snprintf(NULL, 0, "%s", stat_defs[id].h... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/veristat.c | static void output_comp_headers(enum resfmt fmt) {
static const char *table_sfxs[3] = {" (A)", " (B)", " (DIFF)"};
static const char *name_sfxs[3] = {"_base", "_comp", "_diff"};
int i, j, len;
for (i = 0; i < env.output_spec.spec_cnt; i++) {
int id = env.output_spec.ids[i];
int max_j = is_key_stat(id)... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/veristat.c | static bool should_output_join_stats(const struct verif_stats_join *stats) {
struct filter *f;
int i, allow_cnt = 0;
for (i = 0; i < env.deny_filter_cnt; i++) {
f = &env.deny_filters[i];
if (f->kind != FILTER_STAT)
continue;
if (is_join_stat_filter_matched(f, stats))
return false;
}
... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/xdp_redirect_multi.c |
static int get_mac_addr(unsigned int ifindex, void *mac_addr) {
char ifname[IF_NAMESIZE];
struct ifreq ifr;
int fd, ret = -1;
fd = socket(AF_INET, SOCK_DGRAM, 0);
if (fd < 0)
return ret;
if (!if_indextoname(ifindex, ifname))
goto err_out;
strcpy(ifr.ifr_name, ifname);
if (ioctl(fd, SIOCGIFH... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/xdp_synproxy.c | static void noreturn cleanup(int sig) {
LIBBPF_OPTS(bpf_xdp_attach_opts, opts);
int prog_fd;
int err;
if (attached_prog_id == 0)
exit(0);
if (attached_tc) {
LIBBPF_OPTS(bpf_tc_hook, hook, .ifindex = ifindex,
.attach_point = BPF_TC_INGRESS);
err = bpf_tc_hook_destroy(&hook);
... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/xdp_synproxy.c |
static noreturn void usage(const char *progname) {
fprintf(stderr,
"Usage: %s [--iface <iface>|--prog <prog_id>] [--mss4 <mss ipv4> "
"--mss6 <mss ipv6> --wscale <wscale> --ttl <ttl>] [--ports "
"<port1>,<port2>,...] [--single] [--tc]\n",
progname);
exit(1);
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/xsk.c |
int xsk_socket__fd(const struct xsk_socket *xsk) {
return xsk ? xsk->fd : -EINVAL;
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/xsk.c | static void xsk_mmap_offsets_v1(struct xdp_mmap_offsets *off) {
struct xdp_mmap_offsets_v1 off_v1;
memcpy(&off_v1, off, sizeof(off_v1));
off->rx.producer = off_v1.rx.producer;
off->rx.consumer = off_v1.rx.consumer;
off->rx.desc = off_v1.rx.desc;
off->rx.flags = off_v1.rx.consumer + sizeof(__u32);
off->... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/xsk.c |
static int xsk_get_mmap_offsets(int fd, struct xdp_mmap_offsets *off) {
socklen_t optlen;
int err;
optlen = sizeof(*off);
err = getsockopt(fd, SOL_XDP, XDP_MMAP_OFFSETS, off, &optlen);
if (err)
return err;
if (optlen == sizeof(*off))
return 0;
if (optlen == sizeof(struct xdp_mmap_offsets_v1)) ... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/xsk.c | static int xsk_get_max_queues(struct xsk_socket *xsk) {
struct ethtool_channels channels = {.cmd = ETHTOOL_GCHANNELS};
struct xsk_ctx *ctx = xsk->ctx;
struct ifreq ifr = {};
int fd, err, ret;
fd = socket(AF_LOCAL, SOCK_DGRAM | SOCK_CLOEXEC, 0);
if (fd < 0)
return -errno;
ifr.ifr_data = (void *)&chan... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/xsk.c |
static bool xsk_probe_bpf_link(void) {
LIBBPF_OPTS(bpf_link_create_opts, opts, .flags = XDP_FLAGS_SKB_MODE);
struct bpf_insn insns[2] = {BPF_MOV64_IMM(BPF_REG_0, XDP_PASS),
BPF_EXIT_INSN()};
int prog_fd, link_fd = -1, insn_cnt = ARRAY_SIZE(insns);
int ifindex_lo = 1;
bool ret = ... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/xsk.c |
int xsk_setup_xdp_prog_xsk(struct xsk_socket *xsk, int *xsks_map_fd) {
return __xsk_setup_xdp_prog(xsk, xsks_map_fd);
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/xsk.c |
static struct xsk_ctx *xsk_get_ctx(struct xsk_umem *umem, int ifindex,
__u32 queue_id) {
struct xsk_ctx *ctx;
if (list_empty(&umem->ctx_list))
return NULL;
list_for_each_entry(ctx, &umem->ctx_list, list) {
if (ctx->ifindex == ifindex && ctx->queue_id == queue_id) {
... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/xsk.c |
static void xsk_destroy_xsk_struct(struct xsk_socket *xsk) {
free(xsk->ctx);
free(xsk);
} | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/xsk.c |
int xsk_socket__create(struct xsk_socket **xsk_ptr, const char *ifname,
__u32 queue_id, struct xsk_umem *umem,
struct xsk_ring_cons *rx, struct xsk_ring_prod *tx,
const struct xsk_socket_config *usr_config) {
if (!umem)
return -EFAULT;
retur... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/xsk.c | void xsk_socket__delete(struct xsk_socket *xsk) {
size_t desc_sz = sizeof(struct xdp_desc);
struct xdp_mmap_offsets off;
struct xsk_umem *umem;
struct xsk_ctx *ctx;
int err;
if (!xsk)
return;
ctx = xsk->ctx;
umem = ctx->umem;
if (ctx->refcount == 1) {
xsk_delete_bpf_maps(xsk);
close(ctx... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/xskxceiver.c | static u32 from64to32(u64 x) {
x = (x & 0xffffffff) + (x >> 32);
/* add up carry.. */
x = (x & 0xffffffff) + (x >> 32);
return (u32)x;
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/xskxceiver.c |
static bool is_umem_valid(struct ifobject *ifobj) {
return !!ifobj->umem->umem;
} | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/xskxceiver.c |
static void enable_busy_poll(struct xsk_socket_info *xsk) {
int sock_opt;
sock_opt = 1;
if (setsockopt(xsk_socket__fd(xsk->xsk), SOL_SOCKET, SO_PREFER_BUSY_POLL,
(void *)&sock_opt, sizeof(sock_opt)) < 0)
exit_with_error(errno);
sock_opt = 20;
if (setsockopt(xsk_socket__fd(xsk->xsk), SO... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/xskxceiver.c |
static int __xsk_configure_socket(struct xsk_socket_info *xsk,
struct xsk_umem_info *umem,
struct ifobject *ifobject, bool shared) {
struct xsk_socket_config cfg = {};
struct xsk_ring_cons *rxr;
struct xsk_ring_prod *txr;
xsk->umem = umem;
... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/xskxceiver.c |
static void parse_command_line(struct ifobject *ifobj_tx,
struct ifobject *ifobj_rx, int argc,
char **argv) {
struct ifobject *ifobj;
u32 interface_nb = 0;
int option_index, c;
opterr = 0;
for (;;) {
char *sptr, *token;
c = getopt_long(... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/xskxceiver.c |
static void __test_spec_init(struct test_spec *test, struct ifobject *ifobj_tx,
struct ifobject *ifobj_rx) {
u32 i, j;
for (i = 0; i < MAX_INTERFACES; i++) {
struct ifobject *ifobj = i ? ifobj_rx : ifobj_tx;
ifobj->xsk = &ifobj->xsk_arr[0];
ifobj->use_poll = false;
if... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/xskxceiver.c |
static struct pkt *pkt_stream_get_pkt(struct pkt_stream *pkt_stream,
u32 pkt_nb) {
if (pkt_nb >= pkt_stream->nb_pkts)
return NULL;
return &pkt_stream->pkts[pkt_nb];
} | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/xskxceiver.c |
static struct pkt_stream *__pkt_stream_alloc(u32 nb_pkts) {
struct pkt_stream *pkt_stream;
pkt_stream = calloc(1, sizeof(*pkt_stream));
if (!pkt_stream)
return NULL;
pkt_stream->pkts = calloc(nb_pkts, sizeof(*pkt_stream->pkts));
if (!pkt_stream->pkts) {
free(pkt_stream);
return NULL;
}
pkt... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/xskxceiver.c |
static void pkt_stream_replace(struct test_spec *test, u32 nb_pkts,
u32 pkt_len) {
struct pkt_stream *pkt_stream;
pkt_stream = pkt_stream_generate(test->ifobj_tx->umem, nb_pkts, pkt_len);
test->ifobj_tx->pkt_stream = pkt_stream;
pkt_stream = pkt_stream_generate(test->ifobj_rx->u... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/xskxceiver.c |
static void __pkt_stream_replace_half(struct ifobject *ifobj, u32 pkt_len,
int offset) {
struct xsk_umem_info *umem = ifobj->umem;
struct pkt_stream *pkt_stream;
u32 i;
pkt_stream = pkt_stream_clone(umem, ifobj->pkt_stream);
for (i = 1; i < ifobj->pkt_stream->nb_pkts; i... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/xskxceiver.c | static bool is_pkt_valid(struct pkt *pkt, void *buffer, u64 addr, u32 len) {
void *data = xsk_umem__get_data(buffer, addr);
struct iphdr *iphdr = (struct iphdr *)(data + sizeof(struct ethhdr));
if (!pkt) {
ksft_print_msg("[%s] too many packets received\n", __func__);
return false;
}
if (len < MIN_PK... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/xskxceiver.c |
static void kick_tx(struct xsk_socket_info *xsk) {
int ret;
ret = sendto(xsk_socket__fd(xsk->xsk), NULL, 0, MSG_DONTWAIT, NULL, 0);
if (ret >= 0)
return;
if (errno == ENOBUFS || errno == EAGAIN || errno == EBUSY ||
errno == ENETDOWN) {
usleep(100);
return;
}
exit_with_error(errno);
} | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/xskxceiver.c |
static int send_pkts(struct test_spec *test, struct ifobject *ifobject) {
bool timeout = !is_umem_valid(test->ifobj_rx);
struct pollfd fds = {};
u32 pkt_cnt = 0, ret;
fds.fd = xsk_socket__fd(ifobject->xsk->xsk);
fds.events = POLLOUT;
while (pkt_cnt < ifobject->pkt_stream->nb_pkts) {
ret = __send_pkts... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/xskxceiver.c |
static int validate_fill_empty(struct ifobject *ifobject) {
struct xsk_socket *xsk = ifobject->xsk->xsk;
struct xdp_statistics stats;
int err;
usleep(1000);
kick_rx(ifobject->xsk);
err = get_xsk_stats(xsk, &stats);
if (err)
return TEST_FAILURE;
if (stats.rx_fill_ring_empty_descs)
return TEST... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/xskxceiver.c |
static int validate_tx_invalid_descs(struct ifobject *ifobject) {
struct xsk_socket *xsk = ifobject->xsk->xsk;
int fd = xsk_socket__fd(xsk);
struct xdp_statistics stats;
socklen_t optlen;
int err;
optlen = sizeof(stats);
err = getsockopt(fd, SOL_XDP, XDP_STATISTICS, &stats, &optlen);
if (err) {
ks... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/xskxceiver.c |
static void thread_common_ops_tx(struct test_spec *test,
struct ifobject *ifobject) {
xsk_configure_socket(test, ifobject, test->ifobj_rx->umem, true);
ifobject->xsk = &ifobject->xsk_arr[0];
ifobject->xsk_map_fd = test->ifobj_rx->xsk_map_fd;
memcpy(ifobject->umem, test->ifobj_r... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/xskxceiver.c |
static void *worker_testapp_validate_tx(void *arg) {
struct test_spec *test = (struct test_spec *)arg;
struct ifobject *ifobject = test->ifobj_tx;
int err;
if (test->current_step == 1) {
if (!ifobject->shared_umem)
thread_common_ops(test, ifobject);
else
thread_common_ops_tx(test, ifobject... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/xskxceiver.c | static int testapp_validate_traffic(struct test_spec *test) {
struct ifobject *ifobj_tx = test->ifobj_tx;
struct ifobject *ifobj_rx = test->ifobj_rx;
pthread_t t0, t1;
if (pthread_barrier_init(&barr, NULL, 2))
exit_with_error(errno);
test->current_step++;
pkt_stream_reset(ifobj_rx->pkt_stream);
pkts... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/xskxceiver.c |
static void testapp_bidi(struct test_spec *test) {
test_spec_set_name(test, "BIDIRECTIONAL");
test->ifobj_tx->rx_on = true;
test->ifobj_rx->tx_on = true;
test->total_steps = 2;
if (testapp_validate_traffic(test))
return;
print_verbose("Switching Tx/Rx vectors\n");
swap_directions(&test->ifobj_rx, &t... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/bpf/xskxceiver.c |
static void testapp_stats_rx_full(struct test_spec *test) {
test_spec_set_name(test, "STAT_RX_FULL");
pkt_stream_replace(test, DEFAULT_UMEM_BUFFERS + DEFAULT_UMEM_BUFFERS / 2,
PKT_SIZE);
test->ifobj_rx->pkt_stream =
pkt_stream_generate(test->ifobj_rx->umem, DEFAULT_UMEM_BUFFERS, PKT_SI... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/xskxceiver.c |
static void testapp_stats_fill_empty(struct test_spec *test) {
test_spec_set_name(test, "STAT_RX_FILL_EMPTY");
pkt_stream_replace(test, DEFAULT_UMEM_BUFFERS + DEFAULT_UMEM_BUFFERS / 2,
PKT_SIZE);
test->ifobj_rx->pkt_stream =
pkt_stream_generate(test->ifobj_rx->umem, DEFAULT_UMEM_BUFFER... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/xskxceiver.c |
static void init_iface(struct ifobject *ifobj, const char *dst_mac,
const char *src_mac, const char *dst_ip,
const char *src_ip, const u16 dst_port,
const u16 src_port, thread_func_t func_ptr) {
struct in_addr ip;
memcpy(ifobj->dst_mac, dst_mac,... | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/xskxceiver.c |
static void ifobject_delete(struct ifobject *ifobj) {
if (ifobj->ns_fd != -1)
close(ifobj->ns_fd);
free(ifobj->umem);
free(ifobj->xsk_arr);
free(ifobj);
} | [
1,
0
] |
Linux Kernel | tools/testing/selftests/bpf/xskxceiver.c |
static bool is_xdp_supported(struct ifobject *ifobject) {
int flags = XDP_FLAGS_DRV_MODE;
LIBBPF_OPTS(bpf_link_create_opts, opts, .flags = flags);
struct bpf_insn insns[2] = {BPF_MOV64_IMM(BPF_REG_0, XDP_PASS),
BPF_EXIT_INSN()};
int ifindex = if_nametoindex(ifobject->ifname);
i... | [
0,
0
] |
Linux Kernel | tools/testing/selftests/breakpoints/breakpoint_test.c | static void dummy_func2(void) {} | [
0,
0
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.