Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1371368 > unrolled thread

[PATCH net 2/4] lib/test_bpf: Add tests for unsigned BPF_JGT

Started by"Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>
First post2016-04-05 12:10 +0200
Last post2016-04-06 22:50 +0200
Articles 5 — 4 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH net 2/4] lib/test_bpf: Add tests for unsigned BPF_JGT "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> - 2016-04-05 12:10 +0200
    Re: [PATCH net 2/4] lib/test_bpf: Add tests for unsigned BPF_JGT Alexei Starovoitov <ast@fb.com> - 2016-04-05 18:30 +0200
      Re: [PATCH net 2/4] lib/test_bpf: Add tests for unsigned BPF_JGT "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com> - 2016-04-05 19:00 +0200
    Re: [PATCH net 2/4] lib/test_bpf: Add tests for unsigned BPF_JGT Daniel Borkmann <daniel@iogearbox.net> - 2016-04-05 21:40 +0200
    Re: [PATCH net 2/4] lib/test_bpf: Add tests for unsigned BPF_JGT David Miller <davem@davemloft.net> - 2016-04-06 22:50 +0200

#1371368 — [PATCH net 2/4] lib/test_bpf: Add tests for unsigned BPF_JGT

From"Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>
Date2016-04-05 12:10 +0200
Subject[PATCH net 2/4] lib/test_bpf: Add tests for unsigned BPF_JGT
Message-ID<rkw5P-1sL-15@gated-at.bofh.it>
Unsigned Jump-if-Greater-Than.

Cc: Alexei Starovoitov <ast@fb.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Paul Mackerras <paulus@samba.org>
Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
---
 lib/test_bpf.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/lib/test_bpf.c b/lib/test_bpf.c
index e76fa4d..7e6fb49 100644
--- a/lib/test_bpf.c
+++ b/lib/test_bpf.c
@@ -4222,6 +4222,20 @@ static struct bpf_test tests[] = {
 		{ },
 		{ { 0, 1 } },
 	},
+	{
+		"JMP_JGT_K: Unsigned jump: if (-1 > 1) return 1",
+		.u.insns_int = {
+			BPF_ALU32_IMM(BPF_MOV, R0, 0),
+			BPF_LD_IMM64(R1, -1),
+			BPF_JMP_IMM(BPF_JGT, R1, 1, 1),
+			BPF_EXIT_INSN(),
+			BPF_ALU32_IMM(BPF_MOV, R0, 1),
+			BPF_EXIT_INSN(),
+		},
+		INTERNAL,
+		{ },
+		{ { 0, 1 } },
+	},
 	/* BPF_JMP | BPF_JGE | BPF_K */
 	{
 		"JMP_JGE_K: if (3 >= 2) return 1",
@@ -4404,6 +4418,21 @@ static struct bpf_test tests[] = {
 		{ },
 		{ { 0, 1 } },
 	},
+	{
+		"JMP_JGT_X: Unsigned jump: if (-1 > 1) return 1",
+		.u.insns_int = {
+			BPF_ALU32_IMM(BPF_MOV, R0, 0),
+			BPF_LD_IMM64(R1, -1),
+			BPF_LD_IMM64(R2, 1),
+			BPF_JMP_REG(BPF_JGT, R1, R2, 1),
+			BPF_EXIT_INSN(),
+			BPF_ALU32_IMM(BPF_MOV, R0, 1),
+			BPF_EXIT_INSN(),
+		},
+		INTERNAL,
+		{ },
+		{ { 0, 1 } },
+	},
 	/* BPF_JMP | BPF_JGE | BPF_X */
 	{
 		"JMP_JGE_X: if (3 >= 2) return 1",
-- 
2.7.4

[toc] | [next] | [standalone]


#1371776

FromAlexei Starovoitov <ast@fb.com>
Date2016-04-05 18:30 +0200
Message-ID<rkC1D-6PL-75@gated-at.bofh.it>
In reply to#1371368
On 4/5/16 3:02 AM, Naveen N. Rao wrote:
> Unsigned Jump-if-Greater-Than.
>
> Cc: Alexei Starovoitov <ast@fb.com>
> Cc: Daniel Borkmann <daniel@iogearbox.net>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Paul Mackerras <paulus@samba.org>
> Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>

I think some of the tests already cover it, but extra tests are
always great.
Acked-by: Alexei Starovoitov <ast@kernel.org>

I think the whole set belongs in net-next.
Next time you submit the patches please say [PATCH net-next] in subject.
[PATCH net] is for bugfixes only.
Thanks a bunch!

[toc] | [prev] | [next] | [standalone]


#1371790

From"Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>
Date2016-04-05 19:00 +0200
Message-ID<rkCuD-74o-23@gated-at.bofh.it>
In reply to#1371776
On 2016/04/05 09:20AM, Alexei Starovoitov wrote:
> On 4/5/16 3:02 AM, Naveen N. Rao wrote:
> >Unsigned Jump-if-Greater-Than.
> >
> >Cc: Alexei Starovoitov <ast@fb.com>
> >Cc: Daniel Borkmann <daniel@iogearbox.net>
> >Cc: "David S. Miller" <davem@davemloft.net>
> >Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
> >Cc: Michael Ellerman <mpe@ellerman.id.au>
> >Cc: Paul Mackerras <paulus@samba.org>
> >Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
> 
> I think some of the tests already cover it, but extra tests are
> always great.
> Acked-by: Alexei Starovoitov <ast@kernel.org>
> 
> I think the whole set belongs in net-next.
> Next time you submit the patches please say [PATCH net-next] in subject.
> [PATCH net] is for bugfixes only.

Ah, sure. Thanks for the review!

- Naveen

[toc] | [prev] | [next] | [standalone]


#1371906

FromDaniel Borkmann <daniel@iogearbox.net>
Date2016-04-05 21:40 +0200
Message-ID<rkEZs-vr-15@gated-at.bofh.it>
In reply to#1371368
On 04/05/2016 12:02 PM, Naveen N. Rao wrote:
> Unsigned Jump-if-Greater-Than.
>
> Cc: Alexei Starovoitov <ast@fb.com>
> Cc: Daniel Borkmann <daniel@iogearbox.net>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Paul Mackerras <paulus@samba.org>
> Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>

Acked-by: Daniel Borkmann <daniel@iogearbox.net>

[toc] | [prev] | [next] | [standalone]


#1372809

FromDavid Miller <davem@davemloft.net>
Date2016-04-06 22:50 +0200
Message-ID<rl2yK-16I-25@gated-at.bofh.it>
In reply to#1371368
From: "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>
Date: Tue,  5 Apr 2016 15:32:54 +0530

> Unsigned Jump-if-Greater-Than.
> 
> Cc: Alexei Starovoitov <ast@fb.com>
> Cc: Daniel Borkmann <daniel@iogearbox.net>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Paul Mackerras <paulus@samba.org>
> Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>

Applied.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web