Lines Matching full:env

26 static struct env {  struct
38 } env; argument
47 if (level == LIBBPF_DEBUG && !env.verbosity) in libbpf_print_fn()
90 env.feature.action = XDP_PASS; in get_xdp_feature()
91 env.feature.drv_feature = NETDEV_XDP_ACT_BASIC; in get_xdp_feature()
93 env.feature.drv_feature = NETDEV_XDP_ACT_BASIC; in get_xdp_feature()
94 env.feature.action = XDP_DROP; in get_xdp_feature()
96 env.feature.drv_feature = NETDEV_XDP_ACT_BASIC; in get_xdp_feature()
97 env.feature.action = XDP_ABORTED; in get_xdp_feature()
99 env.feature.drv_feature = NETDEV_XDP_ACT_BASIC; in get_xdp_feature()
100 env.feature.action = XDP_TX; in get_xdp_feature()
102 env.feature.drv_feature = NETDEV_XDP_ACT_REDIRECT; in get_xdp_feature()
103 env.feature.action = XDP_REDIRECT; in get_xdp_feature()
105 env.feature.drv_feature = NETDEV_XDP_ACT_NDO_XMIT; in get_xdp_feature()
115 switch (env.feature.action) { in get_xdp_feature_str()
130 if (env.feature.drv_feature == NETDEV_XDP_ACT_NDO_XMIT) in get_xdp_feature_str()
140 env.verbosity = true; in parse_arg()
143 env.is_tester = true; in parse_arg()
154 &env.dut_addr, NULL)) { in parse_arg()
163 &env.dut_ctrl_addr, NULL)) { in parse_arg()
171 if (make_sockaddr(AF_INET6, arg, 0, &env.tester_addr, NULL)) { in parse_arg()
186 env.ifindex = if_nametoindex(arg); in parse_arg()
187 if (!env.ifindex) in parse_arg()
188 env.ifindex = strtoul(arg, NULL, 0); in parse_arg()
189 if (!env.ifindex || !if_indextoname(env.ifindex, env.ifname)) { in parse_arg()
212 env.feature.drv_feature = NETDEV_XDP_ACT_NDO_XMIT; in set_env_default()
213 env.feature.action = -EINVAL; in set_env_default()
214 env.ifindex = -ENODEV; in set_env_default()
215 strcpy(env.ifname, "unknown"); in set_env_default()
217 &env.dut_ctrl_addr, NULL); in set_env_default()
219 &env.dut_addr, NULL); in set_env_default()
220 make_sockaddr(AF_INET6, "::ffff:127.0.0.1", 0, &env.tester_addr, NULL); in set_env_default()
261 env.ifname); in dut_run_echo_thread()
270 env.ifname, strerror(-err)); in dut_run_echo_thread()
280 enum xdp_action action = env.feature.action; in dut_attach_xdp_prog()
285 if (env.feature.drv_feature == NETDEV_XDP_ACT_NDO_XMIT) { in dut_attach_xdp_prog()
287 .ifindex = env.ifindex, in dut_attach_xdp_prog()
332 err = bpf_xdp_attach(env.ifindex, bpf_program__fd(prog), flags, NULL); in dut_attach_xdp_prog()
335 env.ifname); in dut_attach_xdp_prog()
372 "Failed creating control socket on device %s\n", env.ifname); in dut_run()
380 env.ifname); in dut_run()
423 bpf_xdp_detach(env.ifindex, flags, NULL); in dut_run()
434 err = bpf_xdp_query(env.ifindex, XDP_FLAGS_DRV_MODE, in dut_run()
439 env.ifname); in dut_run()
488 bpf_xdp_detach(env.ifindex, flags, NULL); in dut_run()
510 switch (env.feature.action) { in tester_collect_detected_cap()
522 if (env.feature.drv_feature == NETDEV_XDP_ACT_NDO_XMIT) in tester_collect_detected_cap()
559 env.ifname); in send_echo_msg()
567 (struct sockaddr *)&env.dut_addr, sizeof(env.dut_addr)); in send_echo_msg()
592 err = connect(sockfd, (struct sockaddr *)&env.dut_ctrl_addr, in tester_run()
593 sizeof(env.dut_ctrl_addr)); in tester_run()
609 if (env.feature.drv_feature == NETDEV_XDP_ACT_NDO_XMIT || in tester_run()
610 env.feature.action == XDP_TX) in tester_run()
615 err = bpf_xdp_attach(env.ifindex, bpf_program__fd(prog), flags, NULL); in tester_run()
618 env.ifname); in tester_run()
647 env.feature.drv_feature & advertised_feature ? GREEN("ADVERTISED") in tester_run()
650 bpf_xdp_detach(env.ifindex, flags, NULL); in tester_run()
673 if (env.ifindex < 0) { in main()
674 fprintf(stderr, "Invalid device name %s\n", env.ifname); in main()
686 ((struct sockaddr_in6 *)&env.tester_addr)->sin6_addr; in main()
688 ((struct sockaddr_in6 *)&env.dut_addr)->sin6_addr; in main()
703 if (env.is_tester) { in main()
706 env.ifname); in main()
710 fprintf(stdout, "Starting test on device %s\n", env.ifname); in main()