From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id A0956A0350; Wed, 1 Jul 2020 21:47:12 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2F0171C1CB; Wed, 1 Jul 2020 21:47:04 +0200 (CEST) Received: from mail-pf1-f196.google.com (mail-pf1-f196.google.com [209.85.210.196]) by dpdk.org (Postfix) with ESMTP id E767A1C1B3 for ; Wed, 1 Jul 2020 21:47:02 +0200 (CEST) Received: by mail-pf1-f196.google.com with SMTP id u185so9401943pfu.1 for ; Wed, 01 Jul 2020 12:47:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ZTd1TA8NHjAVGfiO8a9O+yoH6csOcCI14iFvVl4Ny+o=; b=PucKM2TcgphGG3YSQOS5+2SGcEtvp7ZLZFg9EmXz2K9jJxZMXaG1/CIfQQ7OIzTx3A XRnVAgrOHzSm5LayXiWxHFZ5Edl4HArlBTh5THuZZ1u3lVpYVEQdGRMUMOquahwZWSqx usSFDZZNPcECQY3TIH3YG9lc0yfjCplE5nzTrcJpYcJ32GPEo55CVuAe4los/wIcJH28 Uma9R0X84fML7p5SBqE4aS5s+lzEXZnZyc4F+apEl3ZAgk75/9iCF1MEQ4FRQKdBFsC1 1gRMrsyYg8Ie+AY3v2EhwM5h/nNIpJZ8w8hofd8ayFSZFwer/vdaLtrFGkOJE/Ly8g29 Ok9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZTd1TA8NHjAVGfiO8a9O+yoH6csOcCI14iFvVl4Ny+o=; b=L5wFlO7Yj3VcABWkybExwvbzVW/3oD3fgDBiqpezc4bBPHc5+Fg+14J+s54r9sBBIB idQvpa4VgUyb55pA+OTJA5rajdR25CvPRErrA+Axxd3rpMynHplFCn8tAfH/Drw9tw84 ApCRqKCManSJc+h382OcE69ymkabbMTa1x3/v+erXBdHjxc+ivyA7cuaYMFjHG4XLYvX NX/+28ULrv4EFUpzj8qaGtMrY5o40R65IxeI3M3b2RM4NRr+Rk/0BqfutBkTkGp4rJeS mu/d+09haKjnhQm5fj3qAr4F8U/WlkLCuIIn50B2D3XOmwY5WQmxX2TduVnVUXbYwuFW /tSA== X-Gm-Message-State: AOAM531tgtVnhs3keUTVxtnPWIWlkGyfaHuOGj9dqdgd1H4wppfvVxtM dKtAsc+5ehtpvWxFywHCfKC7UbCPy0I= X-Google-Smtp-Source: ABdhPJy0yXfNRNAEeeV5Vt0csLi04TNqjliXNQ9kGrjooMu2Qq4ccbPjdXmhbDgmqjL4h3g8PZxg0Q== X-Received: by 2002:a62:8045:: with SMTP id j66mr24964815pfd.162.1593632820616; Wed, 01 Jul 2020 12:47:00 -0700 (PDT) Received: from hermes.corp.microsoft.com (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id n14sm6501870pgd.78.2020.07.01.12.46.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jul 2020 12:46:59 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Wed, 1 Jul 2020 12:46:24 -0700 Message-Id: <20200701194650.10705-2-stephen@networkplumber.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200701194650.10705-1-stephen@networkplumber.org> References: <20200604210200.25405-1-stephen@networkplumber.org> <20200701194650.10705-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v3 01/27] eal: rename terms used for DPDK lcores 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Replace the old use of master/slave lcore with more inclusive name of initial/secondary lcore. The old visible API will stay for now. Change master2slave to new init2worker and vice-versa. This patch breaks the expected practice for new API's. The new rte_get_initial_lcore() will not go through the standard experimental API phase; there is no functional difference from the previous name. Signed-off-by: Stephen Hemminger --- doc/guides/nics/memif.rst | 4 +- lib/librte_eal/common/eal_common_launch.c | 36 ++++++------- lib/librte_eal/common/eal_common_lcore.c | 11 ++-- lib/librte_eal/common/eal_common_options.c | 62 +++++++++++----------- lib/librte_eal/common/eal_options.h | 4 +- lib/librte_eal/common/eal_private.h | 6 +-- lib/librte_eal/common/eal_thread.h | 6 +-- lib/librte_eal/common/rte_random.c | 2 +- lib/librte_eal/common/rte_service.c | 2 +- lib/librte_eal/freebsd/eal.c | 31 +++++++---- lib/librte_eal/freebsd/eal_thread.c | 34 ++++++------ lib/librte_eal/include/rte_eal.h | 4 +- lib/librte_eal/include/rte_eal_trace.h | 4 +- lib/librte_eal/include/rte_launch.h | 62 ++++++++++++---------- lib/librte_eal/include/rte_lcore.h | 29 +++++++--- lib/librte_eal/linux/eal.c | 24 ++++----- lib/librte_eal/linux/eal_memory.c | 10 ++-- lib/librte_eal/linux/eal_thread.c | 34 ++++++------ lib/librte_eal/rte_eal_version.map | 1 + lib/librte_eal/windows/eal.c | 18 ++++--- lib/librte_eal/windows/eal_thread.c | 32 +++++------ 21 files changed, 230 insertions(+), 186 deletions(-) diff --git a/doc/guides/nics/memif.rst b/doc/guides/nics/memif.rst index ddeebed25ccd..9c67d7141cbe 100644 --- a/doc/guides/nics/memif.rst +++ b/doc/guides/nics/memif.rst @@ -106,13 +106,13 @@ region n (no-zero-copy): +-----------------------+-------------------------------------------------------------------------+ | Rings | Buffers | +-----------+-----------+-----------------+---+---------------------------------------------------+ -| S2M rings | M2S rings | packet buffer 0 | . | pb ((1 << pmd->run.log2_ring_size)*(s2m + m2s))-1 | +| S2M rings | M2S rings | packet buffer 0 | . | pb ((1 << pmd->run.log2_ring_size)*(w2i + i2w))-1 | +-----------+-----------+-----------------+---+---------------------------------------------------+ S2M OR M2S Rings: +--------+--------+-----------------------+ -| ring 0 | ring 1 | ring num_s2m_rings - 1| +| ring 0 | ring 1 | ring num_w2i_rings - 1| +--------+--------+-----------------------+ ring 0: diff --git a/lib/librte_eal/common/eal_common_launch.c b/lib/librte_eal/common/eal_common_launch.c index cf52d717f68e..43a0af196db2 100644 --- a/lib/librte_eal/common/eal_common_launch.c +++ b/lib/librte_eal/common/eal_common_launch.c @@ -21,55 +21,55 @@ * Wait until a lcore finished its job. */ int -rte_eal_wait_lcore(unsigned slave_id) +rte_eal_wait_lcore(unsigned worker_id) { - if (lcore_config[slave_id].state == WAIT) + if (lcore_config[worker_id].state == WAIT) return 0; - while (lcore_config[slave_id].state != WAIT && - lcore_config[slave_id].state != FINISHED) + while (lcore_config[worker_id].state != WAIT && + lcore_config[worker_id].state != FINISHED) rte_pause(); rte_rmb(); /* we are in finished state, go to wait state */ - lcore_config[slave_id].state = WAIT; - return lcore_config[slave_id].ret; + lcore_config[worker_id].state = WAIT; + return lcore_config[worker_id].ret; } /* - * Check that every SLAVE lcores are in WAIT state, then call - * rte_eal_remote_launch() for all of them. If call_master is true - * (set to CALL_MASTER), also call the function on the master lcore. + * Check that every WORKER lcores are in WAIT state, then call + * rte_eal_remote_launch() for all of them. If call_initial is true + * (set to CALL_INITIAL), also call the function on the initial lcore. */ int rte_eal_mp_remote_launch(int (*f)(void *), void *arg, - enum rte_rmt_call_master_t call_master) + enum rte_rmt_call_initial_t call_initial) { int lcore_id; - int master = rte_get_master_lcore(); + int initial = rte_get_initial_lcore(); /* check state of lcores */ - RTE_LCORE_FOREACH_SLAVE(lcore_id) { + RTE_LCORE_FOREACH_WORKER(lcore_id) { if (lcore_config[lcore_id].state != WAIT) return -EBUSY; } /* send messages to cores */ - RTE_LCORE_FOREACH_SLAVE(lcore_id) { + RTE_LCORE_FOREACH_WORKER(lcore_id) { rte_eal_remote_launch(f, arg, lcore_id); } - if (call_master == CALL_MASTER) { - lcore_config[master].ret = f(arg); - lcore_config[master].state = FINISHED; + if (call_initial == CALL_INITIAL) { + lcore_config[initial].ret = f(arg); + lcore_config[initial].state = FINISHED; } return 0; } /* - * Return the state of the lcore identified by slave_id. + * Return the state of the lcore identified by worker_id. */ enum rte_lcore_state_t rte_eal_get_lcore_state(unsigned lcore_id) @@ -86,7 +86,7 @@ rte_eal_mp_wait_lcore(void) { unsigned lcore_id; - RTE_LCORE_FOREACH_SLAVE(lcore_id) { + RTE_LCORE_FOREACH_WORKER(lcore_id) { rte_eal_wait_lcore(lcore_id); } } diff --git a/lib/librte_eal/common/eal_common_lcore.c b/lib/librte_eal/common/eal_common_lcore.c index 5404922a87d2..a8c8b7206992 100644 --- a/lib/librte_eal/common/eal_common_lcore.c +++ b/lib/librte_eal/common/eal_common_lcore.c @@ -16,9 +16,14 @@ #include "eal_private.h" #include "eal_thread.h" +unsigned int rte_get_initial_lcore(void) +{ + return rte_eal_get_configuration()->initial_lcore; +} + unsigned int rte_get_master_lcore(void) { - return rte_eal_get_configuration()->master_lcore; + return rte_eal_get_configuration()->initial_lcore; } unsigned int rte_lcore_count(void) @@ -72,7 +77,7 @@ int rte_lcore_is_enabled(unsigned int lcore_id) return cfg->lcore_role[lcore_id] == ROLE_RTE; } -unsigned int rte_get_next_lcore(unsigned int i, int skip_master, int wrap) +unsigned int rte_get_next_lcore(unsigned int i, int skip_initial, int wrap) { i++; if (wrap) @@ -80,7 +85,7 @@ unsigned int rte_get_next_lcore(unsigned int i, int skip_master, int wrap) while (i < RTE_MAX_LCORE) { if (!rte_lcore_is_enabled(i) || - (skip_master && (i == rte_get_master_lcore()))) { + (skip_initial && (i == rte_get_initial_lcore()))) { i++; if (wrap) i %= RTE_MAX_LCORE; diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c index 24b223ebfd0f..48a82cce9ad7 100644 --- a/lib/librte_eal/common/eal_common_options.c +++ b/lib/librte_eal/common/eal_common_options.c @@ -79,7 +79,7 @@ eal_long_options[] = { {OPT_TRACE_DIR, 1, NULL, OPT_TRACE_DIR_NUM }, {OPT_TRACE_BUF_SIZE, 1, NULL, OPT_TRACE_BUF_SIZE_NUM }, {OPT_TRACE_MODE, 1, NULL, OPT_TRACE_MODE_NUM }, - {OPT_MASTER_LCORE, 1, NULL, OPT_MASTER_LCORE_NUM }, + {OPT_INITIAL_LCORE, 1, NULL, OPT_INITIAL_LCORE_NUM }, {OPT_MBUF_POOL_OPS_NAME, 1, NULL, OPT_MBUF_POOL_OPS_NAME_NUM}, {OPT_NO_HPET, 0, NULL, OPT_NO_HPET_NUM }, {OPT_NO_HUGE, 0, NULL, OPT_NO_HUGE_NUM }, @@ -142,7 +142,7 @@ struct device_option { static struct device_option_list devopt_list = TAILQ_HEAD_INITIALIZER(devopt_list); -static int master_lcore_parsed; +static int initial_lcore_parsed; static int mem_parsed; static int core_parsed; @@ -485,12 +485,12 @@ eal_parse_service_coremask(const char *coremask) for (j = 0; j < BITS_PER_HEX && idx < RTE_MAX_LCORE; j++, idx++) { if ((1 << j) & val) { - /* handle master lcore already parsed */ + /* handle initial lcore already parsed */ uint32_t lcore = idx; - if (master_lcore_parsed && - cfg->master_lcore == lcore) { + if (initial_lcore_parsed && + cfg->initial_lcore == lcore) { RTE_LOG(ERR, EAL, - "lcore %u is master lcore, cannot use as service core\n", + "lcore %u is initial lcore, cannot use as service core\n", idx); return -1; } @@ -658,12 +658,12 @@ eal_parse_service_corelist(const char *corelist) min = idx; for (idx = min; idx <= max; idx++) { if (cfg->lcore_role[idx] != ROLE_SERVICE) { - /* handle master lcore already parsed */ + /* handle initial lcore already parsed */ uint32_t lcore = idx; - if (cfg->master_lcore == lcore && - master_lcore_parsed) { + if (cfg->initial_lcore == lcore && + initial_lcore_parsed) { RTE_LOG(ERR, EAL, - "Error: lcore %u is master lcore, cannot use as service core\n", + "Error: lcore %u is initial lcore, cannot use as service core\n", idx); return -1; } @@ -746,25 +746,25 @@ eal_parse_corelist(const char *corelist, int *cores) return 0; } -/* Changes the lcore id of the master thread */ +/* Changes the lcore id of the initial thread */ static int -eal_parse_master_lcore(const char *arg) +eal_parse_initial_lcore(const char *arg) { char *parsing_end; struct rte_config *cfg = rte_eal_get_configuration(); errno = 0; - cfg->master_lcore = (uint32_t) strtol(arg, &parsing_end, 0); + cfg->initial_lcore = (uint32_t) strtol(arg, &parsing_end, 0); if (errno || parsing_end[0] != 0) return -1; - if (cfg->master_lcore >= RTE_MAX_LCORE) + if (cfg->initial_lcore >= RTE_MAX_LCORE) return -1; - master_lcore_parsed = 1; + initial_lcore_parsed = 1; - /* ensure master core is not used as service core */ - if (lcore_config[cfg->master_lcore].core_role == ROLE_SERVICE) { + /* ensure initial core is not used as service core */ + if (lcore_config[cfg->initial_lcore].core_role == ROLE_SERVICE) { RTE_LOG(ERR, EAL, - "Error: Master lcore is used as a service core\n"); + "Error: Initial lcore is used as a service core\n"); return -1; } @@ -1502,10 +1502,10 @@ eal_parse_common_option(int opt, const char *optarg, conf->process_type = eal_parse_proc_type(optarg); break; - case OPT_MASTER_LCORE_NUM: - if (eal_parse_master_lcore(optarg) < 0) { + case OPT_INITIAL_LCORE_NUM: + if (eal_parse_initial_lcore(optarg) < 0) { RTE_LOG(ERR, EAL, "invalid parameter for --" - OPT_MASTER_LCORE "\n"); + OPT_INITIAL_LCORE "\n"); return -1; } break; @@ -1673,9 +1673,9 @@ compute_ctrl_threads_cpuset(struct internal_config *internal_cfg) RTE_CPU_AND(cpuset, cpuset, &default_set); - /* if no remaining cpu, use master lcore cpu affinity */ + /* if no remaining cpu, use initial lcore cpu affinity */ if (!CPU_COUNT(cpuset)) { - memcpy(cpuset, &lcore_config[rte_get_master_lcore()].cpuset, + memcpy(cpuset, &lcore_config[rte_get_initial_lcore()].cpuset, sizeof(*cpuset)); } } @@ -1707,12 +1707,12 @@ eal_adjust_config(struct internal_config *internal_cfg) if (internal_conf->process_type == RTE_PROC_AUTO) internal_conf->process_type = eal_proc_type_detect(); - /* default master lcore is the first one */ - if (!master_lcore_parsed) { - cfg->master_lcore = rte_get_next_lcore(-1, 0, 0); - if (cfg->master_lcore >= RTE_MAX_LCORE) + /* default initial lcore is the first one */ + if (!initial_lcore_parsed) { + cfg->initial_lcore = rte_get_next_lcore(-1, 0, 0); + if (cfg->initial_lcore >= RTE_MAX_LCORE) return -1; - lcore_config[cfg->master_lcore].core_role = ROLE_RTE; + lcore_config[cfg->initial_lcore].core_role = ROLE_RTE; } compute_ctrl_threads_cpuset(internal_cfg); @@ -1732,8 +1732,8 @@ eal_check_common_options(struct internal_config *internal_cfg) const struct internal_config *internal_conf = eal_get_internal_configuration(); - if (cfg->lcore_role[cfg->master_lcore] != ROLE_RTE) { - RTE_LOG(ERR, EAL, "Master lcore is not enabled for DPDK\n"); + if (cfg->lcore_role[cfg->initial_lcore] != ROLE_RTE) { + RTE_LOG(ERR, EAL, "Initial lcore is not enabled for DPDK\n"); return -1; } @@ -1831,7 +1831,7 @@ eal_common_usage(void) " '( )' can be omitted for single element group,\n" " '@' can be omitted if cpus and lcores have the same value\n" " -s SERVICE COREMASK Hexadecimal bitmask of cores to be used as service cores\n" - " --"OPT_MASTER_LCORE" ID Core ID that is used as master\n" + " --"OPT_INITIAL_LCORE" ID Core ID that is used as initial\n" " --"OPT_MBUF_POOL_OPS_NAME" Pool ops name for mbuf to use\n" " -n CHANNELS Number of memory channels\n" " -m MB Memory to allocate (see also --"OPT_SOCKET_MEM")\n" diff --git a/lib/librte_eal/common/eal_options.h b/lib/librte_eal/common/eal_options.h index 18e6da9ab37b..0ffe1a5ec0a3 100644 --- a/lib/librte_eal/common/eal_options.h +++ b/lib/librte_eal/common/eal_options.h @@ -43,8 +43,8 @@ enum { OPT_TRACE_BUF_SIZE_NUM, #define OPT_TRACE_MODE "trace-mode" OPT_TRACE_MODE_NUM, -#define OPT_MASTER_LCORE "master-lcore" - OPT_MASTER_LCORE_NUM, +#define OPT_INITIAL_LCORE "initial-lcore" + OPT_INITIAL_LCORE_NUM, #define OPT_MBUF_POOL_OPS_NAME "mbuf-pool-ops-name" OPT_MBUF_POOL_OPS_NAME_NUM, #define OPT_PROC_TYPE "proc-type" diff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h index 46bcae930590..9ef057d9b0f3 100644 --- a/lib/librte_eal/common/eal_private.h +++ b/lib/librte_eal/common/eal_private.h @@ -20,8 +20,8 @@ */ struct lcore_config { pthread_t thread_id; /**< pthread identifier */ - int pipe_master2slave[2]; /**< communication pipe with master */ - int pipe_slave2master[2]; /**< communication pipe with master */ + int pipe_init2worker[2]; /**< communication pipe with initial core */ + int pipe_worker2init[2]; /**< communication pipe with initial core */ lcore_function_t * volatile f; /**< function to call */ void * volatile arg; /**< argument of function */ @@ -42,7 +42,7 @@ extern struct lcore_config lcore_config[RTE_MAX_LCORE]; * The global RTE configuration structure. */ struct rte_config { - uint32_t master_lcore; /**< Id of the master lcore */ + uint32_t initial_lcore; /**< Id of the initial lcore */ uint32_t lcore_count; /**< Number of available logical cores. */ uint32_t numa_node_count; /**< Number of detected NUMA nodes. */ uint32_t numa_nodes[RTE_MAX_NUMA_NODES]; /**< List of detected NUMA nodes. */ diff --git a/lib/librte_eal/common/eal_thread.h b/lib/librte_eal/common/eal_thread.h index b40ed249edab..35301d852bc2 100644 --- a/lib/librte_eal/common/eal_thread.h +++ b/lib/librte_eal/common/eal_thread.h @@ -16,12 +16,12 @@ __rte_noreturn void *eal_thread_loop(void *arg); /** - * Init per-lcore info for master thread + * Init per-lcore info for initial thread * * @param lcore_id - * identifier of master lcore + * identifier of initial lcore */ -void eal_thread_init_master(unsigned lcore_id); +void eal_thread_initial_lcore(unsigned lcore_id); /** * Get the NUMA socket id from cpu id. diff --git a/lib/librte_eal/common/rte_random.c b/lib/librte_eal/common/rte_random.c index b7a089ac4fe0..6bae53bdf659 100644 --- a/lib/librte_eal/common/rte_random.c +++ b/lib/librte_eal/common/rte_random.c @@ -122,7 +122,7 @@ struct rte_rand_state *__rte_rand_get_state(void) lcore_id = rte_lcore_id(); if (unlikely(lcore_id == LCORE_ID_ANY)) - lcore_id = rte_get_master_lcore(); + lcore_id = rte_get_initial_lcore(); return &rand_states[lcore_id]; } diff --git a/lib/librte_eal/common/rte_service.c b/lib/librte_eal/common/rte_service.c index 6123a2124d33..6a80b1675559 100644 --- a/lib/librte_eal/common/rte_service.c +++ b/lib/librte_eal/common/rte_service.c @@ -106,7 +106,7 @@ rte_service_init(void) struct rte_config *cfg = rte_eal_get_configuration(); for (i = 0; i < RTE_MAX_LCORE; i++) { if (lcore_config[i].core_role == ROLE_SERVICE) { - if ((unsigned int)i == cfg->master_lcore) + if ((unsigned int)i == cfg->initial_lcore) continue; rte_service_lcore_add(i); count++; diff --git a/lib/librte_eal/freebsd/eal.c b/lib/librte_eal/freebsd/eal.c index 8c75cba79a71..c7cc79ce65c3 100644 --- a/lib/librte_eal/freebsd/eal.c +++ b/lib/librte_eal/freebsd/eal.c @@ -622,10 +622,14 @@ eal_check_mem_on_local_socket(void) int socket_id; const struct rte_config *config = rte_eal_get_configuration(); +<<<<<<< HEAD socket_id = rte_lcore_to_socket_id(config->master_lcore); +======= + socket_id = rte_lcore_to_socket_id(rte_config.initial_lcore); +>>>>>>> 28604a3e5a3a... eal: rename terms used for DPDK lcores if (rte_memseg_list_walk(check_socket, &socket_id) == 0) - RTE_LOG(WARNING, EAL, "WARNING: Master core has no memory on local socket!\n"); + RTE_LOG(WARNING, EAL, "WARNING: Initial core has no memory on local socket!\n"); } @@ -845,23 +849,32 @@ rte_eal_init(int argc, char **argv) eal_check_mem_on_local_socket(); - eal_thread_init_master(config->master_lcore); +<<<<<<< HEAD + eal_thread_initial_lcore(config->master_lcore); ret = eal_thread_dump_affinity(cpuset, sizeof(cpuset)); RTE_LOG(DEBUG, EAL, "Master lcore %u is ready (tid=%p;cpuset=[%s%s])\n", config->master_lcore, thread_id, cpuset, +======= + eal_thread_set_initial_lcore(rte_config.initial_lcore); + + ret = eal_thread_dump_affinity(cpuset, sizeof(cpuset)); + + RTE_LOG(DEBUG, EAL, "Initial lcore %u is ready (tid=%p;cpuset=[%s%s])\n", + rte_config.initial_lcore, thread_id, cpuset, +>>>>>>> 28604a3e5a3a... eal: rename terms used for DPDK lcores ret == 0 ? "" : "..."); - RTE_LCORE_FOREACH_SLAVE(i) { + RTE_LCORE_FOREACH_WORKER(i) { /* - * create communication pipes between master thread + * create communication pipes between initial thread * and children */ - if (pipe(lcore_config[i].pipe_master2slave) < 0) + if (pipe(lcore_config[i].pipe_init2worker) < 0) rte_panic("Cannot create pipe\n"); - if (pipe(lcore_config[i].pipe_slave2master) < 0) + if (pipe(lcore_config[i].pipe_worker2init) < 0) rte_panic("Cannot create pipe\n"); lcore_config[i].state = WAIT; @@ -874,15 +887,15 @@ rte_eal_init(int argc, char **argv) /* Set thread_name for aid in debugging. */ snprintf(thread_name, sizeof(thread_name), - "lcore-slave-%d", i); + "lcore-work-%d", i); rte_thread_setname(lcore_config[i].thread_id, thread_name); } /* - * Launch a dummy function on all slave lcores, so that master lcore + * Launch a dummy function on all worker lcores, so that initial lcore * knows they are all ready when this function returns. */ - rte_eal_mp_remote_launch(sync_func, NULL, SKIP_MASTER); + rte_eal_mp_remote_launch(sync_func, NULL, SKIP_INITIAL); rte_eal_mp_wait_lcore(); /* initialize services so vdevs register service during bus_probe. */ diff --git a/lib/librte_eal/freebsd/eal_thread.c b/lib/librte_eal/freebsd/eal_thread.c index b52019782ac6..5fff09c017c1 100644 --- a/lib/librte_eal/freebsd/eal_thread.c +++ b/lib/librte_eal/freebsd/eal_thread.c @@ -30,35 +30,35 @@ RTE_DEFINE_PER_LCORE(unsigned, _socket_id) = (unsigned)SOCKET_ID_ANY; RTE_DEFINE_PER_LCORE(rte_cpuset_t, _cpuset); /* - * Send a message to a slave lcore identified by slave_id to call a + * Send a message to a worker lcore identified by worker_id to call a * function f with argument arg. Once the execution is done, the * remote lcore switch in FINISHED state. */ int -rte_eal_remote_launch(int (*f)(void *), void *arg, unsigned slave_id) +rte_eal_remote_launch(int (*f)(void *), void *arg, unsigned worker_id) { int n; char c = 0; - int m2s = lcore_config[slave_id].pipe_master2slave[1]; - int s2m = lcore_config[slave_id].pipe_slave2master[0]; + int i2w = lcore_config[worker_id].pipe_init2worker[1]; + int w2i = lcore_config[worker_id].pipe_worker2init[0]; int rc = -EBUSY; - if (lcore_config[slave_id].state != WAIT) + if (lcore_config[worker_id].state != WAIT) goto finish; - lcore_config[slave_id].f = f; - lcore_config[slave_id].arg = arg; + lcore_config[worker_id].f = f; + lcore_config[worker_id].arg = arg; /* send message */ n = 0; while (n == 0 || (n < 0 && errno == EINTR)) - n = write(m2s, &c, 1); + n = write(i2w, &c, 1); if (n < 0) rte_panic("cannot write on configuration pipe\n"); /* wait ack */ do { - n = read(s2m, &c, 1); + n = read(w2i, &c, 1); } while (n < 0 && errno == EINTR); if (n <= 0) @@ -66,7 +66,7 @@ rte_eal_remote_launch(int (*f)(void *), void *arg, unsigned slave_id) rc = 0; finish: - rte_eal_trace_thread_remote_launch(f, arg, slave_id, rc); + rte_eal_trace_thread_remote_launch(f, arg, worker_id, rc); return rc; } @@ -83,7 +83,7 @@ eal_thread_set_affinity(void) return rte_thread_set_affinity(&lcore_config[lcore_id].cpuset); } -void eal_thread_init_master(unsigned lcore_id) +void eal_thread_set_initial_lcore(unsigned lcore_id) { /* set the lcore ID in per-lcore memory area */ RTE_PER_LCORE(_lcore_id) = lcore_id; @@ -101,21 +101,21 @@ eal_thread_loop(__rte_unused void *arg) int n, ret; unsigned lcore_id; pthread_t thread_id; - int m2s, s2m; + int i2w, w2i; char cpuset[RTE_CPU_AFFINITY_STR_LEN]; thread_id = pthread_self(); /* retrieve our lcore_id from the configuration structure */ - RTE_LCORE_FOREACH_SLAVE(lcore_id) { + RTE_LCORE_FOREACH_WORKER(lcore_id) { if (thread_id == lcore_config[lcore_id].thread_id) break; } if (lcore_id == RTE_MAX_LCORE) rte_panic("cannot retrieve lcore id\n"); - m2s = lcore_config[lcore_id].pipe_master2slave[0]; - s2m = lcore_config[lcore_id].pipe_slave2master[1]; + i2w = lcore_config[lcore_id].pipe_init2worker[0]; + w2i = lcore_config[lcore_id].pipe_worker2init[1]; /* set the lcore ID in per-lcore memory area */ RTE_PER_LCORE(_lcore_id) = lcore_id; @@ -138,7 +138,7 @@ eal_thread_loop(__rte_unused void *arg) /* wait command */ do { - n = read(m2s, &c, 1); + n = read(i2w, &c, 1); } while (n < 0 && errno == EINTR); if (n <= 0) @@ -149,7 +149,7 @@ eal_thread_loop(__rte_unused void *arg) /* send ack */ n = 0; while (n == 0 || (n < 0 && errno == EINTR)) - n = write(s2m, &c, 1); + n = write(w2i, &c, 1); if (n < 0) rte_panic("cannot write on configuration pipe\n"); diff --git a/lib/librte_eal/include/rte_eal.h b/lib/librte_eal/include/rte_eal.h index 2f9ed298de63..c01b9e913d48 100644 --- a/lib/librte_eal/include/rte_eal.h +++ b/lib/librte_eal/include/rte_eal.h @@ -73,11 +73,11 @@ int rte_eal_iopl_init(void); /** * Initialize the Environment Abstraction Layer (EAL). * - * This function is to be executed on the MASTER lcore only, as soon + * This function is to be executed on the initial lcore only, as soon * as possible in the application's main() function. * * The function finishes the initialization process before main() is called. - * It puts the SLAVE lcores in the WAIT state. + * It puts the worker lcores in the WAIT state. * * When the multi-partition feature is supported, depending on the * configuration (if CONFIG_RTE_EAL_MAIN_PARTITION is disabled), this diff --git a/lib/librte_eal/include/rte_eal_trace.h b/lib/librte_eal/include/rte_eal_trace.h index bcfef0cfaa62..f2b47184d72f 100644 --- a/lib/librte_eal/include/rte_eal_trace.h +++ b/lib/librte_eal/include/rte_eal_trace.h @@ -210,10 +210,10 @@ RTE_TRACE_POINT( RTE_TRACE_POINT( rte_eal_trace_thread_remote_launch, RTE_TRACE_POINT_ARGS(int (*f)(void *), void *arg, - unsigned int slave_id, int rc), + unsigned int worker_id, int rc), rte_trace_point_emit_ptr(f); rte_trace_point_emit_ptr(arg); - rte_trace_point_emit_u32(slave_id); + rte_trace_point_emit_u32(worker_id); rte_trace_point_emit_int(rc); ) RTE_TRACE_POINT( diff --git a/lib/librte_eal/include/rte_launch.h b/lib/librte_eal/include/rte_launch.h index 06a671752ace..9b68685d99d4 100644 --- a/lib/librte_eal/include/rte_launch.h +++ b/lib/librte_eal/include/rte_launch.h @@ -32,12 +32,12 @@ typedef int (lcore_function_t)(void *); /** * Launch a function on another lcore. * - * To be executed on the MASTER lcore only. + * To be executed on the INITIAL lcore only. * - * Sends a message to a slave lcore (identified by the slave_id) that + * Sends a message to a worker lcore (identified by the id) that * is in the WAIT state (this is true after the first call to * rte_eal_init()). This can be checked by first calling - * rte_eal_wait_lcore(slave_id). + * rte_eal_wait_lcore(id). * * When the remote lcore receives the message, it switches to * the RUNNING state, then calls the function f with argument arg. Once the @@ -45,7 +45,7 @@ typedef int (lcore_function_t)(void *); * the return value of f is stored in a local variable to be read using * rte_eal_wait_lcore(). * - * The MASTER lcore returns as soon as the message is sent and knows + * The INITIAL lcore returns as soon as the message is sent and knows * nothing about the completion of f. * * Note: This function is not designed to offer optimum @@ -56,37 +56,43 @@ typedef int (lcore_function_t)(void *); * The function to be called. * @param arg * The argument for the function. - * @param slave_id + * @param id * The identifier of the lcore on which the function should be executed. * @return * - 0: Success. Execution of function f started on the remote lcore. * - (-EBUSY): The remote lcore is not in a WAIT state. */ -int rte_eal_remote_launch(lcore_function_t *f, void *arg, unsigned slave_id); +int rte_eal_remote_launch(lcore_function_t *f, void *arg, unsigned id); /** - * This enum indicates whether the master core must execute the handler + * This enum indicates whether the initial core must execute the handler * launched on all logical cores. */ -enum rte_rmt_call_master_t { - SKIP_MASTER = 0, /**< lcore handler not executed by master core. */ - CALL_MASTER, /**< lcore handler executed by master core. */ +enum rte_rmt_call_initial_t { + SKIP_INITIAL = 0, /**< lcore handler not executed by initial core. */ + CALL_INITIAL, /**< lcore handler executed by initial core. */ }; +/** + * Deprecated backward compatiable definitions + */ +#define SKIP_MASTER SKIP_INITIAL +#define CALL_MASTER CALL_INITIAL + /** * Launch a function on all lcores. * - * Check that each SLAVE lcore is in a WAIT state, then call + * Check that each worker lcore is in a WAIT state, then call * rte_eal_remote_launch() for each lcore. * * @param f * The function to be called. * @param arg * The argument for the function. - * @param call_master - * If call_master set to SKIP_MASTER, the MASTER lcore does not call - * the function. If call_master is set to CALL_MASTER, the function - * is also called on master before returning. In any case, the master + * @param call_initial + * If call_initial set to SKIP_INITIAL, the INITIAL lcore does not call + * the function. If call_initial is set to CALL_INITIAL, the function + * is also called on initial before returning. In any case, the initial * lcore returns as soon as it finished its job and knows nothing * about the completion of f on the other lcores. * @return @@ -95,49 +101,49 @@ enum rte_rmt_call_master_t { * case, no message is sent to any of the lcores. */ int rte_eal_mp_remote_launch(lcore_function_t *f, void *arg, - enum rte_rmt_call_master_t call_master); + enum rte_rmt_call_initial_t call_initial); /** - * Get the state of the lcore identified by slave_id. + * Get the state of the lcore identified by id. * - * To be executed on the MASTER lcore only. + * To be executed on the INITIAL lcore only. * - * @param slave_id + * @param id * The identifier of the lcore. * @return * The state of the lcore. */ -enum rte_lcore_state_t rte_eal_get_lcore_state(unsigned slave_id); +enum rte_lcore_state_t rte_eal_get_lcore_state(unsigned id); /** * Wait until an lcore finishes its job. * - * To be executed on the MASTER lcore only. + * To be executed on the INITIAL lcore only. * - * If the slave lcore identified by the slave_id is in a FINISHED state, + * If the lcore identified by the id is in a FINISHED state, * switch to the WAIT state. If the lcore is in RUNNING state, wait until * the lcore finishes its job and moves to the FINISHED state. * - * @param slave_id + * @param id * The identifier of the lcore. * @return - * - 0: If the lcore identified by the slave_id is in a WAIT state. + * - 0: If the lcore identified by the id is in a WAIT state. * - The value that was returned by the previous remote launch - * function call if the lcore identified by the slave_id was in a + * function call if the lcore identified by the id was in a * FINISHED or RUNNING state. In this case, it changes the state * of the lcore to WAIT. */ -int rte_eal_wait_lcore(unsigned slave_id); +int rte_eal_wait_lcore(unsigned id); /** * Wait until all lcores finish their jobs. * - * To be executed on the MASTER lcore only. Issue an + * To be executed on the INITIAL lcore only. Issue an * rte_eal_wait_lcore() for every lcore. The return values are * ignored. * * After a call to rte_eal_mp_wait_lcore(), the caller can assume - * that all slave lcores are in a WAIT state. + * that all worker lcores are in a WAIT state. */ void rte_eal_mp_wait_lcore(void); diff --git a/lib/librte_eal/include/rte_lcore.h b/lib/librte_eal/include/rte_lcore.h index 339046bc8691..069cb1f427b9 100644 --- a/lib/librte_eal/include/rte_lcore.h +++ b/lib/librte_eal/include/rte_lcore.h @@ -54,10 +54,18 @@ rte_lcore_id(void) } /** - * Get the id of the master lcore + * Get the id of the initial lcore * * @return - * the id of the master lcore + * the id of the initial lcore + */ +unsigned int rte_get_initial_lcore(void); + +/** + * Deprecated API to get the id of the initial lcore + * + * @return + * the id of the initial lcore */ unsigned int rte_get_master_lcore(void); @@ -179,15 +187,15 @@ int rte_lcore_is_enabled(unsigned int lcore_id); * * @param i * The current lcore (reference). - * @param skip_master - * If true, do not return the ID of the master lcore. + * @param skip_initial + * If true, do not return the ID of the initial lcore. * @param wrap * If true, go back to 0 when RTE_MAX_LCORE is reached; otherwise, * return RTE_MAX_LCORE. * @return * The next lcore_id or RTE_MAX_LCORE if not found. */ -unsigned int rte_get_next_lcore(unsigned int i, int skip_master, int wrap); +unsigned int rte_get_next_lcore(unsigned int i, int skip_initial, int wrap); /** * Macro to browse all running lcores. @@ -198,13 +206,20 @@ unsigned int rte_get_next_lcore(unsigned int i, int skip_master, int wrap); i = rte_get_next_lcore(i, 0, 0)) /** - * Macro to browse all running lcores except the master lcore. + * Macro to browse all running lcores except the initial lcore. */ -#define RTE_LCORE_FOREACH_SLAVE(i) \ +#define RTE_LCORE_FOREACH_WORKER(i) \ for (i = rte_get_next_lcore(-1, 1, 0); \ imaster_lcore); + socket_id = rte_lcore_to_socket_id(config->initial_lcore); if (rte_memseg_list_walk(check_socket, &socket_id) == 0) - RTE_LOG(WARNING, EAL, "WARNING: Master core has no memory on local socket!\n"); + RTE_LOG(WARNING, EAL, "WARNING: Initial core has no memory on local socket!\n"); } static int @@ -1184,23 +1184,23 @@ rte_eal_init(int argc, char **argv) eal_check_mem_on_local_socket(); - eal_thread_init_master(config->master_lcore); + eal_thread_initial_lcore(config->initial_lcore); ret = eal_thread_dump_affinity(cpuset, sizeof(cpuset)); - RTE_LOG(DEBUG, EAL, "Master lcore %u is ready (tid=%zx;cpuset=[%s%s])\n", - config->master_lcore, (uintptr_t)thread_id, cpuset, + RTE_LOG(DEBUG, EAL, "Initial lcore %u is ready (tid=%zx;cpuset=[%s%s])\n", + config->initial_lcore, (uintptr_t)thread_id, cpuset, ret == 0 ? "" : "..."); - RTE_LCORE_FOREACH_SLAVE(i) { + RTE_LCORE_FOREACH_WORKER(i) { /* - * create communication pipes between master thread + * create communication pipes between initial thread * and children */ - if (pipe(lcore_config[i].pipe_master2slave) < 0) + if (pipe(lcore_config[i].pipe_init2worker) < 0) rte_panic("Cannot create pipe\n"); - if (pipe(lcore_config[i].pipe_slave2master) < 0) + if (pipe(lcore_config[i].pipe_worker2init) < 0) rte_panic("Cannot create pipe\n"); lcore_config[i].state = WAIT; @@ -1213,7 +1213,7 @@ rte_eal_init(int argc, char **argv) /* Set thread_name for aid in debugging. */ snprintf(thread_name, sizeof(thread_name), - "lcore-slave-%d", i); + "lcore-work-%d", i); ret = rte_thread_setname(lcore_config[i].thread_id, thread_name); if (ret != 0) @@ -1222,10 +1222,10 @@ rte_eal_init(int argc, char **argv) } /* - * Launch a dummy function on all slave lcores, so that master lcore + * Launch a dummy function on all worker lcores, so that initial lcore * knows they are all ready when this function returns. */ - rte_eal_mp_remote_launch(sync_func, NULL, SKIP_MASTER); + rte_eal_mp_remote_launch(sync_func, NULL, SKIP_INITIAL); rte_eal_mp_wait_lcore(); /* initialize services so vdevs register service during bus_probe. */ diff --git a/lib/librte_eal/linux/eal_memory.c b/lib/librte_eal/linux/eal_memory.c index 89725291b0ce..1cbb8aab6016 100644 --- a/lib/librte_eal/linux/eal_memory.c +++ b/lib/librte_eal/linux/eal_memory.c @@ -1737,7 +1737,7 @@ memseg_primary_init_32(void) /* the allocation logic is a little bit convoluted, but here's how it * works, in a nutshell: * - if user hasn't specified on which sockets to allocate memory via - * --socket-mem, we allocate all of our memory on master core socket. + * --socket-mem, we allocate all of our memory on initial core socket. * - if user has specified sockets to allocate memory on, there may be * some "unused" memory left (e.g. if user has specified --socket-mem * such that not all memory adds up to 2 gigabytes), so add it to all @@ -1751,7 +1751,7 @@ memseg_primary_init_32(void) for (i = 0; i < rte_socket_count(); i++) { int hp_sizes = (int) internal_conf->num_hugepage_sizes; uint64_t max_socket_mem, cur_socket_mem; - unsigned int master_lcore_socket; + unsigned int initial_lcore_socket; struct rte_config *cfg = rte_eal_get_configuration(); bool skip; @@ -1767,10 +1767,10 @@ memseg_primary_init_32(void) skip = active_sockets != 0 && internal_conf->socket_mem[socket_id] == 0; /* ...or if we didn't specifically request memory on *any* - * socket, and this is not master lcore + * socket, and this is not initial lcore */ - master_lcore_socket = rte_lcore_to_socket_id(cfg->master_lcore); - skip |= active_sockets == 0 && socket_id != master_lcore_socket; + initial_lcore_socket = rte_lcore_to_socket_id(cfg->initial_lcore); + skip |= active_sockets == 0 && socket_id != initial_lcore_socket; if (skip) { RTE_LOG(DEBUG, EAL, "Will not preallocate memory on socket %u\n", diff --git a/lib/librte_eal/linux/eal_thread.c b/lib/librte_eal/linux/eal_thread.c index cd9d6e0ebf5b..324e9a73060b 100644 --- a/lib/librte_eal/linux/eal_thread.c +++ b/lib/librte_eal/linux/eal_thread.c @@ -30,35 +30,35 @@ RTE_DEFINE_PER_LCORE(unsigned, _socket_id) = (unsigned)SOCKET_ID_ANY; RTE_DEFINE_PER_LCORE(rte_cpuset_t, _cpuset); /* - * Send a message to a slave lcore identified by slave_id to call a + * Send a message to a worker lcore identified by worker_id to call a * function f with argument arg. Once the execution is done, the * remote lcore switch in FINISHED state. */ int -rte_eal_remote_launch(int (*f)(void *), void *arg, unsigned slave_id) +rte_eal_remote_launch(int (*f)(void *), void *arg, unsigned worker_id) { int n; char c = 0; - int m2s = lcore_config[slave_id].pipe_master2slave[1]; - int s2m = lcore_config[slave_id].pipe_slave2master[0]; + int i2w = lcore_config[worker_id].pipe_init2worker[1]; + int w2i = lcore_config[worker_id].pipe_worker2init[0]; int rc = -EBUSY; - if (lcore_config[slave_id].state != WAIT) + if (lcore_config[worker_id].state != WAIT) goto finish; - lcore_config[slave_id].f = f; - lcore_config[slave_id].arg = arg; + lcore_config[worker_id].f = f; + lcore_config[worker_id].arg = arg; /* send message */ n = 0; while (n == 0 || (n < 0 && errno == EINTR)) - n = write(m2s, &c, 1); + n = write(i2w, &c, 1); if (n < 0) rte_panic("cannot write on configuration pipe\n"); /* wait ack */ do { - n = read(s2m, &c, 1); + n = read(w2i, &c, 1); } while (n < 0 && errno == EINTR); if (n <= 0) @@ -66,7 +66,7 @@ rte_eal_remote_launch(int (*f)(void *), void *arg, unsigned slave_id) rc = 0; finish: - rte_eal_trace_thread_remote_launch(f, arg, slave_id, rc); + rte_eal_trace_thread_remote_launch(f, arg, worker_id, rc); return rc; } @@ -83,7 +83,7 @@ eal_thread_set_affinity(void) return rte_thread_set_affinity(&lcore_config[lcore_id].cpuset); } -void eal_thread_init_master(unsigned lcore_id) +void eal_thread_initial_lcore(unsigned lcore_id) { /* set the lcore ID in per-lcore memory area */ RTE_PER_LCORE(_lcore_id) = lcore_id; @@ -101,21 +101,21 @@ eal_thread_loop(__rte_unused void *arg) int n, ret; unsigned lcore_id; pthread_t thread_id; - int m2s, s2m; + int i2w, w2i; char cpuset[RTE_CPU_AFFINITY_STR_LEN]; thread_id = pthread_self(); /* retrieve our lcore_id from the configuration structure */ - RTE_LCORE_FOREACH_SLAVE(lcore_id) { + RTE_LCORE_FOREACH_WORKER(lcore_id) { if (thread_id == lcore_config[lcore_id].thread_id) break; } if (lcore_id == RTE_MAX_LCORE) rte_panic("cannot retrieve lcore id\n"); - m2s = lcore_config[lcore_id].pipe_master2slave[0]; - s2m = lcore_config[lcore_id].pipe_slave2master[1]; + i2w = lcore_config[lcore_id].pipe_init2worker[0]; + w2i = lcore_config[lcore_id].pipe_worker2init[1]; /* set the lcore ID in per-lcore memory area */ RTE_PER_LCORE(_lcore_id) = lcore_id; @@ -138,7 +138,7 @@ eal_thread_loop(__rte_unused void *arg) /* wait command */ do { - n = read(m2s, &c, 1); + n = read(i2w, &c, 1); } while (n < 0 && errno == EINTR); if (n <= 0) @@ -149,7 +149,7 @@ eal_thread_loop(__rte_unused void *arg) /* send ack */ n = 0; while (n == 0 || (n < 0 && errno == EINTR)) - n = write(s2m, &c, 1); + n = write(w2i, &c, 1); if (n < 0) rte_panic("cannot write on configuration pipe\n"); diff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map index 196eef5afab7..fb8f8a32beaf 100644 --- a/lib/librte_eal/rte_eal_version.map +++ b/lib/librte_eal/rte_eal_version.map @@ -79,6 +79,7 @@ DPDK_20.0 { rte_hexdump; rte_hypervisor_get; rte_hypervisor_get_name; + rte_init_lcore_id; rte_intr_allow_others; rte_intr_callback_register; rte_intr_callback_unregister; diff --git a/lib/librte_eal/windows/eal.c b/lib/librte_eal/windows/eal.c index eb10b4ef9689..f3ff4f921bcc 100644 --- a/lib/librte_eal/windows/eal.c +++ b/lib/librte_eal/windows/eal.c @@ -273,6 +273,7 @@ rte_eal_init(int argc, char **argv) if (fctret < 0) exit(1); +<<<<<<< HEAD /* Prevent creation of shared memory files. */ if (internal_conf->in_memory == 0) { RTE_LOG(WARNING, EAL, "Multi-process support is requested, " @@ -333,7 +334,7 @@ rte_eal_init(int argc, char **argv) return -1; } - eal_thread_init_master(config->master_lcore); + eal_thread_initial_lcore(config->master_lcore); bscan = rte_bus_scan(); if (bscan < 0) { @@ -341,17 +342,20 @@ rte_eal_init(int argc, char **argv) rte_errno = ENODEV; return -1; } +======= + eal_thread_set_initial_lcore(rte_config.initial_lcore); +>>>>>>> 28604a3e5a3a... eal: rename terms used for DPDK lcores - RTE_LCORE_FOREACH_SLAVE(i) { + RTE_LCORE_FOREACH_WORKER(i) { /* - * create communication pipes between master thread + * create communication pipes between initial thread * and children */ - if (_pipe(lcore_config[i].pipe_master2slave, + if (_pipe(lcore_config[i].pipe_init2worker, sizeof(char), _O_BINARY) < 0) rte_panic("Cannot create pipe\n"); - if (_pipe(lcore_config[i].pipe_slave2master, + if (_pipe(lcore_config[i].pipe_worker2init, sizeof(char), _O_BINARY) < 0) rte_panic("Cannot create pipe\n"); @@ -363,10 +367,10 @@ rte_eal_init(int argc, char **argv) } /* - * Launch a dummy function on all slave lcores, so that master lcore + * Launch a dummy function on all worker lcores, so that initial lcore * knows they are all ready when this function returns. */ - rte_eal_mp_remote_launch(sync_func, NULL, SKIP_MASTER); + rte_eal_mp_remote_launch(sync_func, NULL, SKIP_INITIAL); rte_eal_mp_wait_lcore(); return fctret; } diff --git a/lib/librte_eal/windows/eal_thread.c b/lib/librte_eal/windows/eal_thread.c index 3dd56519c99a..b3a8a47be313 100644 --- a/lib/librte_eal/windows/eal_thread.c +++ b/lib/librte_eal/windows/eal_thread.c @@ -21,34 +21,34 @@ RTE_DEFINE_PER_LCORE(unsigned int, _socket_id) = (unsigned int)SOCKET_ID_ANY; RTE_DEFINE_PER_LCORE(rte_cpuset_t, _cpuset); /* - * Send a message to a slave lcore identified by slave_id to call a + * Send a message to a worker lcore identified by worker_id to call a * function f with argument arg. Once the execution is done, the * remote lcore switch in FINISHED state. */ int -rte_eal_remote_launch(lcore_function_t *f, void *arg, unsigned int slave_id) +rte_eal_remote_launch(lcore_function_t *f, void *arg, unsigned int worker_id) { int n; char c = 0; - int m2s = lcore_config[slave_id].pipe_master2slave[1]; - int s2m = lcore_config[slave_id].pipe_slave2master[0]; + int i2w = lcore_config[worker_id].pipe_init2worker[1]; + int w2i = lcore_config[worker_id].pipe_worker2init[0]; - if (lcore_config[slave_id].state != WAIT) + if (lcore_config[worker_id].state != WAIT) return -EBUSY; - lcore_config[slave_id].f = f; - lcore_config[slave_id].arg = arg; + lcore_config[worker_id].f = f; + lcore_config[worker_id].arg = arg; /* send message */ n = 0; while (n == 0 || (n < 0 && errno == EINTR)) - n = _write(m2s, &c, 1); + n = _write(i2w, &c, 1); if (n < 0) rte_panic("cannot write on configuration pipe\n"); /* wait ack */ do { - n = _read(s2m, &c, 1); + n = _read(w2i, &c, 1); } while (n < 0 && errno == EINTR); if (n <= 0) @@ -58,7 +58,7 @@ rte_eal_remote_launch(lcore_function_t *f, void *arg, unsigned int slave_id) } void -eal_thread_init_master(unsigned int lcore_id) +eal_thread_set_initial_lcore(unsigned int lcore_id) { /* set the lcore ID in per-lcore memory area */ RTE_PER_LCORE(_lcore_id) = lcore_id; @@ -72,21 +72,21 @@ eal_thread_loop(void *arg __rte_unused) int n, ret; unsigned int lcore_id; pthread_t thread_id; - int m2s, s2m; + int i2w, w2i; char cpuset[RTE_CPU_AFFINITY_STR_LEN]; thread_id = pthread_self(); /* retrieve our lcore_id from the configuration structure */ - RTE_LCORE_FOREACH_SLAVE(lcore_id) { + RTE_LCORE_FOREACH_WORKER(lcore_id) { if (thread_id == lcore_config[lcore_id].thread_id) break; } if (lcore_id == RTE_MAX_LCORE) rte_panic("cannot retrieve lcore id\n"); - m2s = lcore_config[lcore_id].pipe_master2slave[0]; - s2m = lcore_config[lcore_id].pipe_slave2master[1]; + i2w = lcore_config[lcore_id].pipe_init2worker[0]; + w2i = lcore_config[lcore_id].pipe_worker2init[1]; /* set the lcore ID in per-lcore memory area */ RTE_PER_LCORE(_lcore_id) = lcore_id; @@ -100,7 +100,7 @@ eal_thread_loop(void *arg __rte_unused) /* wait command */ do { - n = _read(m2s, &c, 1); + n = _read(i2w, &c, 1); } while (n < 0 && errno == EINTR); if (n <= 0) @@ -111,7 +111,7 @@ eal_thread_loop(void *arg __rte_unused) /* send ack */ n = 0; while (n == 0 || (n < 0 && errno == EINTR)) - n = _write(s2m, &c, 1); + n = _write(w2i, &c, 1); if (n < 0) rte_panic("cannot write on configuration pipe\n"); -- 2.26.2