get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 29588,
    "url": "https://patches.dpdk.org/api/patches/29588/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1507114491-144338-3-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": "<1507114491-144338-3-git-send-email-harry.van.haaren@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1507114491-144338-3-git-send-email-harry.van.haaren@intel.com",
    "date": "2017-10-04T10:54:50",
    "name": "[dpdk-dev,2/3] service: add reset all attributes for service",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "750ee6c138e1a2207715b33123b700181ba256e8",
    "submitter": {
        "id": 317,
        "url": "https://patches.dpdk.org/api/people/317/?format=api",
        "name": "Van Haaren, Harry",
        "email": "harry.van.haaren@intel.com"
    },
    "delegate": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1507114491-144338-3-git-send-email-harry.van.haaren@intel.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/29588/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/29588/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 899A71B64D;\n\tWed,  4 Oct 2017 12:54:36 +0200 (CEST)",
            "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n\tby dpdk.org (Postfix) with ESMTP id E37041B625\n\tfor <dev@dpdk.org>; Wed,  4 Oct 2017 12:54:31 +0200 (CEST)",
            "from fmsmga002.fm.intel.com ([10.253.24.26])\n\tby fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t04 Oct 2017 03:54:30 -0700",
            "from silpixa00398672.ir.intel.com ([10.237.223.128])\n\tby fmsmga002.fm.intel.com with ESMTP; 04 Oct 2017 03:54:29 -0700"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos; i=\"5.42,477,1500966000\"; d=\"scan'208\";\n\ta=\"1226897090\"",
        "From": "Harry van Haaren <harry.van.haaren@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "Harry van Haaren <harry.van.haaren@intel.com>",
        "Date": "Wed,  4 Oct 2017 11:54:50 +0100",
        "Message-Id": "<1507114491-144338-3-git-send-email-harry.van.haaren@intel.com>",
        "X-Mailer": "git-send-email 2.7.4",
        "In-Reply-To": "<1507114491-144338-1-git-send-email-harry.van.haaren@intel.com>",
        "References": "<1507114491-144338-1-git-send-email-harry.van.haaren@intel.com>",
        "Subject": "[dpdk-dev] [PATCH 2/3] service: add reset all attributes for service",
        "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 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 lib/librte_eal/bsdapp/eal/rte_eal_version.map   |  1 +\n lib/librte_eal/common/include/rte_service.h     | 10 ++++++++++\n lib/librte_eal/common/rte_service.c             | 24 ++++++++++++++++++------\n lib/librte_eal/linuxapp/eal/rte_eal_version.map |  1 +\n test/test/test_service_cores.c                  | 11 +++++++++++\n 5 files changed, 41 insertions(+), 6 deletions(-)",
    "diff": "diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map\nindex 8c9c5f6..e654283 100644\n--- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map\n+++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map\n@@ -213,6 +213,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/lib/librte_eal/common/include/rte_service.h b/lib/librte_eal/common/include/rte_service.h\nindex 9267a0e..bf7b50b 100644\n--- a/lib/librte_eal/common/include/rte_service.h\n+++ b/lib/librte_eal/common/include/rte_service.h\n@@ -377,6 +377,16 @@ 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 attributes of a service.\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 4935804..3f274f4 100644\n--- a/lib/librte_eal/common/rte_service.c\n+++ b/lib/librte_eal/common/rte_service.c\n@@ -674,15 +674,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@@ -730,7 +742,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@@ -739,7 +751,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/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map\nindex c2fad10..e5a0f04 100644\n--- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map\n+++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map\n@@ -218,6 +218,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 7d2e42d..dd3bf75 100644\n--- a/test/test/test_service_cores.c\n+++ b/test/test/test_service_cores.c\n@@ -270,6 +270,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@@ -323,6 +326,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",
        "2/3"
    ]
}