From: Bobby Eshleman <[email protected]> Add nk_devmem.py with four tests for TCP devmem through a netkit device:
These tests are just duplicates of the original devmem tests, with some adjusted parameters such as telling ncdevmem to avoid device setup (since it only has access to netkit, not a phys device). Each test uses NetDrvContEnv with primary_rx_redirect=True to set up the BPF redirect program on the primary netkit interface. Signed-off-by: Bobby Eshleman <[email protected]> --- Changes in v2: - Add nk_devmem.py to TEST_PROGS in Makefile (Sashiko) --- tools/testing/selftests/drivers/net/hw/Makefile | 1 + .../testing/selftests/drivers/net/hw/nk_devmem.py | 40 ++++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/tools/testing/selftests/drivers/net/hw/Makefile b/tools/testing/selftests/drivers/net/hw/Makefile index 85ca4d1ecf9e..2f78c6aec397 100644 --- a/tools/testing/selftests/drivers/net/hw/Makefile +++ b/tools/testing/selftests/drivers/net/hw/Makefile @@ -34,6 +34,7 @@ TEST_PROGS = \ irq.py \ loopback.sh \ nic_timestamp.py \ + nk_devmem.py \ nk_netns.py \ nk_qlease.py \ ntuple.py \ diff --git a/tools/testing/selftests/drivers/net/hw/nk_devmem.py b/tools/testing/selftests/drivers/net/hw/nk_devmem.py new file mode 100755 index 000000000000..c069d525798b --- /dev/null +++ b/tools/testing/selftests/drivers/net/hw/nk_devmem.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: GPL-2.0 +"""Test devmem TCP with netkit.""" + +from os import path +from lib.py import ksft_run, ksft_exit, ksft_disruptive +from lib.py import NetDrvContEnv +from lib.py.devmem import setup_test, run_rx, run_tx, run_tx_chunks, run_rx_hds + + +@ksft_disruptive +def check_nk_rx(cfg) -> None: + run_rx(cfg) + + +@ksft_disruptive +def check_nk_tx(cfg) -> None: + run_tx(cfg) + + +@ksft_disruptive +def check_nk_tx_chunks(cfg) -> None: + run_tx_chunks(cfg) + + +@ksft_disruptive +def check_nk_rx_hds(cfg) -> None: + run_rx_hds(cfg) + + +def main() -> None: + with NetDrvContEnv(__file__, rxqueues=2, primary_rx_redirect=True) as cfg: + setup_test(cfg, path.abspath(path.dirname(__file__) + "/ncdevmem")) + ksft_run([check_nk_rx, check_nk_tx, check_nk_tx_chunks, check_nk_rx_hds], + args=(cfg,)) + ksft_exit() + + +if __name__ == "__main__": + main() -- 2.52.0

