Lines Matching +full:tx +full:- +full:queues +full:- +full:config

2 # SPDX-License-Identifier: GPL-2.0
24 def check_pause(cfg) -> None:
26 Check that drivers which support Pause config also report standard
31 ethnl.pause_get({"header": {"dev-index": cfg.ifindex}})
37 data = ethnl.pause_get({"header": {"dev-index": cfg.ifindex,
42 def check_fec(cfg) -> None:
44 Check that drivers which support FEC config also report standard
49 ethnl.fec_get({"header": {"dev-index": cfg.ifindex}})
55 data = ethnl.fec_get({"header": {"dev-index": cfg.ifindex,
60 def check_fec_hist(cfg) -> None:
67 data = ethnl.fec_get({"header": {"dev-index": cfg.ifindex,
80 for key in ['bin-low', 'bin-high', 'bin-val']:
83 ksft_ge(fec_bin['bin-high'], fec_bin['bin-low'],
85 if 'bin-val-per-lane' in fec_bin:
86 ksft_eq(sum(fec_bin['bin-val-per-lane']), fec_bin['bin-val'],
87 "FEC bin value should be equal to sum of per-plane values")
90 def pkt_byte_sum(cfg) -> None:
107 for key in ['tx-packets', 'tx-bytes', 'rx-packets', 'rx-bytes']:
114 for key in ['tx-packets', 'tx-bytes', 'rx-packets', 'rx-bytes']:
116 return rstat[key] - qstat[key]
120 rtstat = rtnl.getlink({"ifi-index": cfg.ifindex})['stats64']
128 def qstat_by_ifindex(cfg) -> None:
129 """ Qstats Netlink API tests - querying by ifindex. """
131 # Construct a map ifindex -> [dump, by-index, dump]
158 queues = NetdevFamily(recv_size=4096).qstats_get({"scope": "queue"}, dump=True)
159 # Reformat the output into {ifindex: {rx: [id, id, ...], tx: [id, id, ...]}}
161 for entry in queues:
164 parsed[ifindex] = {"rx":[], "tx": []}
165 parsed[ifindex][entry["queue-type"]].append(entry['queue-id'])
167 for ifindex, queues in parsed.items():
168 for qtype in ['rx', 'tx']:
169 ksft_eq(len(queues[qtype]), len(set(queues[qtype])),
171 ksft_eq(len(queues[qtype]), max(queues[qtype]) + 1,
178 ksft_eq(cm.exception.nl_msg.error, -34)
179 ksft_eq(cm.exception.nl_msg.extack['bad-attr'], '.ifindex')
184 ksft_eq(cm.exception.nl_msg.error, -errno.EOPNOTSUPP)
185 ksft_eq(cm.exception.nl_msg.extack['bad-attr'], '.ifindex')
189 all_ifindexes = set(dev["ifi-index"] for dev in devs)
196 ksft_eq(cm.exception.nl_msg.error, -19)
197 ksft_eq(cm.exception.nl_msg.extack['bad-attr'], '.ifindex')
201 def check_down(cfg) -> None:
218 # exercise per-queue API to make sure that "device down" state
225 if body[-1] != ';':
232 def __stats_increase_sanely(old, new) -> None:
235 ksft_lt(new[k] - old[k], 1 << 31, comment="likely wrapping error")
238 def procfs_hammer(cfg) -> None:
253 rtstat1 = rtnl.getlink({"ifi-index": cfg.ifindex})['stats64']
255 rtstat2 = rtnl.getlink({"ifi-index": cfg.ifindex})['stats64']
261 def procfs_downup_hammer(cfg) -> None:
266 # Max out the queues, we'll flip between max and 1
267 channels = ethnl.channels_get({'header': {'dev-index': cfg.ifindex}})
268 if channels['combined-count'] == 0:
272 cur_queue_cnt = channels[f'{rx_type}-count']
273 max_queue_cnt = channels[f'{rx_type}-max']
275 cmd(f"ethtool -L {cfg.ifname} {rx_type} {max_queue_cnt}")
276 defer(cmd, f"ethtool -L {cfg.ifname} {rx_type} {cur_queue_cnt}")
284 # The "echo -n 1" lets us count iterations below
286 f"ethtool -L {cfg.ifname} {rx_type} 1; " + \
287 f"ethtool -L {cfg.ifname} {rx_type} {max_queue_cnt}; " + \
288 "echo -n 1"
297 rtstat1 = rtnl.getlink({"ifi-index": cfg.ifindex})['stats64']
300 rtstat2 = rtnl.getlink({"ifi-index": cfg.ifindex})['stats64']
305 ksft_pr("completed up/down cycles:", len(stdout.decode('utf-8')))
308 def main() -> None: