Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp357992pxj; Thu, 3 Jun 2021 08:24:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/A67ZkpzNxBUzdYyKlCXCP3iRdRnodQCu4CmF2Ap3EMTqJiBpvEefkP8WS+PQTX4yvaqy X-Received: by 2002:a17:906:d85:: with SMTP id m5mr137691eji.55.1622733840764; Thu, 03 Jun 2021 08:24:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622733840; cv=none; d=google.com; s=arc-20160816; b=eKAUgapBGA5ZqOhNpMHu9r4NO0MAPq5/qMDwhTa1/yanHGEXdH+FQfPa08scB4P1iF JIwfBxfrX5PGjG6Qho1GjcseEehlzmObmZdiQmO+o/966JXjQDau6l7ouIMBLkKPr8bo tK34LMLaJ8T3DyqIu6RH5nAgBzbUWuNkvM3byYEfmlhUg0RqCRCsUmhMvDus7kOH6peN tKfMMreX10UrvF3kfsucVI3IFxa5rnCqZNcMDG/bEF4CicybXywxWR3aauEKJlKBmPpl zkmDrgWiIxt+Bg87nzwOozK3fvRAv2Eaz2p2sDCvTJt1wVNRhqh8L4vRZyy86U68rt+5 GCkA== 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=Tk288Zz+uIifCmQruWzx1HX+KXbfFOTwP0kxM+VMUEc=; b=anx7w6ho9K9WtYfBr3HcO/sCBq4Cls1YQzSKO665zSGHQHHFIA+vQmk3cxnEHyqQlH Woml7o0Dqq/+LFV5rReMrIa2T2CDBHIJ+r0CzaiGFWjHViy2r+/zXKyKuJ9qixvVCK4S PdiL0cyga46AwbTQ1yRgl1Pqt1xq29PKwVMCXz50VjcQtuqI8aTOt0gbssKloFiP46vq z7NI86mIlUEtp8yvzOmbqeMvMCp74Eyhn7QWBzwASuQHwe5iVf8M0z9or31U1oRkb2bD p1/HiE528C3mcY1pz1DQ0TM6BG+pjV1yOt7UROXfeo5U3K25OuLcu+EEy1brWszJSxE+ nQyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=U8LwQwct; 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 v9si2501292eds.500.2021.06.03.08.23.37; Thu, 03 Jun 2021 08:24:00 -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=U8LwQwct; 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 S232066AbhFCPXz (ORCPT + 99 others); Thu, 3 Jun 2021 11:23:55 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:24535 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231623AbhFCPXz (ORCPT ); Thu, 3 Jun 2021 11:23:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1622733730; 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=Tk288Zz+uIifCmQruWzx1HX+KXbfFOTwP0kxM+VMUEc=; b=U8LwQwctwhWDGUPTzbAdEPnOu+DroSh7QMht5ehK558ivZu1syxHd+HELRIWnTeV+atK2x 2+8R8m9EIcaPLA5zHQ5CcxMvyjrUD759HOdDZRTTHW7cuS7obrO9B1UST53p/qzOYVaijv cWgsyfgi8Q/LNNiX+O/6xA7GwADSO+o= Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-589-R8yDZk8vPUuwLjPj8zIMzg-1; Thu, 03 Jun 2021 11:22:08 -0400 X-MC-Unique: R8yDZk8vPUuwLjPj8zIMzg-1 Received: by mail-ej1-f69.google.com with SMTP id gv42-20020a1709072beab02903eab8e33118so2064017ejc.19 for ; Thu, 03 Jun 2021 08:22:08 -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=Tk288Zz+uIifCmQruWzx1HX+KXbfFOTwP0kxM+VMUEc=; b=cJVckda1fHp8cfia29FuS+/mPqgf9gOOcaxwj42Fu0EScafckFCEDkytav8XFGyRPq 8NdLs6rqeiJPg2uBohBtCSKphbE/ET5unuIUpsbGjYwwGSfaxGl1L/L0MQSbgtKtTvOe eTSSEVdHBv0C8akxRNuljgdRzNokzlnzzUgcN/Z7fH1KI/bTxmoIV9S3OLmwGms0w5kV YBXAa+vXO92RGkMlabSeKmzKduOxnAlPPZZSG/1PFUBrCM+lO9txLVX6YNV0k0wElz3b DEn+5JwgAcIdjryrp/FdzQLJ5v010B5jw+kZKUg1CzoKnmgi0//UDnd0OLk8FKhKN4jA LS0w== X-Gm-Message-State: AOAM5323JWpVy/wE/uQAI7iLiDp838mKNDI6EGlYsbwv5cqK4TTzErDK XhuexfJ6a/YGF9/6FcudYJpVukJnqeQ20jAQ4aZi+WWITBlNH4DM4byvRGIZoFk7XC2ah/bJRLX eszTDjQyUQbg0l0vWdsts3myW X-Received: by 2002:a17:906:6c88:: with SMTP id s8mr125416ejr.129.1622733727731; Thu, 03 Jun 2021 08:22:07 -0700 (PDT) X-Received: by 2002:a17:906:6c88:: with SMTP id s8mr125391ejr.129.1622733727545; Thu, 03 Jun 2021 08:22:07 -0700 (PDT) Received: from steredhat ([5.170.129.82]) by smtp.gmail.com with ESMTPSA id z22sm1197140ejm.71.2021.06.03.08.22.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Jun 2021 08:22:07 -0700 (PDT) Date: Thu, 3 Jun 2021 17:22:03 +0200 From: Stefano Garzarella To: Arseny Krasnov Cc: Stefan Hajnoczi , "Michael S. Tsirkin" , Jason Wang , "David S. Miller" , Jakub Kicinski , Jorgen Hansen , Norbert Slusarek , Colin Ian King , Andra Paraschiv , kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, oxffffaa@gmail.com Subject: Re: [PATCH v10 14/18] virtio/vsock: enable SEQPACKET for transport Message-ID: <20210603152203.gezrjp2xiv53eqpm@steredhat> References: <20210520191357.1270473-1-arseny.krasnov@kaspersky.com> <20210520191901.1272423-1-arseny.krasnov@kaspersky.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20210520191901.1272423-1-arseny.krasnov@kaspersky.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 20, 2021 at 10:18:57PM +0300, Arseny Krasnov wrote: >To make transport work with SOCK_SEQPACKET two updates were >added: Present is better, and you can also mention that we enable it only if the feature is negotiated with the device. >1) SOCK_SEQPACKET ops for virtio transport and 'seqpacket_allow()' > callback. >2) Handling of SEQPACKET bit: guest tries to negotiate it with vhost. > >Signed-off-by: Arseny Krasnov >--- > v9 -> v10: > 1) Use 'virtio_has_feature()' to check feature bit. > 2) Move assignment to 'seqpacket_allow' before 'rcu_assign_pointer()'. > > net/vmw_vsock/virtio_transport.c | 24 ++++++++++++++++++++++++ > 1 file changed, 24 insertions(+) > >diff --git a/net/vmw_vsock/virtio_transport.c b/net/vmw_vsock/virtio_transport.c >index 2700a63ab095..bc5ee8df723a 100644 >--- a/net/vmw_vsock/virtio_transport.c >+++ b/net/vmw_vsock/virtio_transport.c >@@ -62,6 +62,7 @@ struct virtio_vsock { > struct virtio_vsock_event event_list[8]; > > u32 guest_cid; >+ bool seqpacket_allow; > }; > > static u32 virtio_transport_get_local_cid(void) >@@ -443,6 +444,8 @@ static void virtio_vsock_rx_done(struct virtqueue >*vq) > queue_work(virtio_vsock_workqueue, &vsock->rx_work); > } > >+static bool virtio_transport_seqpacket_allow(u32 remote_cid); >+ > static struct virtio_transport virtio_transport = { > .transport = { > .module = THIS_MODULE, >@@ -469,6 +472,10 @@ static struct virtio_transport virtio_transport = { > .stream_is_active = virtio_transport_stream_is_active, > .stream_allow = virtio_transport_stream_allow, > >+ .seqpacket_dequeue = >virtio_transport_seqpacket_dequeue, >+ .seqpacket_enqueue = virtio_transport_seqpacket_enqueue, >+ .seqpacket_allow = virtio_transport_seqpacket_allow, >+ > .notify_poll_in = virtio_transport_notify_poll_in, > .notify_poll_out = virtio_transport_notify_poll_out, > .notify_recv_init = virtio_transport_notify_recv_init, >@@ -485,6 +492,19 @@ static struct virtio_transport virtio_transport = { > .send_pkt = virtio_transport_send_pkt, > }; > >+static bool virtio_transport_seqpacket_allow(u32 remote_cid) >+{ >+ struct virtio_vsock *vsock; >+ bool seqpacket_allow; >+ >+ rcu_read_lock(); >+ vsock = rcu_dereference(the_virtio_vsock); >+ seqpacket_allow = vsock->seqpacket_allow; >+ rcu_read_unlock(); >+ >+ return seqpacket_allow; >+} >+ > static void virtio_transport_rx_work(struct work_struct *work) > { > struct virtio_vsock *vsock = >@@ -608,6 +628,9 @@ static int virtio_vsock_probe(struct virtio_device *vdev) > vsock->event_run = true; > mutex_unlock(&vsock->event_lock); > >+ if (virtio_has_feature(vdev, VIRTIO_VSOCK_F_SEQPACKET)) >+ vsock->seqpacket_allow = true; >+ > vdev->priv = vsock; > rcu_assign_pointer(the_virtio_vsock, vsock); > >@@ -695,6 +718,7 @@ static struct virtio_device_id id_table[] = { > }; > > static unsigned int features[] = { >+ VIRTIO_VSOCK_F_SEQPACKET > }; > > static struct virtio_driver virtio_vsock_driver = { >-- >2.25.1 >