netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Martynas Pumputis <m@lambda.lt>
To: netdev@vger.kernel.org
Cc: bpf@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net, m@lambda.lt
Subject: [PATCH bpf v2 1/2] bpf: simplify definition of BPF_FIB_LOOKUP related flags
Date: Wed, 12 Jun 2019 18:05:40 +0200	[thread overview]
Message-ID: <20190612160541.2550-1-m@lambda.lt> (raw)

Previously, the BPF_FIB_LOOKUP_{DIRECT,OUTPUT} flags were defined
with the help of BIT macro. This had the following issues:

- In order to user any of the flags, a user was required to depend
  on <linux/bits.h>.
- No other flag in bpf.h uses the macro, so it seems that an unwritten
  convention is to use (1 << (nr)) to define BPF-related flags.

Signed-off-by: Martynas Pumputis <m@lambda.lt>
---
 include/uapi/linux/bpf.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
index 63e0cf66f01a..a8f17bc86732 100644
--- a/include/uapi/linux/bpf.h
+++ b/include/uapi/linux/bpf.h
@@ -3376,8 +3376,8 @@ struct bpf_raw_tracepoint_args {
 /* DIRECT:  Skip the FIB rules and go to FIB table associated with device
  * OUTPUT:  Do lookup from egress perspective; default is ingress
  */
-#define BPF_FIB_LOOKUP_DIRECT  BIT(0)
-#define BPF_FIB_LOOKUP_OUTPUT  BIT(1)
+#define BPF_FIB_LOOKUP_DIRECT  (1U << 0)
+#define BPF_FIB_LOOKUP_OUTPUT  (1U << 1)
 
 enum {
 	BPF_FIB_LKUP_RET_SUCCESS,      /* lookup successful */
-- 
2.21.0


             reply	other threads:[~2019-06-12 16:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-12 16:05 Martynas Pumputis [this message]
2019-06-12 16:05 ` [PATCH bpf v2 2/2] bpf: sync BPF_FIB_LOOKUP flag changes with BPF uapi Martynas Pumputis
2019-06-13  6:44   ` Andrii Nakryiko
2019-06-13  6:43 ` [PATCH bpf v2 1/2] bpf: simplify definition of BPF_FIB_LOOKUP related flags Andrii Nakryiko
2019-06-13 20:48 ` Daniel Borkmann

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=20190612160541.2550-1-m@lambda.lt \
    --to=m@lambda.lt \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=netdev@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;
as well as URLs for NNTP newsgroup(s).