Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2586036rwd; Mon, 22 May 2023 00:47:18 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5FzImM/hdyZZZjtvadVtrY31zHynXW8JKTWy8pCyXL4VnZs3tw5DXqiORTZYpptVM3BeB0 X-Received: by 2002:a05:6a20:7d9d:b0:10b:a322:8a7d with SMTP id v29-20020a056a207d9d00b0010ba3228a7dmr2438672pzj.29.1684741637862; Mon, 22 May 2023 00:47:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684741637; cv=none; d=google.com; s=arc-20160816; b=oTyeFALTl+4RjZUqsWWTzst0FQh6NmoM08k6DEAEpX2u5zheV3n1MMSwipSz2riKHI VHACp0wTihBzoBCKaxcD4yzMfj2gXIlHvBY6d932peD2m0JwNJ3DIM1xb18xCO8Sc1Mf qL3vRK+AX3VCFw1Bpzx/DBmo/MGahcxGWsRB3KZy9zOY13xzrIr3/7gAyC2Q63DR/ffu h4C8yTpJp04zGRsNVIxZoDl+rYDHxrKHThFj4aOPFc4nYI+gWxzM18pw3+nUlsG208HS UViTZDPyiXmEt5/e3ashwvZ8u935RdkSzJqaJIiDNQ30aBIhO+Qw9X1l78xWlwBTYHij rwKQ== 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; bh=+uyo/tx+wUTbFI9wbe7G8kTAM4/qdkqxCEh0AnIeTXw=; b=AylpynsBb8CvXk3msIB3WStoQuu2Z0pR21q4gKSoUB/qAwE5GJqiQ/bchpxlT24MiQ 5zjgkzKLLWSloJUsJFCFVyvB6bHTqe2ooHyDM9Jor3RyRCVG+Myxw172OEpP6d3eEWOK qv/o6X3mFNngRysx8hGJDot6xZo50e+9odOkP/2PVaK+lRG5AWdLCHPUh/uPUXGtn82j eCwzIgoy01VBagJfH2swnVFRzLRcHT/u4FN/tdST7q/IAk1BlWmD3DOFWtbr/Pg6PGRt Je+A5li/1pXc3U8apO7mxpvCqHHAo0RhNvoQEqSSU97v73Vk+02luNBThsy3Sg/mZT2Q sccg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sberdevices.ru header.s=mail header.b=QgVloIkL; 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 a9-20020aa79709000000b0064d2d8d7c33si1106239pfg.45.2023.05.22.00.47.05; Mon, 22 May 2023 00:47:17 -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=QgVloIkL; 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 S232377AbjEVHp2 (ORCPT + 99 others); Mon, 22 May 2023 03:45:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232664AbjEVHow (ORCPT ); Mon, 22 May 2023 03:44:52 -0400 Received: from mx.sberdevices.ru (mx.sberdevices.ru [45.89.227.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83DBCB6; Mon, 22 May 2023 00:44:51 -0700 (PDT) Received: from s-lin-edge02.sberdevices.ru (localhost [127.0.0.1]) by mx.sberdevices.ru (Postfix) with ESMTP id 24FCA5FD51; Mon, 22 May 2023 10:44:49 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1684741489; bh=+uyo/tx+wUTbFI9wbe7G8kTAM4/qdkqxCEh0AnIeTXw=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; b=QgVloIkLQYll8zKQoMJX+/dFkGgi5SkshMxYBWLRUGv76vdSgbFhHIBYdNAnFGlr7 k+DdlwadFB0r59rM9tlvAidMNhILJfRuMqdQ0X3Y+nrQZ2FUYSynn4Y0xkcMqi/iz+ RmgyRr9aP3+1+Ur0i87D0zeUm8xRc61cFz+BGk2t7etBks959X2pDUqvDk3aV0EjGN 8UUapFiIZnbx6EdvyrHPqT7OHX0fMTdXxlXIS1oNuAOL9ZbyU3Rcb5lERUIfiTyJbL ED6GaEdNCzPkEV+MiFrBzUOvQWSX9fwQ7mRHAjT/JteTxMJKuIz0fusf02aCFnPsFt me0Qmd1F5Zi2A== Received: from S-MS-EXCH01.sberdevices.ru (S-MS-EXCH01.sberdevices.ru [172.16.1.4]) by mx.sberdevices.ru (Postfix) with ESMTP; Mon, 22 May 2023 10:44:49 +0300 (MSK) 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 v3 07/17] vsock: read from socket's error queue Date: Mon, 22 May 2023 10:39:40 +0300 Message-ID: <20230522073950.3574171-8-AVKrasnov@sberdevices.ru> X-Mailer: git-send-email 2.35.0 In-Reply-To: <20230522073950.3574171-1-AVKrasnov@sberdevices.ru> References: <20230522073950.3574171-1-AVKrasnov@sberdevices.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.16.1.6] X-ClientProxiedBy: S-MS-EXCH02.sberdevices.ru (172.16.1.5) To S-MS-EXCH01.sberdevices.ru (172.16.1.4) X-KSMG-Rule-ID: 4 X-KSMG-Message-Action: clean X-KSMG-AntiSpam-Status: not scanned, disabled by settings X-KSMG-AntiSpam-Interceptor-Info: not scanned X-KSMG-AntiPhishing: not scanned, disabled by settings X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 1.1.2.30, bases: 2023/05/22 04:49:00 #21364689 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 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. Signed-off-by: Arseniy Krasnov --- 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 13c3a237b9c9..19a6f39fa014 100644 --- a/include/linux/socket.h +++ b/include/linux/socket.h @@ -379,6 +379,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 eea2bcc685a2..b2da791d920b 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