bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Fastabend <john.fastabend@gmail.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>, davem@davemloft.net
Cc: daniel@iogearbox.net, netdev@vger.kernel.org,
	bpf@vger.kernel.org, kernel-team@fb.com
Subject: RE: [PATCH v2 bpf-next 2/3] selftests/bpf: Add skb_pkt_end test
Date: Thu, 12 Nov 2020 11:19:54 -0800	[thread overview]
Message-ID: <5fad8adaa7c5d_2a6120828@john-XPS-13-9370.notmuch> (raw)
In-Reply-To: <20201111031213.25109-3-alexei.starovoitov@gmail.com>

Alexei Starovoitov wrote:
> From: Alexei Starovoitov <ast@kernel.org>
> 
> Add a test that currently makes LLVM generate assembly code:
> 
> $ llvm-objdump -S skb_pkt_end.o
> 0000000000000000 <main_prog>:
> ; 	if (skb_shorter(skb, ETH_IPV4_TCP_SIZE))
>        0:	61 12 50 00 00 00 00 00	r2 = *(u32 *)(r1 + 80)
>        1:	61 14 4c 00 00 00 00 00	r4 = *(u32 *)(r1 + 76)
>        2:	bf 43 00 00 00 00 00 00	r3 = r4
>        3:	07 03 00 00 36 00 00 00	r3 += 54
>        4:	b7 01 00 00 00 00 00 00	r1 = 0
>        5:	2d 23 02 00 00 00 00 00	if r3 > r2 goto +2 <LBB0_2>
>        6:	07 04 00 00 0e 00 00 00	r4 += 14
> ; 	if (skb_shorter(skb, ETH_IPV4_TCP_SIZE))
>        7:	bf 41 00 00 00 00 00 00	r1 = r4
> 0000000000000040 <LBB0_2>:
>        8:	b4 00 00 00 ff ff ff ff	w0 = -1
> ; 	if (!(ip = get_iphdr(skb)))
>        9:	2d 23 05 00 00 00 00 00	if r3 > r2 goto +5 <LBB0_6>
> ; 	proto = ip->protocol;
>       10:	71 12 09 00 00 00 00 00	r2 = *(u8 *)(r1 + 9)
> ; 	if (proto != IPPROTO_TCP)
>       11:	56 02 03 00 06 00 00 00	if w2 != 6 goto +3 <LBB0_6>
> ; 	if (tcp->dest != 0)
>       12:	69 12 16 00 00 00 00 00	r2 = *(u16 *)(r1 + 22)
>       13:	56 02 01 00 00 00 00 00	if w2 != 0 goto +1 <LBB0_6>
> ; 	return tcp->urg_ptr;
>       14:	69 10 26 00 00 00 00 00	r0 = *(u16 *)(r1 + 38)
> 0000000000000078 <LBB0_6>:
> ; }
>       15:	95 00 00 00 00 00 00 00	exit
> 
> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
> ---

Acked-by: John Fastabend <john.fastabend@gmail.com>

  reply	other threads:[~2020-11-12 19:20 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-11  3:12 [PATCH v2 bpf-next 0/3] bpf: Pointers beyond packet end Alexei Starovoitov
2020-11-11  3:12 ` [PATCH v2 bpf-next 1/3] bpf: Support for pointers beyond pkt_end Alexei Starovoitov
2020-11-12 19:16   ` John Fastabend
2020-11-12 23:56     ` Daniel Borkmann
2020-11-13  0:09       ` Alexei Starovoitov
2020-11-13  0:50         ` Daniel Borkmann
2020-11-12 23:59     ` Alexei Starovoitov
2020-11-13  0:35       ` John Fastabend
2020-11-11  3:12 ` [PATCH v2 bpf-next 2/3] selftests/bpf: Add skb_pkt_end test Alexei Starovoitov
2020-11-12 19:19   ` John Fastabend [this message]
2020-11-11  3:12 ` [PATCH v2 bpf-next 3/3] selftests/bpf: Add asm tests for pkt vs pkt_end comparison Alexei Starovoitov
2020-11-12 19:24   ` John Fastabend
2021-01-20 20:51   ` Jiri Olsa
2020-11-13  0:50 ` [PATCH v2 bpf-next 0/3] bpf: Pointers beyond packet end patchwork-bot+netdevbpf

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=5fad8adaa7c5d_2a6120828@john-XPS-13-9370.notmuch \
    --to=john.fastabend@gmail.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=kernel-team@fb.com \
    --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).