Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3192046pxf; Mon, 15 Mar 2021 04:04:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyge3/MSGlxEHAfNYQSBTSdmvCzGr9FgqCWagtlhqtatgMptEo8rjrdtJg5+yJpdpxm4GgD X-Received: by 2002:a17:906:170f:: with SMTP id c15mr22579545eje.358.1615806269677; Mon, 15 Mar 2021 04:04:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615806269; cv=none; d=google.com; s=arc-20160816; b=xPyyFxt0f7JCJj+f87xBS6dKSJYhq0tS0U+yKGypEv3J8xScgMf0vRvmg0nsFWEEQ8 OSyJPfldAjnPPKVVKA7YKrQhJplDDx5WQJ/mPpiFu7GEY0+QP7A/KWEYVlyHIJHG+KuK q+cW09It7XLueUyNEixcQWzkvnCHmi6ZDgcVhQVO8ew0rvMzAymI0RMJ7oD0TCbLRpf8 mPt8NEf63udZGYVGBEZj+2VyDqChGZCZR0RoNObb65E6t1gjqkMxdC5qod7FOzywSZ8u vOSCj6cbQm65AEQ3bnsudrwbMdVVcZ/7FCubHPuq8DxasasG4CJ5EZWCuq+MCCgt8w1H 1knw== 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=S/oWGawpXGhyQCD9KmbcPNHKcWmsnOSDhuC/sNGQZGI=; b=uRyGuxsXLBpTXUbmoyESPi/LbcVPV3SvFswMBIg+aPyf6+x9FyOfDqgl/r+YEP1VSu 9VWKUgbiatGOYyY5T+msZevOFhuthp8k3ohb002HFBvfeHEknP4hNRUDQJidGzl/Vmk5 1NhMpe0idypQ4VedUB6nSGaAQbIA7S6E2QnTPP4+XwOLVp6lGQqRiGZmrcW9mwTioTsS /vXBdr1fgOo4VPnokMzvuxMm2UeeBr0dv3N1V8a9YCmAqt1jwhOZXjB3ePbNlRqpbr8y iECt6UZ6CAJI/MxZiqRb+eaZIlVfJzjHXsyQHq+JN2LfAdzV8bcJB0usrnWdkLjZHJ37 Nppw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=CrnWFDtv; 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 js6si10975577ejc.497.2021.03.15.04.04.06; Mon, 15 Mar 2021 04:04:29 -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=CrnWFDtv; 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 S229805AbhCOLCp (ORCPT + 99 others); Mon, 15 Mar 2021 07:02:45 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:33220 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229699AbhCOLCP (ORCPT ); Mon, 15 Mar 2021 07:02:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615806135; 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=S/oWGawpXGhyQCD9KmbcPNHKcWmsnOSDhuC/sNGQZGI=; b=CrnWFDtveGdiLUbmvbydLmBN6TLTE7QMgQOJ12yZT8Vt6lkPCeWQZKw9Uo56yX3EiQOJaM 6seAr11sAfbiAXgrs4UluURXSFstinoxjQjqDztwldNQ4DI0kNUMSahBp27aoaIfYqCiqs s8GYxEosPmumVk9z97/dJLNzjBiXlHg= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-231-qvOD4KKGPR6eRv3F4sKkhQ-1; Mon, 15 Mar 2021 07:02:13 -0400 X-MC-Unique: qvOD4KKGPR6eRv3F4sKkhQ-1 Received: by mail-wm1-f72.google.com with SMTP id s192so8026292wme.6 for ; Mon, 15 Mar 2021 04:02:13 -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=S/oWGawpXGhyQCD9KmbcPNHKcWmsnOSDhuC/sNGQZGI=; b=iEilIDzetY945telBFKDRLlRutAnt7DjVH8T0qiOLQVwOnTa6aaQ9/av/tbhE1kW9I Pq3sWzxdoodUQny5w777PIDlGgzTZyB2Kl0C3r+TrrVXhBaIq80ToeYG/vFWZUatxN+L qh3pw6oVPUOIE4c6ufTbYBwFi8cixTYNY7wnzdAV8Ub3QUUVYHchwc97jjZl96mGInkw c6RVpPLXwPkQs+bMQ+Pr/CGzkl9BeOVCPdbnvyr3ODpIoaJsOpVEFwajHg3uOzXysig3 Vm1qAFUfRE6NMEYwyR/tQRqByr7tt/CT24y+q/wHyqyNagoqhI3Hp36an0cnn71CwIw9 2zmQ== X-Gm-Message-State: AOAM533nBruhVRVoaSixTJUUDEJFf968rF3Pvfj5lmsKNYaNoH/4Bp0c jk9glxvEVF4p/DTnC1/3Xi8hBqe6dsxJ4w/9Ouo5DGDiTRgvT89zpNg4mvxj2BY6o4ANJRc0z3I v5l8XMpsam7i96doZBnTVgszO X-Received: by 2002:a05:6000:24b:: with SMTP id m11mr26777659wrz.393.1615806132233; Mon, 15 Mar 2021 04:02:12 -0700 (PDT) X-Received: by 2002:a05:6000:24b:: with SMTP id m11mr26777627wrz.393.1615806132028; Mon, 15 Mar 2021 04:02:12 -0700 (PDT) Received: from steredhat (host-79-34-249-199.business.telecomitalia.it. [79.34.249.199]) by smtp.gmail.com with ESMTPSA id a13sm16170382wrp.31.2021.03.15.04.02.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Mar 2021 04:02:11 -0700 (PDT) Date: Mon, 15 Mar 2021 12:02:09 +0100 From: Stefano Garzarella To: Arseny Krasnov Cc: Stefan Hajnoczi , "Michael S. Tsirkin" , Jason Wang , "David S. Miller" , Jakub Kicinski , Jorgen Hansen , Colin Ian King , Norbert Slusarek , Andra Paraschiv , kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, stsp2@yandex.ru, oxffffaa@gmail.com Subject: Re: [RFC PATCH v6 11/22] virtio/vsock: dequeue callback for SOCK_SEQPACKET Message-ID: <20210315110209.xuaq5q3a2zp4u3g5@steredhat> References: <20210307175722.3464068-1-arseny.krasnov@kaspersky.com> <20210307180204.3465806-1-arseny.krasnov@kaspersky.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20210307180204.3465806-1-arseny.krasnov@kaspersky.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Mar 07, 2021 at 09:02:01PM +0300, Arseny Krasnov wrote: >This adds transport callback and it's logic for SEQPACKET dequeue. >Callback fetches RW packets from rx queue of socket until whole record >is copied(if user's buffer is full, user is not woken up). This is done >to not stall sender, because if we wake up user and it leaves syscall, >nobody will send credit update for rest of record, and sender will wait >for next enter of read syscall at receiver's side. So if user buffer is >full, we just send credit update and drop data. If during copy SEQ_BEGIN >was found(and not all data was copied), copying is restarted by reset >user's iov iterator(previous unfinished data is dropped). > >Signed-off-by: Arseny Krasnov >--- > include/linux/virtio_vsock.h | 13 +++ > include/uapi/linux/virtio_vsock.h | 16 ++++ > net/vmw_vsock/virtio_transport_common.c | 116 ++++++++++++++++++++++++ > 3 files changed, 145 insertions(+) > >diff --git a/include/linux/virtio_vsock.h b/include/linux/virtio_vsock.h >index dc636b727179..466a5832d2f5 100644 >--- a/include/linux/virtio_vsock.h >+++ b/include/linux/virtio_vsock.h >@@ -18,6 +18,12 @@ enum { > VSOCK_VQ_MAX = 3, > }; > >+struct virtio_vsock_seqpack_state { >+ u32 user_read_seq_len; >+ u32 user_read_copied; >+ u32 curr_rx_msg_id; >+}; >+ > /* Per-socket state (accessed via vsk->trans) */ > struct virtio_vsock_sock { > struct vsock_sock *vsk; >@@ -36,6 +42,8 @@ struct virtio_vsock_sock { > u32 rx_bytes; > u32 buf_alloc; > struct list_head rx_queue; >+ >+ struct virtio_vsock_seqpack_state seqpacket_state; Following 'virtio_vsock_seq_hdr', maybe we can shorten in: struct virtio_vsock_seq_state seq_state; The rest LGTM.