All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf v2 1/2] bpf: simplify definition of BPF_FIB_LOOKUP related flags
@ 2019-06-12 16:05 Martynas Pumputis
  2019-06-12 16:05 ` [PATCH bpf v2 2/2] bpf: sync BPF_FIB_LOOKUP flag changes with BPF uapi Martynas Pumputis
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Martynas Pumputis @ 2019-06-12 16:05 UTC (permalink / raw)
  To: netdev; +Cc: bpf, ast, daniel, m

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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH bpf v2 2/2] bpf: sync BPF_FIB_LOOKUP flag changes with BPF uapi
  2019-06-12 16:05 [PATCH bpf v2 1/2] bpf: simplify definition of BPF_FIB_LOOKUP related flags Martynas Pumputis
@ 2019-06-12 16:05 ` 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
  2 siblings, 1 reply; 5+ messages in thread
From: Martynas Pumputis @ 2019-06-12 16:05 UTC (permalink / raw)
  To: netdev; +Cc: bpf, ast, daniel, m

Sync the changes to the flags made in "bpf: simplify definition of
BPF_FIB_LOOKUP related flags" with the BPF uapi headers.

Doing in a separate commit to ease syncing of github/libbpf.

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

diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h
index 63e0cf66f01a..a8f17bc86732 100644
--- a/tools/include/uapi/linux/bpf.h
+++ b/tools/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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH bpf v2 1/2] bpf: simplify definition of BPF_FIB_LOOKUP related flags
  2019-06-12 16:05 [PATCH bpf v2 1/2] bpf: simplify definition of BPF_FIB_LOOKUP related flags Martynas Pumputis
  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:43 ` Andrii Nakryiko
  2019-06-13 20:48 ` Daniel Borkmann
  2 siblings, 0 replies; 5+ messages in thread
From: Andrii Nakryiko @ 2019-06-13  6:43 UTC (permalink / raw)
  To: Martynas Pumputis; +Cc: Networking, bpf, Alexei Starovoitov, Daniel Borkmann

On Wed, Jun 12, 2019 at 11:06 AM Martynas Pumputis <m@lambda.lt> wrote:
>
> 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.
>

Makes sense!

Acked-by: Andrii Nakryiko <andriin@fb.com>

> 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
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH bpf v2 2/2] bpf: sync BPF_FIB_LOOKUP flag changes with BPF uapi
  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
  0 siblings, 0 replies; 5+ messages in thread
From: Andrii Nakryiko @ 2019-06-13  6:44 UTC (permalink / raw)
  To: Martynas Pumputis; +Cc: Networking, bpf, Alexei Starovoitov, Daniel Borkmann

On Wed, Jun 12, 2019 at 11:06 AM Martynas Pumputis <m@lambda.lt> wrote:
>
> Sync the changes to the flags made in "bpf: simplify definition of
> BPF_FIB_LOOKUP related flags" with the BPF uapi headers.
>
> Doing in a separate commit to ease syncing of github/libbpf.
>
> Signed-off-by: Martynas Pumputis <m@lambda.lt>

Acked-by: Andrii Nakryiko <andriin@fb.com>

> ---
>  tools/include/uapi/linux/bpf.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h
> index 63e0cf66f01a..a8f17bc86732 100644
> --- a/tools/include/uapi/linux/bpf.h
> +++ b/tools/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
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH bpf v2 1/2] bpf: simplify definition of BPF_FIB_LOOKUP related flags
  2019-06-12 16:05 [PATCH bpf v2 1/2] bpf: simplify definition of BPF_FIB_LOOKUP related flags Martynas Pumputis
  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:43 ` [PATCH bpf v2 1/2] bpf: simplify definition of BPF_FIB_LOOKUP related flags Andrii Nakryiko
@ 2019-06-13 20:48 ` Daniel Borkmann
  2 siblings, 0 replies; 5+ messages in thread
From: Daniel Borkmann @ 2019-06-13 20:48 UTC (permalink / raw)
  To: Martynas Pumputis, netdev; +Cc: bpf, ast

On 06/12/2019 06:05 PM, Martynas Pumputis wrote:
> 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>

Applied, thanks!

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-06-13 20:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-12 16:05 [PATCH bpf v2 1/2] bpf: simplify definition of BPF_FIB_LOOKUP related flags Martynas Pumputis
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

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.