Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/52136/?format=api
https://patches.dpdk.org/api/patches/52136/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/20190402205335.13745-1-stephen@networkplumber.org/", "project": { "id": 1, "url": "https://patches.dpdk.org/api/projects/1/?format=api", "name": "DPDK", "link_name": "dpdk", "list_id": "dev.dpdk.org", "list_email": "dev@dpdk.org", "web_url": "http://core.dpdk.org", "scm_url": "git://dpdk.org/dpdk", "webscm_url": "http://git.dpdk.org/dpdk", "list_archive_url": "https://inbox.dpdk.org/dev", "list_archive_url_format": "https://inbox.dpdk.org/dev/{}", "commit_url_format": "" }, "msgid": "<20190402205335.13745-1-stephen@networkplumber.org>", "list_archive_url": "https://inbox.dpdk.org/dev/20190402205335.13745-1-stephen@networkplumber.org", "date": "2019-04-02T20:53:35", "name": "[v3] eal: rename state values in rte_lcore_state", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "edb286acf594ce6b52ab4cae687532368033d0a5", "submitter": { "id": 27, "url": "https://patches.dpdk.org/api/people/27/?format=api", "name": "Stephen Hemminger", "email": "stephen@networkplumber.org" }, "delegate": { "id": 1, "url": "https://patches.dpdk.org/api/users/1/?format=api", "username": "tmonjalo", "first_name": "Thomas", "last_name": "Monjalon", "email": "thomas@monjalon.net" }, "mbox": "https://patches.dpdk.org/project/dpdk/patch/20190402205335.13745-1-stephen@networkplumber.org/mbox/", "series": [ { "id": 4072, "url": "https://patches.dpdk.org/api/series/4072/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=4072", "date": "2019-04-02T20:53:35", "name": "[v3] eal: rename state values in rte_lcore_state", "version": 3, "mbox": "https://patches.dpdk.org/series/4072/mbox/" } ], "comments": "https://patches.dpdk.org/api/patches/52136/comments/", "check": "fail", "checks": "https://patches.dpdk.org/api/patches/52136/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@dpdk.org", "Delivered-To": "patchwork@dpdk.org", "Received": [ "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 0D36D1B1D6;\n\tTue, 2 Apr 2019 22:53:47 +0200 (CEST)", "from mail-pl1-f194.google.com (mail-pl1-f194.google.com\n\t[209.85.214.194]) by dpdk.org (Postfix) with ESMTP id 2DD101B1A0\n\tfor <dev@dpdk.org>; Tue, 2 Apr 2019 22:53:45 +0200 (CEST)", "by mail-pl1-f194.google.com with SMTP id y6so6850007pll.13\n\tfor <dev@dpdk.org>; Tue, 02 Apr 2019 13:53:45 -0700 (PDT)", "from shemminger-XPS-13-9360.lan (204-195-22-127.wavecable.com.\n\t[204.195.22.127]) by smtp.gmail.com with ESMTPSA id\n\th19sm21392903pfd.130.2019.04.02.13.53.42\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tTue, 02 Apr 2019 13:53:42 -0700 (PDT)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=networkplumber-org.20150623.gappssmtp.com; s=20150623;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=ZO/Q1fFbU+TXI18edyBkwKfpBZhxzYETYfyPsGMY5h8=;\n\tb=wGxkx531N4DX6dcK2UhExr7x00oCQincbR9yVXv+QD1UdaD74Ltl1+lT4cacBoqxF2\n\t3EUhaVn8TN5756j2AX8/qGz9zCkP7wJFUGnisPDyK1qi7EGRdOC/2ci42aioTSFhnlcZ\n\t6IgtR0B2YfWlhwyANH3hvHroXmWI3lkUL6h0vhGINIsfNM2ia8fxVNQpdf5+3GtLtkit\n\tlZZC/YWvRzb0ELOASS8rpRdAOA+0Dr7C8685RENgxOzSkzC9zi90SWEAKgdQjit5IXEM\n\tXY7X9BpJGgd5KgebXnNgLnG9VKwkn971OxT3iK35AN2l2MuvNfHDTr1mcHx2TjF7spfj\n\ttfNQ==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=ZO/Q1fFbU+TXI18edyBkwKfpBZhxzYETYfyPsGMY5h8=;\n\tb=JovWv1/PvWTG7ga4sVuzNZIrOtbtjRQHu2BPirR67JWz4NDsrks940yuAeFPNCEbij\n\tLOEinrSUJOjemgLlPSbMpLoS/8VS2Ghl9IHufKGTuXs/wcvtQjah+BcHg+P1Lv2O9Tqz\n\tEId8SapKhwdIUz48o2dYRWdPbBd4cV3Ia13OkAtBNGeCIwZOtzF42P0ATKNpAWOgmNMO\n\talP6fiY14QjsvCkBWFfmrxbJWgqUjI+5liBBzE75lH3j0GeR7sSgsfcuLUABWB/vDCJF\n\tNJhnbgr0v5J036IDHLtPbJvSfi/4SdManYDsq5O9zfzvYAfLznFgg3y7infOFPJk2Iyw\n\tlhjg==", "X-Gm-Message-State": "APjAAAVBDsZfmcHHYK1eihrVKBhG1pnDqcgJDtY3nyjoKYJ8Oirsy5nD\n\tw4AJ2XbT9hL/O6AdNTvT+k5xO55MsLbW+A==", "X-Google-Smtp-Source": "APXvYqwv/y9N4BtoyRQA3zwOU6GyhsqHL69LiX3gSarDZlorClEMriHHJv+8+JVcqnOwDTjFNEdByA==", "X-Received": "by 2002:a17:902:32b:: with SMTP id\n\t40mr70385975pld.122.1554238423966; \n\tTue, 02 Apr 2019 13:53:43 -0700 (PDT)", "From": "Stephen Hemminger <stephen@networkplumber.org>", "To": "dev@dpdk.org", "Cc": "Stephen Hemminger <stephen@networkplumber.org>", "Date": "Tue, 2 Apr 2019 13:53:35 -0700", "Message-Id": "<20190402205335.13745-1-stephen@networkplumber.org>", "X-Mailer": "git-send-email 2.17.1", "In-Reply-To": "<20190402155722.21400-1-stephen@networkplumber.org>", "References": "<20190402155722.21400-1-stephen@networkplumber.org>", "Subject": "[dpdk-dev] [PATCH v3] eal: rename state values in rte_lcore_state", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://mails.dpdk.org/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "C language does not really treat enum's as first class symbols.\nThe values in an enum live in a global namespace. That means if\nDPDK defines \"RUNNING\" it can't be used by another enum in an\napplication using DPDK.\n\nTo solve this add a prefix \"RTE_LCORE_\" to the enum values, and\nmake them grammatically consistent.\n\nAlso, simplify the inline thread_is_running() which is copied\nin softnic and ip_pipeline.\n\nSigned-off-by: Stephen Hemminger <stephen@networkplumber.org>\n---\nv3 - fix BSD and bond driver usage of state\n\n drivers/event/octeontx/ssovf_evdev_selftest.c | 2 +-\n drivers/event/sw/sw_evdev_selftest.c | 4 ++--\n drivers/net/softnic/rte_eth_softnic_thread.c | 5 +----\n examples/bond/main.c | 4 ++--\n examples/ip_pipeline/thread.c | 5 +----\n examples/l2fwd-keepalive/main.c | 2 +-\n lib/librte_eal/common/eal_common_launch.c | 12 ++++++------\n lib/librte_eal/common/include/rte_launch.h | 6 +++---\n lib/librte_eal/common/rte_service.c | 2 +-\n lib/librte_eal/freebsd/eal/eal.c | 2 +-\n lib/librte_eal/freebsd/eal/eal_thread.c | 6 +++---\n lib/librte_eal/linux/eal/eal.c | 2 +-\n lib/librte_eal/linux/eal/eal_thread.c | 8 ++++----\n 13 files changed, 27 insertions(+), 33 deletions(-)", "diff": "diff --git a/drivers/event/octeontx/ssovf_evdev_selftest.c b/drivers/event/octeontx/ssovf_evdev_selftest.c\nindex 239362fcf549..06370840ba36 100644\n--- a/drivers/event/octeontx/ssovf_evdev_selftest.c\n+++ b/drivers/event/octeontx/ssovf_evdev_selftest.c\n@@ -577,7 +577,7 @@ wait_workers_to_join(int lcore, const rte_atomic32_t *count)\n \tRTE_SET_USED(count);\n \n \tprint_cycles = cycles = rte_get_timer_cycles();\n-\twhile (rte_eal_get_lcore_state(lcore) != FINISHED) {\n+\twhile (rte_eal_get_lcore_state(lcore) != RTE_LCORE_FINISHED) {\n \t\tuint64_t new_cycles = rte_get_timer_cycles();\n \n \t\tif (new_cycles - print_cycles > rte_get_timer_hz()) {\ndiff --git a/drivers/event/sw/sw_evdev_selftest.c b/drivers/event/sw/sw_evdev_selftest.c\nindex d00d5de613d7..9e16f7d3520f 100644\n--- a/drivers/event/sw/sw_evdev_selftest.c\n+++ b/drivers/event/sw/sw_evdev_selftest.c\n@@ -3116,8 +3116,8 @@ worker_loopback(struct test *t, uint8_t disable_implicit_release)\n \trte_eal_remote_launch(worker_loopback_worker_fn, t, w_lcore);\n \n \tprint_cycles = cycles = rte_get_timer_cycles();\n-\twhile (rte_eal_get_lcore_state(p_lcore) != FINISHED ||\n-\t\t\trte_eal_get_lcore_state(w_lcore) != FINISHED) {\n+\twhile (rte_eal_get_lcore_state(p_lcore) != RTE_LCORE_FINISHED ||\n+\t rte_eal_get_lcore_state(w_lcore) != RTE_LCORE_FINISHED) {\n \n \t\trte_service_run_iter_on_app_lcore(t->service_id, 1);\n \ndiff --git a/drivers/net/softnic/rte_eth_softnic_thread.c b/drivers/net/softnic/rte_eth_softnic_thread.c\nindex 57989a5aac54..dee3923101bc 100644\n--- a/drivers/net/softnic/rte_eth_softnic_thread.c\n+++ b/drivers/net/softnic/rte_eth_softnic_thread.c\n@@ -118,10 +118,7 @@ thread_is_valid(struct pmd_internals *softnic, uint32_t thread_id)\n static inline int\n thread_is_running(uint32_t thread_id)\n {\n-\tenum rte_lcore_state_t thread_state;\n-\n-\tthread_state = rte_eal_get_lcore_state(thread_id);\n-\treturn (thread_state == RUNNING)? 1 : 0;\n+\treturn rte_eal_get_lcore_state(thread_id) == RTE_LCORE_RUNNING;\n }\n \n static int32_t\ndiff --git a/examples/bond/main.c b/examples/bond/main.c\nindex ef86194fff4a..12123a4b16d8 100644\n--- a/examples/bond/main.c\n+++ b/examples/bond/main.c\n@@ -527,7 +527,7 @@ static void cmd_start_parsed(__attribute__((unused)) void *parsed_result,\n \n \trte_spinlock_trylock(&global_flag_stru_p->lock);\n \tif (global_flag_stru_p->LcoreMainIsRunning == 0)\t{\n-\t\tif (lcore_config[global_flag_stru_p->LcoreMainCore].state != WAIT)\t{\n+\t\tif (lcore_config[global_flag_stru_p->LcoreMainCore].state != RTE_LCORE_WAIT)\t{\n \t\t\trte_spinlock_unlock(&global_flag_stru_p->lock);\n \t\t\treturn;\n \t\t}\n@@ -796,7 +796,7 @@ main(int argc, char *argv[])\n \n \t/* check state of lcores */\n \tRTE_LCORE_FOREACH_SLAVE(slave_core_id) {\n-\tif (lcore_config[slave_core_id].state != WAIT)\n+\tif (lcore_config[slave_core_id].state != RTE_LCORE_WAIT)\n \t\treturn -EBUSY;\n \t}\n \t/* start lcore main on core != master_core - ARP response thread */\ndiff --git a/examples/ip_pipeline/thread.c b/examples/ip_pipeline/thread.c\nindex 272fbbeed1bc..3a62a0aee8bc 100644\n--- a/examples/ip_pipeline/thread.c\n+++ b/examples/ip_pipeline/thread.c\n@@ -158,10 +158,7 @@ thread_init(void)\n static inline int\n thread_is_running(uint32_t thread_id)\n {\n-\tenum rte_lcore_state_t thread_state;\n-\n-\tthread_state = rte_eal_get_lcore_state(thread_id);\n-\treturn (thread_state == RUNNING) ? 1 : 0;\n+\treturn rte_eal_get_lcore_state(thread_id) == RTE_LCORE_RUNNING;\n }\n \n /**\ndiff --git a/examples/l2fwd-keepalive/main.c b/examples/l2fwd-keepalive/main.c\nindex 0bf2b533648a..2e1edfa05937 100644\n--- a/examples/l2fwd-keepalive/main.c\n+++ b/examples/l2fwd-keepalive/main.c\n@@ -502,7 +502,7 @@ dead_core(__rte_unused void *ptr_data, const int id_core)\n \tif (terminate_signal_received)\n \t\treturn;\n \tprintf(\"Dead core %i - restarting..\\n\", id_core);\n-\tif (rte_eal_get_lcore_state(id_core) == FINISHED) {\n+\tif (rte_eal_get_lcore_state(id_core) == RTE_LCORE_FINISHED) {\n \t\trte_eal_wait_lcore(id_core);\n \t\trte_eal_remote_launch(l2fwd_launch_one_lcore, NULL, id_core);\n \t} else {\ndiff --git a/lib/librte_eal/common/eal_common_launch.c b/lib/librte_eal/common/eal_common_launch.c\nindex fe0ba3f0d617..74a3f1a28432 100644\n--- a/lib/librte_eal/common/eal_common_launch.c\n+++ b/lib/librte_eal/common/eal_common_launch.c\n@@ -21,17 +21,17 @@\n int\n rte_eal_wait_lcore(unsigned slave_id)\n {\n-\tif (lcore_config[slave_id].state == WAIT)\n+\tif (lcore_config[slave_id].state == RTE_LCORE_WAITING)\n \t\treturn 0;\n \n-\twhile (lcore_config[slave_id].state != WAIT &&\n-\t lcore_config[slave_id].state != FINISHED)\n+\twhile (lcore_config[slave_id].state != RTE_LCORE_WAITING &&\n+\t lcore_config[slave_id].state != RTE_LCORE_FINISHED)\n \t\trte_pause();\n \n \trte_rmb();\n \n \t/* we are in finished state, go to wait state */\n-\tlcore_config[slave_id].state = WAIT;\n+\tlcore_config[slave_id].state = RTE_LCORE_WAITING;\n \treturn lcore_config[slave_id].ret;\n }\n \n@@ -49,7 +49,7 @@ rte_eal_mp_remote_launch(int (*f)(void *), void *arg,\n \n \t/* check state of lcores */\n \tRTE_LCORE_FOREACH_SLAVE(lcore_id) {\n-\t\tif (lcore_config[lcore_id].state != WAIT)\n+\t\tif (lcore_config[lcore_id].state != RTE_LCORE_WAITING)\n \t\t\treturn -EBUSY;\n \t}\n \n@@ -60,7 +60,7 @@ rte_eal_mp_remote_launch(int (*f)(void *), void *arg,\n \n \tif (call_master == CALL_MASTER) {\n \t\tlcore_config[master].ret = f(arg);\n-\t\tlcore_config[master].state = FINISHED;\n+\t\tlcore_config[master].state = RTE_LCORE_FINISHED;\n \t}\n \n \treturn 0;\ndiff --git a/lib/librte_eal/common/include/rte_launch.h b/lib/librte_eal/common/include/rte_launch.h\nindex 06a671752ace..286ca31c98ab 100644\n--- a/lib/librte_eal/common/include/rte_launch.h\n+++ b/lib/librte_eal/common/include/rte_launch.h\n@@ -19,9 +19,9 @@ extern \"C\" {\n * State of an lcore.\n */\n enum rte_lcore_state_t {\n-\tWAIT, /**< waiting a new command */\n-\tRUNNING, /**< executing command */\n-\tFINISHED, /**< command executed */\n+\tRTE_LCORE_WAITING, /**< waiting a new command */\n+\tRTE_LCORE_RUNNING, /**< executing command */\n+\tRTE_LCORE_FINISHED, /**< command executed */\n };\n \n /**\ndiff --git a/lib/librte_eal/common/rte_service.c b/lib/librte_eal/common/rte_service.c\nindex 5f75e5a53fbf..8dd7586027ff 100644\n--- a/lib/librte_eal/common/rte_service.c\n+++ b/lib/librte_eal/common/rte_service.c\n@@ -450,7 +450,7 @@ rte_service_runner_func(void *arg)\n \t\trte_smp_rmb();\n \t}\n \n-\tlcore_config[lcore].state = WAIT;\n+\tlcore_config[lcore].state = RTE_LCORE_WAITING;\n \n \treturn 0;\n }\ndiff --git a/lib/librte_eal/freebsd/eal/eal.c b/lib/librte_eal/freebsd/eal/eal.c\nindex 790c6afa7050..aae4243486bd 100644\n--- a/lib/librte_eal/freebsd/eal/eal.c\n+++ b/lib/librte_eal/freebsd/eal/eal.c\n@@ -784,7 +784,7 @@ rte_eal_init(int argc, char **argv)\n \t\tif (pipe(lcore_config[i].pipe_slave2master) < 0)\n \t\t\trte_panic(\"Cannot create pipe\\n\");\n \n-\t\tlcore_config[i].state = WAIT;\n+\t\tlcore_config[i].state = RTE_LCORE_WAIT;\n \n \t\t/* create a thread for each lcore */\n \t\tret = pthread_create(&lcore_config[i].thread_id, NULL,\ndiff --git a/lib/librte_eal/freebsd/eal/eal_thread.c b/lib/librte_eal/freebsd/eal/eal_thread.c\nindex 309b5872666b..f25e84fa312b 100644\n--- a/lib/librte_eal/freebsd/eal/eal_thread.c\n+++ b/lib/librte_eal/freebsd/eal/eal_thread.c\n@@ -41,7 +41,7 @@ rte_eal_remote_launch(int (*f)(void *), void *arg, unsigned slave_id)\n \tint m2s = lcore_config[slave_id].pipe_master2slave[1];\n \tint s2m = lcore_config[slave_id].pipe_slave2master[0];\n \n-\tif (lcore_config[slave_id].state != WAIT)\n+\tif (lcore_config[slave_id].state != RTE_LCORE_WAITING)\n \t\treturn -EBUSY;\n \n \tlcore_config[slave_id].f = f;\n@@ -136,7 +136,7 @@ eal_thread_loop(__attribute__((unused)) void *arg)\n \t\tif (n <= 0)\n \t\t\trte_panic(\"cannot read on configuration pipe\\n\");\n \n-\t\tlcore_config[lcore_id].state = RUNNING;\n+\t\tlcore_config[lcore_id].state = RTE_LCORE_RUNNING;\n \n \t\t/* send ack */\n \t\tn = 0;\n@@ -153,7 +153,7 @@ eal_thread_loop(__attribute__((unused)) void *arg)\n \t\tret = lcore_config[lcore_id].f(fct_arg);\n \t\tlcore_config[lcore_id].ret = ret;\n \t\trte_wmb();\n-\t\tlcore_config[lcore_id].state = FINISHED;\n+\t\tlcore_config[lcore_id].state = RTE_LCORE_FINISHED;\n \t}\n \n \t/* never reached */\ndiff --git a/lib/librte_eal/linux/eal/eal.c b/lib/librte_eal/linux/eal/eal.c\nindex 75ed0cf1029f..3fe25a1feb2f 100644\n--- a/lib/librte_eal/linux/eal/eal.c\n+++ b/lib/librte_eal/linux/eal/eal.c\n@@ -1158,7 +1158,7 @@ rte_eal_init(int argc, char **argv)\n \t\tif (pipe(lcore_config[i].pipe_slave2master) < 0)\n \t\t\trte_panic(\"Cannot create pipe\\n\");\n \n-\t\tlcore_config[i].state = WAIT;\n+\t\tlcore_config[i].state = RTE_LCORE_WAITING;\n \n \t\t/* create a thread for each lcore */\n \t\tret = pthread_create(&lcore_config[i].thread_id, NULL,\ndiff --git a/lib/librte_eal/linux/eal/eal_thread.c b/lib/librte_eal/linux/eal/eal_thread.c\nindex 379773b683e8..058692a45412 100644\n--- a/lib/librte_eal/linux/eal/eal_thread.c\n+++ b/lib/librte_eal/linux/eal/eal_thread.c\n@@ -41,7 +41,7 @@ rte_eal_remote_launch(int (*f)(void *), void *arg, unsigned slave_id)\n \tint m2s = lcore_config[slave_id].pipe_master2slave[1];\n \tint s2m = lcore_config[slave_id].pipe_slave2master[0];\n \n-\tif (lcore_config[slave_id].state != WAIT)\n+\tif (lcore_config[slave_id].state != RTE_LCORE_WAITING)\n \t\treturn -EBUSY;\n \n \tlcore_config[slave_id].f = f;\n@@ -136,7 +136,7 @@ eal_thread_loop(__attribute__((unused)) void *arg)\n \t\tif (n <= 0)\n \t\t\trte_panic(\"cannot read on configuration pipe\\n\");\n \n-\t\tlcore_config[lcore_id].state = RUNNING;\n+\t\tlcore_config[lcore_id].state = RTE_LCORE_RUNNING;\n \n \t\t/* send ack */\n \t\tn = 0;\n@@ -158,9 +158,9 @@ eal_thread_loop(__attribute__((unused)) void *arg)\n \t\t * state, because the application will not lcore_wait() for it.\n \t\t */\n \t\tif (lcore_config[lcore_id].core_role == ROLE_SERVICE)\n-\t\t\tlcore_config[lcore_id].state = WAIT;\n+\t\t\tlcore_config[lcore_id].state = RTE_LCORE_WAITING;\n \t\telse\n-\t\t\tlcore_config[lcore_id].state = FINISHED;\n+\t\t\tlcore_config[lcore_id].state = RTE_LCORE_FINISHED;\n \t}\n \n \t/* never reached */\n", "prefixes": [ "v3" ] }{ "id": 52136, "url": "