DPDK patches and discussions
 help / color / mirror / Atom feed
From: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
To: Thomas Monjalon <thomas@monjalon.net>
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
Subject: Re: [dpdk-dev] [PATCH] pci: keep API compatibility with mmap values
Date: Fri, 10 Jul 2020 21:31:55 +0300
Message-ID: <20200710213155.7db798b7@sovereign> (raw)
In-Reply-To: <20200710115324.3902559-1-thomas@monjalon.net>

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 <stdint.h>
> +#include <sys/mman.h>
>  
>  #include <rte_compat.h>
>  
> @@ -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 <sys/mman.h> in <rte_eal_paging.h>, but I'm
against adding this stub header. Why not make #include <sys/mman.h>
conditional and define MAP_FAIELD in <rte_os.h> 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

  parent reply	other threads:[~2020-07-10 18:32 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-10 11:53 Thomas Monjalon
2020-07-10 13:34 ` David Marchand
2020-07-10 15:39 ` Burakov, Anatoly
2020-07-10 16:17   ` Thomas Monjalon
2020-07-13  8:56     ` Burakov, Anatoly
2020-07-15  8:01     ` David Marchand
2020-07-10 17:10 ` Thomas Monjalon
2020-07-10 18:31 ` Dmitry Kozlyuk [this message]
2020-07-10 20:02   ` Thomas Monjalon
2020-07-10 20:40 ` [dpdk-dev] [PATCH v2] " Thomas Monjalon
2020-07-10 21:07   ` Dmitry Kozlyuk
2020-07-11  9:51     ` Thomas Monjalon
2020-07-11  3:27   ` Ma, LihongX
2020-07-11  9:50     ` Thomas Monjalon
2020-07-11  3:18 ` [dpdk-dev] [PATCH] " Ma, LihongX

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200710213155.7db798b7@sovereign \
    --to=dmitry.kozliuk@gmail.com \
    --cc=alvinx.zhang@intel.com \
    --cc=anatoly.burakov@intel.com \
    --cc=beilei.xing@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=dmitrym@microsoft.com \
    --cc=ferruh.yigit@intel.com \
    --cc=grive@u256.net \
    --cc=jia.guo@intel.com \
    --cc=navasile@linux.microsoft.com \
    --cc=pallavi.kadam@intel.com \
    --cc=talshn@mellanox.com \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git