From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80055.outbound.protection.outlook.com [40.107.8.55]) by dpdk.org (Postfix) with ESMTP id B930C27D for ; Wed, 13 Feb 2019 16:23:51 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=egjRgXPOra0NAYFlRL/t2Wy/4XCWKrYjDAEgvs9dmDs=; b=h1dpKKAaK/n1V4VfYMCeADjLe6v148nS7wT1hxcojYQ+lVZmr622wszsHAXVl0xUPtSFMdPYU+OOqDzfJQRq7fR6ltRNJfu42qecqCSukNDjy4m77O9KrtLJOjx7JLLLGsTb76wJXqNfmeoxEoFZHnEhmWtzdTVmmwGfppVYf/A= Received: from AM0PR0502MB3795.eurprd05.prod.outlook.com (52.133.47.29) by AM0PR0502MB3892.eurprd05.prod.outlook.com (52.133.48.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1622.16; Wed, 13 Feb 2019 15:23:49 +0000 Received: from AM0PR0502MB3795.eurprd05.prod.outlook.com ([fe80::386e:f86:50bf:31be]) by AM0PR0502MB3795.eurprd05.prod.outlook.com ([fe80::386e:f86:50bf:31be%5]) with mapi id 15.20.1622.016; Wed, 13 Feb 2019 15:23:49 +0000 From: Shahaf Shuler To: =?iso-8859-1?Q?Ga=EBtan_Rivet?= CC: "anatoly.burakov@intel.com" , Yongseok Koh , Thomas Monjalon , "ferruh.yigit@intel.com" , "nhorman@tuxdriver.com" , "dev@dpdk.org" Thread-Topic: [PATCH 1/6] vfio: allow DMA map of memory for the default vfio fd Thread-Index: AQHUw4DdgeKXdgR1Wkua/qTlhEacnaXd2L5w Date: Wed, 13 Feb 2019 15:23:49 +0000 Message-ID: References: <0f98e0a06c535d58ac8d2c39645b07eb966ec5ec.1550048187.git.shahafs@mellanox.com> <20190213094505.d7ly2sundvmffiny@bidouze.vm.6wind.com> In-Reply-To: <20190213094505.d7ly2sundvmffiny@bidouze.vm.6wind.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=shahafs@mellanox.com; x-originating-ip: [193.47.165.251] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: c5e9c82c-0c27-4a1b-91bf-08d691c74134 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(4618075)(2017052603328)(7153060)(7193020); SRVR:AM0PR0502MB3892; x-ms-traffictypediagnostic: AM0PR0502MB3892: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-exchange-diagnostics: =?iso-8859-1?Q?1; AM0PR0502MB3892; 23:0Hbe/YcokSBQIe8YU+xXxIeCfg57A1hfdfZfJ?= =?iso-8859-1?Q?erTd+Y6GPlovCnr1AcW7NlF646M+bLNQ5mPQ2wpce+LeyG0D7T43N6GyqZ?= =?iso-8859-1?Q?aF9rY55a5XjzpWux6ZXo8tagua9EENLfFFRKcGOd8wyQi7spWeNZIJn88x?= =?iso-8859-1?Q?0+dzumA9tn7euvayLqX2WYM65vhE3FPETPhIU/rpGdTBG6l5IPd3ZUCnIm?= =?iso-8859-1?Q?80dnFINJXN4Wxaz70Ye768kVwqEd8aFhHok4uGZFle6k8kH6uTf4qGZJQU?= =?iso-8859-1?Q?h1cTrmaL8qN9OmB8nf90EkJKiRH13zb3draLiereaMc7cdaIBe02ZA6Dr3?= =?iso-8859-1?Q?5bNV+M8nPApWTNZxLOqDfp/2E2skgvITIYFsQ4kJ/dO/tfWcwI0NjJeHUn?= =?iso-8859-1?Q?MEvAUMIgmh6lYpLro97Ho2bChK2NrG8w4Kt4IcJfe8GPFPCOVtHkWQLDxb?= =?iso-8859-1?Q?HEPp3J6pNxNL19CpDUSpqbsftDZ2i60JpCuVnPMhen+64APdEm89jO5n2G?= =?iso-8859-1?Q?9hvWCxY3of5iyTZStBcyt4UU4+MPYakYnW2ZdH3Us7bD1mDTeNIDPeNrdz?= =?iso-8859-1?Q?xHmgzCltUdIwhN/m9djENvBDuTVEvpHmjRSwkrIW+5ekxbUszmQORfxeu9?= =?iso-8859-1?Q?JLoJLplFHdQBfMuSGNGS/mhfmXxkq7Z9xzYWcGJMHJeiE+a5oewB0axblF?= =?iso-8859-1?Q?KAho28Dy3YyIFN8DXOGI7iiAX+cT4er3Yye5URzwaa8N3rZy5C1Lt/J+yg?= =?iso-8859-1?Q?8W/qackAzaHCnkLjFJonnX0ft+mIEIWd2qCJgtfLogmU5bv3NBU/bpIfu6?= =?iso-8859-1?Q?I1qOQK4LhANxbovWt7Mh/z9oq7/EMKyhcpuhhZLgO6xcroe9K7+MiirYBV?= =?iso-8859-1?Q?d8yF5+GB8a2fmvCW+vrDQvffyH3QKGCvMyVn2wFD89R+HTgamvkCqJLmsH?= =?iso-8859-1?Q?8ddKhHDI7G9PCALTLEkbO6Za+w/UcuCt/9/oQPxorUDEGDdhVMxRciL65n?= =?iso-8859-1?Q?COE4R8CSfr456WPCC1ZPJspPB5cSOF4ciUe0sv5ctnYt7/shiKKRJVJSbM?= =?iso-8859-1?Q?AIZrkSWReSPY/9+xNBXkdeN5gBV4g9AL/JpttL8/Z5Wgs9lvCnrKCbAVF3?= =?iso-8859-1?Q?pjE68M/xUELTw8HjFSTm947k9jjvqUZUPK+xusqlKepgslYCKz/BPoZtLH?= =?iso-8859-1?Q?IW1bLDX4d7wQLOede3Wck+5AUe2yEcisWLwScSda9njvCorPDitGLJYyNp?= =?iso-8859-1?Q?5yQmP0mVP4uNTy46Ypo?= x-microsoft-antispam-prvs: x-forefront-prvs: 094700CA91 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39860400002)(136003)(376002)(396003)(366004)(346002)(199004)(189003)(4326008)(11346002)(6436002)(86362001)(14444005)(229853002)(53936002)(6246003)(9686003)(476003)(486006)(97736004)(256004)(446003)(2906002)(25786009)(66066001)(102836004)(106356001)(186003)(26005)(81166006)(478600001)(8936002)(81156014)(3846002)(76176011)(6506007)(74316002)(105586002)(14454004)(6116002)(316002)(71190400001)(71200400001)(55016002)(33656002)(8676002)(7696005)(54906003)(99286004)(7736002)(6916009)(305945005)(68736007)(66574012); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR0502MB3892; H:AM0PR0502MB3795.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: Yw72ndt/VPPeRQp7IG+te1h+7Puc4j6KTUhGqlaexIMGhN8rwFQL4t9uMnZY58srUAwHJaaVhuZe5mMd2RZ0i1AeFOGQdBR/uCfJY6GKO/JDEoKrD757fv/OLYAt47Cw1JNFcakb9EJy3oS/X7gVu7Opgc8cAaTPph0nT75jwUNeITFbTpYly+03J6ExCrsBWm8E404jZQoi5GM4jKNKhDOfuf/3LG6VBxQb8UKD0hUjotS83jTtsBdmqkfXMJoUx6bpGyF+jUsq5JEqgDPOxVkkbEOHHZuJLCMq9H3JoGnO6E9PRgMeZN8lgVuGJVPZG37NYwMDU4nki0Hf15gLVEVjLiyt+k49dY4nQir75I6WU6bzzFwPMvYIajBdGtFfx213KtB6wL/QNiPd5urWsb4+A7K+9W0E5Gyhufko11o= Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: c5e9c82c-0c27-4a1b-91bf-08d691c74134 X-MS-Exchange-CrossTenant-originalarrivaltime: 13 Feb 2019 15:23:49.6966 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR0502MB3892 Subject: Re: [dpdk-dev] [PATCH 1/6] vfio: allow DMA map of memory for the default vfio fd X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Feb 2019 15:23:51 -0000 Wednesday, February 13, 2019 11:45 AM, Ga=EBtan Rivet: > Subject: Re: [PATCH 1/6] vfio: allow DMA map of memory for the default vf= io > fd >=20 > Hello Shahaf, Hi Gaetan. >=20 > On Wed, Feb 13, 2019 at 11:10:21AM +0200, Shahaf Shuler wrote: > > Enable users the option to call rte_vfio_dma_map with request to map > > to the default vfio fd. > > > > Signed-off-by: Shahaf Shuler > > --- > > lib/librte_eal/common/include/rte_vfio.h | 6 ++++-- > > lib/librte_eal/linuxapp/eal/eal_vfio.c | 14 ++++++++++++-- > > 2 files changed, 16 insertions(+), 4 deletions(-) > > >=20 [...] > Can you use: >=20 > vfio_cfg =3D default_vfio_cfg; >=20 > instead? Then the comment is redundant. > Actually, to keep with my comment above, it might be better to simply hav= e >=20 > if (container_fd =3D=3D RTE_VFIO_DEFAULT_CONTAINER_FD) > vfio_cfg =3D default_vfio_cfg; > else > vfio_cfg =3D get_vfio_cfg_by_group_num(container_fd); >=20 Good suggestion. Will adjust in v2.=20 > > if (vfio_cfg =3D=3D NULL) { > > RTE_LOG(ERR, EAL, "Invalid container fd\n"); > > return -1; > > @@ -1917,7 +1922,12 @@ rte_vfio_container_dma_unmap(int > container_fd, uint64_t vaddr, uint64_t iova, > > return -1; > > } > > > > - vfio_cfg =3D get_vfio_cfg_by_container_fd(container_fd); > > + if (container_fd > 0) { > > + vfio_cfg =3D get_vfio_cfg_by_container_fd(container_fd); > > + } else { > > + /* when no fd provided use the default. */ > > + vfio_cfg =3D &vfio_cfgs[0]; > > + } > > if (vfio_cfg =3D=3D NULL) { > > RTE_LOG(ERR, EAL, "Invalid container fd\n"); > > return -1; > > -- > > 2.12.0 > > >=20 > -- > Ga=EBtan Rivet > 6WIND