Lines Matching full:cfg
56 def _exchg_udp(cfg, port, test_string): argument
61 cfg: Configuration object containing network settings.
68 cfg.require_cmd("socat", remote=True)
70 rx_udp_cmd = f"socat -{cfg.addr_ipver} -T 2 -u UDP-RECV:{port},reuseport STDOUT"
71 tx_udp_cmd = f"echo -n {test_string} | socat -t 2 -u STDIN UDP:{cfg.baddr}:{port}"
75 cmd(tx_udp_cmd, host=cfg.remote, shell=True)
80 def _test_udp(cfg, port, size=256): argument
85 cfg: Configuration object containing network settings.
93 recvd_str = _exchg_udp(cfg, port, test_str)
98 def _load_xdp_prog(cfg, bpf_info): argument
103 cfg: Configuration object containing network settings.
109 abs_path = cfg.net_lib_dir / bpf_info.file
112 cmd(f"ip link set dev {cfg.remote_ifname} mtu {bpf_info.mtu}", shell=True, host=cfg.remote)
113 defer(ip, f"link set dev {cfg.remote_ifname} mtu 1500", host=cfg.remote)
116 f"ip link set dev {cfg.ifname} mtu {bpf_info.mtu} xdpdrv obj {abs_path} sec {bpf_info.xdp_sec}",
119 defer(ip, f"link set dev {cfg.ifname} mtu 1500 xdpdrv off")
121 xdp_info = ip(f"-d link show dev {cfg.ifname}", json=True)[0]
200 def _test_pass(cfg, bpf_info, msg_sz): argument
205 cfg: Configuration object containing network settings.
210 prog_info = _load_xdp_prog(cfg, bpf_info)
216 ksft_eq(_test_udp(cfg, port, msg_sz), True, "UDP packet exchange failed")
223 def test_xdp_native_pass_sb(cfg): argument
228 cfg: Configuration object containing network settings.
232 _test_pass(cfg, bpf_info, 256)
235 def test_xdp_native_pass_mb(cfg): argument
240 cfg: Configuration object containing network settings.
244 _test_pass(cfg, bpf_info, 8000)
247 def _test_drop(cfg, bpf_info, msg_sz): argument
252 cfg: Configuration object containing network settings.
257 prog_info = _load_xdp_prog(cfg, bpf_info)
263 ksft_eq(_test_udp(cfg, port, msg_sz), False, "UDP packet exchange should fail")
270 def test_xdp_native_drop_sb(cfg): argument
275 cfg: Configuration object containing network settings.
279 _test_drop(cfg, bpf_info, 256)
282 def test_xdp_native_drop_mb(cfg): argument
287 cfg: Configuration object containing network settings.
291 _test_drop(cfg, bpf_info, 8000)
294 def _test_xdp_native_tx(cfg, bpf_info, payload_lens): argument
299 cfg: Configuration object containing network settings.
303 cfg.require_cmd("socat", remote=True)
304 prog_info = _load_xdp_prog(cfg, bpf_info)
316 rx_udp = f"socat -{cfg.addr_ipver} -T 2 " + \
324 f"-u STDIN UDP:{cfg.baddr}:{port}{tx_cmd_suffix}"
326 with bkg(rx_udp, host=cfg.remote, exit_wait=True) as rnc:
327 wait_port_listen(port, proto="udp", host=cfg.remote)
328 cmd(tx_udp, host=cfg.remote, shell=True)
338 def test_xdp_native_tx_sb(cfg): argument
343 cfg: Configuration object containing network settings.
348 pkt_hdr_len = 42 if cfg.addr_ipver == "4" else 62
350 _test_xdp_native_tx(cfg, bpf_info, [0, 1500 // 2, 1500 - pkt_hdr_len])
353 def test_xdp_native_tx_mb(cfg): argument
358 cfg: Configuration object containing network settings.
365 _test_xdp_native_tx(cfg, bpf_info, [8000, 0])
432 def _test_xdp_native_tail_adjst(cfg, pkt_sz_lst, offset_lst): argument
442 cfg: Configuration object containing network settings.
453 prog_info = _load_xdp_prog(cfg, bpf_info)
468 recvd_str = _exchg_udp(cfg, port, test_str)
498 def test_xdp_native_adjst_tail_grow_data(cfg): argument
503 cfg: Configuration object containing network settings.
508 cfg,
516 def test_xdp_native_adjst_tail_shrnk_data(cfg): argument
521 cfg: Configuration object containing network settings.
526 cfg,
534 def get_hds_thresh(cfg): argument
539 cfg: Configuration object containing network settings.
545 ethnl = cfg.ethnl
549 rings = ethnl.rings_get({'header': {'dev-index': cfg.ifindex}})
560 def _test_xdp_native_head_adjst(cfg, prog, pkt_sz_lst, offset_lst): argument
565 cfg: Configuration object containing network settings.
571 cfg.require_cmd("socat", remote=True)
573 prog_info = _load_xdp_prog(cfg, BPFProgInfo(prog, "xdp_native.bpf.o", "xdp.frags", 9000))
579 hds_thresh = get_hds_thresh(cfg)
586 l2_cut_off = 28 if cfg.addr_ipver == 4 else 48
603 recvd_str = _exchg_udp(cfg, port, test_str)
633 def test_xdp_native_adjst_head_grow_data(cfg): argument
638 cfg: Configuration object containing network settings.
649 res = _test_xdp_native_head_adjst(cfg, "xdp_prog_frags", pkt_sz_lst, offset_lst)
654 def test_xdp_native_adjst_head_shrnk_data(cfg): argument
659 cfg: Configuration object containing network settings.
670 res = _test_xdp_native_head_adjst(cfg, "xdp_prog_frags", pkt_sz_lst, offset_lst)
675 def _test_xdp_native_ifc_stats(cfg, act): argument
676 cfg.require_cmd("socat")
679 prog_info = _load_xdp_prog(cfg, bpf_info)
686 rx_udp = f"socat -{cfg.addr_ipver} -T 2 -u UDP-RECV:{port},reuseport " + \
689 rx_host = cfg.remote if act == XDPAction.TX else None
691 tx_udp = f"exec 5<>/dev/udp/{cfg.addr}/{port}; " \
694 cfg.wait_hw_stats_settle()
698 before = cfg.netnl.qstats_get({"ifindex": cfg.ifindex}, dump=True)[0]
702 cmd(tx_udp, host=cfg.remote, shell=True)
704 cfg.wait_hw_stats_settle()
705 after = cfg.netnl.qstats_get({"ifindex": cfg.ifindex}, dump=True)[0]
719 chans = cfg.ethnl.channels_get({'header': {'dev-index': cfg.ifindex}})
721 cfg.ethnl.channels_set({'header': {'dev-index': cfg.ifindex},
723 cfg.ethnl.channels_set({'header': {'dev-index': cfg.ifindex},
726 after = cfg.netnl.qstats_get({"ifindex": cfg.ifindex}, dump=True)[0]
733 def test_xdp_native_qstats_pass(cfg): argument
738 _test_xdp_native_ifc_stats(cfg, XDPAction.PASS)
741 def test_xdp_native_qstats_drop(cfg): argument
746 _test_xdp_native_ifc_stats(cfg, XDPAction.DROP)
749 def test_xdp_native_qstats_tx(cfg): argument
754 _test_xdp_native_ifc_stats(cfg, XDPAction.TX)
766 with NetDrvEpEnv(__file__) as cfg:
767 cfg.ethnl = EthtoolFamily()
768 cfg.netnl = NetdevFamily()
785 args=(cfg,))