with bkg(rx_cmd, exit_wait=True):
wait_port_listen(34000, proto="udp")
cmd(tx_cmd, host=cfg.remote)
def test_transmit(cfg, ipver="6", extra_args=None): """Test local nic checksum transmit. Remote host verifies packets.""" if (not cfg.have_tx_csum_generic and not (cfg.have_tx_csum_ipv4 and ipver == "4") and not (cfg.have_tx_csum_ipv6 and ipver == "6")): raise KsftSkipEx(f"Test requires tx checksum offload on {cfg.ifname}")
with bkg(rx_cmd, host=cfg.remote, exit_wait=True):
wait_port_listen(34000, proto="udp", host=cfg.remote)
cmd(tx_cmd)
def test_builder(name, cfg, ipver="6", tx=False, extra_args=""): """Construct specific tests from the common template.
Most tests follow the same basic pattern, differing only in
Direction of the test and optional flags passed to csum.""" def f(cfg):
cfg.require_ipver(ipver)
if tx:
test_transmit(cfg, ipver, extra_args) else:
test_receive(cfg, ipver, extra_args)
f.__name__ = f"ipv{ipver}_" + name return f
def check_nic_features(cfg) -> None: """Test whether Tx and Rx checksum offload are enabled.
If the device under test has either off, then skip the relevant tests."""
cfg.have_tx_csum_generic = False
cfg.have_tx_csum_ipv4 = False
cfg.have_tx_csum_ipv6 = False
cfg.have_rx_csum = False
ethnl = EthtoolFamily()
features = ethnl.features_get({"header": {"dev-index": cfg.ifindex}}) for f in features["active"]["bits"]["bit"]: if f["name"] == "tx-checksum-ip-generic":
cfg.have_tx_csum_generic = True elif f["name"] == "tx-checksum-ipv4":
cfg.have_tx_csum_ipv4 = True elif f["name"] == "tx-checksum-ipv6":
cfg.have_tx_csum_ipv6 = True elif f["name"] == "rx-checksum":
cfg.have_rx_csum = True
def main() -> None: with NetDrvEpEnv(__file__, nsim_test=False) as cfg:
check_nic_features(cfg)
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.