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

2016-04-06 Thread David Miller
From: "Naveen N. Rao" 
Date: Tue,  5 Apr 2016 15:32:54 +0530

> Unsigned Jump-if-Greater-Than.
> 
> Cc: Alexei Starovoitov 
> Cc: Daniel Borkmann 
> Cc: "David S. Miller" 
> Cc: Ananth N Mavinakayanahalli 
> Cc: Michael Ellerman 
> Cc: Paul Mackerras 
> Signed-off-by: Naveen N. Rao 

Applied.


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

2016-04-05 Thread Daniel Borkmann

On 04/05/2016 12:02 PM, Naveen N. Rao wrote:

Unsigned Jump-if-Greater-Than.

Cc: Alexei Starovoitov 
Cc: Daniel Borkmann 
Cc: "David S. Miller" 
Cc: Ananth N Mavinakayanahalli 
Cc: Michael Ellerman 
Cc: Paul Mackerras 
Signed-off-by: Naveen N. Rao 


Acked-by: Daniel Borkmann 


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

2016-04-05 Thread Naveen N. Rao
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 
> >Cc: Daniel Borkmann 
> >Cc: "David S. Miller" 
> >Cc: Ananth N Mavinakayanahalli 
> >Cc: Michael Ellerman 
> >Cc: Paul Mackerras 
> >Signed-off-by: Naveen N. Rao 
> 
> I think some of the tests already cover it, but extra tests are
> always great.
> Acked-by: Alexei Starovoitov 
> 
> 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



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

2016-04-05 Thread Alexei Starovoitov

On 4/5/16 3:02 AM, Naveen N. Rao wrote:

Unsigned Jump-if-Greater-Than.

Cc: Alexei Starovoitov 
Cc: Daniel Borkmann 
Cc: "David S. Miller" 
Cc: Ananth N Mavinakayanahalli 
Cc: Michael Ellerman 
Cc: Paul Mackerras 
Signed-off-by: Naveen N. Rao 


I think some of the tests already cover it, but extra tests are
always great.
Acked-by: Alexei Starovoitov 

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!



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

2016-04-05 Thread Naveen N. Rao
Unsigned Jump-if-Greater-Than.

Cc: Alexei Starovoitov 
Cc: Daniel Borkmann 
Cc: "David S. Miller" 
Cc: Ananth N Mavinakayanahalli 
Cc: Michael Ellerman 
Cc: Paul Mackerras 
Signed-off-by: Naveen N. Rao 
---
 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