Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp3348633ybc; Thu, 21 Nov 2019 07:06:12 -0800 (PST) X-Google-Smtp-Source: APXvYqxDTI70ngCjl0GjJAULsoEq9M0dQMos6eB1A+zUXz2SXAfP1KA9+X5nEqUkRSbDweUou9Gl X-Received: by 2002:a17:906:b7c6:: with SMTP id fy6mr14762782ejb.90.1574348772745; Thu, 21 Nov 2019 07:06:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1574348772; cv=pass; d=google.com; s=arc-20160816; b=SazTsVB8AE6vnssCsB/H0XDbkJPoXlP64l38v4VFz2TCNWKkRlHsIe2ML3yX04tX1F 3MIMH41ObyLcnte4ur0KIuS1D3Q7PAJ/MoiUuDkPw2yHJS+nQuewkNrJWhOe3UZs5XNs Av1HHWZNd19q4EnZI9O563XImhB8G0L6FKVtCBZZHJjOyxz85kHb6k9qoTMdUIcX2ZXv 0YvYcgf0cdXkfDaSEGtmoObVy6PQID3G6H4Y0ZsTO7tfRAOU9RcfugysmytbATNpIpnt 7+tNBb8zbPHgHFhmqOfSH2a2yvzVjqIYbEDilPeQG14+5kMv2LIorRuj2KQdfG8b+tpU Netg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from:dkim-signature; bh=QFN7KBSvKZgjX34qFheOw/srsXvLKfykqCjZBIk1N3k=; b=g3rgnthcPWMTgOQjCNq5+fLJ69ZD3r7d5E5ZWhNuSqUJQVlwT3uvVai2m6OuYbDY/J TFcAlA6I8/EKLMmrG4iVfU8pk1XppDWvVD+Hvb96TGe8gdzevLLtTKqo8ymufFiKDSsk icAAbt+j8BkufsA06LAW+fbcaqbvhmIUCJoibytmBBttGx+NUKRMLd32eAETNEchiOL5 mnpLeTlTwEHhNwLDxeZPbwYxGJUkvTJC99zHoxncFG92rKUI2jimh5DWCRlo8qGY3D4W C+pIvaUq+I/1XZpcB9fwnpKixYyewoaqoniEF9ZeVRIiAfb+3ybZ4ecZBH1Cv+f6Spmz +fvw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vmware.com header.s=selector2 header.b=FkTfRYTs; arc=pass (i=1 spf=pass spfdomain=vmware.com dkim=pass dkdomain=vmware.com dmarc=pass fromdomain=vmware.com); spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=vmware.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q14si1819852ejb.125.2019.11.21.07.05.47; Thu, 21 Nov 2019 07:06:12 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@vmware.com header.s=selector2 header.b=FkTfRYTs; arc=pass (i=1 spf=pass spfdomain=vmware.com dkim=pass dkdomain=vmware.com dmarc=pass fromdomain=vmware.com); spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=vmware.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726881AbfKUPEW (ORCPT + 99 others); Thu, 21 Nov 2019 10:04:22 -0500 Received: from mail-eopbgr680079.outbound.protection.outlook.com ([40.107.68.79]:52359 "EHLO NAM04-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726358AbfKUPEW (ORCPT ); Thu, 21 Nov 2019 10:04:22 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aWShRM1k2C1kZHsgV6rCE+jltq2xPeWhoaeDGZA7OWvn08lRUhZm5zImHXUkd7NehlLKmdPMdvl9TqwdXaLok6X8f4KL4G7BVWcMTqPJv/AnJ97BUsFWz16V8T7kOWe4qOor62X6dTzJrarKZpF2JD+VkGmSYV5xioVzq0qwg8r4dSw+8lOGMDCA1GSymoZgtkSBWTT8OV1HMWAmHZDB99wAgHKDRsODLqKklc68R+BM2RIuxXpvtQAzdMRIM+bKl8UtwBl9aa4Vo6LeF3yj2ShDZtzm7CfO/kke3ECbi/Zp9ukQMl9IO0Sv5g5msQUQrALvFLBgPf9WphZcjv5bOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QFN7KBSvKZgjX34qFheOw/srsXvLKfykqCjZBIk1N3k=; b=TtK1X4ODneqSDJMXbUne/QAy0hmNp0haJ5fxZzXmfXs5ONqBKEuWjwtR05KHKEJcaScudj+xEpKJbOg/55EOvkqAx+bUZ5IlC9JOHudzKNmyKnfIdqg5Vv9maj31UNe+ZJW1ROYb1yiXun29Mpl1j8Lgi+PrmIQay9wpEC+z4FjuhmVgKAP+kpZRyFe7aQbIMYAM/+alVu4nj/bwEx5hIsgEFmOj+F2xdIM3xZYIWNn5nf5aHW+C1mMegWqOTlocBko+G+scp6vA2RjISIereLRhcqCosqloAxbf9bY/5bp7HJjZ9aLDBrZEEUnqEzHLZgwv04FDBKJBXzYEdNbamQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vmware.com; dmarc=pass action=none header.from=vmware.com; dkim=pass header.d=vmware.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vmware.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QFN7KBSvKZgjX34qFheOw/srsXvLKfykqCjZBIk1N3k=; b=FkTfRYTsT1spo8mXrsjCZvh//hbeIzFO/KRkpTvwcSauexwHw0kUhi9kIndSADFTBo8WoZBWdhFqSO7tV71J213oNINmt3WFG9vrHaodayY5aNy8XnnHcwPxpJtG+Y+AsOsRmB1ZKB9XHYdej55DYVzsDfMlJ7ezNHXzEvOZ4Z0= Received: from MWHPR05MB3376.namprd05.prod.outlook.com (10.174.175.149) by MWHPR05MB3662.namprd05.prod.outlook.com (10.174.175.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2474.9; Thu, 21 Nov 2019 15:04:18 +0000 Received: from MWHPR05MB3376.namprd05.prod.outlook.com ([fe80::4098:2c39:d8d3:a209]) by MWHPR05MB3376.namprd05.prod.outlook.com ([fe80::4098:2c39:d8d3:a209%7]) with mapi id 15.20.2474.015; Thu, 21 Nov 2019 15:04:18 +0000 From: Jorgen Hansen To: 'Stefano Garzarella' , "netdev@vger.kernel.org" CC: "virtualization@lists.linux-foundation.org" , Dexuan Cui , Stefan Hajnoczi , "linux-kernel@vger.kernel.org" , "kvm@vger.kernel.org" , "David S. Miller" Subject: RE: [PATCH net-next 3/6] vsock: add local transport support in the vsock core Thread-Topic: [PATCH net-next 3/6] vsock: add local transport support in the vsock core Thread-Index: AQHVnsi6A5C79S6UD0KKiVDL3k1B8qeVuhZQ Date: Thu, 21 Nov 2019 15:04:18 +0000 Message-ID: References: <20191119110121.14480-1-sgarzare@redhat.com> <20191119110121.14480-4-sgarzare@redhat.com> In-Reply-To: <20191119110121.14480-4-sgarzare@redhat.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=jhansen@vmware.com; x-originating-ip: [208.91.2.1] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: c4250684-73e1-4d29-5642-08d76e941512 x-ms-traffictypediagnostic: MWHPR05MB3662: x-microsoft-antispam-prvs: x-vmwhitelist: True x-ms-oob-tlc-oobclassifiers: OLM:7691; x-forefront-prvs: 0228DDDDD7 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(396003)(136003)(346002)(366004)(376002)(39860400002)(199004)(189003)(66066001)(6506007)(71200400001)(71190400001)(8676002)(54906003)(9686003)(6436002)(110136005)(52536014)(229853002)(55016002)(76116006)(53546011)(66556008)(25786009)(66476007)(66946007)(66446008)(33656002)(102836004)(64756008)(316002)(446003)(11346002)(6116002)(4326008)(86362001)(74316002)(305945005)(7736002)(3846002)(14454004)(186003)(99286004)(76176011)(14444005)(256004)(7696005)(6246003)(8936002)(26005)(81166006)(2501003)(81156014)(5660300002)(2906002)(478600001);DIR:OUT;SFP:1101;SCL:1;SRVR:MWHPR05MB3662;H:MWHPR05MB3376.namprd05.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: vmware.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: vRIdROe8BxytFZJZ2Uqmr4AyAeAO+S7WkQOkQwIUniUgH2qmfOmc1n3Ed9gqjCo1SkLfkCH8FHrH4C8y3VR4tO+BE+ewV4wJQs9+b310wwwkPlixL9BxOBFikO8IQ9Gw/cEMXYEPQMMXOdc567u5btV2YKidXO2J6f8Is33XcClKkQ3cgKP4qqblbbWhVhLfv8oYSVr81hEMJ+wds4h1W0gGRyocicIUNk0vV6vNTM1S9tuZqRfThzWtaN9M9xbPUFR7MK2XZjfMh6214wcVjaJD9zkf7wbqFvPO1dznMChR9uiuYyIHbqB9Fxp5Z3N+B/Rye4vW5A7mU77+KlhTSlm65KJ287blEx++WGkx10XvVGa3jwpxQ15/UzUkoBzdw2COYDw+KNljV2Z1IW52eph1YV4TzqxglGHaojgu2wvZ448rXzsYC4hqmpH89UBm x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: vmware.com X-MS-Exchange-CrossTenant-Network-Message-Id: c4250684-73e1-4d29-5642-08d76e941512 X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Nov 2019 15:04:18.3083 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b39138ca-3cee-4b4a-a4d6-cd83d9dd62f0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: L8OsOczFrILrMSM8N6dYe4CDU6czqh35qVycCJj3DFfYHVHIcyuQHVjXKq7kRFVY24RBoSOzbrkzaNE2CpnBBA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR05MB3662 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > From: Stefano Garzarella [mailto:sgarzare@redhat.com] > Sent: Tuesday, November 19, 2019 12:01 PM > To: netdev@vger.kernel.org > > This patch allows to register a transport able to handle > local communication (loopback). >=20 > Signed-off-by: Stefano Garzarella > --- > include/net/af_vsock.h | 2 ++ > net/vmw_vsock/af_vsock.c | 17 ++++++++++++++++- > 2 files changed, 18 insertions(+), 1 deletion(-) >=20 > diff --git a/include/net/af_vsock.h b/include/net/af_vsock.h > index 4206dc6d813f..b1c717286993 100644 > --- a/include/net/af_vsock.h > +++ b/include/net/af_vsock.h > @@ -98,6 +98,8 @@ struct vsock_transport_send_notify_data { > #define VSOCK_TRANSPORT_F_G2H 0x00000002 > /* Transport provides DGRAM communication */ > #define VSOCK_TRANSPORT_F_DGRAM 0x00000004 > +/* Transport provides local (loopback) communication */ > +#define VSOCK_TRANSPORT_F_LOCAL 0x00000008 >=20 > struct vsock_transport { > struct module *module; > diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c > index cc8659838bf2..c9e5bad59dc1 100644 > --- a/net/vmw_vsock/af_vsock.c > +++ b/net/vmw_vsock/af_vsock.c > @@ -136,6 +136,8 @@ static const struct vsock_transport *transport_h2g; > static const struct vsock_transport *transport_g2h; > /* Transport used for DGRAM communication */ > static const struct vsock_transport *transport_dgram; > +/* Transport used for local communication */ > +static const struct vsock_transport *transport_local; > static DEFINE_MUTEX(vsock_register_mutex); >=20 > /**** UTILS ****/ > @@ -2130,7 +2132,7 @@ EXPORT_SYMBOL_GPL(vsock_core_get_transport); >=20 > int vsock_core_register(const struct vsock_transport *t, int features) > { > - const struct vsock_transport *t_h2g, *t_g2h, *t_dgram; > + const struct vsock_transport *t_h2g, *t_g2h, *t_dgram, *t_local; > int err =3D mutex_lock_interruptible(&vsock_register_mutex); >=20 > if (err) > @@ -2139,6 +2141,7 @@ int vsock_core_register(const struct > vsock_transport *t, int features) > t_h2g =3D transport_h2g; > t_g2h =3D transport_g2h; > t_dgram =3D transport_dgram; > + t_local =3D transport_local; >=20 > if (features & VSOCK_TRANSPORT_F_H2G) { > if (t_h2g) { > @@ -2164,9 +2167,18 @@ int vsock_core_register(const struct > vsock_transport *t, int features) > t_dgram =3D t; > } >=20 > + if (features & VSOCK_TRANSPORT_F_LOCAL) { > + if (t_local) { > + err =3D -EBUSY; > + goto err_busy; > + } > + t_local =3D t; > + } > + > transport_h2g =3D t_h2g; > transport_g2h =3D t_g2h; > transport_dgram =3D t_dgram; > + transport_local =3D t_local; >=20 > err_busy: > mutex_unlock(&vsock_register_mutex); > @@ -2187,6 +2199,9 @@ void vsock_core_unregister(const struct > vsock_transport *t) > if (transport_dgram =3D=3D t) > transport_dgram =3D NULL; >=20 > + if (transport_local =3D=3D t) > + transport_local =3D NULL; > + > mutex_unlock(&vsock_register_mutex); > } > EXPORT_SYMBOL_GPL(vsock_core_unregister); > -- > 2.21.0 Having loopback support as a separate transport fits nicely, but do we need= to support different variants of loopback? It could just be built in. Thanks, Jorgen