[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <40a1d508-c841-23b7-58d5-f539b2d98ae1@kaspersky.com>
Date: Fri, 6 Aug 2021 11:40:38 +0300
From: Arseny Krasnov <arseny.krasnov@...persky.com>
To: Stefano Garzarella <sgarzare@...hat.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 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.
Thank You
>
Powered by blists - more mailing lists