Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2095852pxb; Thu, 11 Feb 2021 04:22:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJwMojFy+Dsbh36ZOy44GZ6eZvpSoQQQeNkssLKLdHTM70V2c6C8DvqJOW0sQzU5Pzf4w5ee X-Received: by 2002:a05:6402:3069:: with SMTP id bs9mr8124789edb.151.1613046168487; Thu, 11 Feb 2021 04:22:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613046168; cv=none; d=google.com; s=arc-20160816; b=BJ1MFJYks/COGb/3lFxCecxorOfEfgc7m8xv2rNZlHxdHyu8u5caFd7CNjKpWtR0S+ UDnQqULX0dRoFMAXDlvVAdiv4MCs9Ql6b9roI5nJ4i5vKkfRfCsVMO6jL2PVXmUOVVap E+u2Winm0FSXEXcuOkmEcwvDI/bjJWtCTCB2whUPQ3MuuhpntI2btlKX1af7h3iWUb0W +aJi7A9BVqxjnRRt3GFOdAhd4oxNJbpTvvQgd5a51/IaKKK5u1/6Lm+kI/mouDB8htyn 10LG787BmjCa7m+5bgQdSZ5bHW0aQiES8oHXaglG3UDDQyCodG0zsjNdshebHDk0WZp4 iE6A== 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=E1yuAMx44/76bqf49DYn2JPHR26BQBuYBzfgeTpXepM=; b=uOfddU+opC6zSU8/ERGfJ6yFHI5jdI0JA5iZJlRdqLKsz2jZpUfMxekntdYf4KjgW+ 0jCPWueL2Er5fdjsAoBiHg86FKmshAmDyevYsFiE7vKLwYSID4Q7OSV6gaYDREZ3xAhg yiEGQGK9xMApPSETZ3zILybPADwYjnOXEj5JUJ+5aplGtiHjsygTdE19ykW3jddijmpF 9Ts0CtT0AkS4qw0KTOeq7vIyjqRAPoq5gd9LSe6f0VRDbfUxKTnmB0E3+UiYeMpWYLre kM4oRpoVPmkI9nMyfET0zLN6933bJN4Tx7K0kSTtL1w4RV2aEsZ5c2RIwSMR/qcreP72 Gf/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=V5jP+lOo; 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 i4si3698493ejg.48.2021.02.11.04.22.23; Thu, 11 Feb 2021 04:22:48 -0800 (PST) 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=V5jP+lOo; 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 S231815AbhBKMVK (ORCPT + 99 others); Thu, 11 Feb 2021 07:21:10 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:22847 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231840AbhBKMSj (ORCPT ); Thu, 11 Feb 2021 07:18:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613045831; 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=E1yuAMx44/76bqf49DYn2JPHR26BQBuYBzfgeTpXepM=; b=V5jP+lOoaT00lygE2hcM3MuawAesMYW0Kz/1JZZADE8WIfCNojvlssyIXEk4RsrXnSGvuO mQrKSdGfjA7SYwns/O8a9MjYZdfPqEiL6OyGuYCrdSM6l6yc1U7NmqJAlnmtHFqndSsGGS 3X7AZE2kgoHTkEoBkf2WWLrjW0q4Kxc= Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-15-cJbwc0wZMyaPom8bLk6gyQ-1; Thu, 11 Feb 2021 07:17:06 -0500 X-MC-Unique: cJbwc0wZMyaPom8bLk6gyQ-1 Received: by mail-ej1-f71.google.com with SMTP id ia14so4663638ejc.8 for ; Thu, 11 Feb 2021 04:17:06 -0800 (PST) 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=E1yuAMx44/76bqf49DYn2JPHR26BQBuYBzfgeTpXepM=; b=DKn6vdEpn+BJXCocIIlyiTe+sKjjbIUFXIeSIqCfSpJs+DQweB9sAdVMR4WHtA/MVy 46M6LEDV17XNgoYFumWIx92jDrIHQXePtupKwJ2/5w2ZYYUemNHMWT0twq7zCATmnb1a oSB/VR9EQHz8ciaP18ucrcPhTGXy7HDP5WAKPhei40D3WSgxfjBgNo86rRAVoAl9eLr0 hgxAhl1AO0StJFCfHCw7bDyl19baOZJounOy6Z+0fJ8E+L2E7czW5Tm0gC3pbQpn33mh ytDdZoGGSh60af7GODwBo17QcE29pB4WLYut9/jnl0wROoir7ynVdqyFq9SEkEihKPUO fv0w== X-Gm-Message-State: AOAM531UdGpKpS9vWkmKxWen4+/4iSs/DSjSrHiZQ982aehsHXWfXqgb xNcoI66pQp3twP4U8XWJeOencyB3nrYavOmEA57rKkVK6LhA50UQLwEqx4oSeUMKzDkFePg1n/F RYhViAtq39iuRqPR18Ql82O74 X-Received: by 2002:aa7:d6c2:: with SMTP id x2mr8057400edr.225.1613045825259; Thu, 11 Feb 2021 04:17:05 -0800 (PST) X-Received: by 2002:aa7:d6c2:: with SMTP id x2mr8057363edr.225.1613045825000; Thu, 11 Feb 2021 04:17:05 -0800 (PST) Received: from steredhat (host-79-34-249-199.business.telecomitalia.it. [79.34.249.199]) by smtp.gmail.com with ESMTPSA id hr31sm4057322ejc.125.2021.02.11.04.17.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Feb 2021 04:17:04 -0800 (PST) Date: Thu, 11 Feb 2021 13:17:01 +0100 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 , Jeff Vander Stoep , 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 v4 06/17] af_vsock: implement send logic for SEQPACKET Message-ID: <20210211121701.4em23vgsqfdkdp5j@steredhat> References: <20210207151259.803917-1-arseny.krasnov@kaspersky.com> <20210207151600.804998-1-arseny.krasnov@kaspersky.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20210207151600.804998-1-arseny.krasnov@kaspersky.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Feb 07, 2021 at 06:15:57PM +0300, Arseny Krasnov wrote: >This adds some logic to current stream enqueue function for SEQPACKET >support: >1) Send record's begin/end marker. >2) Return value from enqueue function is whole record length or error > for SOCK_SEQPACKET. > >Signed-off-by: Arseny Krasnov >--- > include/net/af_vsock.h | 2 ++ > net/vmw_vsock/af_vsock.c | 22 ++++++++++++++++++++-- > 2 files changed, 22 insertions(+), 2 deletions(-) > >diff --git a/include/net/af_vsock.h b/include/net/af_vsock.h >index 19f6f22821ec..198d58c4c7ee 100644 >--- a/include/net/af_vsock.h >+++ b/include/net/af_vsock.h >@@ -136,6 +136,8 @@ struct vsock_transport { > bool (*stream_allow)(u32 cid, u32 port); > > /* SEQ_PACKET. */ >+ int (*seqpacket_seq_send_len)(struct vsock_sock *, size_t len, int flags); >+ int (*seqpacket_seq_send_eor)(struct vsock_sock *, int flags); As before, we could add the identifier of the parameters. Other than that, the patch LGTM. Stefano > size_t (*seqpacket_seq_get_len)(struct vsock_sock *); > int (*seqpacket_dequeue)(struct vsock_sock *, struct msghdr *, > int flags, bool *msg_ready); >diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c >index ea99261e88ac..a033d3340ac4 100644 >--- a/net/vmw_vsock/af_vsock.c >+++ b/net/vmw_vsock/af_vsock.c >@@ -1806,6 +1806,12 @@ static int vsock_connectible_sendmsg(struct socket *sock, struct msghdr *msg, > if (err < 0) > goto out; > >+ if (sk->sk_type == SOCK_SEQPACKET) { >+ err = transport->seqpacket_seq_send_len(vsk, len, msg->msg_flags); >+ if (err < 0) >+ goto out; >+ } >+ > while (total_written < len) { > ssize_t written; > >@@ -1852,9 +1858,21 @@ static int vsock_connectible_sendmsg(struct socket *sock, struct msghdr *msg, > > } > >+ if (sk->sk_type == SOCK_SEQPACKET) { >+ err = transport->seqpacket_seq_send_eor(vsk, msg->msg_flags); >+ if (err < 0) >+ goto out; >+ } >+ > out_err: >- if (total_written > 0) >- err = total_written; >+ if (total_written > 0) { >+ /* Return number of written bytes only if: >+ * 1) SOCK_STREAM socket. >+ * 2) SOCK_SEQPACKET socket when whole buffer is sent. >+ */ >+ if (sk->sk_type == SOCK_STREAM || total_written == len) >+ err = total_written; >+ } > out: > release_sock(sk); > return err; >-- >2.25.1 >