mirror of
https://github.com/raspberrypi/linux.git
synced 2026-01-05 10:47:34 +00:00
Test that the SO_INCOMING_NAPI_ID of a network file descriptor is non-zero. This ensures that either the core networking stack or, in some cases like netdevsim, the driver correctly sets the NAPI ID. Signed-off-by: Joe Damato <jdamato@fastly.com> Link: https://patch.msgid.link/20250424002746.16891-4-jdamato@fastly.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
24 lines
649 B
Python
Executable File
24 lines
649 B
Python
Executable File
#!/usr/bin/env python3
|
|
# SPDX-License-Identifier: GPL-2.0
|
|
|
|
from lib.py import ksft_run, ksft_exit
|
|
from lib.py import ksft_eq, NetDrvEpEnv
|
|
from lib.py import bkg, cmd, rand_port, NetNSEnter
|
|
|
|
def test_napi_id(cfg) -> None:
|
|
port = rand_port()
|
|
listen_cmd = f"{cfg.test_dir}/napi_id_helper {cfg.addr_v['4']} {port}"
|
|
|
|
with bkg(listen_cmd, ksft_wait=3) as server:
|
|
cmd(f"echo a | socat - TCP:{cfg.addr_v['4']}:{port}", host=cfg.remote, shell=True)
|
|
|
|
ksft_eq(0, server.ret)
|
|
|
|
def main() -> None:
|
|
with NetDrvEpEnv(__file__) as cfg:
|
|
ksft_run([test_napi_id], args=(cfg,))
|
|
ksft_exit()
|
|
|
|
if __name__ == "__main__":
|
|
main()
|