tools/testing/selftests/drivers/net/gro.py
Source file repositories/reference/linux-study-clean/tools/testing/selftests/drivers/net/gro.py
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/drivers/net/gro.py- Extension
.py- Size
- 16758 bytes
- Lines
- 474
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: tools
- Status
- atlas-only
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
Dependency Surface
- No C-style include directives detected by the generator.
Detected Declarations
- No top-level syscall, struct, function, initcall, or export declaration detected by the generator.
Annotated Snippet
#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-2.0
"""
GRO (Generic Receive Offload) conformance tests.
Validates that GRO coalescing works correctly by running the gro
binary in different configurations and checking for correct packet
coalescing behavior.
Test cases:
- data_same: Same size data packets coalesce
- data_lrg_sml: Large packet followed by smaller one coalesces
- data_lrg_1byte: Large packet followed by 1B one coalesces (Ethernet padding)
- data_sml_lrg: Small packet followed by larger one doesn't coalesce
- ack: Pure ACK packets do not coalesce
- flags_psh: Packets with PSH flag don't coalesce
- flags_syn: Packets with SYN flag don't coalesce
- flags_rst: Packets with RST flag don't coalesce
- flags_urg: Packets with URG flag don't coalesce
- flags_cwr: Packets with CWR flag don't coalesce
- tcp_csum: Packets with incorrect checksum don't coalesce
- tcp_seq: Packets with non-consecutive seqno don't coalesce
- tcp_ts: Packets with different timestamp options don't coalesce
- tcp_opt: Packets with different TCP options don't coalesce
- ip_ecn: Packets with different ECN don't coalesce
- ip_tos: Packets with different TOS don't coalesce
- ip_ttl: (IPv4) Packets with different TTL don't coalesce
- ip_opt: (IPv4) Packets with IP options don't coalesce
- ip_frag4: (IPv4) IPv4 fragments don't coalesce
- ip_id_df*: (IPv4) IP ID field coalescing tests
- ip_frag6: (IPv6) IPv6 fragments don't coalesce
- ip_v6ext_same: (IPv6) IPv6 ext header with same payload coalesces
- ip_v6ext_diff: (IPv6) IPv6 ext header with different payload doesn't coalesce
- large_max: Packets exceeding GRO_MAX_SIZE don't coalesce
- large_rem: Large packet remainder handling
"""
import glob
import os
import re
from lib.py import ksft_run, ksft_exit, ksft_pr
from lib.py import NetDrvEpEnv, KsftFailEx, KsftXfailEx
from lib.py import NetdevFamily, EthtoolFamily
from lib.py import bkg, cmd, defer, ethtool, ip
from lib.py import ksft_variants, KsftNamedVariant
# gro.c uses hardcoded DPORT=8000
GRO_DPORT = 8000
def _resolve_dmac(cfg, ipver):
"""
Find the destination MAC address remote host should use to send packets
towards the local host. It may be a router / gateway address.
"""
attr = "dmac" + ipver
# Cache the response across test cases
if hasattr(cfg, attr):
return getattr(cfg, attr)
route = ip(f"-{ipver} route get {cfg.addr_v[ipver]}",
json=True, host=cfg.remote)[0]
gw = route.get("gateway")
# Local L2 segment, address directly
if not gw:
setattr(cfg, attr, cfg.dev['address'])
return getattr(cfg, attr)
Annotation
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: atlas-only.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.