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 E08A2A0C4B; Sat, 6 Nov 2021 21:49:04 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 687F640151; Sat, 6 Nov 2021 21:49:04 +0100 (CET) Received: from na01-obe.outbound.protection.outlook.com (mail-cusazon11021015.outbound.protection.outlook.com [52.101.62.15]) by mails.dpdk.org (Postfix) with ESMTP id 6819640040 for ; Sat, 6 Nov 2021 21:49:03 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OfnS60yYzVlUEZ9CHiszPKDrqVxd8d57pn9YlJdvpHlypoFOPAIi23JE7hd3HUFYayryajgLaZEGk06DvobhLpDrvyoS5vVucpEaH/tczewu8fVFxwvrV56gypxJvDmGcNZt56m+UybOtNEf1JwNK6AjY/7gyBaW1M/tMt0adMOHmuzpsSwLmp8P2Qa+5gZGNyUNfmYT1tt1XcymPxJaRWRcckwkMPKXq2cKIIaXTfo9AXpln+8dLCDzzPj3+QnOXQeG2YqER4gj0HGh221RMTFWsH7hxlknK7Jid3QXl2NU3i7ORHBDjJU+0eSYD52CLbhYvyMy79ZzXY2KweXmmQ== 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=7sM/8YmCS2JHyBFJXpwiX0SUvQnBwg1mL/DqwIYwAd4=; b=lRT1+HvSpnxnt2aTavA7wHQjdADuuYqHIaf7TBZrdOA8P+CAQD1r6P60iZIJLR7J8VBZVxzP6kWflewCkWWkJR0reXCsGrzKv6t5U3UeJXV2wNPU2HYxHNQ6UysVxfILJHgQvPl4TL/J2h7OT6LsvrzsBfzhXd1ZhuxtXIX36LuuSPvJZ9bPKd/elhT5Ns53QQiYffDQtaGESaaDgzvBPwBG/YY5Zr9OnjINdbBEuEk5MagYiruF3zLvmigcsvh00ifITJlmSVEQs1/88RDmNMVWiJ5LIC0nj2JTWSGObtnm0hlRYkXPkH+PK6D7NRLwfcEBnOKpEwSHovVpc2iyXw== 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=7sM/8YmCS2JHyBFJXpwiX0SUvQnBwg1mL/DqwIYwAd4=; b=JqyCFxxTW3vlqADcs/ziXq/lvkbDeWlYyygY1Xy4a8ytfHU36Kc5NSXwyBudsmUuto/k+/xbAb78ZadAuSHdWzAjETrkHSJyxgWxMxSz97wxg57MH2lkOqBQe0O38tcL2zQ3jIXLjcoQ2lD4Ii7cvOBIITGOQOTqos9HmRQhO+U= Received: from BY5PR21MB1506.namprd21.prod.outlook.com (2603:10b6:a03:23d::12) by SJ0PR21MB1293.namprd21.prod.outlook.com (2603:10b6:a03:3e5::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.3; Sat, 6 Nov 2021 20:49:00 +0000 Received: from BY5PR21MB1506.namprd21.prod.outlook.com ([fe80::1db2:a482:d774:93ea]) by BY5PR21MB1506.namprd21.prod.outlook.com ([fe80::1db2:a482:d774:93ea%3]) with mapi id 15.20.4713.000; Sat, 6 Nov 2021 20:49:00 +0000 From: Long Li To: Srikanth Kaka , Stephen Hemminger CC: "dev@dpdk.org" , Vag Singh , Anand Thulasiram Thread-Topic: [PATCH v2 05/11] bus/vmbus: open subchannels Thread-Index: AQHXvDlto5MpW4k4dEWOfnDEINOGkav3JuSg Date: Sat, 6 Nov 2021 20:49:00 +0000 Message-ID: References: <20210927134231.11177-6-srikanth.k@oneconvergence.com> <20211008114107.101616-1-srikanth.k@oneconvergence.com> In-Reply-To: <20211008114107.101616-1-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=b9164053-10c3-4679-8f41-ea5f4245b03e; 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-11-06T20:48:36Z; 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: 890f5c9d-f252-4c02-c15e-08d9a166dc46 x-ms-traffictypediagnostic: SJ0PR21MB1293: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:1824; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: sIRvIdggf2KowMaI4jO+rd36YZuTqqLnb04bP4YOlx/ImIOzfIboVOGPRrt7j0x38bznuNnwshGYsekd98IL3+7c8Gw/Tciqg6MjYAU1wP54soPjhKxH6uqH86JYaapJ3BJEg48A7RruTu72xakr/VuREbnCA7NJF4vtx3Wsr8/FCCuCp+wDONEZpVTEnR9JXfNsIgvIcFGNQKhG73XJWzjaPcxcn1kJKUn7n5nr5DDOZf3NC/2GmqMl1Hx6mwxvAqho11zW5aa3gZ0vXA+QbfzvtmfLFbmW1m5/mXB1wCnsXUXRKevin/4Jw1L3KxVywszIontpcJk5AaGbtGmND+CFCfozfNnDXc9nGSCYKeM8IVOpkak1tQewkFARay1gw30J9wKY/Q0AX/CJhdy+tl024Hcm9Ji7exY48OijeJlcX4g25Z4tvaRVZqgrtxhWxfY/zkX77xk4mgW6gsIiZz/5gxIZlbT2v1KjHfkHdX/D43WDenQg+5pvDTrZMAiQmhD47pIOHJ8XUenHwomhNk5CgR8knBlKoJcx9Ai+TgBSGmfAkp8ElOnIgnvCgZuZbg45XrNWsOncYloucdv0sOCBjQH+2yi4KWlsa74cUXEvqJumJAUeFsl9MQjI/MqB8qTBR7TRg0hy3pqwlQRNGs/xARLqK27yjlJJNo2+VQC3OQk/DkLbW4tpnqRElSwQ1Eela37AqD2DyVrbAxrjUw== 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)(26005)(52536014)(110136005)(6636002)(10290500003)(54906003)(316002)(186003)(2906002)(38070700005)(4326008)(82960400001)(82950400001)(83380400001)(33656002)(8990500004)(5660300002)(38100700002)(122000001)(86362001)(66446008)(8676002)(66476007)(66556008)(64756008)(8936002)(6506007)(508600001)(9686003)(7696005)(55016002)(71200400001)(66946007)(76116006); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?BHCbfGSA7hwHu+6LE7fKVHEf7eUn8ucMyaLAEFs51NnlHlOa6+a/Stbo5B9+?= =?us-ascii?Q?+4G0pUILCvn+2XiYUQ8fdEs6hOZBSpXh0v/mL+yTYHo8muTQQkEu0XZAiR5A?= =?us-ascii?Q?6lWw8Zf9KuynC56L1GFbC3ucClYBdHoPyvVu2IqkFuF0YtZAwnHo5LAvo3bp?= =?us-asc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h06lRRhOJ/i3zFGnwuAwwqjz8?= =?us-ascii?Q?xezxxYyjM9HFhPRdICrhqFlm+AMNtGMesX3l/DH7kDT1sAbuMftF8WlmZA+4?= =?us-ascii?Q?uhiSvlCoC9pP0mt6F+t+XbQxDrWRudwh+l5K/MJyTXYPlq88IxK/5ERiDmyp?= =?us-ascii?Q?bNVG4BQvHWKPa93SL/DNOpafm2FLcpjZFuQ5WKtzassjFsDBE6gNd+5oH5cF?= =?us-ascii?Q?+yUxBHkgFU6FvnpoqO8YN6drkIo7k5rcz9rUULQnmvp3W0SUfJ4qNcIG7WBi?= =?us-ascii?Q?E484bxXaMS3y+4/9FywmT/PtylJ6Vsr6C3v8LlfwazFFIF2KcomW34s4yPOL?= =?us-ascii?Q?xI76eDAVl5KhR3V8mDq0HwRk4LIzIrsk647cjGxfgltTYrPhn5qWw0RMqVn+?= =?us-ascii?Q?aIxWolqUPGCtfrikAqB37YMjnxDRVZDtUUY55niogSDlyVrRxV45QN6y/blK?= =?us-ascii?Q?PaypEQCi+p9drxPlOP9ygodC4iZC2If+OJfKTop1w3+UPhpDVV7mA8xjMH3r?= =?us-ascii?Q?YbTpbNDJMHRwusLwPSsNt+XbFI78cbWyqeBehVgaGOk8bivaqi+V7H4wwqeY?= =?us-ascii?Q?0A=3D=3D?= 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: 890f5c9d-f252-4c02-c15e-08d9a166dc46 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Nov 2021 20:49:00.2831 (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: GqmbM+ak702OY6n0Ymp2LOG6i2iieczfwuEVgqZDwAliCgev6C4ZS0JWXZSRXxv19MPfDwwHXFIfVrfDp2SJEA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR21MB1293 Subject: Re: [dpdk-dev] [PATCH v2 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 v2 05/11] bus/vmbus: open subchannels >=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-channe= ls >=20 > v2 - Added comment in linux/vmbus_uio.c >=20 > Signed-off-by: Srikanth Kaka > Signed-off-by: Vag Singh > Signed-off-by: Anand Thulasiram Reviewed-by: Long Li > --- > drivers/bus/vmbus/freebsd/vmbus_uio.c | 31 +++++++++++++++++++++++++++ > drivers/bus/vmbus/linux/vmbus_uio.c | 12 +++++++++++ > 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, 60 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..29e889347a 100644 > --- a/drivers/bus/vmbus/linux/vmbus_uio.c > +++ b/drivers/bus/vmbus/linux/vmbus_uio.c > @@ -451,3 +451,15 @@ int vmbus_uio_get_subchan(struct vmbus_channel > *primary, > closedir(chan_dir); > return err; > } > + > +/* > + * This is a stub function and it should always succeed. > + * The Linux UIO kernel driver opens the subchannels implicitly. > + */ > +int vmbus_uio_subchan_open(struct rte_vmbus_device *dev, > + uint32_t subchan) > +{ > + RTE_SET_USED(dev); > + RTE_SET_USED(subchan); > + return 0; > +} > diff --git a/drivers/bus/vmbus/private.h b/drivers/bus/vmbus/private.h in= dex > 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 6bcff66468..60c5812706 100644 > --- a/drivers/bus/vmbus/rte_bus_vmbus.h > +++ b/drivers/bus/vmbus/rte_bus_vmbus.h > @@ -404,6 +404,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.ma= p > 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.1