get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 111096,
    "url": "http://patches.dpdk.org/api/patches/111096/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20220513025357.52275-2-fengchengwen@huawei.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": "<20220513025357.52275-2-fengchengwen@huawei.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20220513025357.52275-2-fengchengwen@huawei.com",
    "date": "2022-05-13T02:53:49",
    "name": "[v4,1/9] ethdev: specify return value of xstats-get API",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "f53286e88b0ba7d389a1b520479c6c8408ecbe0e",
    "submitter": {
        "id": 2146,
        "url": "http://patches.dpdk.org/api/people/2146/?format=api",
        "name": "fengchengwen",
        "email": "fengchengwen@huawei.com"
    },
    "delegate": {
        "id": 3961,
        "url": "http://patches.dpdk.org/api/users/3961/?format=api",
        "username": "arybchenko",
        "first_name": "Andrew",
        "last_name": "Rybchenko",
        "email": "andrew.rybchenko@oktetlabs.ru"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20220513025357.52275-2-fengchengwen@huawei.com/mbox/",
    "series": [
        {
            "id": 22920,
            "url": "http://patches.dpdk.org/api/series/22920/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=22920",
            "date": "2022-05-13T02:53:48",
            "name": "bugfix for ethdev telemetry",
            "version": 4,
            "mbox": "http://patches.dpdk.org/series/22920/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/111096/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/111096/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 mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 6BA7DA00C3;\n\tFri, 13 May 2022 05:00:05 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 66A974283A;\n\tFri, 13 May 2022 04:59:57 +0200 (CEST)",
            "from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188])\n by mails.dpdk.org (Postfix) with ESMTP id 7C08D40698\n for <dev@dpdk.org>; Fri, 13 May 2022 04:59:53 +0200 (CEST)",
            "from dggpeml500024.china.huawei.com (unknown [172.30.72.53])\n by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Kztdp1ZQmzhZ2V;\n Fri, 13 May 2022 10:59:10 +0800 (CST)",
            "from localhost.localdomain (10.67.165.24) by\n dggpeml500024.china.huawei.com (7.185.36.10) with Microsoft SMTP Server\n (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id\n 15.1.2375.24; Fri, 13 May 2022 10:59:51 +0800"
        ],
        "From": "Chengwen Feng <fengchengwen@huawei.com>",
        "To": "<thomas@monjalon.net>, <ferruh.yigit@xilinx.com>,\n <andrew.rybchenko@oktetlabs.ru>, <ndabilpuram@marvell.com>,\n <kirankumark@marvell.com>, <skori@marvell.com>, <skoteshwar@marvell.com>",
        "CC": "<mb@smartsharesystems.com>, <stephen@networkplumber.org>, <dev@dpdk.org>",
        "Subject": "[PATCH v4 1/9] ethdev: specify return value of xstats-get API",
        "Date": "Fri, 13 May 2022 10:53:49 +0800",
        "Message-ID": "<20220513025357.52275-2-fengchengwen@huawei.com>",
        "X-Mailer": "git-send-email 2.33.0",
        "In-Reply-To": "<20220513025357.52275-1-fengchengwen@huawei.com>",
        "References": "<20220416010747.40714-1-fengchengwen@huawei.com>\n <20220513025357.52275-1-fengchengwen@huawei.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain",
        "X-Originating-IP": "[10.67.165.24]",
        "X-ClientProxiedBy": "dggems702-chm.china.huawei.com (10.3.19.179) To\n dggpeml500024.china.huawei.com (7.185.36.10)",
        "X-CFilter-Loop": "Reflected",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "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"
    },
    "content": "Currently the value returned when xstats is NULL of rte_eth_xstats_get()\nis not specified, some PMDs (eg. hns3/ipn3ke/mvpp2/axgbe) return zero\nwhile others return the required number of elements.\n\nIn this patch, special parameter combinations are restricted:\n1. specify that xstats is NULL if and only if n is 0.\n2. specify that if n is lower than the required number of elements, the\nfunction returns the required number of elements.\n3. specify that if n is zero, the xstats must be NULL, the function\nreturns the required number of elements.\n\nThis patch also makes sure that xstats is NULL if n is lower or equal to\nthe number of basic stats when invoke driver's ops.\n\nFixes: ce757f5c9a4d (\"ethdev: new method to retrieve extended statistics\")\nCc: stable@dpdk.org\n\nSigned-off-by: Chengwen Feng <fengchengwen@huawei.com>\n---\n lib/ethdev/rte_ethdev.c | 4 +++-\n lib/ethdev/rte_ethdev.h | 6 +++++-\n 2 files changed, 8 insertions(+), 2 deletions(-)",
    "diff": "diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c\nindex 29a3d80466..d9661bd64f 100644\n--- a/lib/ethdev/rte_ethdev.c\n+++ b/lib/ethdev/rte_ethdev.c\n@@ -2973,6 +2973,8 @@ rte_eth_xstats_get(uint16_t port_id, struct rte_eth_xstat *xstats,\n \tint ret;\n \n \tRTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);\n+\tif (xstats == NULL && n > 0)\n+\t\treturn -EINVAL;\n \tdev = &rte_eth_devices[port_id];\n \n \tnb_rxqs = RTE_MIN(dev->data->nb_rx_queues, RTE_ETHDEV_QUEUE_STAT_CNTRS);\n@@ -2989,7 +2991,7 @@ rte_eth_xstats_get(uint16_t port_id, struct rte_eth_xstat *xstats,\n \t\t * xstats struct.\n \t\t */\n \t\txcount = (*dev->dev_ops->xstats_get)(dev,\n-\t\t\t\t     xstats ? xstats + count : NULL,\n+\t\t\t\t     (n > count) ? xstats + count : NULL,\n \t\t\t\t     (n > count) ? n - count : 0);\n \n \t\tif (xcount < 0)\ndiff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h\nindex 04cff8ee10..04225bba4d 100644\n--- a/lib/ethdev/rte_ethdev.h\n+++ b/lib/ethdev/rte_ethdev.h\n@@ -3174,9 +3174,13 @@ int rte_eth_xstats_get_names(uint16_t port_id,\n  * @param xstats\n  *   A pointer to a table of structure of type *rte_eth_xstat*\n  *   to be filled with device statistics ids and values.\n- *   This parameter can be set to NULL if n is 0.\n+ *   This parameter can be set to NULL if and only if n is 0.\n  * @param n\n  *   The size of the xstats array (number of elements).\n+ *   If lower than the required number of elements, the function returns\n+ *   the required number of elements.\n+ *   If equal to zero, the xstats must be NULL, the function returns the\n+ *   required number of elements.\n  * @return\n  *   - A positive value lower or equal to n: success. The return value\n  *     is the number of entries filled in the stats table.\n",
    "prefixes": [
        "v4",
        "1/9"
    ]
}