Lines Matching refs:sim
640 fail(dev["ifname"] != sim["ifname"],
641 "Ifname incorrect %s vs %s" % (dev["ifname"], sim["ifname"]))
680 def test_spurios_extack(sim, obj, skip_hw, needle): argument
681 res = sim.cls_bpf_add_filter(obj, prio=1, handle=1, skip_hw=skip_hw,
684 res = sim.cls_bpf_add_filter(obj, op="replace", prio=1, handle=1,
687 res = sim.cls_filter_op(op="delete", prio=1, handle=1, cls="bpf",
691 def test_multi_prog(simdev, sim, obj, modename, modeid): argument
694 sim.set_xdp(obj, "offload")
695 xdp = sim.ip_link_show(xdp=True)["xdp"]
696 offloaded = sim.dfs_read("bpf_offloaded_id")
701 sim.set_xdp(obj, modename)
702 two_xdps = sim.ip_link_show(xdp=True)["xdp"]
708 offloaded2 = sim.dfs_read("bpf_offloaded_id")
713 ret, _, err = sim.set_xdp(obj, "offload", fail=False, include_stderr=True)
718 ret, _, err = sim.unset_xdp("", force=True,
723 sim.unset_xdp("offload")
724 xdp = sim.ip_link_show(xdp=True)["xdp"]
725 offloaded = sim.dfs_read("bpf_offloaded_id")
737 sim.set_xdp(obj, "offload")
738 two_xdps = sim.ip_link_show(xdp=True)["xdp"]
748 sim, = simdev.nsims
749 sim.set_ethtool_tc_offloads(True)
750 return [simdev, sim]
811 sim, = simdev.nsims variable
812 sim.set_xdp(obj, "generic")
817 sim, = simdev.nsims variable
818 sim.tc_add_ingress()
821 ret, _ = sim.cls_bpf_add_filter(obj, skip_hw=True, fail=False)
825 ret, _ = sim.cls_bpf_add_filter(obj, fail=False)
829 sim.tc_flush_filters()
832 ret, _, err = sim.cls_bpf_add_filter(obj, skip_sw=True,
836 sim.wait_for_flush()
838 sim.set_ethtool_tc_offloads(True)
839 sim.dfs["bpf_tc_non_bound_accept"] = "Y"
842 ret, _ = sim.cls_bpf_add_filter(obj, fail=False)
845 ingress = sim.tc_show_ingress(expected=1)
849 sim.tc_flush_filters()
852 ret, _ = sim.cls_bpf_add_filter(bytecode, fail=False)
855 ingress = sim.tc_show_ingress(expected=1)
859 sim.tc_flush_filters()
860 sim.dfs["bpf_tc_non_bound_accept"] = "N"
863 ret, _, err = sim.cls_bpf_add_filter(bytecode, skip_sw=True,
868 sim.wait_for_flush()
871 ret, _, err = sim.cls_bpf_add_filter(obj, chain=1, prio=1, handle=1,
876 sim.tc_flush_filters()
879 sim.cls_bpf_add_filter(obj, prio=1, handle=1)
880 sim.cls_bpf_add_filter(obj, op="replace", prio=1, handle=1)
881 sim.cls_filter_op(op="delete", prio=1, handle=1, cls="bpf")
883 sim.cls_bpf_add_filter(obj, prio=1, handle=1, skip_sw=True)
884 sim.cls_bpf_add_filter(obj, op="replace", prio=1, handle=1, skip_sw=True)
885 sim.cls_filter_op(op="delete", prio=1, handle=1, cls="bpf")
887 sim.cls_bpf_add_filter(obj, prio=1, handle=1, skip_hw=True)
888 sim.cls_bpf_add_filter(obj, op="replace", prio=1, handle=1, skip_hw=True)
889 sim.cls_filter_op(op="delete", prio=1, handle=1, cls="bpf")
894 ret, _ = sim.cls_bpf_add_filter(obj, op="replace", prio=1, handle=1,
900 sim.cls_filter_op(op="delete", prio=1, handle=1, cls="bpf")
903 test_spurios_extack(sim, obj, False, "netdevsim")
904 test_spurios_extack(sim, obj, True, "netdevsim")
906 sim.set_ethtool_tc_offloads(False)
908 test_spurios_extack(sim, obj, False, "TC offload is disabled")
909 test_spurios_extack(sim, obj, True, "TC offload is disabled")
911 sim.set_ethtool_tc_offloads(True)
913 sim.tc_flush_filters()
916 sim.dfs["dev/bpf_bind_verifier_accept"] = 0
917 ret, _, err = sim.cls_bpf_add_filter(obj, verbose=True, skip_sw=True,
921 sim.dfs["dev/bpf_bind_verifier_accept"] = 1
924 ret, _, err = sim.cls_bpf_add_filter(obj, verbose=True, skip_sw=True,
931 ingress = sim.tc_show_ingress(expected=1)
948 ret, _ = sim.set_ethtool_tc_offloads(False, fail=False)
950 sim.set_ethtool_tc_offloads(True)
953 sim.tc_flush_filters()
954 sim.tc_show_ingress(expected=0)
957 ret, _ = sim.set_ethtool_tc_offloads(False, fail=False)
961 sim.set_ethtool_tc_offloads(True)
964 sim.cls_bpf_add_filter(obj, skip_sw=True)
969 sim, = simdev.nsims variable
970 sim.set_ethtool_tc_offloads(True)
973 sim.set_xdp(obj, "offload")
978 sim, = simdev.nsims variable
979 sim.set_ethtool_tc_offloads(True)
982 sim.set_xdp(obj, "drv")
983 ipl = sim.ip_link_show(xdp=True)
989 ret, _ = sim.set_xdp(obj, "drv", fail=False)
991 sim.wait_for_flush(total=1)
994 ret, _ = sim.set_xdp(obj, "drv", force=True, fail=False)
997 ipl = sim.ip_link_show(xdp=True)
1005 ret, _, err = sim.set_xdp(obj, "generic", force=True,
1013 ret, _ = sim.set_mtu(9000, fail=False)
1016 sim.unset_xdp("drv")
1018 sim.set_mtu(9000)
1019 ret, _, err = sim.set_xdp(obj, "drv", fail=False, include_stderr=True)
1022 sim.set_mtu(1500)
1024 sim.wait_for_flush()
1028 ret, _, err = sim.set_xdp(nooffload, "offload",
1036 dev=sim['ifname'])
1038 ret, _, err = sim.set_xdp(offload, "drv", fail=False, include_stderr=True)
1042 sim.wait_for_flush()
1045 sim.dfs["dev/bpf_bind_verifier_accept"] = 0
1047 dev=sim['ifname'], fail=False, include_stderr=True)
1050 sim.dfs["dev/bpf_bind_verifier_accept"] = 1
1051 sim.wait_for_flush()
1054 _, _, err = sim.set_xdp(obj, "offload", verbose=True, include_stderr=True)
1055 ipl = sim.ip_link_show(xdp=True)
1072 sim.unset_xdp("offload")
1073 sim.unset_xdp("offload")
1074 sim.unset_xdp("drv")
1075 sim.unset_xdp("drv")
1076 sim.unset_xdp("")
1077 sim.unset_xdp("")
1086 ret, _, err = sim.set_xdp(pinned, "offload",
1091 ret, _, err = sim.set_xdp(pinned, "offload",
1098 simdev, sim = test_multi_prog(simdev, sim, obj, "", 1) variable
1099 simdev, sim = test_multi_prog(simdev, sim, obj, "drv", 1) variable
1100 simdev, sim = test_multi_prog(simdev, sim, obj, "generic", 2) variable
1103 sim.tc_add_ingress()
1104 sim.set_xdp(obj, "offload")
1105 ret, _, err = sim.cls_bpf_add_filter(obj, skip_sw=True,
1109 sim.unset_xdp("offload")
1110 sim.wait_for_flush()
1112 sim.cls_bpf_add_filter(obj, skip_sw=True)
1113 ret, _, err = sim.set_xdp(obj, "offload", fail=False, include_stderr=True)
1119 sim.tc_flush_filters(bound=1, total=1)
1120 sim.cls_bpf_add_filter(pinned, da=True, skip_sw=True)
1121 sim.tc_flush_filters(bound=1, total=1)
1124 sim.set_xdp(obj, "offload")
1127 sim.set_xdp(pinned, "offload", force=True)
1128 sim.unset_xdp("offload")
1129 sim.set_xdp(pinned, "offload", force=True)
1130 sim.unset_xdp("offload")
1133 ret, _ = sim.cls_bpf_add_filter(pinned, da=True, skip_sw=True, fail=False)
1137 sim.cls_bpf_add_filter(obj, da=True, skip_sw=True)
1138 ret, _, err = sim.cls_bpf_add_filter(obj, da=True, skip_sw=True,
1143 sim.tc_flush_filters(bound=2, total=2)
1147 sim.dfs["dev/bpf_bind_verifier_delay"] = delay_msec
1150 (sim['ifname'], obj)
1171 sim, = simdev.nsims variable
1174 sim.set_xdp(map_obj, "offload", JSON=False) # map fixup msg breaks JSON
1181 sim.set_ns(ns)
1188 sim.set_ns("")
1203 sim, = simdev.nsims variable
1206 sim.set_xdp(map_obj, "offload", JSON=False) # map fixup msg breaks JSON
1282 sim.unset_xdp("offload")
1287 sim, = simdev.nsims variable
1288 sim.set_xdp(map_obj, "offload", JSON=False) # map fixup msg breaks JSON
1294 sim, = simdev.nsims variable
1295 sim.dfs["bpf_map_accept"] = "N"
1296 ret, _ = sim.set_xdp(map_obj, "offload", JSON=False, fail=False)