Lines Matching full:cfg
10 def get_shapers(cfg, nl_shaper) -> None: argument
12 shapers = nl_shaper.get({'ifindex': cfg.ifindex}, dump=True)
21 def get_caps(cfg, nl_shaper) -> None: argument
23 caps = nl_shaper.cap_get({'ifindex': cfg.ifindex}, dump=True)
33 def set_qshapers(cfg, nl_shaper) -> None: argument
35 caps = nl_shaper.cap_get({'ifindex': cfg.ifindex,
44 cfg.queues = True;
46 channels = netnl.channels_get({'header': {'dev-index': cfg.ifindex}})
48 cfg.rx_type = 'rx'
49 cfg.nr_queues = channels['rx-count']
51 cfg.rx_type = 'combined'
52 cfg.nr_queues = channels['combined-count']
53 if cfg.nr_queues < 3:
54 raise KsftSkipEx(f"device does not support enough queues min 3 found {cfg.nr_queues}")
56 nl_shaper.set({'ifindex': cfg.ifindex,
60 nl_shaper.set({'ifindex': cfg.ifindex,
68 shaper_q0 = nl_shaper.get({'ifindex': cfg.ifindex,
74 shaper_q1 = nl_shaper.get({'ifindex': cfg.ifindex,
76 ksft_eq(shaper_q1, {'ifindex': cfg.ifindex,
82 shapers = nl_shaper.get({'ifindex': cfg.ifindex}, dump=True)
83 ksft_eq(shapers, [{'ifindex': cfg.ifindex,
88 {'ifindex': cfg.ifindex,
94 def del_qshapers(cfg, nl_shaper) -> None: argument
95 if not cfg.queues:
98 nl_shaper.delete({'ifindex': cfg.ifindex,
100 nl_shaper.delete({'ifindex': cfg.ifindex,
102 shapers = nl_shaper.get({'ifindex': cfg.ifindex}, dump=True)
105 def set_nshapers(cfg, nl_shaper) -> None: argument
108 caps = nl_shaper.cap_get({'ifindex': cfg.ifindex,
117 cfg.netdev = True;
118 nl_shaper.set({'ifindex': cfg.ifindex,
122 shapers = nl_shaper.get({'ifindex': cfg.ifindex}, dump=True)
123 ksft_eq(shapers, [{'ifindex': cfg.ifindex,
128 def del_nshapers(cfg, nl_shaper) -> None: argument
129 if not cfg.netdev:
132 nl_shaper.delete({'ifindex': cfg.ifindex,
134 shapers = nl_shaper.get({'ifindex': cfg.ifindex}, dump=True)
137 def basic_groups(cfg, nl_shaper) -> None: argument
138 if not cfg.netdev:
140 if cfg.nr_queues < 3:
141 raise KsftSkipEx(f"netdev does not have enough queues min 3 reported {cfg.nr_queues}")
144 caps = nl_shaper.cap_get({'ifindex': cfg.ifindex,
154 'ifindex': cfg.ifindex,
162 ksft_eq(node_handle, {'ifindex': cfg.ifindex,
165 shaper = nl_shaper.get({'ifindex': cfg.ifindex,
167 ksft_eq(shaper, {'ifindex': cfg.ifindex,
172 nl_shaper.delete({'ifindex': cfg.ifindex,
174 nl_shaper.delete({'ifindex': cfg.ifindex,
179 shapers = nl_shaper.get({'ifindex': cfg.ifindex}, dump=True)
182 nl_shaper.delete({'ifindex': cfg.ifindex,
185 def qgroups(cfg, nl_shaper) -> None: argument
186 if cfg.nr_queues < 4:
187 raise KsftSkipEx(f"netdev does not have enough queues min 4 reported {cfg.nr_queues}")
189 caps = nl_shaper.cap_get({'ifindex': cfg.ifindex,
198 caps = nl_shaper.cap_get({'ifindex': cfg.ifindex,
207 cfg.groups = True;
209 'ifindex': cfg.ifindex,
219 shaper = nl_shaper.get({'ifindex': cfg.ifindex,
221 ksft_eq(shaper, {'ifindex': cfg.ifindex,
225 shaper = nl_shaper.get({'ifindex': cfg.ifindex,
227 ksft_eq(shaper, {'ifindex': cfg.ifindex,
237 'ifindex': cfg.ifindex,
250 'ifindex': cfg.ifindex,
254 ksft_eq(node_handle, {'ifindex': cfg.ifindex,
257 shaper = nl_shaper.get({'ifindex': cfg.ifindex,
259 ksft_eq(shaper, {'ifindex': cfg.ifindex,
264 nl_shaper.delete({'ifindex': cfg.ifindex,
266 nl_shaper.delete({'ifindex': cfg.ifindex,
270 nl_shaper.delete({'ifindex': cfg.ifindex,
272 shapers = nl_shaper.get({'ifindex': cfg.ifindex}, dump=True)
273 ksft_eq(shapers, [{'ifindex': cfg.ifindex,
279 nl_shaper.delete({'ifindex': cfg.ifindex,
281 shapers = nl_shaper.get({'ifindex': cfg.ifindex}, dump=True)
284 def delegation(cfg, nl_shaper) -> None: argument
285 if not cfg.groups:
288 caps = nl_shaper.cap_get({'ifindex': cfg.ifindex,
298 'ifindex': cfg.ifindex,
312 'ifindex': cfg.ifindex,
322 shapers = nl_shaper.get({'ifindex': cfg.ifindex}, dump=True)
323 ksft_eq(shapers, [{'ifindex': cfg.ifindex,
327 {'ifindex': cfg.ifindex,
331 {'ifindex': cfg.ifindex,
335 {'ifindex': cfg.ifindex,
340 {'ifindex': cfg.ifindex,
347 nl_shaper.delete({'ifindex': cfg.ifindex,
349 shapers = nl_shaper.get({'ifindex': cfg.ifindex}, dump=True)
350 ksft_eq(shapers, [{'ifindex': cfg.ifindex,
354 {'ifindex': cfg.ifindex,
358 {'ifindex': cfg.ifindex,
362 {'ifindex': cfg.ifindex,
370 nl_shaper.delete({'ifindex': cfg.ifindex,
372 shapers = nl_shaper.get({'ifindex': cfg.ifindex}, dump=True)
375 def queue_update(cfg, nl_shaper) -> None: argument
376 if cfg.nr_queues < 4:
377 raise KsftSkipEx(f"netdev does not have enough queues min 4 reported {cfg.nr_queues}")
378 if not cfg.queues:
382 nl_shaper.set({'ifindex': cfg.ifindex,
388 cmd(f"ethtool -L {cfg.dev['ifname']} {cfg.rx_type} 3", timeout=10)
389 shapers = nl_shaper.get({'ifindex': cfg.ifindex}, dump=True)
390 ksft_eq(shapers, [{'ifindex': cfg.ifindex,
395 {'ifindex': cfg.ifindex,
400 {'ifindex': cfg.ifindex,
408 cmd(f"ethtool -L {cfg.dev['ifname']} {cfg.rx_type} 2", timeout=10)
410 shapers = nl_shaper.get({'ifindex': cfg.ifindex}, dump=True)
411 ksft_eq(shapers, [{'ifindex': cfg.ifindex,
416 {'ifindex': cfg.ifindex,
423 cmd(f"ethtool -L {cfg.dev['ifname']} {cfg.rx_type} {cfg.nr_queues}", timeout=10)
424 shapers = nl_shaper.get({'ifindex': cfg.ifindex}, dump=True)
425 ksft_eq(shapers, [{'ifindex': cfg.ifindex,
430 {'ifindex': cfg.ifindex,
438 nl_shaper.delete({'ifindex': cfg.ifindex,
442 with NetDrvEnv(__file__, queue_count=4) as cfg:
443 cfg.queues = False
444 cfg.netdev = False
445 cfg.groups = False
446 cfg.nr_queues = 0
456 queue_update], args=(cfg, NetshaperFamily()))