[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20210806084752.vzzucocjg3wvpukr@steredhat>
Date: Fri, 6 Aug 2021 10:47:52 +0200
From: Stefano Garzarella <sgarzare@...hat.com>
To: Arseny Krasnov <arseny.krasnov@...persky.com>
Cc: Stefan Hajnoczi <stefanha@...hat.com>,
"Michael S. Tsirkin" <mst@...hat.com>,
Jason Wang <jasowang@...hat.com>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Norbert Slusarek <nslusarek@....net>,
Andra Paraschiv <andraprs@...zon.com>,
Colin Ian King <colin.king@...onical.com>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"virtualization@...ts.linux-foundation.org"
<virtualization@...ts.linux-foundation.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"oxffffaa@...il.com" <oxffffaa@...il.com>
Subject: Re: [RFC PATCH v1 3/7] vhost/vsock: support MSG_EOR bit processing
On Fri, Aug 06, 2021 at 11:40:38AM +0300, Arseny Krasnov wrote:
>
>On 06.08.2021 10:28, Stefano Garzarella wrote:
>> Caution: This is an external email. Be cautious while opening links or attachments.
>>
>>
>>
>> On Mon, Jul 26, 2021 at 07:33:38PM +0300, Arseny Krasnov wrote:
>>> It works in the same way as 'end-of-message' bit: if packet has
>>> 'EOM' bit, also check for 'EOR' bit.
>>>
>>> Signed-off-by: Arseny Krasnov <arseny.krasnov@...persky.com>
>>> ---
>>> drivers/vhost/vsock.c | 12 +++++++++++-
>>> 1 file changed, 11 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/vhost/vsock.c b/drivers/vhost/vsock.c
>>> index 3b55de70ac77..3e2b150f9c6f 100644
>>> --- a/drivers/vhost/vsock.c
>>> +++ b/drivers/vhost/vsock.c
>>> @@ -115,6 +115,7 @@ vhost_transport_do_send_pkt(struct vhost_vsock *vsock,
>>> size_t iov_len, payload_len;
>>> int head;
>>> bool restore_msg_eom_flag = false;
>>> + bool restore_msg_eor_flag = false;
>> Since we now have 2 flags to potentially restore, we could use a single
>> variable (e.g. uint32_t flags_to_restore), initialized to 0.
>>
>> We can set all the flags we need to restore and then simply put it
>> in or with the `pkt->hdr.flags` field.
>>
>>> spin_lock_bh(&vsock->send_pkt_list_lock);
>>> if (list_empty(&vsock->send_pkt_list)) {
>>> @@ -188,6 +189,11 @@ vhost_transport_do_send_pkt(struct vhost_vsock *vsock,
>>> if (le32_to_cpu(pkt->hdr.flags) & VIRTIO_VSOCK_SEQ_EOM) {
>>> pkt->hdr.flags &= ~cpu_to_le32(VIRTIO_VSOCK_SEQ_EOM);
>>> restore_msg_eom_flag = true;
>>> +
>>> + if (le32_to_cpu(pkt->hdr.flags & VIRTIO_VSOCK_SEQ_EOR)) {
>> ^
>> Here it should be `le32_to_cpu(pkt->hdr.flags) & VIRTIO_VSOCK_SEQ_EOR`
>>
>>> + pkt->hdr.flags &= ~cpu_to_le32(VIRTIO_VSOCK_SEQ_EOR);
>>> + restore_msg_eor_flag = true;
>>> + }
>>> }
>>> }
>>>
>>> @@ -224,9 +230,13 @@ vhost_transport_do_send_pkt(struct vhost_vsock *vsock,
>>> * to send it with the next available buffer.
>>> */
>>> if (pkt->off < pkt->len) {
>>> - if (restore_msg_eom_flag)
>>> + if (restore_msg_eom_flag) {
>>> pkt->hdr.flags |= cpu_to_le32(VIRTIO_VSOCK_SEQ_EOM);
>>>
>>> + if (restore_msg_eor_flag)
>>> + pkt->hdr.flags |= cpu_to_le32(VIRTIO_VSOCK_SEQ_EOR);
>>> + }
>>> +
>> If we use a single variable, here we can simply do:
>>
>> pkt->hdr.flags |= cpu_to_le32(flags_to_restore);
>>
>> Stefano
>
>Thanks, i'll prepare v2 both with spec patch. About spec: i've already sent
>
>patch for SEQPACKET, can i prepare spec patch updating current reviewed
>
>SEQPACKET? E.g. i'll include both EOM and EOR in one patch.
Yep, since spec is not yet merged, I think make sense to have all
seqpacket stuff in a single patch.
Thanks,
Stefano
Powered by blists - more mailing lists