Re: vhost-net

From: Jonas Bonn
Date: Thu Jan 19 2023 - 08:15:46 EST


Hi Jason,

Thanks for your feedback.

On 17/01/2023 05:26, Jason Wang wrote:
On Mon, Jan 16, 2023 at 4:59 PM Jonas Bonn <jonas@xxxxxxxxxxx> wrote:

For an IFF_TUN device, should vhost-net not be adding an implicit
ethernet header in _build_xdp()?

Probably.

Actually, this makes me think that we should disable XDP for TUN?

After playing around with this for a week, I agree. It appears that as soon as the XDP paths come into play there are requirements on having valid ethernet headers in place; the TUN interface doesn't even have a MAC address to validate against so packets in the TCP paths get dropped. UDP packet validation apparently only cares about the ethernet "proto" field so these can be made to go through with less rigorous ethernet addressing.

That said, when the XDP path is bypassed, the TUN device works fine with vhost-net.


Can this be done without backward
compatibility implications?


The path is used by vhost-net only, so I think we are fine.

Patch is more than welcomed.

I'll try to put something together.

/Jonas