Message ID | 20240426232400.624864-1-kuba@kernel.org |
---|---|
Headers | show |
Series | selftests: net: page_poll allocation error injection | expand |
Jakub Kicinski wrote: > The main use of the ip() wrapper over cmd() is that it can parse JSON. > cmd("ip -j link show") will return stdout as a string, and test has > to call json.loads(). With ip("link show", json=True) the return value > will be already parsed. > > More tools (ethtool, bpftool etc.) support the --json switch. > To avoid having to wrap all of them individually create a tool() > helper. > > Switch from -j to --json (for ethtool). > While at it consume the netns attribute at the ip() level. > > Signed-off-by: Jakub Kicinski <kuba@kernel.org> > --- > tools/testing/selftests/net/lib/py/utils.py | 12 +++++++++--- > 1 file changed, 9 insertions(+), 3 deletions(-) > > diff --git a/tools/testing/selftests/net/lib/py/utils.py b/tools/testing/selftests/net/lib/py/utils.py > index d3715e6c21f2..11b588a2bb9d 100644 > --- a/tools/testing/selftests/net/lib/py/utils.py > +++ b/tools/testing/selftests/net/lib/py/utils.py > @@ -56,10 +56,10 @@ import time > return self.process(terminate=self.terminate) > > > -def ip(args, json=None, ns=None, host=None): > - cmd_str = "ip " > +def tool(name, args, json=None, ns=None, host=None): > + cmd_str = name + " " > if json: > - cmd_str += '-j ' > + cmd_str += '--json ' > cmd_str += args > cmd_obj = cmd(cmd_str, ns=ns, host=host) > if json: > @@ -67,6 +67,12 @@ import time > return cmd_obj > > > +def ip(args, json=None, ns=None, host=None): > + if ns: > + args = '-netns ' + ns + " " + args Minor: inconsistent use of single and double comma strings. Maybe there's a reasoning that I'm just missing. > + return tool("ip", args, json=json, host=host) > + > + > def rand_port(): > """ > Get unprivileged port, for now just random, one day we may decide to check if used. > -- > 2.44.0 >
Jakub Kicinski wrote: > Add a test for exercising driver memory allocation failure paths. > page pool is a bit tricky to inject errors into at the page allocator > level because of the bulk alloc and recycling, so add explicit error > injection support "in front" of the caches. > > Add a test to exercise that using only the standard APIs. > This is the first useful test for the new tests with an endpoint. > There's no point testing netdevsim here, so this is also the first > HW-only test in Python. > > I'm not super happy with the traffic generation using iperf3, > my initial approach was to use mausezahn. But it turned out to be > 5x slower in terms of PPS. Hopefully this is good enough for now. > > Jakub Kicinski (6): > net: page_pool: support error injection > selftests: drv-net-hw: support using Python from net hw tests > selftests: net: py: extract tool logic > selftests: net: py: avoid all ports < 10k > selftests: drv-net: support generating iperf3 load > selftests: drv-net-hw: add test for memory allocation failures with > page pool Reviewed-by: Willem de Bruijn <willemb@google.com>
On Mon, 29 Apr 2024 17:01:55 +0200 Andrew Lunn wrote: > > I'm not super happy with the traffic generation using iperf3, > > my initial approach was to use mausezahn. But it turned out to be > > 5x slower in terms of PPS. Hopefully this is good enough for now. > > How important is PPS? In order to get 'Maintained' status, automotive > vendors are going to want to test their 10Mbps T1 links. s/Maintained/Supported/ ? PPS isn't important in itself, that said, I wanted to set a floor to make sure that the failure path is actually well exercised. Some drivers may be doing internal recycling or whatever other magic, which would make them barely call the page_pool alloc. Even though this is not a performance tests the check is based on expected perf. My thinking is that once we have some data points about various system we can abstract the perf expectations a bit more systematically than if speed < 10GE: pps //= 10