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 2C5DCA04C0; Fri, 11 Sep 2020 21:07:31 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 830801C10B; Fri, 11 Sep 2020 21:07:16 +0200 (CEST) Received: from mail-pj1-f66.google.com (mail-pj1-f66.google.com [209.85.216.66]) by dpdk.org (Postfix) with ESMTP id 68DB41C0DA for ; Fri, 11 Sep 2020 21:07:14 +0200 (CEST) Received: by mail-pj1-f66.google.com with SMTP id mm21so2155313pjb.4 for ; Fri, 11 Sep 2020 12:07:14 -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=zJHCl3Y+BniIoEf7umqoo/QsqIHU6DGrf2sAzqvQC2I=; b=RiAA1ePkXx7zgNBBRNBLKifSuUlKbqy5VVIsZ1fW9uqnGWXDsiSunlmzJXg2TP3rvO CZsSie68wyjn42cMyYscO+p1k1OGwjQAiLBGoCSoc4zlU2msZNyP3ghUmTd4t1AH7kpl wkdA/S492QsXE06faAzy+EQ1KHYN43V/yNrTA6OAnoIdYC+lxi1HkJnZxHQl97E1FMqs kiYI5xbg2ui66TcMTU22kJymUknmJjfphbGNfewRbo1dOESY2qLL2DuEKfJbSGq/mtcy juIFdJAMR6nToBdkOPmBmUkUkm44GsGE4MzBMsfqtNOYsRtnZBbH8tnAYs9GYOx0s9o6 BWTw== 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=zJHCl3Y+BniIoEf7umqoo/QsqIHU6DGrf2sAzqvQC2I=; b=UvxTxnxuJ+xP6Fnb5emMTgDnC+2hHWkh9oLTFrCmGSd5TluliIz/mz/ja3wQNWWZwr hotFYCowflNH1ZHVnCDp2FAq2I4lvpl3HSJz15/OEkVarfJnQwNpUOzTcXha1ZAqTs/2 xViZ4v6XmNe0NizbrMvkB/SsT/9OnEo6+r0OgGfnD2JfCittqXa+PA79iaWO+Yqfs0PD Ps0p9ZB/UkQPEz5dgCewuB16l3mQ9/mVvn3n177BUmxcQxoaWRZwvpqTehP5tQb8UVus PsfsFYgi5Sz33q3rKhS9xtJ740m3NBhPGz8WuzyH00rrJiQUWg9IN3C0/S1Mx3wVOxsR 6TJA== X-Gm-Message-State: AOAM533gOJr8m3uRkdQG15E3h/gM3GxFcks4z0ojABaHEVTS2f7ZNTNB AO9j7Yt0Q5kkE7oFZBOAhjJ/P3NAcx2Kaw== X-Google-Smtp-Source: ABdhPJx8mQhLkiD2xhHESK9xXseoFnDSQ5JtMJ51fGrWvDAqQUjl9nSBCbj6Qnkgzpi16iOOuMD0cA== X-Received: by 2002:a17:90b:3444:: with SMTP id lj4mr3354373pjb.78.1599851232281; Fri, 11 Sep 2020 12:07:12 -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 z23sm2979984pfg.220.2020.09.11.12.07.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Sep 2020 12:07:11 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Fri, 11 Sep 2020 12:06:48 -0700 Message-Id: <20200911190701.29171-3-stephen@networkplumber.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200911190701.29171-1-stephen@networkplumber.org> References: <20200911190701.29171-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 02/15] eal: rename lcore word choices 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 master lcore with main lcore and replace slave lcore with worker lcore. Keep the old functions and macros but mark them as deprecated for this release. The "--master-lcore" command line option is also deprecated and any usage will print a warning and use "--main-lcore" as replacement. Signed-off-by: Stephen Hemminger --- doc/guides/rel_notes/deprecation.rst | 19 ------- doc/guides/rel_notes/release_20_11.rst | 11 ++++ lib/librte_eal/common/eal_common_dynmem.c | 8 +-- lib/librte_eal/common/eal_common_launch.c | 36 ++++++------- lib/librte_eal/common/eal_common_lcore.c | 8 +-- lib/librte_eal/common/eal_common_options.c | 54 +++++++++++--------- lib/librte_eal/common/eal_options.h | 2 + lib/librte_eal/common/eal_private.h | 6 +-- lib/librte_eal/common/rte_random.c | 2 +- lib/librte_eal/common/rte_service.c | 2 +- lib/librte_eal/freebsd/eal.c | 28 +++++----- lib/librte_eal/freebsd/eal_thread.c | 32 ++++++------ lib/librte_eal/include/rte_eal.h | 4 +- lib/librte_eal/include/rte_eal_trace.h | 4 +- lib/librte_eal/include/rte_launch.h | 59 ++++++++++++---------- lib/librte_eal/include/rte_lcore.h | 36 +++++++++---- lib/librte_eal/linux/eal.c | 28 +++++----- lib/librte_eal/linux/eal_memory.c | 8 +-- lib/librte_eal/linux/eal_thread.c | 32 ++++++------ lib/librte_eal/rte_eal_version.map | 2 +- lib/librte_eal/windows/eal.c | 16 +++--- lib/librte_eal/windows/eal_thread.c | 30 +++++------ 22 files changed, 223 insertions(+), 204 deletions(-) diff --git a/doc/guides/rel_notes/deprecation.rst b/doc/guides/rel_notes/deprecation.rst index 88d7d07613c0..9c11bb354e6d 100644 --- a/doc/guides/rel_notes/deprecation.rst +++ b/doc/guides/rel_notes/deprecation.rst @@ -25,25 +25,6 @@ Deprecation Notices * kvargs: The function ``rte_kvargs_process`` will get a new parameter for returning key match count. It will ease handling of no-match case. -* eal: To be more inclusive in choice of naming, the DPDK project - will replace uses of master/slave in the API's and command line arguments. - - References to master/slave in relation to lcore will be renamed - to initial/worker. The function ``rte_get_master_lcore()`` - will be renamed to ``rte_get_initial_lcore()``. - For the 20.11 release, both names will be present and the - old function will be marked with the deprecated tag. - The old function will be removed in a future version. - - The iterator for worker lcores will also change: - ``RTE_LCORE_FOREACH_SLAVE`` will be replaced with - ``RTE_LCORE_FOREACH_WORKER``. - - The ``master-lcore`` argument to testpmd will be replaced - with ``initial-lcore``. The old ``master-lcore`` argument - will produce a runtime notification in 20.11 release, and - be removed completely in a future release. - * eal: The terms blacklist and whitelist to describe devices used by DPDK will be replaced in the 20.11 relase. This will apply to command line arguments as well as macros. diff --git a/doc/guides/rel_notes/release_20_11.rst b/doc/guides/rel_notes/release_20_11.rst index 667e3d54ad44..4b9f5087c64e 100644 --- a/doc/guides/rel_notes/release_20_11.rst +++ b/doc/guides/rel_notes/release_20_11.rst @@ -93,6 +93,17 @@ API Changes and the function ``rte_rawdev_queue_conf_get()`` from ``void`` to ``int`` allowing the return of error codes from drivers. +* eal: Changed the function ``rte_get_master_lcore()`` is + replaced to ``rte_get_main_lcore()``. The old function is deprecated. + + The iterator for worker lcores will also change: + ``RTE_LCORE_FOREACH_SLAVE`` will be replaced with + ``RTE_LCORE_FOREACH_WORKER``. + + The ``master-lcore`` argument to testpmd will be replaced + with ``main-lcore``. The old ``master-lcore`` argument + will produce a runtime notification in 20.11 release, and + be removed completely in a future release. ABI Changes ----------- diff --git a/lib/librte_eal/common/eal_common_dynmem.c b/lib/librte_eal/common/eal_common_dynmem.c index 614648d8a4de..48eca5854ebe 100644 --- a/lib/librte_eal/common/eal_common_dynmem.c +++ b/lib/librte_eal/common/eal_common_dynmem.c @@ -434,12 +434,12 @@ eal_dynmem_calc_num_pages_per_socket( for (socket = 0; socket < RTE_MAX_NUMA_NODES && total_size != 0; socket++) { struct rte_config *cfg = rte_eal_get_configuration(); - unsigned int master_lcore_socket; + unsigned int main_lcore_socket; - master_lcore_socket = - rte_lcore_to_socket_id(cfg->master_lcore); + main_lcore_socket = + rte_lcore_to_socket_id(cfg->main_lcore); - if (master_lcore_socket != socket) + if (main_lcore_socket != socket) continue; /* Update sizes */ diff --git a/lib/librte_eal/common/eal_common_launch.c b/lib/librte_eal/common/eal_common_launch.c index cf52d717f68e..34f854ad80c8 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_main is true + * (set to CALL_MAIN), also call the function on the main lcore. */ int rte_eal_mp_remote_launch(int (*f)(void *), void *arg, - enum rte_rmt_call_master_t call_master) + enum rte_rmt_call_main_t call_main) { int lcore_id; - int master = rte_get_master_lcore(); + int main_lcore = rte_get_main_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_main == CALL_MAIN) { + lcore_config[main_lcore].ret = f(arg); + lcore_config[main_lcore].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 d64569b3c758..66d6bad1a7d7 100644 --- a/lib/librte_eal/common/eal_common_lcore.c +++ b/lib/librte_eal/common/eal_common_lcore.c @@ -18,9 +18,9 @@ #include "eal_private.h" #include "eal_thread.h" -unsigned int rte_get_master_lcore(void) +unsigned int rte_get_main_lcore(void) { - return rte_eal_get_configuration()->master_lcore; + return rte_eal_get_configuration()->main_lcore; } unsigned int rte_lcore_count(void) @@ -93,7 +93,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_main, int wrap) { i++; if (wrap) @@ -101,7 +101,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_main && (i == rte_get_main_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 a5426e12346a..649dc4f63b7b 100644 --- a/lib/librte_eal/common/eal_common_options.c +++ b/lib/librte_eal/common/eal_common_options.c @@ -81,6 +81,7 @@ eal_long_options[] = { {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_MAIN_LCORE, 1, NULL, OPT_MAIN_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 }, @@ -144,7 +145,7 @@ struct device_option { static struct device_option_list devopt_list = TAILQ_HEAD_INITIALIZER(devopt_list); -static int master_lcore_parsed; +static int main_lcore_parsed; static int mem_parsed; static int core_parsed; @@ -575,12 +576,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 main lcore already parsed */ uint32_t lcore = idx; - if (master_lcore_parsed && - cfg->master_lcore == lcore) { + if (main_lcore_parsed && + cfg->main_lcore == lcore) { RTE_LOG(ERR, EAL, - "lcore %u is master lcore, cannot use as service core\n", + "lcore %u is main lcore, cannot use as service core\n", idx); return -1; } @@ -748,12 +749,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 main lcore already parsed */ uint32_t lcore = idx; - if (cfg->master_lcore == lcore && - master_lcore_parsed) { + if (cfg->main_lcore == lcore && + main_lcore_parsed) { RTE_LOG(ERR, EAL, - "Error: lcore %u is master lcore, cannot use as service core\n", + "Error: lcore %u is main lcore, cannot use as service core\n", idx); return -1; } @@ -836,23 +837,23 @@ eal_parse_corelist(const char *corelist, int *cores) return 0; } -/* Changes the lcore id of the master thread */ +/* Changes the lcore id of the main thread */ static int -eal_parse_master_lcore(const char *arg) +eal_parse_main_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->main_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->main_lcore >= RTE_MAX_LCORE) return -1; - master_lcore_parsed = 1; + main_lcore_parsed = 1; /* ensure master core is not used as service core */ - if (lcore_config[cfg->master_lcore].core_role == ROLE_SERVICE) { + if (lcore_config[cfg->main_lcore].core_role == ROLE_SERVICE) { RTE_LOG(ERR, EAL, "Error: Master lcore is used as a service core\n"); return -1; @@ -1593,7 +1594,12 @@ eal_parse_common_option(int opt, const char *optarg, break; case OPT_MASTER_LCORE_NUM: - if (eal_parse_master_lcore(optarg) < 0) { + fprintf(stderr, + "option --" OPT_MASTER_LCORE + " is deprecated use " OPT_MAIN_LCORE "\n"); + /* fallthrough */ + case OPT_MAIN_LCORE_NUM: + if (eal_parse_main_lcore(optarg) < 0) { RTE_LOG(ERR, EAL, "invalid parameter for --" OPT_MASTER_LCORE "\n"); return -1; @@ -1763,9 +1769,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 main lcore cpu affinity */ if (!CPU_COUNT(cpuset)) { - memcpy(cpuset, &lcore_config[rte_get_master_lcore()].cpuset, + memcpy(cpuset, &lcore_config[rte_get_main_lcore()].cpuset, sizeof(*cpuset)); } } @@ -1797,12 +1803,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 main lcore is the first one */ + if (!main_lcore_parsed) { + cfg->main_lcore = rte_get_next_lcore(-1, 0, 0); + if (cfg->main_lcore >= RTE_MAX_LCORE) return -1; - lcore_config[cfg->master_lcore].core_role = ROLE_RTE; + lcore_config[cfg->main_lcore].core_role = ROLE_RTE; } compute_ctrl_threads_cpuset(internal_cfg); @@ -1822,7 +1828,7 @@ 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) { + if (cfg->lcore_role[cfg->main_lcore] != ROLE_RTE) { RTE_LOG(ERR, EAL, "Master lcore is not enabled for DPDK\n"); return -1; } diff --git a/lib/librte_eal/common/eal_options.h b/lib/librte_eal/common/eal_options.h index 89769d48b487..d363228a7a25 100644 --- a/lib/librte_eal/common/eal_options.h +++ b/lib/librte_eal/common/eal_options.h @@ -43,6 +43,8 @@ enum { OPT_TRACE_BUF_SIZE_NUM, #define OPT_TRACE_MODE "trace-mode" OPT_TRACE_MODE_NUM, +#define OPT_MAIN_LCORE "main-lcore" + OPT_MAIN_LCORE_NUM, #define OPT_MASTER_LCORE "master-lcore" OPT_MASTER_LCORE_NUM, #define OPT_MBUF_POOL_OPS_NAME "mbuf-pool-ops-name" diff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h index a6a6381567f4..4684c4c7df19 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_main2worker[2]; /**< communication pipe with main */ + int pipe_worker2main[2]; /**< communication pipe with main */ 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 main_lcore; /**< Id of the main 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/rte_random.c b/lib/librte_eal/common/rte_random.c index b7a089ac4fe0..8d88aca26299 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_main_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 6a0e0ff65d14..626d2409ad57 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->main_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 798add0b5919..f7bdd8caabc3 100644 --- a/lib/librte_eal/freebsd/eal.c +++ b/lib/librte_eal/freebsd/eal.c @@ -626,10 +626,10 @@ eal_check_mem_on_local_socket(void) int socket_id; const struct rte_config *config = rte_eal_get_configuration(); - socket_id = rte_lcore_to_socket_id(config->master_lcore); + socket_id = rte_lcore_to_socket_id(config->main_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: Main core has no memory on local socket!\n"); } @@ -850,29 +850,29 @@ rte_eal_init(int argc, char **argv) eal_check_mem_on_local_socket(); if (pthread_setaffinity_np(pthread_self(), sizeof(rte_cpuset_t), - &lcore_config[config->master_lcore].cpuset) != 0) { + &lcore_config[config->main_lcore].cpuset) != 0) { rte_eal_init_alert("Cannot set affinity"); rte_errno = EINVAL; return -1; } - __rte_thread_init(config->master_lcore, - &lcore_config[config->master_lcore].cpuset); + __rte_thread_init(config->main_lcore, + &lcore_config[config->main_lcore].cpuset); ret = eal_thread_dump_current_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, + RTE_LOG(DEBUG, EAL, "Main lcore %u is ready (tid=%p;cpuset=[%s%s])\n", + config->main_lcore, 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 main thread * and children */ - if (pipe(lcore_config[i].pipe_master2slave) < 0) + if (pipe(lcore_config[i].pipe_main2worker) < 0) rte_panic("Cannot create pipe\n"); - if (pipe(lcore_config[i].pipe_slave2master) < 0) + if (pipe(lcore_config[i].pipe_worker2main) < 0) rte_panic("Cannot create pipe\n"); lcore_config[i].state = WAIT; @@ -885,7 +885,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-worker-%d", i); rte_thread_setname(lcore_config[i].thread_id, thread_name); ret = pthread_setaffinity_np(lcore_config[i].thread_id, @@ -895,10 +895,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 main 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_MAIN); 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 99b5fefc4c5b..1dce9b04f24a 100644 --- a/lib/librte_eal/freebsd/eal_thread.c +++ b/lib/librte_eal/freebsd/eal_thread.c @@ -26,35 +26,35 @@ #include "eal_thread.h" /* - * 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 m2w = lcore_config[worker_id].pipe_main2worker[1]; + int w2m = lcore_config[worker_id].pipe_worker2main[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(m2w, &c, 1); if (n < 0) rte_panic("cannot write on configuration pipe\n"); /* wait ack */ do { - n = read(s2m, &c, 1); + n = read(w2m, &c, 1); } while (n < 0 && errno == EINTR); if (n <= 0) @@ -62,7 +62,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; } @@ -74,21 +74,21 @@ eal_thread_loop(__rte_unused void *arg) int n, ret; unsigned lcore_id; pthread_t thread_id; - int m2s, s2m; + int m2w, w2m; 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]; + m2w = lcore_config[lcore_id].pipe_main2worker[0]; + w2m = lcore_config[lcore_id].pipe_worker2main[1]; __rte_thread_init(lcore_id, &lcore_config[lcore_id].cpuset); @@ -104,7 +104,7 @@ eal_thread_loop(__rte_unused void *arg) /* wait command */ do { - n = read(m2s, &c, 1); + n = read(m2w, &c, 1); } while (n < 0 && errno == EINTR); if (n <= 0) @@ -115,7 +115,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(w2m, &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 ddcf6a2e7a1a..f8f0d74b476c 100644 --- a/lib/librte_eal/include/rte_eal.h +++ b/lib/librte_eal/include/rte_eal.h @@ -65,11 +65,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 MAIN 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 6b1a813c7b1b..dd4e30e7fe5c 100644 --- a/lib/librte_eal/include/rte_eal_trace.h +++ b/lib/librte_eal/include/rte_eal_trace.h @@ -258,10 +258,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..acba8a779faf 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 MAIN 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 worker_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(worker_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 MAIN 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,40 @@ typedef int (lcore_function_t)(void *); * The function to be called. * @param arg * The argument for the function. - * @param slave_id + * @param worker_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 worker_id); /** - * This enum indicates whether the master core must execute the handler + * This enum indicates whether the main 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_main_t { + SKIP_MAIN = 0, /**< lcore handler not executed by main core. */ + CALL_MAIN, /**< lcore handler executed by main core. */ }; +#define SKIP_MASTER RTE_DEPRECATED(SKIP_MASTER, SKIP_MAIN) SKIP_MAIN +#define CALL_MASTER RTE_DEPRECATED(CALL_MASTER, CALL_MAIN) CALL_MAIN + /** * 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_main + * If call_main set to SKIP_MAIN, the MAIN lcore does not call + * the function. If call_main is set to CALL_MAIN, the function + * is also called on main before returning. In any case, the main * lcore returns as soon as it finished its job and knows nothing * about the completion of f on the other lcores. * @return @@ -95,49 +98,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_main_t call_main); /** - * Get the state of the lcore identified by slave_id. + * Get the state of the lcore identified by worker_id. * - * To be executed on the MASTER lcore only. + * To be executed on the MAIN lcore only. * - * @param slave_id + * @param worker_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 worker_id); /** * Wait until an lcore finishes its job. * - * To be executed on the MASTER lcore only. + * To be executed on the MAIN lcore only. * - * If the slave lcore identified by the slave_id is in a FINISHED state, + * If the worker lcore identified by the worker_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 worker_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 worker_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 worker_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 worker_id); /** * Wait until all lcores finish their jobs. * - * To be executed on the MASTER lcore only. Issue an + * To be executed on the MAIN 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 b8b64a625200..b0b6f4c643b0 100644 --- a/lib/librte_eal/include/rte_lcore.h +++ b/lib/librte_eal/include/rte_lcore.h @@ -78,12 +78,24 @@ rte_lcore_id(void) } /** - * Get the id of the master lcore + * Get the id of the main lcore * * @return - * the id of the master lcore + * the id of the main lcore */ -unsigned int rte_get_master_lcore(void); +unsigned int rte_get_main_lcore(void); + +/** + * Deprecated function the id of the main lcore + * + * @return + * the id of the main lcore + */ +__rte_deprecated +static inline unsigned int rte_get_master_lcore(void) +{ + return rte_get_main_lcore(); +} /** * Return the number of execution units (lcores) on the system. @@ -203,32 +215,36 @@ 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_main + * If true, do not return the ID of the main 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_main, int wrap); /** * Macro to browse all running lcores. */ #define RTE_LCORE_FOREACH(i) \ for (i = rte_get_next_lcore(-1, 0, 0); \ - imaster_lcore); + socket_id = rte_lcore_to_socket_id(config->main_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: Main core has no memory on local socket!\n"); } static int @@ -1214,28 +1214,28 @@ rte_eal_init(int argc, char **argv) eal_check_mem_on_local_socket(); if (pthread_setaffinity_np(pthread_self(), sizeof(rte_cpuset_t), - &lcore_config[config->master_lcore].cpuset) != 0) { + &lcore_config[config->main_lcore].cpuset) != 0) { rte_eal_init_alert("Cannot set affinity"); rte_errno = EINVAL; return -1; } - __rte_thread_init(config->master_lcore, - &lcore_config[config->master_lcore].cpuset); + __rte_thread_init(config->main_lcore, + &lcore_config[config->main_lcore].cpuset); ret = eal_thread_dump_current_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, "Main lcore %u is ready (tid=%zx;cpuset=[%s%s])\n", + config->main_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 main thread * and children */ - if (pipe(lcore_config[i].pipe_master2slave) < 0) + if (pipe(lcore_config[i].pipe_main2worker) < 0) rte_panic("Cannot create pipe\n"); - if (pipe(lcore_config[i].pipe_slave2master) < 0) + if (pipe(lcore_config[i].pipe_worker2main) < 0) rte_panic("Cannot create pipe\n"); lcore_config[i].state = WAIT; @@ -1248,7 +1248,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-worker-%d", i); ret = rte_thread_setname(lcore_config[i].thread_id, thread_name); if (ret != 0) @@ -1262,10 +1262,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 main 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_MAIN); 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..d7349544a13a 100644 --- a/lib/librte_eal/linux/eal_memory.c +++ b/lib/librte_eal/linux/eal_memory.c @@ -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 main_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 main lcore */ - master_lcore_socket = rte_lcore_to_socket_id(cfg->master_lcore); - skip |= active_sockets == 0 && socket_id != master_lcore_socket; + main_lcore_socket = rte_lcore_to_socket_id(cfg->main_lcore); + skip |= active_sockets == 0 && socket_id != main_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 068de2559555..bed1d513c841 100644 --- a/lib/librte_eal/linux/eal_thread.c +++ b/lib/librte_eal/linux/eal_thread.c @@ -26,35 +26,35 @@ #include "eal_thread.h" /* - * 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 m2w = lcore_config[worker_id].pipe_main2worker[1]; + int w2m = lcore_config[worker_id].pipe_worker2main[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(m2w, &c, 1); if (n < 0) rte_panic("cannot write on configuration pipe\n"); /* wait ack */ do { - n = read(s2m, &c, 1); + n = read(w2m, &c, 1); } while (n < 0 && errno == EINTR); if (n <= 0) @@ -62,7 +62,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; } @@ -74,21 +74,21 @@ eal_thread_loop(__rte_unused void *arg) int n, ret; unsigned lcore_id; pthread_t thread_id; - int m2s, s2m; + int m2w, w2m; 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]; + m2w = lcore_config[lcore_id].pipe_main2worker[0]; + w2m = lcore_config[lcore_id].pipe_worker2main[1]; __rte_thread_init(lcore_id, &lcore_config[lcore_id].cpuset); @@ -104,7 +104,7 @@ eal_thread_loop(__rte_unused void *arg) /* wait command */ do { - n = read(m2s, &c, 1); + n = read(m2w, &c, 1); } while (n < 0 && errno == EINTR); if (n <= 0) @@ -115,7 +115,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(w2m, &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 0b18e2ef85f9..8ff6fe7c3eaf 100644 --- a/lib/librte_eal/rte_eal_version.map +++ b/lib/librte_eal/rte_eal_version.map @@ -74,7 +74,7 @@ DPDK_21 { rte_free; rte_get_hpet_cycles; rte_get_hpet_hz; - rte_get_master_lcore; + rte_get_main_lcore; rte_get_next_lcore; rte_get_tsc_hz; rte_hexdump; diff --git a/lib/librte_eal/windows/eal.c b/lib/librte_eal/windows/eal.c index bc48f27ab39a..cbca20956210 100644 --- a/lib/librte_eal/windows/eal.c +++ b/lib/librte_eal/windows/eal.c @@ -350,8 +350,8 @@ rte_eal_init(int argc, char **argv) return -1; } - __rte_thread_init(config->master_lcore, - &lcore_config[config->master_lcore].cpuset); + __rte_thread_init(config->main_lcore, + &lcore_config[config->main_lcore].cpuset); bscan = rte_bus_scan(); if (bscan < 0) { @@ -360,16 +360,16 @@ rte_eal_init(int argc, char **argv) return -1; } - RTE_LCORE_FOREACH_SLAVE(i) { + RTE_LCORE_FOREACH_WORKER(i) { /* - * create communication pipes between master thread + * create communication pipes between main thread * and children */ - if (_pipe(lcore_config[i].pipe_master2slave, + if (_pipe(lcore_config[i].pipe_main2worker, sizeof(char), _O_BINARY) < 0) rte_panic("Cannot create pipe\n"); - if (_pipe(lcore_config[i].pipe_slave2master, + if (_pipe(lcore_config[i].pipe_worker2main, sizeof(char), _O_BINARY) < 0) rte_panic("Cannot create pipe\n"); @@ -394,10 +394,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 main 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_MAIN); 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 20889b6196c9..908e726d16cc 100644 --- a/lib/librte_eal/windows/eal_thread.c +++ b/lib/librte_eal/windows/eal_thread.c @@ -17,34 +17,34 @@ #include "eal_windows.h" /* - * 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 m2w = lcore_config[worker_id].pipe_main2worker[1]; + int w2m = lcore_config[worker_id].pipe_worker2main[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(m2w, &c, 1); if (n < 0) rte_panic("cannot write on configuration pipe\n"); /* wait ack */ do { - n = _read(s2m, &c, 1); + n = _read(w2m, &c, 1); } while (n < 0 && errno == EINTR); if (n <= 0) @@ -61,21 +61,21 @@ eal_thread_loop(void *arg __rte_unused) int n, ret; unsigned int lcore_id; pthread_t thread_id; - int m2s, s2m; + int m2w, w2m; 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]; + m2w = lcore_config[lcore_id].pipe_main2worker[0]; + w2m = lcore_config[lcore_id].pipe_worker2main[1]; __rte_thread_init(lcore_id, &lcore_config[lcore_id].cpuset); @@ -88,7 +88,7 @@ eal_thread_loop(void *arg __rte_unused) /* wait command */ do { - n = _read(m2s, &c, 1); + n = _read(m2w, &c, 1); } while (n < 0 && errno == EINTR); if (n <= 0) @@ -99,7 +99,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(w2m, &c, 1); if (n < 0) rte_panic("cannot write on configuration pipe\n"); -- 2.27.0