[dpdk-dev] [RFC 1/5] eal: add accessor functions for lcore_config

David Marchand david.marchand at redhat.com
Fri Apr 5 13:01:10 CEST 2019


On Wed, Apr 3, 2019 at 7:16 PM Stephen Hemminger <stephen at networkplumber.org>
wrote:

> diff --git a/lib/librte_eal/common/eal_common_lcore.c
> b/lib/librte_eal/common/eal_common_lcore.c
> index 1cbac42286ba..806204d9f73d 100644
> --- a/lib/librte_eal/common/eal_common_lcore.c
> +++ b/lib/librte_eal/common/eal_common_lcore.c
> @@ -16,6 +16,52 @@
>  #include "eal_private.h"
>  #include "eal_thread.h"
>
> +int rte_lcore_index(int lcore_id)
> +{
> +       if (unlikely(lcore_id >= RTE_MAX_LCORE))
> +               return -1;
> +
> +       if (lcore_id < 0)
> +               lcore_id = (int)rte_lcore_id();
> +
> +       return lcore_config[lcore_id].core_index;
> +}
>
+
> +int rte_lcore_to_cpu_id(int lcore_id)
> +{
> +       if (unlikely(lcore_id >= RTE_MAX_LCORE))
> +               return -1;
> +
> +       if (lcore_id < 0)
> +               lcore_id = (int)rte_lcore_id();
> +
> +       return lcore_config[lcore_id].core_id;
> +}
> +
> +rte_cpuset_t rte_lcore_cpuset(unsigned lcore_id)
>

unsigned int

+{
> +       return lcore_config[lcore_id].cpuset;
> +}
>

I am a bit skeptical at what dpaa wants to do with this.
Anyway, it can be used when we want to check the current cpuset.


+
> +unsigned
>

unsigned int

+rte_lcore_to_socket_id(unsigned int lcore_id)
> +{
> +       return lcore_config[lcore_id].socket_id;
> +}
> +
> +enum rte_lcore_state_t
> +rte_lcore_state(unsigned lcore_id)
>

unsigned int

+{
> +       return lcore_config[lcore_id].state;
> +}
>

This is a duplicate for existing rte_eal_get_lcore_state() in
lib/librte_eal/common/eal_common_launch.c.
So either we keep rte_eal_get_lcore_state() or we replace it with this new
one.


+
> +int
> +rte_lcore_return_code(unsigned lcore_id)
>

unsigned int

+{
> +       return lcore_config[lcore_id].ret;
> +}
>
+
> +
>

Double blank line.

 static int
>  socket_id_cmp(const void *a, const void *b)
>  {
>



-- 
David Marchand


More information about the dev mailing list