Show a patch.

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

{
    "id": 74594,
    "url": "https://patches.dpdk.org/api/patches/74594/",
    "web_url": "https://patches.dpdk.org/patch/74594/",
    "project": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/projects/1/",
        "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"
    },
    "msgid": "<20200721182242.5366-9-stephen@networkplumber.org>",
    "date": "2020-07-21T18:22:42",
    "name": "[v4,8/8] app/proc-info: provide way to request info on owned ports",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "7bc6fb69a9cd9ab306f6884e7c99aa33fa8b9c6f",
    "submitter": {
        "id": 27,
        "url": "https://patches.dpdk.org/api/people/27/",
        "name": "Stephen Hemminger",
        "email": "stephen@networkplumber.org"
    },
    "delegate": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/users/1/",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "https://patches.dpdk.org/patch/74594/mbox/",
    "series": [
        {
            "id": 11222,
            "url": "https://patches.dpdk.org/api/series/11222/",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=11222",
            "date": "2020-07-21T18:22:34",
            "name": "app/proc-info enhancements",
            "version": 4,
            "mbox": "https://patches.dpdk.org/series/11222/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/74594/comments/",
    "check": "warning",
    "checks": "https://patches.dpdk.org/api/patches/74594/checks/",
    "tags": {},
    "headers": {
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "X-Gm-Message-State": "AOAM531IlD7d1P7qoRcb476bVxg02JzZbRbayvT8Ofqw8smjhWdwrTP2\n VIdVWDPLHWt18G9+7twKFE2Hdp0ZIZbVuQ==",
        "X-Google-Smtp-Source": "\n ABdhPJyPYVrPMzXih6RbBYmvWY+z0/9BPaJ1g7/tMPJfvmX6WPYzkZRSlqavOyLj7uDhm+XTF8DEXA==",
        "List-Post": "<mailto:dev@dpdk.org>",
        "MIME-Version": "1.0",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "X-BeenThere": "dev@dpdk.org",
        "References": "<20200506193741.24117-1-stephen@networkplumber.org>\n <20200721182242.5366-1-stephen@networkplumber.org>",
        "Subject": "[dpdk-dev] [PATCH v4 8/8] app/proc-info: provide way to request\n\tinfo on owned ports",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id B52CDA0526;\n\tTue, 21 Jul 2020 20:24:05 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 277961C0D4;\n\tTue, 21 Jul 2020 20:23:14 +0200 (CEST)",
            "from mail-pf1-f196.google.com (mail-pf1-f196.google.com\n [209.85.210.196]) by dpdk.org (Postfix) with ESMTP id 086B31C0C0\n for <dev@dpdk.org>; Tue, 21 Jul 2020 20:23:05 +0200 (CEST)",
            "by mail-pf1-f196.google.com with SMTP id s26so11117619pfm.4\n for <dev@dpdk.org>; Tue, 21 Jul 2020 11:23:04 -0700 (PDT)",
            "from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127])\n by smtp.gmail.com with ESMTPSA id 76sm21434031pfu.139.2020.07.21.11.23.02\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Tue, 21 Jul 2020 11:23:02 -0700 (PDT)"
        ],
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "X-Mailer": "git-send-email 2.27.0",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20161025;\n h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n :references:mime-version:content-transfer-encoding;\n bh=ayjpsRuSmwaP8iEWgmrAlJ/SL79IxKv+SuNzii3piHE=;\n b=KMM3lHQ6R2OvwhO16Oh40F9NXJ4vZtvi6wLtc6vZYT0JpeRvs0oPSfBNgbIYL/nrf/\n liy8v18YtFr78fIUM/HOtI9cH2RIDeDaVy9B6CFXM0qNRm2+9Wh8M1RqefFd62MKUFMD\n Hqmy+7Jir3WueOYCWs6H7o4zIIbWkZ5uBi4jCX8X2ys9lnUIYOARgW+KT4C+hgHy3RFO\n JZs/bThEaNRADVu2AUc9urbkO4WQtwlq2UvSVoShKRnUIB1gZbT8kAvkUPmjIAW9bUL5\n 9c51FG9dAM+cl0S94J1bfENBnA0wwu2L5m227SkJZ1Q+PmubJxjAlcTuv1Uqe1JLx3PT\n XRPA==",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=networkplumber-org.20150623.gappssmtp.com; s=20150623;\n h=from:to:cc:subject:date:message-id:in-reply-to:references\n :mime-version:content-transfer-encoding;\n bh=ayjpsRuSmwaP8iEWgmrAlJ/SL79IxKv+SuNzii3piHE=;\n b=oVr9WPcdQcgAWHYYGpQjH/tBoa7PTwmb4mCZ2ER1AQqCgOWGmC0gJ0B35RdHyJN+IS\n Z1PCDZG0BYDGcX/uV54T3zdbD/wyExPwnHHSy+k3tmao2rd6SKFGLJLGdYblIqJlwO9r\n 5KGO0ou0SH7pMICxu2CAPbggvmcUlg9pZqcWhbcrCWSZl+f5ViDTt8BLxjDFJlrS5/S8\n 6l0OkOtdjxaqfjErM5Dw+nQZAhayQAUp8Jdseg13RgNr5rVSejgLsmH/qWMNFsXV05pW\n hXCUgvZJbsKsjDl2rn66i1utCER6AWa4jUdrOy65jz9peOB7IJFpf3pDqEbDbLqe1K11\n v4pA==",
        "Date": "Tue, 21 Jul 2020 11:22:42 -0700",
        "Content-Transfer-Encoding": "8bit",
        "X-Received": "by 2002:a63:5013:: with SMTP id e19mr23775662pgb.68.1595355783613;\n Tue, 21 Jul 2020 11:23:03 -0700 (PDT)",
        "To": "dev@dpdk.org",
        "From": "Stephen Hemminger <stephen@networkplumber.org>",
        "In-Reply-To": "<20200721182242.5366-1-stephen@networkplumber.org>",
        "Cc": "Stephen Hemminger <stephen@networkplumber.org>,\n Hemant Agrawal <hemant.agrawal@nxp.com>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Message-Id": "<20200721182242.5366-9-stephen@networkplumber.org>",
        "Return-Path": "<dev-bounces@dpdk.org>"
    },
    "content": "There are cases where a port maybe owned by another (failsafe, netvsc,\nbond); but currently proc-info has no way to look at stats of those\nports. This patch provides way for the user to explicitly ask for these\nports.\n\nIf no portmask is given the output is unchanged; it only shows the\ntop level ports. If portmask requests a specific port it will be\nshown even if owned.\n\nIncrease the size of port mask variable to unsigned long to\nallow up to 64 ports to be handled on 64 bit architecture.\n\nThe device owner is also a useful thing to show in port info.\n\nSigned-off-by: Stephen Hemminger <stephen@networkplumber.org>\nAcked-by: Hemant Agrawal <hemant.agrawal@nxp.com>\n---\n app/proc-info/main.c | 94 ++++++++++++++++++++++++++------------------\n 1 file changed, 55 insertions(+), 39 deletions(-)",
    "diff": "diff --git a/app/proc-info/main.c b/app/proc-info/main.c\nindex aa074dc7c429..77a59bcefb9b 100644\n--- a/app/proc-info/main.c\n+++ b/app/proc-info/main.c\n@@ -12,6 +12,7 @@\n #include <stdlib.h>\n #include <getopt.h>\n #include <unistd.h>\n+#include <strings.h>\n \n #include <rte_eal.h>\n #include <rte_common.h>\n@@ -46,7 +47,7 @@\n \tSTATS_BDR_FMT, s, w, STATS_BDR_FMT)\n \n /**< mask of enabled ports */\n-static uint32_t enabled_port_mask;\n+static unsigned long enabled_port_mask;\n /**< Enable stats. */\n static uint32_t enable_stats;\n /**< Enable xstats. */\n@@ -128,23 +129,17 @@ static int\n parse_portmask(const char *portmask)\n {\n \tchar *end = NULL;\n-\tunsigned long pm;\n \n \terrno = 0;\n \n \t/* parse hexadecimal string */\n-\tpm = strtoul(portmask, &end, 16);\n-\tif ((portmask[0] == '\\0') || (end == NULL) || (*end != '\\0') ||\n-\t\t(errno != 0)) {\n-\t\tprintf(\"%s ERROR parsing the port mask\\n\", __func__);\n+\tenabled_port_mask = strtoul(portmask, &end, 16);\n+\tif (portmask[0] == '\\0' || end == NULL || *end != '\\0' || errno != 0) {\n+\t\tfprintf(stderr, \"Invalid portmask '%s'\\n\", portmask);\n \t\treturn -1;\n \t}\n \n-\tif (pm == 0)\n-\t\treturn -1;\n-\n-\treturn pm;\n-\n+\treturn 0;\n }\n \n /*\n@@ -242,9 +237,7 @@ proc_info_parse_args(int argc, char **argv)\n \t\tswitch (opt) {\n \t\t/* portmask */\n \t\tcase 'p':\n-\t\t\tenabled_port_mask = parse_portmask(optarg);\n-\t\t\tif (enabled_port_mask == 0) {\n-\t\t\t\tprintf(\"invalid portmask\\n\");\n+\t\t\tif (parse_portmask(optarg) < 0) {\n \t\t\t\tproc_info_usage(prgname);\n \t\t\t\treturn -1;\n \t\t\t}\n@@ -702,20 +695,28 @@ show_security_context(uint16_t portid)\n static void\n show_port(void)\n {\n-\tuint16_t i = 0;\n-\tint ret = 0, j, k;\n+\tint i, ret, j, k;\n \n \tsnprintf(bdr_str, MAX_STRING_LEN, \" show - Port PMD \");\n \tSTATS_BDR_STR(10, bdr_str);\n-\n-\tRTE_ETH_FOREACH_DEV(i) {\n+\t\n+\tfor (i = 0; i < RTE_MAX_ETHPORTS; i++) {\n \t\tuint16_t mtu = 0;\n \t\tstruct rte_eth_link link;\n \t\tstruct rte_eth_dev_info dev_info;\n \t\tstruct rte_eth_rss_conf rss_conf;\n \t\tstruct rte_eth_fc_conf fc_conf;\n \t\tstruct rte_ether_addr mac;\n+\t\tstruct rte_eth_dev_owner owner;\n \n+\t\t/* Skip if port is not in mask */\n+\t\tif ((enabled_port_mask & (1ul << i)) == 0)\n+\t\t\tcontinue;\n+\t\t\n+\t\t/* Skip if port is unused */\n+\t\tif (!rte_eth_dev_is_valid_port(i))\n+\t\t\tcontinue;\n+\t\t\n \t\tmemset(&rss_conf, 0, sizeof(rss_conf));\n \n \t\tsnprintf(bdr_str, MAX_STRING_LEN, \" Port %u \", i);\n@@ -733,6 +734,11 @@ show_port(void)\n \t\t       dev_info.driver_name, dev_info.device->name,\n \t\t       rte_eth_dev_socket_id(i));\n \n+\t\tret = rte_eth_dev_owner_get(i, &owner);\n+\t\tif (ret == 0 && owner.id != RTE_ETH_DEV_NO_OWNER)\n+\t\t\tprintf(\"\\t --  owner %#\"PRIx64\":%s\\n\",\n+\t\t\t       owner.id, owner.name);\n+\n \t\tret = rte_eth_link_get(i, &link);\n \t\tif (ret < 0) {\n \t\t\tprintf(\"Link get failed (port %u): %s\\n\",\n@@ -1411,28 +1417,38 @@ main(int argc, char **argv)\n \tif (nb_ports == 0)\n \t\trte_exit(EXIT_FAILURE, \"No Ethernet ports - bye\\n\");\n \n-\t/* If no port mask was specified*/\n-\tif (enabled_port_mask == 0)\n-\t\tenabled_port_mask = 0xffff;\n+\t/* If no port mask was specified, then show non-owned ports */\n+\tif (enabled_port_mask == 0) {\n+\t\tRTE_ETH_FOREACH_DEV(i)\n+\t\t\tenabled_port_mask = 1ul << i;\n+\t}\n+\n+\tfor (i = 0; i < RTE_MAX_ETHPORTS; i++) {\n+\n+\t\t/* Skip if port is not in mask */\n+\t\tif ((enabled_port_mask & (1ul << i)) == 0)\n+\t\t\tcontinue;\n+\t\t\n+\t\t/* Skip if port is unused */\n+\t\tif (!rte_eth_dev_is_valid_port(i))\n+\t\t\tcontinue;\n+\n+\t\tif (enable_stats)\n+\t\t\tnic_stats_display(i);\n+\t\telse if (enable_xstats)\n+\t\t\tnic_xstats_display(i);\n+\t\telse if (reset_stats)\n+\t\t\tnic_stats_clear(i);\n+\t\telse if (reset_xstats)\n+\t\t\tnic_xstats_clear(i);\n+\t\telse if (enable_xstats_name)\n+\t\t\tnic_xstats_by_name_display(i, xstats_name);\n+\t\telse if (nb_xstats_ids > 0)\n+\t\t\tnic_xstats_by_ids_display(i, xstats_ids,\n+\t\t\t\t\t\t  nb_xstats_ids);\n+\t\telse if (enable_metrics)\n+\t\t\tmetrics_display(i);\n \n-\tRTE_ETH_FOREACH_DEV(i) {\n-\t\tif (enabled_port_mask & (1 << i)) {\n-\t\t\tif (enable_stats)\n-\t\t\t\tnic_stats_display(i);\n-\t\t\telse if (enable_xstats)\n-\t\t\t\tnic_xstats_display(i);\n-\t\t\telse if (reset_stats)\n-\t\t\t\tnic_stats_clear(i);\n-\t\t\telse if (reset_xstats)\n-\t\t\t\tnic_xstats_clear(i);\n-\t\t\telse if (enable_xstats_name)\n-\t\t\t\tnic_xstats_by_name_display(i, xstats_name);\n-\t\t\telse if (nb_xstats_ids > 0)\n-\t\t\t\tnic_xstats_by_ids_display(i, xstats_ids,\n-\t\t\t\t\t\tnb_xstats_ids);\n-\t\t\telse if (enable_metrics)\n-\t\t\t\tmetrics_display(i);\n-\t\t}\n \t}\n \n \t/* print port independent stats */\n",
    "prefixes": [
        "v4",
        "8/8"
    ]
}