summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/drivers/net/pppoe_gro.py
blob: 3891d5e17ee1af95598a19338747be21c7751327 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-2.0

"""
GRO conformance tests for PPPoE.

Only SW GRO is expected to coalesce PPPoE, the HW offloads are not
exercised. PPPoE runs a subset of the cases described in gro_lib.py,
plus one of its own:
  - pppoe_sid: Packets with different PPPoE session ID don't coalesce
"""

from gro_lib import run_test
from lib.py import NetDrvEpEnv, ksft_exit, ksft_run, ksft_variants


def _pppoe_variants():
    """Generator that yields all combinations of protocol and test types."""

    tests = [
        "data_same", "data_lrg_sml", "data_sml_lrg", "data_lrg_1byte",
        "data_burst", "pppoe_sid",
    ]

    for protocol in ["pppoev4", "pppoev6"]:
        for test_name in tests:
            yield protocol, test_name


@ksft_variants(_pppoe_variants())
def test(cfg, protocol, test_name):
    """Run a single GRO test case."""
    run_test(cfg, "sw", protocol, test_name)


def main() -> None:
    """ Ksft boiler plate main """

    with NetDrvEpEnv(__file__) as cfg:
        ksft_run(cases=[test], args=(cfg,))
    ksft_exit()


if __name__ == "__main__":
    main()