Thread (14 messages) flat view 14 messages, 3 authors, 2026-03-06

[net-next 3/3] selftests: drv-net: psp: add reset statistics test

From: Akhilesh Samineni <hidden>
Date: 2026-03-02 19:54:47
Also in: lkml
Subsystem: kernel selftest framework, networking drivers, the rest · Maintainers: Shuah Khan, Shuah Khan, Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds

Add get stats and reset stats verification within _data_basic_send()
to exercise the reset-stats netlink command in the data path test.

Signed-off-by: Akhilesh Samineni <redacted>
Reviewed-by: Kiran Kella <redacted>
---
 tools/testing/selftests/drivers/net/psp.py | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
diff --git a/tools/testing/selftests/drivers/net/psp.py b/tools/testing/selftests/drivers/net/psp.py
index 864d9fce1094..b7a59d0dbe25 100755
--- a/tools/testing/selftests/drivers/net/psp.py
+++ b/tools/testing/selftests/drivers/net/psp.py
@@ -113,6 +113,9 @@ def _check_data_outq(s, exp_len, force_wait=False):
 def _get_stat(cfg, key):
     return cfg.pspnl.get_stats({'dev-id': cfg.psp_dev_id})[key]
 
+
+def _reset_stat(cfg):
+    cfg.pspnl.reset_stats({"id": cfg.psp_dev_id})
+
 #
 # Test case boiler plate
 #
@@ -389,8 +392,22 @@ def _data_basic_send(cfg, version, ipver):
                         "tx-key": tx,
                         "sock-fd": s.fileno()})
 
+    _reset_stat(cfg)
+    rx_packets = _get_stat(cfg, 'rx-packets')
+    rx_bytes = _get_stat(cfg, 'rx-bytes')
+    ksft_eq(rx_packets, 0)
+    ksft_eq(rx_bytes, 0)
     data_len = _send_careful(cfg, s, 100)
     _check_data_rx(cfg, data_len)
+    rx_packets = _get_stat(cfg, 'rx-packets')
+    rx_bytes = _get_stat(cfg, 'rx-bytes')
+    ksft_ne(rx_packets, 0)
+    ksft_ne(rx_bytes, 0)
+    _reset_stat(cfg)
+    rx_packets = _get_stat(cfg, 'rx-packets')
+    rx_bytes = _get_stat(cfg, 'rx-bytes')
+    ksft_eq(rx_packets, 0)
+    ksft_eq(rx_bytes, 0)
     _close_psp_conn(cfg, s)
 
 
-- 
2.45.4
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help