Skip to content

Commit 1cc3462

Browse files
committed
selftests: openvswitch: don't hardcode the drop reason subsys
WiFi removed one of their subsys entries from drop reasons, in commit 286e696 ("wifi: mac80211: Drop cooked monitor support") SKB_DROP_REASON_SUBSYS_OPENVSWITCH is now 2 not 3. The drop reasons are not uAPI, read the correct value from debug info. We need to enable vmlinux BTF, otherwise pahole needs a few GB of memory to decode the enum name. Acked-by: Stanislav Fomichev <[email protected]> Acked-by: Aaron Conole <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent a202dfe commit 1cc3462

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

tools/testing/selftests/net/config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ CONFIG_DUMMY=y
1818
CONFIG_BRIDGE_VLAN_FILTERING=y
1919
CONFIG_BRIDGE=y
2020
CONFIG_CRYPTO_CHACHA20POLY1305=m
21+
CONFIG_DEBUG_INFO_BTF=y
22+
CONFIG_DEBUG_INFO_BTF_MODULES=n
2123
CONFIG_VLAN_8021Q=y
2224
CONFIG_GENEVE=m
2325
CONFIG_IFB=y

tools/testing/selftests/net/openvswitch/openvswitch.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,11 @@ test_psample() {
330330
# - drop packets and verify the right drop reason is reported
331331
test_drop_reason() {
332332
which perf >/dev/null 2>&1 || return $ksft_skip
333+
which pahole >/dev/null 2>&1 || return $ksft_skip
334+
335+
ovs_drop_subsys=$(pahole -C skb_drop_reason_subsys |
336+
awk '/OPENVSWITCH/ { print $3; }' |
337+
tr -d ,)
333338

334339
sbx_add "test_drop_reason" || return $?
335340

@@ -373,7 +378,7 @@ test_drop_reason() {
373378
"in_port(2),eth(),eth_type(0x0800),ipv4(src=172.31.110.20,proto=1),icmp()" 'drop'
374379

375380
ovs_drop_record_and_run "test_drop_reason" ip netns exec client ping -c 2 172.31.110.20
376-
ovs_drop_reason_count 0x30001 # OVS_DROP_FLOW_ACTION
381+
ovs_drop_reason_count 0x${ovs_drop_subsys}0001 # OVS_DROP_FLOW_ACTION
377382
if [[ "$?" -ne "2" ]]; then
378383
info "Did not detect expected drops: $?"
379384
return 1
@@ -390,15 +395,15 @@ test_drop_reason() {
390395

391396
ovs_drop_record_and_run \
392397
"test_drop_reason" ip netns exec client nc -i 1 -zuv 172.31.110.20 6000
393-
ovs_drop_reason_count 0x30004 # OVS_DROP_EXPLICIT_ACTION_ERROR
398+
ovs_drop_reason_count 0x${ovs_drop_subsys}0004 # OVS_DROP_EXPLICIT_ACTION_ERROR
394399
if [[ "$?" -ne "1" ]]; then
395400
info "Did not detect expected explicit error drops: $?"
396401
return 1
397402
fi
398403

399404
ovs_drop_record_and_run \
400405
"test_drop_reason" ip netns exec client nc -i 1 -zuv 172.31.110.20 7000
401-
ovs_drop_reason_count 0x30003 # OVS_DROP_EXPLICIT_ACTION
406+
ovs_drop_reason_count 0x${ovs_drop_subsys}0003 # OVS_DROP_EXPLICIT_ACTION
402407
if [[ "$?" -ne "1" ]]; then
403408
info "Did not detect expected explicit drops: $?"
404409
return 1

0 commit comments

Comments
 (0)