VSOCK: support fill mergeable rx buffer in guest
Subsystems (6)
PATCH v2 1/5 VSOCK: support fill mergeable rx buffer in guest
In driver probing, if virtio has VIRTIO_VSOCK_F_MRG_RXBUF feature, it will fill mergeable rx buffer, support for host send mergeable rx buffer. It will fill a fixed size(PAGE_SIZE) everytime to compact with small packet and big packet.
In addition, it also add one optimizations copied from virtio-net.c.
- Skb_page_frag_refill() which can use high order page and reduce the stress of page allocator.
--- include/linux/virtio_vsock.h | 3 ++ net/vmw_vsock/virtio_transport.c | 112 +++++++++++++++++++++++++++++++-------- 2 files changed, 92 insertions(+), 23 deletions(-)
include/linux/virtio_vsock.h +3 -0
@@ -14,6 +14,9 @@#define VIRTIO_VSOCK_MAX_BUF_SIZE 0xFFFFFFFFUL#define VIRTIO_VSOCK_MAX_PKT_BUF_SIZE (1024 * 64) +/* Virtio-vsock feature */ +#define VIRTIO_VSOCK_F_MRG_RXBUF 0/* Host can merge receive buffers. */ +enum {VSOCK_VQ_RX =0 ,/* for host to guest data */ VSOCK_VQ_TX =1 ,/* for guest to host data */
net/vmw_vsock/virtio_transport.c +89 -23
154 lines not on this page · raw message
Signature · 1 line
1.8.3.1
David Miller
maintainerFrom: jiangyiwen <[email protected]>
Date: Wed, 12 Dec 2018 17:28:16 +0800
net/vmw_vsock/virtio_transport.c static int virtio_transport_send_pkt_loopback(struct virtio_vsock *vsock, · line 275
Quoted 11 lines
net/vmw_vsock/virtio_transport.c +11
-0+static int fill_mergeable_rx_buff (struct virtio_vsock *vsock, +struct virtqueue *vq) +{ +struct page_frag *alloc_frag = &vsock->alloc_frag; +struct scatterlist sg; +/* Currently we don't use ewma len, use PAGE_SIZE instead, because too +* small size can't fill one full packet, sadly we only 128 vq num now. +*/ +unsigned int len =PAGE_SIZE , hole; +void *buf; +int err;
Please don't break up a set of local variable declarations with a comment like this. The comment seems to be about the initialization of 'len', so move that initialization into the code below the variable declarations and bring the comment along for the ride as well.
Quoted 20 lines · David Miller
From: jiangyiwen <[email protected]>
Date: Wed, 12 Dec 2018 17:28:16 +0800net/vmw_vsock/virtio_transport.c static int virtio_transport_send_pkt_loopback(struct virtio_vsock *vsock, · line 275
Quoted 11 lines
net/vmw_vsock/virtio_transport.c +11
-0+static int fill_mergeable_rx_buff (struct virtio_vsock *vsock, +struct virtqueue *vq) +{ +struct page_frag *alloc_frag = &vsock->alloc_frag; +struct scatterlist sg; +/* Currently we don't use ewma len, use PAGE_SIZE instead, because too +* small size can't fill one full packet, sadly we only 128 vq num now. +*/ +unsigned int len =PAGE_SIZE , hole; +void *buf; +int err;Please don't break up a set of local variable declarations with a comment like this. The comment seems to be about the initialization of 'len', so move that initialization into the code below the variable declarations and bring the comment along for the ride as well.
Quoted 2 lines
.
Hi David,
Thanks your suggestions, if maintainers approve use this series of patches other than "vsock over virtio-net" idea, I will send to next version and fix it. Otherwise, I hope it can give maintainers the motivation that aggregate the vsock(virtio_transport related) and virtio-net.
Thanks,
Yiwen.
Quoted 20 lines · David Miller
From: jiangyiwen <[email protected]>
Date: Wed, 12 Dec 2018 17:28:16 +0800net/vmw_vsock/virtio_transport.c static int virtio_transport_send_pkt_loopback(struct virtio_vsock *vsock, · line 275
Quoted 11 lines
net/vmw_vsock/virtio_transport.c +11
-0+static int fill_mergeable_rx_buff (struct virtio_vsock *vsock, +struct virtqueue *vq) +{ +struct page_frag *alloc_frag = &vsock->alloc_frag; +struct scatterlist sg; +/* Currently we don't use ewma len, use PAGE_SIZE instead, because too +* small size can't fill one full packet, sadly we only 128 vq num now. +*/ +unsigned int len =PAGE_SIZE , hole; +void *buf; +int err;Please don't break up a set of local variable declarations with a comment like this. The comment seems to be about the initialization of 'len', so move that initialization into the code below the variable declarations and bring the comment along for the ride as well.
Quoted 2 lines
.
Hi David,
Thanks your suggestions, if maintainers approve use this series of patches other than "vsock over virtio-net" idea, I will send to next version and fix it. Otherwise, I hope it can give maintainers the motivation that aggregate the vsock(virtio_transport related) and virtio-net.
Thanks,
Yiwen.
David Miller
maintainerFrom: jiangyiwen <[email protected]>
Date: Wed, 12 Dec 2018 17:28:16 +0800
net/vmw_vsock/virtio_transport.c static int virtio_transport_send_pkt_loopback(struct virtio_vsock *vsock, · line 275
Quoted 11 lines
net/vmw_vsock/virtio_transport.c +11
-0+static int fill_mergeable_rx_buff (struct virtio_vsock *vsock, +struct virtqueue *vq) +{ +struct page_frag *alloc_frag = &vsock->alloc_frag; +struct scatterlist sg; +/* Currently we don't use ewma len, use PAGE_SIZE instead, because too +* small size can't fill one full packet, sadly we only 128 vq num now. +*/ +unsigned int len =PAGE_SIZE , hole; +void *buf; +int err;
Please don't break up a set of local variable declarations with a comment like this. The comment seems to be about the initialization of 'len', so move that initialization into the code below the variable declarations and bring the comment along for the ride as well.