On Sat, Jan 18, 2020 at 11:14:05AM +0100, Jesper Dangaard Brouer wrote: > On Fri, 17 Jan 2020 12:54:09 -0500 > Ryan Goodfellow <rgoodfel@xxxxxxx> wrote: > > I tried to use this program, however it does not seem to work for bidirectional > > traffic across the two interfaces? > > It does work bidirectional if you start more of these xdp_redirect_map > programs. Do notice this is an example program. Look at xdp_fwd_*.c > if you want a program that is functional and uses the existing IP route > table for XDP acceleration. > > My point is that there are alternatives for doing zero-copy between > interfaces... A xdp_redirect_map inside the kernel out another > interface is already zero-copy. > > I'm wondering why did you choose/need AF_XDP technology for doing forwarding? This is just a sample program used to demonstrate moving packets between different interfaces efficiently using AF_XDP. Our actual use case is performing network emulation in userspace. For example, representing impaired links or entire networks with link-by-link shaping specifications. We are using AF_XDP to get packets to/from our network emulation software as quickly as possible without having to go through the entire network stack, as the emulation host's network configuration does not influence the networks it's emulating. Traditionally we've used DPDK for this, but are porting to AF_XDP for the relative simplicity and flexibility it provides. Some specific benefits for us are: - Can attach to VTEPs which allows us to hook into some EVPN/VXLAN based networks we have easily. Alternatively with the BPF program flexibility, we also have the option to split out BGP control plane traffic from overlay traffic when attaching to the physical interface and pass it through to the kernel. Both of these approaches let the kernel manage the FDB for VTEPs as well as taking care of encap/decap (potentially offloaded to the NIC itself) and let our software focus on emulation. - Using XDP in virtual machines in our testing environment is straightforward, while this is possible with DPDK and virtio, the setup was rather convoluted. -- ~ ry