Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/27617/?format=api
https://patches.dpdk.org/api/patches/27617/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/1502800360-15782-7-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-7-git-send-email-harry.van.haaren@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1502800360-15782-7-git-send-email-harry.van.haaren@intel.com", "date": "2017-08-15T12:32:38", "name": "[dpdk-dev,6/8] service: rework unregister api to use integers", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "3ac10d1963185db343e7d964f26d515e79b63ae5", "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-7-git-send-email-harry.van.haaren@intel.com/mbox/", "series": [], "comments": "https://patches.dpdk.org/api/patches/27617/comments/", "check": "success", "checks": "https://patches.dpdk.org/api/patches/27617/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 9BB1F9958;\n\tTue, 15 Aug 2017 14:33:11 +0200 (CEST)", "from mga04.intel.com (mga04.intel.com [192.55.52.120])\n\tby dpdk.org (Postfix) with ESMTP id 9F3617D8E\n\tfor <dev@dpdk.org>; Tue, 15 Aug 2017 14:32:57 +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:56 -0700", "from silpixa00398672.ir.intel.com ([10.237.223.128])\n\tby fmsmga005.fm.intel.com with ESMTP; 15 Aug 2017 05:32:56 -0700" ], "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.41,377,1498546800\"; d=\"scan'208\";a=\"139790202\"", "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:38 +0100", "Message-Id": "<1502800360-15782-7-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 6/8] service: rework unregister api to use\n\tintegers", "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 unregister API to accept an integer.\n\nSigned-off-by: Harry van Haaren <harry.van.haaren@intel.com>\n---\n .../common/include/rte_service_component.h | 2 +-\n lib/librte_eal/common/rte_service.c | 25 ++++++----------------\n test/test/test_service_cores.c | 10 +++------\n 3 files changed, 10 insertions(+), 27 deletions(-)", "diff": "diff --git a/lib/librte_eal/common/include/rte_service_component.h b/lib/librte_eal/common/include/rte_service_component.h\nindex 5ba5cdf..70cca69 100644\n--- a/lib/librte_eal/common/include/rte_service_component.h\n+++ b/lib/librte_eal/common/include/rte_service_component.h\n@@ -111,7 +111,7 @@ int32_t rte_service_register(const struct rte_service_spec *spec,\n * @retval -EBUSY The service is currently running, stop the service before\n * calling unregister. No action has been taken.\n */\n-int32_t rte_service_unregister(struct rte_service_spec *service);\n+int32_t rte_service_unregister(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 308ec6f..7299514 100644\n--- a/lib/librte_eal/common/rte_service.c\n+++ b/lib/librte_eal/common/rte_service.c\n@@ -259,35 +259,22 @@ rte_service_register(const struct rte_service_spec *spec, uint32_t *id_ptr)\n }\n \n int32_t\n-rte_service_unregister(struct rte_service_spec *spec)\n+rte_service_unregister(uint32_t id)\n {\n-\tstruct rte_service_spec_impl *s = NULL;\n-\tstruct rte_service_spec_impl *spec_impl =\n-\t\t(struct rte_service_spec_impl *)spec;\n-\n \tuint32_t i;\n-\tuint32_t service_id;\n-\tfor (i = 0; i < RTE_SERVICE_NUM_MAX; i++) {\n-\t\tif (&rte_services[i] == spec_impl) {\n-\t\t\ts = spec_impl;\n-\t\t\tservice_id = i;\n-\t\t\tbreak;\n-\t\t}\n-\t}\n-\n-\tif (!s)\n-\t\treturn -EINVAL;\n+\tstruct rte_service_spec_impl *s;\n+\tSERVICE_VALID_GET_OR_ERR_RET(id, s, -EINVAL);\n \n \trte_service_count--;\n \trte_smp_wmb();\n \n \ts->internal_flags &= ~(SERVICE_F_REGISTERED);\n \n+\t/* clear the run-bit in all cores */\n \tfor (i = 0; i < RTE_MAX_LCORE; i++)\n-\t\tlcore_states[i].service_mask &= ~(UINT64_C(1) << service_id);\n+\t\tlcore_states[i].service_mask &= ~(UINT64_C(1) << id);\n \n-\tmemset(&rte_services[service_id], 0,\n-\t\t\tsizeof(struct rte_service_spec_impl));\n+\tmemset(&rte_services[id], 0, sizeof(struct rte_service_spec_impl));\n \n \treturn 0;\n }\ndiff --git a/test/test/test_service_cores.c b/test/test/test_service_cores.c\nindex 4ece080..43ad027 100644\n--- a/test/test/test_service_cores.c\n+++ b/test/test/test_service_cores.c\n@@ -131,17 +131,13 @@ static int\n unregister_all(void)\n {\n \tuint32_t i;\n-\tstruct rte_service_spec *dead = (struct rte_service_spec *)0xdead;\n \n-\tTEST_ASSERT_EQUAL(-EINVAL, rte_service_unregister(0),\n-\t\t\t\"Unregistered NULL pointer\");\n-\tTEST_ASSERT_EQUAL(-EINVAL, rte_service_unregister(dead),\n-\t\t\t\"Unregistered invalid pointer\");\n+\tTEST_ASSERT_EQUAL(-EINVAL, rte_service_unregister(1000),\n+\t\t\t\"Unregistered invalid service id\");\n \n \tuint32_t c = rte_service_get_count();\n \tfor (i = 0; i < c; i++) {\n-\t\tstruct rte_service_spec *s = rte_service_get_by_id(i);\n-\t\tTEST_ASSERT_EQUAL(0, rte_service_unregister(s),\n+\t\tTEST_ASSERT_EQUAL(0, rte_service_unregister(i),\n \t\t\t\t\"Error unregistering a valid service\");\n \t}\n \n", "prefixes": [ "dpdk-dev", "6/8" ] }{ "id": 27617, "url": "