From: Daniel Borkmann <daniel@iogearbox.net>
To: Kimitoshi Takahashi <ktaka@nii.ac.jp>
Cc: xdp-newbies@vger.kernel.org, jasowang@redhat.com, netdev@vger.kernel.org
Subject: Re: XDP_TX for virtio_net not working in recent kernel?
Date: Tue, 10 Apr 2018 12:17:15 +0200 [thread overview]
Message-ID: <1d5849ae-a9ec-93af-e1b5-e7a368193c7a@iogearbox.net> (raw)
In-Reply-To: <47428621-2f24-3c8e-5d34-1d788a86a455@nii.ac.jp>
[ +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
next parent reply other threads:[~2018-04-10 10:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <47428621-2f24-3c8e-5d34-1d788a86a455@nii.ac.jp>
2018-04-10 10:17 ` Daniel Borkmann [this message]
2018-04-11 1:50 ` XDP_TX for virtio_net not working in recent kernel? Jason Wang
2018-04-12 17:39 ` Kimitoshi Takahashi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1d5849ae-a9ec-93af-e1b5-e7a368193c7a@iogearbox.net \
--to=daniel@iogearbox.net \
--cc=jasowang@redhat.com \
--cc=ktaka@nii.ac.jp \
--cc=netdev@vger.kernel.org \
--cc=xdp-newbies@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox