Lines Matching +full:1 +full:f
29 ksft_eq(bool(non_zero), True, comment=f"RSS key is all zero {data['rss-hash-key']}")
33 return ethtool(f"-x {cfg.ifname} context {context}", json=True)[0]
47 output = ethtool(f"{act} {cfg.ifname} {opts}").stdout
48 # Output will be something like: "New RSS context is 1" or
50 return int(output.split()[-1])
54 features = ethtool(f"-k {cfg.ifname}", json=True)[0]
68 queue_stats = [0] * (max_q + 1)
91 ksft_ge(directed, 20000, f"traffic on {name}: " + str(cnts))
94 f"traffic on other queues ({name})':" + str(cnts))
97 f"traffic on inactive queues ({name}): " + str(cnts))
102 text = ethtool(f"-n {cfg.ifname} rule {rule_id}").stdout
103 pattern = f"RSS Context (ID: )?{ctx_id}"
120 raise KsftFailEx(f"ethtool results empty for '{k}': {data[k]}")
127 ethtool(f"-X {cfg.ifname} hkey " + _rss_key_str(key))
134 ethtool(f"-X {cfg.ifname} equal 3 hkey " + _rss_key_str(key))
135 reset_indir = defer(ethtool, f"-X {cfg.ifname} default")
144 ethtool(f"-X {cfg.ifname} default hkey " + _rss_key_str(key))
148 ksft_eq(qcnt - 1, max(data['rss-indirection-table']))
151 ethtool(f"-X {cfg.ifname} equal 2")
154 ksft_eq(1, max(data['rss-indirection-table']))
161 ksft_ge(cnts[0], 5000, "traffic on main context (1/2): " + str(cnts))
162 ksft_ge(cnts[1], 5000, "traffic on main context (2/2): " + str(cnts))
191 ethtool(f"-L {cfg.ifname} combined 4")
192 defer(ethtool, f"-L {cfg.ifname} combined {qcnt}")
201 ctx_ref = f"context {ctx_id}"
202 defer(ethtool, f"-X {cfg.ifname} {ctx_ref} delete")
212 ethtool(f"-L {cfg.ifname} combined 5")
216 ethtool(f"-L {cfg.ifname} combined 4")
220 ethtool(f"-X {cfg.ifname} {ctx_ref} weight 1 0 0 1")
223 defer(ethtool, f"-X {cfg.ifname} default")
226 flow = f"flow-type tcp{cfg.addr_ipver} dst-ip {cfg.addr} dst-port {port} context {ctx_id}"
228 defer(ethtool, f"-N {cfg.ifname} delete {ntuple}")
231 other_key: (1, 2) })
234 ethtool(f"-L {cfg.ifname} combined 5")
239 other_key: (1, 2, 4) })
243 ethtool(f"-L {cfg.ifname} combined 3")
247 … raise Exception(f"Driver didn't prevent us from deactivating a used queue (context {ctx_id})")
250 ethtool(f"-L {cfg.ifname} combined 4")
251 …flow = f"flow-type tcp{cfg.addr_ipver} dst-ip {cfg.addr} dst-port {port} context {ctx_id} action 1"
258 … raise Exception(f"Driver didn't prevent us from targeting a nonexistent queue (context {ctx_id})")
260 ethtool(f"-X {cfg.ifname} {ctx_ref} weight 1 0 1 0")
261 # ntuple rule therefore targets queues 1 and 3
265 _send_traffic_check(cfg, port, ctx_ref, { 'target': (1, 3),
269 ethtool(f"-L {cfg.ifname} combined 3")
273 … raise Exception(f"Driver didn't prevent us from deactivating a used queue (context {ctx_id})")
290 raise KsftSkipEx(f"Not enough queues for the test: {ch_max}")
292 ethtool(f"-L {cfg.ifname} combined 2")
293 defer(ethtool, f"-L {cfg.ifname} combined {qcnt}")
295 ethtool(f"-X {cfg.ifname} weight 1 7")
296 defer(ethtool, f"-X {cfg.ifname} default")
298 ethtool(f"-L {cfg.ifname} combined {ch_max}")
301 ksft_eq(1, max(data['rss-indirection-table']))
304 data['rss-indirection-table'].count(1) /
306 f"Table imbalance after resize: {data['rss-indirection-table']}")
328 ethtool(f"-X {cfg.ifname} hkey " + _rss_key_str(key))
355 ids.append(ethtool_create(cfg, "-X", f"context new"))
356 defer(ethtool, f"-X {cfg.ifname} context {ids[-1]} delete")
358 ids.append(ethtool_create(cfg, "-X", f"context new weight 1 1"))
359 defer(ethtool, f"-X {cfg.ifname} context {ids[-1]} delete")
361 ids.append(ethtool_create(cfg, "-X", f"context new hkey {key}"))
362 defer(ethtool, f"-X {cfg.ifname} context {ids[-1]} delete")
366 ksft_pr(f"Added only {len(ids)} out of 3 contexts")
368 expect_tuples = set([(cfg.ifname, -1)] + [(cfg.ifname, ctx_id) for ctx_id in ids])
372 tuples = [(c['header']['dev-name'], c.get('context', -1)) for c in ctxs]
380 ksft_ne(set(data.get('hkey', [1])), {0}, "key is all zero")
383 if len(ids) > 1 and data.get('context') == ids[1]:
384 ksft_eq(set(data['indir']), {0, 1},
391 tuples = [(c['header']['dev-name'], c.get('context', -1)) for c in ctxs]
397 expect_tuples.remove((cfg.ifname, -1))
399 ctxs = cfg.ethnl.rss_get({'start-context': 1}, dump=True)
400 tuples = [(c['header']['dev-name'], c.get('context', -1)) for c in ctxs]
406 ctxs = cfg.ethnl.rss_get({'header': {'dev-name': cfg.ifname}, 'start-context': 1}, dump=True)
407 ctx_tuples = set([(c['header']['dev-name'], c.get('context', -1)) for c in ctxs])
411 def test_rss_context(cfg, ctx_cnt=1, create_with_cfg=None):
416 [0 1] [2 3] [4 5] [6 7] ...
427 ksft_pr(f"Increasing queue count {qcnt} -> {2 + 2 * ctx_cnt}")
428 ethtool(f"-L {cfg.ifname} combined {2 + 2 * ctx_cnt}")
429 defer(ethtool, f"-L {cfg.ifname} combined {qcnt}")
435 # Use queues 0 and 1 for normal traffic
436 ethtool(f"-X {cfg.ifname} equal 2")
437 defer(ethtool, f"-X {cfg.ifname} default")
440 want_cfg = f"start {2 + i * 2} equal 2"
444 ctx_id = ethtool_create(cfg, "-X", f"context new {create_cfg}")
445 defer(ethtool, f"-X {cfg.ifname} context {ctx_id} delete")
450 ksft_pr(f"Failed to create context {i + 1}, trying to test what we got")
457 ethtool(f"-X {cfg.ifname} context {ctx_id} {want_cfg}")
463 … ksft_eq(max(data['rss-indirection-table']), 2 + i * 2 + 1, "Unexpected context cfg: " + str(data))
466 … flow = f"flow-type tcp{cfg.addr_ipver} dst-ip {cfg.addr} dst-port {ports[i]} context {ctx_id}"
468 defer(ethtool, f"-N {cfg.ifname} delete {ntuple}")
473 _send_traffic_check(cfg, ports[i], f"context {i}",
475 'noise': (0, 1),
479 raise KsftSkipEx(f"Tested only {ctx_cnt} contexts, wanted {requested_ctx_cnt}")
514 ksft_pr(f"Increasing queue count {qcnt} -> {2 + 2 * ctx_cnt}")
515 ethtool(f"-L {cfg.ifname} combined {2 + 2 * ctx_cnt}")
516 defer(ethtool, f"-L {cfg.ifname} combined {qcnt}")
535 'noise': (0, 1),
540 'target': (0, 1),
544 _send_traffic_check(cfg, ports[i], f"context {i}", expected)
546 # Use queues 0 and 1 for normal traffic
547 ethtool(f"-X {cfg.ifname} equal 2")
548 defer(ethtool, f"-X {cfg.ifname} default")
551 ctx_id = ethtool_create(cfg, "-X", f"context new start {2 + i * 2} equal 2")
552 ctx.append(defer(ethtool, f"-X {cfg.ifname} context {ctx_id} delete"))
555 … flow = f"flow-type tcp{cfg.addr_ipver} dst-ip {cfg.addr} dst-port {ports[i]} context {ctx_id}"
557 ntuple.append(defer(ethtool, f"-N {cfg.ifname} delete {ntuple_id}"))
570 remove_ctx(-1)
574 raise KsftSkipEx(f"Tested only {ctx_cnt} contexts, wanted {requested_ctx_cnt}")
580 Use 4 queues for the main context, but only queues 2 and 3 for context 1.
588 ksft_pr(f"Increasing queue count {queue_cnt} -> 4")
589 ethtool(f"-L {cfg.ifname} combined 4")
590 defer(ethtool, f"-L {cfg.ifname} combined {queue_cnt}")
595 ethtool(f"-X {cfg.ifname} equal 4")
596 defer(ethtool, f"-X {cfg.ifname} default")
599 ethtool(f"-X {cfg.ifname} context {other_ctx} equal 4")
600 defer(ethtool, f"-X {cfg.ifname} context {other_ctx} delete")
603 ethtool(f"-X {cfg.ifname} context {ctx_id} start 2 equal 2")
604 defer(ethtool, f"-X {cfg.ifname} context {ctx_id} delete")
608 … flow = f"flow-type tcp{cfg.addr_ipver} dst-ip {cfg.addr} dst-port {port} context {other_ctx}"
610 ntuple = defer(ethtool, f"-N {cfg.ifname} delete {ntuple_id}")
618 ksft_ge(sum(cnts[ :2]), 7000, "traffic on main context (1/2): " + str(cnts))
623 # Now create a rule for context 1 and make sure traffic goes to a subset
626 flow = f"flow-type tcp{cfg.addr_ipver} dst-ip {cfg.addr} dst-port {port} context {ctx_id}"
628 defer(ethtool, f"-N {cfg.ifname} delete {ntuple_id}")
655 ctx_deleter = defer(ethtool, f"-X {cfg.ifname} context {ctx_id} delete")
659 flow = f"flow-type tcp{cfg.addr_ipver} dst-ip {cfg.addr} dst-port {port} context {ctx_id}"
661 defer(ethtool, f"-N {cfg.ifname} delete {ntuple_id}")
667 raise KsftFailEx(f"deleted context {ctx_id} used by rule {ntuple_id}")
683 ksft_pr(f"Increasing queue count {queue_cnt} -> 4")
684 ethtool(f"-L {cfg.ifname} combined 4")
685 defer(ethtool, f"-L {cfg.ifname} combined {queue_cnt}")
690 ethtool(f"-X {cfg.ifname} equal 1")
691 defer(ethtool, f"-X {cfg.ifname} default")
695 defer(ethtool, f"-X {cfg.ifname} context {ctx_id} delete")
699 …flow = f"flow-type tcp{cfg.addr_ipver} dst-ip {cfg.addr} dst-port {port} context {ctx_id} action 2"
704 defer(ethtool, f"-N {cfg.ifname} delete {ntuple_id}")
706 _send_traffic_check(cfg, port, f"context {ctx_id}", { 'target': (2, 3),
707 'empty' : (1,),