From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <dev-bounces@dpdk.org> Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1D6ACA04EF; Mon, 1 Jun 2020 23:08:11 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 69C951BFE8; Mon, 1 Jun 2020 23:08:09 +0200 (CEST) Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by dpdk.org (Postfix) with ESMTP id 486B41BFCD for <dev@dpdk.org>; Mon, 1 Jun 2020 23:08:08 +0200 (CEST) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 5BBAA5C00A4; Mon, 1 Jun 2020 17:08:07 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Mon, 01 Jun 2020 17:08:07 -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= TpqyfzzWYq0Ib6eWWGiDn7lCdXAbNAJtB2tuC1baLgM=; b=VEG/3aIDFSBNMfGq +CfEYI17usmzC+Ba3U8kdZEDKDxSOh4yxJOwEvv4iC4UfecVVA4j/ha9+UIUdzbM BgQ3DoIZHFfi+AZcIDOGQvHl/F1YyKKI1eC527wS9xsekNAdyqEXqIHyUKqx+dRt cSHJ1i5em+PuxZY2T0n3ExP5r0LU4Bz2ratJnxDmImlCTd0aRGDn9eZzf04aj1JR cvN9mUERjcA3FRKzrGo1jKFcu0w0ZPOlSjQ0FiQF5s9yMRfKMza2/jeGPW/viyy+ 8cR0BGasJnuUfscQ6SkZtDHJ+2Vuo8ZOWkivAGQDrhO1wCZ2LF5PpnHt3pT2bTja AXl3Aw== 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=fm2; bh=TpqyfzzWYq0Ib6eWWGiDn7lCdXAbNAJtB2tuC1baL gM=; b=udBw51wcax82Q4NBhhcdV8qBxwy4DGeVea6YyTCLgacFaEeQBZs2B8W3z HyMjej5A+tf3sSdVasfqdqztIkR1bO9DE0qMCyuoeOaEPFztdq91Nb0hDZlC9IL9 1ESMe7V1a9ZSV7lchg4O/3hjxnNWYnqIsEI796e39dIhqN4JLBSPCKcVtrRrRTaO gS1FJroPp6xdzjzvsX0kqNO5bvK01tLXrmoLPDXYZ1NifYQ7Gn5xMGvIF5I8HHgi bJQf8okwWQZ3HPrIGjtmUBZAwI8qMvzI/yibgoEICWcrg0mLM4Vdw94ZGqpvpZO9 Bu5AnoLcudRmypnMSxg/rwViXd11A== X-ME-Sender: <xms:NW7VXlbkIt6hreFVjJEo7TOBXhHWL1t2J5gl98zG_0vAWlnNXfTK1w> X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrudefhedgudeglecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhvffufffkjghfggfgtgesthfuredttddtvdenucfhrhhomhepvfhhohhm rghsucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenuc ggtffrrghtthgvrhhnpedugefgvdefudfftdefgeelgffhueekgfffhfeujedtteeutdej ueeiiedvffegheenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrh fuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgr lhhonhdrnhgvth X-ME-Proxy: <xmx:NW7VXsaYPkkyFTf27pJHZJBGuEBcf0jNQbqWCwN576r88jCOY9T1gA> <xmx:NW7VXn9I0e6SCX1qCY8ha1Mwv9tI40-USqEgewWg-VNfXv5h2Zz0kg> <xmx:NW7VXjpkNfLbjr62AFO9TFsGZAPdj-6KNAexyWnBSN07hRcbPJZ6SQ> <xmx:N27VXhcLCg_hImV8-h0OOq2vdODZVRRLqCFWqGwgqh-FGUnIwBQS3Q> Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 8591D3062545; Mon, 1 Jun 2020 17:08:04 -0400 (EDT) From: Thomas Monjalon <thomas@monjalon.net> To: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>, dev@dpdk.org Cc: Dmitry Malloy <dmitrym@microsoft.com>, Narcisa Ana Maria Vasile <Narcisa.Vasile@microsoft.com>, Fady Bader <fady@mellanox.com>, Tal Shnaiderman <talshn@mellanox.com>, Bruce Richardson <bruce.richardson@intel.com>, Ray Kinsella <mdr@ashroe.eu>, Neil Horman <nhorman@tuxdriver.com>, "Burakov, Anatoly" <anatoly.burakov@intel.com> Date: Mon, 01 Jun 2020 23:08:03 +0200 Message-ID: <7299575.1ddqD88X9K@thomas> In-Reply-To: <b816282f-fbd1-1cba-c144-830f721c4813@intel.com> References: <20200428235015.2820677-1-dmitry.kozliuk@gmail.com> <20200525003720.6410-4-dmitry.kozliuk@gmail.com> <b816282f-fbd1-1cba-c144-830f721c4813@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH v5 03/11] eal: introduce memory management wrappers X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions <dev.dpdk.org> List-Unsubscribe: <https://mails.dpdk.org/options/dev>, <mailto:dev-request@dpdk.org?subject=unsubscribe> List-Archive: <http://mails.dpdk.org/archives/dev/> List-Post: <mailto:dev@dpdk.org> List-Help: <mailto:dev-request@dpdk.org?subject=help> List-Subscribe: <https://mails.dpdk.org/listinfo/dev>, <mailto:dev-request@dpdk.org?subject=subscribe> Errors-To: dev-bounces@dpdk.org Sender: "dev" <dev-bounces@dpdk.org> 28/05/2020 13:26, Burakov, Anatoly: > On 25-May-20 1:37 AM, Dmitry Kozlyuk wrote: > > +/** > > + * Memory protection flags. > > + */ > > +enum rte_mem_prot { > > + RTE_PROT_READ = 1 << 0, /**< Read access. */ > > + RTE_PROT_WRITE = 1 << 1, /**< Write access. */ > > + RTE_PROT_EXECUTE = 1 << 2 /**< Code execution. */ > > +}; > > + > > +/** > > + * Additional flags for memory mapping. > > + */ > > +enum rte_map_flags { > > + /** Changes to the mapped memory are visible to other processes. */ > > + RTE_MAP_SHARED = 1 << 0, > > + /** Mapping is not backed by a regular file. */ > > + RTE_MAP_ANONYMOUS = 1 << 1, > > + /** Copy-on-write mapping, changes are invisible to other processes. */ > > + RTE_MAP_PRIVATE = 1 << 2, > > + /** > > + * Force mapping to the requested address. This flag should be used > > + * with caution, because to fulfill the request implementation > > + * may remove all other mappings in the requested region. However, > > + * it is not required to do so, thus mapping with this flag may fail. > > + */ > > + RTE_MAP_FORCE_ADDRESS = 1 << 3 > > +}; > > I have no strong opinion on this, but it feels like the fact that these > are enums is a relic from the times where you used enum everywhere :) i > have a feeling that DPDK codebase prefers #define's for this usage, > while what you have here is more of a C++ thing. The benefit of using an enum is to explicitly name the type of the variables, serving documentation purpose. +1 for the enums