Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/69786/?format=api
https://patches.dpdk.org/api/patches/69786/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/20200505211732.25291-5-honnappa.nagarahalli@arm.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": "<20200505211732.25291-5-honnappa.nagarahalli@arm.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20200505211732.25291-5-honnappa.nagarahalli@arm.com", "date": "2020-05-05T21:17:30", "name": "[v4,4/6] service: remove redundant code", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "198c2a2788353de65f459fedf2014ca068dba385", "submitter": { "id": 1045, "url": "https://patches.dpdk.org/api/people/1045/?format=api", "name": "Honnappa Nagarahalli", "email": "honnappa.nagarahalli@arm.com" }, "delegate": { "id": 24651, "url": "https://patches.dpdk.org/api/users/24651/?format=api", "username": "dmarchand", "first_name": "David", "last_name": "Marchand", "email": "david.marchand@redhat.com" }, "mbox": "https://patches.dpdk.org/project/dpdk/patch/20200505211732.25291-5-honnappa.nagarahalli@arm.com/mbox/", "series": [ { "id": 9845, "url": "https://patches.dpdk.org/api/series/9845/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=9845", "date": "2020-05-05T21:17:26", "name": "use c11 atomics for service core lib", "version": 4, "mbox": "https://patches.dpdk.org/series/9845/mbox/" } ], "comments": "https://patches.dpdk.org/api/patches/69786/comments/", "check": "success", "checks": "https://patches.dpdk.org/api/patches/69786/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@inbox.dpdk.org", "Delivered-To": "patchwork@inbox.dpdk.org", "Received": [ "from dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 4EF1DA0352;\n\tTue, 5 May 2020 23:18:21 +0200 (CEST)", "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 00EB31D6F5;\n\tTue, 5 May 2020 23:17:56 +0200 (CEST)", "from foss.arm.com (foss.arm.com [217.140.110.172])\n by dpdk.org (Postfix) with ESMTP id 16AF31D6F2\n for <dev@dpdk.org>; Tue, 5 May 2020 23:17:55 +0200 (CEST)", "from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14])\n by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9535630E;\n Tue, 5 May 2020 14:17:54 -0700 (PDT)", "from qc2400f-1.austin.arm.com (qc2400f-1.austin.arm.com\n [10.118.14.48])\n by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 82A973F305;\n Tue, 5 May 2020 14:17:54 -0700 (PDT)" ], "From": "Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>", "To": "dev@dpdk.org,\n\tphil.yang@arm.com,\n\tharry.van.haaren@intel.com", "Cc": "thomas@monjalon.net, david.marchand@redhat.com,\n konstantin.ananyev@intel.com, jerinj@marvell.com, hemant.agrawal@nxp.com,\n gage.eads@intel.com, bruce.richardson@intel.com,\n honnappa.nagarahalli@arm.com, nd@arm.com", "Date": "Tue, 5 May 2020 16:17:30 -0500", "Message-Id": "<20200505211732.25291-5-honnappa.nagarahalli@arm.com>", "X-Mailer": "git-send-email 2.17.1", "In-Reply-To": "<20200505211732.25291-1-honnappa.nagarahalli@arm.com>", "References": "<1587659482-27133-1-git-send-email-phil.yang@arm.com>\n <20200505211732.25291-1-honnappa.nagarahalli@arm.com>", "Subject": "[dpdk-dev] [PATCH v4 4/6] service: remove redundant code", "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 <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 <mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "From: Phil Yang <phil.yang@arm.com>\n\nThe service id validation is duplicated, remove the redundant code\nin the calling functions.\n\nSigned-off-by: Phil Yang <phil.yang@arm.com>\nReviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>\nAcked-by: Harry van Haaren <harry.van.haaren@intel.com>\n---\n lib/librte_eal/common/rte_service.c | 28 ++++++----------------------\n 1 file changed, 6 insertions(+), 22 deletions(-)", "diff": "diff --git a/lib/librte_eal/common/rte_service.c b/lib/librte_eal/common/rte_service.c\nindex 62ea9cbd6..37c16c4bc 100644\n--- a/lib/librte_eal/common/rte_service.c\n+++ b/lib/librte_eal/common/rte_service.c\n@@ -541,24 +541,12 @@ rte_service_start_with_defaults(void)\n }\n \n static int32_t\n-service_update(struct rte_service_spec *service, uint32_t lcore,\n+service_update(uint32_t sid, uint32_t lcore,\n \t\tuint32_t *set, uint32_t *enabled)\n {\n-\tuint32_t i;\n-\tint32_t sid = -1;\n-\n-\tfor (i = 0; i < RTE_SERVICE_NUM_MAX; i++) {\n-\t\tif ((struct rte_service_spec *)&rte_services[i] == service &&\n-\t\t\t\tservice_valid(i)) {\n-\t\t\tsid = i;\n-\t\t\tbreak;\n-\t\t}\n-\t}\n-\n-\tif (sid == -1 || lcore >= RTE_MAX_LCORE)\n-\t\treturn -EINVAL;\n-\n-\tif (!lcore_states[lcore].is_service_core)\n+\t/* validate ID, or return error value */\n+\tif (sid >= RTE_SERVICE_NUM_MAX || !service_valid(sid) ||\n+\t lcore >= RTE_MAX_LCORE || !lcore_states[lcore].is_service_core)\n \t\treturn -EINVAL;\n \n \tuint64_t sid_mask = UINT64_C(1) << sid;\n@@ -587,19 +575,15 @@ service_update(struct rte_service_spec *service, uint32_t lcore,\n int32_t\n rte_service_map_lcore_set(uint32_t id, uint32_t lcore, uint32_t enabled)\n {\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+\treturn service_update(id, lcore, &on, 0);\n }\n \n int32_t\n rte_service_map_lcore_get(uint32_t id, uint32_t lcore)\n {\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+\tint ret = service_update(id, lcore, 0, &enabled);\n \tif (ret == 0)\n \t\treturn enabled;\n \treturn ret;\n", "prefixes": [ "v4", "4/6" ] }{ "id": 69786, "url": "