get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 49115,
    "url": "https://patches.dpdk.org/api/patches/49115/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20181219115950.46386-1-bruce.richardson@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": "<20181219115950.46386-1-bruce.richardson@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20181219115950.46386-1-bruce.richardson@intel.com",
    "date": "2018-12-19T11:59:50",
    "name": "telemetry: fix error when using ports of different types",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "77f0c38ce04b4c090839eca5648c1db857a5f05e",
    "submitter": {
        "id": 20,
        "url": "https://patches.dpdk.org/api/people/20/?format=api",
        "name": "Bruce Richardson",
        "email": "bruce.richardson@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/20181219115950.46386-1-bruce.richardson@intel.com/mbox/",
    "series": [
        {
            "id": 2867,
            "url": "https://patches.dpdk.org/api/series/2867/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=2867",
            "date": "2018-12-19T11:59:50",
            "name": "telemetry: fix error when using ports of different types",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/2867/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/49115/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/49115/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 862781B57E;\n\tWed, 19 Dec 2018 13:00:06 +0100 (CET)",
            "from mga17.intel.com (mga17.intel.com [192.55.52.151])\n\tby dpdk.org (Postfix) with ESMTP id D36621B4EE;\n\tWed, 19 Dec 2018 13:00:03 +0100 (CET)",
            "from fmsmga005.fm.intel.com ([10.253.24.32])\n\tby fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t19 Dec 2018 04:00:02 -0800",
            "from silpixa00399126.ir.intel.com (HELO\n\tsilpixa00399126.ger.corp.intel.com) ([10.237.222.236])\n\tby fmsmga005.fm.intel.com with ESMTP; 19 Dec 2018 04:00:01 -0800"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.56,372,1539673200\"; d=\"scan'208\";a=\"305071863\"",
        "From": "Bruce Richardson <bruce.richardson@intel.com>",
        "To": "Kevin Laatz <kevin.laatz@intel.com>",
        "Cc": "dev@dpdk.org, Bruce Richardson <bruce.richardson@intel.com>,\n\tstable@dpdk.org",
        "Date": "Wed, 19 Dec 2018 11:59:50 +0000",
        "Message-Id": "<20181219115950.46386-1-bruce.richardson@intel.com>",
        "X-Mailer": "git-send-email 2.19.2",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH] telemetry: fix error when using ports of\n\tdifferent types",
        "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://mails.dpdk.org/options/dev>,\n\t<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\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Different NIC ports can have different numbers of xstats on them, which\nmeans that we can't just use the xstats list from the first port registered\nin the telemetry library. Instead, we need to check the type of each port -\nby checking its ops structure pointer - and register each port type once\nwith the metrics lib.\n\nCC: stable@dpdk.org\nFixes: fdbdb3f9ce46 (\"telemetry: add initial connection socket\")\n\nSigned-off-by: Bruce Richardson <bruce.richardson@intel.com>\n---\n lib/librte_telemetry/rte_telemetry.c          | 40 ++++++++++++++-----\n lib/librte_telemetry/rte_telemetry_internal.h |  2 +-\n 2 files changed, 32 insertions(+), 10 deletions(-)",
    "diff": "diff --git a/lib/librte_telemetry/rte_telemetry.c b/lib/librte_telemetry/rte_telemetry.c\nindex 016431f12..7fb247eaa 100644\n--- a/lib/librte_telemetry/rte_telemetry.c\n+++ b/lib/librte_telemetry/rte_telemetry.c\n@@ -558,7 +558,7 @@ rte_telemetry_send_ports_stats_values(uint32_t *metric_ids, int num_metric_ids,\n \t\t}\n \n \t\tret = rte_telemetry_update_metrics_ethdev(telemetry,\n-\t\t\t\tport_ids[i], telemetry->reg_index);\n+\t\t\t\tport_ids[i], telemetry->reg_index[i]);\n \t\tif (ret < 0) {\n \t\t\tTELEMETRY_LOG_ERR(\"Failed to update ethdev metrics\");\n \t\t\treturn -1;\n@@ -658,23 +658,45 @@ rte_telemetry_reg_ethdev_to_metrics(uint16_t port_id)\n static int32_t\n rte_telemetry_initial_accept(struct telemetry_impl *telemetry)\n {\n+\tstruct driver_index {\n+\t\tconst void *dev_ops;\n+\t\tint reg_index;\n+\t} drv_idx[RTE_MAX_ETHPORTS];\n+\tint nb_drv_idx = 0;\n \tuint16_t pid;\n \tint ret;\n \tint selftest = 0;\n \n \tRTE_ETH_FOREACH_DEV(pid) {\n-\t\ttelemetry->reg_index = rte_telemetry_reg_ethdev_to_metrics(pid);\n-\t\tbreak;\n-\t}\n+\t\tint i;\n+\t\t/* Different device types have different numbers of stats, so\n+\t\t * first check if the stats for this type of device have\n+\t\t * already been registered\n+\t\t */\n+\t\tfor (i = 0; i < nb_drv_idx; i++) {\n+\t\t\tif (rte_eth_devices[pid].dev_ops == drv_idx[i].dev_ops) {\n+\t\t\t\ttelemetry->reg_index[pid] = drv_idx[i].reg_index;\n+\t\t\t\tbreak;\n+\t\t\t}\n+\t\t}\n+\t\tif (i < nb_drv_idx)\n+\t\t\tcontinue; /* we found a match, go to next port */\n \n-\tif (telemetry->reg_index < 0) {\n-\t\tTELEMETRY_LOG_ERR(\"Failed to register ethdev metrics\");\n-\t\treturn -1;\n+\t\t/* No match, register a new set of xstats for this port */\n+\t\tret = rte_telemetry_reg_ethdev_to_metrics(pid);\n+\t\tif (ret < 0) {\n+\t\t\tTELEMETRY_LOG_ERR(\"Failed to register ethdev metrics\");\n+\t\t\treturn -1;\n+\t\t}\n+\t\ttelemetry->reg_index[pid] = ret;\n+\t\tdrv_idx[nb_drv_idx].dev_ops = rte_eth_devices[pid].dev_ops;\n+\t\tdrv_idx[nb_drv_idx].reg_index = ret;\n+\t\tnb_drv_idx++;\n \t}\n \n \ttelemetry->metrics_register_done = 1;\n \tif (selftest) {\n-\t\tret = rte_telemetry_socket_messaging_testing(telemetry->reg_index,\n+\t\tret = rte_telemetry_socket_messaging_testing(telemetry->reg_index[0],\n \t\t\t\ttelemetry->server_fd);\n \t\tif (ret < 0)\n \t\t\treturn -1;\n@@ -1299,7 +1321,7 @@ rte_telemetry_socket_messaging_testing(int index, int socket)\n \t}\n \n \ttelemetry->server_fd = socket;\n-\ttelemetry->reg_index = index;\n+\ttelemetry->reg_index[0] = index;\n \tTELEMETRY_LOG_INFO(\"Beginning Telemetry socket message Selftest\");\n \trte_telemetry_socket_test_setup(telemetry, &send_fd, &recv_fd);\n \tTELEMETRY_LOG_INFO(\"Register valid client test\");\ndiff --git a/lib/librte_telemetry/rte_telemetry_internal.h b/lib/librte_telemetry/rte_telemetry_internal.h\nindex de7afda30..c298c3919 100644\n--- a/lib/librte_telemetry/rte_telemetry_internal.h\n+++ b/lib/librte_telemetry/rte_telemetry_internal.h\n@@ -36,7 +36,7 @@ typedef struct telemetry_impl {\n \tpthread_t thread_id;\n \tint thread_status;\n \tuint32_t socket_id;\n-\tint reg_index;\n+\tint reg_index[RTE_MAX_ETHPORTS];\n \tint metrics_register_done;\n \tTAILQ_HEAD(, telemetry_client) client_list_head;\n \tstruct telemetry_client *request_client;\n",
    "prefixes": []
}