netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] selftests: openvswitch: don't hardcode the drop reason subsys
@ 2025-03-04 18:06 Jakub Kicinski
  2025-03-05  0:17 ` Stanislav Fomichev
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jakub Kicinski @ 2025-03-04 18:06 UTC (permalink / raw)
  To: davem
  Cc: netdev, edumazet, pabeni, andrew+netdev, horms, Jakub Kicinski,
	shuah, pshelar, aconole, amorenoz, linux-kselftest, dev

WiFi removed one of their subsys entries from drop reasons, in
commit 286e69677065 ("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.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: shuah@kernel.org
CC: pshelar@ovn.org
CC: aconole@redhat.com
CC: amorenoz@redhat.com
CC: linux-kselftest@vger.kernel.org
CC: dev@openvswitch.org
---
 tools/testing/selftests/net/config                    |  2 ++
 .../testing/selftests/net/openvswitch/openvswitch.sh  | 11 ++++++++---
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/net/config b/tools/testing/selftests/net/config
index 5b9baf708950..3365bcc35304 100644
--- a/tools/testing/selftests/net/config
+++ b/tools/testing/selftests/net/config
@@ -18,6 +18,8 @@ CONFIG_DUMMY=y
 CONFIG_BRIDGE_VLAN_FILTERING=y
 CONFIG_BRIDGE=y
 CONFIG_CRYPTO_CHACHA20POLY1305=m
+CONFIG_DEBUG_INFO_BTF=y
+CONFIG_DEBUG_INFO_BTF_MODULES=n
 CONFIG_VLAN_8021Q=y
 CONFIG_GENEVE=m
 CONFIG_IFB=y
diff --git a/tools/testing/selftests/net/openvswitch/openvswitch.sh b/tools/testing/selftests/net/openvswitch/openvswitch.sh
index 960e1ab4dd04..3c8d3455d8e7 100755
--- a/tools/testing/selftests/net/openvswitch/openvswitch.sh
+++ b/tools/testing/selftests/net/openvswitch/openvswitch.sh
@@ -330,6 +330,11 @@ 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 ,)
 
 	sbx_add "test_drop_reason" || return $?
 
@@ -373,7 +378,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 0x30001 # OVS_DROP_FLOW_ACTION
+	ovs_drop_reason_count 0x${ovs_drop_subsys}0001 # OVS_DROP_FLOW_ACTION
 	if [[ "$?" -ne "2" ]]; then
 		info "Did not detect expected drops: $?"
 		return 1
@@ -390,7 +395,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 0x30004 # OVS_DROP_EXPLICIT_ACTION_ERROR
+	ovs_drop_reason_count 0x${ovs_drop_subsys}0004 # OVS_DROP_EXPLICIT_ACTION_ERROR
 	if [[ "$?" -ne "1" ]]; then
 		info "Did not detect expected explicit error drops: $?"
 		return 1
@@ -398,7 +403,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 0x30003 # OVS_DROP_EXPLICIT_ACTION
+	ovs_drop_reason_count 0x${ovs_drop_subsys}0003 # OVS_DROP_EXPLICIT_ACTION
 	if [[ "$?" -ne "1" ]]; then
 		info "Did not detect expected explicit drops: $?"
 		return 1
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] selftests: openvswitch: don't hardcode the drop reason subsys
  2025-03-04 18:06 [PATCH net-next] selftests: openvswitch: don't hardcode the drop reason subsys Jakub Kicinski
@ 2025-03-05  0:17 ` Stanislav Fomichev
  2025-03-05  0:48 ` [ovs-dev] " Aaron Conole
  2025-03-07  1:00 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Stanislav Fomichev @ 2025-03-05  0:17 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: davem, netdev, edumazet, pabeni, andrew+netdev, horms, shuah,
	pshelar, aconole, amorenoz, linux-kselftest, dev

On 03/04, Jakub Kicinski wrote:
> WiFi removed one of their subsys entries from drop reasons, in
> commit 286e69677065 ("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.
> 
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Acked-by: Stanislav Fomichev <sdf@fomichev.me>

Might have resolved OVS_DROP_FLOW_ACTION and the rest as well via
pahole, but assuming these won't be reordered/removed too often..

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [ovs-dev] [PATCH net-next] selftests: openvswitch: don't hardcode the drop reason subsys
  2025-03-04 18:06 [PATCH net-next] selftests: openvswitch: don't hardcode the drop reason subsys Jakub Kicinski
  2025-03-05  0:17 ` Stanislav Fomichev
@ 2025-03-05  0:48 ` Aaron Conole
  2025-03-07  1:00 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Aaron Conole @ 2025-03-05  0:48 UTC (permalink / raw)
  To: Jakub Kicinski via dev
  Cc: davem, Jakub Kicinski, dev, linux-kselftest, netdev,
	andrew+netdev, edumazet, horms, pabeni, shuah

Jakub Kicinski via dev <ovs-dev@openvswitch.org> writes:

> WiFi removed one of their subsys entries from drop reasons, in
> commit 286e69677065 ("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.
>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
> CC: shuah@kernel.org
> CC: pshelar@ovn.org
> CC: aconole@redhat.com
> CC: amorenoz@redhat.com
> CC: linux-kselftest@vger.kernel.org
> CC: dev@openvswitch.org
> ---

Acked-by: Aaron Conole <aconole@redhat.com>

Thanks for the fix!

>  tools/testing/selftests/net/config                    |  2 ++
>  .../testing/selftests/net/openvswitch/openvswitch.sh  | 11 ++++++++---
>  2 files changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/tools/testing/selftests/net/config b/tools/testing/selftests/net/config
> index 5b9baf708950..3365bcc35304 100644
> --- a/tools/testing/selftests/net/config
> +++ b/tools/testing/selftests/net/config
> @@ -18,6 +18,8 @@ CONFIG_DUMMY=y
>  CONFIG_BRIDGE_VLAN_FILTERING=y
>  CONFIG_BRIDGE=y
>  CONFIG_CRYPTO_CHACHA20POLY1305=m
> +CONFIG_DEBUG_INFO_BTF=y
> +CONFIG_DEBUG_INFO_BTF_MODULES=n
>  CONFIG_VLAN_8021Q=y
>  CONFIG_GENEVE=m
>  CONFIG_IFB=y
> diff --git a/tools/testing/selftests/net/openvswitch/openvswitch.sh b/tools/testing/selftests/net/openvswitch/openvswitch.sh
> index 960e1ab4dd04..3c8d3455d8e7 100755
> --- a/tools/testing/selftests/net/openvswitch/openvswitch.sh
> +++ b/tools/testing/selftests/net/openvswitch/openvswitch.sh
> @@ -330,6 +330,11 @@ 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 ,)
>  
>  	sbx_add "test_drop_reason" || return $?
>  
> @@ -373,7 +378,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 0x30001 # OVS_DROP_FLOW_ACTION
> +	ovs_drop_reason_count 0x${ovs_drop_subsys}0001 # OVS_DROP_FLOW_ACTION
>  	if [[ "$?" -ne "2" ]]; then
>  		info "Did not detect expected drops: $?"
>  		return 1
> @@ -390,7 +395,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 0x30004 # OVS_DROP_EXPLICIT_ACTION_ERROR
> +	ovs_drop_reason_count 0x${ovs_drop_subsys}0004 # OVS_DROP_EXPLICIT_ACTION_ERROR
>  	if [[ "$?" -ne "1" ]]; then
>  		info "Did not detect expected explicit error drops: $?"
>  		return 1
> @@ -398,7 +403,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 0x30003 # OVS_DROP_EXPLICIT_ACTION
> +	ovs_drop_reason_count 0x${ovs_drop_subsys}0003 # OVS_DROP_EXPLICIT_ACTION
>  	if [[ "$?" -ne "1" ]]; then
>  		info "Did not detect expected explicit drops: $?"
>  		return 1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] selftests: openvswitch: don't hardcode the drop reason subsys
  2025-03-04 18:06 [PATCH net-next] selftests: openvswitch: don't hardcode the drop reason subsys Jakub Kicinski
  2025-03-05  0:17 ` Stanislav Fomichev
  2025-03-05  0:48 ` [ovs-dev] " Aaron Conole
@ 2025-03-07  1:00 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-03-07  1:00 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: davem, netdev, edumazet, pabeni, andrew+netdev, horms, shuah,
	pshelar, aconole, amorenoz, linux-kselftest, dev

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Tue,  4 Mar 2025 10:06:15 -0800 you wrote:
> WiFi removed one of their subsys entries from drop reasons, in
> commit 286e69677065 ("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.
> 
> [...]

Here is the summary with links:
  - [net-next] selftests: openvswitch: don't hardcode the drop reason subsys
    https://git.kernel.org/netdev/net-next/c/1cc3462159ba

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-03-07  1:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-04 18:06 [PATCH net-next] selftests: openvswitch: don't hardcode the drop reason subsys Jakub Kicinski
2025-03-05  0:17 ` Stanislav Fomichev
2025-03-05  0:48 ` [ovs-dev] " Aaron Conole
2025-03-07  1:00 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).