Commit Graph

16 Commits

Author SHA1 Message Date
Adam Jensen
060c8a99c4 include: Include linux/stddef.h
This fixes the build in environments such as Alpine Linux.
See [0] for discussion.

  [0] https://github.com/libbpf/libbpf/pull/41

Signed-off-by: Adam Jensen
2022-01-14 12:21:53 -08:00
Andrii Nakryiko
17d7f04e7c include: add BPF_ALU32_IMM macro implementation
BPF_ALU32_IMM is now used in gen_loader.c. Add its definition to
include/linux/filter.h header.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
2021-11-01 15:10:25 -07:00
Andrii Nakryiko
91001a9923 include: implement list_empty() and list_for_each_entry()
Implement list_empty() function and list_for_each_entry() macro, newly used by
xsk.c in 2f6324a3937f ("libbpf: Support shared umems between queues and devices")
(Linux commit sha).

Fixes: 5f630710f52e ("libbpf: Support shared umems between queues and devices")
Signed-off-by: Andrii Nakryiko <andriin@fb.com>
2020-09-03 21:21:34 -07:00
Andrii Nakryiko
28e26bdc3e sync: add BPF_RAW_INSN macro
Add BPF_RAW_INSNS macro used by libbpf.

Signed-off-by: Andrii Nakryiko <andriin@fb.com>
2020-08-21 18:22:15 -07:00
Andrii Nakryiko
5150a4a0fb includes: add BPF_JMP32_IMM macro to fix build
Recent xsk change started using new BPF_JMP32_IMM macro. Add it to our
local copy of include/linux/filter.h to fix the build.

Signed-off-by: Andrii Nakryiko <andriin@fb.com>
2019-10-24 22:59:06 -07:00
Petar Penkov
db63a5aa5d filter.h: fix BPF_LD_MAP_VALUE definition
The current definition calls BPF_LD_IMM64_RAW_FULL with
BPF_PSEUDO_MAP_FD but the original patch[0] invokes it with
BPF_PSEUDO_MAP_VALUE.

[0] https://patchwork.ozlabs.org/patch/1082785/
2019-08-22 16:33:59 -07:00
Andrii Nakryiko
e60460f4e5 linux/err.h: add PTR_ERR_OR_ZERO
Add missing PTR_ERR_OR_ZERO implementation. Also add a bunch of
generated files to .gitignore.

Signed-off-by: Andrii Nakryiko <andriin@fb.com>
2019-05-29 10:19:20 -07:00
Andrii Nakryiko
58d39f2af3 filter.h: add missing BPF raw instruction macros
These are used in some of the new commits from bpf-next.

Signed-off-by: Andrii Nakryiko <andriin@fb.com>
2019-05-15 21:17:43 -07:00
Daniel Borkmann
dd3fc8bde1 sync: latest tooling changes from kernel
[ upstream commit 6b7a21140fca461c6d8d5c65a3746e7da50a409e ]

Needed a custom backport. I've changed fallbacks so that we can
partially pull in barriers step by step. I've fixed x86 ones and
added corresponding arm64 barriers.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
2019-04-11 15:55:59 -07:00
Andrii Nakryiko
cb658e9724 AF_XDP: add xsk.{c,h} to Makefile and fix build
This patch makes sure we build AF_XDP-related code as part of libbpf. This
also required copying few uapi/linux headers and adding few used definitions
in include headers.

Signed-off-by: Andrii Nakryiko <andriin@fb.com>
2019-03-05 09:22:54 -08:00
Yonghong Song
30388a7afd add BPF_EMIT_CALL macro for libbpf_probes.c
libbpf_probes.c accessed BPF_EMIT_CALL. Added the
definition in include/linux/filter.h.

Signed-off-by: Yonghong Song <yhs@fb.com>
2019-02-04 14:39:30 -08:00
yonghong-song
d5b146fec5
add asm/errno.h to linux/err.h (#8)
Otherwise, we will have the following compilation error:

  /home/yhs/work/bcc-new/src/cc/libbpf/src/bpf_prog_linfo.c:
      In function ‘dissect_jited_func’:
  /home/yhs/work/bcc-new/src/cc/libbpf/src/bpf_prog_linfo.c:88:10:
      error: ‘EINVAL’ undeclared (first use in this function)
    return -EINVAL;

The original linux/err.h at linux:tools/include directory
does include "asm/errno.h" as well.

Signed-off-by: Yonghong Song <yhs@fb.com>
2019-01-16 17:16:50 -08:00
yonghong-song
556e0a0def
bpf: sync with latest bpf-next tree (#5)
sync with latest bpf-next tree.
the include/linux/filter.h is created as libbpf.c tries
to use various insn define macros.

Signed-off-by: Yonghong Song <yhs@fb.com>
2018-11-26 14:32:21 -08:00
Daniel Borkmann
a0e4e323bb bpf: add ring_buffer.h drop in replacement header
Add fast variant for x86-64 for now, and we can later extend for
others upon demand.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
2018-10-19 23:14:46 +02:00
Yonghong Song
8acf2635c3 add a simple Makefile to build and clean up
add missing macros, static inline functions, etc.
add README to illustrate the purpose of this repo.

Signed-off-by: Yonghong Song <yhs@fb.com>
2018-10-10 09:40:15 -07:00
Yonghong Song
66684189f0 initial commit
This initial commit added the following files
from bpf-next repository:
  src:
    <files from linux:tools/lib/bpf>
    bpf.c bpf.h btf.c btf.h libbpf.c libbpf.h
    libbpf_errno.c netlink.c nlattr.c nlattr.h
    str_error.c str_error.h
  include:
    <files from linux:tools/include/uapi/linux>
    uapi/linux/{bpf.h, btf.h}

    <files from linux:tools/include/tools>
    tools/libc_compat.h

The following files are also added:
  include/linux/{err.h, kernel.h, list.h, overflow.h, types.h}
These files are customized headers to satisfy compilation.
Their original counterparts are at linux:tools/include/linux
directory.

Signed-off-by: Yonghong Song <yhs@fb.com>
2018-10-09 21:56:40 -07:00