Commit 6867b17b authored by Denis Kirjanov's avatar Denis Kirjanov Committed by David S. Miller

test: bpf: expand DIV_KX to DIV_MOD_KX

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

CC: Alexei Starovoitov <ast@plumgrid.com>
Signed-off-by: default avatarDenis Kirjanov <kda@linux-powerpc.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent aae68bc6
...@@ -124,7 +124,7 @@ static struct bpf_test tests[] = { ...@@ -124,7 +124,7 @@ static struct bpf_test tests[] = {
{ { 0, 0xfffffffd } } { { 0, 0xfffffffd } }
}, },
{ {
"DIV_KX", "DIV_MOD_KX",
.u.insns = { .u.insns = {
BPF_STMT(BPF_LD | BPF_IMM, 8), BPF_STMT(BPF_LD | BPF_IMM, 8),
BPF_STMT(BPF_ALU | BPF_DIV | BPF_K, 2), BPF_STMT(BPF_ALU | BPF_DIV | BPF_K, 2),
...@@ -134,12 +134,18 @@ static struct bpf_test tests[] = { ...@@ -134,12 +134,18 @@ static struct bpf_test tests[] = {
BPF_STMT(BPF_MISC | BPF_TAX, 0), BPF_STMT(BPF_MISC | BPF_TAX, 0),
BPF_STMT(BPF_LD | BPF_IMM, 0xffffffff), BPF_STMT(BPF_LD | BPF_IMM, 0xffffffff),
BPF_STMT(BPF_ALU | BPF_DIV | BPF_K, 0x70000000), 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_ALU | BPF_ADD | BPF_X, 0),
BPF_STMT(BPF_RET | BPF_A, 0) BPF_STMT(BPF_RET | BPF_A, 0)
}, },
CLASSIC | FLAG_NO_DATA, CLASSIC | FLAG_NO_DATA,
{ }, { },
{ { 0, 0x40000001 } } { { 0, 0x20000000 } }
}, },
{ {
"AND_OR_LSH_K", "AND_OR_LSH_K",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment