Skip to content

Commit 6867b17

Browse files
Denis Kirjanovdavem330
authored andcommitted
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: Denis Kirjanov <kda@linux-powerpc.org> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent aae68bc commit 6867b17

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lib/test_bpf.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ static struct bpf_test tests[] = {
124124
{ { 0, 0xfffffffd } }
125125
},
126126
{
127-
"DIV_KX",
127+
"DIV_MOD_KX",
128128
.u.insns = {
129129
BPF_STMT(BPF_LD | BPF_IMM, 8),
130130
BPF_STMT(BPF_ALU | BPF_DIV | BPF_K, 2),
@@ -134,12 +134,18 @@ static struct bpf_test tests[] = {
134134
BPF_STMT(BPF_MISC | BPF_TAX, 0),
135135
BPF_STMT(BPF_LD | BPF_IMM, 0xffffffff),
136136
BPF_STMT(BPF_ALU | BPF_DIV | BPF_K, 0x70000000),
137+
BPF_STMT(BPF_MISC | BPF_TAX, 0),
138+
BPF_STMT(BPF_LD | BPF_IMM, 0xffffffff),
139+
BPF_STMT(BPF_ALU | BPF_MOD | BPF_X, 0),
140+
BPF_STMT(BPF_MISC | BPF_TAX, 0),
141+
BPF_STMT(BPF_LD | BPF_IMM, 0xffffffff),
142+
BPF_STMT(BPF_ALU | BPF_MOD | BPF_K, 0x70000000),
137143
BPF_STMT(BPF_ALU | BPF_ADD | BPF_X, 0),
138144
BPF_STMT(BPF_RET | BPF_A, 0)
139145
},
140146
CLASSIC | FLAG_NO_DATA,
141147
{ },
142-
{ { 0, 0x40000001 } }
148+
{ { 0, 0x20000000 } }
143149
},
144150
{
145151
"AND_OR_LSH_K",

0 commit comments

Comments
 (0)