get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 38879,
    "url": "http://patches.dpdk.org/api/patches/38879/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1524650515-26659-3-git-send-email-zijie.pan@6wind.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": "<1524650515-26659-3-git-send-email-zijie.pan@6wind.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1524650515-26659-3-git-send-email-zijie.pan@6wind.com",
    "date": "2018-04-25T10:01:52",
    "name": "[dpdk-dev,v6,2/5] examples/ethtool: add a new command module-eeprom",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "493928345d6ac4e11895a2d0516afd6d7f824c26",
    "submitter": {
        "id": 991,
        "url": "http://patches.dpdk.org/api/people/991/?format=api",
        "name": "Zijie Pan",
        "email": "zijie.pan@6wind.com"
    },
    "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/1524650515-26659-3-git-send-email-zijie.pan@6wind.com/mbox/",
    "series": [],
    "comments": "http://patches.dpdk.org/api/patches/38879/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/38879/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 6FF1B5F14;\n\tWed, 25 Apr 2018 12:02:24 +0200 (CEST)",
            "from mail-wm0-f43.google.com (mail-wm0-f43.google.com\n\t[74.125.82.43]) by dpdk.org (Postfix) with ESMTP id 8F5845593\n\tfor <dev@dpdk.org>; Wed, 25 Apr 2018 12:02:19 +0200 (CEST)",
            "by mail-wm0-f43.google.com with SMTP id w195so6112452wmw.2\n\tfor <dev@dpdk.org>; Wed, 25 Apr 2018 03:02:19 -0700 (PDT)",
            "from cougar.6wind.com (host.78.145.23.62.rev.coltfrance.com.\n\t[62.23.145.78]) by smtp.gmail.com with ESMTPSA id\n\tn143sm14100363wmd.29.2018.04.25.03.02.18\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tWed, 25 Apr 2018 03:02:18 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=6wind-com.20150623.gappssmtp.com; s=20150623;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=F0x1wJazy/E7s6jTcEcndsEISCrENaLyoVxZFj4V4ps=;\n\tb=wdGSNG6g4cHl0rNpwiwgMhidcf3VAdCcIADaMNvEWibuNx1HC6L3e9nDP6s5XiqpBf\n\t7isGclzyTjGFIvdVBW9aBcYDJaeN7wrSbOESjk/r22I/l9JieHtZLQXWU1CC4ujOT6D0\n\tqQsqQE2p++ufRf+LW6DRa1n02gbWymDvWovpTnWC6Fol9kFQJfwSB0Zmc0J8o3zvhEpV\n\tjKkk0mSV5EsM7RPLDpsehnLIgMl3vrjX+4ggiNOCJ2ldSBC2+K78YubRHdAKVGPb2DjN\n\tx9sNDqgYfhboK3BVtXemHdIV4pGxBV/9rDxFLUEOnvrrzqxtm2s6sbz+/QRZjqCjqskG\n\tcEhA==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=F0x1wJazy/E7s6jTcEcndsEISCrENaLyoVxZFj4V4ps=;\n\tb=Px4z3xpaoOZY505KgrwByQs4+3VgePICPjN9SNQNRjFZEcOVjl4WgMCwPOJC9ectqL\n\tiQr/sTuVbZNh6boKaGIR3YInf3BAuosY4mExSf2fv+Kol8iAtEa5PIEXMKFdO+1YWXHq\n\ten2jiNjq8JgQ3VUO6LgcDjrC8kgZW7tOe2ES38T/66tdo03cqK31y2Q+xJU9tbbVK8cW\n\tvFgGRhXf3QIt6OH/JNVn/XmHBpmJXEkNjYLrhGob6wiEPZuYriOSkfe2xxW+WVRqqdKx\n\twJixF9LkhQCCdguN8v9gglweG+BEBTUM7CtEIeSYhFrKYcxVhfwJgl732TCrD8jRu0d3\n\twbcg==",
        "X-Gm-Message-State": "ALQs6tDgH+EY1QA6AACwQPPDUynsRmNXUNA/H0+YoO7Kbk2JyACFiHFk\n\tpf8zEQLyrzN5kvjnBh8MFAXgBr2b9WA=",
        "X-Google-Smtp-Source": "AIpwx48I6pYDYCnzq7xlT9WJMO+LDDur6IsJrTHdaCg73OuZ/FOC5jHbFnud9Tl5jv0M1DXO0pV9MQ==",
        "X-Received": "by 10.28.125.66 with SMTP id y63mr12451816wmc.121.1524650539115; \n\tWed, 25 Apr 2018 03:02:19 -0700 (PDT)",
        "From": "Zijie Pan <zijie.pan@6wind.com>",
        "To": "dev@dpdk.org",
        "Cc": "remy.horton@intel.com, ferruh.yigit@intel.com, thomas@monjalon.net,\n\torika@mellanox.com, bruce.richardson@intel.com,\n\tpablo.de.lara.guarch@intel.com, radu.nicolau@intel.com,\n\takhil.goyal@nxp.com, tomasz.kantecki@intel.com, john.mcnamara@intel.com, \n\tmarko.kovacevic@intel.com",
        "Date": "Wed, 25 Apr 2018 12:01:52 +0200",
        "Message-Id": "<1524650515-26659-3-git-send-email-zijie.pan@6wind.com>",
        "X-Mailer": "git-send-email 1.7.10.4",
        "In-Reply-To": "<1524650515-26659-1-git-send-email-zijie.pan@6wind.com>",
        "References": "<1524647624-23005-1-git-send-email-zijie.pan@6wind.com>\n\t<1524650515-26659-1-git-send-email-zijie.pan@6wind.com>",
        "Subject": "[dpdk-dev] [PATCH v6 2/5] examples/ethtool: add a new command\n\tmodule-eeprom",
        "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://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Add a new command \"module-eeprom\" to get the data of plugin\nmodule EEPROM.\n\nSigned-off-by: Zijie Pan <zijie.pan@6wind.com>\nAcked-by: Remy Horton <remy.horton@intel.com>\n---\nCc: remy.horton@intel.com\nCc: orika@mellanox.com\nCc: bruce.richardson@intel.com\nCc: pablo.de.lara.guarch@intel.com\nCc: radu.nicolau@intel.com\nCc: akhil.goyal@nxp.com\nCc: tomasz.kantecki@intel.com\nCc: john.mcnamara@intel.com\nCc: marko.kovacevic@intel.com\n\n doc/guides/sample_app_ug/ethtool.rst  |    3 ++\n examples/ethtool/ethtool-app/ethapp.c |   64 +++++++++++++++++++++++++++++++++\n examples/ethtool/lib/Makefile         |    1 +\n examples/ethtool/lib/rte_ethtool.c    |   30 ++++++++++++++++\n examples/ethtool/lib/rte_ethtool.h    |   34 ++++++++++++++++++\n 5 files changed, 132 insertions(+)",
    "diff": "diff --git a/doc/guides/sample_app_ug/ethtool.rst b/doc/guides/sample_app_ug/ethtool.rst\nindex 1b79aca..47e09f6 100644\n--- a/doc/guides/sample_app_ug/ethtool.rst\n+++ b/doc/guides/sample_app_ug/ethtool.rst\n@@ -44,6 +44,7 @@ they do as as follows:\n \n * ``drvinfo``: Print driver info\n * ``eeprom``: Dump EEPROM to file\n+* ``module-eeprom``: Dump plugin module EEPROM to file\n * ``link``: Print port link states\n * ``macaddr``: Gets/sets MAC address\n * ``mtu``: Set NIC MTU\n@@ -97,6 +98,8 @@ the following functions:\n - ``rte_ethtool_get_eeprom_len()``\n - ``rte_ethtool_get_eeprom()``\n - ``rte_ethtool_set_eeprom()``\n+- ``rte_ethtool_get_module_info()``\n+- ``rte_ethtool_get_module_eeprom()``\n - ``rte_ethtool_get_pauseparam()``\n - ``rte_ethtool_set_pauseparam()``\n - ``rte_ethtool_net_open()``\ndiff --git a/examples/ethtool/ethtool-app/ethapp.c b/examples/ethtool/ethtool-app/ethapp.c\nindex 4d62f4c..a4e64b3 100644\n--- a/examples/ethtool/ethtool-app/ethapp.c\n+++ b/examples/ethtool/ethtool-app/ethapp.c\n@@ -75,6 +75,9 @@ struct pcmd_intintint_params {\n /* Commands taking port id and string */\n cmdline_parse_token_string_t pcmd_eeprom_token_cmd =\n \tTOKEN_STRING_INITIALIZER(struct pcmd_intstr_params, cmd, \"eeprom\");\n+cmdline_parse_token_string_t pcmd_module_eeprom_token_cmd =\n+\tTOKEN_STRING_INITIALIZER(struct pcmd_intstr_params, cmd,\n+\t\t\t\t \"module-eeprom\");\n cmdline_parse_token_string_t pcmd_mtu_token_cmd =\n \tTOKEN_STRING_INITIALIZER(struct pcmd_intstr_params, cmd, \"mtu\");\n cmdline_parse_token_string_t pcmd_regs_token_cmd =\n@@ -298,6 +301,54 @@ struct pcmd_intintint_params {\n \n \n static void\n+pcmd_module_eeprom_callback(void *ptr_params,\n+\t__rte_unused struct cmdline *ctx,\n+\t__rte_unused void *ptr_data)\n+{\n+\tstruct pcmd_intstr_params *params = ptr_params;\n+\tstruct ethtool_eeprom info_eeprom;\n+\tuint32_t module_info[2];\n+\tint stat;\n+\tunsigned char bytes_eeprom[EEPROM_DUMP_CHUNKSIZE];\n+\tFILE *fp_eeprom;\n+\n+\tif (!rte_eth_dev_is_valid_port(params->port)) {\n+\t\tprintf(\"Error: Invalid port number %i\\n\", params->port);\n+\t\treturn;\n+\t}\n+\n+\tstat = rte_ethtool_get_module_info(params->port, module_info);\n+\tif (stat != 0) {\n+\t\tprintf(\"Module EEPROM information read error %i\\n\", stat);\n+\t\treturn;\n+\t}\n+\n+\tinfo_eeprom.len = module_info[1];\n+\tinfo_eeprom.offset = 0;\n+\n+\tstat = rte_ethtool_get_module_eeprom(params->port,\n+\t\t\t\t\t     &info_eeprom, bytes_eeprom);\n+\tif (stat != 0) {\n+\t\tprintf(\"Module EEPROM read error %i\\n\", stat);\n+\t\treturn;\n+\t}\n+\n+\tfp_eeprom = fopen(params->opt, \"wb\");\n+\tif (fp_eeprom == NULL) {\n+\t\tprintf(\"Error opening '%s' for writing\\n\", params->opt);\n+\t\treturn;\n+\t}\n+\tprintf(\"Total plugin module EEPROM length: %i bytes\\n\",\n+\t       info_eeprom.len);\n+\tif (fwrite(bytes_eeprom, 1, info_eeprom.len,\n+\t\t   fp_eeprom) != info_eeprom.len) {\n+\t\tprintf(\"Error writing '%s'\\n\", params->opt);\n+\t}\n+\tfclose(fp_eeprom);\n+}\n+\n+\n+static void\n pcmd_pause_callback(void *ptr_params,\n \t__rte_unused struct cmdline *ctx,\n \tvoid *ptr_data)\n@@ -664,6 +715,18 @@ static void pcmd_vlan_callback(__rte_unused void *ptr_params,\n \t\tNULL\n \t},\n };\n+cmdline_parse_inst_t pcmd_module_eeprom = {\n+\t.f = pcmd_module_eeprom_callback,\n+\t.data = NULL,\n+\t.help_str = \"module-eeprom <port_id> <filename>\\n\"\n+\t\t\"     Dump plugin module EEPROM to file\",\n+\t.tokens = {\n+\t\t(void *)&pcmd_module_eeprom_token_cmd,\n+\t\t(void *)&pcmd_intstr_token_port,\n+\t\t(void *)&pcmd_intstr_token_opt,\n+\t\tNULL\n+\t},\n+};\n cmdline_parse_inst_t pcmd_pause_noopt = {\n \t.f = pcmd_pause_callback,\n \t.data = (void *)0x01,\n@@ -816,6 +879,7 @@ static void pcmd_vlan_callback(__rte_unused void *ptr_params,\n cmdline_parse_ctx_t list_prompt_commands[] = {\n \t(cmdline_parse_inst_t *)&pcmd_drvinfo,\n \t(cmdline_parse_inst_t *)&pcmd_eeprom,\n+\t(cmdline_parse_inst_t *)&pcmd_module_eeprom,\n \t(cmdline_parse_inst_t *)&pcmd_link,\n \t(cmdline_parse_inst_t *)&pcmd_macaddr_get,\n \t(cmdline_parse_inst_t *)&pcmd_macaddr,\ndiff --git a/examples/ethtool/lib/Makefile b/examples/ethtool/lib/Makefile\nindex fbafa6d..2576910 100644\n--- a/examples/ethtool/lib/Makefile\n+++ b/examples/ethtool/lib/Makefile\n@@ -25,6 +25,7 @@ SRCS-y := rte_ethtool.c\n \n CFLAGS += -O3\n CFLAGS += $(WERROR_FLAGS)\n+CFLAGS += -DALLOW_EXPERIMENTAL_API\n \n ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y)\n ifeq ($(CONFIG_RTE_LIBRTE_IXGBE_PMD),y)\ndiff --git a/examples/ethtool/lib/rte_ethtool.c b/examples/ethtool/lib/rte_ethtool.c\nindex d519a50..e6a2e88 100644\n--- a/examples/ethtool/lib/rte_ethtool.c\n+++ b/examples/ethtool/lib/rte_ethtool.c\n@@ -178,6 +178,36 @@\n }\n \n int\n+rte_ethtool_get_module_info(uint16_t port_id, uint32_t *modinfo)\n+{\n+\tstruct rte_eth_dev_module_info *info;\n+\n+\tinfo = (struct rte_eth_dev_module_info *)modinfo;\n+\treturn rte_eth_dev_get_module_info(port_id, info);\n+}\n+\n+int\n+rte_ethtool_get_module_eeprom(uint16_t port_id, struct ethtool_eeprom *eeprom,\n+\tvoid *words)\n+{\n+\tstruct rte_dev_eeprom_info eeprom_info;\n+\tint status;\n+\n+\tif (eeprom == NULL || words == NULL)\n+\t\treturn -EINVAL;\n+\n+\teeprom_info.offset = eeprom->offset;\n+\teeprom_info.length = eeprom->len;\n+\teeprom_info.data = words;\n+\n+\tstatus = rte_eth_dev_get_module_eeprom(port_id, &eeprom_info);\n+\tif (status)\n+\t\treturn status;\n+\n+\treturn 0;\n+}\n+\n+int\n rte_ethtool_get_pauseparam(uint16_t port_id,\n \tstruct ethtool_pauseparam *pause_param)\n {\ndiff --git a/examples/ethtool/lib/rte_ethtool.h b/examples/ethtool/lib/rte_ethtool.h\nindex c962396..43adc97 100644\n--- a/examples/ethtool/lib/rte_ethtool.h\n+++ b/examples/ethtool/lib/rte_ethtool.h\n@@ -154,6 +154,40 @@ int rte_ethtool_set_eeprom(uint16_t port_id, struct ethtool_eeprom *eeprom,\n \t\t\t      void *words);\n \n /**\n+ * Retrieve the type and size of plugin module EEPROM\n+ *\n+ * @param port_id\n+ *   The port identifier of the Ethernet device.\n+ * @param modinfo\n+ *\t The pointer that provides the type and size of plugin module EEPROM.\n+ * @return\n+ *   - (0) if successful.\n+ *   - (-ENOTSUP) if hardware doesn't support.\n+ *   - (-ENODEV) if *port_id* invalid.\n+ *   - others depends on the specific operations implementation.\n+ */\n+int rte_ethtool_get_module_info(uint16_t port_id, uint32_t *modinfo);\n+\n+/**\n+ * Retrieve the data of plugin module EEPROM\n+ *\n+ * @param port_id\n+ *   The port identifier of the Ethernet device.\n+ * @param eeprom\n+ *\t The pointer of ethtool_eeprom that provides plugin module eeprom\n+ *   offset and length\n+ * @param words\n+ *\t A buffer that holds data read from plugin module eeprom\n+ * @return\n+ *   - (0) if successful.\n+ *   - (-ENOTSUP) if hardware doesn't support.\n+ *   - (-ENODEV) if *port_id* invalid.\n+ *   - others depends on the specific operations implementation.\n+ */\n+int rte_ethtool_get_module_eeprom(uint16_t port_id,\n+\t\t\t\t  struct ethtool_eeprom *eeprom, void *words);\n+\n+/**\n  * Retrieve the Ethernet device pause frame configuration according to\n  * parameter attributes desribed by ethtool data structure,\n  * ethtool_pauseparam.\n",
    "prefixes": [
        "dpdk-dev",
        "v6",
        "2/5"
    ]
}