Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp333461pxj; Thu, 13 May 2021 06:08:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyeVNLIX/OqFCWF4aHTxIsrmnXouWbOlWveBlj3gJ8PYNL7K9moHcaP0Ex1NU9rGpfNROGJ X-Received: by 2002:a2e:9586:: with SMTP id w6mr21636855ljh.131.1620911311742; Thu, 13 May 2021 06:08:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620911311; cv=none; d=google.com; s=arc-20160816; b=TlokP7HsGSObg/15QEfrUhV9J5exLvinh1ACbIEss6U7uny4bOWsXMF8VP8kFEVY1u CWWXUxOmQUjE4Z5FCrdwWy9wuIeF4tQ1qAMZUraycws6HpKu7R5dh4OMcLV9SOJA5hId 01cjVFe8KgrMRWpx17ql4fRrH7BO3K07kLIfqxZao3bEmK0QMF8/ySkPyZvfpLaLheM+ DzIUVkbZG1o0gwjooDMgS8I5PjTmrD4JhKGnHk3JXAhmah6kOcPM5q5PRqp6n5mQKznc Qbnmw4yQXBS+xtgkRfFDGUXB4guP5obaUaQFbm3iVdidQCJVnZbFmN3uEqJbkO7P4KBw 40pA== 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=reFKUH6rrlF+AA2394T7GVrIVtOgj3DePRS0lsPMuB0=; b=ozHMItC7u7ngxFx2V/XZftz9EO6IJZgVf4jf9jqvU1UzIvyudq/PiPtXEhgxYOsq/Y bn//dGdsMMPmA/Fhj9joBZQFVMBohaVa3FUeMyhvG9YzzW4ju4GHL3++GascmXU8N3ST HLuVHHHIv2vBN0Z6LAos5o07I5ZSrE2F2TSA7eMwwmDyDvnes/3AzzXVH0xQ4dukc235 Y6aV8s3ET8vaAAdJAhLHcflO5R5/QCKn/e1hQ6LBA1ahCI4qc1Nn418eMuCre45bWoC8 PIx3WNicmYPmcaApJVIJCwckMSaRn2z8fFlfRC4GJq231hmhrFwHlX46j6ahVYWtRgLz i1yw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=iU1pLIUg; 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 o5si3735971ljh.509.2021.05.13.06.08.01; Thu, 13 May 2021 06:08:31 -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=iU1pLIUg; 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 S233740AbhEMNEc (ORCPT + 99 others); Thu, 13 May 2021 09:04:32 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:30161 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233591AbhEMNE3 (ORCPT ); Thu, 13 May 2021 09:04:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620910999; 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=reFKUH6rrlF+AA2394T7GVrIVtOgj3DePRS0lsPMuB0=; b=iU1pLIUggdeYLMe1RxV77TwP4TKS8095Zp61qXjpBza/f0Z8Tm+JsWicylTuwZTxBpBrKC Rqkw/KsfHRHLh/R13T3ePwUM0gMWfOkE/KmJcdYmKPiqRmN9woLdMtj/2u5lQlKJcvltKG s0fWXco4hNiFJdguvQQkM6PSNkzmPv4= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-57-mmepGcJ8PzeyoPHKRzu0Ew-1; Thu, 13 May 2021 09:03:17 -0400 X-MC-Unique: mmepGcJ8PzeyoPHKRzu0Ew-1 Received: by mail-ed1-f72.google.com with SMTP id i19-20020a05640242d3b0290388cea34ed3so14582318edc.15 for ; Thu, 13 May 2021 06:03:17 -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=reFKUH6rrlF+AA2394T7GVrIVtOgj3DePRS0lsPMuB0=; b=rkhIIAiTdJW59RLU3qiAHliyJB2Et/Dposk4zhF14ugdAc5pv7xUJzdlyIURwDyVDz JmrvDAEZ3I4I+uh7g5Tnv4cuy8J01HzpPG46Lqxs3fZLjtAWCuj/lwEBFwsB1nsO2En6 HtDWMVJanctCzTryrR4UIsGesL1EvrShxId2IYk0javtOMM8auesbHCXQafN2XpBznQK Z9PLMu2YciJzaBjONEDZmSXaVM3DlScKCsQ07TKK1n7UFgsl84851SntxXfacj9U3Ycm axOdH9m9vXC5hv1FgYGFhaBRDi7rj7mp7pBrrJue3jlAbRL3fxeXouM0fU+S0qlYkm/P Ih4Q== X-Gm-Message-State: AOAM531ScApNaJ/dh9fvig32UTWIaD2IgZOVaNBXvl8FpLd5REO97zLP XGQS239FtC+FQJz+nn0rVPON55FD+FAYCjo3Cct+veyLgoaVBxUfYRaL8699GfEZBteE33JscjL 4UtTpWUV/3v0AHJzvunWMWB06 X-Received: by 2002:a17:906:a017:: with SMTP id p23mr44269249ejy.460.1620910996140; Thu, 13 May 2021 06:03:16 -0700 (PDT) X-Received: by 2002:a17:906:a017:: with SMTP id p23mr44269235ejy.460.1620910995957; Thu, 13 May 2021 06:03:15 -0700 (PDT) Received: from steredhat (host-79-18-148-79.retail.telecomitalia.it. [79.18.148.79]) by smtp.gmail.com with ESMTPSA id h4sm2157154edv.97.2021.05.13.06.03.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 May 2021 06:03:15 -0700 (PDT) Date: Thu, 13 May 2021 15:03:13 +0200 From: Stefano Garzarella To: Arseny Krasnov Cc: Stefan Hajnoczi , "Michael S. Tsirkin" , Jason Wang , "David S. Miller" , Jakub Kicinski , Jorgen Hansen , Andra Paraschiv , Colin Ian King , Norbert Slusarek , kvm , Linux Virtualization , netdev , kernel list , stsp , Krasnov Arseniy Subject: Re: [RFC PATCH v9 13/19] virtio/vsock: rest of SOCK_SEQPACKET support Message-ID: References: <20210508163027.3430238-1-arseny.krasnov@kaspersky.com> <20210508163558.3432246-1-arseny.krasnov@kaspersky.com> <20210513122708.mwooglzkhv7du7jo@steredhat> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210513122708.mwooglzkhv7du7jo@steredhat> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org sdf On Thu, May 13, 2021 at 2:27 PM Stefano Garzarella wrote: > > On Sat, May 08, 2021 at 07:35:54PM +0300, Arseny Krasnov wrote: > >This adds rest of logic for SEQPACKET: > >1) Send SHUTDOWN on socket close for SEQPACKET type. > >2) Set SEQPACKET packet type during send. > >3) 'seqpacket_allow' flag to virtio transport. > > Please update this commit message, point 3 is not included anymore in > this patch, right? > > >4) Set 'VIRTIO_VSOCK_SEQ_EOR' bit in flags for last > > packet of message. > > > >Signed-off-by: Arseny Krasnov > >--- > > v8 -> v9: > > 1) Use cpu_to_le32() to set VIRTIO_VSOCK_SEQ_EOR. > > > > include/linux/virtio_vsock.h | 4 ++++ > > net/vmw_vsock/virtio_transport_common.c | 17 +++++++++++++++-- > > 2 files changed, 19 insertions(+), 2 deletions(-) > > > >diff --git a/include/linux/virtio_vsock.h b/include/linux/virtio_vsock.h > >index 02acf6e9ae04..7360ab7ea0af 100644 > >--- a/include/linux/virtio_vsock.h > >+++ b/include/linux/virtio_vsock.h > >@@ -80,6 +80,10 @@ virtio_transport_dgram_dequeue(struct vsock_sock *vsk, > > struct msghdr *msg, > > size_t len, int flags); > > > >+int > >+virtio_transport_seqpacket_enqueue(struct vsock_sock *vsk, > >+ struct msghdr *msg, > >+ size_t len); > > ssize_t > > virtio_transport_seqpacket_dequeue(struct vsock_sock *vsk, > > struct msghdr *msg, > >diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c > >index 7fea0a2192f7..b6608b4ac7c2 100644 > >--- a/net/vmw_vsock/virtio_transport_common.c > >+++ b/net/vmw_vsock/virtio_transport_common.c > >@@ -74,6 +74,10 @@ virtio_transport_alloc_pkt(struct virtio_vsock_pkt_info *info, > > err = memcpy_from_msg(pkt->buf, info->msg, len); > > if (err) > > goto out; > >+ > >+ if (info->msg->msg_iter.count == 0) > > Also here is better `msg_data_left(info->msg)` > > >+ pkt->hdr.flags = cpu_to_le32(info->flags | > >+ VIRTIO_VSOCK_SEQ_EOR); > > Re-thinking an alternative could be to set EOR here... > > info->flags |= VIRTIO_VSOCK_SEQ_EOR; Or just `pkt->hdr.flags |= cpu_to_le32(VIRTIO_VSOCK_SEQ_EOR)`, as you did in vhost-vsock :-)