From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Borkmann Subject: Re: XDP_TX for virtio_net not working in recent kernel? Date: Tue, 10 Apr 2018 12:17:15 +0200 Message-ID: <1d5849ae-a9ec-93af-e1b5-e7a368193c7a@iogearbox.net> References: <47428621-2f24-3c8e-5d34-1d788a86a455@nii.ac.jp> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Cc: xdp-newbies@vger.kernel.org, jasowang@redhat.com, netdev@vger.kernel.org To: Kimitoshi Takahashi Return-path: Received: from www62.your-server.de ([213.133.104.62]:42983 "EHLO www62.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751611AbeDJKRR (ORCPT ); Tue, 10 Apr 2018 06:17:17 -0400 In-Reply-To: <47428621-2f24-3c8e-5d34-1d788a86a455@nii.ac.jp> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: [ +jason +netdev ] On 04/10/2018 12:49 AM, Kimitoshi Takahashi wrote: > Hello, > > I'm totally newbie. > > I want to try some examples under the samples/bpf of the kernel tree using the virtio_net driver in kvm, in order to get familiar with the XDP. However, it seems to me that for kernels newer than linux-4.15, the xdp2 and xdp_tx_tunnel are not working in the case of virtio_net. > > Can somebody help me out to make them working? > > > 1) For linux-4.11.12, linux-4.12.14, and linux-4.14.31, xdp2 and xdp_tx_tunnel are working. > > [xdp2] > 10.0.0.27# ./xdp2 2 (or ./xdp -N 2) > > 10.0.0.254# hping3 10.0.0.27 -p 5000 -2 > > 10.0.0.254# tcpdump -nei kbr0 udp port 5000 > 06:18:37.677070 2e:c9:83:fb:5b:f3 > 52:54:00:11:00:1b, ethertype IPv4 (0x0800), length 42: 10.0.0.254.2982 > 10.0.0.27.5000: UDP, length 0 > 06:18:37.677265 52:54:00:11:00:1b > 2e:c9:83:fb:5b:f3, ethertype IPv4 (0x0800), length 42: 10.0.0.254.2982 > 10.0.0.27.5000: UDP, length 0 > > I can see the UDP packets with MAC addresses swapped. > > [xdp_tx_tunnel] > > 10.0.0.254# telnet 10.1.2.1 80 > > 10.0.0.27# ./xdp_tx_iptunnel -i 2 -a 10.1.2.1 -p 80 -s 10.0.0.27 -d 10.0.0.24 -m 52:54:00:11:00:18 > > 10.0.0.24# tcpdump -nei any proto 4 > 22:08:20.510354  In 52:54:00:11:00:1b ethertype IPv4 (0x0800), length 96: 10.0.0.27 > 10.0.0.24: 10.0.0.254.60826 > 10.1.2.1.80: Flags [S], seq 3224377720, win 29200, options [mss 1460,sackOK,TS val 217801953 ecr 0,nop,wscale 7], length 0 (ipip-proto-4) > > I can see the encapsulated SYN packet that is forwarded by the 10.0.0.27. > > 2) For linux-4.15, linux-4.15.5, linux-4.15.13 and linux-4.16.1, xdp2 and xdp_tx_tunnel are NOT working. > > [xdp2] > 10.0.0.27# ./xdp2 -N 2 > > 10.0.0.254# hping3 10.0.0.27 -p 5000 -2 > > 10.0.0.254# tcpdump -nei br0 udp port 5000 > 06:45:34.810046 2e:c9:83:fb:5b:f3 > 52:54:00:11:00:1b, ethertype IPv4 (0x0800), length 42: 10.0.0.254.2346 > 10.0.0.27.5000: UDP, length 0 > 06:45:35.810176 2e:c9:83:fb:5b:f3 > 52:54:00:11:00:1b, ethertype IPv4 (0x0800), length 42: 10.0.0.254.2347 > 10.0.0.27.5000: UDP, length 0 > > Only the outgoing packets can be seen. > > [xdp_tx_tunnel] > > 10.0.0.254# telnet 10.1.2.1 80 > > 10.0.0.27# ./xdp_tx_iptunnel -i 2 -a 10.1.2.1 -p 80 -s 10.0.0.27 -d 10.0.0.24 -m 52:54:00:11:00:18 > > 10.0.0.24# tcpdump -nei any proto 4 > > I can NOT see the encapsulated SYN packet that is forwarded by the 10.0.0.27. > > > -- > Sincerely, > Takahashi Kimitoshi