get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 27616,
    "url": "https://patches.dpdk.org/api/patches/27616/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1502800360-15782-6-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-6-git-send-email-harry.van.haaren@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1502800360-15782-6-git-send-email-harry.van.haaren@intel.com",
    "date": "2017-08-15T12:32:37",
    "name": "[dpdk-dev,5/8] service: rework service stats functions",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "2c14528357bfa76d67f5042f855b11fb35ae7c2f",
    "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-6-git-send-email-harry.van.haaren@intel.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/27616/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/27616/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 5E2639187;\n\tTue, 15 Aug 2017 14:33:10 +0200 (CEST)",
            "from mga04.intel.com (mga04.intel.com [192.55.52.120])\n\tby dpdk.org (Postfix) with ESMTP id E17677D10\n\tfor <dev@dpdk.org>; Tue, 15 Aug 2017 14:32:56 +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:55 -0700",
            "from silpixa00398672.ir.intel.com ([10.237.223.128])\n\tby fmsmga005.fm.intel.com with ESMTP; 15 Aug 2017 05:32:55 -0700"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.41,377,1498546800\"; d=\"scan'208\";a=\"139790199\"",
        "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:37 +0100",
        "Message-Id": "<1502800360-15782-6-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 5/8] service: rework service stats functions",
        "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 statistics functions to use integer ids\nfor services instead of pointers. Passing UINT32_MAX to the dump\nfunction prints all info, similar to passing NULL previously.\n\nSigned-off-by: Harry van Haaren <harry.van.haaren@intel.com>\n---\n lib/librte_eal/common/include/rte_service.h | 14 ++++++++------\n lib/librte_eal/common/rte_service.c         | 24 ++++++++++++------------\n test/test/test_service_cores.c              | 10 +++++-----\n 3 files changed, 25 insertions(+), 23 deletions(-)",
    "diff": "diff --git a/lib/librte_eal/common/include/rte_service.h b/lib/librte_eal/common/include/rte_service.h\nindex e133ca1..afa6c0bf 100644\n--- a/lib/librte_eal/common/include/rte_service.h\n+++ b/lib/librte_eal/common/include/rte_service.h\n@@ -318,13 +318,12 @@ int32_t rte_service_lcore_reset_all(void);\n  * Enable or disable statistics collection for *service*.\n  *\n  * This function enables per core, per-service cycle count collection.\n- * @param service The service to enable statistics gathering on.\n+ * @param id The service to enable statistics gathering on.\n  * @param enable Zero to disable statistics, non-zero to enable.\n  * @retval 0 Success\n  * @retval -EINVAL Invalid service pointer passed\n  */\n-int32_t rte_service_set_stats_enable(struct rte_service_spec *service,\n-\t\t\t\t  int32_t enable);\n+int32_t rte_service_set_stats_enable(uint32_t id, int32_t enable);\n \n /**\n  * @warning\n@@ -351,10 +350,13 @@ int32_t rte_service_lcore_list(uint32_t array[], uint32_t n);\n  * @warning\n  * @b EXPERIMENTAL: this API may change without prior notice\n  *\n- * Dumps any information available about the service. If service is NULL,\n- * dumps info for all services.\n+ * Dumps any information available about the service. When id is UINT32_MAX,\n+ * this function dumps info for all services.\n+ *\n+ * @retval 0 Statistics have been successfully dumped\n+ * @retval -EINVAL Invalid service id provided\n  */\n-int32_t rte_service_dump(FILE *f, struct rte_service_spec *service);\n+int32_t rte_service_dump(FILE *f, uint32_t id);\n \n #ifdef __cplusplus\n }\ndiff --git a/lib/librte_eal/common/rte_service.c b/lib/librte_eal/common/rte_service.c\nindex 7e9bf4d..308ec6f 100644\n--- a/lib/librte_eal/common/rte_service.c\n+++ b/lib/librte_eal/common/rte_service.c\n@@ -166,18 +166,15 @@ service_mt_safe(struct rte_service_spec_impl *s)\n \treturn s->spec.capabilities & RTE_SERVICE_CAP_MT_SAFE;\n }\n \n-int32_t rte_service_set_stats_enable(struct rte_service_spec *service,\n-\t\t\t\t  int32_t enabled)\n+int32_t rte_service_set_stats_enable(uint32_t id, int32_t enabled)\n {\n-\tstruct rte_service_spec_impl *impl =\n-\t\t(struct rte_service_spec_impl *)service;\n-\tif (!impl)\n-\t\treturn -EINVAL;\n+\tstruct rte_service_spec_impl *s;\n+\tSERVICE_VALID_GET_OR_ERR_RET(id, s, 0);\n \n \tif (enabled)\n-\t\timpl->internal_flags |= SERVICE_F_STATS_ENABLED;\n+\t\ts->internal_flags |= SERVICE_F_STATS_ENABLED;\n \telse\n-\t\timpl->internal_flags &= ~(SERVICE_F_STATS_ENABLED);\n+\t\ts->internal_flags &= ~(SERVICE_F_STATS_ENABLED);\n \n \treturn 0;\n }\n@@ -669,9 +666,10 @@ service_dump_calls_per_lcore(FILE *f, uint32_t lcore, uint32_t reset)\n \tfprintf(f, \"\\n\");\n }\n \n-int32_t rte_service_dump(FILE *f, struct rte_service_spec *service)\n+int32_t rte_service_dump(FILE *f, uint32_t id)\n {\n \tuint32_t i;\n+\tint print_one = (id != UINT32_MAX);\n \n \tuint64_t total_cycles = 0;\n \tfor (i = 0; i < rte_service_count; i++) {\n@@ -680,15 +678,17 @@ int32_t rte_service_dump(FILE *f, struct rte_service_spec *service)\n \t\ttotal_cycles += rte_services[i].cycles_spent;\n \t}\n \n-\tif (service) {\n-\t\tstruct rte_service_spec_impl *s =\n-\t\t\t(struct rte_service_spec_impl *)service;\n+\t/* print only the specified service */\n+\tif (print_one) {\n+\t\tstruct rte_service_spec_impl *s;\n+\t\tSERVICE_VALID_GET_OR_ERR_RET(id, s, -EINVAL);\n \t\tfprintf(f, \"Service %s Summary\\n\", s->spec.name);\n \t\tuint32_t reset = 0;\n \t\trte_service_dump_one(f, s, total_cycles, reset);\n \t\treturn 0;\n \t}\n \n+\t/* print all services, as UINT32_MAX was passed as id */\n \tfprintf(f, \"Services Summary\\n\");\n \tfor (i = 0; i < rte_service_count; i++) {\n \t\tuint32_t reset = 1;\ndiff --git a/test/test/test_service_cores.c b/test/test/test_service_cores.c\nindex ba252c5..4ece080 100644\n--- a/test/test/test_service_cores.c\n+++ b/test/test/test_service_cores.c\n@@ -261,11 +261,11 @@ service_name(void)\n static int\n service_dump(void)\n {\n-\tstruct rte_service_spec *service = rte_service_get_by_id(0);\n-\trte_service_set_stats_enable(service, 1);\n-\trte_service_dump(stdout, service);\n-\trte_service_set_stats_enable(service, 0);\n-\trte_service_dump(stdout, service);\n+\tconst uint32_t sid = 0;\n+\trte_service_set_stats_enable(sid, 1);\n+\trte_service_dump(stdout, 0);\n+\trte_service_set_stats_enable(sid, 0);\n+\trte_service_dump(stdout, 0);\n \treturn unregister_all();\n }\n \n",
    "prefixes": [
        "dpdk-dev",
        "5/8"
    ]
}