On Thu, 23 Mar 2023 15:24:38 +0800, Yunsheng Lin <linyunsheng@xxxxxxxxxx> wrote: > On 2023/3/23 13:40, Jason Wang wrote: > >>> > >>>> > >>>> Also, it seems better to split the xdp_linearize_page() to two functions > >>>> as pskb_expand_head() and __skb_linearize() do, one to expand the headroom, > >>>> the other one to do the linearizing. > >>> > >>> No skb here. > >> > >> I means following the semantics of pskb_expand_head() and __skb_linearize(), > >> not to combine the headroom expanding and linearizing into one function as > >> xdp_linearize_page() does now if we want a better refoctor result. > > > > Not sure it's worth it, since the use is very specific unless we could > > find a case that wants only one of them. > > It seems receive_small() only need the headroom expanding one. > For receive_mergeable(), it seems we can split into the below cases: > 1. " (!xdp_prog->aux->xdp_has_frags && (num_buf > 1 || headroom < virtnet_get_headroom(vi)))" > case only need linearizing. > 2. other cases only need headroom/tailroom expanding. > > Anyway, it is your call to decide if you want to take this > opportunity do a better refoctoring to virtio_net. Compared to the chaotic state of the virtio-net XDP, this is a small point. And I don’t think this brings any practical optimization. If you think this division is better. You can submit a new patch on the top of this patch set. I think the code can be clearer. Thanks. > > > > > Thanks > > > >> > >>> > >>> > >>>> > >> > > > > > > . > >