From: Vadim Fedorenko <vadim.fedorenko@linux.dev>
To: Jakub Kicinski <kuba@kernel.org>, Andrew Lunn <andrew@lunn.ch>,
Michael Chan <michael.chan@broadcom.com>,
Pavan Chebbi <pavan.chebbi@broadcom.com>,
Tariq Toukan <tariqt@nvidia.com>, Gal Pressman <gal@nvidia.com>,
intel-wired-lan@lists.osuosl.org,
Donald Hunter <donald.hunter@gmail.com>,
Carolina Jubran <cjubran@nvidia.com>,
Aleksandr Loktionov <aleksandr.loktionov@intel.com>,
Vadim Fedorenko <vadim.fedorenko@linux.dev>
Cc: Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
netdev@vger.kernel.org
Subject: [Intel-wired-lan] [PATCH net-next v4 5/5] selftests: net-drv: stats: sanity check FEC histogram
Date: Fri, 19 Sep 2025 19:46:51 +0000 [thread overview]
Message-ID: <20250919194651.2164987-6-vadim.fedorenko@linux.dev> (raw)
In-Reply-To: <20250919194651.2164987-1-vadim.fedorenko@linux.dev>
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@linux.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..d433ac71aa02 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") from e
+ if 'hist' not in data['stats']:
+ raise KsftSkipEx("FEC histogram not supported by the device") from e
+
+ 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
WARNING: multiple messages have this Message-ID (diff)
From: Vadim Fedorenko <vadim.fedorenko@linux.dev>
To: Jakub Kicinski <kuba@kernel.org>, Andrew Lunn <andrew@lunn.ch>,
Michael Chan <michael.chan@broadcom.com>,
Pavan Chebbi <pavan.chebbi@broadcom.com>,
Tariq Toukan <tariqt@nvidia.com>, Gal Pressman <gal@nvidia.com>,
intel-wired-lan@lists.osuosl.org,
Donald Hunter <donald.hunter@gmail.com>,
Carolina Jubran <cjubran@nvidia.com>,
Aleksandr Loktionov <aleksandr.loktionov@intel.com>,
Vadim Fedorenko <vadim.fedorenko@linux.dev>
Cc: Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
netdev@vger.kernel.org
Subject: [PATCH net-next v4 5/5] selftests: net-drv: stats: sanity check FEC histogram
Date: Fri, 19 Sep 2025 19:46:51 +0000 [thread overview]
Message-ID: <20250919194651.2164987-6-vadim.fedorenko@linux.dev> (raw)
In-Reply-To: <20250919194651.2164987-1-vadim.fedorenko@linux.dev>
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@linux.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..d433ac71aa02 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") from e
+ if 'hist' not in data['stats']:
+ raise KsftSkipEx("FEC histogram not supported by the device") from e
+
+ 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
next prev parent reply other threads:[~2025-09-19 19:55 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-19 19:46 [Intel-wired-lan] [PATCH net-next v4 0/5] add FEC bins histogram report via ethtool Vadim Fedorenko
2025-09-19 19:46 ` Vadim Fedorenko
2025-09-19 19:46 ` [Intel-wired-lan] [PATCH net-next v4 1/5] ethtool: add FEC bins histogram report Vadim Fedorenko
2025-09-19 19:46 ` Vadim Fedorenko
2025-09-19 19:46 ` [Intel-wired-lan] [PATCH net-next v4 2/5] net/mlx5e: Don't query FEC statistics when FEC is disabled Vadim Fedorenko
2025-09-19 19:46 ` Vadim Fedorenko
2025-09-19 19:46 ` [Intel-wired-lan] [PATCH net-next v4 3/5] net/mlx5e: Add logic to read RS-FEC histogram bin ranges from PPHCR Vadim Fedorenko
2025-09-19 19:46 ` Vadim Fedorenko
2025-09-19 19:46 ` [Intel-wired-lan] [PATCH net-next v4 4/5] net/mlx5e: Report RS-FEC histogram statistics via ethtool Vadim Fedorenko
2025-09-19 19:46 ` Vadim Fedorenko
2025-09-19 19:46 ` Vadim Fedorenko [this message]
2025-09-19 19:46 ` [PATCH net-next v4 5/5] selftests: net-drv: stats: sanity check FEC histogram Vadim Fedorenko
2025-09-22 10:14 ` [Intel-wired-lan] [PATCH net-next v4 0/5] add FEC bins histogram report via ethtool Vadim Fedorenko
2025-09-22 10:14 ` Vadim Fedorenko
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=20250919194651.2164987-6-vadim.fedorenko@linux.dev \
--to=vadim.fedorenko@linux.dev \
--cc=aleksandr.loktionov@intel.com \
--cc=andrew@lunn.ch \
--cc=cjubran@nvidia.com \
--cc=donald.hunter@gmail.com \
--cc=gal@nvidia.com \
--cc=horms@kernel.org \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=kuba@kernel.org \
--cc=michael.chan@broadcom.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pavan.chebbi@broadcom.com \
--cc=tariqt@nvidia.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.