On 12.11.2017 17:30, Jesper Dangaard Brouer wrote:
On Sun, 12 Nov 2017 14:27:25 +0530 Anmol Panda <anmol07.visitor@xxxxxxxxxxxxxx> wrote:Dear all, We are trying to write a program that receives a packet from a client and is supposed to return the packet to the source. We tried to swap the source and dest and send it using the XDP_TX action. But it doesn't work.We have compiled a new kernel and bound the NIC to xdp successfully.After binding, the system stops responding to ping and other packet generating scripts (like sendip). We are using kernel 4.13.12 (Ubuntu 17.10) from the main linux kernel tree and binding with Intel I217-LM NIC. This NIC is using e1000e driver. Can xdp / eBPF be used for this NIC? Moreover, do we need to patch the driver for additional support?Not all drivers have "native' XDP support. See slide 11 of [1] [1] http://people.netfilter.org/hawk/presentations/driving-IT2017/driving-IT-2017_XDP_eBPF_technology_Jesper_Brouer.pdf There is something called "Generic" XDP (v4.12) for ease of development. It allow you to attach an XDP program any net_device. I call it --skb-mode in my sample programs. See [2] [2] https://prototype-kernel.readthedocs.io/en/latest/blogposts/xdp25_eval_generic_xdp_tx.htmlOur aim is to benchmark various forwarding applications (L2 , L3,etc.) run using xdp. Please point to some code samples to achieve this.We will be truly grateful.Kernel have directory: samples/bpf/ I maintain some more example programs here:https://github.com/netoptimizer/prototype-kernel/tree/master/kernel/samples/bpfDo notice that e1000e is only 1Gbit/s (which is very slow). The normal Linux kernel can handle 1Gbit/s without any issues... I hope you areplanning to use something faster, else it does not make sense to use XDP.