Skip to content

Commit 933048f

Browse files
committed
selftests: drv-net: rss_ctx: test flow rehashing without impacting traffic
Some workloads may want to rehash the flows in response to an imbalance. Most effective way to do that is changing the RSS key. Check that changing the key does not cause link flaps or traffic disruption. Disrupting traffic for key update is not incorrect, but makes the key update unusable for rehashing under load. Reviewed-by: Willem de Bruijn <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 7e3e5b0 commit 933048f

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

tools/testing/selftests/drivers/net/hw/rss_ctx.py

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,36 @@ def test_rss_resize(cfg):
244244
f"Table imbalance after resize: {data['rss-indirection-table']}")
245245

246246

247+
def test_hitless_key_update(cfg):
248+
"""Test that flows may be rehashed without impacting traffic.
249+
250+
Some workloads may want to rehash the flows in response to an imbalance.
251+
Most effective way to do that is changing the RSS key. Check that changing
252+
the key does not cause link flaps or traffic disruption.
253+
254+
Disrupting traffic for key update is not a bug, but makes the key
255+
update unusable for rehashing under load.
256+
"""
257+
data = get_rss(cfg)
258+
key_len = len(data['rss-hash-key'])
259+
260+
key = _rss_key_rand(key_len)
261+
262+
tgen = GenerateTraffic(cfg)
263+
try:
264+
errors0, carrier0 = get_drop_err_sum(cfg)
265+
t0 = datetime.datetime.now()
266+
ethtool(f"-X {cfg.ifname} hkey " + _rss_key_str(key))
267+
t1 = datetime.datetime.now()
268+
errors1, carrier1 = get_drop_err_sum(cfg)
269+
finally:
270+
tgen.wait_pkts_and_stop(5000)
271+
272+
ksft_lt((t1 - t0).total_seconds(), 0.2)
273+
ksft_eq(errors1 - errors1, 0)
274+
ksft_eq(carrier1 - carrier0, 0)
275+
276+
247277
def test_rss_context(cfg, ctx_cnt=1, create_with_cfg=None):
248278
"""
249279
Test separating traffic into RSS contexts.
@@ -479,7 +509,7 @@ def main() -> None:
479509
cfg.netdevnl = NetdevFamily()
480510

481511
ksft_run([test_rss_key_indir, test_rss_queue_reconfigure,
482-
test_rss_resize,
512+
test_rss_resize, test_hitless_key_update,
483513
test_rss_context, test_rss_context4, test_rss_context32,
484514
test_rss_context_queue_reconfigure,
485515
test_rss_context_overlap, test_rss_context_overlap2,

0 commit comments

Comments
 (0)