Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/27687/?format=api
https://patches.dpdk.org/api/patches/27687/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/1503320296-51122-5-git-send-email-harry.van.haaren@intel.com/", "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": "<1503320296-51122-5-git-send-email-harry.van.haaren@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1503320296-51122-5-git-send-email-harry.van.haaren@intel.com", "date": "2017-08-21T12:58:05", "name": "[dpdk-dev,v2,04/15] service: rework service start stop to runstate", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "76716529be97168da3afbf48c099db96d00b6573", "submitter": { "id": 317, "url": "https://patches.dpdk.org/api/people/317/?format=api", "name": "Van Haaren, Harry", "email": "harry.van.haaren@intel.com" }, "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/1503320296-51122-5-git-send-email-harry.van.haaren@intel.com/mbox/", "series": [], "comments": "https://patches.dpdk.org/api/patches/27687/comments/", "check": "success", "checks": "https://patches.dpdk.org/api/patches/27687/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 [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id EA9517D43;\n\tMon, 21 Aug 2017 14:58:33 +0200 (CEST)", "from mga05.intel.com (mga05.intel.com [192.55.52.43])\n\tby dpdk.org (Postfix) with ESMTP id 8687C7D0F\n\tfor <dev@dpdk.org>; Mon, 21 Aug 2017 14:58:30 +0200 (CEST)", "from fmsmga002.fm.intel.com ([10.253.24.26])\n\tby fmsmga105.fm.intel.com with ESMTP; 21 Aug 2017 05:58:30 -0700", "from silpixa00398672.ir.intel.com ([10.237.223.128])\n\tby fmsmga002.fm.intel.com with ESMTP; 21 Aug 2017 05:58:29 -0700" ], "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos; i=\"5.41,409,1498546800\"; d=\"scan'208\";\n\ta=\"1208383280\"", "From": "Harry van Haaren <harry.van.haaren@intel.com>", "To": "dev@dpdk.org", "Cc": "Harry van Haaren <harry.van.haaren@intel.com>", "Date": "Mon, 21 Aug 2017 13:58:05 +0100", "Message-Id": "<1503320296-51122-5-git-send-email-harry.van.haaren@intel.com>", "X-Mailer": "git-send-email 2.7.4", "In-Reply-To": "<1503320296-51122-1-git-send-email-harry.van.haaren@intel.com>", "References": "<1502800360-15782-1-git-send-email-harry.van.haaren@intel.com>\n\t<1503320296-51122-1-git-send-email-harry.van.haaren@intel.com>", "Subject": "[dpdk-dev] [PATCH v2 04/15] service: rework service start stop to\n\trunstate", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://dpdk.org/ml/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "This commit reworks the API to move from two separate start\nand stop functions, to a \"runstate\" API which allows setting\nthe runstate. The is_running API is replaced with an function\nto query the runstate. The runstate functions take a id value\nfor service. Unit tests and the eventdev sw pmd are updated.\n\nSigned-off-by: Harry van Haaren <harry.van.haaren@intel.com>\n---\n drivers/event/sw/sw_evdev.c | 3 +-\n lib/librte_eal/bsdapp/eal/rte_eal_version.map | 5 ++--\n lib/librte_eal/common/include/rte_service.h | 37 +++++++++---------------\n lib/librte_eal/common/rte_service.c | 38 ++++++++++---------------\n lib/librte_eal/linuxapp/eal/rte_eal_version.map | 5 ++--\n test/test/test_service_cores.c | 19 ++++++-------\n 6 files changed, 42 insertions(+), 65 deletions(-)", "diff": "diff --git a/drivers/event/sw/sw_evdev.c b/drivers/event/sw/sw_evdev.c\nindex 9cc63a0..da6ac30 100644\n--- a/drivers/event/sw/sw_evdev.c\n+++ b/drivers/event/sw/sw_evdev.c\n@@ -617,8 +617,7 @@ sw_start(struct rte_eventdev *dev)\n \tstruct sw_evdev *sw = sw_pmd_priv(dev);\n \n \t/* check a service core is mapped to this service */\n-\tstruct rte_service_spec *s = rte_service_get_by_name(sw->service_name);\n-\tif (!rte_service_is_running(s))\n+\tif (!rte_service_runstate_get(sw->service_id))\n \t\tSW_LOG_ERR(\"Warning: No Service core enabled on service %s\\n\",\n \t\t\t\tsw->service_name);\n \ndiff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map\nindex 2b1089d..b336f54 100644\n--- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map\n+++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map\n@@ -217,7 +217,6 @@ EXPERIMENTAL {\n \trte_service_get_by_id;\n \trte_service_get_by_name;\n \trte_service_get_count;\n-\trte_service_is_running;\n \trte_service_lcore_add;\n \trte_service_lcore_count;\n \trte_service_lcore_del;\n@@ -229,10 +228,10 @@ EXPERIMENTAL {\n \trte_service_map_lcore_set;\n \trte_service_probe_capability;\n \trte_service_reset;\n+\trte_service_runstate_get;\n+\trte_service_runstate_set;\n \trte_service_set_stats_enable;\n-\trte_service_start;\n \trte_service_start_with_defaults;\n-\trte_service_stop;\n \trte_service_unregister;\n \n } DPDK_17.08;\ndiff --git a/lib/librte_eal/common/include/rte_service.h b/lib/librte_eal/common/include/rte_service.h\nindex de69695..e133ca1 100644\n--- a/lib/librte_eal/common/include/rte_service.h\n+++ b/lib/librte_eal/common/include/rte_service.h\n@@ -192,40 +192,31 @@ int32_t rte_service_map_lcore_get(uint32_t service_id, uint32_t lcore);\n * @warning\n * @b EXPERIMENTAL: this API may change without prior notice\n *\n- * Enable *service* to run.\n+ * Set the runstate of the service.\n *\n- * This function switches on a service during runtime.\n- * @retval 0 The service was successfully started\n- */\n-int32_t rte_service_start(struct rte_service_spec *service);\n-\n-/**\n- * @warning\n- * @b EXPERIMENTAL: this API may change without prior notice\n+ * Each service is either running or stopped. Setting a non-zero runstate\n+ * enables the service to run, while setting runstate zero disables it.\n *\n- * Disable *service*.\n+ * @param id The id of the service\n+ * @param runstate The run state to apply to the service\n *\n- * Switch off a service, so it is not run until it is *rte_service_start* is\n- * called on it.\n- * @retval 0 Service successfully switched off\n+ * @retval 0 The service was successfully started\n+ * @retval -EINVAL Invalid service id\n */\n-int32_t rte_service_stop(struct rte_service_spec *service);\n+int32_t rte_service_runstate_set(uint32_t id, uint32_t runstate);\n \n /**\n * @warning\n * @b EXPERIMENTAL: this API may change without prior notice\n *\n- * Returns if *service* is currently running.\n- *\n- * This function returns true if the service has been started using\n- * *rte_service_start*, AND a service core is mapped to the service. This\n- * function can be used to ensure that the service will be run.\n+ * Get the runstate for the service with *id*. See *rte_service_runstate_set*\n+ * for details of runstates.\n *\n- * @retval 1 Service is currently running, and has a service lcore mapped\n- * @retval 0 Service is currently stopped, or no service lcore is mapped\n- * @retval -EINVAL Invalid service pointer provided\n+ * @retval 1 Service is running\n+ * @retval 0 Service is stopped\n+ * @retval -EINVAL Invalid service id\n */\n-int32_t rte_service_is_running(const struct rte_service_spec *service);\n+int32_t rte_service_runstate_get(uint32_t id);\n \n /**\n * @warning\ndiff --git a/lib/librte_eal/common/rte_service.c b/lib/librte_eal/common/rte_service.c\nindex 152eafe..2ff1ab0 100644\n--- a/lib/librte_eal/common/rte_service.c\n+++ b/lib/librte_eal/common/rte_service.c\n@@ -230,18 +230,6 @@ rte_service_probe_capability(uint32_t id, uint32_t capability)\n }\n \n int32_t\n-rte_service_is_running(const struct rte_service_spec *spec)\n-{\n-\tconst struct rte_service_spec_impl *impl =\n-\t\t(const struct rte_service_spec_impl *)spec;\n-\tif (!impl)\n-\t\treturn -EINVAL;\n-\n-\treturn (impl->runstate == RUNSTATE_RUNNING) &&\n-\t\t(impl->num_mapped_cores > 0);\n-}\n-\n-int32_t\n rte_service_component_register(const struct rte_service_spec *spec,\n \t\t\t uint32_t *id_ptr)\n {\n@@ -309,23 +297,27 @@ rte_service_unregister(struct rte_service_spec *spec)\n }\n \n int32_t\n-rte_service_start(struct rte_service_spec *service)\n+rte_service_runstate_set(uint32_t id, uint32_t runstate)\n {\n-\tstruct rte_service_spec_impl *s =\n-\t\t(struct rte_service_spec_impl *)service;\n-\ts->runstate = RUNSTATE_RUNNING;\n+\tstruct rte_service_spec_impl *s;\n+\tSERVICE_VALID_GET_OR_ERR_RET(id, s, -EINVAL);\n+\n+\tif (runstate)\n+\t\ts->runstate = RUNSTATE_RUNNING;\n+\telse\n+\t\ts->runstate = RUNSTATE_STOPPED;\n+\n \trte_smp_wmb();\n \treturn 0;\n }\n \n int32_t\n-rte_service_stop(struct rte_service_spec *service)\n+rte_service_runstate_get(uint32_t id)\n {\n-\tstruct rte_service_spec_impl *s =\n-\t\t(struct rte_service_spec_impl *)service;\n-\ts->runstate = RUNSTATE_STOPPED;\n-\trte_smp_wmb();\n-\treturn 0;\n+\tstruct rte_service_spec_impl *s;\n+\tSERVICE_VALID_GET_OR_ERR_RET(id, s, -EINVAL);\n+\n+\treturn (s->runstate == RUNSTATE_RUNNING) && (s->num_mapped_cores > 0);\n }\n \n static int32_t\n@@ -448,7 +440,7 @@ rte_service_start_with_defaults(void)\n \t\tif (lcore_iter >= lcore_count)\n \t\t\tlcore_iter = 0;\n \n-\t\tret = rte_service_start(s);\n+\t\tret = rte_service_runstate_set(i, 1);\n \t\tif (ret)\n \t\t\treturn -ENOEXEC;\n \t}\ndiff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map\nindex 336e40e..b2b2235 100644\n--- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map\n+++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map\n@@ -222,7 +222,6 @@ EXPERIMENTAL {\n \trte_service_get_by_id;\n \trte_service_get_by_name;\n \trte_service_get_count;\n-\trte_service_is_running;\n \trte_service_lcore_add;\n \trte_service_lcore_count;\n \trte_service_lcore_del;\n@@ -234,10 +233,10 @@ EXPERIMENTAL {\n \trte_service_map_lcore_set;\n \trte_service_probe_capability;\n \trte_service_reset;\n+\trte_service_runstate_get;\n+\trte_service_runstate_set;\n \trte_service_set_stats_enable;\n-\trte_service_start;\n \trte_service_start_with_defaults;\n-\trte_service_stop;\n \trte_service_unregister;\n \n } DPDK_17.08;\ndiff --git a/test/test/test_service_cores.c b/test/test/test_service_cores.c\nindex 7767fa2..196277b 100644\n--- a/test/test/test_service_cores.c\n+++ b/test/test/test_service_cores.c\n@@ -278,7 +278,6 @@ static int\n service_start_stop(void)\n {\n \tconst uint32_t sid = 0;\n-\tstruct rte_service_spec *s = rte_service_get_by_id(0);\n \n \t/* runstate_get() returns if service is running and slcore is mapped */\n \tTEST_ASSERT_EQUAL(0, rte_service_lcore_add(slcore_id),\n@@ -287,19 +286,19 @@ service_start_stop(void)\n \tTEST_ASSERT_EQUAL(0, ret,\n \t\t\t\"Enabling service core, expected 0 got %d\", ret);\n \n-\tTEST_ASSERT_EQUAL(0, rte_service_is_running(s),\n+\tTEST_ASSERT_EQUAL(0, rte_service_runstate_get(sid),\n \t\t\t\"Error: Service should be stopped\");\n \n-\tTEST_ASSERT_EQUAL(0, rte_service_stop(s),\n+\tTEST_ASSERT_EQUAL(0, rte_service_runstate_set(sid, 0),\n \t\t\t\"Error: Service stopped returned non-zero\");\n \n-\tTEST_ASSERT_EQUAL(0, rte_service_is_running(s),\n+\tTEST_ASSERT_EQUAL(0, rte_service_runstate_get(sid),\n \t\t\t\"Error: Service is running - should be stopped\");\n \n-\tTEST_ASSERT_EQUAL(0, rte_service_start(s),\n+\tTEST_ASSERT_EQUAL(0, rte_service_runstate_set(sid, 1),\n \t\t\t\"Error: Service start returned non-zero\");\n \n-\tTEST_ASSERT_EQUAL(1, rte_service_is_running(s),\n+\tTEST_ASSERT_EQUAL(1, rte_service_runstate_get(sid),\n \t\t\t\"Error: Service is not running\");\n \n \treturn unregister_all();\n@@ -478,9 +477,8 @@ service_threaded_test(int mt_safe)\n \tTEST_ASSERT_EQUAL(0, rte_service_component_register(&service, NULL),\n \t\t\t\"Register of MT SAFE service failed\");\n \n-\tstruct rte_service_spec *s = rte_service_get_by_id(0);\n \tconst uint32_t sid = 0;\n-\tTEST_ASSERT_EQUAL(0, rte_service_start(s),\n+\tTEST_ASSERT_EQUAL(0, rte_service_runstate_set(sid, 1),\n \t\t\t\"Starting valid service failed\");\n \tTEST_ASSERT_EQUAL(0, rte_service_map_lcore_set(sid, slcore_1, 1),\n \t\t\t\"Failed to enable lcore 1 on mt safe service\");\n@@ -497,7 +495,7 @@ service_threaded_test(int mt_safe)\n \tTEST_ASSERT_EQUAL(1, test_params[1],\n \t\t\t\"MT Safe service not run by two cores concurrently\");\n \n-\tTEST_ASSERT_EQUAL(0, rte_service_stop(s),\n+\tTEST_ASSERT_EQUAL(0, rte_service_runstate_set(sid, 0),\n \t\t\t\"Failed to stop MT Safe service\");\n \n \tunregister_all();\n@@ -536,8 +534,7 @@ service_lcore_start_stop(void)\n {\n \t/* start service core and service, create mapping so tick() runs */\n \tconst uint32_t sid = 0;\n-\tstruct rte_service_spec *s = rte_service_get_by_id(0);\n-\tTEST_ASSERT_EQUAL(0, rte_service_start(s),\n+\tTEST_ASSERT_EQUAL(0, rte_service_runstate_set(sid, 1),\n \t\t\t\"Starting valid service failed\");\n \tTEST_ASSERT_EQUAL(-EINVAL, rte_service_map_lcore_set(sid, slcore_id, 1),\n \t\t\t\"Enabling valid service on non-service core must fail\");\n", "prefixes": [ "dpdk-dev", "v2", "04/15" ] }{ "id": 27687, "url": "