get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 40706,
    "url": "http://patches.dpdk.org/api/patches/40706/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1528359323-22885-1-git-send-email-david.marchand@6wind.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": "<1528359323-22885-1-git-send-email-david.marchand@6wind.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1528359323-22885-1-git-send-email-david.marchand@6wind.com",
    "date": "2018-06-07T08:15:23",
    "name": "[dpdk-dev] app/testpmd: add sanity checks when retrieving xstats",
    "commit_ref": null,
    "pull_url": null,
    "state": "rejected",
    "archived": true,
    "hash": "98472999ac988c1f18fb506f615eb07f362c856d",
    "submitter": {
        "id": 3,
        "url": "http://patches.dpdk.org/api/people/3/?format=api",
        "name": "David Marchand",
        "email": "david.marchand@6wind.com"
    },
    "delegate": {
        "id": 319,
        "url": "http://patches.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/1528359323-22885-1-git-send-email-david.marchand@6wind.com/mbox/",
    "series": [
        {
            "id": 24,
            "url": "http://patches.dpdk.org/api/series/24/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=24",
            "date": "2018-06-07T08:15:23",
            "name": "[dpdk-dev] app/testpmd: add sanity checks when retrieving xstats",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/24/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/40706/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/40706/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 52F901B024;\n\tThu,  7 Jun 2018 10:15:30 +0200 (CEST)",
            "from mail-wm0-f67.google.com (mail-wm0-f67.google.com\n\t[74.125.82.67]) by dpdk.org (Postfix) with ESMTP id 0FA6E1B01F\n\tfor <dev@dpdk.org>; Thu,  7 Jun 2018 10:15:29 +0200 (CEST)",
            "by mail-wm0-f67.google.com with SMTP id q4-v6so2044022wmq.1\n\tfor <dev@dpdk.org>; Thu, 07 Jun 2018 01:15:29 -0700 (PDT)",
            "from 6wind.com ([2a01:cb19:142:1800:b9d8:f16f:434d:6cba])\n\tby smtp.gmail.com with ESMTPSA id\n\tc53-v6sm64283319wrg.12.2018.06.07.01.15.27\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tThu, 07 Jun 2018 01:15:27 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=6wind-com.20150623.gappssmtp.com; s=20150623;\n\th=from:to:cc:subject:date:message-id;\n\tbh=GRF16dw8rzOhD9TzpVWWhu8G8+lqsfdIUPnaaQ4qwUc=;\n\tb=uXyY8lAj2DJoUMn8ZPzll3tkSEOVhItmscavdhIRFzEAp7eMqXp2pvw/fIcvT7g9W/\n\tlYkPn5s9Vlb4H96tUsE8lShDlKMKyOwJBnYNAotBMdsm4Wp/nCTncYITdtFbYRYYhfaT\n\td0miOg1xVfbaMJ4MhYiccd3vpsJRfGO0Yc61O1u5LttoI6vzzxwdrOpyy0qzhATvK1U8\n\tioD75QedF11CtFcq9EFzD7IAif+C5kUR4RP+CO66N57qOoIRRNs5TZVhF7fqZebOPFZw\n\tIHCzfeVw/Cp0P1asiGYKqiKD0m1ojHXNb8Nx8X/0M+1+evgYjFEptTalDagM5Hu2FIFz\n\tZL7A==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id;\n\tbh=GRF16dw8rzOhD9TzpVWWhu8G8+lqsfdIUPnaaQ4qwUc=;\n\tb=mvSHcWeZ/dy6qeIZhK/nAT60aQ5KiUg7sdAUSwZr9qmnnNv7vpVw6bkTMi35/CNdIL\n\tyYz3c2Y8pb9iF9L0Pc4R/vGRyOyMD2vbmCvLHhstrkYgDo9XHbQA+nAV0v/Zwbk+Q0Bn\n\tHQnONjgIhS7yNTHtfhUIQKQRRgeO7H/eKKRms1pOfIelmpmjwtgm0BzU0HTbuiNHdB1W\n\t1jvWeGtC6C19K6akZ3c7tcHaySFy4keaX1bdjzHCPxNtt126OPDduM2jGrpi0eH4Klih\n\ts6SwiMMdcRHzOgeKr8t56Y0cPlZNPIsNNhPdSg0yeLM6cGAN68S5H0iNG0kzbEODgiQ0\n\tt8VA==",
        "X-Gm-Message-State": "APt69E0Jmsk+0cZ4MZRVZ9tzzgO7nvVxazbE2+6Jxr2XViA8jw8Qu1WC\n\tSAyoVxyMcLWSQEZCZVYajemwAg2gJ/Y=",
        "X-Google-Smtp-Source": "ADUXVKJWbdnzI7p77pmdqfdquteWvQHx18JRlCzzkWDzaaUopT991xVTI7q5DbsjC6VSfY7fcXPZEg==",
        "X-Received": "by 2002:a1c:d70c:: with SMTP id\n\to12-v6mr788839wmg.71.1528359328443; \n\tThu, 07 Jun 2018 01:15:28 -0700 (PDT)",
        "From": "David Marchand <david.marchand@6wind.com>",
        "To": "dev@dpdk.org",
        "Cc": "wenzhuo.lu@intel.com, jingjing.wu@intel.com, bernard.iremonger@intel.com,\n\tremy.horton@intel.com, stable@dpdk.org",
        "Date": "Thu,  7 Jun 2018 10:15:23 +0200",
        "Message-Id": "<1528359323-22885-1-git-send-email-david.marchand@6wind.com>",
        "X-Mailer": "git-send-email 2.7.4",
        "Subject": "[dpdk-dev] [PATCH] app/testpmd: add sanity checks when retrieving\n\txstats",
        "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": "Testpmd should not expect the xstats names and values arrays to be\naligned: neither the arrays sizes, nor the order in which the values are.\n\nThis hid some bugs where pmds would either return wrong values count or\ninvalid statistics indexes.\n\nLink: http://dpdk.org/browse/dpdk/commit/?id=5fd4d049692b2fde8bf49c7461b18180a8fd2545\nLink: http://dpdk.org/dev/patchwork/patch/40705/\n\nSigned-off-by: David Marchand <david.marchand@6wind.com>\n---\n\n@stable: when this goes in, I recommend backporting this to all existing\nbranches, as it makes it easier to show this kind of pmds bugs.\n\n---\n app/test-pmd/config.c | 28 ++++++++++++++++++----------\n 1 file changed, 18 insertions(+), 10 deletions(-)",
    "diff": "diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c\nindex 97020fb..8edb80c 100644\n--- a/app/test-pmd/config.c\n+++ b/app/test-pmd/config.c\n@@ -210,9 +210,11 @@ nic_stats_clear(portid_t port_id)\n void\n nic_xstats_display(portid_t port_id)\n {\n-\tstruct rte_eth_xstat *xstats;\n-\tint cnt_xstats, idx_xstat;\n \tstruct rte_eth_xstat_name *xstats_names;\n+\tstruct rte_eth_xstat *xstats;\n+\tint cnt_xnames;\n+\tint cnt_xstats;\n+\tint idx_xstat;\n \n \tprintf(\"###### NIC extended statistics for port %-2d\\n\", port_id);\n \tif (!rte_eth_dev_is_valid_port(port_id)) {\n@@ -221,33 +223,34 @@ nic_xstats_display(portid_t port_id)\n \t}\n \n \t/* Get count */\n-\tcnt_xstats = rte_eth_xstats_get_names(port_id, NULL, 0);\n-\tif (cnt_xstats  < 0) {\n+\tcnt_xnames = rte_eth_xstats_get_names(port_id, NULL, 0);\n+\tif (cnt_xnames  < 0) {\n \t\tprintf(\"Error: Cannot get count of xstats\\n\");\n \t\treturn;\n \t}\n \n \t/* Get id-name lookup table */\n-\txstats_names = malloc(sizeof(struct rte_eth_xstat_name) * cnt_xstats);\n+\txstats_names = malloc(sizeof(struct rte_eth_xstat_name) * cnt_xnames);\n \tif (xstats_names == NULL) {\n \t\tprintf(\"Cannot allocate memory for xstats lookup\\n\");\n \t\treturn;\n \t}\n-\tif (cnt_xstats != rte_eth_xstats_get_names(\n-\t\t\tport_id, xstats_names, cnt_xstats)) {\n+\tif (cnt_xnames != rte_eth_xstats_get_names(\n+\t\t\tport_id, xstats_names, cnt_xnames)) {\n \t\tprintf(\"Error: Cannot get xstats lookup\\n\");\n \t\tfree(xstats_names);\n \t\treturn;\n \t}\n \n \t/* Get stats themselves */\n-\txstats = malloc(sizeof(struct rte_eth_xstat) * cnt_xstats);\n+\txstats = malloc(sizeof(struct rte_eth_xstat) * cnt_xnames);\n \tif (xstats == NULL) {\n \t\tprintf(\"Cannot allocate memory for xstats\\n\");\n \t\tfree(xstats_names);\n \t\treturn;\n \t}\n-\tif (cnt_xstats != rte_eth_xstats_get(port_id, xstats, cnt_xstats)) {\n+\tcnt_xstats = rte_eth_xstats_get(port_id, xstats, cnt_xnames);\n+\tif (cnt_xstats > cnt_xnames) {\n \t\tprintf(\"Error: Unable to get xstats\\n\");\n \t\tfree(xstats_names);\n \t\tfree(xstats);\n@@ -256,10 +259,15 @@ nic_xstats_display(portid_t port_id)\n \n \t/* Display xstats */\n \tfor (idx_xstat = 0; idx_xstat < cnt_xstats; idx_xstat++) {\n+\t\tif (xstats[idx_xstat].id > (uint64_t)cnt_xnames) {\n+\t\t\tprintf(\"Error: Invalid statistic index: %\"PRId64\n+\t\t\t       \", max %d\\n\", xstats[idx_xstat].id, cnt_xnames);\n+\t\t\tcontinue;\n+\t\t}\n \t\tif (xstats_hide_zero && !xstats[idx_xstat].value)\n \t\t\tcontinue;\n \t\tprintf(\"%s: %\"PRIu64\"\\n\",\n-\t\t\txstats_names[idx_xstat].name,\n+\t\t\txstats_names[xstats[idx_xstat].id].name,\n \t\t\txstats[idx_xstat].value);\n \t}\n \tfree(xstats_names);\n",
    "prefixes": [
        "dpdk-dev"
    ]
}