get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 99912,
    "url": "http://patches.dpdk.org/api/patches/99912/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20210928112912.785412-9-andrew.rybchenko@oktetlabs.ru/",
    "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": "<20210928112912.785412-9-andrew.rybchenko@oktetlabs.ru>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20210928112912.785412-9-andrew.rybchenko@oktetlabs.ru",
    "date": "2021-09-28T11:29:09",
    "name": "[08/11] net/sfc: add toggle to disable total stat",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "3c49126afef2e3cd34334812a09226230b6e8ebc",
    "submitter": {
        "id": 2013,
        "url": "http://patches.dpdk.org/api/people/2013/?format=api",
        "name": "Andrew Rybchenko",
        "email": "Andrew.Rybchenko@oktetlabs.ru"
    },
    "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/20210928112912.785412-9-andrew.rybchenko@oktetlabs.ru/mbox/",
    "series": [
        {
            "id": 19227,
            "url": "http://patches.dpdk.org/api/series/19227/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=19227",
            "date": "2021-09-28T11:29:01",
            "name": "net/sfc: support per-queue stats on EF100",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/19227/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/99912/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/99912/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 44909A0032;\n\tTue, 28 Sep 2021 13:30:28 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 5F45A4113A;\n\tTue, 28 Sep 2021 13:29:48 +0200 (CEST)",
            "from shelob.oktetlabs.ru (shelob.oktetlabs.ru [91.220.146.113])\n by mails.dpdk.org (Postfix) with ESMTP id 3C2114111A\n for <dev@dpdk.org>; Tue, 28 Sep 2021 13:29:44 +0200 (CEST)",
            "by shelob.oktetlabs.ru (Postfix, from userid 122)\n id 0F9ED7F6D6; Tue, 28 Sep 2021 14:29:44 +0300 (MSK)",
            "from aros.oktetlabs.ru (aros.oktetlabs.ru [192.168.38.17])\n by shelob.oktetlabs.ru (Postfix) with ESMTP id ED36B7F6DA;\n Tue, 28 Sep 2021 14:29:31 +0300 (MSK)"
        ],
        "X-Spam-Checker-Version": "SpamAssassin 3.4.2 (2018-09-13) on shelob.oktetlabs.ru",
        "X-Spam-Level": "",
        "X-Spam-Status": "No, score=0.8 required=5.0 tests=ALL_TRUSTED,\n DKIM_ADSP_DISCARD,\n URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2",
        "DKIM-Filter": "OpenDKIM Filter v2.11.0 shelob.oktetlabs.ru ED36B7F6DA",
        "Authentication-Results": "shelob.oktetlabs.ru/ED36B7F6DA; dkim=none;\n dkim-atps=neutral",
        "From": "Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>",
        "To": "dev@dpdk.org",
        "Cc": "Ivan Ilchenko <ivan.ilchenko@oktetlabs.ru>",
        "Date": "Tue, 28 Sep 2021 14:29:09 +0300",
        "Message-Id": "<20210928112912.785412-9-andrew.rybchenko@oktetlabs.ru>",
        "X-Mailer": "git-send-email 2.30.2",
        "In-Reply-To": "<20210928112912.785412-1-andrew.rybchenko@oktetlabs.ru>",
        "References": "<20210928112912.785412-1-andrew.rybchenko@oktetlabs.ru>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH 08/11] net/sfc: add toggle to disable total stat",
        "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",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "From: Ivan Ilchenko <ivan.ilchenko@oktetlabs.ru>\n\nAdd toggle to disable total SW stat. This is useful\nfor per-queue 'packets' and 'bytes' to not conflict\nwith corresponding basic stats. These stats will be\nadded in the following patches.\n\nSigned-off-by: Ivan Ilchenko <ivan.ilchenko@oktetlabs.ru>\nSigned-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>\n---\n drivers/net/sfc/sfc_sw_stats.c | 54 +++++++++++++++++++++-------------\n 1 file changed, 34 insertions(+), 20 deletions(-)",
    "diff": "diff --git a/drivers/net/sfc/sfc_sw_stats.c b/drivers/net/sfc/sfc_sw_stats.c\nindex a9ab29064a..63fc334d2b 100644\n--- a/drivers/net/sfc/sfc_sw_stats.c\n+++ b/drivers/net/sfc/sfc_sw_stats.c\n@@ -21,6 +21,7 @@ struct sfc_sw_stat_descr {\n \tconst char *name;\n \tenum sfc_sw_stats_type type;\n \tsfc_get_sw_stat_val_t *get_val;\n+\tbool provide_total;\n };\n \n static sfc_get_sw_stat_val_t sfc_get_sw_stat_val_rx_dbells;\n@@ -54,11 +55,13 @@ const struct sfc_sw_stat_descr sfc_sw_stats_descr[] = {\n \t\t.name = \"dbells\",\n \t\t.type = SFC_SW_STATS_RX,\n \t\t.get_val  = sfc_get_sw_stat_val_rx_dbells,\n+\t\t.provide_total = true,\n \t},\n \t{\n \t\t.name = \"dbells\",\n \t\t.type = SFC_SW_STATS_TX,\n \t\t.get_val  = sfc_get_sw_stat_val_tx_dbells,\n+\t\t.provide_total = true,\n \t}\n };\n \n@@ -83,7 +86,7 @@ sfc_sw_stat_get_name(struct sfc_adapter *sa,\n \t\treturn -EINVAL;\n \t}\n \n-\tif (id_off == 0) {\n+\tif (sw_stat->provide_total && id_off == 0) {\n \t\tret = snprintf(name, name_size, \"%s_%s\", prefix,\n \t\t\t\t\t\t\t sw_stat->name);\n \t\tif (ret < 0 || ret >= (int)name_size) {\n@@ -92,7 +95,7 @@ sfc_sw_stat_get_name(struct sfc_adapter *sa,\n \t\t\treturn ret > 0 ? -EINVAL : ret;\n \t\t}\n \t} else {\n-\t\tuint16_t qid = id_off - 1;\n+\t\tuint16_t qid = id_off - sw_stat->provide_total;\n \t\tret = snprintf(name, name_size, \"%s_q%u_%s\", prefix, qid,\n \t\t\t\t\t\t\tsw_stat->name);\n \t\tif (ret < 0 || ret >= (int)name_size) {\n@@ -124,10 +127,11 @@ sfc_sw_stat_get_queue_count(struct sfc_adapter *sa,\n }\n \n static unsigned int\n-sfc_sw_xstat_per_queue_get_count(unsigned int nb_queues)\n+sfc_sw_xstat_per_queue_get_count(const struct sfc_sw_stat_descr *sw_stat,\n+\t\t\t\t unsigned int nb_queues)\n {\n \t/* Take into account the total xstat of all queues */\n-\treturn nb_queues > 0 ? 1 + nb_queues : 0;\n+\treturn nb_queues > 0 ? sw_stat->provide_total + nb_queues : 0;\n }\n \n static unsigned int\n@@ -137,7 +141,7 @@ sfc_sw_xstat_get_nb_supported(struct sfc_adapter *sa,\n \tunsigned int nb_queues;\n \n \tnb_queues = sfc_sw_stat_get_queue_count(sa, sw_stat);\n-\treturn sfc_sw_xstat_per_queue_get_count(nb_queues);\n+\treturn sfc_sw_xstat_per_queue_get_count(sw_stat, nb_queues);\n }\n \n static int\n@@ -157,13 +161,13 @@ sfc_sw_stat_get_names(struct sfc_adapter *sa,\n \tnb_queues = sfc_sw_stat_get_queue_count(sa, sw_stat);\n \tif (nb_queues == 0)\n \t\treturn 0;\n-\t*nb_supported += sfc_sw_xstat_per_queue_get_count(nb_queues);\n+\t*nb_supported += sfc_sw_xstat_per_queue_get_count(sw_stat, nb_queues);\n \n \t/*\n \t * The order of each software xstat type is the total xstat\n \t * followed by per-queue xstats.\n \t */\n-\tif (*nb_written < xstats_names_sz) {\n+\tif (*nb_written < xstats_names_sz && sw_stat->provide_total) {\n \t\trc = sfc_sw_stat_get_name(sa, sw_stat,\n \t\t\t\t\t  xstats_names[*nb_written].name,\n \t\t\t\t\t  name_size, *nb_written - id_base);\n@@ -196,6 +200,7 @@ sfc_sw_xstat_get_names_by_id(struct sfc_adapter *sa,\n {\n \tconst size_t name_size = sizeof(xstats_names[0].name);\n \tunsigned int id_base = *nb_supported;\n+\tunsigned int id_end;\n \tunsigned int nb_queues;\n \tunsigned int i;\n \tint rc;\n@@ -203,14 +208,15 @@ sfc_sw_xstat_get_names_by_id(struct sfc_adapter *sa,\n \tnb_queues = sfc_sw_stat_get_queue_count(sa, sw_stat);\n \tif (nb_queues == 0)\n \t\treturn 0;\n-\t*nb_supported += sfc_sw_xstat_per_queue_get_count(nb_queues);\n+\t*nb_supported += sfc_sw_xstat_per_queue_get_count(sw_stat, nb_queues);\n \n \t/*\n \t * The order of each software xstat type is the total xstat\n \t * followed by per-queue xstats.\n \t */\n+\tid_end = id_base + sw_stat->provide_total + nb_queues;\n \tfor (i = 0; i < size; i++) {\n-\t\tif (id_base <= ids[i] && ids[i] <= id_base + nb_queues) {\n+\t\tif (id_base <= ids[i] && ids[i] < id_end) {\n \t\t\trc = sfc_sw_stat_get_name(sa, sw_stat,\n \t\t\t\t\t\t  xstats_names[i].name,\n \t\t\t\t\t\t  name_size, ids[i] - id_base);\n@@ -239,13 +245,13 @@ sfc_sw_xstat_get_values(struct sfc_adapter *sa,\n \tnb_queues = sfc_sw_stat_get_queue_count(sa, sw_stat);\n \tif (nb_queues == 0)\n \t\treturn;\n-\t*nb_supported += sfc_sw_xstat_per_queue_get_count(nb_queues);\n+\t*nb_supported += sfc_sw_xstat_per_queue_get_count(sw_stat, nb_queues);\n \n \t/*\n \t * The order of each software xstat type is the total xstat\n \t * followed by per-queue xstats.\n \t */\n-\tif (*nb_written < xstats_size) {\n+\tif (*nb_written < xstats_size && sw_stat->provide_total) {\n \t\tcount_total_value = true;\n \t\ttotal_xstat = &xstats[*nb_written];\n \t\txstats[*nb_written].id = *nb_written;\n@@ -278,6 +284,8 @@ sfc_sw_xstat_get_values_by_id(struct sfc_adapter *sa,\n \trte_spinlock_t *bmp_lock = &sa->sw_stats.queues_bitmap_lock;\n \tstruct rte_bitmap *bmp = sa->sw_stats.queues_bitmap;\n \tunsigned int id_base = *nb_supported;\n+\tunsigned int id_base_q;\n+\tunsigned int id_end;\n \tbool count_total_value = false;\n \tunsigned int total_value_idx;\n \tuint64_t total_value = 0;\n@@ -291,20 +299,23 @@ sfc_sw_xstat_get_values_by_id(struct sfc_adapter *sa,\n \tnb_queues = sfc_sw_stat_get_queue_count(sa, sw_stat);\n \tif (nb_queues == 0)\n \t\tgoto unlock;\n-\t*nb_supported += sfc_sw_xstat_per_queue_get_count(nb_queues);\n+\t*nb_supported += sfc_sw_xstat_per_queue_get_count(sw_stat, nb_queues);\n \n \t/*\n \t * The order of each software xstat type is the total xstat\n \t * followed by per-queue xstats.\n \t */\n+\tid_end = id_base + sw_stat->provide_total + nb_queues;\n \tfor (i = 0; i < ids_size; i++) {\n-\t\tif (id_base <= ids[i] && ids[i] <= (id_base + nb_queues)) {\n-\t\t\tif (ids[i] == id_base) { /* Accumulative value */\n+\t\tif (id_base <= ids[i] && ids[i] < id_end) {\n+\t\t\tif (sw_stat->provide_total && ids[i] == id_base) {\n+\t\t\t\t/* Accumulative value */\n \t\t\t\tcount_total_value = true;\n \t\t\t\ttotal_value_idx = i;\n \t\t\t\tcontinue;\n \t\t\t}\n-\t\t\tqid = ids[i] - id_base - 1;\n+\t\t\tid_base_q = id_base + sw_stat->provide_total;\n+\t\t\tqid = ids[i] - id_base_q;\n \t\t\tvalues[i] = sw_stat->get_val(sa, qid);\n \t\t\ttotal_value += values[i];\n \n@@ -453,7 +464,7 @@ sfc_sw_xstat_reset(struct sfc_adapter *sa,\n {\n \tunsigned int nb_queues;\n \tunsigned int qid;\n-\tuint64_t *total_xstat_reset;\n+\tuint64_t *total_xstat_reset = NULL;\n \n \tSFC_ASSERT(sfc_adapter_is_locked(sa));\n \n@@ -465,13 +476,16 @@ sfc_sw_xstat_reset(struct sfc_adapter *sa,\n \t * The order of each software xstat type is the total xstat\n \t * followed by per-queue xstats.\n \t */\n-\ttotal_xstat_reset = reset_vals;\n-\t*total_xstat_reset = 0;\n-\treset_vals++;\n+\tif (sw_stat->provide_total) {\n+\t\ttotal_xstat_reset = reset_vals;\n+\t\t*total_xstat_reset = 0;\n+\t\treset_vals++;\n+\t}\n \n \tfor (qid = 0; qid < nb_queues; ++qid) {\n \t\treset_vals[qid] = sw_stat->get_val(sa, qid);\n-\t\t*total_xstat_reset += reset_vals[qid];\n+\t\tif (sw_stat->provide_total)\n+\t\t\t*total_xstat_reset += reset_vals[qid];\n \t}\n }\n \n",
    "prefixes": [
        "08/11"
    ]
}