OSDN Git Service

virtio-net: page_to_skb() use build_skb when there's sufficient tailroom
authorXuan Zhuo <xuanzhuo@linux.alibaba.com>
Fri, 16 Apr 2021 09:16:15 +0000 (17:16 +0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 16 Apr 2021 22:33:22 +0000 (15:33 -0700)
commitfb32856b16ad9d5bcd75b76a274e2c515ac7b9d7
tree4cf513879583e3172ce89b7341cae39fd37a912a
parentfa588eba632df14d296436995e6bbea0c146ae77
virtio-net: page_to_skb() use build_skb when there's sufficient tailroom

In page_to_skb(), if we have enough tailroom to save skb_shared_info, we
can use build_skb to create skb directly. No need to alloc for
additional space. And it can save a 'frags slot', which is very friendly
to GRO.

Here, if the payload of the received package is too small (less than
GOOD_COPY_LEN), we still choose to copy it directly to the space got by
napi_alloc_skb. So we can reuse these pages.

Testing Machine:
    The four queues of the network card are bound to the cpu1.

Test command:
    for ((i=0;i<5;++i)); do sockperf tp --ip 192.168.122.64 -m 1000 -t 150& done

The size of the udp package is 1000, so in the case of this patch, there
will always be enough tailroom to use build_skb. The sent udp packet
will be discarded because there is no port to receive it. The irqsoftd
of the machine is 100%, we observe the received quantity displayed by
sar -n DEV 1:

no build_skb:  956864.00 rxpck/s
build_skb:    1158465.00 rxpck/s

Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Suggested-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/virtio_net.c