From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id BBA6FA0C43; Fri, 1 Oct 2021 01:17:33 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3A6264067A; Fri, 1 Oct 2021 01:17:33 +0200 (CEST) Received: from na01-obe.outbound.protection.outlook.com (mail-oln040093003003.outbound.protection.outlook.com [40.93.3.3]) by mails.dpdk.org (Postfix) with ESMTP id 5002340040 for ; Fri, 1 Oct 2021 01:17:32 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nWwM0a/Tyw7hFDGvdcRKecELGjs5G0RF7Eq6dmcAPqf8BN1zK5rawdZmCl/+WXi+MqiVnOKlroHA0o1TbXuEF0wKKymw8KDGG7cgPCvP04j4/NS5IvrJkKUsv8DfHSQIvOw2LEJU3TYwJiexiwB/7z7Jpeta1YAAxC7AYisDXy1icceHeGW2cDjAubyEQf8/cykfcQtfO5fahwxHg/tvnN53AoXzb0rx8p9waEareIFsOyUy8+xqiDv8xROfXod2dQnuo1PxGnh9UUady708R2OuEwlh3nzdfeyjnQ71klNtub+XWy5fbZUl9PJyZ+l1XsczcDddO+OtYa1gpqRPrA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=oyr92VDtPylsHylj1Jhc3gDkPbVG0C896Stmw7A6PZU=; b=E2NucVS17C4LZe3KtIOx8Ap5LqNI4JaodFzq4nrj1BcTDX2kyDWQ8IaMnJNvwNIz1vL1Zh0ZZ/NeFKPH2vNcpwl8rMwbXJkYdu6CsuttcljH5qEW3X1E87k5SqQLkVfgdCjlklpHgrUnYFNa7yqeGURmfcypLCTKcc6pQbENWdy5q3pOYwyTnmM3DSjTFNl9V85GnFJWO2S2uwcWsu9dtY40i/2nRoJzjLFe8VUSjDwrPHyliEcC7Y+bvxdYqd93vwX55p6xC3b4kATW3brcQJXFaow5hrGajbk5cveUsoJ3W0BHBYb5joqIUtQ8MSVRKqOJdHWVC7GcL/K9xZyfRA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microsoft.com; dmarc=pass action=none header.from=microsoft.com; dkim=pass header.d=microsoft.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=oyr92VDtPylsHylj1Jhc3gDkPbVG0C896Stmw7A6PZU=; b=QfvsFlAl/qCMO0illuaGWxjh1FT6P2rJMQGTFlqqWwO1fIa6PHwU5+ILY5EjAPOrjJK5A1fzAz464074ksPt+a2UbVD3KyKkJn34xltJSFQjo0WrHnCvIXhn66LjpsS+K2zOAlUs0dawI9kGyuErK8s8dM40fys6Qz9yXPxGjao= Received: from BY5PR21MB1506.namprd21.prod.outlook.com (2603:10b6:a03:23d::12) by BY5PR21MB1473.namprd21.prod.outlook.com (2603:10b6:a03:239::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.0; Thu, 30 Sep 2021 23:17:29 +0000 Received: from BY5PR21MB1506.namprd21.prod.outlook.com ([fe80::c5e9:9018:e64f:c330]) by BY5PR21MB1506.namprd21.prod.outlook.com ([fe80::c5e9:9018:e64f:c330%7]) with mapi id 15.20.4587.011; Thu, 30 Sep 2021 23:17:29 +0000 From: Long Li To: Srikanth Kaka , Stephen Hemminger CC: "dev@dpdk.org" , Vag Singh , Anand Thulasiram Thread-Topic: [PATCH 05/11] bus/vmbus: open subchannels Thread-Index: AQHXs6WfAgkGCxX2NkW6/X2U280n+6u9Ouvw Date: Thu, 30 Sep 2021 23:17:29 +0000 Message-ID: References: <20210927134231.11177-1-srikanth.k@oneconvergence.com> <20210927134231.11177-6-srikanth.k@oneconvergence.com> In-Reply-To: <20210927134231.11177-6-srikanth.k@oneconvergence.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ActionId=aef150a6-d169-4e23-90a8-18c06f2a604e; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ContentBits=0; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Enabled=true; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Method=Standard; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Name=Internal; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2021-09-30T23:15:49Z; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47; authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=microsoft.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: e94e4ef6-f320-4d7c-f71d-08d98468796c x-ms-traffictypediagnostic: BY5PR21MB1473: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2399; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 5/jVN0ey0sYiV0VT0GSo9h3PYtlU1oWAwWVe4w2hq6NehZtjivFl12y9GrKWfwR66CAZq/IrnQDRTjgVk/01YF3yf2oGBWyHCRWQVkZatELFMbqv6Yb66cKvwOl0zyw0OsKJ+XYBwggx1Ti4RJ/rIb6hvAvI57ZZd2g8uYnzZ2s3eZwy1A5qFOoDngqAJak13cdukUUBM1nIdgmyjqi8EcoEhS2djRSU5k4RO0jEHnPYNXqEf1XDMXxaqaCTEDA8DD+/I++g6MxjYnkYyJpRbyEwdsc1WIJ5xVLjLjBHsS98hUbgLtXy5CO1WwfNK+BbE2lHjHmAz+GeWsv1RzDjka5+omsLCgsV98n09rf5jtT5S4ptfeEXifavrAIbx7mRdSIkr4k1lbp3Q57fFCDv1LIvcORsYSdCNskJFLmNus2rY7igYyUwwNRjWkOELIv7S8KmQoxPntR59PAQFyn4qcoh+A5R6rYJWHlMAgH2Jl7QwSeKC194wRC9Qjm0TwzfouGZJxUn/OcnFiuiWKz4HFjLenjK77n0OxxSaPft0TknfG1sPK3Ss4JFVz8kIyET1Ez2ILd7SyoaZCkkl3Ft6QB0KII/kUgwrduvtZPrD6xVCA+T6nPOPBf29swuxGqJp105wuzjskGNNGxWTQHTwSMDJKPWhpTEGsDak4IrozHIlWUhYdTNVFRvIY71Qjq9C0dVbnhIkQvxmEQMkN5gbjO97Ybq33GsJ8V+WLgv98Jq5Vuk0tMTdXuv7XczhM6q x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BY5PR21MB1506.namprd21.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(10290500003)(33656002)(186003)(55016002)(2906002)(6636002)(508600001)(5660300002)(54906003)(38070700005)(8990500004)(66446008)(83380400001)(8676002)(110136005)(86362001)(122000001)(64756008)(8936002)(52536014)(82960400001)(66556008)(966005)(82950400001)(9686003)(66476007)(4326008)(7696005)(316002)(6506007)(71200400001)(38100700002)(66946007)(26005)(76116006)(10090945008); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?Gnrkmc2Asux5uYlqFhK61KGZ0Ks+L5TmZN2nahi1z5KFS33aXTDWqRHmjj2V?= =?us-ascii?Q?hNysjyT5CvBUZT+vYVtMCPw4yIgjQAzmUej8HT57QKTwMmg9ti6wgw2Pit8t?= =?us-ascii?Q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j9eoatML5DsNlGV?= =?us-ascii?Q?2ckIZuAiSe/R/VOYjNKa1ly/qTdBFvf8tHTQ2hq+ypL2GkxPLDKBOa3d9Ic/?= =?us-ascii?Q?woqXmMXSwTJovp8xjfCQ0FtuFMRtBKdjXCVepAGRJvv6PV+QR1kw9R8ckUB2?= =?us-ascii?Q?gQhVi+Se6ezuRf4fXdd+chXbiDx3S2oRXNbG4AtaP/OwEe/lE5XS6O6j1m46?= =?us-ascii?Q?tJQVldb6j9o8Hn7MF67g824r4281ePW/Nd1N27Sbt0lqRLBdjHKgq7JYD16j?= =?us-ascii?Q?F2oCyPIQ8DgeLwChWADi6refODWLmm4RZV9hsr8qKYCAOnNq1Ux2tw0Mg1wM?= =?us-ascii?Q?BoZ8n9UdIHalLl7Sd5oqL1Nz?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BY5PR21MB1506.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: e94e4ef6-f320-4d7c-f71d-08d98468796c X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Sep 2021 23:17:29.6811 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: Eb2qGAnUvBT4hv0IvJ3A2Yi1zfBqEbg9v8CSOVBoTDeccdnxj49KyQRKidCQcYG/Zyt3cRxpiRo2p29MvRTBzw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR21MB1473 Subject: Re: [dpdk-dev] [PATCH 05/11] bus/vmbus: open subchannels X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" > Subject: [PATCH 05/11] bus/vmbus: open subchannels >=20 > [You don't often get email from srikanth.k@oneconvergence.com. Learn > why this is important at http://aka.ms/LearnAboutSenderIdentification.] >=20 > In FreeBSD, unlike Linux there is no sub-channel open callback that could= be > called by HV_UIO driver, upon their grant by the hypervisor. > Thus, the PMD makes an IOCTL to the HV_UIO to open the granted sub- > channels >=20 > Signed-off-by: Srikanth Kaka > Signed-off-by: Vag Singh > Signed-off-by: Anand Thulasiram > --- > drivers/bus/vmbus/freebsd/vmbus_uio.c | 31 > +++++++++++++++++++++++++++ > drivers/bus/vmbus/linux/vmbus_uio.c | 8 +++++++ > drivers/bus/vmbus/private.h | 1 + > drivers/bus/vmbus/rte_bus_vmbus.h | 10 +++++++++ > drivers/bus/vmbus/version.map | 1 + > drivers/bus/vmbus/vmbus_channel.c | 5 +++++ > 6 files changed, 56 insertions(+) >=20 > diff --git a/drivers/bus/vmbus/freebsd/vmbus_uio.c > b/drivers/bus/vmbus/freebsd/vmbus_uio.c > index fdd37dac3a..022ac85302 100644 > --- a/drivers/bus/vmbus/freebsd/vmbus_uio.c > +++ b/drivers/bus/vmbus/freebsd/vmbus_uio.c > @@ -12,6 +12,7 @@ > #include > #include > #include > +#include >=20 > #include > #include > @@ -26,6 +27,9 @@ > /** Pathname of VMBUS devices directory. */ #define > SYSFS_VMBUS_DEVICES "/sys/bus/vmbus/devices" >=20 > +/* ioctl */ > +#define HVIOOPENSUBCHAN _IOW('h', 14, uint32_t) > + > const char *driver_name =3D "hv_uio"; > static void *vmbus_map_addr; >=20 > @@ -515,3 +519,30 @@ int vmbus_uio_get_subchan(struct vmbus_channel > *primary, > closedir(chan_dir); > return err; > } > + > +int vmbus_uio_subchan_open(struct rte_vmbus_device *dev, uint32_t > +subchan) { > + struct mapped_vmbus_resource *uio_res; > + int fd, err =3D 0; > + > + uio_res =3D vmbus_uio_find_resource(dev); > + if (!uio_res) { > + VMBUS_LOG(ERR, "cannot find uio resource"); > + return -EINVAL; > + } > + > + fd =3D open(uio_res->path, O_RDWR); > + if (fd < 0) { > + VMBUS_LOG(ERR, "Cannot open %s: %s", > + uio_res->path, strerror(errno)); > + return -1; > + } > + > + if (ioctl(fd, HVIOOPENSUBCHAN, &subchan)) { > + VMBUS_LOG(ERR, "open subchan ioctl failed %s: %s", > + uio_res->path, strerror(errno)); > + err =3D -1; > + } > + close(fd); > + return err; > +} > diff --git a/drivers/bus/vmbus/linux/vmbus_uio.c > b/drivers/bus/vmbus/linux/vmbus_uio.c > index b52ca5bf1d..9e91ed9907 100644 > --- a/drivers/bus/vmbus/linux/vmbus_uio.c > +++ b/drivers/bus/vmbus/linux/vmbus_uio.c > @@ -451,3 +451,11 @@ int vmbus_uio_get_subchan(struct vmbus_channel > *primary, > closedir(chan_dir); > return err; > } > + > +int vmbus_uio_subchan_open(struct rte_vmbus_device *dev, > + uint32_t subchan) { > + RTE_SET_USED(dev); > + RTE_SET_USED(subchan); > + return 0; > +} If this function ever gets called in Linux and it doesn't do anything, shou= ld it return a failure? > diff --git a/drivers/bus/vmbus/private.h b/drivers/bus/vmbus/private.h > index 528d60a42f..968f0b6f23 100644 > --- a/drivers/bus/vmbus/private.h > +++ b/drivers/bus/vmbus/private.h > @@ -107,6 +107,7 @@ int vmbus_uio_get_subchan(struct vmbus_channel > *primary, int vmbus_uio_map_rings(struct vmbus_channel *chan); int > vmbus_uio_map_secondary_subchan(const struct rte_vmbus_device *dev, > const struct vmbus_channel *chan); > +int vmbus_uio_subchan_open(struct rte_vmbus_device *device, uint32_t > +subchan); >=20 > void vmbus_br_setup(struct vmbus_br *br, void *buf, unsigned int blen); >=20 > diff --git a/drivers/bus/vmbus/rte_bus_vmbus.h > b/drivers/bus/vmbus/rte_bus_vmbus.h > index 4cf73ce815..42d13c5705 100644 > --- a/drivers/bus/vmbus/rte_bus_vmbus.h > +++ b/drivers/bus/vmbus/rte_bus_vmbus.h > @@ -405,6 +405,16 @@ void rte_vmbus_chan_dump(FILE *f, const struct > vmbus_channel *chan); > */ > void rte_vmbus_unregister(struct rte_vmbus_driver *driver); >=20 > +/** > + * Perform IOCTL to VMBUS device > + * > + * @param device > + * A pointer to a rte_vmbus_device structure > + * @param subchan > + * Count of subchannels to open > + */ > +int rte_vmbus_ioctl(struct rte_vmbus_device *device, uint32_t subchan); > + > /** Helper for VMBUS device registration from driver instance */ > #define RTE_PMD_REGISTER_VMBUS(nm, vmbus_drv) \ > RTE_INIT(vmbusinitfn_ ##nm) \ > diff --git a/drivers/bus/vmbus/version.map > b/drivers/bus/vmbus/version.map index 3cadec7fae..3509d4fc14 100644 > --- a/drivers/bus/vmbus/version.map > +++ b/drivers/bus/vmbus/version.map > @@ -23,6 +23,7 @@ DPDK_22 { > rte_vmbus_subchan_open; > rte_vmbus_unmap_device; > rte_vmbus_unregister; > + rte_vmbus_ioctl; >=20 > local: *; > }; > diff --git a/drivers/bus/vmbus/vmbus_channel.c > b/drivers/bus/vmbus/vmbus_channel.c > index f67f1c438a..f53a1b6511 100644 > --- a/drivers/bus/vmbus/vmbus_channel.c > +++ b/drivers/bus/vmbus/vmbus_channel.c > @@ -367,6 +367,11 @@ int rte_vmbus_max_channels(const struct > rte_vmbus_device *device) > return 1; > } >=20 > +int rte_vmbus_ioctl(struct rte_vmbus_device *device, uint32_t subchan) > +{ > + return vmbus_uio_subchan_open(device, subchan); } > + > /* Setup secondary channel */ > int rte_vmbus_subchan_open(struct vmbus_channel *primary, > struct vmbus_channel **new_chan) > -- > 2.30.2