get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 76275,
    "url": "https://patches.dpdk.org/api/patches/76275/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20200901190727.76476-1-dliu@iol.unh.edu/",
    "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": "<20200901190727.76476-1-dliu@iol.unh.edu>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200901190727.76476-1-dliu@iol.unh.edu",
    "date": "2020-09-01T19:07:27",
    "name": "[V1] testpmd: add eeprom/module eeprom display",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "ffebb7f8739713a65d81227302d58651fc9b5d9d",
    "submitter": {
        "id": 1818,
        "url": "https://patches.dpdk.org/api/people/1818/?format=api",
        "name": "dliu",
        "email": "dliu@iol.unh.edu"
    },
    "delegate": {
        "id": 319,
        "url": "https://patches.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20200901190727.76476-1-dliu@iol.unh.edu/mbox/",
    "series": [
        {
            "id": 11885,
            "url": "https://patches.dpdk.org/api/series/11885/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=11885",
            "date": "2020-09-01T19:07:27",
            "name": "[V1] testpmd: add eeprom/module eeprom display",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/11885/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/76275/comments/",
    "check": "fail",
    "checks": "https://patches.dpdk.org/api/patches/76275/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 dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 344F2A04AC;\n\tTue,  1 Sep 2020 21:07:37 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id C2B4C1C0B6;\n\tTue,  1 Sep 2020 21:07:36 +0200 (CEST)",
            "from mail-qv1-f43.google.com (mail-qv1-f43.google.com\n [209.85.219.43]) by dpdk.org (Postfix) with ESMTP id 2F6F01C0AF\n for <dev@dpdk.org>; Tue,  1 Sep 2020 21:07:35 +0200 (CEST)",
            "by mail-qv1-f43.google.com with SMTP id h1so1045107qvo.9\n for <dev@dpdk.org>; Tue, 01 Sep 2020 12:07:35 -0700 (PDT)",
            "from traffictester.opnfv.iol.unh.edu (opnfv-vpn.iol.unh.edu.\n [132.177.125.250])\n by smtp.gmail.com with ESMTPSA id x126sm2568355qkb.101.2020.09.01.12.07.33\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Tue, 01 Sep 2020 12:07:33 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu;\n s=unh-iol;\n h=from:to:cc:subject:date:message-id;\n bh=IGBMx56SCyCgk6ebdEJx6sJyJMypSzmaeTzTeCoup5s=;\n b=f18ayqFCCis4a8sdrtL//ywEttBykyg2Tnqt8R4E8FVCMtRp0EeRT+/6+Jnb23JtMq\n fB5CRuyqjKVYGIPSug8SaKKqLGcns0H3kjEuo9x905Zh3UjTkHYjGLb4ypPTuy4UpiNC\n G/mHM9aW42sXwvICsbDUtvqN7rSx14gKIwneQ=",
        "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;\n bh=IGBMx56SCyCgk6ebdEJx6sJyJMypSzmaeTzTeCoup5s=;\n b=FBf30ExGn/2uB4+F3rbk9KmNcUP/3qz5bFOkLYEmvVoHfYm3DVntiWFwYpj4TQf3Z6\n hA5oFmNEnvsBNocvsbe3GO7Bm8T0LpzGRbBOA46l7OO8FPvWI6BJsYUwJIJIHb5cwUYn\n kYwdj0pRQXxLNYf/i/Bo9H2XGz/X31zeYpf/nRRO4GJj9oulpQlpApymz9UGU0I1cOzA\n 2DVQ2yaGQn8qYrUEpsdx0xHrQLbWJ9FgCH/QdB8YJyoM10c3zJVoiT3chaxa4q3uFNcr\n CDB83U1yy8SiZyePyIXsKdlUnYjxLuUlSfF9m/P9OGGzqDUHjq9zqtsOaBF1xCd7jN6c\n hAgw==",
        "X-Gm-Message-State": "AOAM533DNU4mIeX/+LOkqPw0zh5DatwrDt48l7lkwoyavKzNpY2a1rcN\n dG61HmqkBKUwRUmZMAzyWnvQ+A==",
        "X-Google-Smtp-Source": "\n ABdhPJzOQf8zHbpEahKPME1OeHytEadIw8FIC0+gIrRWaB/bVgkYH2CxoEbkUU5MgJCYm5fYN9O34Q==",
        "X-Received": "by 2002:a05:6214:570:: with SMTP id\n cj16mr3467533qvb.24.1598987254531;\n Tue, 01 Sep 2020 12:07:34 -0700 (PDT)",
        "From": "David Liu <dliu@iol.unh.edu>",
        "To": "ferruh.yigit@intel.com",
        "Cc": "dev@dpdk.org, lylavoie@iol.unh.edu, tmonjalon@nvidia.com,\n David Liu <dliu@iol.unh.edu>",
        "Date": "Tue,  1 Sep 2020 15:07:27 -0400",
        "Message-Id": "<20200901190727.76476-1-dliu@iol.unh.edu>",
        "X-Mailer": "git-send-email 2.17.1",
        "Subject": "[dpdk-dev]  [PATCH V1] testpmd: add eeprom/module eeprom display",
        "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 <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": "Change display message.\nAdd EEPROM dump command\n  \"show port <port_id> eeprom\"\nAdd module EEPROM dump command\n     \"show port <port_id> module_eeprom\"\nCommands will dump the content of the \nEEPROM/module EEPROM for the selected port.\n\nSigned-off-by: David Liu <dliu@iol.unh.edu>\n---\n app/test-pmd/cmdline.c                      |  87 ++++++++++++++\n app/test-pmd/config.c                       | 126 ++++++++++++++++++++\n app/test-pmd/testpmd.h                      |   2 +\n doc/guides/testpmd_app_ug/testpmd_funcs.rst |  14 +++\n 4 files changed, 229 insertions(+)",
    "diff": "diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c\nindex a037a55c6..71c98dd96 100644\n--- a/app/test-pmd/cmdline.c\n+++ b/app/test-pmd/cmdline.c\n@@ -166,6 +166,12 @@ static void cmd_help_long_parsed(void *parsed_result,\n \t\t\t\"show port (info|stats|summary|xstats|fdir|stat_qmap|dcb_tc|cap) (port_id|all)\\n\"\n \t\t\t\"    Display information for port_id, or all.\\n\\n\"\n \n+\t\t\t\"show port (port_id) eeprom \\n\"\n+\t\t\t\"    Display the EEPROM infomation for given port_id.\\n\\n\"\n+\n+\t\t\t\"show port (port_id) module_eeprom \\n\"\n+\t\t\t\"    Display the port moudle EEPROM infomation for given port_id.\\n\\n\"\n+\n \t\t\t\"show port X rss reta (size) (mask0,mask1,...)\\n\"\n \t\t\t\"    Display the rss redirection table entry indicated\"\n \t\t\t\" by masks on port X. size is used to indicate the\"\n@@ -7594,6 +7600,85 @@ cmdline_parse_inst_t cmd_showdevice = {\n \t\tNULL,\n \t},\n };\n+\n+/* ** SHOW EEPROM INFO *** */\n+struct cmd_showeeprom_result {\n+       cmdline_fixed_string_t show;\n+       cmdline_fixed_string_t port;\n+       cmdline_fixed_string_t type;\n+        uint16_t portnum;\n+};\n+\n+static void cmd_showeeprom_parsed(void *parsed_result,\n+               __rte_unused struct cmdline *cl,\n+               __rte_unused void *data)\n+{\n+       struct cmd_showeeprom_result *res = parsed_result;\n+\n+       port_eeprom_display(res->portnum);\n+}\n+\n+cmdline_parse_token_string_t cmd_showeeprom_show =\n+       TOKEN_STRING_INITIALIZER(struct cmd_showeeprom_result, show, \"show\");\n+cmdline_parse_token_string_t cmd_showeeprom_port =\n+       TOKEN_STRING_INITIALIZER(struct cmd_showeeprom_result, port, \"port\");\n+cmdline_parse_token_num_t cmd_showeeprom_portnum =\n+       TOKEN_NUM_INITIALIZER(struct cmd_showeeprom_result, portnum, UINT16);\n+cmdline_parse_token_string_t cmd_showeeprom_type =\n+       TOKEN_STRING_INITIALIZER(struct cmd_showeeprom_result, type, \"eeprom\");\n+\n+cmdline_parse_inst_t cmd_showeeprom = {\n+       .f = cmd_showeeprom_parsed,\n+       .data = NULL,\n+       .help_str = \"show port <port_id> eeprom\",\n+       .tokens = {\n+               (void *)&cmd_showeeprom_show,\n+               (void *)&cmd_showeeprom_port,\n+               (void *)&cmd_showeeprom_portnum,\n+               (void *)&cmd_showeeprom_type,\n+               NULL,\n+       },\n+};\n+\n+/* ** SHOW MODULE EEPROM INFO *** */\n+struct cmd_showmoduleeeprom_result {\n+       cmdline_fixed_string_t show;\n+       cmdline_fixed_string_t port;\n+       cmdline_fixed_string_t type;\n+        uint16_t portnum;\n+};\n+\n+static void cmd_showmoduleeeprom_parsed(void *parsed_result,\n+               __rte_unused struct cmdline *cl,\n+               __rte_unused void *data)\n+{\n+       struct cmd_showmoduleeeprom_result *res = parsed_result;\n+\n+       port_module_eeprom_display(res->portnum);\n+}\n+\n+cmdline_parse_token_string_t cmd_showmoduleeeprom_show =\n+       TOKEN_STRING_INITIALIZER(struct cmd_showmoduleeeprom_result, show, \"show\");\n+cmdline_parse_token_string_t cmd_showmoduleeeprom_port =\n+       TOKEN_STRING_INITIALIZER(struct cmd_showmoduleeeprom_result, port, \"port\");\n+cmdline_parse_token_num_t cmd_showmoduleeeprom_portnum =\n+\tTOKEN_NUM_INITIALIZER(struct cmd_showmoduleeeprom_result, portnum, UINT16);\n+cmdline_parse_token_string_t cmd_showmoduleeeprom_type =\n+\tTOKEN_STRING_INITIALIZER(struct cmd_showmoduleeeprom_result, type, \"module_eeprom\");\n+\n+cmdline_parse_inst_t cmd_showmoduleeeprom = {\n+\t.f = cmd_showmoduleeeprom_parsed,\n+\t.data = NULL,\n+\t.help_str = \"show port <port_id> module_eeprom\",\n+\t.tokens = {\n+\t\t(void *)&cmd_showmoduleeeprom_show,\n+\t\t(void *)&cmd_showmoduleeeprom_port,\n+\t\t(void *)&cmd_showmoduleeeprom_portnum,\n+\t\t(void *)&cmd_showmoduleeeprom_type,\n+\t\tNULL,\n+\t},\n+};\n+\n /* *** SHOW QUEUE INFO *** */\n struct cmd_showqueue_result {\n \tcmdline_fixed_string_t show;\n@@ -19325,6 +19410,8 @@ cmdline_parse_ctx_t main_ctx[] = {\n \t(cmdline_parse_inst_t *)&cmd_load_from_file,\n \t(cmdline_parse_inst_t *)&cmd_showport,\n \t(cmdline_parse_inst_t *)&cmd_showqueue,\n+        (cmdline_parse_inst_t *)&cmd_showeeprom,\n+\t(cmdline_parse_inst_t *)&cmd_showmoduleeeprom,\n \t(cmdline_parse_inst_t *)&cmd_showportall,\n \t(cmdline_parse_inst_t *)&cmd_showdevice,\n \t(cmdline_parse_inst_t *)&cmd_showcfg,\ndiff --git a/app/test-pmd/config.c b/app/test-pmd/config.c\nindex 8cf84ccd3..ea026a8eb 100644\n--- a/app/test-pmd/config.c\n+++ b/app/test-pmd/config.c\n@@ -49,6 +49,7 @@\n #include <rte_pmd_bnxt.h>\n #endif\n #include <rte_gro.h>\n+#include <rte_hexdump.h>\n \n #include \"testpmd.h\"\n \n@@ -710,6 +711,131 @@ port_summary_display(portid_t port_id)\n \t\t(unsigned int) link.link_speed);\n }\n \n+void\n+port_eeprom_display(portid_t port_id)\n+{\n+       struct rte_dev_eeprom_info einfo;\n+       int ret;\n+\n+       if (port_id_is_invalid(port_id, ENABLED_WARN)) {\n+               print_valid_ports();\n+               return;\n+       }\n+\n+       int len_eeprom = rte_eth_dev_get_eeprom_length(port_id);\n+\n+       if(len_eeprom < 0) {\n+               switch (len_eeprom) {\n+               case -ENODEV:\n+\t\t       printf(\"port index %d invalid\\n\", port_id);\n+\t\t       break;\n+\t       case -ENOTSUP:\n+                       printf(\"operation not supported by device\\n\");\n+                       break;\n+               case -EIO:\n+\t\t       printf(\"device is removed\\n\");\n+\t\t       break;\n+               default:\n+                       printf(\"Unable to get module EEPROM: %d\\n\", ret);\n+                       break;\n+               }\n+\t       return;\n+       }\n+\n+       char buf[len_eeprom];\n+       printf(\"\\nPort: %d\\nModule EEPROM:\\n\", port_id);\n+\n+       einfo.offset = 0;\n+       einfo.length = len_eeprom;\n+       einfo.data = buf;\n+\n+       ret = rte_eth_dev_get_eeprom(port_id, &einfo);\n+       if (ret != 0) {\n+               switch (ret) {\n+               case -ENODEV:\n+\t\t       printf(\"port index %d invalid\\n\", port_id);\n+\t\t       break;\n+               case -ENOTSUP:\n+                       printf(\"operation not supported by device\\n\");\n+\t\t       break;\n+               case -EIO:\n+\t\t       printf(\"device is removed\\n\");\n+\t\t       break;\n+\t       default:\n+\t\t       printf(\"Unable to get module EEPROM: %d\\n\", ret);\n+\t\t       break;\n+\t       }\n+\t       return;\n+       }\n+       \n+       rte_hexdump(stdout, \"hexdump\", einfo.data, einfo.length);\n+       printf(\"Finish -- Total EEPROM length: %i bytes\\n\", len_eeprom);\n+}\n+\n+void\n+port_module_eeprom_displao(portid_t port_id)\n+{\n+       struct rte_eth_dev_module_info minfo;\n+       struct rte_dev_eeprom_info einfo;\n+       int ret;\n+\n+       if (port_id_is_invalid(port_id, ENABLED_WARN)) {\n+               print_valid_ports();\n+               return;\n+       }\n+\n+       ret = rte_eth_dev_get_module_info(port_id, &minfo);\n+       if (ret != 0) {\n+               switch (ret) {\n+               case -ENODEV:\n+                       printf(\"port index %d invalid\\n\", port_id);\n+                       break;\n+               case -ENOTSUP:\n+                       printf(\"operation not supported by device\\n\");\n+                       break;\n+               case -EIO:\n+                       printf(\"device Iis removed\\n\");\n+                       break;\n+               default:\n+                       printf(\"Unable to get module info: %d\\n\", ret);\n+                       break;\n+               }\n+               return;\n+       }\n+\n+       if (minfo.eeprom_len < 0){\n+               printf(\"invalid module eeprom length\");\n+               return;\n+       }\n+\n+       char buf[minfo.eeprom_len];\n+       einfo.offset = 0;\n+       einfo.length = minfo.eeprom_len;\n+       einfo.data = buf;\n+\n+       ret = rte_eth_dev_get_module_eeprom(port_id, &einfo);\n+       if (ret != 0) {\n+               switch (ret) {\n+               case -ENODEV:\n+                       printf(\"port index %d invalid\\n\", port_id);\n+                       break;\n+               case -ENOTSUP:\n+                       printf(\"operation not supported by device\\n\");\n+                       break;\n+               case -EIO:\n+                       printf(\"device Iis removed\\n\");\n+                       break;\n+               default:\n+                       printf(\"Unable to get module EEPROM: %d\\n\", ret);\n+                       break;\n+               }\n+               return;\n+       }\n+\n+       printf(\"\\nPort: %d\\nEEPROM:\\n\", port_id);\n+       rte_hexdump(stdout, \"hexdump\", einfo.data, einfo.length);\n+}\n+\n void\n port_offload_cap_display(portid_t port_id)\n {\ndiff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h\nindex 7a7c73f79..e3a0d17e5 100644\n--- a/app/test-pmd/testpmd.h\n+++ b/app/test-pmd/testpmd.h\n@@ -714,6 +714,8 @@ void nic_stats_mapping_display(portid_t port_id);\n void device_infos_display(const char *identifier);\n void port_infos_display(portid_t port_id);\n void port_summary_display(portid_t port_id);\n+void port_eeprom_display(portid_t port_id);\n+void port_module_eeprom_display(portid_t port_id);\n void port_summary_header_display(void);\n void port_offload_cap_display(portid_t port_id);\n void rx_queue_infos_display(portid_t port_idi, uint16_t queue_id);\ndiff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst\nindex 5103ff925..f3e2211ab 100644\n--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst\n+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst\n@@ -218,6 +218,20 @@ For example:\n      nvgre\n      vxlan-gpe\n \n+show port eeprom\n+~~~~~~~~~~~~~~~~\n+\n+Display the EEPROM informatioon for given port_id::\n+\n+   testpmd> show port (port_id) eeprom\n+\n+show port module eeprom\n+~~~~~~~~~~~~~~~~~~~~~~~\n+\n+Display the module EEPROM informatioon for given port_id::\n+\n+   testpmd> show port (port_id) module_eeprom\n+\n show port rss reta\n ~~~~~~~~~~~~~~~~~~\n \n",
    "prefixes": [
        "V1"
    ]
}