Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp4275557pxt; Wed, 11 Aug 2021 02:04:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwmI5qRva2JwQiSJjss0UKqKfL/iZd+/OtlKwyWbSyaXp/6mDUGjudFbkr4SgGxgKncZX/8 X-Received: by 2002:aa7:c794:: with SMTP id n20mr10220516eds.244.1628672646556; Wed, 11 Aug 2021 02:04:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628672646; cv=none; d=google.com; s=arc-20160816; b=zqIXBdP7E2Rv7l4/MlaM2jaxBfUKEDGGcyA0gL14nYmetzIlsdl3mNnmQjkOCfYk1M xLIBVb/vtyxDeaV+9nOE+ed0pD3yix8RyTmcvDhKcg6N0wSl+HFgMvaBROypwdtGGHjf Yg1ZfpcAVxy8u6MK+50laMbWndB9K0MUc/82dcy7u7roWdn5GNGldrwzFt0Z1MbjDL7E dZt0pa1evi0rcIYJEQP291aKqjFfcbc0CMmGZnIes58eKu8Eq9W+AFqo+ePoZBoEaOmY a62D0ZdXlyb6LnoM60xD3VGb4JNXpwfV1XDi+cwfNOfihnM8hY/7MYBpM/isKLFjWi5b fuwQ== 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=xVYk6O6UbKVQlEk4hpiQ+ioYAfkIhHzccxHN1Fx+454=; b=HE4jTX45gnsz5bP4ZRWNsbwzl3UvZqmEIKuz0kQWSev+FB/iEXKjC4QZW/ZcPnzJR0 Zsjgj7taX+L2xWyUXjC6FvhzNAp9I6FrhYPZU+2lM6XvYGsf5jWFyxZB/BwSlg/NKBIz 5ieKMUPVTsTavF6HTELI57lVn3VZLIqQ6LS0w3udPNNvVQqO12sNW5NVPQYI9QphCSAB jijRl+7byIJRWmxsmmpTQ2CHqyQIUQKaqBNwbG3+AFPT52TIcvunbJiE5SvUhMpgMkbs v0sEhl8mxSy2RNjaFNLAqeAyp5dAykAvZTt/KmnUXfKXqj3JvycPAs17GFjStRDnva3k osXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="T/pogVQ6"; 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 e10si26255086edj.183.2021.08.11.02.03.37; Wed, 11 Aug 2021 02:04:06 -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="T/pogVQ6"; 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 S236581AbhHKJBG (ORCPT + 99 others); Wed, 11 Aug 2021 05:01:06 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:60751 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236570AbhHKJBC (ORCPT ); Wed, 11 Aug 2021 05:01:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628672438; 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=xVYk6O6UbKVQlEk4hpiQ+ioYAfkIhHzccxHN1Fx+454=; b=T/pogVQ6LOdA85cxys2r8Oov0oYWdqkwp4EIA6yINrMWIf8rUlOBOI2NJ6ecwD42S2IEDK FJRSU5xXa/fJogpaDT8SxftcvDOQgnbxTKZoywOOOl7OofO8xdfTJxvxzk9Hr5v5TV6mML cWjeq9kl6yCws6JbJxJYijPmrwRiG9U= 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-309-ikHHE2RiNgCNkynurHdFQA-1; Wed, 11 Aug 2021 05:00:35 -0400 X-MC-Unique: ikHHE2RiNgCNkynurHdFQA-1 Received: by mail-ej1-f70.google.com with SMTP id q19-20020a1709064cd3b02904c5f93c0124so411537ejt.14 for ; Wed, 11 Aug 2021 02:00:35 -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=xVYk6O6UbKVQlEk4hpiQ+ioYAfkIhHzccxHN1Fx+454=; b=jpDEm5HB3MkFByfS11D5RyMn2ilqGDE4i3iQncA+4IzfB5e61BgRKKHLT3kPAqBXnr slnptppwJL4U9UURUktXAa4K9WNLjQFlx1YsDkG/EGh/IvultXYE21kZ83sk0OPa6Ltn BlsOLxfhyqGV943rEPLxlSHUtmaqAu0BUxxt6UniJ/RwZZIp94hjAeyDlkaReUGl2Cck /rZs9rVcVqZsb6elnnJpl2HDYP/bpltF7ytYkPEjIwLls0ScfjMBymBUunf6HSS8X9yj iXdpz7/lpq5t61xIPbUg2nLRrtgCPo9rwFxHArcTVlZkmemXTLsh1JzBm1egYDsL5InH SaLA== X-Gm-Message-State: AOAM532OwFSntHLF79dPV5Zxhsm7SY56KLYmTp8Ygyp/7meT7IiHr29X Lzj/Amz+LAqx+jXZLhpVwsA641lpbXGb7+cXNJo80L5pB0NjTT/SzBk+goVu4WCUq9t+EHfNJuC 909hCuM6iGXFmqvsQxNiBwE/Y X-Received: by 2002:a17:906:a08a:: with SMTP id q10mr2593175ejy.100.1628672433792; Wed, 11 Aug 2021 02:00:33 -0700 (PDT) X-Received: by 2002:a17:906:a08a:: with SMTP id q10mr2593146ejy.100.1628672433523; Wed, 11 Aug 2021 02:00:33 -0700 (PDT) Received: from steredhat (a-nu5-14.tin.it. [212.216.181.13]) by smtp.gmail.com with ESMTPSA id l19sm4147213edb.86.2021.08.11.02.00.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Aug 2021 02:00:33 -0700 (PDT) Date: Wed, 11 Aug 2021 11:00:30 +0200 From: Stefano Garzarella To: Arseny Krasnov Cc: Stefan Hajnoczi , "Michael S. Tsirkin" , Jason Wang , "David S. Miller" , Jakub Kicinski , 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 v2 1/5] virtio/vsock: add 'VIRTIO_VSOCK_SEQ_EOM' bit Message-ID: <20210811090030.snu5ckf6bdkzxdg7@steredhat> References: <20210810113901.1214116-1-arseny.krasnov@kaspersky.com> <20210810113956.1214463-1-arseny.krasnov@kaspersky.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20210810113956.1214463-1-arseny.krasnov@kaspersky.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 10, 2021 at 02:39:53PM +0300, Arseny Krasnov wrote: The title is confusing, we are renaming EOR in EOM. >This bit is used to mark end of messages('EOM' - end of message), while >'VIRIO_VSOCK_SEQ_EOR' is used to pass MSG_EOR. Also rename 'record' to >'message' in implementation as it is different things. > >Signed-off-by: Arseny Krasnov >--- > drivers/vhost/vsock.c | 12 ++++++------ > include/uapi/linux/virtio_vsock.h | 3 ++- > net/vmw_vsock/virtio_transport_common.c | 14 +++++++------- > 3 files changed, 15 insertions(+), 14 deletions(-) > >diff --git a/drivers/vhost/vsock.c b/drivers/vhost/vsock.c >index f249622ef11b..feaf650affbe 100644 >--- a/drivers/vhost/vsock.c >+++ b/drivers/vhost/vsock.c >@@ -178,15 +178,15 @@ vhost_transport_do_send_pkt(struct vhost_vsock *vsock, > * small rx buffers, headers of packets in rx queue are > * created dynamically and are initialized with > header > * of current packet(except length). But in case of >- * SOCK_SEQPACKET, we also must clear record delimeter >- * bit(VIRTIO_VSOCK_SEQ_EOR). Otherwise, instead of one >- * packet with delimeter(which marks end of record), >+ * SOCK_SEQPACKET, we also must clear message delimeter >+ * bit(VIRTIO_VSOCK_SEQ_EOM). Otherwise, instead of one >+ * packet with delimeter(which marks end of message), > * there will be sequence of packets with delimeter > * bit set. After initialized header will be copied to > * rx buffer, this bit will be restored. > */ >- if (le32_to_cpu(pkt->hdr.flags) & VIRTIO_VSOCK_SEQ_EOR) { >- pkt->hdr.flags &= ~cpu_to_le32(VIRTIO_VSOCK_SEQ_EOR); >+ if (le32_to_cpu(pkt->hdr.flags) & VIRTIO_VSOCK_SEQ_EOM) { >+ pkt->hdr.flags &= ~cpu_to_le32(VIRTIO_VSOCK_SEQ_EOM); > restore_flag = true; > } > } >@@ -225,7 +225,7 @@ vhost_transport_do_send_pkt(struct vhost_vsock *vsock, > */ > if (pkt->off < pkt->len) { > if (restore_flag) >- pkt->hdr.flags |= cpu_to_le32(VIRTIO_VSOCK_SEQ_EOR); >+ pkt->hdr.flags |= cpu_to_le32(VIRTIO_VSOCK_SEQ_EOM); > > /* We are queueing the same virtio_vsock_pkt to handle > * the remaining bytes, and we want to deliver it >diff --git a/include/uapi/linux/virtio_vsock.h b/include/uapi/linux/virtio_vsock.h >index 3dd3555b2740..64738838bee5 100644 >--- a/include/uapi/linux/virtio_vsock.h >+++ b/include/uapi/linux/virtio_vsock.h >@@ -97,7 +97,8 @@ enum virtio_vsock_shutdown { > > /* VIRTIO_VSOCK_OP_RW flags values */ > enum virtio_vsock_rw { >- VIRTIO_VSOCK_SEQ_EOR = 1, >+ VIRTIO_VSOCK_SEQ_EOM = 1, >+ VIRTIO_VSOCK_SEQ_EOR = 2, ^ I think is better to add this new flag in a separate patch. > }; > > #endif /* _UAPI_LINUX_VIRTIO_VSOCK_H */ >diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c >index 081e7ae93cb1..4d5a93beceb0 100644 >--- a/net/vmw_vsock/virtio_transport_common.c >+++ b/net/vmw_vsock/virtio_transport_common.c >@@ -77,7 +77,7 @@ virtio_transport_alloc_pkt(struct virtio_vsock_pkt_info *info, > > if (msg_data_left(info->msg) == 0 && > info->type == VIRTIO_VSOCK_TYPE_SEQPACKET) >- pkt->hdr.flags |= cpu_to_le32(VIRTIO_VSOCK_SEQ_EOR); >+ pkt->hdr.flags |= cpu_to_le32(VIRTIO_VSOCK_SEQ_EOM); > } > > trace_virtio_transport_alloc_pkt(src_cid, src_port, >@@ -457,7 +457,7 @@ static int virtio_transport_seqpacket_do_dequeue(struct vsock_sock *vsk, > dequeued_len += pkt_len; > } > >- if (le32_to_cpu(pkt->hdr.flags) & VIRTIO_VSOCK_SEQ_EOR) { >+ if (le32_to_cpu(pkt->hdr.flags) & VIRTIO_VSOCK_SEQ_EOM) { > msg_ready = true; > vvs->msg_count--; > } >@@ -1029,7 +1029,7 @@ virtio_transport_recv_enqueue(struct vsock_sock *vsk, > goto out; > } > >- if (le32_to_cpu(pkt->hdr.flags) & VIRTIO_VSOCK_SEQ_EOR) >+ if (le32_to_cpu(pkt->hdr.flags) & VIRTIO_VSOCK_SEQ_EOM) > vvs->msg_count++; > > /* Try to copy small packets into the buffer of last packet queued, >@@ -1044,12 +1044,12 @@ virtio_transport_recv_enqueue(struct vsock_sock *vsk, > > /* If there is space in the last packet queued, we copy the > * new packet in its buffer. We avoid this if the last packet >- * queued has VIRTIO_VSOCK_SEQ_EOR set, because this is >- * delimiter of SEQPACKET record, so 'pkt' is the first packet >- * of a new record. >+ * queued has VIRTIO_VSOCK_SEQ_EOM set, because this is >+ * delimiter of SEQPACKET message, so 'pkt' is the first packet >+ * of a new message. > */ > if ((pkt->len <= last_pkt->buf_len - last_pkt->len) && >- !(le32_to_cpu(last_pkt->hdr.flags) & VIRTIO_VSOCK_SEQ_EOR)) { >+ !(le32_to_cpu(last_pkt->hdr.flags) & VIRTIO_VSOCK_SEQ_EOM)) { > memcpy(last_pkt->buf + last_pkt->len, pkt->buf, > pkt->len); > last_pkt->len += pkt->len; >-- >2.25.1 > The rest LGTM! Thanks, Stefano