From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id A1920A0528; Sat, 11 Jul 2020 11:51:36 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 736C51D93D; Sat, 11 Jul 2020 11:51:36 +0200 (CEST) Received: from new1-smtp.messagingengine.com (new1-smtp.messagingengine.com [66.111.4.221]) by dpdk.org (Postfix) with ESMTP id D5F3F1C1F4 for ; Sat, 11 Jul 2020 11:51:34 +0200 (CEST) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailnew.nyi.internal (Postfix) with ESMTP id 4CC645803A8; Sat, 11 Jul 2020 05:51:34 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Sat, 11 Jul 2020 05:51:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s=fm1; bh= XFCXMmTwp6pqkw2EjZOYOSMcdA1GCXdQ5RFUhbgnXeM=; b=pTrKqmxQAa4Sfi0l Wgp5WK7OsvSCguotpPgSj0a0RavG+p7tw4vHtOFNw9qFm8GOQDg/zTOcj45NlrAK LpxaIa8eEQuq/F85aXGd3d2yk++eiukOZQzNJuiq3jmkI6LtTTSgEOACMgCBp1yC 4L2c24Hc0JTO08+vfQkLbp2hgP7gmqiCeqheYAFvj9vMUjGSrIRM33s6SCB5ljHf z44GHvuMtsY1P+Fmw9uZbnudVa23uLUXQPaMJeBMx/v+eD0Y6wVF12MqnLFVWhal Ck4YkpGHcI9jp3LfwhDz+J7ywvT6yRnQMKs+FS+wuq0i5wh1UgQZ/+SsC/1y+Ilc YZ9zdw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=XFCXMmTwp6pqkw2EjZOYOSMcdA1GCXdQ5RFUhbgnX eM=; b=EZs2zgL6Uw/A90tQ90S368XlWK/jLRlvlBeo/60vh0xdaTcecFyYvm3pp ek0ffcwWI2bc7m4667giLj8yN8tIPvpjoOxRuwxcs6hYoTzkUXkJ1+G/F+Oz29MT G+1TcmWH5JW6mycW9ax3oyPCV6bJOBdo9qkZ6YZwtOOl26j1mkUYjdUqGA4HyQBg TQOHijIyAxbunYIa5cdtPw1XHWt9t2Tu6R23uAmo5UgWJUEFUMwtextM3lSLnlhs QS0usSE5SzQ2seHb+jFbdq4ACRUCn1FpbjRzi9sfHDm/AuAScNzKXAQcBC0Rj1Bu OwtTdKFzWHSMEgNC8DNqJG89aL+sw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduiedrvdefgddvvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkfgjfhgggfgtsehtufertd dttddvnecuhfhrohhmpefvhhhomhgrshcuofhonhhjrghlohhnuceothhhohhmrghssehm ohhnjhgrlhhonhdrnhgvtheqnecuggftrfgrthhtvghrnhepudeggfdvfeduffdtfeegle fghfeukefgfffhueejtdetuedtjeeuieeivdffgeehnecukfhppeejjedrudefgedrvddt fedrudekgeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehthhhomhgrshesmhhonhhjrghlohhnrdhnvght X-ME-Proxy: Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 8CAB13060067; Sat, 11 Jul 2020 05:51:32 -0400 (EDT) From: Thomas Monjalon To: dev@dpdk.org Cc: david.marchand@redhat.com, ferruh.yigit@intel.com, grive@u256.net, alvinx.zhang@intel.com, beilei.xing@intel.com, jia.guo@intel.com, anatoly.burakov@intel.com, bruce.richardson@intel.com, navasile@linux.microsoft.com, dmitrym@microsoft.com, pallavi.kadam@intel.com, talshn@mellanox.com, Dmitry Kozlyuk , Lihong Ma Date: Sat, 11 Jul 2020 11:51:31 +0200 Message-ID: <3394779.QeanU0coBd@thomas> In-Reply-To: <20200711000702.26e70084@sovereign> References: <20200710115324.3902559-1-thomas@monjalon.net> <20200710204034.4158330-1-thomas@monjalon.net> <20200711000702.26e70084@sovereign> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH v2] pci: keep API compatibility with mmap values 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 10/07/2020 23:07, Dmitry Kozlyuk: > On Fri, 10 Jul 2020 22:40:34 +0200, Thomas Monjalon wrote: > > The function pci_map_resource() returns MAP_FAILED in case of error. > > When replacing the call to mmap() by rte_mem_map(), > > the error code became NULL, breaking the API. > > This function is probably not used outside of DPDK, > > but it is still a problem for two reasons: > > - the deprecation process was not followed > > - the Linux function pci_vfio_mmap_bar() is broken for i40e > > > > The error code is reverted to the Unix value MAP_FAILED. > > Windows needs to define this special value (-1 as in Unix). > > After proper deprecation process, the API could be changed again > > if really needed. > > > > Because of the switch from mmap() to rte_mem_map(), > > another part of the API was changed: "int additional_flags" > > are defined as "additional flags for the mapping range" > > without mentioning it was directly used in mmap(). > > Currently it is directly used in rte_mem_map(), > > that's why the values rte_map_flags must be mapped (sic) on the mmap ones > > in case of Unix OS. > > > > These are side effects of a badly defined API using Unix values. > > > > Bugzilla ID: 503 > > Fixes: 2fd3567e5425 ("pci: use OS generic memory mapping functions") > > Cc: talshn@mellanox.com > > > > Reported-by: David Marchand > > Signed-off-by: Thomas Monjalon > > --- > > v2: move MAP_FAILED from sys/mman.h to rte_os.h > > --- > > drivers/bus/pci/bsd/pci.c | 2 +- > > drivers/bus/pci/linux/pci_uio.c | 2 +- > > drivers/bus/pci/linux/pci_vfio.c | 4 ++-- > > drivers/bus/pci/pci_common_uio.c | 2 +- > > lib/librte_eal/include/rte_eal_paging.h | 10 ++++++++++ > > lib/librte_eal/windows/include/rte_os.h | 6 ++++++ > > lib/librte_pci/rte_pci.c | 1 + > > lib/librte_pci/rte_pci.h | 2 +- > > 8 files changed, 23 insertions(+), 6 deletions(-) > > Acked-by: Dmitry Kozlyuk > > No Intel NIC to test, but LGTM and compiles OK for Windows. Tested-by: Lihong Ma Applied