get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 27614,
    "url": "https://patches.dpdk.org/api/patches/27614/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1502800360-15782-4-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-4-git-send-email-harry.van.haaren@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1502800360-15782-4-git-send-email-harry.van.haaren@intel.com",
    "date": "2017-08-15T12:32:35",
    "name": "[dpdk-dev,3/8] service: rework register to return service id",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "e8506d93448eaacebe706fa1d435d63b44685db5",
    "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-4-git-send-email-harry.van.haaren@intel.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/27614/comments/",
    "check": "warning",
    "checks": "https://patches.dpdk.org/api/patches/27614/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 39D7B90F7;\n\tTue, 15 Aug 2017 14:33:05 +0200 (CEST)",
            "from mga04.intel.com (mga04.intel.com [192.55.52.120])\n\tby dpdk.org (Postfix) with ESMTP id B4FC47D10\n\tfor <dev@dpdk.org>; Tue, 15 Aug 2017 14:32:54 +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:53 -0700",
            "from silpixa00398672.ir.intel.com ([10.237.223.128])\n\tby fmsmga005.fm.intel.com with ESMTP; 15 Aug 2017 05:32:53 -0700"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.41,377,1498546800\"; d=\"scan'208\";a=\"139790186\"",
        "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:35 +0100",
        "Message-Id": "<1502800360-15782-4-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 3/8] service: rework register to return service id",
        "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 service register function to accept\nan extra parameter. The parameter is a uint32_t *, which when\nprovided will be set to the integer service_id that the newly\nregistered service is represented by.\n\nThis is useful for services that wish to validate settings at\na later point in time - they need to know thier own service id.\n\nThis commit updates the eventdev sw pmd, as well as unit tests\nto use the new register API.\n\nSigned-off-by: Harry van Haaren <harry.van.haaren@intel.com>\n---\n drivers/event/sw/sw_evdev.c                        |  4 +--\n drivers/event/sw/sw_evdev.h                        |  1 +\n .../common/include/rte_service_component.h         |  6 +++-\n lib/librte_eal/common/rte_service.c                |  5 +++-\n test/test/test_service_cores.c                     | 32 +++++++++++-----------\n 5 files changed, 28 insertions(+), 20 deletions(-)",
    "diff": "diff --git a/drivers/event/sw/sw_evdev.c b/drivers/event/sw/sw_evdev.c\nindex 9c534b7..819d3ef 100644\n--- a/drivers/event/sw/sw_evdev.c\n+++ b/drivers/event/sw/sw_evdev.c\n@@ -620,7 +620,7 @@ sw_start(struct rte_eventdev *dev)\n \tstruct rte_service_spec *s = rte_service_get_by_name(sw->service_name);\n \tif (!rte_service_is_running(s))\n \t\tSW_LOG_ERR(\"Warning: No Service core enabled on service %s\\n\",\n-\t\t\t\ts->name);\n+\t\t\t\tsw->service_name);\n \n \t/* check all ports are set up */\n \tfor (i = 0; i < sw->port_count; i++)\n@@ -855,7 +855,7 @@ sw_probe(struct rte_vdev_device *vdev)\n \tservice.callback = sw_sched_service_func;\n \tservice.callback_userdata = (void *)dev;\n \n-\tint32_t ret = rte_service_register(&service);\n+\tint32_t ret = rte_service_register(&service, &sw->service_id);\n \tif (ret) {\n \t\tSW_LOG_ERR(\"service register() failed\");\n \t\treturn -ENOEXEC;\ndiff --git a/drivers/event/sw/sw_evdev.h b/drivers/event/sw/sw_evdev.h\nindex 71de3c1..e0dec91 100644\n--- a/drivers/event/sw/sw_evdev.h\n+++ b/drivers/event/sw/sw_evdev.h\n@@ -278,6 +278,7 @@ struct sw_evdev {\n \tuint16_t xstats_count_per_qid[RTE_EVENT_MAX_QUEUES_PER_DEV];\n \tuint16_t xstats_offset_for_qid[RTE_EVENT_MAX_QUEUES_PER_DEV];\n \n+\tuint32_t service_id;\n \tchar service_name[SW_PMD_NAME_MAX];\n };\n \ndiff --git a/lib/librte_eal/common/include/rte_service_component.h b/lib/librte_eal/common/include/rte_service_component.h\nindex 7a946a1..5ba5cdf 100644\n--- a/lib/librte_eal/common/include/rte_service_component.h\n+++ b/lib/librte_eal/common/include/rte_service_component.h\n@@ -89,11 +89,15 @@ struct rte_service_spec {\n  * *rte_service_set_coremask*.\n  *\n  * @param spec The specification of the service to register\n+ * @param[out] service_id A pointer to a uint32_t, which will be filled in\n+ *             during registration of the service. It is set to the integers\n+ *             service number given to the service. This parameter may be NULL.\n  * @retval 0 Successfully registered the service.\n  *         -EINVAL Attempted to register an invalid service (eg, no callback\n  *         set)\n  */\n-int32_t rte_service_register(const struct rte_service_spec *spec);\n+int32_t rte_service_register(const struct rte_service_spec *spec,\n+\t\t\t     uint32_t *service_id);\n \n /**\n  * @warning\ndiff --git a/lib/librte_eal/common/rte_service.c b/lib/librte_eal/common/rte_service.c\nindex c5a8d0d..0ee0c13 100644\n--- a/lib/librte_eal/common/rte_service.c\n+++ b/lib/librte_eal/common/rte_service.c\n@@ -242,7 +242,7 @@ rte_service_is_running(const struct rte_service_spec *spec)\n }\n \n int32_t\n-rte_service_register(const struct rte_service_spec *spec)\n+rte_service_register(const struct rte_service_spec *spec, uint32_t *id_ptr)\n {\n \tuint32_t i;\n \tint32_t free_slot = -1;\n@@ -267,6 +267,9 @@ rte_service_register(const struct rte_service_spec *spec)\n \trte_smp_wmb();\n \trte_service_count++;\n \n+\tif (id_ptr)\n+\t\t*id_ptr = free_slot;\n+\n \treturn 0;\n }\n \ndiff --git a/test/test/test_service_cores.c b/test/test/test_service_cores.c\nindex fd63efd..72d774d 100644\n--- a/test/test/test_service_cores.c\n+++ b/test/test/test_service_cores.c\n@@ -160,15 +160,15 @@ dummy_register(void)\n \tstruct rte_service_spec service;\n \tmemset(&service, 0, sizeof(struct rte_service_spec));\n \n-\tTEST_ASSERT_EQUAL(-EINVAL, rte_service_register(&service),\n+\tTEST_ASSERT_EQUAL(-EINVAL, rte_service_register(&service, NULL),\n \t\t\t\"Invalid callback\");\n \tservice.callback = dummy_cb;\n \n-\tTEST_ASSERT_EQUAL(-EINVAL, rte_service_register(&service),\n+\tTEST_ASSERT_EQUAL(-EINVAL, rte_service_register(&service, NULL),\n \t\t\t\"Invalid name\");\n \tsnprintf(service.name, sizeof(service.name), DUMMY_SERVICE_NAME);\n \n-\tTEST_ASSERT_EQUAL(0, rte_service_register(&service),\n+\tTEST_ASSERT_EQUAL(0, rte_service_register(&service, NULL),\n \t\t\t\"Failed to register valid service\");\n \n \treturn TEST_SUCCESS;\n@@ -187,13 +187,13 @@ service_get_by_name(void)\n \t/* register service */\n \tstruct rte_service_spec service;\n \tmemset(&service, 0, sizeof(struct rte_service_spec));\n-\tTEST_ASSERT_EQUAL(-EINVAL, rte_service_register(&service),\n+\tTEST_ASSERT_EQUAL(-EINVAL, rte_service_register(&service, NULL),\n \t\t\t\"Invalid callback\");\n \tservice.callback = dummy_cb;\n-\tTEST_ASSERT_EQUAL(-EINVAL, rte_service_register(&service),\n+\tTEST_ASSERT_EQUAL(-EINVAL, rte_service_register(&service, NULL),\n \t\t\t\"Invalid name\");\n \tsnprintf(service.name, sizeof(service.name), DUMMY_SERVICE_NAME);\n-\tTEST_ASSERT_EQUAL(0, rte_service_register(&service),\n+\tTEST_ASSERT_EQUAL(0, rte_service_register(&service, NULL),\n \t\t\t\"Failed to register valid service\");\n \n \t/* ensure with dummy services registered returns same ptr as ID */\n@@ -221,7 +221,7 @@ service_probe_capability(void)\n \tservice.callback = dummy_cb;\n \tsnprintf(service.name, sizeof(service.name), DUMMY_SERVICE_NAME);\n \tservice.capabilities |= RTE_SERVICE_CAP_MT_SAFE;\n-\tTEST_ASSERT_EQUAL(0, rte_service_register(&service),\n+\tTEST_ASSERT_EQUAL(0, rte_service_register(&service, NULL),\n \t\t\t\"Register of MT SAFE service failed\");\n \n \t/* verify flag is enabled */\n@@ -235,7 +235,7 @@ service_probe_capability(void)\n \tmemset(&service, 0, sizeof(struct rte_service_spec));\n \tservice.callback = dummy_cb;\n \tsnprintf(service.name, sizeof(service.name), DUMMY_SERVICE_NAME);\n-\tTEST_ASSERT_EQUAL(0, rte_service_register(&service),\n+\tTEST_ASSERT_EQUAL(0, rte_service_register(&service, NULL),\n \t\t\t\"Register of non-MT safe service failed\");\n \n \t/* verify flag is enabled */\n@@ -274,28 +274,28 @@ 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+\tstruct rte_service_spec *s = rte_service_get_by_id(0);\n \n-\t/* is_running() returns if service is running and slcore is mapped */\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 \t\t\t\"Service core add did not return zero\");\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-\tTEST_ASSERT_EQUAL(0, rte_service_is_running(service),\n+\tTEST_ASSERT_EQUAL(0, rte_service_is_running(s),\n \t\t\t\"Error: Service should be stopped\");\n \n-\tTEST_ASSERT_EQUAL(0, rte_service_stop(service),\n+\tTEST_ASSERT_EQUAL(0, rte_service_stop(s),\n \t\t\t\"Error: Service stopped returned non-zero\");\n \n-\tTEST_ASSERT_EQUAL(0, rte_service_is_running(service),\n+\tTEST_ASSERT_EQUAL(0, rte_service_is_running(s),\n \t\t\t\"Error: Service is running - should be stopped\");\n \n-\tTEST_ASSERT_EQUAL(0, rte_service_start(service),\n+\tTEST_ASSERT_EQUAL(0, rte_service_start(s),\n \t\t\t\"Error: Service start returned non-zero\");\n \n-\tTEST_ASSERT_EQUAL(1, rte_service_is_running(service),\n+\tTEST_ASSERT_EQUAL(1, rte_service_is_running(s),\n \t\t\t\"Error: Service is not running\");\n \n \treturn unregister_all();\n@@ -471,7 +471,7 @@ service_threaded_test(int mt_safe)\n \t\tservice.callback = dummy_mt_unsafe_cb;\n \t}\n \n-\tTEST_ASSERT_EQUAL(0, rte_service_register(&service),\n+\tTEST_ASSERT_EQUAL(0, rte_service_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",
    "prefixes": [
        "dpdk-dev",
        "3/8"
    ]
}