Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misc fix #215

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion basic01-xdp-pass/xdp_pass_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ int main(int argc, char **argv)
if (err)
return err;

/* This step is not really needed , BPF-info via bpf-syscall */
/* This step is not really needed , BPF-info via bpf-syscall */
err = bpf_obj_get_info_by_fd(prog_fd, &info, &info_len);
if (err) {
fprintf(stderr, "ERR: can't get prog info - %s\n",
Expand Down
2 changes: 1 addition & 1 deletion basic02-prog-by-name/xdp_loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ static void list_avail_progs(struct bpf_object *obj)

bpf_object__for_each_program(pos, obj) {
if (bpf_program__is_xdp(pos))
printf(" %s\n", bpf_program__title(pos, false));
printf(" %s\n", bpf_program__section_name(pos));
}
}

Expand Down
6 changes: 3 additions & 3 deletions basic03-map-counter/xdp_load_and_stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ int find_map_fd(struct bpf_object *bpf_obj, const char *mapname)

/* Lesson#3: bpf_object to bpf_map */
map = bpf_object__find_map_by_name(bpf_obj, mapname);
if (!map) {
if (!map) {
fprintf(stderr, "ERR: cannot find map by name: %s\n", mapname);
goto out;
}
Expand All @@ -85,7 +85,7 @@ static __u64 gettime(void)

res = clock_gettime(CLOCK_MONOTONIC, &t);
if (res < 0) {
fprintf(stderr, "Error with gettimeofday! (%i)\n", res);
fprintf(stderr, "Error with clock_gettime! (%i)\n", res);
exit(EXIT_FAIL);
}
return (__u64) t.tv_sec * NANOSEC_PER_SEC + t.tv_nsec;
Expand Down Expand Up @@ -131,7 +131,7 @@ static void stats_print(struct stats_record *stats_rec,

period = calc_period(rec, prev);
if (period == 0)
return;
return;

packets = rec->total.rx_packets - prev->total.rx_packets;
pps = packets / period;
Expand Down
7 changes: 0 additions & 7 deletions basic04-pinning-maps/xdp_prog_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,6 @@ struct bpf_map_def SEC("maps") xdp_stats_map = {
.max_entries = XDP_ACTION_MAX,
};

/* LLVM maps __sync_fetch_and_add() as a built-in function to the BPF atomic add
* instruction (that is BPF_STX | BPF_XADD | BPF_W for word sizes)
*/
#ifndef lock_xadd
#define lock_xadd(ptr, val) ((void) __sync_fetch_and_add(ptr, val))
#endif

static __always_inline
__u32 xdp_stats_record_action(struct xdp_md *ctx, __u32 action)
{
Expand Down
2 changes: 1 addition & 1 deletion basic04-pinning-maps/xdp_stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ static __u64 gettime(void)

res = clock_gettime(CLOCK_MONOTONIC, &t);
if (res < 0) {
fprintf(stderr, "Error with gettimeofday! (%i)\n", res);
fprintf(stderr, "Error with clock_gettime! (%i)\n", res);
exit(EXIT_FAIL);
}
return (__u64) t.tv_sec * NANOSEC_PER_SEC + t.tv_nsec;
Expand Down
2 changes: 1 addition & 1 deletion common/common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ LDFLAGS ?= -L$(LIBBPF_DIR)

BPF_CFLAGS ?= -I$(LIBBPF_DIR)/build/usr/include/ -I../headers/

LIBS = -l:libbpf.a -lelf $(USER_LIBS)
LIBS = -l:libbpf.a -lelf -lz $(USER_LIBS)

all: llvm-check $(USER_TARGETS) $(XDP_OBJ) $(COPY_LOADER) $(COPY_STATS)

Expand Down
2 changes: 1 addition & 1 deletion common/common_user_bpf_xdp.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ struct bpf_object *load_bpf_and_xdp_attach(struct config *cfg)
exit(EXIT_FAIL_BPF);
}

strncpy(cfg->progsec, bpf_program__title(bpf_prog, false), sizeof(cfg->progsec));
strncpy(cfg->progsec, bpf_program__section_name(bpf_prog), sizeof(cfg->progsec));

prog_fd = bpf_program__fd(bpf_prog);
if (prog_fd <= 0) {
Expand Down
2 changes: 1 addition & 1 deletion libbpf
Submodule libbpf updated 66 files
+71 −92 .travis.yml
+1 −1 BPF-CHECKPOINT-COMMIT
+1 −1 CHECKPOINT-COMMIT
+1 −0 LICENSE
+32 −0 LICENSE.BSD-2-Clause
+503 −0 LICENSE.LGPL-2.1
+122 −17 README.md
+8 −0 include/linux/filter.h
+9 −0 include/linux/list.h
+0 −20 include/tools/libc_compat.h
+2,722 −324 include/uapi/linux/bpf.h
+13 −5 include/uapi/linux/btf.h
+17 −1 include/uapi/linux/if_link.h
+4 −1 include/uapi/linux/if_xdp.h
+0 −18 scripts/check-reallocarray.sh
+51 −63 scripts/sync-kernel.sh
+61 −33 src/Makefile
+296 −31 src/bpf.c
+112 −8 src/bpf.h
+227 −54 src/bpf_core_read.h
+35 −8 src/bpf_endian.h
+1,274 −141 src/bpf_helper_defs.h
+118 −4 src/bpf_helpers.h
+277 −4 src/bpf_tracing.h
+2,446 −672 src/btf.c
+120 −51 src/btf.h
+159 −101 src/btf_dump.c
+14 −2 src/hashmap.c
+30 −13 src/hashmap.h
+6,949 −1,868 src/libbpf.c
+205 −55 src/libbpf.h
+157 −0 src/libbpf.map
+1 −1 src/libbpf.pc.template
+42 −0 src/libbpf_common.h
+3 −0 src/libbpf_errno.c
+235 −21 src/libbpf_internal.h
+37 −2 src/libbpf_probes.c
+0 −47 src/libbpf_util.h
+2,883 −0 src/linker.c
+45 −124 src/netlink.c
+3 −3 src/nlattr.c
+290 −0 src/ringbuf.c
+3 −0 src/str_error.c
+176 −0 src/strset.c
+21 −0 src/strset.h
+635 −161 src/xsk.c
+97 −21 src/xsk.h
+12 −9 travis-ci/managers/debian.sh
+6 −10 travis-ci/managers/ubuntu.sh
+30 −0 travis-ci/vmtest/build_pahole.sh
+43 −0 travis-ci/vmtest/build_selftests.sh
+44 −0 travis-ci/vmtest/checkout_latest_kernel.sh
+8 −0 travis-ci/vmtest/configs/INDEX
+98 −0 travis-ci/vmtest/configs/blacklist/BLACKLIST-5.5.0
+1 −0 travis-ci/vmtest/configs/blacklist/BLACKLIST-latest
+3,054 −0 travis-ci/vmtest/configs/latest.config
+7 −0 travis-ci/vmtest/configs/whitelist/WHITELIST-4.9.0
+12 −0 travis-ci/vmtest/helpers.sh
+158 −0 travis-ci/vmtest/mkrootfs.sh
+3 −0 travis-ci/vmtest/prepare_selftests-4.9.0.sh
+3 −0 travis-ci/vmtest/prepare_selftests-5.5.0.sh
+20 −0 travis-ci/vmtest/prepare_selftests.sh
+455 −0 travis-ci/vmtest/run.sh
+51 −0 travis-ci/vmtest/run_selftests.sh
+38 −0 travis-ci/vmtest/run_vmtest.sh
+138,018 −0 travis-ci/vmtest/vmlinux.h
2 changes: 1 addition & 1 deletion tracing02-xdp-monitor/trace_load_and_stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -796,7 +796,7 @@ static struct bpf_object* load_bpf_and_trace_attach(struct config *cfg)
}

bpf_object__for_each_program(prog, obj) {
const char *sec = bpf_program__title(prog, true);
const char *sec = bpf_program__section_name(prog);
char *tp;

if (!sec) {
Expand Down