From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jason Wang Subject: Re: [PATCH 3/5] VSOCK: support receive mergeable rx buffer in guest Date: Wed, 7 Nov 2018 14:20:52 +0800 Message-ID: <1b67b8ef-5dcc-0383-1b32-d80f294533d3@redhat.com> References: <5BDFF57C.5020106@huawei.com> <791d67e7-ad95-38e4-0d38-2b7c54d68040@redhat.com> <5BE137B2.5040305@huawei.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Cc: netdev@vger.kernel.org, kvm@vger.kernel.org, virtualization@lists.linux-foundation.org To: jiangyiwen , stefanha@redhat.com Return-path: Received: from mx1.redhat.com ([209.132.183.28]:60480 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726194AbeKGPt4 (ORCPT ); Wed, 7 Nov 2018 10:49:56 -0500 In-Reply-To: <5BE137B2.5040305@huawei.com> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 2018/11/6 下午2:41, jiangyiwen wrote: > On 2018/11/6 12:00, Jason Wang wrote: >> On 2018/11/5 下午3:47, jiangyiwen wrote: >>> Guest receive mergeable rx buffer, it can merge >>> scatter rx buffer into a big buffer and then copy >>> to user space. >>> >>> Signed-off-by: Yiwen Jiang >>> --- >>> include/linux/virtio_vsock.h | 9 ++++ >>> net/vmw_vsock/virtio_transport.c | 75 +++++++++++++++++++++++++++++---- >>> net/vmw_vsock/virtio_transport_common.c | 59 ++++++++++++++++++++++---- >>> 3 files changed, 127 insertions(+), 16 deletions(-) >>> >>> diff --git a/include/linux/virtio_vsock.h b/include/linux/virtio_vsock.h >>> index da9e1fe..6be3cd7 100644 >>> --- a/include/linux/virtio_vsock.h >>> +++ b/include/linux/virtio_vsock.h >>> @@ -13,6 +13,8 @@ >>> #define VIRTIO_VSOCK_DEFAULT_RX_BUF_SIZE (1024 * 4) >>> #define VIRTIO_VSOCK_MAX_BUF_SIZE 0xFFFFFFFFUL >>> #define VIRTIO_VSOCK_MAX_PKT_BUF_SIZE (1024 * 64) >>> +/* virtio_vsock_pkt + max_pkt_len(default MAX_PKT_BUF_SIZE) */ >>> +#define VIRTIO_VSOCK_MAX_MRG_BUF_NUM ((VIRTIO_VSOCK_MAX_PKT_BUF_SIZE / PAGE_SIZE) + 1) >>> >>> /* Virtio-vsock feature */ >>> #define VIRTIO_VSOCK_F_MRG_RXBUF 0 /* Host can merge receive buffers. */ >>> @@ -48,6 +50,11 @@ struct virtio_vsock_sock { >>> struct list_head rx_queue; >>> }; >>> >>> +struct virtio_vsock_mrg_rxbuf { >>> + void *buf; >>> + u32 len; >>> +}; >>> + >>> struct virtio_vsock_pkt { >>> struct virtio_vsock_hdr hdr; >>> struct virtio_vsock_mrg_rxbuf_hdr mrg_rxbuf_hdr; >>> @@ -59,6 +66,8 @@ struct virtio_vsock_pkt { >>> u32 len; >>> u32 off; >>> bool reply; >>> + bool mergeable; >>> + struct virtio_vsock_mrg_rxbuf mrg_rxbuf[VIRTIO_VSOCK_MAX_MRG_BUF_NUM]; >>> }; >> It's better to use iov here I think, and drop buf completely. >> >> And this is better to be done in an independent patch. >> > You're right, I can use kvec instead of customized structure, > in addition, I don't understand about drop buf completely and > an independent patch. I mean there a void *buf in struct virtio_vsock_pkt. You can drop it and switch to use iov(iter) or other data structure that supports sg. Thanks > > Thanks. >