Skip to contentSkip to conversation

selftests: drv-net: Test queue stall upon reconfig

PATCH Superseded Mohsin Bashir 2 participants 3 messages Jul 25 – Jul 30

Subsystems (3)

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 selftests: drv-net: Test queue stall upon reconfig

From: Mohsin Bashir <[email protected]>

Add a reconfig_tx_stall test that detects the possibility of a TX stall after ring reconfiguration. The key observation is that drivers using netif_tx_start_all_queues() are prone to experiencing a stall when reconfiguration completes compared to drivers using netif_tx_wake_all_queues(). start_all_queues only clears DRV_XOFF, while wake_all_queues also calls __netif_schedule() to kick the qdisc. Without the kick, qdisc backlog present at reconfig time can stay stuck until a new trigger is issued.

The test caps the TX ring at 64 entries so it fills quickly, then installs FQ on a target TX queue and sends UDP packets with SO_TXTIME scheduled in the future. With napi_defer_hard_irqs slowing completions, the small ring can fill when FQ releases the burst, leaving requeued qdisc backlog with no FQ timer to rescue it. A subsequent ring reconfig must wake the queues to drain the backlog. Simply starting the queues can leave it stuck.

Some drivers lack backpressure on the TX path and may not be able to build up the qdisc backlog the test relies on. In that case report an expected failure (xfail) instead of a hard failure.

On host with problematic driver:
Sent 128 SO_TXTIME packets (+100ms)
Sent 128 SO_TXTIME packets (+200ms)
Backlog before reconfig: 52632 bytes
Check| At /root/ksft-net-drv/./drivers/net/ring_reconfig.py, ...
Check| ksft_eq(0, backlog,
Check failed 0 != 52632 qdisc backlog stuck on queue 1 after ring reconfig
not ok 3 ring_reconfig.reconfig_tx_stall

On host with fixed driver:
Sent 128 SO_TXTIME packets (+100ms)
Sent 128 SO_TXTIME packets (+200ms)
Backlog before reconfig: 76024 bytes
ok 3 ring_reconfig.reconfig_tx_stall

---
Changelog:
V4:
- Some drivers lack backpressure on the TX path and cannot build up the qdisc backlog; report xfail in that case instead of failing.

V3: https://lore.kernel.org/netdev/[email protected]

V2: https://lore.kernel.org/netdev/[email protected]

V1: https://lore.kernel.org/netdev/[email protected]

---
 tools/testing/selftests/drivers/net/config    |   3 +
 .../selftests/drivers/net/lib/py/env.py       |  11 +-
 .../selftests/drivers/net/ring_reconfig.py    | 211 +++++++++++++++++-
 3 files changed, 219 insertions(+), 6 deletions(-)
tools/testing/selftests/drivers/net/config +3 -0
index 2070e890e064..f3933cf3e6be 100644
@@ -4,8 +4,11 @@ CONFIG_DEBUG_INFO_BTF_MODULES=n
 CONFIG_INET_PSP=y
 CONFIG_IPV6=y
 CONFIG_MACSEC=m
+CONFIG_NET_ACT_SKBEDIT=m
 CONFIG_NET_CLS_ACT=y
 CONFIG_NET_CLS_BPF=y
+CONFIG_NET_CLS_FLOWER=m
+CONFIG_NET_CLS_MATCHALL=m
 CONFIG_NETCONSOLE=m
 CONFIG_NETCONSOLE_DYNAMIC=y
 CONFIG_NETCONSOLE_EXTENDED_LOG=y
tools/testing/selftests/drivers/net/lib/py/env.py +8 -3
index e4acf3d8333f..b1c6f6cef7dd 100644
@@ -114,10 +114,11 @@ class NetDrvEpEnv(NetDrvEnvBase):
     nsim_v4_pfx = "192.0.2."
     nsim_v6_pfx = "2001:db8::"
 
-    def __init__(self, src_path, nsim_test=None):
+    def __init__(self, src_path, nsim_test=None, queue_count=None):
         super().__init__(src_path)
 
         self._stats_settle_time = None
+        self._queue_count = queue_count
 
         # Things we try to destroy
         self.remote = None
@@ -173,9 +174,13 @@ class NetDrvEpEnv(NetDrvEnvBase):
         self._required_cmd = {}
 
     def create_local(self):
+        nsim_kwargs = {}
+        if self._queue_count:
+            nsim_kwargs["queue_count"] = self._queue_count
+
         self._netns = NetNS()
-        self._ns = NetdevSimDev()
-        self._ns_peer = NetdevSimDev(ns=self._netns)
+        self._ns = NetdevSimDev(**nsim_kwargs)
+        self._ns_peer = NetdevSimDev(ns=self._netns, **nsim_kwargs)
 
         with open("/proc/self/ns/net") as nsfd0, \
              open("/var/run/netns/" + self._netns.name) as nsfd1:
tools/testing/selftests/drivers/net/ring_reconfig.py +208 -3

232 lines not on this page · raw message

Signature · 1 line
2.53.0-Meta
maintainer
#1 lore raw

tools/testing/selftests/drivers/net/ring_reconfig.py line 22

Quoted 2 lines · On Fri, 24 Jul 2026 17:21:55 -0700 Mohsin Bashir wrote:
tools/testing/selftests/drivers/net/ring_reconfig.py +2 -0
+# TX ring size the test shrinks to so the ring fills quickly.
+MIN_TX_RING = 64

Testing against bnxt is failing in NIPA, could you check why? I suspect the rings size may be too small (hence the quote). There was a recent patch to Intel drivers to require min ring of 128 so we may need to try a few values ([32, 64, 128, 256]?) before giving up?

Signature · 1 line
pw-bot: cr
#2 lore raw
Quoted 9 lines · Jakub Kicinski

tools/testing/selftests/drivers/net/ring_reconfig.py line 22

Quoted 2 lines · On Fri, 24 Jul 2026 17:21:55 -0700 Mohsin Bashir wrote:
tools/testing/selftests/drivers/net/ring_reconfig.py +2 -0
+# TX ring size the test shrinks to so the ring fills quickly.
+MIN_TX_RING = 64

Testing against bnxt is failing in NIPA, could you check why? I suspect the rings size may be too small (hence the quote). There was a recent patch to Intel drivers to require min ring of 128 so we may need to try a few values ([32, 64, 128, 256]?) before giving up?

Thanks for the pointer. Your suspicion is correct. Broadcom does not allow tx ring size to be < 420 when we have software based udp segmentation. I'll harden the test accordingly.