[2/4] eal: do not cache lcore detection state
Checks
Commit Message
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 | 4 +---
lib/librte_eal/common/eal_common_options.c | 10 +++++-----
lib/librte_eal/common/eal_private.h | 1 -
3 files changed, 6 insertions(+), 9 deletions(-)
@@ -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;
@@ -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) {
@@ -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 */
};