All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bobby Eshleman <bobbyeshleman@gmail.com>
To: Michael Chan <michael.chan@broadcom.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, andrew+netdev@lunn.ch,
	pavan.chebbi@broadcom.com, andrew.gospodarek@broadcom.com
Subject: Re: [PATCH net v2 4/4] selftests: drv-net: rss_ctx: test RSS contexts persist after ifdown/up
Date: Fri, 6 Feb 2026 10:45:05 -0800	[thread overview]
Message-ID: <aYY2sak4adKOGRSv@devvm11784.nha0.facebook.com> (raw)
In-Reply-To: <20260206052930.1882740-5-michael.chan@broadcom.com>

On Thu, Feb 05, 2026 at 09:29:30PM -0800, Michael Chan wrote:
> From: Pavan Chebbi <pavan.chebbi@broadcom.com>
> 
> Add a test to verify that RSS contexts persist across interface
> down/up along with their associated Ntuple fitlers. Another test
> that creates contexts/rules keeping interface down and test their
> persistence is also added.
> 
> Tested on bnxt_en:
> 
>  TAP version 13
>  1..1
>  # timeout set to 0
>  # selftests: drivers/net/hw: rss_ctx.py
>  # TAP version 13
>  # 1..2
>  # ok 1 rss_ctx.test_rss_context_persist_create_and_ifdown
>  # ok 2 rss_ctx.test_rss_context_persist_ifdown_and_create # SKIP Create context not supported with interface down
>  # # Totals: pass:1 fail:0 xfail:0 xpass:0 skip:1 error:0
> 
> Reviewed-by: Andy Gospodarek <andrew.gospodarek@broadcom.com>
> Signed-off-by: Pavan Chebbi <pavan.chebbi@broadcom.com>
> Signed-off-by: Michael Chan <michael.chan@broadcom.com>
> ---
> v2: Many improvements suggested by Jakub:
> 1. simplified the tests to have only 2 contexts, use one of the contexts
> to test ntuple filters' persistence also 
> 2. used @ksft_disruptive for the test
> 3. used netlink API to get rss contexts
> 
> v1: https://lore.kernel.org/netdev/20260129061646.1417185-5-michael.chan@broadcom.com/
> ---
>  .../selftests/drivers/net/hw/rss_ctx.py       | 102 +++++++++++++++++-
>  1 file changed, 101 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/drivers/net/hw/rss_ctx.py b/tools/testing/selftests/drivers/net/hw/rss_ctx.py
> index ed7e405682f0..f72162ee9dc3 100755
> --- a/tools/testing/selftests/drivers/net/hw/rss_ctx.py
> +++ b/tools/testing/selftests/drivers/net/hw/rss_ctx.py
> @@ -4,11 +4,13 @@
>  import datetime
>  import random
>  import re
> +import time
>  from lib.py import ksft_run, ksft_pr, ksft_exit
>  from lib.py import ksft_eq, ksft_ne, ksft_ge, ksft_in, ksft_lt, ksft_true, ksft_raises
>  from lib.py import NetDrvEpEnv
>  from lib.py import EthtoolFamily, NetdevFamily
>  from lib.py import KsftSkipEx, KsftFailEx
> +from lib.py import ksft_disruptive
>  from lib.py import rand_port
>  from lib.py import ethtool, ip, defer, GenerateTraffic, CmdExitFailure
>  
> @@ -809,6 +811,102 @@ def test_rss_default_context_rule(cfg):
>                            'noise' : (0, 1) })
>  
>  
> +@ksft_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")
> +            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")
> +
> +    import subprocess
> +    max_wait = 10
> +    ping_success = False
> +    remote_addr = cfg.remote_addr_v[cfg.addr_ipver]
> +    for attempt in range(max_wait):
> +        try:
> +            result = subprocess.run(['ping', '-c', '1', '-W', '1', remote_addr],
> +                                  capture_output=True, timeout=2)
> +            if result.returncode == 0:
> +                ping_success = True
> +                break

This might be wanting to use utils.py's cmd()?

> +        except Exception:
> +            pass

> +        time.sleep(1)
> +
> +    if not ping_success:
> +        raise KsftSkipEx("Cannot reach remote host after interface up")
> +
> +    ctxs = cfg.ethnl.rss_get({'header': {'dev-name': cfg.ifname}}, dump=True)
> +
> +    data1 = [c for c in ctxs if c.get('context') == ctx1_id]
> +    ksft_eq(len(data1), 1, f"Context {ctx1_id} should persist after ifup")
> +
> +    data2 = [c for c in ctxs if c.get('context') == ctx2_id]
> +    ksft_eq(len(data2), 1, f"Context {ctx2_id} should persist after ifup")
> +
> +    _ntuple_rule_check(cfg, ntuple_id, ctx2_id)
> +
> +    cnts = _get_rx_cnts(cfg)
> +    GenerateTraffic(cfg).wait_pkts_and_stop(20000)
> +    cnts = _get_rx_cnts(cfg, prev=cnts)
> +
> +    main_traffic = sum(cnts[0:2])
> +    ksft_ge(main_traffic, 18000, f"Main context traffic distribution: {cnts}")
> +    ksft_lt(sum(cnts[2:6]), 500, f"Other context queues should be mostly empty: {cnts}")
> +
> +    _send_traffic_check(cfg, port_ctx2, f"context {ctx2_id}",
> +                        {'target': (4, 5),
> +                         'noise': (0, 1),
> +                         'empty': (2, 3)})
> +
> +
> +def test_rss_context_persist_create_and_ifdown(cfg):
> +    test_rss_context_persist_ifupdown(cfg, pre_down=False)
> +
> +
> +def test_rss_context_persist_ifdown_and_create(cfg):
> +    test_rss_context_persist_ifupdown(cfg, pre_down=True)
> +
> +
>  def main() -> None:
>      with NetDrvEpEnv(__file__, nsim_test=False) as cfg:
>          cfg.context_cnt = None
> @@ -823,7 +921,9 @@ def main() -> None:
>                    test_rss_context_out_of_order, test_rss_context4_create_with_cfg,
>                    test_flow_add_context_missing,
>                    test_delete_rss_context_busy, test_rss_ntuple_addition,
> -                  test_rss_default_context_rule],
> +                  test_rss_default_context_rule,
> +                  test_rss_context_persist_create_and_ifdown,
> +                  test_rss_context_persist_ifdown_and_create],
>                   args=(cfg, ))
>      ksft_exit()
>  
> -- 
> 2.51.0
> 

  reply	other threads:[~2026-02-06 18:45 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-06  5:29 [PATCH net v2 0/4] bnxt_en: Fix RSS context and ntuple filter issues Michael Chan
2026-02-06  5:29 ` [PATCH net v2 1/4] bnxt_en: Fix RSS context delete logic Michael Chan
2026-02-06  5:29 ` [PATCH net v2 2/4] bnxt_en: Don't overload fw_vnic_id for RSS context's filters Michael Chan
2026-02-06  5:29 ` [PATCH net v2 3/4] bnxt_en: Fix deleting of Ntuple filters Michael Chan
2026-02-06  5:29 ` [PATCH net v2 4/4] selftests: drv-net: rss_ctx: test RSS contexts persist after ifdown/up Michael Chan
2026-02-06 18:45   ` Bobby Eshleman [this message]
2026-02-08 16:26     ` Pavan Chebbi
2026-02-11  1:46       ` Jakub Kicinski
2026-02-11  3:58         ` Pavan Chebbi
2026-02-11  4:17           ` Jakub Kicinski
2026-02-11  5:15             ` Pavan Chebbi
2026-02-11  7:59               ` Pavan Chebbi
2026-02-11 16:31                 ` Jakub Kicinski
2026-02-11 16:38                   ` Pavan Chebbi
2026-02-11 16:58                     ` Jakub Kicinski
2026-02-11 17:23                       ` Pavan Chebbi
2026-02-11 17:50                         ` Pavan Chebbi
2026-02-12  8:12                       ` [PATCH 1/1] " Pavan Chebbi
2026-02-13  1:52                         ` Jakub Kicinski
2026-02-13  3:52                           ` Pavan Chebbi
2026-02-21  0:40                         ` patchwork-bot+netdevbpf
2026-02-07  5:12   ` Jakub Kicinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aYY2sak4adKOGRSv@devvm11784.nha0.facebook.com \
    --to=bobbyeshleman@gmail.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=andrew.gospodarek@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=michael.chan@broadcom.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pavan.chebbi@broadcom.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.