public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Petr Machata <petrm@nvidia.com>
To: Petr Machata <petrm@nvidia.com>
Cc: Vladimir Oltean <vladimir.oltean@nxp.com>,
	<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	Michal Kubecek <mkubecek@suse.cz>,
	"Vinicius Costa Gomes" <vinicius.gomes@intel.com>,
	Xiaoliang Yang <xiaoliang.yang_1@nxp.com>,
	Kurt Kanzenbach <kurt@linutronix.de>,
	Rui Sousa <rui.sousa@nxp.com>,
	Ferenc Fejes <ferenc.fejes@ericsson.com>,
	"Pranavi Somisetty" <pranavi.somisetty@amd.com>,
	Harini Katakam <harini.katakam@amd.com>,
	<UNGLinuxDriver@microchip.com>, Ido Schimmel <idosch@nvidia.com>,
	Aaron Conole <aconole@redhat.com>
Subject: Re: [RFC PATCH net-next] selftests: forwarding: add a test for MAC Merge layer
Date: Thu, 16 Mar 2023 14:43:25 +0100	[thread overview]
Message-ID: <87ttykreky.fsf@nvidia.com> (raw)
In-Reply-To: <87y1nxq7dk.fsf@nvidia.com>


Petr Machata <petrm@nvidia.com> writes:

> Petr Machata <petrm@nvidia.com> writes:
>
>> Vladimir Oltean <vladimir.oltean@nxp.com> writes:
>>
>>> diff --git a/tools/testing/selftests/drivers/net/mlxsw/sch_tbf_ets.sh b/tools/testing/selftests/drivers/net/mlxsw/sch_tbf_ets.sh
>>> index c6ce0b448bf3..bf57400e14ee 100755
>>> --- a/tools/testing/selftests/drivers/net/mlxsw/sch_tbf_ets.sh
>>> +++ b/tools/testing/selftests/drivers/net/mlxsw/sch_tbf_ets.sh
>>> @@ -2,7 +2,7 @@
>>>  # SPDX-License-Identifier: GPL-2.0
>>>  
>>>  source qos_lib.sh
>>> -bail_on_lldpad
>>> +bail_on_lldpad "configure DCB" "configure Qdiscs"
>>
>> ... lib.sh isn't sourced at this point yet. `source
>> $lib_dir/sch_tbf_ets.sh' brings that in later in the file, so the bail
>> would need to be below that. But if it is, it won't run until after the
>> test, which is useless.

I added a shim as shown below. Comments welcome. Your patch then needs a
bit of adaptation, plus I've dropped all the now-useless imports of
qos_lib.sh. I'll pass this through our regression, and if nothing
explodes, I'll point you at a branch tomorrow, and you can make the two
patches a part of your larger patchset?

Subject: [PATCH net-next mlxsw] selftests: forwarding: sch_tbs_*: Add a
 pre-run hook

The driver-specific wrappers of these selftests invoke bail_on_lldpad to
make sure that LLDPAD doesn't trample the configuration. The function
bail_on_lldpad is going to move to lib.sh in the next patch. With that, it
won't be visible for the wrappers before sourcing the framework script. And
after sourcing it, it is too late: the selftest will have run by then.

One option might be to source NUM_NETIFS=0 lib.sh from the wrapper, but
even if that worked (it might, it might not), that seems cumbersome. lib.sh
is doing fair amount of stuff, and even if it works today, it does not look
particularly solid as a solution.

Instead, introduce a hook, sch_tbf_pre_hook(), that when available, gets
invoked. Move the bail to the hook.

Signed-off-by: Petr Machata <petrm@nvidia.com>
---
 tools/testing/selftests/drivers/net/mlxsw/sch_tbf_ets.sh  | 6 +++++-
 tools/testing/selftests/drivers/net/mlxsw/sch_tbf_prio.sh | 6 +++++-
 tools/testing/selftests/drivers/net/mlxsw/sch_tbf_root.sh | 6 +++++-
 tools/testing/selftests/net/forwarding/sch_tbf_etsprio.sh | 4 ++++
 tools/testing/selftests/net/forwarding/sch_tbf_root.sh    | 4 ++++
 5 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/drivers/net/mlxsw/sch_tbf_ets.sh b/tools/testing/selftests/drivers/net/mlxsw/sch_tbf_ets.sh
index c6ce0b448bf3..b9b4cdf14ceb 100755
--- a/tools/testing/selftests/drivers/net/mlxsw/sch_tbf_ets.sh
+++ b/tools/testing/selftests/drivers/net/mlxsw/sch_tbf_ets.sh
@@ -2,7 +2,11 @@
 # SPDX-License-Identifier: GPL-2.0
 
 source qos_lib.sh
-bail_on_lldpad
+
+sch_tbf_pre_hook()
+{
+	bail_on_lldpad
+}
 
 lib_dir=$(dirname $0)/../../../net/forwarding
 TCFLAGS=skip_sw
diff --git a/tools/testing/selftests/drivers/net/mlxsw/sch_tbf_prio.sh b/tools/testing/selftests/drivers/net/mlxsw/sch_tbf_prio.sh
index 8d245f331619..dff9810ee04f 100755
--- a/tools/testing/selftests/drivers/net/mlxsw/sch_tbf_prio.sh
+++ b/tools/testing/selftests/drivers/net/mlxsw/sch_tbf_prio.sh
@@ -2,7 +2,11 @@
 # SPDX-License-Identifier: GPL-2.0
 
 source qos_lib.sh
-bail_on_lldpad
+
+sch_tbf_pre_hook()
+{
+	bail_on_lldpad
+}
 
 lib_dir=$(dirname $0)/../../../net/forwarding
 TCFLAGS=skip_sw
diff --git a/tools/testing/selftests/drivers/net/mlxsw/sch_tbf_root.sh b/tools/testing/selftests/drivers/net/mlxsw/sch_tbf_root.sh
index 013886061f15..75406bd7036e 100755
--- a/tools/testing/selftests/drivers/net/mlxsw/sch_tbf_root.sh
+++ b/tools/testing/selftests/drivers/net/mlxsw/sch_tbf_root.sh
@@ -2,7 +2,11 @@
 # SPDX-License-Identifier: GPL-2.0
 
 source qos_lib.sh
-bail_on_lldpad
+
+sch_tbf_pre_hook()
+{
+	bail_on_lldpad
+}
 
 lib_dir=$(dirname $0)/../../../net/forwarding
 TCFLAGS=skip_sw
diff --git a/tools/testing/selftests/net/forwarding/sch_tbf_etsprio.sh b/tools/testing/selftests/net/forwarding/sch_tbf_etsprio.sh
index 75a37c189ef3..df9bcd6a811a 100644
--- a/tools/testing/selftests/net/forwarding/sch_tbf_etsprio.sh
+++ b/tools/testing/selftests/net/forwarding/sch_tbf_etsprio.sh
@@ -57,6 +57,10 @@ tbf_root_test()
 	tc qdisc del dev $swp2 root
 }
 
+if type -t sch_tbf_pre_hook >/dev/null; then
+	sch_tbf_pre_hook
+fi
+
 trap cleanup EXIT
 
 setup_prepare
diff --git a/tools/testing/selftests/net/forwarding/sch_tbf_root.sh b/tools/testing/selftests/net/forwarding/sch_tbf_root.sh
index 72aa21ba88c7..96c997be0d03 100755
--- a/tools/testing/selftests/net/forwarding/sch_tbf_root.sh
+++ b/tools/testing/selftests/net/forwarding/sch_tbf_root.sh
@@ -23,6 +23,10 @@ tbf_test()
 	tc qdisc del dev $swp2 root
 }
 
+if type -t sch_tbf_pre_hook >/dev/null; then
+	sch_tbf_pre_hook
+fi
+
 trap cleanup EXIT
 
 setup_prepare
-- 
2.39.0

  reply	other threads:[~2023-03-16 13:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-10 22:12 [RFC PATCH net-next] selftests: forwarding: add a test for MAC Merge layer Vladimir Oltean
2023-02-13 10:51 ` Petr Machata
2023-02-13 11:39   ` Vladimir Oltean
2023-02-14 11:53     ` Petr Machata
2023-03-15 15:52       ` Vladimir Oltean
2023-03-16 11:10       ` Petr Machata
2023-03-16 13:43         ` Petr Machata [this message]
2023-02-13 11:42 ` Kurt Kanzenbach
2023-02-13 12:02   ` Vladimir Oltean

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ttykreky.fsf@nvidia.com \
    --to=petrm@nvidia.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=aconole@redhat.com \
    --cc=ferenc.fejes@ericsson.com \
    --cc=harini.katakam@amd.com \
    --cc=idosch@nvidia.com \
    --cc=kurt@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mkubecek@suse.cz \
    --cc=netdev@vger.kernel.org \
    --cc=pranavi.somisetty@amd.com \
    --cc=rui.sousa@nxp.com \
    --cc=vinicius.gomes@intel.com \
    --cc=vladimir.oltean@nxp.com \
    --cc=xiaoliang.yang_1@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox