Lines Matching +full:- +full:cfg
2 # SPDX-License-Identifier: GPL-2.0
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,
41 if not 'support-bw-max' in caps or not 'support-metric-bps' in caps:
44 cfg.queues = True;
46 channels = netnl.channels_get({'header': {'dev-index': cfg.ifindex}})
47 if channels['combined-count'] == 0:
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,
59 'bw-max': 10000})
60 nl_shaper.set({'ifindex': cfg.ifindex,
63 'bw-max': 20000})
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,
80 'bw-max': 10000})
82 shapers = nl_shaper.get({'ifindex': cfg.ifindex}, dump=True)
83 ksft_eq(shapers, [{'ifindex': cfg.ifindex,
87 'bw-max': 10000},
88 {'ifindex': cfg.ifindex,
92 'bw-max': 20000}])
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,
114 if not 'support-bw-max' in caps or not 'support-metric-bps' in caps:
117 cfg.netdev = True;
118 nl_shaper.set({'ifindex': cfg.ifindex,
120 'bw-max': 100000})
122 shapers = nl_shaper.get({'ifindex': cfg.ifindex}, dump=True)
123 ksft_eq(shapers, [{'ifindex': cfg.ifindex,
126 'bw-max': 100000}])
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,
150 if not 'support-weight' in caps:
154 'ifindex': cfg.ifindex,
161 'bw-max': 10000})
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,
195 if not 'support-bw-max' in caps or not 'support-metric-bps' in caps:
198 caps = nl_shaper.cap_get({'ifindex': cfg.ifindex,
204 …if not 'support-nesting' in caps or not 'support-weight' in caps or not 'support-metric-bps' in ca…
207 cfg.groups = True;
209 'ifindex': cfg.ifindex,
216 'bw-max': 10000})
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,
231 'bw-max': 10000})
237 'ifindex': cfg.ifindex,
242 'bw-max': 10000})
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,
294 if not 'support-nesting' in caps:
298 'ifindex': cfg.ifindex,
307 'bw-max': 10000})
312 'ifindex': cfg.ifindex,
319 'bw-max': 5000})
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,
339 'bw-max': 10000},
340 {'ifindex': cfg.ifindex,
344 'bw-max': 5000}])
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,
366 'bw-max': 10000}])
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,
385 'bw-max': (i + 1) * 1000})
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,
394 'bw-max': 1000},
395 {'ifindex': cfg.ifindex,
399 'bw-max': 2000},
400 {'ifindex': cfg.ifindex,
404 'bw-max': 3000}])
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,
415 'bw-max': 1000},
416 {'ifindex': cfg.ifindex,
420 'bw-max': 2000}])
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,
429 'bw-max': 1000},
430 {'ifindex': cfg.ifindex,
434 'bw-max': 2000}])
438 nl_shaper.delete({'ifindex': cfg.ifindex,
441 def main() -> None:
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()))