From patchwork Fri Jun 5 01:04:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 70863 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id B4001A00C4; Fri, 5 Jun 2020 03:04:23 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EECD01D607; Fri, 5 Jun 2020 03:04:22 +0200 (CEST) Received: from mail-pl1-f195.google.com (mail-pl1-f195.google.com [209.85.214.195]) by dpdk.org (Postfix) with ESMTP id D7A7E1D603 for ; Fri, 5 Jun 2020 03:04:20 +0200 (CEST) Received: by mail-pl1-f195.google.com with SMTP id q16so2949528plr.2 for ; Thu, 04 Jun 2020 18:04:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:subject:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=CzmbBP4caAkn+5jmz0EuZ8autwq9Bff+ckSy0FAz1Vc=; b=GU86jIjy37KY7HgLZxGRLjHpJMk4oz7VLVfJ7te6aQMvMoXkwGM+WPNDR0li1kWvFq C6SbCIo879lHLjOb8YN2+KWxQn6BQJO8zWeVujD2M3j01VnHEVIWAxSxqPSTzfoP6TQJ t5YGxEqPyt51th83LQLfHPzB0rV8cZJgDBsFgsebHgBXyIkHDJ2SVfi312XbOgaTPbz1 LUbjBCd2LkNbvEA2mjq7txuUgT/bt8Ng8VbyErpnSZ+nA5yyAG4TTTiCXE1PGaPeKWwk A2U1e/LflBgnIbPDB0Eef/CEEHZ8TC7mqOOYg27YrxyIGvZu/HTfWafXqV7akqTNiG81 8qgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CzmbBP4caAkn+5jmz0EuZ8autwq9Bff+ckSy0FAz1Vc=; b=Mzc2kcfrrU8Ru4q4XsH2adXqGKzD2quX8mzoH5hCYfR32EM/b50+xg3GVoATrxvmEx BVIgRgzjrh+HjmPlFAuBua7HukLG8lSDyRINBHf00LeOAKnQAWAd91PqFLwy/mBul+2o rHrlzCfNYyGvQCj2rzKkwkb21CLyFdak+HIBqR0QGZhFW0tmCHThA8O1uQ+xhQENhIt0 U+32nCKxOg701tXMBBc7l/UxM2x0rJG551ihet4l7pVssae4E3qwC/2+aKWpYmrYE1kV 3gVMQ5YwjzLdwZFgoRQh1KjSUErgkCvUPSMRq/RD5NekX2/R2hohhNdjl5YBFXpcYj+d v2hQ== X-Gm-Message-State: AOAM530hnoUKpOLR1QHXHsXOi7gLePnMagleFHiqTXAOobDA4Gg8uAt9 5Ctky8jOi+PIeL1L7ArK1Wh+gUqFGOs= X-Google-Smtp-Source: ABdhPJyHtwKvWtm1mbICuInZxs6rMIYyDOrJoWgeyk4pbGygl9diYePG8wlho4KBCqRBSYpGpKIrRA== X-Received: by 2002:a17:90a:d3d6:: with SMTP id d22mr89402pjw.184.1591319058913; Thu, 04 Jun 2020 18:04:18 -0700 (PDT) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id l83sm5316955pfd.150.2020.06.04.18.04.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jun 2020 18:04:18 -0700 (PDT) Date: Thu, 4 Jun 2020 18:04:09 -0700 From: Stephen Hemminger To: dev@dpdk.org Message-ID: <20200604180409.4a2831c3@hermes.lan> In-Reply-To: <20200604210200.25405-1-stephen@networkplumber.org> References: <20200604210200.25405-1-stephen@networkplumber.org> MIME-Version: 1.0 Subject: [dpdk-dev] [RFC] replace master/slave with primary/secondary 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" I have a full patch that replaces the master/slave lcore naming (widely used in DPDK) with a better primary/secondary naming. For now this is just a trial balloon to see what the impact would look like. The change mostly automated so likely that things are broken. It is hard to break a change like this down, and still keep git bisection clean. It keeps rte_master_lcore_id and RTE_FOREACH_SLAVE as deprecated items so that user code can still be built but they will be motivated to change. Here is a sample of what it would look like: diff --git a/lib/librte_eal/include/rte_launch.h b/lib/librte_eal/include/rte_launch.h index 06a671752ace..3d81207988a0 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 PRIMARY lcore only. * - * Sends a message to a slave lcore (identified by the slave_id) that + * Sends a message to a secondary 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 PRIMARY 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,37 @@ 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 primary 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_primary_t { + SKIP_PRIMARY = 0, /**< lcore handler not executed by primary core. */ + CALL_PRIMARY, /**< lcore handler executed by primary core. */ }; /** * Launch a function on all lcores. * - * Check that each SLAVE lcore is in a WAIT state, then call + * Check that each secondary 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_primary + * If call_primary set to SKIP_PRIMARY, the PRIMARY lcore does not call + * the function. If call_primary is set to CALL_PRIMARY, the function + * is also called on primary before returning. In any case, the primary * lcore returns as soon as it finished its job and knows nothing * about the completion of f on the other lcores. * @return @@ -95,49 +95,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_primary_t call_primary); /** - * 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 PRIMARY 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 PRIMARY 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 PRIMARY 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 secondary 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..e43985db17df 100644 --- a/lib/librte_eal/include/rte_lcore.h +++ b/lib/librte_eal/include/rte_lcore.h @@ -54,13 +54,21 @@ rte_lcore_id(void) } /** - * Get the id of the master lcore + * Get the id of the primary lcore * * @return - * the id of the master lcore + * the id of the primary lcore */ -unsigned int rte_get_master_lcore(void); +unsigned int rte_get_primary_lcore(void); +/** + * Deprecated API to get the id of the primary lcore + * + * @return + * the id of the primary lcore + */ +unsigned int rte_get_master_lcore(void) __rte_deprecated; + /** * Return the number of execution units (lcores) on the system. * @@ -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_primary + * If true, do not return the ID of the primary 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_primary, int wrap); /** * Macro to browse all running lcores. @@ -198,13 +206,21 @@ 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 primary lcore. */ -#define RTE_LCORE_FOREACH_SLAVE(i) \ +#define RTE_LCORE_FOREACH_SECONDARY(i) \ for (i = rte_get_next_lcore(-1, 1, 0); \ i