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 A55EDA052A; Fri, 10 Jul 2020 20:32:00 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5C3441DCC3; Fri, 10 Jul 2020 20:31:59 +0200 (CEST) Received: from mail-lj1-f193.google.com (mail-lj1-f193.google.com [209.85.208.193]) by dpdk.org (Postfix) with ESMTP id 2D7741DC77 for ; Fri, 10 Jul 2020 20:31:58 +0200 (CEST) Received: by mail-lj1-f193.google.com with SMTP id h19so7502496ljg.13 for ; Fri, 10 Jul 2020 11:31:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=JZCMkFRA3Axvov1+fH/twTpGV+aHpD/T80OFD9D5fhY=; b=WzIQ4WRii2fRHXLfnGiGC+M0DMmrE/uRzBtfmCyRfydH6DTTtvnL/y33UnhPcq9BL0 wQdnU0c0wK2Hnv3cMUQMSbKd1Iy6WkGYiwl5OQ+uB4pNXiDIeorJrJWe1z3kuttSwF02 91FNVwTTB3ssxtgLTqchAR5tskNJV46UX+V0k8avrgaq3cyOBjhR0T3EYz2HxyGIWAyF /VAoh95BKnpFE3rH+2XdJCfuiK0F4gB8nR82IDqNwchs60dNKsRylkzCwgLSfirc5ZBS wZPI887G+B3zInuCRJUlO1vDZvG5NeiXewOGo4pKS/8MgmHfgZSZguQemfsL6dRUKcOo XEMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JZCMkFRA3Axvov1+fH/twTpGV+aHpD/T80OFD9D5fhY=; b=Dndo2lAsN+pfr2NjwZRAb6jDaNd4lXCzjhrPDO0aAazZ+g+NUvBKvG0aIetavxbJen 6EZ1rEKkXv9jCznu44/kfLszO6hq46CpCSTli3k8TXBmjuswW7DCLHlRcEwcq88jJF0J QvJJOnt+5qY36GaV4V4h2qsydZa1w92IKAQBhwAyGHPgBjjoV8fWjkmbSqgeGl1UG6mB 1AWDBZFjUM1amU/9PhsxUQZYESaznEec6TjpCS7kQSXpzzp60TIEp4eg+x9bTRWuR21O yqnXGSN5aDYPEecc2kNOrxJTTDIwRSLpVOm0T8lGf0fIVJALiK8Lap4GyEUH/sJ+Xd/i NZ0g== X-Gm-Message-State: AOAM533ML+ngvdC4aAXL2zahw4T8dO52C/k3wDPJIkdt8KstP2Ubv4Va DaMwL1ubm1lh17xf+IKf8Xg= X-Google-Smtp-Source: ABdhPJyUv3JZYOUDSp8XTr0KSdR37QEGE/Oyy8VEuz+hIhV0Uh0G4QWiUI8diIcKSYH9bmF1flDpxA== X-Received: by 2002:a2e:b175:: with SMTP id a21mr38595059ljm.10.1594405917548; Fri, 10 Jul 2020 11:31:57 -0700 (PDT) Received: from sovereign (broadband-37-110-65-23.ip.moscow.rt.ru. [37.110.65.23]) by smtp.gmail.com with ESMTPSA id 24sm2440737lfy.59.2020.07.10.11.31.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Jul 2020 11:31:56 -0700 (PDT) Date: Fri, 10 Jul 2020 21:31:55 +0300 From: Dmitry Kozlyuk To: Thomas Monjalon Cc: dev@dpdk.org, 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 Message-ID: <20200710213155.7db798b7@sovereign> In-Reply-To: <20200710115324.3902559-1-thomas@monjalon.net> References: <20200710115324.3902559-1-thomas@monjalon.net> X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH] 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" My apologies for not examining mmap() usage thoroughly enough when designing these internal APIs. I support your suggestion to move PCI mapping functions to bus driver after proper deprecation. On Fri, 10 Jul 2020 13:53:24 +0200, Thomas Monjalon wrote: [snip] > diff --git a/lib/librte_eal/include/rte_eal_paging.h b/lib/librte_eal/include/rte_eal_paging.h > index ed98e70e9e..680a7f2505 100644 > --- a/lib/librte_eal/include/rte_eal_paging.h > +++ b/lib/librte_eal/include/rte_eal_paging.h > @@ -3,6 +3,7 @@ > */ > > #include > +#include > > #include > > @@ -22,6 +23,7 @@ enum rte_mem_prot { > > /** Additional flags for memory mapping. */ > enum rte_map_flags { > +#ifdef RTE_EXEC_ENV_WINDOWS > /** Changes to the mapped memory are visible to other processes. */ > RTE_MAP_SHARED = 1 << 0, > /** Mapping is not backed by a regular file. */ > @@ -35,6 +37,12 @@ enum rte_map_flags { > * it is not required to do so, thus mapping with this flag may fail. > */ > RTE_MAP_FORCE_ADDRESS = 1 << 3 > +#else /* map mmap flags because they are exposed in pci_map_resource() API */ > + RTE_MAP_SHARED = MAP_SHARED, > + RTE_MAP_ANONYMOUS = MAP_ANONYMOUS, > + RTE_MAP_PRIVATE = MAP_PRIVATE, > + RTE_MAP_FORCE_ADDRESS = MAP_FIXED, > +#endif > }; > > /** > diff --git a/lib/librte_eal/windows/include/sys/mman.h b/lib/librte_eal/windows/include/sys/mman.h > new file mode 100644 > index 0000000000..0b4b10df1f > --- /dev/null > +++ b/lib/librte_eal/windows/include/sys/mman.h > @@ -0,0 +1,9 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright 2020 Mellanox Technologies, Ltd > + */ > + > +/* > + * The syscall mmap does not exist on Windows, > + * but this error code is used in a badly defined DPDK API for PCI mapping. > + */ > +#define MAP_FAILED ((void *) -1) I see why we can't help exposing in , but I'm against adding this stub header. Why not make #include conditional and define MAP_FAIELD in for Windows? (While networking headers we have define things that are common to all platforms, just expressed in incompatible ways, memory management is inherently OS-specific.) -- Dmitry Kozlyuk