From: Alejandro Lucero <alejandro.lucero@netronome.com>
To: Anatoly Burakov <anatoly.burakov@intel.com>
Cc: dev <dev@dpdk.org>,
srinath.mannam@broadcom.com, scott.branden@broadcom.com,
Ajit Khaparde <ajit.khaparde@broadcom.com>
Subject: Re: [dpdk-dev] [RFC 02/11] eal: add function to rerieve socket index by socket ID
Date: Tue, 10 Jul 2018 14:03:32 +0100 [thread overview]
Message-ID: <CAD+H990SkfQAWV9Om+B_pjdD_QqLrMAQp+Hm2-zV1O13+uXL_Q@mail.gmail.com> (raw)
In-Reply-To: <603dcc865358cc669cba9ec042db93e32a4c8cd5.1530881548.git.anatoly.burakov@intel.com>
On Fri, Jul 6, 2018 at 2:17 PM, Anatoly Burakov <anatoly.burakov@intel.com>
wrote:
> We are preparing to switch to index heap based on heap indexes
> rather than by NUMA nodes. First few indexes will be equal to
> NUMA node ID indexes. For example, currently on a machine with
> NUMA nodes [0, 8], heaps 0 and 8 will be active, while we want
> to make it so that heaps 0 and 1 are active. However, currently
> we don't have a function to map a specific NUMA node to a node
> index, so add it in this patch.
>
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> ---
> lib/librte_eal/common/eal_common_lcore.c | 15 +++++++++++++++
> lib/librte_eal/common/include/rte_lcore.h | 19 ++++++++++++++++++-
> lib/librte_eal/rte_eal_version.map | 1 +
> 3 files changed, 34 insertions(+), 1 deletion(-)
>
> diff --git a/lib/librte_eal/common/eal_common_lcore.c
> b/lib/librte_eal/common/eal_common_lcore.c
> index 3167e9d79..579f5a0a1 100644
> --- a/lib/librte_eal/common/eal_common_lcore.c
> +++ b/lib/librte_eal/common/eal_common_lcore.c
> @@ -132,3 +132,18 @@ rte_socket_id_by_idx(unsigned int idx)
> }
> return config->numa_nodes[idx];
> }
> +
> +int __rte_experimental
> +rte_socket_idx_by_id(unsigned int socket)
> +{
> + const struct rte_config *config = rte_eal_get_configuration();
> + int i;
> +
> + for (i = 0; i < (int) config->numa_node_count; i++) {
> + unsigned int cur_socket = config->numa_nodes[i];
> + if (cur_socket == socket)
> + return i;
> + }
> + rte_errno = EINVAL;
> + return -1;
> +}
> diff --git a/lib/librte_eal/common/include/rte_lcore.h
> b/lib/librte_eal/common/include/rte_lcore.h
> index 6e09d9181..f58cda09a 100644
> --- a/lib/librte_eal/common/include/rte_lcore.h
> +++ b/lib/librte_eal/common/include/rte_lcore.h
> @@ -156,11 +156,28 @@ rte_socket_count(void);
> *
> * @return
> * - physical socket id as recognized by EAL
> - * - -1 on error, with errno set to EINVAL
> + * - -1 on error, with rte_errno set to EINVAL
> */
> int __rte_experimental
> rte_socket_id_by_idx(unsigned int idx);
>
> +/**
> + * Return index for a particular socket id.
> + *
> + * This will return position in list of all detected physical socket id's
> for a
> + * given socket. For example, on a machine with sockets [0, 8], passing
> + * 8 as a parameter will return 1.
> + *
> + * @param socket
> + * physical socket id to return index for
> + *
> + * @return
> + * - index of physical socket id as recognized by EAL
> + * - -1 on error, with rte_errno set to EINVAL
> + */
> +int __rte_experimental
> +rte_socket_idx_by_id(unsigned int socket);
> +
> /**
> * Get the ID of the physical socket of the specified lcore
> *
> diff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_
> version.map
> index f7dd0e7bc..e7fb37b2a 100644
> --- a/lib/librte_eal/rte_eal_version.map
> +++ b/lib/librte_eal/rte_eal_version.map
> @@ -296,6 +296,7 @@ EXPERIMENTAL {
> rte_mp_sendmsg;
> rte_socket_count;
> rte_socket_id_by_idx;
> + rte_socket_idx_by_id;
> rte_vfio_dma_map;
> rte_vfio_dma_unmap;
> rte_vfio_get_container_fd;
> --
> 2.17.1
>
Acked-by: Alejandro Lucero <alejandro.lucero@netronome.com>
next prev parent reply other threads:[~2018-07-10 13:03 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-06 13:17 [dpdk-dev] [RFC 00/11] Support externally allocated memory in DPDK Anatoly Burakov
2018-07-06 13:17 ` [dpdk-dev] [RFC 01/11] mem: allow memseg lists to be marked as external Anatoly Burakov
2018-07-10 11:18 ` Alejandro Lucero
2018-07-10 11:31 ` Burakov, Anatoly
2018-07-06 13:17 ` [dpdk-dev] [RFC 02/11] eal: add function to rerieve socket index by socket ID Anatoly Burakov
2018-07-10 13:03 ` Alejandro Lucero [this message]
2018-07-06 13:17 ` [dpdk-dev] [RFC 03/11] malloc: index heaps using heap ID rather than NUMA node Anatoly Burakov
2018-07-13 16:05 ` Alejandro Lucero
2018-07-13 16:08 ` Burakov, Anatoly
2018-07-06 13:17 ` [dpdk-dev] [RFC 04/11] malloc: add name to malloc heaps Anatoly Burakov
2018-07-13 16:09 ` Alejandro Lucero
2018-07-06 13:17 ` [dpdk-dev] [RFC 05/11] malloc: enable retrieving statistics from named heaps Anatoly Burakov
2018-07-13 16:25 ` Alejandro Lucero
2018-07-06 13:17 ` [dpdk-dev] [RFC 06/11] malloc: enable allocating " Anatoly Burakov
2018-07-13 16:31 ` Alejandro Lucero
2018-07-06 13:17 ` [dpdk-dev] [RFC 07/11] malloc: enable creating new malloc heaps Anatoly Burakov
2018-07-06 13:17 ` [dpdk-dev] [RFC 08/11] malloc: allow adding memory to named heaps Anatoly Burakov
2018-07-13 17:04 ` Alejandro Lucero
2018-07-06 13:17 ` [dpdk-dev] [RFC 09/11] malloc: allow removing memory from " Anatoly Burakov
2018-07-06 13:17 ` [dpdk-dev] [RFC 10/11] malloc: allow destroying heaps Anatoly Burakov
2018-07-06 13:17 ` [dpdk-dev] [RFC 11/11] memzone: enable reserving memory from named heaps Anatoly Burakov
2018-07-13 17:10 ` [dpdk-dev] [RFC 00/11] Support externally allocated memory in DPDK Burakov, Anatoly
2018-07-13 17:56 ` Wiles, Keith
2018-07-19 10:58 ` László Vadkerti
2018-07-26 13:48 ` Burakov, Anatoly
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=CAD+H990SkfQAWV9Om+B_pjdD_QqLrMAQp+Hm2-zV1O13+uXL_Q@mail.gmail.com \
--to=alejandro.lucero@netronome.com \
--cc=ajit.khaparde@broadcom.com \
--cc=anatoly.burakov@intel.com \
--cc=dev@dpdk.org \
--cc=scott.branden@broadcom.com \
--cc=srinath.mannam@broadcom.com \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).