|
1 | 1 | #!/usr/bin/env python3
|
2 | 2 | # SPDX-License-Identifier: GPL-2.0
|
3 | 3 |
|
4 |
| -from lib.py import ksft_run, ksft_exit, ksft_eq, KsftSkipEx |
5 |
| -from lib.py import EthtoolFamily, NetdevFamily |
| 4 | +from lib.py import ksft_disruptive, ksft_exit, ksft_run |
| 5 | +from lib.py import ksft_eq, ksft_raises, KsftSkipEx |
| 6 | +from lib.py import EthtoolFamily, NetdevFamily, NlError |
6 | 7 | from lib.py import NetDrvEnv
|
7 |
| -from lib.py import cmd |
| 8 | +from lib.py import cmd, defer, ip |
| 9 | +import errno |
8 | 10 | import glob
|
9 | 11 |
|
10 | 12 |
|
@@ -59,9 +61,27 @@ def addremove_queues(cfg, nl) -> None:
|
59 | 61 | ksft_eq(queues, expected)
|
60 | 62 |
|
61 | 63 |
|
| 64 | +@ksft_disruptive |
| 65 | +def check_down(cfg, nl) -> None: |
| 66 | + # Check the NAPI IDs before interface goes down and hides them |
| 67 | + napis = nl.napi_get({'ifindex': cfg.ifindex}, dump=True) |
| 68 | + |
| 69 | + ip(f"link set dev {cfg.dev['ifname']} down") |
| 70 | + defer(ip, f"link set dev {cfg.dev['ifname']} up") |
| 71 | + |
| 72 | + with ksft_raises(NlError) as cm: |
| 73 | + nl.queue_get({'ifindex': cfg.ifindex, 'id': 0, 'type': 'rx'}) |
| 74 | + ksft_eq(cm.exception.nl_msg.error, -errno.ENOENT) |
| 75 | + |
| 76 | + if napis: |
| 77 | + with ksft_raises(NlError) as cm: |
| 78 | + nl.napi_get({'id': napis[0]['id']}) |
| 79 | + ksft_eq(cm.exception.nl_msg.error, -errno.ENOENT) |
| 80 | + |
| 81 | + |
62 | 82 | def main() -> None:
|
63 | 83 | with NetDrvEnv(__file__, queue_count=100) as cfg:
|
64 |
| - ksft_run([get_queues, addremove_queues], args=(cfg, NetdevFamily())) |
| 84 | + ksft_run([get_queues, addremove_queues, check_down], args=(cfg, NetdevFamily())) |
65 | 85 | ksft_exit()
|
66 | 86 |
|
67 | 87 |
|
|
0 commit comments