From patchwork Wed Jul 19 00:50:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bobby Eshleman X-Patchwork-Id: 122343 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp2119225vqt; Tue, 18 Jul 2023 18:11:01 -0700 (PDT) X-Google-Smtp-Source: APBJJlG6OIIKY7lGPwfE71PxwGkiou2Mfzu86sgMN5tUElae/ugJE2JpJB+7vcd66Q8OnmOe8Nj+ X-Received: by 2002:a17:907:d13:b0:988:fb2f:274e with SMTP id gn19-20020a1709070d1300b00988fb2f274emr925338ejc.27.1689729061145; Tue, 18 Jul 2023 18:11:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689729061; cv=none; d=google.com; s=arc-20160816; b=NcOHOm9/0JAiDKLWvT+zkZOlVBFjgG05m/ZNNLRvTFCt5CYc4auTVdy4ChkLffh/bb tpZ/hKgaBNCKW9qr9/fGe4rKfl0sH1i9aY3iB4pqWNbeAPswSSEfdpEog7JFngvzDiGJ KmrKpw/kMyfaUi78B7oJuXm7cRveiEMLwTKN2nokVJYbzmhhqXseMYsgOgpx7ZQsF+Xz rMhsYEzxDRk64Od9KXZAY2YeduhNuBxtD8A+sqcNfvVxu2jZzaLOy2R3i5SH4d8dYPVt dnH20z+8xBj0zx1OPA7alPMjNYCl4pyffkT4rTmJaIHfC+H/UpUMonpWGm0DkVnmpqbg 2CtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=xWt1YKpD8soekZyHz3lCaTewqjrH2L6FY0Axo6M4fj8=; fh=jejeGpHkr9vVlEyvdVBCSLFut92eNP6vAI+O1tx9vp4=; b=SJy1+qkFQ7QswI63mOfD800hxa5IDRQEkE4/2tOzyMfVvg1Rjuo9BCCZHZoxXcP2gj huuaERq88fNdD/dDevEqooDb1qMD0mmAov/uJfGo1ZNT1siN6c3wQiPkAKlxOPtwTtxD /Bau0tEVKjDnqEafbNqFUSn0UgreGc001nQqfwaUn5btQVhSI1ghRjNFPasWsmT2MDAq uPRAf9fSn0KZObO57kNk0xnKoYGXqrq99pdFhpKVItbV/4z0Sce1nKleHnXn1ihoplfv meX6ru8Czty0rU3pXMf6WRv8ZX1jFx7M8lnfc7pYsm6B1gY8MuR9byTwWazloA9oAp0C ezQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=W6pVQ6BR; 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=bytedance.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gq15-20020a170906e24f00b0098886d50308si1999786ejb.490.2023.07.18.18.10.37; Tue, 18 Jul 2023 18:11:01 -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=@bytedance.com header.s=google header.b=W6pVQ6BR; 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=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230294AbjGSAv3 (ORCPT + 99 others); Tue, 18 Jul 2023 20:51:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230200AbjGSAvE (ORCPT ); Tue, 18 Jul 2023 20:51:04 -0400 Received: from mail-qk1-x730.google.com (mail-qk1-x730.google.com [IPv6:2607:f8b0:4864:20::730]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED88718D for ; Tue, 18 Jul 2023 17:50:20 -0700 (PDT) Received: by mail-qk1-x730.google.com with SMTP id af79cd13be357-76731802203so582286485a.3 for ; Tue, 18 Jul 2023 17:50:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1689727819; x=1692319819; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=xWt1YKpD8soekZyHz3lCaTewqjrH2L6FY0Axo6M4fj8=; b=W6pVQ6BRHiDGSffnATfPbkdw7LAkbCWNOgEeVD9GxenwUIT3vGKQ1XNpdCGV2dE5U0 lJeJ+JLDX+zXBHDl/VjOXmwS8BMhZ5XSG25WsyCdQ1L7J1PUQeS7wchneIdZXrXnew5c KKW0gqXZEEH92kEOE7IFf+JTQHYcqqcD5rraPp2jJH3XKCssNhQOiNEh9IpZfQ4eBiwF aDJXTPexVb1OPGgbnTlIM42X66c35BOEx7O4i0WJKVhEhHUmfAKxktnatfdWGkr0RmVV O4BHQmBBgupnNG76/x2nogVrYfJ8M7gCIWAYec8ZDmCl1QIBGbUBLQtvMORRGTgded45 YoTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689727819; x=1692319819; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xWt1YKpD8soekZyHz3lCaTewqjrH2L6FY0Axo6M4fj8=; b=R8I84tkwpfczKlGhKTiTCV2JLh/4/l7U0Pzb2cCrTV0KX7BmVTUBQxj/1p2v22p3qs 3pgFGnHYODtwYu23brhPLEPHkFvQFal4vG5fDdMQOQSZs3KMmC4jIPIzlnX19JyVFi5c Y1alI7kRk3erP8NfobNPeMyDIP2ANZnOSm+bXhBGh9C0KG1wZGZmKLTf6ivF2aMfHmkX 0gofo9SIkoXk+AmLogrbM0fbQela3w5tgypWsANb6djFzScCiOYrcVXLpiUz5hcLmmdF WStQAVBiRrPdoZMKPiZCOBQpP0j1R5FE8YoxkcVUIGz67rZJnW+zuHcXmZsqcVT9pW9q Gdaw== X-Gm-Message-State: ABy/qLZvd1BQuk+moknq4VBS1LB/Ggqeo+a91Q+ct9/60CQn/r8eYZx+ B3ExNE4wfJSfz5Bp3u/TflR+sw== X-Received: by 2002:a05:620a:2401:b0:767:f2c2:7e64 with SMTP id d1-20020a05620a240100b00767f2c27e64mr19481527qkn.63.1689727819403; Tue, 18 Jul 2023 17:50:19 -0700 (PDT) Received: from [172.17.0.7] ([130.44.212.112]) by smtp.gmail.com with ESMTPSA id c5-20020a05620a11a500b0076738337cd1sm968696qkk.1.2023.07.18.17.50.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Jul 2023 17:50:19 -0700 (PDT) From: Bobby Eshleman Date: Wed, 19 Jul 2023 00:50:16 +0000 Subject: [PATCH RFC net-next v5 12/14] vsock/loopback: implement datagram support MIME-Version: 1.0 Message-Id: <20230413-b4-vsock-dgram-v5-12-581bd37fdb26@bytedance.com> References: <20230413-b4-vsock-dgram-v5-0-581bd37fdb26@bytedance.com> In-Reply-To: <20230413-b4-vsock-dgram-v5-0-581bd37fdb26@bytedance.com> To: Stefan Hajnoczi , Stefano Garzarella , "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , Bryan Tan , Vishnu Dasa , VMware PV-Drivers Reviewers Cc: Dan Carpenter , Simon Horman , Krasnov Arseniy , kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, bpf@vger.kernel.org, Bobby Eshleman X-Mailer: b4 0.12.2 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771809339879683325 X-GMAIL-MSGID: 1771809339879683325 This commit implements datagram support for vsock loopback. Not much more than simply toggling on "dgram_allow" and continuing to use the common virtio functions. Signed-off-by: Bobby Eshleman --- net/vmw_vsock/vsock_loopback.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/net/vmw_vsock/vsock_loopback.c b/net/vmw_vsock/vsock_loopback.c index 278235ea06c4..0459b2bf7b15 100644 --- a/net/vmw_vsock/vsock_loopback.c +++ b/net/vmw_vsock/vsock_loopback.c @@ -46,6 +46,7 @@ static int vsock_loopback_cancel_pkt(struct vsock_sock *vsk) return 0; } +static bool vsock_loopback_dgram_allow(u32 cid, u32 port); static bool vsock_loopback_seqpacket_allow(u32 remote_cid); static struct virtio_transport loopback_transport = { @@ -62,7 +63,7 @@ static struct virtio_transport loopback_transport = { .cancel_pkt = vsock_loopback_cancel_pkt, .dgram_enqueue = virtio_transport_dgram_enqueue, - .dgram_allow = virtio_transport_dgram_allow, + .dgram_allow = vsock_loopback_dgram_allow, .stream_dequeue = virtio_transport_stream_dequeue, .stream_enqueue = virtio_transport_stream_enqueue, @@ -95,6 +96,11 @@ static struct virtio_transport loopback_transport = { .send_pkt = vsock_loopback_send_pkt, }; +static bool vsock_loopback_dgram_allow(u32 cid, u32 port) +{ + return true; +} + static bool vsock_loopback_seqpacket_allow(u32 remote_cid) { return true;