netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: jiangyiwen <jiangyiwen@huawei.com>, stefanha@redhat.com
Cc: netdev@vger.kernel.org, kvm@vger.kernel.org,
	virtualization@lists.linux-foundation.org
Subject: Re: [PATCH 3/5] VSOCK: support receive mergeable rx buffer in guest
Date: Wed, 7 Nov 2018 14:20:52 +0800	[thread overview]
Message-ID: <1b67b8ef-5dcc-0383-1b32-d80f294533d3@redhat.com> (raw)
In-Reply-To: <5BE137B2.5040305@huawei.com>


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<jiangyiwen@huawei.com>
>>> ---
>>>    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.
>

  reply	other threads:[~2018-11-07 15:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-05  7:47 [PATCH 3/5] VSOCK: support receive mergeable rx buffer in guest jiangyiwen
2018-11-06  4:00 ` Jason Wang
2018-11-06  6:41   ` jiangyiwen
2018-11-07  6:20     ` Jason Wang [this message]
2018-11-07  7:07       ` jiangyiwen
2018-11-07 13:29         ` Jason Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1b67b8ef-5dcc-0383-1b32-d80f294533d3@redhat.com \
    --to=jasowang@redhat.com \
    --cc=jiangyiwen@huawei.com \
    --cc=kvm@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=stefanha@redhat.com \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).