netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] test: bpf: expand DIV_KX to DIV_MOD_KX
@ 2014-12-01 10:12 Denis Kirjanov
  2014-12-09  1:23 ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Denis Kirjanov @ 2014-12-01 10:12 UTC (permalink / raw)
  To: netdev; +Cc: Denis Kirjanov, Alexei Starovoitov

Expand DIV_KX to use BPF_MOD operation in the
DIV_KX bpf 'classic' test.

CC: Alexei Starovoitov <ast@plumgrid.com>
Signed-off-by: Denis Kirjanov <kda@linux-powerpc.org>
---
 lib/test_bpf.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/lib/test_bpf.c b/lib/test_bpf.c
index 3f167d2..80d78c5 100644
--- a/lib/test_bpf.c
+++ b/lib/test_bpf.c
@@ -124,7 +124,7 @@ static struct bpf_test tests[] = {
 		{ { 0, 0xfffffffd } }
 	},
 	{
-		"DIV_KX",
+		"DIV_MOD_KX",
 		.u.insns = {
 			BPF_STMT(BPF_LD | BPF_IMM, 8),
 			BPF_STMT(BPF_ALU | BPF_DIV | BPF_K, 2),
@@ -134,12 +134,18 @@ static struct bpf_test tests[] = {
 			BPF_STMT(BPF_MISC | BPF_TAX, 0),
 			BPF_STMT(BPF_LD | BPF_IMM, 0xffffffff),
 			BPF_STMT(BPF_ALU | BPF_DIV | BPF_K, 0x70000000),
+			BPF_STMT(BPF_MISC | BPF_TAX, 0),
+			BPF_STMT(BPF_LD | BPF_IMM, 0xffffffff),
+			BPF_STMT(BPF_ALU | BPF_MOD | BPF_X, 0),
+			BPF_STMT(BPF_MISC | BPF_TAX, 0),
+			BPF_STMT(BPF_LD | BPF_IMM, 0xffffffff),
+			BPF_STMT(BPF_ALU | BPF_MOD | BPF_K, 0x70000000),
 			BPF_STMT(BPF_ALU | BPF_ADD | BPF_X, 0),
 			BPF_STMT(BPF_RET | BPF_A, 0)
 		},
 		CLASSIC | FLAG_NO_DATA,
 		{ },
-		{ { 0, 0x40000001 } }
+		{ { 0, 0x20000000 } }
 	},
 	{
 		"AND_OR_LSH_K",
-- 
1.7.10.4

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

* Re: [PATCH net-next] test: bpf: expand DIV_KX to DIV_MOD_KX
@ 2014-12-01 17:44 Alexei Starovoitov
  0 siblings, 0 replies; 3+ messages in thread
From: Alexei Starovoitov @ 2014-12-01 17:44 UTC (permalink / raw)
  To: Denis Kirjanov, Daniel Borkmann; +Cc: Network Development

On Mon, Dec 1, 2014 at 2:12 AM, Denis Kirjanov <kda@linux-powerpc.org> wrote:
> Expand DIV_KX to use BPF_MOD operation in the
> DIV_KX bpf 'classic' test.
>
> CC: Alexei Starovoitov <ast@plumgrid.com>
> Signed-off-by: Denis Kirjanov <kda@linux-powerpc.org>

Increases test coverage. Makes sense. Thanks
Acked-by: Alexei Starovoitov <ast@plumgrid.com>

> ---
>  lib/test_bpf.c |   10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/lib/test_bpf.c b/lib/test_bpf.c
> index 3f167d2..80d78c5 100644
> --- a/lib/test_bpf.c
> +++ b/lib/test_bpf.c
> @@ -124,7 +124,7 @@ static struct bpf_test tests[] = {
>                 { { 0, 0xfffffffd } }
>         },
>         {
> -               "DIV_KX",
> +               "DIV_MOD_KX",
>                 .u.insns = {
>                         BPF_STMT(BPF_LD | BPF_IMM, 8),
>                         BPF_STMT(BPF_ALU | BPF_DIV | BPF_K, 2),
> @@ -134,12 +134,18 @@ static struct bpf_test tests[] = {
>                         BPF_STMT(BPF_MISC | BPF_TAX, 0),
>                         BPF_STMT(BPF_LD | BPF_IMM, 0xffffffff),
>                         BPF_STMT(BPF_ALU | BPF_DIV | BPF_K, 0x70000000),
> +                       BPF_STMT(BPF_MISC | BPF_TAX, 0),
> +                       BPF_STMT(BPF_LD | BPF_IMM, 0xffffffff),
> +                       BPF_STMT(BPF_ALU | BPF_MOD | BPF_X, 0),
> +                       BPF_STMT(BPF_MISC | BPF_TAX, 0),
> +                       BPF_STMT(BPF_LD | BPF_IMM, 0xffffffff),
> +                       BPF_STMT(BPF_ALU | BPF_MOD | BPF_K, 0x70000000),
>                         BPF_STMT(BPF_ALU | BPF_ADD | BPF_X, 0),
>                         BPF_STMT(BPF_RET | BPF_A, 0)
>                 },
>                 CLASSIC | FLAG_NO_DATA,
>                 { },
> -               { { 0, 0x40000001 } }
> +               { { 0, 0x20000000 } }
>         },
>         {
>                 "AND_OR_LSH_K",
> --
> 1.7.10.4
>

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

* Re: [PATCH net-next] test: bpf: expand DIV_KX to DIV_MOD_KX
  2014-12-01 10:12 [PATCH net-next] test: bpf: expand DIV_KX to DIV_MOD_KX Denis Kirjanov
@ 2014-12-09  1:23 ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2014-12-09  1:23 UTC (permalink / raw)
  To: kda; +Cc: netdev, ast

From: Denis Kirjanov <kda@linux-powerpc.org>
Date: Mon,  1 Dec 2014 13:12:25 +0300

> Expand DIV_KX to use BPF_MOD operation in the
> DIV_KX bpf 'classic' test.
> 
> CC: Alexei Starovoitov <ast@plumgrid.com>
> Signed-off-by: Denis Kirjanov <kda@linux-powerpc.org>

Applied, thanks.

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

end of thread, other threads:[~2014-12-09  1:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-01 10:12 [PATCH net-next] test: bpf: expand DIV_KX to DIV_MOD_KX Denis Kirjanov
2014-12-09  1:23 ` David Miller
  -- strict thread matches above, loose matches on Subject: below --
2014-12-01 17:44 Alexei Starovoitov

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