From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-f53.google.com (mail-ed1-f53.google.com [209.85.208.53]) by dpdk.org (Postfix) with ESMTP id 84CEA1B39D for ; Tue, 10 Jul 2018 15:03:33 +0200 (CEST) Received: by mail-ed1-f53.google.com with SMTP id i20-v6so3498671eds.12 for ; Tue, 10 Jul 2018 06:03:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netronome-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=hR69Cz3Uhc0bKRdV6lqUAPWxnnvgNaAW3hyBYVrEYHk=; b=qK9hM1/QUBY+tjcUhX6vFyN3qqWvxOxuRAJD2bxSA7HVtbnpB+s5k5ythKzAVYxyLV 70tn7IZeEW/RHqWQ1h99HrXS3199A+/NrK2hIUDgjQfMb847R+q8MXZDMQAHUxzPorts 6c3/3kzhep4Tj1PWX+W0+3fmDm9zdjeQhpNY8WmmQzxyOL9yepKxjkLzIuJNxxdsyGhO B2cNubf2G+ztkQpohaBfepPkm0mxm30uauH2V4LBjz/RfIoBT4Cl/WncLiXnAAD0NbFE yBTlyPk21eqwmTkxcgGyt9/H5IPfosqUqe++i4ZMxfNq/CklsD2qe2bcwTO9G0pfHeZy nNww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=hR69Cz3Uhc0bKRdV6lqUAPWxnnvgNaAW3hyBYVrEYHk=; b=R0kMr8NEcmIA4baXbiUWhDSKqTWO64zQpvb64yxx70AIaOg/bNQy4LOiuB2iZcTGKx LUDkoK98MnSLHV3OI34i13J9u+4W07UFd1dpnIw9w78FezqhyWgJ/s/Bnzxp7YmqdtDq 89pODK35viMxdIgMrnqzmlqXCEMVSn3KsncwMrCq6QtOQgg0ljWCRQFhp+P88RGnp6vB RyKSnDIrK5Osva+xtP724WjzEZNceA1kmv05t99fcU1jLJKcmT3cyjEdi3BA+TT+jypP AE4peZwIc1MotK5W1+GG4VgDDGh7pjPq4D7MOiDA15kFyRYSaAOyq1yB/ZgrBUUzqY6o Xhjw== X-Gm-Message-State: APt69E0iWwpNq959flqlzHwBohZP8bSJ5uaSzIHwxpFT14VDGW/z26Aq 5hWF2pim9MfAHfBkf6RjCgaCKvmcODyScmn7+s+AEA== X-Google-Smtp-Source: AAOMgpfbwRf6J4gLQY2vDy1Fc3jWp4hvta7R7DKag0s6oXQmJXUKaUTOolRjJean3NmOTUaRWRY3RiSNjRrZv9sdbts= X-Received: by 2002:a50:8e09:: with SMTP id 9-v6mr5168997edw.101.1531227813211; Tue, 10 Jul 2018 06:03:33 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a50:b194:0:0:0:0:0 with HTTP; Tue, 10 Jul 2018 06:03:32 -0700 (PDT) In-Reply-To: <603dcc865358cc669cba9ec042db93e32a4c8cd5.1530881548.git.anatoly.burakov@intel.com> References: <603dcc865358cc669cba9ec042db93e32a4c8cd5.1530881548.git.anatoly.burakov@intel.com> From: Alejandro Lucero Date: Tue, 10 Jul 2018 14:03:32 +0100 Message-ID: To: Anatoly Burakov Cc: dev , srinath.mannam@broadcom.com, scott.branden@broadcom.com, Ajit Khaparde Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [RFC 02/11] eal: add function to rerieve socket index by socket ID 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: , X-List-Received-Date: Tue, 10 Jul 2018 13:03:33 -0000 On Fri, Jul 6, 2018 at 2:17 PM, Anatoly Burakov 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 > --- > 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