BPF List
 help / color / mirror / Atom feed
From: Kumar Kartikeya Dwivedi <memxor@gmail.com>
To: bpf@vger.kernel.org
Subject: [PATCH bpf-next] samples: bpf: avoid name collision with kernel enum values
Date: Sun, 26 Sep 2021 18:26:05 +0530	[thread overview]
Message-ID: <20210926125605.1101605-1-memxor@gmail.com> (raw)

In xdp_redirect_map_multi.bpf.c, on newer kernels samples compilation
fails when vmlinux.h is generated from a kernel supporting broadcast for
devmap. Hence, avoid naming collisions to prevent build failure.

Fixes: a29b3ca17ee6 (samples: bpf: Convert xdp_redirect_map_multi_kern.o to XDP samples helper)
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
---
 samples/bpf/xdp_redirect_map_multi.bpf.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/samples/bpf/xdp_redirect_map_multi.bpf.c b/samples/bpf/xdp_redirect_map_multi.bpf.c
index 8f59d430cb64..c6361e70c829 100644
--- a/samples/bpf/xdp_redirect_map_multi.bpf.c
+++ b/samples/bpf/xdp_redirect_map_multi.bpf.c
@@ -6,8 +6,8 @@
 #include "xdp_sample_shared.h"

 enum {
-	BPF_F_BROADCAST		= (1ULL << 3),
-	BPF_F_EXCLUDE_INGRESS	= (1ULL << 4),
+	__BPF_F_BROADCAST	= (1ULL << 3),
+	__BPF_F_EXCLUDE_INGRESS	= (1ULL << 4),
 };

 struct {
@@ -43,7 +43,8 @@ static int xdp_redirect_map(struct xdp_md *ctx, void *forward_map)
 	NO_TEAR_INC(rec->processed);

 	return bpf_redirect_map(forward_map, 0,
-				BPF_F_BROADCAST | BPF_F_EXCLUDE_INGRESS);
+				__BPF_F_BROADCAST |
+				__BPF_F_EXCLUDE_INGRESS);
 }

 SEC("xdp")
--
2.33.0


             reply	other threads:[~2021-09-26 12:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-26 12:56 Kumar Kartikeya Dwivedi [this message]
2021-09-27 12:37 ` [PATCH bpf-next] samples: bpf: avoid name collision with kernel enum values Toke Høiland-Jørgensen
2021-09-27 13:46   ` Kumar Kartikeya Dwivedi
2021-09-27 16:01     ` Toke Høiland-Jørgensen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210926125605.1101605-1-memxor@gmail.com \
    --to=memxor@gmail.com \
    --cc=bpf@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox