mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-16 18:26:42 +00:00
selftests: net-drv: queues: sanity check netlink dumps
This test already catches a netlink bug fixed by this series, but only when running on HW with many queues. Make sure the netdevsim instance created has a lot of queues, and constrain the size of the recv_buffer used by netlink. While at it test both rx and tx queues. Reviewed-by: Joe Damato <jdamato@fastly.com> Reviewed-by: Petr Machata <petrm@nvidia.com> Link: https://patch.msgid.link/20241213152244.3080955-5-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
0518863407
commit
1234810b16
@ -8,25 +8,28 @@ from lib.py import cmd
|
|||||||
import glob
|
import glob
|
||||||
|
|
||||||
|
|
||||||
def sys_get_queues(ifname) -> int:
|
def sys_get_queues(ifname, qtype='rx') -> int:
|
||||||
folders = glob.glob(f'/sys/class/net/{ifname}/queues/rx-*')
|
folders = glob.glob(f'/sys/class/net/{ifname}/queues/{qtype}-*')
|
||||||
return len(folders)
|
return len(folders)
|
||||||
|
|
||||||
|
|
||||||
def nl_get_queues(cfg, nl):
|
def nl_get_queues(cfg, nl, qtype='rx'):
|
||||||
queues = nl.queue_get({'ifindex': cfg.ifindex}, dump=True)
|
queues = nl.queue_get({'ifindex': cfg.ifindex}, dump=True)
|
||||||
if queues:
|
if queues:
|
||||||
return len([q for q in queues if q['type'] == 'rx'])
|
return len([q for q in queues if q['type'] == qtype])
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def get_queues(cfg, nl) -> None:
|
def get_queues(cfg, nl) -> None:
|
||||||
queues = nl_get_queues(cfg, nl)
|
snl = NetdevFamily(recv_size=4096)
|
||||||
if not queues:
|
|
||||||
raise KsftSkipEx('queue-get not supported by device')
|
|
||||||
|
|
||||||
expected = sys_get_queues(cfg.dev['ifname'])
|
for qtype in ['rx', 'tx']:
|
||||||
ksft_eq(queues, expected)
|
queues = nl_get_queues(cfg, snl, qtype)
|
||||||
|
if not queues:
|
||||||
|
raise KsftSkipEx('queue-get not supported by device')
|
||||||
|
|
||||||
|
expected = sys_get_queues(cfg.dev['ifname'], qtype)
|
||||||
|
ksft_eq(queues, expected)
|
||||||
|
|
||||||
|
|
||||||
def addremove_queues(cfg, nl) -> None:
|
def addremove_queues(cfg, nl) -> None:
|
||||||
@ -57,7 +60,7 @@ def addremove_queues(cfg, nl) -> None:
|
|||||||
|
|
||||||
|
|
||||||
def main() -> None:
|
def main() -> None:
|
||||||
with NetDrvEnv(__file__, queue_count=3) as cfg:
|
with NetDrvEnv(__file__, queue_count=100) as cfg:
|
||||||
ksft_run([get_queues, addremove_queues], args=(cfg, NetdevFamily()))
|
ksft_run([get_queues, addremove_queues], args=(cfg, NetdevFamily()))
|
||||||
ksft_exit()
|
ksft_exit()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user