Lines Matching +full:key +full:- +full:down

2 # SPDX-License-Identifier: GPL-2.0
20 def check_pause(cfg) -> None:
24 ethnl.pause_get({"header": {"dev-index": cfg.ifindex}})
30 data = ethnl.pause_get({"header": {"dev-index": cfg.ifindex,
35 def check_fec(cfg) -> None:
39 ethnl.fec_get({"header": {"dev-index": cfg.ifindex}})
45 data = ethnl.fec_get({"header": {"dev-index": cfg.ifindex,
50 def pkt_byte_sum(cfg) -> None:
65 for key in ['tx-packets', 'tx-bytes', 'rx-packets', 'rx-bytes']:
66 ksft_in(key, qstat, "Drivers should always report basic keys")
72 for key in ['tx-packets', 'tx-bytes', 'rx-packets', 'rx-bytes']:
73 if rstat[key] != qstat[key]:
74 return rstat[key] - qstat[key]
78 rtstat = rtnl.getlink({"ifi-index": cfg.ifindex})['stats64']
86 def qstat_by_ifindex(cfg) -> None:
90 # Construct a map ifindex -> [dump, by-index, dump]
112 for key in all_keys:
113 ksft_ge(triple[1][key], triple[0][key], comment="bad key: " + key)
114 ksft_ge(triple[2][key], triple[1][key], comment="bad key: " + key)
124 parsed[ifindex][entry["queue-type"]].append(entry['queue-id'])
137 ksft_eq(cm.exception.nl_msg.error, -34)
138 ksft_eq(cm.exception.nl_msg.extack['bad-attr'], '.ifindex')
143 ksft_eq(cm.exception.nl_msg.error, -errno.EOPNOTSUPP)
144 ksft_eq(cm.exception.nl_msg.extack['bad-attr'], '.ifindex')
148 all_ifindexes = set([dev["ifi-index"] for dev in devs])
155 ksft_eq(cm.exception.nl_msg.error, -19)
156 ksft_eq(cm.exception.nl_msg.extack['bad-attr'], '.ifindex')
160 def check_down(cfg) -> None:
168 ip(f"link set dev {cfg.dev['ifname']} down")
173 ksft_ge(qstat2[k], qstat[k], comment=f"{k} went backwards on device down")
175 # exercise per-queue API to make sure that "device down" state
182 if body[-1] != ';':
189 def __stats_increase_sanely(old, new) -> None:
192 ksft_lt(new[k] - old[k], 1 << 31, comment="likely wrapping error")
195 def procfs_hammer(cfg) -> None:
210 rtstat1 = rtnl.getlink({"ifi-index": cfg.ifindex})['stats64']
212 rtstat2 = rtnl.getlink({"ifi-index": cfg.ifindex})['stats64']
218 def procfs_downup_hammer(cfg) -> None:
224 channels = ethnl.channels_get({'header': {'dev-index': cfg.ifindex}})
225 if channels['combined-count'] == 0:
229 cur_queue_cnt = channels[f'{rx_type}-count']
230 max_queue_cnt = channels[f'{rx_type}-max']
232 cmd(f"ethtool -L {cfg.ifname} {rx_type} {max_queue_cnt}")
233 defer(cmd, f"ethtool -L {cfg.ifname} {rx_type} {cur_queue_cnt}")
241 # The "echo -n 1" lets us count iterations below
242 updown = f"{ipset} down; sleep 0.05; {ipset} up; sleep 0.05; " + \
243 f"ethtool -L {cfg.ifname} {rx_type} 1; " + \
244 f"ethtool -L {cfg.ifname} {rx_type} {max_queue_cnt}; " + \
245 "echo -n 1"
254 rtstat1 = rtnl.getlink({"ifi-index": cfg.ifindex})['stats64']
257 rtstat2 = rtnl.getlink({"ifi-index": cfg.ifindex})['stats64']
262 ksft_pr("completed up/down cycles:", len(stdout.decode('utf-8')))
265 def main() -> None: