Skip to content

samples: bpf: update map definition to new syntax BTF-defined map

Daniel T. Lee bpf netdev 2 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. v2 Latest2 patches 3 repliesApplied
  2. v12 patches 3 repliesSuperseded

Changes in v2 from the cover letter

- stick to __type() instead of __uint({key,value}_size) where possible

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/2samples: bpf: update outdated error messagesamples/bpf/hbm.c samples/bpf/xdp1_user.c samples/bpf/xdp_rxq_info_user.c +2 more+7 -70 replies
2/2samples: bpf: update map definition to new syntax BTF-defined mapsamples/bpf/sockex1_kern.c samples/bpf/sockex2_kern.c samples/bpf/xdp1_kern.c +9 more+178 -1783 replies

Reviews trailers per patch

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

PatchAndrii Nakryiko
1/2A-b
2/2A-b

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

Read the v2 thread

Cover letter [PATCH,bpf-next v2 0/2] samples: bpf: update map definition to new syntax BTF-defined map

Since, the new syntax of BTF-defined map has been introduced, the syntax for using maps under samples directory are mixed up. For example, some are already using the new syntax, and some are using existing syntax by calling them as 'legacy'.

As stated at commit abd29c931459 ("libbpf: allow specifying map definitions using BTF"), the BTF-defined map has more compatablility with extending supported map definition features.

Also, unifying the map definition to BTF-defined map will help reduce confusion between new syntax and existing syntax.

The commit doesn't replace all of the map to new BTF-defined map, because some of the samples still use bpf_load instead of libbpf, which can't properly create BTF-defined map.

This will only updates the samples which uses libbpf API for loading bpf program. (ex. bpf_prog_load_xattr)

This patchset fixes some of the outdated error message regarded to loading bpf program (load_bpf_file -> bpf_prog_load_xattr), and updates map definition to new syntax of BTF-defined map.

v1 -> v2:
- stick to __type() instead of __uint({key,value}_size) where possible

Daniel T. Lee (2):
samples: bpf: update outdated error message
samples: bpf: update map definition to new syntax BTF-defined map

 samples/bpf/hbm.c                   |   2 +-
 samples/bpf/sockex1_kern.c          |  12 ++--
 samples/bpf/sockex2_kern.c          |  12 ++--
 samples/bpf/xdp1_kern.c             |  12 ++--
 samples/bpf/xdp1_user.c             |   2 +-
 samples/bpf/xdp2_kern.c             |  12 ++--
 samples/bpf/xdp_adjust_tail_kern.c  |  12 ++--
 samples/bpf/xdp_fwd_kern.c          |  13 ++--
 samples/bpf/xdp_redirect_cpu_kern.c | 108 ++++++++++++++--------------
 samples/bpf/xdp_redirect_kern.c     |  24 +++----
 samples/bpf/xdp_redirect_map_kern.c |  24 +++----
 samples/bpf/xdp_router_ipv4_kern.c  |  64 ++++++++---------
 samples/bpf/xdp_rxq_info_kern.c     |  37 +++++-----
 samples/bpf/xdp_rxq_info_user.c     |   6 +-
 samples/bpf/xdp_sample_pkts_user.c  |   2 +-
 samples/bpf/xdp_tx_iptunnel_kern.c  |  26 +++----
 samples/bpf/xdp_tx_iptunnel_user.c  |   2 +-
 17 files changed, 185 insertions(+), 185 deletions(-)
Signature · 1 line
2.23.0