summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/drivers/net/hw/devmem.py
blob: 82c11ffc4add7b270cc1d09d8961be32ff5b5d32 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-2.0

from os import path
from devmem_lib import (setup_test, run_rx, run_tx, run_tx_chunks, run_rx_hds,
                        run_rx_large_niov)
from lib.py import ksft_run, ksft_exit, ksft_disruptive
from lib.py import NetDrvEpEnv


@ksft_disruptive
def check_rx(cfg) -> None:
    """Run the devmem RX test."""
    run_rx(cfg)


@ksft_disruptive
def check_tx(cfg) -> None:
    """Run the devmem TX test."""
    run_tx(cfg)


@ksft_disruptive
def check_tx_chunks(cfg) -> None:
    """Run the devmem TX chunking test."""
    run_tx_chunks(cfg)


def check_rx_hds(cfg) -> None:
    """Run the HDS test."""
    run_rx_hds(cfg)


def check_rx_large_niov(cfg) -> None:
    """Run the devmem RX test with rx-page-size = 16 KiB."""
    run_rx_large_niov(cfg)


def main() -> None:
    """Run the devmem test cases."""
    with NetDrvEpEnv(__file__) as cfg:
        setup_test(cfg, path.abspath(path.dirname(__file__) + "/ncdevmem"))
        ksft_run([check_rx, check_tx, check_tx_chunks, check_rx_hds,
                  check_rx_large_niov],
                 args=(cfg,))
    ksft_exit()


if __name__ == "__main__":
    main()