eal: do not cache lcore detection state
authorDavid Marchand <david.marchand@redhat.com>
Mon, 2 Dec 2019 15:42:01 +0000 (16:42 +0100)
committerThomas Monjalon <thomas@monjalon.net>
Mon, 20 Jan 2020 23:55:49 +0000 (00:55 +0100)
We use this state in control path only for services cores and -c/-l
options.
The value is not updated when using --lcores.

Use the internal helper where needed.

Signed-off-by: David Marchand <david.marchand@redhat.com>
lib/librte_eal/common/eal_common_lcore.c
lib/librte_eal/common/eal_common_options.c
lib/librte_eal/common/eal_private.h

index 39efade..1d16fb2 100644 (file)
@@ -139,9 +139,7 @@ rte_eal_cpu_init(void)
                socket_id = eal_cpu_socket_id(lcore_id);
                lcore_to_socket_id[lcore_id] = socket_id;
 
-               /* in 1:1 mapping, record related cpu detected state */
-               lcore_config[lcore_id].detected = eal_cpu_detected(lcore_id);
-               if (lcore_config[lcore_id].detected == 0) {
+               if (eal_cpu_detected(lcore_id) == 0) {
                        config->lcore_role[lcore_id] = ROLE_OFF;
                        lcore_config[lcore_id].core_index = -1;
                        continue;
index a7f9c5f..68f7d1c 100644 (file)
@@ -373,7 +373,7 @@ eal_parse_service_coremask(const char *coremask)
                                        return -1;
                                }
 
-                               if (!lcore_config[idx].detected) {
+                               if (eal_cpu_detected(idx) == 0) {
                                        RTE_LOG(ERR, EAL,
                                                "lcore %u unavailable\n", idx);
                                        return -1;
@@ -429,7 +429,7 @@ update_lcore_config(int *cores)
 
        for (i = 0; i < RTE_MAX_LCORE; i++) {
                if (cores[i] != -1) {
-                       if (!lcore_config[i].detected) {
+                       if (eal_cpu_detected(i) == 0) {
                                RTE_LOG(ERR, EAL, "lcore %u unavailable\n", i);
                                ret = -1;
                                continue;
@@ -785,7 +785,7 @@ convert_to_cpuset(rte_cpuset_t *cpusetp,
                if (!set[idx])
                        continue;
 
-               if (!lcore_config[idx].detected) {
+               if (eal_cpu_detected(idx) == 0) {
                        RTE_LOG(ERR, EAL, "core %u "
                                "unavailable\n", idx);
                        return -1;
@@ -1138,7 +1138,7 @@ available_cores(void)
 
        /* find the first available cpu */
        for (idx = 0; idx < RTE_MAX_LCORE; idx++) {
-               if (!lcore_config[idx].detected)
+               if (eal_cpu_detected(idx) == 0)
                        continue;
                break;
        }
@@ -1152,7 +1152,7 @@ available_cores(void)
        sequence = 0;
 
        for (idx++ ; idx < RTE_MAX_LCORE; idx++) {
-               if (!lcore_config[idx].detected)
+               if (eal_cpu_detected(idx) == 0)
                        continue;
 
                if (idx == previous + 1) {
index 8a9d493..ddcfbe2 100644 (file)
@@ -29,7 +29,6 @@ struct lcore_config {
        unsigned int core_id;      /**< core number on socket for this lcore */
        int core_index;            /**< relative index, starting from 0 */
        uint8_t core_role;         /**< role of core eg: OFF, RTE, SERVICE */
-       uint8_t detected;          /**< true if lcore was detected */
 
        rte_cpuset_t cpuset;       /**< cpu set which the lcore affinity to */
 };