Re: [PATCH net-next 7/7] testing: net-drv: add a driver test for stats reporting

2024-04-03 Thread Jakub Kicinski
On Wed, 3 Apr 2024 18:52:50 +0200 Petr Machata wrote: > > Nothing wrong with that. I guess the question in my mind is whether > > we're aiming for making the tests "pythonic" (in which case "with" > > definitely wins), or more of a "bash with classes" style trying to > > avoid any constructs people

Re: [PATCH net-next 7/7] testing: net-drv: add a driver test for stats reporting

2024-04-03 Thread Petr Machata
Jakub Kicinski writes: > On Wed, 3 Apr 2024 10:58:19 +0200 Petr Machata wrote: >> Also, it's not clear what "del thing" should do in that context, because >> if cfg also keeps a reference, __del__ won't get called. There could be >> a direct method, like thing.exit() or whatever, but then you n

Re: [PATCH net-next 7/7] testing: net-drv: add a driver test for stats reporting

2024-04-03 Thread Jakub Kicinski
On Wed, 3 Apr 2024 10:58:19 +0200 Petr Machata wrote: > Also, it's not clear what "del thing" should do in that context, because > if cfg also keeps a reference, __del__ won't get called. There could be > a direct method, like thing.exit() or whatever, but then you need > bookkeeping so as not to c

Re: [PATCH net-next 7/7] testing: net-drv: add a driver test for stats reporting

2024-04-03 Thread Petr Machata
Jakub Kicinski writes: > On Wed, 3 Apr 2024 00:04:14 +0200 Petr Machata wrote: >> > Yes, I was wondering about that. It must be doable, IIRC >> > the multi-threading API "injects" args from a tuple. >> > I was thinking something along the lines of: >> > >> > with NetDrvEnv(__file__) as cfg

Re: [PATCH net-next 7/7] testing: net-drv: add a driver test for stats reporting

2024-04-02 Thread David Wei
On 2024-04-02 10:31, Jakub Kicinski wrote: > On Tue, 2 Apr 2024 18:37:44 +0200 Petr Machata wrote: >> Yeah, this would be usually done through context managers, as I mention >> in the other e-mail. But then cfg would be lexically scoped, which IMHO >> is a good thing, but then it needs to be passed

Re: [PATCH net-next 7/7] testing: net-drv: add a driver test for stats reporting

2024-04-02 Thread David Wei
On 2024-04-01 18:05, Jakub Kicinski wrote: > Add a very simple test to make sure drivers report expected > stats. Drivers which implement FEC or pause configuration > should report relevant stats. Qstats must be reported, > at least packet and byte counts, and they must match > total device stats.

Re: [PATCH net-next 7/7] testing: net-drv: add a driver test for stats reporting

2024-04-02 Thread Jakub Kicinski
On Wed, 3 Apr 2024 00:04:14 +0200 Petr Machata wrote: > > Yes, I was wondering about that. It must be doable, IIRC > > the multi-threading API "injects" args from a tuple. > > I was thinking something along the lines of: > > > > with NetDrvEnv(__file__) as cfg: > > ksft_run([check_paus

Re: [PATCH net-next 7/7] testing: net-drv: add a driver test for stats reporting

2024-04-02 Thread Petr Machata
Jakub Kicinski writes: > On Tue, 2 Apr 2024 18:37:44 +0200 Petr Machata wrote: >> Yeah, this would be usually done through context managers, as I mention >> in the other e-mail. But then cfg would be lexically scoped, which IMHO >> is a good thing, but then it needs to be passed around as an ar

Re: [PATCH net-next 7/7] testing: net-drv: add a driver test for stats reporting

2024-04-02 Thread Petr Machata
Jakub Kicinski writes: > On Tue, 2 Apr 2024 10:31:11 -0700 Jakub Kicinski wrote: >> Yes, I was wondering about that. It must be doable, IIRC >> the multi-threading API "injects" args from a tuple. >> I was thinking something along the lines of: >> >> with NetDrvEnv(__file__) as cfg: >>

Re: [PATCH net-next 7/7] testing: net-drv: add a driver test for stats reporting

2024-04-02 Thread Jakub Kicinski
On Tue, 2 Apr 2024 10:31:11 -0700 Jakub Kicinski wrote: > Yes, I was wondering about that. It must be doable, IIRC > the multi-threading API "injects" args from a tuple. > I was thinking something along the lines of: > > with NetDrvEnv(__file__) as cfg: > ksft_run([check_pause, check_

Re: [PATCH net-next 7/7] testing: net-drv: add a driver test for stats reporting

2024-04-02 Thread Jakub Kicinski
On Tue, 2 Apr 2024 18:37:44 +0200 Petr Machata wrote: > Yeah, this would be usually done through context managers, as I mention > in the other e-mail. But then cfg would be lexically scoped, which IMHO > is a good thing, but then it needs to be passed around as an argument, > and that makes the ksf

Re: [PATCH net-next 7/7] testing: net-drv: add a driver test for stats reporting

2024-04-02 Thread Petr Machata
Jakub Kicinski writes: > Add a very simple test to make sure drivers report expected > stats. Drivers which implement FEC or pause configuration > should report relevant stats. Qstats must be reported, > at least packet and byte counts, and they must match > total device stats. > > Tested with

[PATCH net-next 7/7] testing: net-drv: add a driver test for stats reporting

2024-04-01 Thread Jakub Kicinski
Add a very simple test to make sure drivers report expected stats. Drivers which implement FEC or pause configuration should report relevant stats. Qstats must be reported, at least packet and byte counts, and they must match total device stats. Tested with netdevsim, bnxt, in-tree and installed.