xref: /linux/tools/testing/selftests/drivers/net/hw/devmem.py (revision 91ec2035134982b98fab0609a9fd8480e8217dc1)
1#!/usr/bin/env python3
2# SPDX-License-Identifier: GPL-2.0
3
4from os import path
5from devmem_lib import (setup_test, run_rx, run_tx, run_tx_chunks, run_rx_hds,
6                        run_rx_large_niov)
7from lib.py import ksft_run, ksft_exit, ksft_disruptive
8from lib.py import NetDrvEpEnv
9
10
11@ksft_disruptive
12def check_rx(cfg) -> None:
13    """Run the devmem RX test."""
14    run_rx(cfg)
15
16
17@ksft_disruptive
18def check_tx(cfg) -> None:
19    """Run the devmem TX test."""
20    run_tx(cfg)
21
22
23@ksft_disruptive
24def check_tx_chunks(cfg) -> None:
25    """Run the devmem TX chunking test."""
26    run_tx_chunks(cfg)
27
28
29def check_rx_hds(cfg) -> None:
30    """Run the HDS test."""
31    run_rx_hds(cfg)
32
33
34def check_rx_large_niov(cfg) -> None:
35    """Run the devmem RX test with rx-page-size = 16 KiB."""
36    run_rx_large_niov(cfg)
37
38
39def main() -> None:
40    """Run the devmem test cases."""
41    with NetDrvEpEnv(__file__) as cfg:
42        setup_test(cfg, path.abspath(path.dirname(__file__) + "/ncdevmem"))
43        ksft_run([check_rx, check_tx, check_tx_chunks, check_rx_hds,
44                  check_rx_large_niov],
45                 args=(cfg,))
46    ksft_exit()
47
48
49if __name__ == "__main__":
50    main()
51