All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf-next] selftests/bpf: bring back (void *) cast to set_ipv4_csum in test_tc_tunnel
@ 2019-04-11 22:53 Stanislav Fomichev
  2019-04-12  6:01 ` Song Liu
  2019-04-16  8:27 ` Daniel Borkmann
  0 siblings, 2 replies; 4+ messages in thread
From: Stanislav Fomichev @ 2019-04-11 22:53 UTC (permalink / raw)
  To: netdev, bpf
  Cc: davem, ast, daniel, Stanislav Fomichev, Alan Maguire, Willem de Bruijn

It was removed in commit 166b5a7f2ca3 ("selftests_bpf: extend
test_tc_tunnel for UDP encap") without any explanation.

Otherwise I see:
progs/test_tc_tunnel.c:160:17: warning: taking address of packed member 'ip' of class or structure
      'v4hdr' may result in an unaligned pointer value [-Waddress-of-packed-member]
        set_ipv4_csum(&h_outer.ip);
                       ^~~~~~~~~~
1 warning generated.

Cc: Alan Maguire <alan.maguire@oracle.com>
Cc: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Fixes: 166b5a7f2ca3 ("selftests_bpf: extend test_tc_tunnel for UDP encap")
Signed-off-by: Stanislav Fomichev <sdf@google.com>
---
 tools/testing/selftests/bpf/progs/test_tc_tunnel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/bpf/progs/test_tc_tunnel.c b/tools/testing/selftests/bpf/progs/test_tc_tunnel.c
index bcb00d737e95..ab56a6a72b7a 100644
--- a/tools/testing/selftests/bpf/progs/test_tc_tunnel.c
+++ b/tools/testing/selftests/bpf/progs/test_tc_tunnel.c
@@ -157,7 +157,7 @@ static __always_inline int encap_ipv4(struct __sk_buff *skb, __u8 encap_proto,
 				       bpf_ntohs(h_outer.ip.tot_len));
 	h_outer.ip.protocol = encap_proto;
 
-	set_ipv4_csum(&h_outer.ip);
+	set_ipv4_csum((void *)&h_outer.ip);
 
 	/* store new outer network header */
 	if (bpf_skb_store_bytes(skb, ETH_HLEN, &h_outer, olen,
-- 
2.21.0.392.gf8f6787159e-goog


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

* Re: [PATCH bpf-next] selftests/bpf: bring back (void *) cast to set_ipv4_csum in test_tc_tunnel
  2019-04-11 22:53 [PATCH bpf-next] selftests/bpf: bring back (void *) cast to set_ipv4_csum in test_tc_tunnel Stanislav Fomichev
@ 2019-04-12  6:01 ` Song Liu
  2019-04-12  6:32   ` Alan Maguire
  2019-04-16  8:27 ` Daniel Borkmann
  1 sibling, 1 reply; 4+ messages in thread
From: Song Liu @ 2019-04-12  6:01 UTC (permalink / raw)
  To: Stanislav Fomichev
  Cc: Networking, bpf, David S . Miller, Alexei Starovoitov,
	Daniel Borkmann, Alan Maguire, Willem de Bruijn

On Thu, Apr 11, 2019 at 4:08 PM Stanislav Fomichev <sdf@google.com> wrote:
>
> It was removed in commit 166b5a7f2ca3 ("selftests_bpf: extend
> test_tc_tunnel for UDP encap") without any explanation.
>
> Otherwise I see:
> progs/test_tc_tunnel.c:160:17: warning: taking address of packed member 'ip' of class or structure
>       'v4hdr' may result in an unaligned pointer value [-Waddress-of-packed-member]
>         set_ipv4_csum(&h_outer.ip);
>                        ^~~~~~~~~~
> 1 warning generated.
>
> Cc: Alan Maguire <alan.maguire@oracle.com>
> Cc: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
> Fixes: 166b5a7f2ca3 ("selftests_bpf: extend test_tc_tunnel for UDP encap")
> Signed-off-by: Stanislav Fomichev <sdf@google.com>

Acked-by: Song Liu <songliubraving@fb.com>

> ---
>  tools/testing/selftests/bpf/progs/test_tc_tunnel.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/bpf/progs/test_tc_tunnel.c b/tools/testing/selftests/bpf/progs/test_tc_tunnel.c
> index bcb00d737e95..ab56a6a72b7a 100644
> --- a/tools/testing/selftests/bpf/progs/test_tc_tunnel.c
> +++ b/tools/testing/selftests/bpf/progs/test_tc_tunnel.c
> @@ -157,7 +157,7 @@ static __always_inline int encap_ipv4(struct __sk_buff *skb, __u8 encap_proto,
>                                        bpf_ntohs(h_outer.ip.tot_len));
>         h_outer.ip.protocol = encap_proto;
>
> -       set_ipv4_csum(&h_outer.ip);
> +       set_ipv4_csum((void *)&h_outer.ip);
>
>         /* store new outer network header */
>         if (bpf_skb_store_bytes(skb, ETH_HLEN, &h_outer, olen,
> --
> 2.21.0.392.gf8f6787159e-goog
>

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

* Re: [PATCH bpf-next] selftests/bpf: bring back (void *) cast to set_ipv4_csum in test_tc_tunnel
  2019-04-12  6:01 ` Song Liu
@ 2019-04-12  6:32   ` Alan Maguire
  0 siblings, 0 replies; 4+ messages in thread
From: Alan Maguire @ 2019-04-12  6:32 UTC (permalink / raw)
  To: Song Liu
  Cc: Stanislav Fomichev, Networking, bpf, David S . Miller,
	Alexei Starovoitov, Daniel Borkmann, Alan Maguire,
	Willem de Bruijn

On Thu, 11 Apr 2019, Song Liu wrote:

> On Thu, Apr 11, 2019 at 4:08 PM Stanislav Fomichev <sdf@google.com> wrote:
> >
> > It was removed in commit 166b5a7f2ca3 ("selftests_bpf: extend
> > test_tc_tunnel for UDP encap") without any explanation.
> >
> > Otherwise I see:
> > progs/test_tc_tunnel.c:160:17: warning: taking address of packed member 'ip' of class or structure
> >       'v4hdr' may result in an unaligned pointer value [-Waddress-of-packed-member]
> >         set_ipv4_csum(&h_outer.ip);
> >                        ^~~~~~~~~~
> > 1 warning generated.
> >
> > Cc: Alan Maguire <alan.maguire@oracle.com>
> > Cc: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
> > Fixes: 166b5a7f2ca3 ("selftests_bpf: extend test_tc_tunnel for UDP encap")
> > Signed-off-by: Stanislav Fomichev <sdf@google.com>
> 
> Acked-by: Song Liu <songliubraving@fb.com>
>

Thanks for fixing this Stanislav!

Reviewed-by: Alan Maguire <alan.maguire@oracle.com> 

> > ---
> >  tools/testing/selftests/bpf/progs/test_tc_tunnel.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/tools/testing/selftests/bpf/progs/test_tc_tunnel.c b/tools/testing/selftests/bpf/progs/test_tc_tunnel.c
> > index bcb00d737e95..ab56a6a72b7a 100644
> > --- a/tools/testing/selftests/bpf/progs/test_tc_tunnel.c
> > +++ b/tools/testing/selftests/bpf/progs/test_tc_tunnel.c
> > @@ -157,7 +157,7 @@ static __always_inline int encap_ipv4(struct __sk_buff *skb, __u8 encap_proto,
> >                                        bpf_ntohs(h_outer.ip.tot_len));
> >         h_outer.ip.protocol = encap_proto;
> >
> > -       set_ipv4_csum(&h_outer.ip);
> > +       set_ipv4_csum((void *)&h_outer.ip);
> >
> >         /* store new outer network header */
> >         if (bpf_skb_store_bytes(skb, ETH_HLEN, &h_outer, olen,
> > --
> > 2.21.0.392.gf8f6787159e-goog
> >
> 

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

* Re: [PATCH bpf-next] selftests/bpf: bring back (void *) cast to set_ipv4_csum in test_tc_tunnel
  2019-04-11 22:53 [PATCH bpf-next] selftests/bpf: bring back (void *) cast to set_ipv4_csum in test_tc_tunnel Stanislav Fomichev
  2019-04-12  6:01 ` Song Liu
@ 2019-04-16  8:27 ` Daniel Borkmann
  1 sibling, 0 replies; 4+ messages in thread
From: Daniel Borkmann @ 2019-04-16  8:27 UTC (permalink / raw)
  To: Stanislav Fomichev, netdev, bpf
  Cc: davem, ast, Alan Maguire, Willem de Bruijn

On 04/12/2019 12:53 AM, Stanislav Fomichev wrote:
> It was removed in commit 166b5a7f2ca3 ("selftests_bpf: extend
> test_tc_tunnel for UDP encap") without any explanation.
> 
> Otherwise I see:
> progs/test_tc_tunnel.c:160:17: warning: taking address of packed member 'ip' of class or structure
>       'v4hdr' may result in an unaligned pointer value [-Waddress-of-packed-member]
>         set_ipv4_csum(&h_outer.ip);
>                        ^~~~~~~~~~
> 1 warning generated.
> 
> Cc: Alan Maguire <alan.maguire@oracle.com>
> Cc: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
> Fixes: 166b5a7f2ca3 ("selftests_bpf: extend test_tc_tunnel for UDP encap")
> Signed-off-by: Stanislav Fomichev <sdf@google.com>

Applied, thanks!

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

end of thread, other threads:[~2019-04-16  8:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-11 22:53 [PATCH bpf-next] selftests/bpf: bring back (void *) cast to set_ipv4_csum in test_tc_tunnel Stanislav Fomichev
2019-04-12  6:01 ` Song Liu
2019-04-12  6:32   ` Alan Maguire
2019-04-16  8:27 ` 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.