Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2596378pxb; Tue, 24 Aug 2021 03:03:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJypzyPzDnNhhHRWEurDnmIMOXnavFP3c9uY0kUpgN6AyyjtQUpxROuw4BLfX6PxmecyJm7U X-Received: by 2002:a92:da4c:: with SMTP id p12mr25514972ilq.89.1629799405223; Tue, 24 Aug 2021 03:03:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629799405; cv=none; d=google.com; s=arc-20160816; b=l6/z2qmYpKKOaemfMOr+RMwBOkwqkAGtFExO0X0a6ebrm5t+woSxDHHOXof3Vv6xGX Y1TOuEYtxDDLaqH3p4O+itA72v8FZxASGNccy7hvAmstUwiEugCdbVHb+sZnRTeto77Y nT5/sVGiisgWphO7ZJUuRonJpvCBsFQpkULiTWdiaAn6De8zBu95Q8sjv6nNFdkizdX9 o+au2mZJiQPZY2mmoGsAI0xvFVFuCCzqc900npghO0gDSdmmWYujDTspT+5hgakRZ+1H +tWDdFUdoBef9mmVxz+gkywZVMn7t6kY0jNQIupb5788mwkgPC1MM0JtgL4GEiH6VxSc HHVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=AsfgonFEhHbtRW9+iWzj2iDpJcwnghT7FgzSm7rVr3I=; b=SCz2XFpBhegVKgSyBR2+KEWE2JHsmD90vjVIMzjIHk0VkJiTGD1+yIeFRBn2QTizE4 JopMTPFn2QDGoQPHfNn1mamJ2nQMabTg4+LIx5lnxg8yBfiT0GKotZH2r5OStKuFA2CQ IyrM/QhAoqF+tHfCZJFX9nGdbAIwT/XNnPV0RjIRAMW1JHDYV15720WRj1X4yL547OzO LX56hGmiNFZ3E6ML86EJqvK4CIoUIq/cGoWlnvsrW+CC03Kra+bCArEKZhe8IOfegSU7 FgoREPayvE9OP6CfJzVtaJfCwHTmpbj/7uqr5lawAC8/kJ1jWOSGT904uApFhq64cO4N DNFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=OWntaB+N; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q9si16771672ile.120.2021.08.24.03.03.13; Tue, 24 Aug 2021 03:03:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=OWntaB+N; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236204AbhHXKB4 (ORCPT + 99 others); Tue, 24 Aug 2021 06:01:56 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:45135 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235566AbhHXKBn (ORCPT ); Tue, 24 Aug 2021 06:01:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629799259; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=AsfgonFEhHbtRW9+iWzj2iDpJcwnghT7FgzSm7rVr3I=; b=OWntaB+NXPrlDtpTakkoZitch+/NkZHvciZ1tMnzCLzbrTa6cv+akeAekm7k6zWvFYnEKj gfZSvdHp1qVRCQa+ZhG9ROXqwIeKPj2Ga3hBk6zZv/jK+0/3I7++oIYcJPPEL7kEwNf3TQ Im9JBqzCxKEKAtIqmBBPLzAeapdAvsE= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-423-7QwYz1oUN2Wd9qzBdEkYKA-1; Tue, 24 Aug 2021 06:00:58 -0400 X-MC-Unique: 7QwYz1oUN2Wd9qzBdEkYKA-1 Received: by mail-ej1-f70.google.com with SMTP id yz13-20020a170906dc4d00b005c61ad936f0so2060184ejb.12 for ; Tue, 24 Aug 2021 03:00:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=AsfgonFEhHbtRW9+iWzj2iDpJcwnghT7FgzSm7rVr3I=; b=eHp2SSTxg5CQjgz4BLtX8L6Ny6wlWyeKmKgWbzMQ7yt6vSK2tn80UWsfK36R73Vd4v evLojT5kaxGr2+zzSlqtyndRna8OLOm5ok8NBvjFJqWlQOinZp2WOdE74mUQQA/pkosx TgY5Eq39K1OT/oAzBpi4XTnOKePh9wxg5xAj6yyvKCDw1P4OlbFsqc15gXW+IaFlq3YL AowWFIju6CDaUlOAapmAPtoocEO25Nwhct/9qgnYNy4IkZoK20GePZTciZVQG+AVcc3k dk/JHEWjikt/EObaMPFk0yBU2KZBZvCNA/HMZiWsDD1HhQ+KPRzu8ljvTcHqAyNlvQlX /uTg== X-Gm-Message-State: AOAM533GAWpUQHwRYWatUdOwKdPDQ5PIdaBjr31mPmU3MeoNqqcJT5hY qUqYb91GA3VjrEu9HC5AXskCgzuHouMjGV3cJn3FuU60jQmS3/ggcfVUshCLdKTL4YZP1v3H/n6 Aln85xrKOqDu/rVJNQeXBF0Zk X-Received: by 2002:a17:906:a0ce:: with SMTP id bh14mr38811944ejb.434.1629799257233; Tue, 24 Aug 2021 03:00:57 -0700 (PDT) X-Received: by 2002:a17:906:a0ce:: with SMTP id bh14mr38811918ejb.434.1629799257043; Tue, 24 Aug 2021 03:00:57 -0700 (PDT) Received: from steredhat (host-79-45-8-152.retail.telecomitalia.it. [79.45.8.152]) by smtp.gmail.com with ESMTPSA id f30sm3469843ejl.78.2021.08.24.03.00.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Aug 2021 03:00:56 -0700 (PDT) Date: Tue, 24 Aug 2021 12:00:53 +0200 From: Stefano Garzarella To: Arseny Krasnov Cc: Stefan Hajnoczi , "Michael S. Tsirkin" , Jason Wang , "David S. Miller" , Jakub Kicinski , Andra Paraschiv , Colin Ian King , Norbert Slusarek , kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, stsp2@yandex.ru, oxffffaa@gmail.co Subject: Re: [RFC PATCH v3 3/6] vhost/vsock: support MSG_EOR bit processing Message-ID: <20210824100053.jc2pgttgwq5sujvu@steredhat> References: <20210816085036.4173627-1-arseny.krasnov@kaspersky.com> <20210816085143.4174099-1-arseny.krasnov@kaspersky.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20210816085143.4174099-1-arseny.krasnov@kaspersky.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 16, 2021 at 11:51:40AM +0300, Arseny Krasnov wrote: >'MSG_EOR' handling has same logic as 'MSG_EOM' - if bit present s/same/similar >in packet's header, reset it to 0. Then restore it back if packet >processing wasn't completed. Instead of bool variable for each >flag, bit mask variable was added: it has logical OR of 'MSG_EOR' >and 'MSG_EOM' if needed, to restore flags, this variable is ORed >with flags field of packet. > >Signed-off-by: Arseny Krasnov >--- > drivers/vhost/vsock.c | 12 ++++++++---- > 1 file changed, 8 insertions(+), 4 deletions(-) > >diff --git a/drivers/vhost/vsock.c b/drivers/vhost/vsock.c >index feaf650affbe..d217955bbcd4 100644 >--- a/drivers/vhost/vsock.c >+++ b/drivers/vhost/vsock.c >@@ -114,7 +114,7 @@ vhost_transport_do_send_pkt(struct vhost_vsock *vsock, > size_t nbytes; > size_t iov_len, payload_len; > int head; >- bool restore_flag = false; >+ uint32_t flags_to_restore = 0; checkpatch.pl suggest the following: CHECK: Prefer kernel type 'u32' over 'uint32_t' Sorry, I suggested that, I forgot that u32 is preferable :-) > > spin_lock_bh(&vsock->send_pkt_list_lock); > if (list_empty(&vsock->send_pkt_list)) { >@@ -187,7 +187,12 @@ vhost_transport_do_send_pkt(struct vhost_vsock >*vsock, > */ Please also update the comment above with the new flag handled. > if (le32_to_cpu(pkt->hdr.flags) & VIRTIO_VSOCK_SEQ_EOM) { > pkt->hdr.flags &= ~cpu_to_le32(VIRTIO_VSOCK_SEQ_EOM); >- restore_flag = true; >+ flags_to_restore |= VIRTIO_VSOCK_SEQ_EOM; >+ >+ if (le32_to_cpu(pkt->hdr.flags) & VIRTIO_VSOCK_SEQ_EOR) { >+ pkt->hdr.flags &= ~cpu_to_le32(VIRTIO_VSOCK_SEQ_EOR); >+ flags_to_restore |= VIRTIO_VSOCK_SEQ_EOR; >+ } > } > } > >@@ -224,8 +229,7 @@ vhost_transport_do_send_pkt(struct vhost_vsock *vsock, > * to send it with the next available buffer. > */ > if (pkt->off < pkt->len) { >- if (restore_flag) >- pkt->hdr.flags |= cpu_to_le32(VIRTIO_VSOCK_SEQ_EOM); >+ pkt->hdr.flags |= cpu_to_le32(flags_to_restore); > > /* We are queueing the same virtio_vsock_pkt to handle > * the remaining bytes, and we want to deliver it >-- >2.25.1 > The rest LGTM. Stefano