mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 09:36:22 +02:00
selftests: drv-net: add netkit devmem tests
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, then calls a shared run_*() helper which probes for devmem support and configures the NIC (HDS, RSS, queue lease) before driving the test. NIC state is restored per-test via defer() callbacks registered inside the helper. Acked-by: Stanislav Fomichev <sdf@fomichev.me> Signed-off-by: Bobby Eshleman <bobbyeshleman@meta.com> Link: https://patch.msgid.link/20260514-tcp-dm-netkit-v5-8-408c59b91e66@meta.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
886a790b59
commit
28c1cc999f
|
|
@ -35,6 +35,7 @@ TEST_PROGS = \
|
|||
irq.py \
|
||||
loopback.sh \
|
||||
nic_timestamp.py \
|
||||
nk_devmem.py \
|
||||
nk_netns.py \
|
||||
nk_qlease.py \
|
||||
ntuple.py \
|
||||
|
|
|
|||
46
tools/testing/selftests/drivers/net/hw/nk_devmem.py
Executable file
46
tools/testing/selftests/drivers/net/hw/nk_devmem.py
Executable file
|
|
@ -0,0 +1,46 @@
|
|||
#!/usr/bin/env python3
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
"""Test devmem TCP with netkit."""
|
||||
|
||||
import os
|
||||
from devmem_lib import setup_test, run_rx, run_tx, run_tx_chunks, run_rx_hds
|
||||
from lib.py import ksft_run, ksft_exit, ksft_disruptive
|
||||
from lib.py import NetDrvContEnv
|
||||
|
||||
|
||||
@ksft_disruptive
|
||||
def check_nk_rx(cfg) -> None:
|
||||
"""Run the devmem RX test through netkit."""
|
||||
run_rx(cfg)
|
||||
|
||||
|
||||
@ksft_disruptive
|
||||
def check_nk_tx(cfg) -> None:
|
||||
"""Run the devmem TX test through netkit."""
|
||||
run_tx(cfg)
|
||||
|
||||
|
||||
@ksft_disruptive
|
||||
def check_nk_tx_chunks(cfg) -> None:
|
||||
"""Run the devmem TX chunking test through netkit."""
|
||||
run_tx_chunks(cfg)
|
||||
|
||||
|
||||
def check_nk_rx_hds(cfg) -> None:
|
||||
"""Run the HDS test through netkit."""
|
||||
run_rx_hds(cfg)
|
||||
|
||||
|
||||
def main() -> None:
|
||||
"""Run the netkit devmem test cases."""
|
||||
with NetDrvContEnv(__file__, rxqueues=2, primary_rx_redirect=True) as cfg:
|
||||
setup_test(cfg,
|
||||
os.path.join(os.path.dirname(os.path.abspath(__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()
|
||||
Loading…
Reference in New Issue
Block a user