Re: [PATCH v8 3/4] net: dropreason: use new __print_sym() in tracing
From: Ilya Maximets
Date: Sun Nov 22 2026 - 23:15:18 EST
On 11/19/26 4:48 PM, Johannes Berg wrote:
> From: Johannes Berg <johannes.berg@xxxxxxxxx>
>
> The __print_symbolic() could only ever print the core
> drop reasons, since that's the way the infrastructure
> works. Now that we have __print_sym() with all the
> advantages mentioned in that commit, convert to that
> and get all the drop reasons from all subsystems. As
> we already have a list of them, that's really easy.
>
> This is a little bit of .text (~100 bytes in my build)
> and saves a lot of .data (~17k).
>
> Signed-off-by: Johannes Berg <johannes.berg@xxxxxxxxx>
> ---
> v7: update the selftest accordingly
> ---
> include/net/dropreason.h | 5 +++
> include/trace/events/skb.h | 13 ++----
> net/core/skbuff.c | 43 +++++++++++++++++++
> .../selftests/net/openvswitch/openvswitch.sh | 17 ++------
> 4 files changed, 55 insertions(+), 23 deletions(-)
[...]
> diff --git a/tools/testing/selftests/net/openvswitch/openvswitch.sh b/tools/testing/selftests/net/openvswitch/openvswitch.sh
> index 21444657a040..b5dbdfb29089 100755
> --- a/tools/testing/selftests/net/openvswitch/openvswitch.sh
> +++ b/tools/testing/selftests/net/openvswitch/openvswitch.sh
> @@ -236,7 +236,7 @@ ovs_drop_reason_count()
> local reason=$1
>
> local perf_output=`perf script -i ${ovs_dir}/perf.data -F trace:event,trace`
> - local pattern="skb:kfree_skb:.*reason: $reason"
> + local pattern="skb:kfree_skb:.*reason: $reason$"
>
> return `echo "$perf_output" | grep "$pattern" | wc -l`
> }
> @@ -900,15 +900,6 @@ test_psample() {
> # - drop packets and verify the right drop reason is reported
> test_drop_reason() {
> which perf >/dev/null 2>&1 || return $ksft_skip
> - which pahole >/dev/null 2>&1 || return $ksft_skip
> -
> - ovs_drop_subsys=$(pahole -C skb_drop_reason_subsys |
> - awk '/OPENVSWITCH/ { print $3; }' |
> - tr -d ,)
> - if [ -z "$ovs_drop_subsys" ]; then
> - info "failed to get OVS drop subsys ID"
> - return $ksft_skip
> - fi
>
> sbx_add "test_drop_reason" || return $?
>
> @@ -952,7 +943,7 @@ test_drop_reason() {
> "in_port(2),eth(),eth_type(0x0800),ipv4(src=172.31.110.20,proto=1),icmp()" 'drop'
>
> ovs_drop_record_and_run "test_drop_reason" ip netns exec client ping -c 2 172.31.110.20
> - ovs_drop_reason_count 0x${ovs_drop_subsys}0001 # OVS_DROP_FLOW_ACTION
> + ovs_drop_reason_count OVS_DROP_LAST_ACTION
> if [[ "$?" -ne "2" ]]; then
> info "Did not detect expected drops: $?"
> return 1
> @@ -969,7 +960,7 @@ test_drop_reason() {
>
> ovs_drop_record_and_run \
> "test_drop_reason" ip netns exec client nc -i 1 -zuv 172.31.110.20 6000
> - ovs_drop_reason_count 0x${ovs_drop_subsys}0004 # OVS_DROP_EXPLICIT_ACTION_ERROR
> + ovs_drop_reason_count OVS_DROP_EXPLICIT_WITH_ERROR
> if [[ "$?" -ne "1" ]]; then
> info "Did not detect expected explicit error drops: $?"
> return 1
> @@ -977,7 +968,7 @@ test_drop_reason() {
>
> ovs_drop_record_and_run \
> "test_drop_reason" ip netns exec client nc -i 1 -zuv 172.31.110.20 7000
> - ovs_drop_reason_count 0x${ovs_drop_subsys}0003 # OVS_DROP_EXPLICIT_ACTION
> + ovs_drop_reason_count OVS_DROP_EXPLICIT
> if [[ "$?" -ne "1" ]]; then
> info "Did not detect expected explicit drops: $?"
> return 1
For the OVS test part:
Reviewed-by: Ilya Maximets <i.maximets@xxxxxxx>