get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 33653,
    "url": "http://patches.dpdk.org/api/patches/33653/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1515752838-56067-2-git-send-email-harry.van.haaren@intel.com/",
    "project": {
        "id": 1,
        "url": "http://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": "<1515752838-56067-2-git-send-email-harry.van.haaren@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1515752838-56067-2-git-send-email-harry.van.haaren@intel.com",
    "date": "2018-01-12T10:27:17",
    "name": "[dpdk-dev,v2,2/3] service: add reset all attributes for service",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "1032520077fcd5df32075deff5c175aa90d36bb8",
    "submitter": {
        "id": 317,
        "url": "http://patches.dpdk.org/api/people/317/?format=api",
        "name": "Van Haaren, Harry",
        "email": "harry.van.haaren@intel.com"
    },
    "delegate": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/1515752838-56067-2-git-send-email-harry.van.haaren@intel.com/mbox/",
    "series": [],
    "comments": "http://patches.dpdk.org/api/patches/33653/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/33653/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 [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 18B8BA494;\n\tFri, 12 Jan 2018 11:27:49 +0100 (CET)",
            "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n\tby dpdk.org (Postfix) with ESMTP id C98A73250\n\tfor <dev@dpdk.org>; Fri, 12 Jan 2018 11:27:46 +0100 (CET)",
            "from orsmga002.jf.intel.com ([10.7.209.21])\n\tby fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t12 Jan 2018 02:27:46 -0800",
            "from silpixa00398672.ir.intel.com ([10.237.223.128])\n\tby orsmga002.jf.intel.com with ESMTP; 12 Jan 2018 02:27:45 -0800"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.46,348,1511856000\"; d=\"scan'208\";a=\"26590544\"",
        "From": "Harry van Haaren <harry.van.haaren@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "thomas@monjalon.net,\n\tHarry van Haaren <harry.van.haaren@intel.com>",
        "Date": "Fri, 12 Jan 2018 10:27:17 +0000",
        "Message-Id": "<1515752838-56067-2-git-send-email-harry.van.haaren@intel.com>",
        "X-Mailer": "git-send-email 2.7.4",
        "In-Reply-To": "<1515752838-56067-1-git-send-email-harry.van.haaren@intel.com>",
        "References": "<1507114491-144338-2-git-send-email-harry.van.haaren@intel.com>\n\t<1515752838-56067-1-git-send-email-harry.van.haaren@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v2 2/3] service: add reset all attributes for\n\tservice",
        "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://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": "<https://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 introduces a new API, allowing the application to\nreset attributes of a service like the cycle count. Given this\nfunctionality is now exposed to the user, remove the resetting\nof stats during a dump() call.\n\nSigned-off-by: Harry van Haaren <harry.van.haaren@intel.com>\n\n---\n\nv2:\n- Improve doxygen with @param value\n---\n lib/librte_eal/common/include/rte_service.h | 12 ++++++++++++\n lib/librte_eal/common/rte_service.c         | 24 ++++++++++++++++++------\n lib/librte_eal/rte_eal_version.map          |  1 +\n test/test/test_service_cores.c              | 11 +++++++++++\n 4 files changed, 42 insertions(+), 6 deletions(-)",
    "diff": "diff --git a/lib/librte_eal/common/include/rte_service.h b/lib/librte_eal/common/include/rte_service.h\nindex 4898e76..460dbbf 100644\n--- a/lib/librte_eal/common/include/rte_service.h\n+++ b/lib/librte_eal/common/include/rte_service.h\n@@ -411,6 +411,18 @@ int32_t rte_service_dump(FILE *f, uint32_t id);\n int32_t rte_service_attr_get(uint32_t id, uint32_t attr_id,\n \t\t\t     uint32_t *attr_value);\n \n+/**\n+ * @warning\n+ * @b EXPERIMENTAL: this API may change without prior notice\n+ *\n+ * Reset all attribute values of a service.\n+ *\n+ * @param id The service to reset all statistics of\n+ * @retval 0 Successfully reset attributes\n+ *         -EINVAL Invalid service id provided\n+ */\n+int32_t rte_service_attr_reset_all(uint32_t id);\n+\n #ifdef __cplusplus\n }\n #endif\ndiff --git a/lib/librte_eal/common/rte_service.c b/lib/librte_eal/common/rte_service.c\nindex 63db475..1b54b7e 100644\n--- a/lib/librte_eal/common/rte_service.c\n+++ b/lib/librte_eal/common/rte_service.c\n@@ -712,15 +712,27 @@ rte_service_dump_one(FILE *f, struct rte_service_spec_impl *s,\n \tif (s->calls != 0)\n \t\tcalls = s->calls;\n \n+\tif (reset) {\n+\t\ts->cycles_spent = 0;\n+\t\ts->calls = 0;\n+\t\treturn;\n+\t}\n+\n \tfprintf(f, \"  %s: stats %d\\tcalls %\"PRIu64\"\\tcycles %\"\n \t\t\tPRIu64\"\\tavg: %\"PRIu64\"\\n\",\n \t\t\ts->spec.name, service_stats_enabled(s), s->calls,\n \t\t\ts->cycles_spent, s->cycles_spent / calls);\n+}\n \n-\tif (reset) {\n-\t\ts->cycles_spent = 0;\n-\t\ts->calls = 0;\n-\t}\n+int32_t\n+rte_service_attr_reset_all(uint32_t id)\n+{\n+\tstruct rte_service_spec_impl *s;\n+\tSERVICE_VALID_GET_OR_ERR_RET(id, s, -EINVAL);\n+\n+\tint reset = 1;\n+\trte_service_dump_one(NULL, s, 0, reset);\n+\treturn 0;\n }\n \n static void\n@@ -768,7 +780,7 @@ int32_t rte_service_dump(FILE *f, uint32_t id)\n \tfor (i = 0; i < RTE_SERVICE_NUM_MAX; i++) {\n \t\tif (!service_valid(i))\n \t\t\tcontinue;\n-\t\tuint32_t reset = 1;\n+\t\tuint32_t reset = 0;\n \t\trte_service_dump_one(f, &rte_services[i], total_cycles, reset);\n \t}\n \n@@ -777,7 +789,7 @@ int32_t rte_service_dump(FILE *f, uint32_t id)\n \t\tif (lcore_config[i].core_role != ROLE_SERVICE)\n \t\t\tcontinue;\n \n-\t\tuint32_t reset = 1;\n+\t\tuint32_t reset = 0;\n \t\tservice_dump_calls_per_lcore(f, i, reset);\n \t}\n \ndiff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map\nindex 744de04..3fa1e13 100644\n--- a/lib/librte_eal/rte_eal_version.map\n+++ b/lib/librte_eal/rte_eal_version.map\n@@ -217,6 +217,7 @@ EXPERIMENTAL {\n \trte_eal_hotplug_add;\n \trte_eal_hotplug_remove;\n \trte_service_attr_get;\n+\trte_service_attr_reset_all;\n \trte_service_component_register;\n \trte_service_component_unregister;\n \trte_service_component_runstate_set;\ndiff --git a/test/test/test_service_cores.c b/test/test/test_service_cores.c\nindex a0768c9..e510643 100644\n--- a/test/test/test_service_cores.c\n+++ b/test/test/test_service_cores.c\n@@ -242,6 +242,9 @@ service_name(void)\n static int\n service_attr_get(void)\n {\n+\t/* ensure all services unregistered so cycle counts are zero */\n+\tunregister_all();\n+\n \tstruct rte_service_spec service;\n \tmemset(&service, 0, sizeof(struct rte_service_spec));\n \tservice.callback = dummy_cb;\n@@ -295,6 +298,14 @@ service_attr_get(void)\n \n \trte_service_lcore_stop(slcore_id);\n \n+\tTEST_ASSERT_EQUAL(0, rte_service_attr_reset_all(id),\n+\t\t\t\"Valid attr_reset_all() return success\");\n+\n+\tTEST_ASSERT_EQUAL(0, rte_service_attr_get(id, attr_id, &attr_value),\n+\t\t\t\"Valid attr_get() call didn't return success\");\n+\tTEST_ASSERT_EQUAL(0, attr_value,\n+\t\t\t\"attr_get() call didn't set correct cycles (zero)\");\n+\n \treturn unregister_all();\n }\n \n",
    "prefixes": [
        "dpdk-dev",
        "v2",
        "2/3"
    ]
}