OSDN Git Service

bpf: btf: support 128 bit integer type
authorYonghong Song <yhs@fb.com>
Wed, 16 Jan 2019 01:07:47 +0000 (17:07 -0800)
committerDaniel Borkmann <daniel@iogearbox.net>
Wed, 16 Jan 2019 21:53:44 +0000 (22:53 +0100)
commitb1e8818cabf407a5a2cec696411b0bdfd7fd12f0
tree5ba254875be3323dffdfbca53bc62f53a0158d70
parenteeedd3527d80333fd6587a3db260395f05f312d0
bpf: btf: support 128 bit integer type

Currently, btf only supports up to 64-bit integer.
On the other hand, 128bit support for gcc and clang
has existed for a long time. For example, both gcc 4.8
and llvm 3.7 supports types "__int128" and
"unsigned __int128" for virtually all 64bit architectures
including bpf.

The requirement for __int128 support comes from two areas:
  . bpf program may use __int128. For example, some bcc tools
    (https://github.com/iovisor/bcc/tree/master/tools),
    mostly tcp v6 related, tcpstates.py, tcpaccept.py, etc.,
    are using __int128 to represent the ipv6 addresses.
  . linux itself is using __int128 types. Hence supporting
    __int128 type in BTF is required for vmlinux BTF,
    which will be used by "compile once and run everywhere"
    and other projects.

For 128bit integer, instead of base-10, hex numbers are pretty
printed out as large decimal number is hard to decipher, e.g.,
for ipv6 addresses.

Acked-by: Martin KaFai Lau <kafai@fb.com>
Signed-off-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
kernel/bpf/btf.c