Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp23369862rwd; Sat, 1 Jul 2023 00:13:04 -0700 (PDT) X-Google-Smtp-Source: APBJJlEHMjyHrb+hGobQjpqw+rVqmiDlNJkDUeJZpC6SW2Q60sc+4XFzLbtuWeL/7k9NGjRirSCJ X-Received: by 2002:a05:6359:c02:b0:134:d4b6:1c47 with SMTP id gn2-20020a0563590c0200b00134d4b61c47mr4961513rwb.22.1688195584272; Sat, 01 Jul 2023 00:13:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688195584; cv=none; d=google.com; s=arc-20160816; b=PtHSFY5cCJk81Bqi086np5eaRemvL/wCrX5VjO/L50F/fvGNGejfQKvS2ifFMYRIey 4fpA+5aWSlvhgoZ+yPqf3eAccTzKTCUgX5m4oESub8F+w9VHay6vsVogRLS1fKX64CIA bFdC7ibrY4Uyv8gTzAwsUA+YmoN5jVh5mbs4/Nk5vjIUykdG6hsY5TX7HlOyS9U+Smrx exuwrmEjElt5zbzj1VSNPC0BJ88GUyyqoK1V5+bAQyysq1SdCcAEBTAzvYPH7qbX2uGq xUNTISt9wm3/Onup8G6HdvskyDo+0bhyKvmycW1Q4y9923Zbov4Nrppg0vBCE56bG8Jn eIXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=UprXoHq7Bqi5L60D4m4n3ECZ9Zuve/BBPpn+ZPhJids=; fh=PzWIi6JmlJNekYqVy23433fKO6OE4+V62ucRx731HUI=; b=FV9Q6OSFuG4h/XpyGk9C9zLnClTbVAk9eRNAPsP2QnFVqlI9VNT7w47tJj3wXPMOwv 0KeBm82OI7eS6QNAczbL2JxATK0HkQBWfVEjqTtvSYKvC2ZQAdBrTcZc+daFyN8OTlMW bLZ4Vh7xt4nzizQ5pqB02Ns7VJlg9CBgFIZlUXxdfGW/RVMqDnkqFs+xrK6XZuT20KRa 6M65j3/bKs7mL1BRiQgkLLQxqu6DDzFjIMImsEmzPo8ddOPNeU1rcaAtYShcs3cifGN+ pU5M3un+G/zzyDOuelUMxGmg2O+6PW8lfzQI2M28z2JfaS1R+v7rxEfTQqlBbKaAyPun Cg6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sberdevices.ru header.s=mail header.b=BJDasY+s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=sberdevices.ru Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x11-20020a170902ec8b00b001b876cc4086si2194295plg.364.2023.07.01.00.12.49; Sat, 01 Jul 2023 00:13:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@sberdevices.ru header.s=mail header.b=BJDasY+s; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=sberdevices.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230450AbjGAGxa (ORCPT + 99 others); Sat, 1 Jul 2023 02:53:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230114AbjGAGwW (ORCPT ); Sat, 1 Jul 2023 02:52:22 -0400 Received: from mx1.sberdevices.ru (mx2.sberdevices.ru [45.89.224.132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1065C468B; Fri, 30 Jun 2023 23:46:03 -0700 (PDT) Received: from p-infra-ksmg-sc-msk02 (localhost [127.0.0.1]) by mx1.sberdevices.ru (Postfix) with ESMTP id 5F38312000E; Sat, 1 Jul 2023 09:45:10 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.sberdevices.ru 5F38312000E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1688193910; bh=UprXoHq7Bqi5L60D4m4n3ECZ9Zuve/BBPpn+ZPhJids=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type:From; b=BJDasY+sAOAdkA4xYMsbg4UKdtVbOlENEY8XRyuLeC6whJxLzBezS9s80teNnEvxA O9wcpIsCuX0pwmZnAsFx/ZdbBDUZPPPG4Hd0MBT3kqF1G7Ur/W3H/GOO5DVzEgnq/8 76aoEVP6N50A/Dr3DzGfczp3zxjSGWCEsTiQQmVGejT8cmDwc3u1OzzkhoDHzMzALN nmewDOXjrk9G+pSJ15MVWz6XcBXYXbZHnDYsQpcMDiH8DTj9ECIIPC2lze0J8z/NGu 9lpP+1FqIZuw36/k6tvrWxOZUzU41AXVRJc2ARXK9KAn5JGvK1c1RiL8YFQ0lsJacE blY4xHaJKYrCA== Received: from p-i-exch-sc-m01.sberdevices.ru (p-i-exch-sc-m01.sberdevices.ru [172.16.192.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.sberdevices.ru (Postfix) with ESMTPS; Sat, 1 Jul 2023 09:45:09 +0300 (MSK) Received: from localhost.localdomain (100.64.160.123) by p-i-exch-sc-m01.sberdevices.ru (172.16.192.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.30; Sat, 1 Jul 2023 09:44:47 +0300 From: Arseniy Krasnov To: Stefan Hajnoczi , Stefano Garzarella , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , "Michael S. Tsirkin" , Jason Wang , Bobby Eshleman CC: , , , , , , , Arseniy Krasnov Subject: [RFC PATCH v5 07/17] vsock: read from socket's error queue Date: Sat, 1 Jul 2023 09:39:37 +0300 Message-ID: <20230701063947.3422088-8-AVKrasnov@sberdevices.ru> X-Mailer: git-send-email 2.35.0 In-Reply-To: <20230701063947.3422088-1-AVKrasnov@sberdevices.ru> References: <20230701063947.3422088-1-AVKrasnov@sberdevices.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [100.64.160.123] X-ClientProxiedBy: p-i-exch-sc-m01.sberdevices.ru (172.16.192.107) To p-i-exch-sc-m01.sberdevices.ru (172.16.192.107) X-KSMG-Rule-ID: 10 X-KSMG-Message-Action: clean X-KSMG-AntiSpam-Lua-Profiles: 178380 [Jun 30 2023] X-KSMG-AntiSpam-Version: 5.9.59.0 X-KSMG-AntiSpam-Envelope-From: AVKrasnov@sberdevices.ru X-KSMG-AntiSpam-Rate: 0 X-KSMG-AntiSpam-Status: not_detected X-KSMG-AntiSpam-Method: none X-KSMG-AntiSpam-Auth: dkim=none X-KSMG-AntiSpam-Info: LuaCore: 517 517 b0056c19d8e10afbb16cb7aad7258dedb0179a79, {Tracking_from_domain_doesnt_match_to}, sberdevices.ru:7.1.1,5.0.1;d41d8cd98f00b204e9800998ecf8427e.com:7.1.1;127.0.0.199:7.1.2;100.64.160.123:7.1.2;p-i-exch-sc-m01.sberdevices.ru:7.1.1,5.0.1, FromAlignment: s, {Tracking_white_helo}, ApMailHostAddress: 100.64.160.123 X-MS-Exchange-Organization-SCL: -1 X-KSMG-AntiSpam-Interceptor-Info: scan successful X-KSMG-AntiPhishing: Clean X-KSMG-LinksScanning: Clean X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 2.0.1.6960, bases: 2023/07/01 04:02:00 #21597763 X-KSMG-AntiVirus-Status: Clean, skipped X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This adds handling of MSG_ERRQUEUE input flag in receive call. This flag is used to read socket's error queue instead of data queue. Possible scenario of error queue usage is receiving completions for transmission with MSG_ZEROCOPY flag. This patch also adds 'SOL_VSOCK' define. Signed-off-by: Arseniy Krasnov --- Changelog: v4 -> v5: * Update commit message by adding sentence that 'SOL_VSOCK' is also added. include/linux/socket.h | 1 + net/vmw_vsock/af_vsock.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/include/linux/socket.h b/include/linux/socket.h index bd1cc3238851..d79efd026880 100644 --- a/include/linux/socket.h +++ b/include/linux/socket.h @@ -382,6 +382,7 @@ struct ucred { #define SOL_MPTCP 284 #define SOL_MCTP 285 #define SOL_SMC 286 +#define SOL_VSOCK 287 /* IPX options */ #define IPX_TYPE 1 diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c index 45fd20c4ed50..07803d9fbf6d 100644 --- a/net/vmw_vsock/af_vsock.c +++ b/net/vmw_vsock/af_vsock.c @@ -110,6 +110,7 @@ #include #include #include +#include static int __vsock_bind(struct sock *sk, struct sockaddr_vm *addr); static void vsock_sk_destruct(struct sock *sk); @@ -2135,6 +2136,10 @@ vsock_connectible_recvmsg(struct socket *sock, struct msghdr *msg, size_t len, int err; sk = sock->sk; + + if (unlikely(flags & MSG_ERRQUEUE)) + return sock_recv_errqueue(sk, msg, len, SOL_VSOCK, 0); + vsk = vsock_sk(sk); err = 0; -- 2.25.1