* [PATCH v3 bpf-next 0/3] libbpf: deprecate xdp_cpumap, xdp_devmap and classifier sec definitions
@ 2022-02-01 14:58 Lorenzo Bianconi
2022-02-01 14:58 ` [PATCH v3 bpf-next 1/3] " Lorenzo Bianconi
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Lorenzo Bianconi @ 2022-02-01 14:58 UTC (permalink / raw)
To: bpf
Cc: ast, daniel, dsahern, brouer, toke, lorenzo.bianconi, andrii,
john.fastabend
Deprecate xdp_cpumap, xdp_devmap and classifier sec definitions.
Update cpumap/devmap samples and kselftests.
Changes since v2:
- update warning log
- split libbpf and samples/kselftests changes
- deprecate classifier sec definition
Changes since v1:
- refer to Libbpf-1.0-migration-guide in the warning rised by libbpf
Lorenzo Bianconi (3):
libbpf: deprecate xdp_cpumap, xdp_devmap and classifier sec
definitions
selftests/bpf: update cpumap/devmap sec_name
samples/bpf: update cpumap/devmap sec_name
samples/bpf/xdp_redirect_cpu.bpf.c | 8 ++++----
samples/bpf/xdp_redirect_map.bpf.c | 2 +-
samples/bpf/xdp_redirect_map_multi.bpf.c | 2 +-
tools/lib/bpf/libbpf.c | 14 +++++++++++---
.../bpf/progs/test_xdp_with_cpumap_frags_helpers.c | 2 +-
.../bpf/progs/test_xdp_with_cpumap_helpers.c | 2 +-
.../bpf/progs/test_xdp_with_devmap_frags_helpers.c | 2 +-
.../bpf/progs/test_xdp_with_devmap_helpers.c | 2 +-
.../selftests/bpf/progs/xdp_redirect_multi_kern.c | 2 +-
9 files changed, 22 insertions(+), 14 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v3 bpf-next 1/3] libbpf: deprecate xdp_cpumap, xdp_devmap and classifier sec definitions
2022-02-01 14:58 [PATCH v3 bpf-next 0/3] libbpf: deprecate xdp_cpumap, xdp_devmap and classifier sec definitions Lorenzo Bianconi
@ 2022-02-01 14:58 ` Lorenzo Bianconi
2022-02-01 14:58 ` [PATCH v3 bpf-next 2/3] selftests/bpf: update cpumap/devmap sec_name Lorenzo Bianconi
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Lorenzo Bianconi @ 2022-02-01 14:58 UTC (permalink / raw)
To: bpf
Cc: ast, daniel, dsahern, brouer, toke, lorenzo.bianconi, andrii,
john.fastabend
Deprecate xdp_cpumap, xdp_devmap and classifier sec definitions.
Introduce xdp/devmap and xdp/cpumap definitions according to the
standard for SEC("") in libbpf:
- prog_type.prog_flags/attach_place
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
tools/lib/bpf/libbpf.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index 4ce94f4ed34a..1b0936b016d9 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -237,6 +237,8 @@ enum sec_def_flags {
SEC_SLOPPY_PFX = 16,
/* BPF program support non-linear XDP buffer */
SEC_XDP_FRAGS = 32,
+ /* deprecated sec definitions not supposed to be used */
+ SEC_DEPRECATED = 64,
};
struct bpf_sec_def {
@@ -6575,6 +6577,10 @@ static int libbpf_preload_prog(struct bpf_program *prog,
if (prog->type == BPF_PROG_TYPE_XDP && (def & SEC_XDP_FRAGS))
opts->prog_flags |= BPF_F_XDP_HAS_FRAGS;
+ if (def & SEC_DEPRECATED)
+ pr_warn("SEC(\"%s\") is deprecated, please see https://github.com/libbpf/libbpf/wiki/Libbpf-1.0-migration-guide#bpf-program-sec-annotation-deprecations for details\n",
+ prog->sec_name);
+
if ((prog->type == BPF_PROG_TYPE_TRACING ||
prog->type == BPF_PROG_TYPE_LSM ||
prog->type == BPF_PROG_TYPE_EXT) && !prog->attach_btf_id) {
@@ -8596,7 +8602,7 @@ static const struct bpf_sec_def section_defs[] = {
SEC_DEF("kretprobe/", KPROBE, 0, SEC_NONE, attach_kprobe),
SEC_DEF("uretprobe/", KPROBE, 0, SEC_NONE),
SEC_DEF("tc", SCHED_CLS, 0, SEC_NONE),
- SEC_DEF("classifier", SCHED_CLS, 0, SEC_NONE | SEC_SLOPPY_PFX),
+ SEC_DEF("classifier", SCHED_CLS, 0, SEC_NONE | SEC_SLOPPY_PFX | SEC_DEPRECATED),
SEC_DEF("action", SCHED_ACT, 0, SEC_NONE | SEC_SLOPPY_PFX),
SEC_DEF("tracepoint/", TRACEPOINT, 0, SEC_NONE, attach_tp),
SEC_DEF("tp/", TRACEPOINT, 0, SEC_NONE, attach_tp),
@@ -8618,9 +8624,11 @@ static const struct bpf_sec_def section_defs[] = {
SEC_DEF("iter.s/", TRACING, BPF_TRACE_ITER, SEC_ATTACH_BTF | SEC_SLEEPABLE, attach_iter),
SEC_DEF("syscall", SYSCALL, 0, SEC_SLEEPABLE),
SEC_DEF("xdp.frags/devmap", XDP, BPF_XDP_DEVMAP, SEC_XDP_FRAGS),
- SEC_DEF("xdp_devmap/", XDP, BPF_XDP_DEVMAP, SEC_ATTACHABLE),
+ SEC_DEF("xdp/devmap", XDP, BPF_XDP_DEVMAP, SEC_ATTACHABLE),
+ SEC_DEF("xdp_devmap/", XDP, BPF_XDP_DEVMAP, SEC_ATTACHABLE | SEC_DEPRECATED),
SEC_DEF("xdp.frags/cpumap", XDP, BPF_XDP_CPUMAP, SEC_XDP_FRAGS),
- SEC_DEF("xdp_cpumap/", XDP, BPF_XDP_CPUMAP, SEC_ATTACHABLE),
+ SEC_DEF("xdp/cpumap", XDP, BPF_XDP_CPUMAP, SEC_ATTACHABLE),
+ SEC_DEF("xdp_cpumap/", XDP, BPF_XDP_CPUMAP, SEC_ATTACHABLE | SEC_DEPRECATED),
SEC_DEF("xdp.frags", XDP, BPF_XDP, SEC_XDP_FRAGS),
SEC_DEF("xdp", XDP, BPF_XDP, SEC_ATTACHABLE_OPT | SEC_SLOPPY_PFX),
SEC_DEF("perf_event", PERF_EVENT, 0, SEC_NONE | SEC_SLOPPY_PFX),
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v3 bpf-next 2/3] selftests/bpf: update cpumap/devmap sec_name
2022-02-01 14:58 [PATCH v3 bpf-next 0/3] libbpf: deprecate xdp_cpumap, xdp_devmap and classifier sec definitions Lorenzo Bianconi
2022-02-01 14:58 ` [PATCH v3 bpf-next 1/3] " Lorenzo Bianconi
@ 2022-02-01 14:58 ` Lorenzo Bianconi
2022-02-01 14:58 ` [PATCH v3 bpf-next 3/3] samples/bpf: " Lorenzo Bianconi
2022-02-01 18:00 ` [PATCH v3 bpf-next 0/3] libbpf: deprecate xdp_cpumap, xdp_devmap and classifier sec definitions patchwork-bot+netdevbpf
3 siblings, 0 replies; 5+ messages in thread
From: Lorenzo Bianconi @ 2022-02-01 14:58 UTC (permalink / raw)
To: bpf
Cc: ast, daniel, dsahern, brouer, toke, lorenzo.bianconi, andrii,
john.fastabend
Substitute deprecated xdp_cpumap and xdp_devmap sec_name with
xdp/cpumap and xdp/devmap respectively in bpf kselftests.
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
.../selftests/bpf/progs/test_xdp_with_cpumap_frags_helpers.c | 2 +-
.../testing/selftests/bpf/progs/test_xdp_with_cpumap_helpers.c | 2 +-
.../selftests/bpf/progs/test_xdp_with_devmap_frags_helpers.c | 2 +-
.../testing/selftests/bpf/progs/test_xdp_with_devmap_helpers.c | 2 +-
tools/testing/selftests/bpf/progs/xdp_redirect_multi_kern.c | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/tools/testing/selftests/bpf/progs/test_xdp_with_cpumap_frags_helpers.c b/tools/testing/selftests/bpf/progs/test_xdp_with_cpumap_frags_helpers.c
index 62fb7cd4d87a..97ed625bb70a 100644
--- a/tools/testing/selftests/bpf/progs/test_xdp_with_cpumap_frags_helpers.c
+++ b/tools/testing/selftests/bpf/progs/test_xdp_with_cpumap_frags_helpers.c
@@ -12,7 +12,7 @@ struct {
__uint(max_entries, 4);
} cpu_map SEC(".maps");
-SEC("xdp_cpumap/dummy_cm")
+SEC("xdp/cpumap")
int xdp_dummy_cm(struct xdp_md *ctx)
{
return XDP_PASS;
diff --git a/tools/testing/selftests/bpf/progs/test_xdp_with_cpumap_helpers.c b/tools/testing/selftests/bpf/progs/test_xdp_with_cpumap_helpers.c
index 48007f17dfa8..20ec6723df18 100644
--- a/tools/testing/selftests/bpf/progs/test_xdp_with_cpumap_helpers.c
+++ b/tools/testing/selftests/bpf/progs/test_xdp_with_cpumap_helpers.c
@@ -24,7 +24,7 @@ int xdp_dummy_prog(struct xdp_md *ctx)
return XDP_PASS;
}
-SEC("xdp_cpumap/dummy_cm")
+SEC("xdp/cpumap")
int xdp_dummy_cm(struct xdp_md *ctx)
{
if (ctx->ingress_ifindex == IFINDEX_LO)
diff --git a/tools/testing/selftests/bpf/progs/test_xdp_with_devmap_frags_helpers.c b/tools/testing/selftests/bpf/progs/test_xdp_with_devmap_frags_helpers.c
index e1caf510b7d2..cdcf7de7ec8c 100644
--- a/tools/testing/selftests/bpf/progs/test_xdp_with_devmap_frags_helpers.c
+++ b/tools/testing/selftests/bpf/progs/test_xdp_with_devmap_frags_helpers.c
@@ -12,7 +12,7 @@ struct {
/* valid program on DEVMAP entry via SEC name;
* has access to egress and ingress ifindex
*/
-SEC("xdp_devmap/map_prog")
+SEC("xdp/devmap")
int xdp_dummy_dm(struct xdp_md *ctx)
{
return XDP_PASS;
diff --git a/tools/testing/selftests/bpf/progs/test_xdp_with_devmap_helpers.c b/tools/testing/selftests/bpf/progs/test_xdp_with_devmap_helpers.c
index 8ae11fab8316..4139a14f9996 100644
--- a/tools/testing/selftests/bpf/progs/test_xdp_with_devmap_helpers.c
+++ b/tools/testing/selftests/bpf/progs/test_xdp_with_devmap_helpers.c
@@ -27,7 +27,7 @@ int xdp_dummy_prog(struct xdp_md *ctx)
/* valid program on DEVMAP entry via SEC name;
* has access to egress and ingress ifindex
*/
-SEC("xdp_devmap/map_prog")
+SEC("xdp/devmap")
int xdp_dummy_dm(struct xdp_md *ctx)
{
char fmt[] = "devmap redirect: dev %u -> dev %u len %u\n";
diff --git a/tools/testing/selftests/bpf/progs/xdp_redirect_multi_kern.c b/tools/testing/selftests/bpf/progs/xdp_redirect_multi_kern.c
index 8395782b6e0a..97b26a30b59a 100644
--- a/tools/testing/selftests/bpf/progs/xdp_redirect_multi_kern.c
+++ b/tools/testing/selftests/bpf/progs/xdp_redirect_multi_kern.c
@@ -70,7 +70,7 @@ int xdp_redirect_map_all_prog(struct xdp_md *ctx)
BPF_F_BROADCAST | BPF_F_EXCLUDE_INGRESS);
}
-SEC("xdp_devmap/map_prog")
+SEC("xdp/devmap")
int xdp_devmap_prog(struct xdp_md *ctx)
{
void *data_end = (void *)(long)ctx->data_end;
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v3 bpf-next 3/3] samples/bpf: update cpumap/devmap sec_name
2022-02-01 14:58 [PATCH v3 bpf-next 0/3] libbpf: deprecate xdp_cpumap, xdp_devmap and classifier sec definitions Lorenzo Bianconi
2022-02-01 14:58 ` [PATCH v3 bpf-next 1/3] " Lorenzo Bianconi
2022-02-01 14:58 ` [PATCH v3 bpf-next 2/3] selftests/bpf: update cpumap/devmap sec_name Lorenzo Bianconi
@ 2022-02-01 14:58 ` Lorenzo Bianconi
2022-02-01 18:00 ` [PATCH v3 bpf-next 0/3] libbpf: deprecate xdp_cpumap, xdp_devmap and classifier sec definitions patchwork-bot+netdevbpf
3 siblings, 0 replies; 5+ messages in thread
From: Lorenzo Bianconi @ 2022-02-01 14:58 UTC (permalink / raw)
To: bpf
Cc: ast, daniel, dsahern, brouer, toke, lorenzo.bianconi, andrii,
john.fastabend
Substitute deprecated xdp_cpumap and xdp_devmap sec_name with
xdp/cpumap and xdp/devmap respectively.
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
samples/bpf/xdp_redirect_cpu.bpf.c | 8 ++++----
samples/bpf/xdp_redirect_map.bpf.c | 2 +-
samples/bpf/xdp_redirect_map_multi.bpf.c | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/samples/bpf/xdp_redirect_cpu.bpf.c b/samples/bpf/xdp_redirect_cpu.bpf.c
index 25e3a405375f..87c54bfdbb70 100644
--- a/samples/bpf/xdp_redirect_cpu.bpf.c
+++ b/samples/bpf/xdp_redirect_cpu.bpf.c
@@ -491,7 +491,7 @@ int xdp_prognum5_lb_hash_ip_pairs(struct xdp_md *ctx)
return bpf_redirect_map(&cpu_map, cpu_dest, 0);
}
-SEC("xdp_cpumap/redirect")
+SEC("xdp/cpumap")
int xdp_redirect_cpu_devmap(struct xdp_md *ctx)
{
void *data_end = (void *)(long)ctx->data_end;
@@ -507,19 +507,19 @@ int xdp_redirect_cpu_devmap(struct xdp_md *ctx)
return bpf_redirect_map(&tx_port, 0, 0);
}
-SEC("xdp_cpumap/pass")
+SEC("xdp/cpumap")
int xdp_redirect_cpu_pass(struct xdp_md *ctx)
{
return XDP_PASS;
}
-SEC("xdp_cpumap/drop")
+SEC("xdp/cpumap")
int xdp_redirect_cpu_drop(struct xdp_md *ctx)
{
return XDP_DROP;
}
-SEC("xdp_devmap/egress")
+SEC("xdp/devmap")
int xdp_redirect_egress_prog(struct xdp_md *ctx)
{
void *data_end = (void *)(long)ctx->data_end;
diff --git a/samples/bpf/xdp_redirect_map.bpf.c b/samples/bpf/xdp_redirect_map.bpf.c
index 59efd656e1b2..415bac1758e3 100644
--- a/samples/bpf/xdp_redirect_map.bpf.c
+++ b/samples/bpf/xdp_redirect_map.bpf.c
@@ -68,7 +68,7 @@ int xdp_redirect_map_native(struct xdp_md *ctx)
return xdp_redirect_map(ctx, &tx_port_native);
}
-SEC("xdp_devmap/egress")
+SEC("xdp/devmap")
int xdp_redirect_map_egress(struct xdp_md *ctx)
{
void *data_end = (void *)(long)ctx->data_end;
diff --git a/samples/bpf/xdp_redirect_map_multi.bpf.c b/samples/bpf/xdp_redirect_map_multi.bpf.c
index bb0a5a3bfcf0..8b2fd4ec2c76 100644
--- a/samples/bpf/xdp_redirect_map_multi.bpf.c
+++ b/samples/bpf/xdp_redirect_map_multi.bpf.c
@@ -53,7 +53,7 @@ int xdp_redirect_map_native(struct xdp_md *ctx)
return xdp_redirect_map(ctx, &forward_map_native);
}
-SEC("xdp_devmap/egress")
+SEC("xdp/devmap")
int xdp_devmap_prog(struct xdp_md *ctx)
{
void *data_end = (void *)(long)ctx->data_end;
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v3 bpf-next 0/3] libbpf: deprecate xdp_cpumap, xdp_devmap and classifier sec definitions
2022-02-01 14:58 [PATCH v3 bpf-next 0/3] libbpf: deprecate xdp_cpumap, xdp_devmap and classifier sec definitions Lorenzo Bianconi
` (2 preceding siblings ...)
2022-02-01 14:58 ` [PATCH v3 bpf-next 3/3] samples/bpf: " Lorenzo Bianconi
@ 2022-02-01 18:00 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-02-01 18:00 UTC (permalink / raw)
To: Lorenzo Bianconi
Cc: bpf, ast, daniel, dsahern, brouer, toke, lorenzo.bianconi,
andrii, john.fastabend
Hello:
This series was applied to bpf/bpf-next.git (master)
by Andrii Nakryiko <andrii@kernel.org>:
On Tue, 1 Feb 2022 15:58:07 +0100 you wrote:
> Deprecate xdp_cpumap, xdp_devmap and classifier sec definitions.
> Update cpumap/devmap samples and kselftests.
>
> Changes since v2:
> - update warning log
> - split libbpf and samples/kselftests changes
> - deprecate classifier sec definition
>
> [...]
Here is the summary with links:
- [v3,bpf-next,1/3] libbpf: deprecate xdp_cpumap, xdp_devmap and classifier sec definitions
https://git.kernel.org/bpf/bpf-next/c/4a4d4cee48e2
- [v3,bpf-next,2/3] selftests/bpf: update cpumap/devmap sec_name
https://git.kernel.org/bpf/bpf-next/c/439f0336566c
- [v3,bpf-next,3/3] samples/bpf: update cpumap/devmap sec_name
https://git.kernel.org/bpf/bpf-next/c/8bab53223340
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-02-01 18:00 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-01 14:58 [PATCH v3 bpf-next 0/3] libbpf: deprecate xdp_cpumap, xdp_devmap and classifier sec definitions Lorenzo Bianconi
2022-02-01 14:58 ` [PATCH v3 bpf-next 1/3] " Lorenzo Bianconi
2022-02-01 14:58 ` [PATCH v3 bpf-next 2/3] selftests/bpf: update cpumap/devmap sec_name Lorenzo Bianconi
2022-02-01 14:58 ` [PATCH v3 bpf-next 3/3] samples/bpf: " Lorenzo Bianconi
2022-02-01 18:00 ` [PATCH v3 bpf-next 0/3] libbpf: deprecate xdp_cpumap, xdp_devmap and classifier sec definitions patchwork-bot+netdevbpf
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.