lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20260206211218.323d172f@kernel.org>
Date: Fri, 6 Feb 2026 21:12:18 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: Michael Chan <michael.chan@...adcom.com>
Cc: davem@...emloft.net, netdev@...r.kernel.org, edumazet@...gle.com,
 pabeni@...hat.com, andrew+netdev@...n.ch, pavan.chebbi@...adcom.com,
 andrew.gospodarek@...adcom.com
Subject: Re: [PATCH net v2 4/4] selftests: drv-net: rss_ctx: test RSS
 contexts persist after ifdown/up

On Thu,  5 Feb 2026 21:29:30 -0800 Michael Chan wrote:
> diff --git a/tools/testing/selftests/drivers/net/hw/rss_ctx.py b/tools/testing/selftests/drivers/net/hw/rss_ctx.py

Please use:

 ruff check $file
 pylint --disable=R $file

and fix the new warnings.

This file predates my discovery of these tools so there are some
warnings already, but let's not add more.

> +@...t_disruptive
> +def test_rss_context_persist_ifupdown(cfg, pre_down=False):
> +    """
> +    Test that RSS contexts and their associated ntuple filters persist across
> +    an interface down/up cycle.
> +
> +    """
> +
> +    require_ntuple(cfg)
> +
> +    qcnt = len(_get_rx_cnts(cfg))
> +    if qcnt < 6:
> +        try:
> +            ethtool(f"-L {cfg.ifname} combined 6")
> +            defer(ethtool, f"-L {cfg.ifname} combined {qcnt}")
> +        except:
> +            raise KsftSkipEx("Not enough queues for the test")
> +
> +    ethtool(f"-X {cfg.ifname} equal 2")
> +    defer(ethtool, f"-X {cfg.ifname} default")
> +
> +    if pre_down:
> +        ip(f"link set dev {cfg.ifname} down")
> +
> +    try:
> +        ctx1_id = ethtool_create(cfg, "-X", "context new start 2 equal 2")
> +        defer(ethtool, f"-X {cfg.ifname} context {ctx1_id} delete")
> +    except CmdExitFailure:
> +        if pre_down:
> +            ip(f"link set dev {cfg.ifname} up")

You should use defer for the ifup. You can save it and run it with
.exec():

	ifup = defer(ip, f"link set dev {cfg.ifname} up")
	if pre_down:
		ip(f"link set dev {cfg.ifname} down")

	try:
		ctx1_id = ethtool_create(cfg, "-X", "context new start 2 equal 2")
		defer(ethtool, f"-X {cfg.ifname} context {ctx1_id} delete")
	except CmdExitFailure:
		raise KsftSkipEx("Create context not supported with interface down")

	....

	if not pre_down:
		ip(f"link set dev {cfg.ifname} down")
	ifup.exec()

this ifup.exec() also removes ifup from the "defer queue".

> +            raise KsftSkipEx("Create context not supported with interface down")
> +        raise
> +
> +    ctx2_id = ethtool_create(cfg, "-X", "context new start 4 equal 2")
> +    defer(ethtool, f"-X {cfg.ifname} context {ctx2_id} delete")
> +
> +    port_ctx2 = rand_port()
> +    flow = f"flow-type tcp{cfg.addr_ipver} dst-ip {cfg.addr} dst-port {port_ctx2} context {ctx2_id}"
> +    ntuple_id = ethtool_create(cfg, "-N", flow)
> +    defer(ethtool, f"-N {cfg.ifname} delete {ntuple_id}")
> +
> +    if not pre_down:
> +        ip(f"link set dev {cfg.ifname} down")
> +
> +    ip(f"link set dev {cfg.ifname} up")

You can add here:

	wait_file(f"/sys/class/net/{cfg.ifname}/carrier",
		  lambda x: x.strip() == "1")   

to wait for carrier before running the ping loop.



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ