Skip to content

Commit 9a9dffc

Browse files
pmachatadavem330
authored andcommitted
selftests: mlxsw: qos_dscp_router: Test no DSCP rewrite after pedit
When DSCP is updated through an offloaded pedit action, DSCP rewrite on egress should be disabled. Add a test that check that it is so. Signed-off-by: Petr Machata <[email protected]> Signed-off-by: Ido Schimmel <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 226657b commit 9a9dffc

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

tools/testing/selftests/drivers/net/mlxsw/qos_dscp_router.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ ALL_TESTS="
3131
ping_ipv4
3232
test_update
3333
test_no_update
34+
test_pedit_norewrite
3435
test_dscp_leftover
3536
"
3637

@@ -56,6 +57,11 @@ zero()
5657
echo 0
5758
}
5859

60+
three()
61+
{
62+
echo 3
63+
}
64+
5965
h1_create()
6066
{
6167
simple_if_init $h1 192.0.2.1/28
@@ -103,6 +109,9 @@ switch_create()
103109
simple_if_init $swp1 192.0.2.2/28
104110
__simple_if_init $swp2 v$swp1 192.0.2.17/28
105111

112+
tc qdisc add dev $swp1 clsact
113+
tc qdisc add dev $swp2 clsact
114+
106115
lldptool -T -i $swp1 -V APP $(dscp_map 0) >/dev/null
107116
lldptool -T -i $swp2 -V APP $(dscp_map 0) >/dev/null
108117
lldpad_app_wait_set $swp1
@@ -115,6 +124,9 @@ switch_destroy()
115124
lldptool -T -i $swp1 -V APP -d $(dscp_map 0) >/dev/null
116125
lldpad_app_wait_del
117126

127+
tc qdisc del dev $swp2 clsact
128+
tc qdisc del dev $swp1 clsact
129+
118130
__simple_if_fini $swp2 192.0.2.17/28
119131
simple_if_fini $swp1 192.0.2.2/28
120132
}
@@ -223,18 +235,36 @@ __test_update()
223235

224236
test_update()
225237
{
238+
echo "Test net.ipv4.ip_forward_update_priority=1"
226239
__test_update 1 reprioritize
227240
}
228241

229242
test_no_update()
230243
{
244+
echo "Test net.ipv4.ip_forward_update_priority=0"
231245
__test_update 0 echo
232246
}
233247

248+
# Test that when DSCP is updated in pedit, the DSCP rewrite is turned off.
249+
test_pedit_norewrite()
250+
{
251+
echo "Test no DSCP rewrite after DSCP is updated by pedit"
252+
253+
tc filter add dev $swp1 ingress handle 101 pref 1 prot ip flower \
254+
action pedit ex munge ip dsfield set $((3 << 2)) retain 0xfc \
255+
action skbedit priority 3
256+
257+
__test_update 0 three
258+
259+
tc filter del dev $swp1 ingress pref 1
260+
}
261+
234262
# Test that when the last APP rule is removed, the prio->DSCP map is properly
235263
# set to zeroes, and that the last APP rule does not stay active in the ASIC.
236264
test_dscp_leftover()
237265
{
266+
echo "Test that last removed DSCP rule is deconfigured correctly"
267+
238268
lldptool -T -i $swp2 -V APP -d $(dscp_map 0) >/dev/null
239269
lldpad_app_wait_del
240270

0 commit comments

Comments
 (0)