Re: [PATCH net-next] tun: use xdp_get_frame_len()

From: Jon Kohler
Date: Thu May 08 2025 - 11:28:53 EST




> On May 8, 2025, at 11:04 AM, Jesper Dangaard Brouer <hawk@xxxxxxxxxx> wrote:
>
>
> On 08/05/2025 16.24, Jon Kohler wrote:
>>> On May 8, 2025, at 10:16 AM, Jesper Dangaard Brouer <hawk@xxxxxxxxxx> wrote:
>>>
> [...]
>>>
>>> AFAICR there is also some dual packet handling code path for XDP in
>>> vhost_net/tun. I'm also willing to take the paper-cut, for cleaning
>>> that up.
>>>
>>> --Jesper
>> When you say dual packet handling, what are you referring to specifically?
>
> The important part of the sentence was *code path*, as in multiple code path for packets.

Ah right, sorry coffee hadn’t kicked in, apologies for the trickery!

>
> You tricked me into looking up the code for you...
>
> It was in drivers/net/virtio_net.c where function receive_buf() calls[1]
> three different functions based on different checks. Some cases support
> XDP and others don't. I though you talked about this in another thread?

I was talking about the vhost/net side, not the virtio_net side. In vhost net.c
there is roughly the same thing though, where < PAGE_SIZE uses xdp_buff
as a means-to-an-end for batching, either to be dispatched as proper XDP
or just flipping to SKB and the traditional net stack.

Anything above PAGE_SIZE takes a wildly different, non-batched path. That’s
what I’m actively working through now.

The series I’m working on aims to unify that handling again, but will see if it
blows up in my face or not.

>
> --Jesper
>
> [1] https://elixir.bootlin.com/linux/v6.15-rc5/source/drivers/net/virtio_net.c#L2570-L2573
>
>