Skip to content

bpftool: Add struct_ops support

Martin KaFai Lau bpf netdev 4 versions – Applied

Status from this message: Applied, thanks!

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest4 patches 1 replyApplied
  2. v34 patches 3 repliesSuperseded
  3. v24 patches 0 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v14 patches8 repliesSuperseded

Changes in v4 from the cover letter

- Return -EINVAL in patch 1 (Andrii)

Patches in v4 Applied

#Subject and filesSizeRepliesApplied
1/4bpftool: Print the enum's name instead of valuetools/bpf/bpftool/btf_dumper.c+36 -40 replies
2/4bpftool: Print as a string for char arraytools/bpf/bpftool/btf_dumper.c+41 -00 replies
3/4bpftool: Translate prog_id to its bpf prog_nametools/bpf/bpftool/btf_dumper.c tools/bpf/bpftool/main.h+107 -120 replies
4/4bpftool: Add struct_ops supporttools/bpf/bpftool/Documentation/bpftool-struct_ops.rst tools/bpf/bpftool/bash-completion/bpftool tools/bpf/bpftool/main.c +2 more+743 -10 replies

Reviews trailers per patch

All 4 patches have a Reviewed-by or Acked-by.

PatchQuentin MonnetAndrii Nakryiko
1/4A-b
2/4A-b A-b
3/4A-b
4/4A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [PATCH v4 bpf-next 0/4] bpftool: Add struct_ops support

This set adds "struct_ops" support to bpftool.

The first two patches improve the btf_dumper in bpftool. Patch 1: print the enum's name (if it is found) instead of the
enum's value.
Patch 2: print a char[] as a string if all characters are printable.

"struct_ops" stores the prog_id in a func ptr.
Instead of printing a prog_id,
patch 3 adds an option to btf_dumper to allow a func ptr's value to be printed with the full func_proto info and the prog_name.

Patch 4 implements the "struct_ops" bpftool command.

v4:
- Return -EINVAL in patch 1 (Andrii)

v3:
- Check for "case 1:" in patch 1 (Andrii)

v2:
- Typo fixes in comment and doc in patch 4 (Quentin)
- Link to a few other man pages in doc in patch 4 (Quentin)
- Alphabet ordering in include files in patch 4 (Quentin)
- Use GET_ARG() in patch 4 (Quentin)

Martin KaFai Lau (4):
bpftool: Print the enum's name instead of value
bpftool: Print as a string for char array
bpftool: Translate prog_id to its bpf prog_name
bpftool: Add struct_ops support

 .../Documentation/bpftool-struct_ops.rst      | 116 ++++
 tools/bpf/bpftool/bash-completion/bpftool     |  28 +
 tools/bpf/bpftool/btf_dumper.c                | 199 +++++-
 tools/bpf/bpftool/main.c                      |   3 +-
 tools/bpf/bpftool/main.h                      |   2 +
 tools/bpf/bpftool/struct_ops.c                | 596 ++++++++++++++++++
 6 files changed, 927 insertions(+), 17 deletions(-)
 create mode 100644 tools/bpf/bpftool/Documentation/bpftool-struct_ops.rst
 create mode 100644 tools/bpf/bpftool/struct_ops.c
Signature · 1 line
2.17.1