bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 bpf] selftests/bpf: fix bpf_target_sparc check
@ 2019-07-10 11:56 Ilya Leoshkevich
  2019-07-10 15:58 ` Andrii Nakryiko
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Ilya Leoshkevich @ 2019-07-10 11:56 UTC (permalink / raw)
  To: bpf, netdev; +Cc: andrii.nakryiko, Ilya Leoshkevich

bpf_helpers.h fails to compile on sparc: the code should be checking
for defined(bpf_target_sparc), but checks simply for bpf_target_sparc.

Also change #ifdef bpf_target_powerpc to #if defined() for consistency.

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
---

v1->v2: bpf_target_powerpc change

 tools/testing/selftests/bpf/bpf_helpers.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/bpf/bpf_helpers.h b/tools/testing/selftests/bpf/bpf_helpers.h
index 5f6f9e7aba2a..0214797518ce 100644
--- a/tools/testing/selftests/bpf/bpf_helpers.h
+++ b/tools/testing/selftests/bpf/bpf_helpers.h
@@ -440,10 +440,10 @@ static int (*bpf_skb_adjust_room)(void *ctx, __s32 len_diff, __u32 mode,
 
 #endif
 
-#ifdef bpf_target_powerpc
+#if defined(bpf_target_powerpc)
 #define BPF_KPROBE_READ_RET_IP(ip, ctx)		({ (ip) = (ctx)->link; })
 #define BPF_KRETPROBE_READ_RET_IP		BPF_KPROBE_READ_RET_IP
-#elif bpf_target_sparc
+#elif defined(bpf_target_sparc)
 #define BPF_KPROBE_READ_RET_IP(ip, ctx)		({ (ip) = PT_REGS_RET(ctx); })
 #define BPF_KRETPROBE_READ_RET_IP		BPF_KPROBE_READ_RET_IP
 #else
-- 
2.21.0


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

* Re: [PATCH v2 bpf] selftests/bpf: fix bpf_target_sparc check
  2019-07-10 11:56 [PATCH v2 bpf] selftests/bpf: fix bpf_target_sparc check Ilya Leoshkevich
@ 2019-07-10 15:58 ` Andrii Nakryiko
  2019-07-10 18:42 ` David Miller
  2019-07-12 13:08 ` Daniel Borkmann
  2 siblings, 0 replies; 4+ messages in thread
From: Andrii Nakryiko @ 2019-07-10 15:58 UTC (permalink / raw)
  To: Ilya Leoshkevich; +Cc: bpf, Networking

On Wed, Jul 10, 2019 at 4:57 AM Ilya Leoshkevich <iii@linux.ibm.com> wrote:
>
> bpf_helpers.h fails to compile on sparc: the code should be checking
> for defined(bpf_target_sparc), but checks simply for bpf_target_sparc.
>
> Also change #ifdef bpf_target_powerpc to #if defined() for consistency.
>
> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
> ---

Thanks!

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

>
> v1->v2: bpf_target_powerpc change
>
>  tools/testing/selftests/bpf/bpf_helpers.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/bpf_helpers.h b/tools/testing/selftests/bpf/bpf_helpers.h
> index 5f6f9e7aba2a..0214797518ce 100644
> --- a/tools/testing/selftests/bpf/bpf_helpers.h
> +++ b/tools/testing/selftests/bpf/bpf_helpers.h
> @@ -440,10 +440,10 @@ static int (*bpf_skb_adjust_room)(void *ctx, __s32 len_diff, __u32 mode,
>
>  #endif
>
> -#ifdef bpf_target_powerpc
> +#if defined(bpf_target_powerpc)

Oh, yeah, that mix of #ifdef and #if definitely threw me off. I prefer
consistency, so thanks for this update!

>  #define BPF_KPROBE_READ_RET_IP(ip, ctx)                ({ (ip) = (ctx)->link; })
>  #define BPF_KRETPROBE_READ_RET_IP              BPF_KPROBE_READ_RET_IP
> -#elif bpf_target_sparc
> +#elif defined(bpf_target_sparc)
>  #define BPF_KPROBE_READ_RET_IP(ip, ctx)                ({ (ip) = PT_REGS_RET(ctx); })
>  #define BPF_KRETPROBE_READ_RET_IP              BPF_KPROBE_READ_RET_IP
>  #else
> --
> 2.21.0
>

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

* Re: [PATCH v2 bpf] selftests/bpf: fix bpf_target_sparc check
  2019-07-10 11:56 [PATCH v2 bpf] selftests/bpf: fix bpf_target_sparc check Ilya Leoshkevich
  2019-07-10 15:58 ` Andrii Nakryiko
@ 2019-07-10 18:42 ` David Miller
  2019-07-12 13:08 ` Daniel Borkmann
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2019-07-10 18:42 UTC (permalink / raw)
  To: iii; +Cc: bpf, netdev, andrii.nakryiko

From: Ilya Leoshkevich <iii@linux.ibm.com>
Date: Wed, 10 Jul 2019 13:56:54 +0200

> bpf_helpers.h fails to compile on sparc: the code should be checking
> for defined(bpf_target_sparc), but checks simply for bpf_target_sparc.
> 
> Also change #ifdef bpf_target_powerpc to #if defined() for consistency.
> 
> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>

Acked-by: David S. Miller <davem@davemloft.net>

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

* Re: [PATCH v2 bpf] selftests/bpf: fix bpf_target_sparc check
  2019-07-10 11:56 [PATCH v2 bpf] selftests/bpf: fix bpf_target_sparc check Ilya Leoshkevich
  2019-07-10 15:58 ` Andrii Nakryiko
  2019-07-10 18:42 ` David Miller
@ 2019-07-12 13:08 ` Daniel Borkmann
  2 siblings, 0 replies; 4+ messages in thread
From: Daniel Borkmann @ 2019-07-12 13:08 UTC (permalink / raw)
  To: Ilya Leoshkevich, bpf, netdev; +Cc: andrii.nakryiko

On 07/10/2019 01:56 PM, Ilya Leoshkevich wrote:
> bpf_helpers.h fails to compile on sparc: the code should be checking
> for defined(bpf_target_sparc), but checks simply for bpf_target_sparc.
> 
> Also change #ifdef bpf_target_powerpc to #if defined() for consistency.
> 
> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>

Applied, thanks!

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

end of thread, other threads:[~2019-07-12 13:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-10 11:56 [PATCH v2 bpf] selftests/bpf: fix bpf_target_sparc check Ilya Leoshkevich
2019-07-10 15:58 ` Andrii Nakryiko
2019-07-10 18:42 ` David Miller
2019-07-12 13:08 ` Daniel Borkmann

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