[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <IA3PR11MB8986A24E0ADE2DCA018998BDE51CA@IA3PR11MB8986.namprd11.prod.outlook.com>
Date: Wed, 24 Sep 2025 13:40:43 +0000
From: "Loktionov, Aleksandr" <aleksandr.loktionov@...el.com>
To: Vadim Fedorenko <vadim.fedorenko@...ux.dev>, Jakub Kicinski
<kuba@...nel.org>, Andrew Lunn <andrew@...n.ch>, Michael Chan
<michael.chan@...adcom.com>, Pavan Chebbi <pavan.chebbi@...adcom.com>, "Tariq
Toukan" <tariqt@...dia.com>, Gal Pressman <gal@...dia.com>,
"intel-wired-lan@...ts.osuosl.org" <intel-wired-lan@...ts.osuosl.org>, Donald
Hunter <donald.hunter@...il.com>, Carolina Jubran <cjubran@...dia.com>
CC: Paolo Abeni <pabeni@...hat.com>, Simon Horman <horms@...nel.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: RE: [PATCH net-next v6 5/5] selftests: net-drv: stats: sanity check
FEC histogram
> -----Original Message-----
> From: Vadim Fedorenko <vadim.fedorenko@...ux.dev>
> Sent: Wednesday, September 24, 2025 2:41 PM
> To: Jakub Kicinski <kuba@...nel.org>; Andrew Lunn <andrew@...n.ch>;
> Michael Chan <michael.chan@...adcom.com>; Pavan Chebbi
> <pavan.chebbi@...adcom.com>; Tariq Toukan <tariqt@...dia.com>; Gal
> Pressman <gal@...dia.com>; intel-wired-lan@...ts.osuosl.org; Donald
> Hunter <donald.hunter@...il.com>; Carolina Jubran
> <cjubran@...dia.com>; Loktionov, Aleksandr
> <aleksandr.loktionov@...el.com>; Vadim Fedorenko
> <vadim.fedorenko@...ux.dev>
> Cc: Paolo Abeni <pabeni@...hat.com>; Simon Horman <horms@...nel.org>;
> netdev@...r.kernel.org
> Subject: [PATCH net-next v6 5/5] selftests: net-drv: stats: sanity
> check FEC histogram
>
> Simple tests to validate kernel's output. FEC bin range should be
> valid means high boundary should be not less than low boundary. Bin
> boundaries have to be provided as well as error counter value. Per-
> plane value should match bin's value.
>
> Signed-off-by: Vadim Fedorenko <vadim.fedorenko@...ux.dev>
> ---
> tools/testing/selftests/drivers/net/stats.py | 35 ++++++++++++++++++-
> -
> 1 file changed, 33 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/drivers/net/stats.py
> b/tools/testing/selftests/drivers/net/stats.py
> index c2bb5d3f1ca1..04d0a2a13e73 100755
> --- a/tools/testing/selftests/drivers/net/stats.py
> +++ b/tools/testing/selftests/drivers/net/stats.py
> @@ -57,6 +57,36 @@ def check_fec(cfg) -> None:
> ksft_true(data['stats'], "driver does not report stats")
>
>
> +def check_fec_hist(cfg) -> None:
> + """
> + Check that drivers which support FEC histogram statistics report
> + reasonable values.
> + """
> +
> + try:
> + data = ethnl.fec_get({"header": {"dev-index": cfg.ifindex,
> + "flags": {'stats'}}})
> + except NlError as e:
> + if e.error == errno.EOPNOTSUPP:
> + raise KsftSkipEx("FEC not supported by the device") from
> e
> + raise
> + if 'stats' not in data:
> + raise KsftSkipEx("FEC stats not supported by the device")
> + if 'hist' not in data['stats']:
> + raise KsftSkipEx("FEC histogram not supported by the device")
> +
> + hist = data['stats']['hist']
> + for fec_bin in hist:
> + for key in ['bin-low', 'bin-high', 'bin-val']:
> + ksft_in(key, fec_bin,
> + "Drivers should always report FEC bin range and
> value")
> + ksft_ge(fec_bin['bin-high'], fec_bin['bin-low'],
> + "FEC bin range should be valid")
> + if 'bin-val-per-lane' in fec_bin:
> + ksft_eq(sum(fec_bin['bin-val-per-lane']), fec_bin['bin-
> val'],
> + "FEC bin value should be equal to sum of per-
> plane
> +values")
> +
> +
> def pkt_byte_sum(cfg) -> None:
> """
> Check that qstat and interface stats match in value.
> @@ -279,8 +309,9 @@ def main() -> None:
> """ Ksft boiler plate main """
>
> with NetDrvEnv(__file__, queue_count=100) as cfg:
> - ksft_run([check_pause, check_fec, pkt_byte_sum,
> qstat_by_ifindex,
> - check_down, procfs_hammer, procfs_downup_hammer],
> + ksft_run([check_pause, check_fec, check_fec_hist,
> pkt_byte_sum,
> + qstat_by_ifindex, check_down, procfs_hammer,
> + procfs_downup_hammer],
> args=(cfg, ))
> ksft_exit()
>
> --
> 2.47.3
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@...el.com>
Powered by blists - more mailing lists