Re: [PATCH net-next 1/2] virtio-net: don't reserve space for vnet header for XDP

From: Jason Wang
Date: Thu May 07 2020 - 21:56:53 EST



On 2020/5/6 äå5:54, Michael S. Tsirkin wrote:
On Wed, May 06, 2020 at 04:19:40PM +0800, Jason Wang wrote:
On 2020/5/6 äå3:53, Michael S. Tsirkin wrote:
On Wed, May 06, 2020 at 02:16:32PM +0800, Jason Wang wrote:
We tried to reserve space for vnet header before
xdp.data_hard_start. But this is useless since the packet could be
modified by XDP which may invalidate the information stored in the
header and there's no way for XDP to know the existence of the vnet
header currently.
What do you mean? Doesn't XDP_PASS use the header in the buffer?
We don't, see 436c9453a1ac0 ("virtio-net: keep vnet header zeroed after
processing XDP")

If there's other place, it should be a bug.


So let's just not reserve space for vnet header in this case.
In any case, we can find out XDP does head adjustments
if we need to.
But XDP program can modify the packets without adjusting headers.

Thanks
Then what's the problem?


Then we can't do anything more than just invalidating vnet header since we don't know whether or not the packet has been modified or not.

Technically, XDP can give the driver some hint about whether or not the packet has been modified, but AFAIK we haven't implemented this yet.

Thanks