Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

selftests: drv-net: psp: add assertions on core-tracked psp dev stats

Add assertions to existing test cases to cover key rotations and
'stale-events'.

Signed-off-by: Daniel Zahka <daniel.zahka@gmail.com>
Link: https://patch.msgid.link/20251106002608.1578518-3-daniel.zahka@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Daniel Zahka and committed by
Jakub Kicinski
2098cec3 dae4a923

+13
+13
tools/testing/selftests/drivers/net/psp.py
··· 109 109 time.sleep(0.01) 110 110 ksft_eq(outq, exp_len) 111 111 112 + 113 + def _get_stat(cfg, key): 114 + return cfg.pspnl.get_stats({'dev-id': cfg.psp_dev_id})[key] 115 + 112 116 # 113 117 # Test case boiler plate 114 118 # ··· 175 171 """ Test key rotation """ 176 172 _init_psp_dev(cfg) 177 173 174 + prev_rotations = _get_stat(cfg, 'key-rotations') 175 + 178 176 rot = cfg.pspnl.key_rotate({"id": cfg.psp_dev_id}) 179 177 ksft_eq(rot['id'], cfg.psp_dev_id) 180 178 rot = cfg.pspnl.key_rotate({"id": cfg.psp_dev_id}) 181 179 ksft_eq(rot['id'], cfg.psp_dev_id) 180 + 181 + cur_rotations = _get_stat(cfg, 'key-rotations') 182 + ksft_eq(cur_rotations, prev_rotations + 2) 182 183 183 184 184 185 def dev_rotate_spi(cfg): ··· 484 475 """ Test send on a double-rotated key """ 485 476 _init_psp_dev(cfg) 486 477 478 + prev_stale = _get_stat(cfg, 'stale-events') 487 479 s = _make_psp_conn(cfg) 488 480 try: 489 481 rx_assoc = cfg.pspnl.rx_assoc({"version": 0, ··· 504 494 505 495 cfg.pspnl.key_rotate({"id": cfg.psp_dev_id}) 506 496 cfg.pspnl.key_rotate({"id": cfg.psp_dev_id}) 497 + 498 + cur_stale = _get_stat(cfg, 'stale-events') 499 + ksft_gt(cur_stale, prev_stale) 507 500 508 501 s.send(b'0123456789' * 200) 509 502 _check_data_outq(s, 2000, force_wait=True)