get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/27613/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 27613,
    "url": "https://patches.dpdk.org/api/patches/27613/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1502800360-15782-3-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": "<1502800360-15782-3-git-send-email-harry.van.haaren@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1502800360-15782-3-git-send-email-harry.van.haaren@intel.com",
    "date": "2017-08-15T12:32:34",
    "name": "[dpdk-dev,2/8] service: rework lcore to service map functions",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "2218b5c6ac979f5f7f32564e655ddec070d918a0",
    "submitter": {
        "id": 317,
        "url": "https://patches.dpdk.org/api/people/317/?format=api",
        "name": "Van Haaren, Harry",
        "email": "harry.van.haaren@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1502800360-15782-3-git-send-email-harry.van.haaren@intel.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/27613/comments/",
    "check": "warning",
    "checks": "https://patches.dpdk.org/api/patches/27613/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 3AA697CD6;\n\tTue, 15 Aug 2017 14:33:02 +0200 (CEST)",
            "from mga04.intel.com (mga04.intel.com [192.55.52.120])\n\tby dpdk.org (Postfix) with ESMTP id EA7FE7CD6\n\tfor <dev@dpdk.org>; Tue, 15 Aug 2017 14:32:53 +0200 (CEST)",
            "from fmsmga005.fm.intel.com ([10.253.24.32])\n\tby fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t15 Aug 2017 05:32:52 -0700",
            "from silpixa00398672.ir.intel.com ([10.237.223.128])\n\tby fmsmga005.fm.intel.com with ESMTP; 15 Aug 2017 05:32:52 -0700"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.41,377,1498546800\"; d=\"scan'208\";a=\"139790179\"",
        "From": "Harry van Haaren <harry.van.haaren@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "Harry van Haaren <harry.van.haaren@intel.com>",
        "Date": "Tue, 15 Aug 2017 13:32:34 +0100",
        "Message-Id": "<1502800360-15782-3-git-send-email-harry.van.haaren@intel.com>",
        "X-Mailer": "git-send-email 2.7.4",
        "In-Reply-To": "<1502800360-15782-1-git-send-email-harry.van.haaren@intel.com>",
        "References": "<1502800360-15782-1-git-send-email-harry.van.haaren@intel.com>",
        "Subject": "[dpdk-dev] [PATCH 2/8] service: rework lcore to service map\n\tfunctions",
        "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 updates the APIs exposed to map service cores and\nservices. The previous APIs required a pointer to a service,\nand used two seperate functions for enable and disable. The\nnew API uses an integer ID for the service and has a parameter\nfor map or unmap. Unit tests are updated and passing, and the\nmap file is updated to the new function names.\n\nSigned-off-by: Harry van Haaren <harry.van.haaren@intel.com>\n---\n lib/librte_eal/bsdapp/eal/rte_eal_version.map   |  5 ++-\n lib/librte_eal/common/include/rte_service.h     | 43 +++++++++----------------\n lib/librte_eal/common/rte_service.c             | 31 ++++++++----------\n lib/librte_eal/linuxapp/eal/rte_eal_version.map |  5 ++-\n test/test/test_service_cores.c                  | 27 +++++++++-------\n 5 files changed, 48 insertions(+), 63 deletions(-)",
    "diff": "diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map\nindex aac6fd7..f626a6f 100644\n--- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map\n+++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map\n@@ -212,13 +212,10 @@ EXPERIMENTAL {\n \trte_eal_devargs_remove;\n \trte_eal_hotplug_add;\n \trte_eal_hotplug_remove;\n-\trte_service_disable_on_lcore;\n \trte_service_dump;\n-\trte_service_enable_on_lcore;\n \trte_service_get_by_id;\n \trte_service_get_by_name;\n \trte_service_get_count;\n-\trte_service_get_enabled_on_lcore;\n \trte_service_is_running;\n \trte_service_lcore_add;\n \trte_service_lcore_count;\n@@ -227,6 +224,8 @@ EXPERIMENTAL {\n \trte_service_lcore_reset_all;\n \trte_service_lcore_start;\n \trte_service_lcore_stop;\n+\trte_service_map_lcore_get;\n+\trte_service_map_lcore_set;\n \trte_service_probe_capability;\n \trte_service_register;\n \trte_service_reset;\ndiff --git a/lib/librte_eal/common/include/rte_service.h b/lib/librte_eal/common/include/rte_service.h\nindex bed1a61..de69695 100644\n--- a/lib/librte_eal/common/include/rte_service.h\n+++ b/lib/librte_eal/common/include/rte_service.h\n@@ -152,10 +152,10 @@ int32_t rte_service_probe_capability(uint32_t id, uint32_t capability);\n  * @warning\n  * @b EXPERIMENTAL: this API may change without prior notice\n  *\n- * Enable a core to run a service.\n+ * Map or unmap a lcore to a service.\n  *\n- * Each core can be added or removed from running specific services. This\n- * functions adds *lcore* to the set of cores that will run *service*.\n+ * Each core can be added or removed from running a specific service. This\n+ * function enables or disables *lcore* to run *service_id*.\n  *\n  * If multiple cores are enabled on a service, an atomic is used to ensure that\n  * only one cores runs the service at a time. The exception to this is when\n@@ -163,43 +163,30 @@ int32_t rte_service_probe_capability(uint32_t id, uint32_t capability);\n  * called RTE_SERVICE_CAP_MT_SAFE. With the multi-thread safe capability set,\n  * the service function can be run on multiple threads at the same time.\n  *\n- * @retval 0 lcore added successfully\n- * @retval -EINVAL An invalid service or lcore was provided.\n- */\n-int32_t rte_service_enable_on_lcore(struct rte_service_spec *service,\n-\t\t\t\t   uint32_t lcore);\n-\n-/**\n- * @warning\n- * @b EXPERIMENTAL: this API may change without prior notice\n- *\n- * Disable a core to run a service.\n+ * @param service_id the service to apply the lcore to\n+ * @param lcore The lcore that will be mapped to service\n+ * @param enable Zero to unmap or disable the core, non-zero to enable\n  *\n- * Each core can be added or removed from running specific services. This\n- * functions removes *lcore* to the set of cores that will run *service*.\n- *\n- * @retval 0 Lcore removed successfully\n+ * @retval 0 lcore map updated successfully\n  * @retval -EINVAL An invalid service or lcore was provided.\n  */\n-int32_t rte_service_disable_on_lcore(struct rte_service_spec *service,\n-\t\t\t\t   uint32_t lcore);\n+int32_t rte_service_map_lcore_set(uint32_t service_id, uint32_t lcore,\n+\t\t\t\t  uint32_t enable);\n \n /**\n  * @warning\n  * @b EXPERIMENTAL: this API may change without prior notice\n  *\n- * Return if an lcore is enabled for the service.\n+ * Retrieve the mapping of an lcore to a service.\n  *\n- * This function allows the application to query if *lcore* is currently set to\n- * run *service*.\n+ * @param service_id the service to apply the lcore to\n+ * @param lcore The lcore that will be mapped to service\n  *\n- * @retval 1 Lcore enabled on this lcore\n- * @retval 0 Lcore disabled on this lcore\n+ * @retval 1 lcore is mapped to service\n+ * @retval 0 lcore is not mapped to service\n  * @retval -EINVAL An invalid service or lcore was provided.\n  */\n-int32_t rte_service_get_enabled_on_lcore(struct rte_service_spec *service,\n-\t\t\t\t\tuint32_t lcore);\n-\n+int32_t rte_service_map_lcore_get(uint32_t service_id, uint32_t lcore);\n \n /**\n  * @warning\ndiff --git a/lib/librte_eal/common/rte_service.c b/lib/librte_eal/common/rte_service.c\nindex c969406..c5a8d0d 100644\n--- a/lib/librte_eal/common/rte_service.c\n+++ b/lib/librte_eal/common/rte_service.c\n@@ -436,7 +436,7 @@ rte_service_start_with_defaults(void)\n \t\t * should multiplex to a single core, or 1:1 if there are the\n \t\t * same amount of services as service-cores\n \t\t */\n-\t\tret = rte_service_enable_on_lcore(s, ids[lcore_iter]);\n+\t\tret = rte_service_map_lcore_set(i, ids[lcore_iter], 1);\n \t\tif (ret)\n \t\t\treturn -ENODEV;\n \n@@ -492,28 +492,25 @@ service_update(struct rte_service_spec *service, uint32_t lcore,\n \treturn 0;\n }\n \n-int32_t rte_service_get_enabled_on_lcore(struct rte_service_spec *service,\n-\t\t\t\t\tuint32_t lcore)\n-{\n-\tuint32_t enabled;\n-\tint ret = service_update(service, lcore, 0, &enabled);\n-\tif (ret == 0)\n-\t\treturn enabled;\n-\treturn -EINVAL;\n-}\n-\n int32_t\n-rte_service_enable_on_lcore(struct rte_service_spec *service, uint32_t lcore)\n+rte_service_map_lcore_set(uint32_t id, uint32_t lcore, uint32_t enabled)\n {\n-\tuint32_t on = 1;\n-\treturn service_update(service, lcore, &on, 0);\n+\tstruct rte_service_spec_impl *s;\n+\tSERVICE_VALID_GET_OR_ERR_RET(id, s, -EINVAL);\n+\tuint32_t on = enabled > 0;\n+\treturn service_update(&s->spec, lcore, &on, 0);\n }\n \n int32_t\n-rte_service_disable_on_lcore(struct rte_service_spec *service, uint32_t lcore)\n+rte_service_map_lcore_get(uint32_t id, uint32_t lcore)\n {\n-\tuint32_t off = 0;\n-\treturn service_update(service, lcore, &off, 0);\n+\tstruct rte_service_spec_impl *s;\n+\tSERVICE_VALID_GET_OR_ERR_RET(id, s, -EINVAL);\n+\tuint32_t enabled;\n+\tint ret = service_update(&s->spec, lcore, 0, &enabled);\n+\tif (ret == 0)\n+\t\treturn enabled;\n+\treturn ret;\n }\n \n int32_t rte_service_lcore_reset_all(void)\ndiff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map\nindex 3a8f154..452ae1c 100644\n--- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map\n+++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map\n@@ -217,13 +217,10 @@ EXPERIMENTAL {\n \trte_eal_devargs_remove;\n \trte_eal_hotplug_add;\n \trte_eal_hotplug_remove;\n-\trte_service_disable_on_lcore;\n \trte_service_dump;\n-\trte_service_enable_on_lcore;\n \trte_service_get_by_id;\n \trte_service_get_by_name;\n \trte_service_get_count;\n-\trte_service_get_enabled_on_lcore;\n \trte_service_is_running;\n \trte_service_lcore_add;\n \trte_service_lcore_count;\n@@ -232,6 +229,8 @@ EXPERIMENTAL {\n \trte_service_lcore_reset_all;\n \trte_service_lcore_start;\n \trte_service_lcore_stop;\n+\trte_service_map_lcore_get;\n+\trte_service_map_lcore_set;\n \trte_service_probe_capability;\n \trte_service_register;\n \trte_service_reset;\ndiff --git a/test/test/test_service_cores.c b/test/test/test_service_cores.c\nindex 940bc62..fd63efd 100644\n--- a/test/test/test_service_cores.c\n+++ b/test/test/test_service_cores.c\n@@ -273,12 +273,13 @@ service_dump(void)\n static int\n service_start_stop(void)\n {\n+\tconst uint32_t sid = 0;\n \tstruct rte_service_spec *service = rte_service_get_by_id(0);\n \n \t/* is_running() returns if service is running and slcore is mapped */\n \tTEST_ASSERT_EQUAL(0, rte_service_lcore_add(slcore_id),\n \t\t\t\"Service core add did not return zero\");\n-\tint ret = rte_service_enable_on_lcore(service, slcore_id);\n+\tint ret = rte_service_map_lcore_set(sid, slcore_id, 1);\n \tTEST_ASSERT_EQUAL(0, ret,\n \t\t\t\"Enabling service core, expected 0 got %d\", ret);\n \n@@ -313,12 +314,12 @@ service_remote_launch_func(void *arg)\n static int\n service_lcore_en_dis_able(void)\n {\n-\tstruct rte_service_spec *s = rte_service_get_by_id(0);\n+\tconst uint32_t sid = 0;\n \n \t/* expected failure cases */\n-\tTEST_ASSERT_EQUAL(-EINVAL, rte_service_enable_on_lcore(s, 100000),\n+\tTEST_ASSERT_EQUAL(-EINVAL, rte_service_map_lcore_set(sid, 100000, 1),\n \t\t\t\"Enable on invalid core did not fail\");\n-\tTEST_ASSERT_EQUAL(-EINVAL, rte_service_disable_on_lcore(s, 100000),\n+\tTEST_ASSERT_EQUAL(-EINVAL, rte_service_map_lcore_set(sid, 100000, 0),\n \t\t\t\"Disable on invalid core did not fail\");\n \n \t/* add service core to allow enabling */\n@@ -326,15 +327,15 @@ service_lcore_en_dis_able(void)\n \t\t\t\"Add service core failed when not in use before\");\n \n \t/* valid enable */\n-\tTEST_ASSERT_EQUAL(0, rte_service_enable_on_lcore(s, slcore_id),\n+\tTEST_ASSERT_EQUAL(0, rte_service_map_lcore_set(sid, slcore_id, 1),\n \t\t\t\"Enabling valid service and core failed\");\n-\tTEST_ASSERT_EQUAL(1, rte_service_get_enabled_on_lcore(s, slcore_id),\n+\tTEST_ASSERT_EQUAL(1, rte_service_map_lcore_get(sid, slcore_id),\n \t\t\t\"Enabled core returned not-enabled\");\n \n \t/* valid disable */\n-\tTEST_ASSERT_EQUAL(0, rte_service_disable_on_lcore(s, slcore_id),\n+\tTEST_ASSERT_EQUAL(0, rte_service_map_lcore_set(sid, slcore_id, 0),\n \t\t\t\"Disabling valid service and lcore failed\");\n-\tTEST_ASSERT_EQUAL(0, rte_service_get_enabled_on_lcore(s, slcore_id),\n+\tTEST_ASSERT_EQUAL(0, rte_service_map_lcore_get(sid, slcore_id),\n \t\t\t\"Disabled core returned enabled\");\n \n \t/* call remote_launch to verify that app can launch ex-service lcore */\n@@ -474,11 +475,12 @@ service_threaded_test(int mt_safe)\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 \t\t\t\"Starting valid service failed\");\n-\tTEST_ASSERT_EQUAL(0, rte_service_enable_on_lcore(s, slcore_1),\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-\tTEST_ASSERT_EQUAL(0, rte_service_enable_on_lcore(s, slcore_2),\n+\tTEST_ASSERT_EQUAL(0, rte_service_map_lcore_set(sid, slcore_2, 1),\n \t\t\t\"Failed to enable lcore 2 on mt safe service\");\n \trte_service_lcore_start(slcore_1);\n \trte_service_lcore_start(slcore_2);\n@@ -529,10 +531,11 @@ static int\n 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 \t\t\t\"Starting valid service failed\");\n-\tTEST_ASSERT_EQUAL(-EINVAL, rte_service_enable_on_lcore(s, slcore_id),\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 \n \t/* core start */\n@@ -540,7 +543,7 @@ service_lcore_start_stop(void)\n \t\t\t\"Service core start without add should return EINVAL\");\n \tTEST_ASSERT_EQUAL(0, rte_service_lcore_add(slcore_id),\n \t\t\t\"Service core add did not return zero\");\n-\tTEST_ASSERT_EQUAL(0, rte_service_enable_on_lcore(s, slcore_id),\n+\tTEST_ASSERT_EQUAL(0, rte_service_map_lcore_set(sid, slcore_id, 1),\n \t\t\t\"Enabling valid service on valid core failed\");\n \tTEST_ASSERT_EQUAL(0, rte_service_lcore_start(slcore_id),\n \t\t\t\"Service core start after add failed\");\n",
    "prefixes": [
        "dpdk-dev",
        "2/8"
    ]
}