get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 10869,
    "url": "http://patches.dpdk.org/api/patches/10869/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1456495841-15749-2-git-send-email-ferruh.yigit@intel.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": "<1456495841-15749-2-git-send-email-ferruh.yigit@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1456495841-15749-2-git-send-email-ferruh.yigit@intel.com",
    "date": "2016-02-26T14:10:38",
    "name": "[dpdk-dev,v3,1/4] lib/librte_ethtool: move librte_ethtool form examples to lib folder",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "f4fc50ca733f3421641fd929185b3d489a2c0a07",
    "submitter": {
        "id": 324,
        "url": "http://patches.dpdk.org/api/people/324/?format=api",
        "name": "Ferruh Yigit",
        "email": "ferruh.yigit@intel.com"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/1456495841-15749-2-git-send-email-ferruh.yigit@intel.com/mbox/",
    "series": [],
    "comments": "http://patches.dpdk.org/api/patches/10869/comments/",
    "check": "pending",
    "checks": "http://patches.dpdk.org/api/patches/10869/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 [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id 0743447CE;\n\tFri, 26 Feb 2016 15:11:05 +0100 (CET)",
            "from mga03.intel.com (mga03.intel.com [134.134.136.65])\n\tby dpdk.org (Postfix) with ESMTP id 2D3D137B6\n\tfor <dev@dpdk.org>; Fri, 26 Feb 2016 15:11:03 +0100 (CET)",
            "from fmsmga001.fm.intel.com ([10.253.24.23])\n\tby orsmga103.jf.intel.com with ESMTP; 26 Feb 2016 06:11:02 -0800",
            "from irvmail001.ir.intel.com ([163.33.26.43])\n\tby fmsmga001.fm.intel.com with ESMTP; 26 Feb 2016 06:10:57 -0800",
            "from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com\n\t[10.237.217.45])\n\tby irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id\n\tu1QEAs33000553; Fri, 26 Feb 2016 14:10:54 GMT",
            "from sivswdev01.ir.intel.com (localhost [127.0.0.1])\n\tby sivswdev01.ir.intel.com with ESMTP id u1QEAsuJ015790;\n\tFri, 26 Feb 2016 14:10:54 GMT",
            "(from fyigit@localhost)\n\tby sivswdev01.ir.intel.com with  id u1QEAsM9015786;\n\tFri, 26 Feb 2016 14:10:54 GMT"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.22,498,1449561600\"; d=\"scan'208\";a=\"911864094\"",
        "From": "Ferruh Yigit <ferruh.yigit@intel.com>",
        "To": "dev@dpdk.org",
        "Date": "Fri, 26 Feb 2016 14:10:38 +0000",
        "Message-Id": "<1456495841-15749-2-git-send-email-ferruh.yigit@intel.com>",
        "X-Mailer": "git-send-email 1.7.4.1",
        "In-Reply-To": "<1456495841-15749-1-git-send-email-ferruh.yigit@intel.com>",
        "References": "<1455284735-9606-1-git-send-email-ferruh.yigit@intel.com>\n\t<1456495841-15749-1-git-send-email-ferruh.yigit@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v3 1/4] lib/librte_ethtool: move librte_ethtool\n\tform examples to lib folder",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "patches and discussions about DPDK <dev.dpdk.org>",
        "List-Unsubscribe": "<http://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": "<http://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": "With KCP, examples/ethtool/lib/ethtool has two users, to prevent code\ndublication, moving library from examples folder into lib/ folder.\n\nSigned-off-by: Ferruh Yigit <ferruh.yigit@intel.com>\n---\n config/common_linuxapp                     |   5 +\n doc/api/doxy-api-index.md                  |   3 +-\n doc/api/doxy-api.conf                      |   1 +\n doc/api/examples.dox                       |   5 +-\n doc/guides/prog_guide/ethtool_lib.rst      |  62 ++\n doc/guides/prog_guide/index.rst            |   3 +-\n doc/guides/rel_notes/release_16_04.rst     |   1 +\n doc/guides/sample_app_ug/ethtool.rst       |  36 +-\n examples/ethtool/Makefile                  |  24 +-\n examples/ethtool/ethapp.c                  | 873 +++++++++++++++++++++++++++++\n examples/ethtool/ethapp.h                  |  41 ++\n examples/ethtool/ethtool-app/Makefile      |  54 --\n examples/ethtool/ethtool-app/ethapp.c      | 873 -----------------------------\n examples/ethtool/ethtool-app/ethapp.h      |  41 --\n examples/ethtool/ethtool-app/main.c        | 305 ----------\n examples/ethtool/lib/Makefile              |  57 --\n examples/ethtool/lib/rte_ethtool.c         | 423 --------------\n examples/ethtool/lib/rte_ethtool.h         | 410 --------------\n examples/ethtool/main.c                    | 305 ++++++++++\n lib/Makefile                               |   1 +\n lib/librte_ethtool/Makefile                |  57 ++\n lib/librte_ethtool/rte_ethtool.c           | 423 ++++++++++++++\n lib/librte_ethtool/rte_ethtool.h           | 413 ++++++++++++++\n lib/librte_ethtool/rte_ethtool_version.map |  28 +\n mk/rte.app.mk                              |   1 +\n 25 files changed, 2236 insertions(+), 2209 deletions(-)\n create mode 100644 doc/guides/prog_guide/ethtool_lib.rst\n create mode 100644 examples/ethtool/ethapp.c\n create mode 100644 examples/ethtool/ethapp.h\n delete mode 100644 examples/ethtool/ethtool-app/Makefile\n delete mode 100644 examples/ethtool/ethtool-app/ethapp.c\n delete mode 100644 examples/ethtool/ethtool-app/ethapp.h\n delete mode 100644 examples/ethtool/ethtool-app/main.c\n delete mode 100644 examples/ethtool/lib/Makefile\n delete mode 100644 examples/ethtool/lib/rte_ethtool.c\n delete mode 100644 examples/ethtool/lib/rte_ethtool.h\n create mode 100644 examples/ethtool/main.c\n create mode 100644 lib/librte_ethtool/Makefile\n create mode 100644 lib/librte_ethtool/rte_ethtool.c\n create mode 100644 lib/librte_ethtool/rte_ethtool.h\n create mode 100644 lib/librte_ethtool/rte_ethtool_version.map",
    "diff": "diff --git a/config/common_linuxapp b/config/common_linuxapp\nindex f1638db..960dde4 100644\n--- a/config/common_linuxapp\n+++ b/config/common_linuxapp\n@@ -497,6 +497,11 @@ CONFIG_RTE_KNI_VHOST_DEBUG_RX=n\n CONFIG_RTE_KNI_VHOST_DEBUG_TX=n\n \n #\n+# Compile librte_ethtool\n+#\n+CONFIG_RTE_LIBRTE_ETHTOOL=y\n+\n+#\n # Compile vhost library\n # fuse-devel is needed to run vhost-cuse.\n # fuse-devel enables user space char driver development\ndiff --git a/doc/api/doxy-api-index.md b/doc/api/doxy-api-index.md\nindex 7a91001..4cdd3f5 100644\n--- a/doc/api/doxy-api-index.md\n+++ b/doc/api/doxy-api-index.md\n@@ -149,4 +149,5 @@ There are many libraries, so their headers may be grouped by topics:\n   [common]             (@ref rte_common.h),\n   [ABI compat]         (@ref rte_compat.h),\n   [keepalive]          (@ref rte_keepalive.h),\n-  [version]            (@ref rte_version.h)\n+  [version]            (@ref rte_version.h),\n+  [ethtool]            (@ref rte_ethtool.h),\ndiff --git a/doc/api/doxy-api.conf b/doc/api/doxy-api.conf\nindex 57e8b5d..c5b8615 100644\n--- a/doc/api/doxy-api.conf\n+++ b/doc/api/doxy-api.conf\n@@ -41,6 +41,7 @@ INPUT                   = doc/api/doxy-api-index.md \\\n                           lib/librte_cryptodev \\\n                           lib/librte_distributor \\\n                           lib/librte_ether \\\n+                          lib/librte_ethtool \\\n                           lib/librte_hash \\\n                           lib/librte_ip_frag \\\n                           lib/librte_ivshmem \\\ndiff --git a/doc/api/examples.dox b/doc/api/examples.dox\nindex 200af0b..8763d77 100644\n--- a/doc/api/examples.dox\n+++ b/doc/api/examples.dox\n@@ -8,9 +8,8 @@\n @example distributor/main.c\n @example dpdk_qat/crypto.c\n @example dpdk_qat/main.c\n-@example ethtool/ethtool-app/ethapp.c\n-@example ethtool/ethtool-app/main.c\n-@example ethtool/lib/rte_ethtool.c\n+@example ethtool/ethapp.c\n+@example ethtool/main.c\n @example exception_path/main.c\n @example helloworld/main.c\n @example ip_fragmentation/main.c\ndiff --git a/doc/guides/prog_guide/ethtool_lib.rst b/doc/guides/prog_guide/ethtool_lib.rst\nnew file mode 100644\nindex 0000000..e161cd0\n--- /dev/null\n+++ b/doc/guides/prog_guide/ethtool_lib.rst\n@@ -0,0 +1,62 @@\n+..  BSD LICENSE\n+    Copyright(c) 2016 Intel Corporation. All rights reserved.\n+    All rights reserved.\n+\n+    Redistribution and use in source and binary forms, with or without\n+    modification, are permitted provided that the following conditions\n+    are met:\n+\n+    * Redistributions of source code must retain the above copyright\n+    notice, this list of conditions and the following disclaimer.\n+    * Redistributions in binary form must reproduce the above copyright\n+    notice, this list of conditions and the following disclaimer in\n+    the documentation and/or other materials provided with the\n+    distribution.\n+    * Neither the name of Intel Corporation nor the names of its\n+    contributors may be used to endorse or promote products derived\n+    from this software without specific prior written permission.\n+\n+    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n+    \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n+    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n+    A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n+    OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n+    SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n+    LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n+    DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n+    THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n+    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n+    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+\n+.. _Ethtool_Library:\n+\n+Ethtool Library\n+===============\n+\n+Ethtool interface\n+-----------------\n+\n+The Ethtool interface is built as a separate library, and implements\n+the following functions:\n+\n+- ``rte_ethtool_get_drvinfo()``\n+- ``rte_ethtool_get_regs_len()``\n+- ``rte_ethtool_get_regs()``\n+- ``rte_ethtool_get_link()``\n+- ``rte_ethtool_get_eeprom_len()``\n+- ``rte_ethtool_get_eeprom()``\n+- ``rte_ethtool_set_eeprom()``\n+- ``rte_ethtool_get_pauseparam()``\n+- ``rte_ethtool_set_pauseparam()``\n+- ``rte_ethtool_net_open()``\n+- ``rte_ethtool_net_stop()``\n+- ``rte_ethtool_net_get_mac_addr()``\n+- ``rte_ethtool_net_set_mac_addr()``\n+- ``rte_ethtool_net_validate_addr()``\n+- ``rte_ethtool_net_change_mtu()``\n+- ``rte_ethtool_net_get_stats64()``\n+- ``rte_ethtool_net_vlan_rx_add_vid()``\n+- ``rte_ethtool_net_vlan_rx_kill_vid()``\n+- ``rte_ethtool_net_set_rx_mode()``\n+- ``rte_ethtool_get_ringparam()``\n+- ``rte_ethtool_set_ringparam()``\ndiff --git a/doc/guides/prog_guide/index.rst b/doc/guides/prog_guide/index.rst\nindex a9404fb..98f4aca 100644\n--- a/doc/guides/prog_guide/index.rst\n+++ b/doc/guides/prog_guide/index.rst\n@@ -1,5 +1,5 @@\n ..  BSD LICENSE\n-    Copyright(c) 2010-2014 Intel Corporation. All rights reserved.\n+    Copyright(c) 2010-2016 Intel Corporation. All rights reserved.\n     All rights reserved.\n \n     Redistribution and use in source and binary forms, with or without\n@@ -51,6 +51,7 @@ Programmer's Guide\n     packet_distrib_lib\n     reorder_lib\n     ip_fragment_reassembly_lib\n+    ethtool_lib\n     multi_proc_support\n     kernel_nic_interface\n     thread_safety_dpdk_functions\ndiff --git a/doc/guides/rel_notes/release_16_04.rst b/doc/guides/rel_notes/release_16_04.rst\nindex 8273817..70338f1 100644\n--- a/doc/guides/rel_notes/release_16_04.rst\n+++ b/doc/guides/rel_notes/release_16_04.rst\n@@ -129,6 +129,7 @@ The libraries prepended with a plus sign were incremented in this version.\n      librte_cmdline.so.1\n      librte_distributor.so.1\n      librte_eal.so.2\n+   + librte_ethtool.so.1\n      librte_hash.so.2\n      librte_ip_frag.so.1\n      librte_ivshmem.so.1\ndiff --git a/doc/guides/sample_app_ug/ethtool.rst b/doc/guides/sample_app_ug/ethtool.rst\nindex 4d1697e..65240ae 100644\n--- a/doc/guides/sample_app_ug/ethtool.rst\n+++ b/doc/guides/sample_app_ug/ethtool.rst\n@@ -1,6 +1,6 @@\n \n ..  BSD LICENSE\n-    Copyright(c) 2015 Intel Corporation. All rights reserved.\n+    Copyright(c) 2015-2016 Intel Corporation. All rights reserved.\n     All rights reserved.\n \n     Redistribution and use in source and binary forms, with or without\n@@ -71,7 +71,7 @@ The only available options are the standard ones for the EAL:\n \n .. code-block:: console\n \n-    ./ethtool-app/ethtool-app/${RTE_TARGET}/ethtool [EAL options]\n+    ./${RTE_TARGET}/ethtool [EAL options]\n \n Refer to the *DPDK Getting Started Guide* for general information on\n running applications and the Environment Abstraction Layer (EAL)\n@@ -128,33 +128,5 @@ Ethtool Shell\n The foreground part of the Ethtool sample is a console-based\n interface that accepts commands as described in `using the\n application`_. Individual call-back functions handle the detail\n-associated with each command, which make use of the functions\n-defined in the `Ethtool interface`_ to the DPDK functions.\n-\n-Ethtool interface\n------------------\n-\n-The Ethtool interface is built as a separate library, and implements\n-the following functions:\n-\n-- ``rte_ethtool_get_drvinfo()``\n-- ``rte_ethtool_get_regs_len()``\n-- ``rte_ethtool_get_regs()``\n-- ``rte_ethtool_get_link()``\n-- ``rte_ethtool_get_eeprom_len()``\n-- ``rte_ethtool_get_eeprom()``\n-- ``rte_ethtool_set_eeprom()``\n-- ``rte_ethtool_get_pauseparam()``\n-- ``rte_ethtool_set_pauseparam()``\n-- ``rte_ethtool_net_open()``\n-- ``rte_ethtool_net_stop()``\n-- ``rte_ethtool_net_get_mac_addr()``\n-- ``rte_ethtool_net_set_mac_addr()``\n-- ``rte_ethtool_net_validate_addr()``\n-- ``rte_ethtool_net_change_mtu()``\n-- ``rte_ethtool_net_get_stats64()``\n-- ``rte_ethtool_net_vlan_rx_add_vid()``\n-- ``rte_ethtool_net_vlan_rx_kill_vid()``\n-- ``rte_ethtool_net_set_rx_mode()``\n-- ``rte_ethtool_get_ringparam()``\n-- ``rte_ethtool_set_ringparam()``\n+associated with each command, which make use of librte_ethtool\n+library.\ndiff --git a/examples/ethtool/Makefile b/examples/ethtool/Makefile\nindex 995cd25..23a6ffd 100644\n--- a/examples/ethtool/Makefile\n+++ b/examples/ethtool/Makefile\n@@ -1,6 +1,6 @@\n #   BSD LICENSE\n #\n-#   Copyright(c) 2015 Intel Corporation. All rights reserved.\n+#   Copyright(c) 2010-2016 Intel Corporation. All rights reserved.\n #   All rights reserved.\n #\n #   Redistribution and use in source and binary forms, with or without\n@@ -33,17 +33,23 @@ ifeq ($(RTE_SDK),)\n $(error \"Please define RTE_SDK environment variable\")\n endif\n \n-# Default target, can be overwritten by command line or environment\n+# Default target, can be overridden by command line or environment\n RTE_TARGET ?= x86_64-native-linuxapp-gcc\n \n include $(RTE_SDK)/mk/rte.vars.mk\n \n-ifneq ($(CONFIG_RTE_EXEC_ENV),\"linuxapp\")\n-$(info This application can only operate in a linuxapp environment, \\\n-please change the definition of the RTE_TARGET environment variable)\n-else\n+# binary name\n+APP = ethtool\n+\n+# all source are stored in SRCS-y\n+SRCS-y := main.c ethapp.c\n+\n+#CFLAGS += -O3 -D_GNU_SOURCE -pthread -I$(SRCDIR)/../lib\n+CFLAGS += -O3\n+CFLAGS += $(WERROR_FLAGS)\n+\n+#LDLIBS += -L$(subst ethtool-app,lib,$(RTE_OUTPUT))/lib\n+#LDLIBS += -lrte_ethtool\n \n-DIRS-y += lib ethtool-app\n-endif\n \n-include $(RTE_SDK)/mk/rte.extsubdir.mk\n+include $(RTE_SDK)/mk/rte.extapp.mk\ndiff --git a/examples/ethtool/ethapp.c b/examples/ethtool/ethapp.c\nnew file mode 100644\nindex 0000000..fca602b\n--- /dev/null\n+++ b/examples/ethtool/ethapp.c\n@@ -0,0 +1,873 @@\n+/*-\n+ *   BSD LICENSE\n+ *\n+ *   Copyright(c) 2015-2016 Intel Corporation. All rights reserved.\n+ *   All rights reserved.\n+ *\n+ *   Redistribution and use in source and binary forms, with or without\n+ *   modification, are permitted provided that the following conditions\n+ *   are met:\n+ *\n+ *     * Redistributions of source code must retain the above copyright\n+ *       notice, this list of conditions and the following disclaimer.\n+ *     * Redistributions in binary form must reproduce the above copyright\n+ *       notice, this list of conditions and the following disclaimer in\n+ *       the documentation and/or other materials provided with the\n+ *       distribution.\n+ *     * Neither the name of Intel Corporation nor the names of its\n+ *       contributors may be used to endorse or promote products derived\n+ *       from this software without specific prior written permission.\n+ *\n+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n+ *   \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+ */\n+\n+#include <cmdline_parse.h>\n+#include <cmdline_parse_num.h>\n+#include <cmdline_parse_string.h>\n+#include <cmdline_parse_etheraddr.h>\n+#include <cmdline_socket.h>\n+#include <cmdline.h>\n+\n+#include \"rte_ethtool.h\"\n+#include \"ethapp.h\"\n+\n+#define EEPROM_DUMP_CHUNKSIZE 1024\n+\n+\n+struct pcmd_get_params {\n+\tcmdline_fixed_string_t cmd;\n+};\n+struct pcmd_int_params {\n+\tcmdline_fixed_string_t cmd;\n+\tuint16_t port;\n+};\n+struct pcmd_intstr_params {\n+\tcmdline_fixed_string_t cmd;\n+\tuint16_t port;\n+\tcmdline_fixed_string_t opt;\n+};\n+struct pcmd_intmac_params {\n+\tcmdline_fixed_string_t cmd;\n+\tuint16_t port;\n+\tstruct ether_addr mac;\n+};\n+struct pcmd_str_params {\n+\tcmdline_fixed_string_t cmd;\n+\tcmdline_fixed_string_t opt;\n+};\n+struct pcmd_vlan_params {\n+\tcmdline_fixed_string_t cmd;\n+\tuint16_t port;\n+\tcmdline_fixed_string_t mode;\n+\tuint16_t vid;\n+};\n+struct pcmd_intintint_params {\n+\tcmdline_fixed_string_t cmd;\n+\tuint16_t port;\n+\tuint16_t tx;\n+\tuint16_t rx;\n+};\n+\n+\n+/* Parameter-less commands */\n+cmdline_parse_token_string_t pcmd_quit_token_cmd =\n+\tTOKEN_STRING_INITIALIZER(struct pcmd_get_params, cmd, \"quit\");\n+cmdline_parse_token_string_t pcmd_stats_token_cmd =\n+\tTOKEN_STRING_INITIALIZER(struct pcmd_get_params, cmd, \"stats\");\n+cmdline_parse_token_string_t pcmd_drvinfo_token_cmd =\n+\tTOKEN_STRING_INITIALIZER(struct pcmd_get_params, cmd, \"drvinfo\");\n+cmdline_parse_token_string_t pcmd_link_token_cmd =\n+\tTOKEN_STRING_INITIALIZER(struct pcmd_get_params, cmd, \"link\");\n+\n+/* Commands taking just port id */\n+cmdline_parse_token_string_t pcmd_open_token_cmd =\n+\tTOKEN_STRING_INITIALIZER(struct pcmd_int_params, cmd, \"open\");\n+cmdline_parse_token_string_t pcmd_stop_token_cmd =\n+\tTOKEN_STRING_INITIALIZER(struct pcmd_int_params, cmd, \"stop\");\n+cmdline_parse_token_string_t pcmd_rxmode_token_cmd =\n+\tTOKEN_STRING_INITIALIZER(struct pcmd_int_params, cmd, \"rxmode\");\n+cmdline_parse_token_string_t pcmd_portstats_token_cmd =\n+\tTOKEN_STRING_INITIALIZER(struct pcmd_int_params, cmd, \"portstats\");\n+cmdline_parse_token_num_t pcmd_int_token_port =\n+\tTOKEN_NUM_INITIALIZER(struct pcmd_int_params, port, UINT16);\n+\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_mtu_token_cmd =\n+\tTOKEN_STRING_INITIALIZER(struct pcmd_intstr_params, cmd, \"mtu\");\n+cmdline_parse_token_string_t pcmd_regs_token_cmd =\n+\tTOKEN_STRING_INITIALIZER(struct pcmd_intstr_params, cmd, \"regs\");\n+\n+cmdline_parse_token_num_t pcmd_intstr_token_port =\n+\tTOKEN_NUM_INITIALIZER(struct pcmd_intstr_params, port, UINT16);\n+cmdline_parse_token_string_t pcmd_intstr_token_opt =\n+\tTOKEN_STRING_INITIALIZER(struct pcmd_intstr_params, opt, NULL);\n+\n+/* Commands taking port id and a MAC address string */\n+cmdline_parse_token_string_t pcmd_macaddr_token_cmd =\n+\tTOKEN_STRING_INITIALIZER(struct pcmd_intmac_params, cmd, \"macaddr\");\n+cmdline_parse_token_num_t pcmd_intmac_token_port =\n+\tTOKEN_NUM_INITIALIZER(struct pcmd_intmac_params, port, UINT16);\n+cmdline_parse_token_etheraddr_t pcmd_intmac_token_mac =\n+\tTOKEN_ETHERADDR_INITIALIZER(struct pcmd_intmac_params, mac);\n+\n+/* Command taking just a MAC address */\n+cmdline_parse_token_string_t pcmd_validate_token_cmd =\n+\tTOKEN_STRING_INITIALIZER(struct pcmd_intmac_params, cmd, \"validate\");\n+\n+\n+/* Commands taking port id and two integers */\n+cmdline_parse_token_string_t pcmd_ringparam_token_cmd =\n+\tTOKEN_STRING_INITIALIZER(struct pcmd_intintint_params, cmd,\n+\t\t\"ringparam\");\n+cmdline_parse_token_num_t pcmd_intintint_token_port =\n+\tTOKEN_NUM_INITIALIZER(struct pcmd_intintint_params, port, UINT16);\n+cmdline_parse_token_num_t pcmd_intintint_token_tx =\n+\tTOKEN_NUM_INITIALIZER(struct pcmd_intintint_params, tx, UINT16);\n+cmdline_parse_token_num_t pcmd_intintint_token_rx =\n+\tTOKEN_NUM_INITIALIZER(struct pcmd_intintint_params, rx, UINT16);\n+\n+\n+/* Pause commands */\n+cmdline_parse_token_string_t pcmd_pause_token_cmd =\n+\tTOKEN_STRING_INITIALIZER(struct pcmd_intstr_params, cmd, \"pause\");\n+cmdline_parse_token_num_t pcmd_pause_token_port =\n+\tTOKEN_NUM_INITIALIZER(struct pcmd_intstr_params, port, UINT16);\n+cmdline_parse_token_string_t pcmd_pause_token_opt =\n+\tTOKEN_STRING_INITIALIZER(struct pcmd_intstr_params,\n+\t\topt, \"all#tx#rx#none\");\n+\n+/* VLAN commands */\n+cmdline_parse_token_string_t pcmd_vlan_token_cmd =\n+\tTOKEN_STRING_INITIALIZER(struct pcmd_vlan_params, cmd, \"vlan\");\n+cmdline_parse_token_num_t pcmd_vlan_token_port =\n+\tTOKEN_NUM_INITIALIZER(struct pcmd_vlan_params, port, UINT16);\n+cmdline_parse_token_string_t pcmd_vlan_token_mode =\n+\tTOKEN_STRING_INITIALIZER(struct pcmd_vlan_params, mode, \"add#del\");\n+cmdline_parse_token_num_t pcmd_vlan_token_vid =\n+\tTOKEN_NUM_INITIALIZER(struct pcmd_vlan_params, vid, UINT16);\n+\n+\n+static void\n+pcmd_quit_callback(__rte_unused void *ptr_params,\n+\tstruct cmdline *ctx,\n+\t__rte_unused void *ptr_data)\n+{\n+\tcmdline_quit(ctx);\n+}\n+\n+\n+static void\n+pcmd_drvinfo_callback(__rte_unused void *ptr_params,\n+\t__rte_unused struct cmdline *ctx,\n+\t__rte_unused void *ptr_data)\n+{\n+\tstruct ethtool_drvinfo info;\n+\tint id_port;\n+\n+\tfor (id_port = 0; id_port < rte_eth_dev_count(); id_port++) {\n+\t\tif (rte_ethtool_get_drvinfo(id_port, &info)) {\n+\t\t\tprintf(\"Error getting info for port %i\\n\", id_port);\n+\t\t\treturn;\n+\t\t}\n+\t\tprintf(\"Port %i driver: %s (ver: %s)\\n\",\n+\t\t\tid_port, info.driver, info.version\n+\t\t      );\n+\t}\n+}\n+\n+\n+static void\n+pcmd_link_callback(__rte_unused void *ptr_params,\n+\t__rte_unused struct cmdline *ctx,\n+\t__rte_unused void *ptr_data)\n+{\n+\tint num_ports = rte_eth_dev_count();\n+\tint id_port, stat_port;\n+\n+\tfor (id_port = 0; id_port < num_ports; id_port++) {\n+\t\tif (!rte_eth_dev_is_valid_port(id_port))\n+\t\t\tcontinue;\n+\t\tstat_port = rte_ethtool_get_link(id_port);\n+\t\tswitch (stat_port) {\n+\t\tcase 0:\n+\t\t\tprintf(\"Port %i: Down\\n\", id_port);\n+\t\t\tbreak;\n+\t\tcase 1:\n+\t\t\tprintf(\"Port %i: Up\\n\", id_port);\n+\t\t\tbreak;\n+\t\tdefault:\n+\t\t\tprintf(\"Port %i: Error getting link status\\n\",\n+\t\t\t\tid_port\n+\t\t\t\t);\n+\t\t\tbreak;\n+\t\t}\n+\t}\n+\tprintf(\"\\n\");\n+}\n+\n+\n+static void\n+pcmd_regs_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+\tint len_regs;\n+\tstruct ethtool_regs regs;\n+\tunsigned char *buf_data;\n+\tFILE *fp_regs;\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+\tlen_regs = rte_ethtool_get_regs_len(params->port);\n+\tif (len_regs > 0) {\n+\t\tprintf(\"Port %i: %i bytes\\n\", params->port, len_regs);\n+\t\tbuf_data = malloc(len_regs);\n+\t\tif (buf_data == NULL) {\n+\t\t\tprintf(\"Error allocating %i bytes for buffer\\n\",\n+\t\t\t\tlen_regs);\n+\t\t\treturn;\n+\t\t}\n+\t\tif (!rte_ethtool_get_regs(params->port, &regs, buf_data)) {\n+\t\t\tfp_regs = fopen(params->opt, \"wb\");\n+\t\t\tif (fp_regs == NULL) {\n+\t\t\t\tprintf(\"Error opening '%s' for writing\\n\",\n+\t\t\t\t\tparams->opt);\n+\t\t\t} else {\n+\t\t\t\tif ((int)fwrite(buf_data,\n+\t\t\t\t\t\t1, len_regs,\n+\t\t\t\t\t\tfp_regs) != len_regs)\n+\t\t\t\t\tprintf(\"Error writing '%s'\\n\",\n+\t\t\t\t\t\tparams->opt);\n+\t\t\t\tfclose(fp_regs);\n+\t\t\t}\n+\t\t}\n+\t\tfree(buf_data);\n+\t} else if (len_regs == -ENOTSUP)\n+\t\tprintf(\"Port %i: Operation not supported\\n\", params->port);\n+\telse\n+\t\tprintf(\"Port %i: Error getting registers\\n\", params->port);\n+}\n+\n+\n+static void\n+pcmd_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+\tint len_eeprom;\n+\tint pos_eeprom;\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+\tlen_eeprom = rte_ethtool_get_eeprom_len(params->port);\n+\tif (len_eeprom > 0) {\n+\t\tfp_eeprom = fopen(params->opt, \"wb\");\n+\t\tif (fp_eeprom == NULL) {\n+\t\t\tprintf(\"Error opening '%s' for writing\\n\",\n+\t\t\t\tparams->opt);\n+\t\t\treturn;\n+\t\t}\n+\t\tprintf(\"Total EEPROM length: %i bytes\\n\", len_eeprom);\n+\t\tinfo_eeprom.len = EEPROM_DUMP_CHUNKSIZE;\n+\t\tfor (pos_eeprom = 0;\n+\t\t\t\tpos_eeprom < len_eeprom;\n+\t\t\t\tpos_eeprom += EEPROM_DUMP_CHUNKSIZE) {\n+\t\t\tinfo_eeprom.offset = pos_eeprom;\n+\t\t\tif (pos_eeprom + EEPROM_DUMP_CHUNKSIZE > len_eeprom)\n+\t\t\t\tinfo_eeprom.len = len_eeprom - pos_eeprom;\n+\t\t\telse\n+\t\t\t\tinfo_eeprom.len = EEPROM_DUMP_CHUNKSIZE;\n+\t\t\tstat = rte_ethtool_get_eeprom(\n+\t\t\t\tparams->port, &info_eeprom, bytes_eeprom\n+\t\t\t\t);\n+\t\t\tif (stat != 0) {\n+\t\t\t\tprintf(\"EEPROM read error %i\\n\", stat);\n+\t\t\t\tbreak;\n+\t\t\t}\n+\t\t\tif (fwrite(bytes_eeprom,\n+\t\t\t\t\t1, info_eeprom.len,\n+\t\t\t\t\tfp_eeprom) != info_eeprom.len) {\n+\t\t\t\tprintf(\"Error writing '%s'\\n\", params->opt);\n+\t\t\t\tbreak;\n+\t\t\t}\n+\t\t}\n+\t\tfclose(fp_eeprom);\n+\t} else if (len_eeprom == 0)\n+\t\tprintf(\"Port %i: Device does not have EEPROM\\n\", params->port);\n+\telse if (len_eeprom == -ENOTSUP)\n+\t\tprintf(\"Port %i: Operation not supported\\n\", params->port);\n+\telse\n+\t\tprintf(\"Port %i: Error getting EEPROM\\n\", params->port);\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+{\n+\tstruct pcmd_intstr_params *params = ptr_params;\n+\tstruct ethtool_pauseparam info;\n+\tint stat;\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+\tif (ptr_data != NULL) {\n+\t\tstat = rte_ethtool_get_pauseparam(params->port, &info);\n+\t} else {\n+\t\tmemset(&info, 0, sizeof(info));\n+\t\tif (strcasecmp(\"all\", params->opt) == 0) {\n+\t\t\tinfo.tx_pause = 1;\n+\t\t\tinfo.rx_pause = 1;\n+\t\t} else if (strcasecmp(\"tx\", params->opt) == 0) {\n+\t\t\tinfo.tx_pause = 1;\n+\t\t\tinfo.rx_pause = 0;\n+\t\t} else if (strcasecmp(\"rx\", params->opt) == 0) {\n+\t\t\tinfo.tx_pause = 0;\n+\t\t\tinfo.rx_pause = 1;\n+\t\t} else {\n+\t\t\tinfo.tx_pause = 0;\n+\t\t\tinfo.rx_pause = 0;\n+\t\t}\n+\t\t/* Assume auto-negotiation wanted */\n+\t\tinfo.autoneg = 1;\n+\t\tstat = rte_ethtool_set_pauseparam(params->port, &info);\n+\t}\n+\tif (stat == 0) {\n+\t\tif (info.rx_pause && info.tx_pause)\n+\t\t\tprintf(\"Port %i: Tx & Rx Paused\\n\", params->port);\n+\t\telse if (info.rx_pause)\n+\t\t\tprintf(\"Port %i: Rx Paused\\n\", params->port);\n+\t\telse if (info.tx_pause)\n+\t\t\tprintf(\"Port %i: Tx Paused\\n\", params->port);\n+\t\telse\n+\t\t\tprintf(\"Port %i: Tx & Rx not paused\\n\", params->port);\n+\t} else if (stat == -ENOTSUP)\n+\t\tprintf(\"Port %i: Operation not supported\\n\", params->port);\n+\telse\n+\t\tprintf(\"Port %i: Error %i\\n\", params->port, stat);\n+}\n+\n+\n+static void\n+pcmd_open_callback(__rte_unused void *ptr_params,\n+\t__rte_unused struct cmdline *ctx,\n+\t__rte_unused void *ptr_data)\n+{\n+\tstruct pcmd_int_params *params = ptr_params;\n+\tint stat;\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+\tlock_port(params->port);\n+\tstat = rte_ethtool_net_open(params->port);\n+\tmark_port_active(params->port);\n+\tunlock_port(params->port);\n+\tif (stat == 0)\n+\t\treturn;\n+\telse if (stat == -ENOTSUP)\n+\t\tprintf(\"Port %i: Operation not supported\\n\", params->port);\n+\telse\n+\t\tprintf(\"Port %i: Error opening device\\n\", params->port);\n+}\n+\n+static void\n+pcmd_stop_callback(__rte_unused void *ptr_params,\n+\t__rte_unused struct cmdline *ctx,\n+\t__rte_unused void *ptr_data)\n+{\n+\tstruct pcmd_int_params *params = ptr_params;\n+\tint stat;\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+\tlock_port(params->port);\n+\tstat = rte_ethtool_net_stop(params->port);\n+\tmark_port_inactive(params->port);\n+\tunlock_port(params->port);\n+\tif (stat == 0)\n+\t\treturn;\n+\telse if (stat == -ENOTSUP)\n+\t\tprintf(\"Port %i: Operation not supported\\n\", params->port);\n+\telse\n+\t\tprintf(\"Port %i: Error stopping device\\n\", params->port);\n+}\n+\n+\n+static void\n+pcmd_rxmode_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+\tint stat;\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+\tstat = rte_ethtool_net_set_rx_mode(params->port);\n+\tif (stat == 0)\n+\t\treturn;\n+\telse if (stat == -ENOTSUP)\n+\t\tprintf(\"Port %i: Operation not supported\\n\", params->port);\n+\telse\n+\t\tprintf(\"Port %i: Error setting rx mode\\n\", params->port);\n+}\n+\n+\n+static void\n+pcmd_macaddr_callback(void *ptr_params,\n+\t__rte_unused struct cmdline *ctx,\n+\tvoid *ptr_data)\n+{\n+\tstruct pcmd_intmac_params *params = ptr_params;\n+\tstruct ether_addr mac_addr;\n+\tint stat;\n+\n+\tstat = 0;\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+\tif (ptr_data != NULL) {\n+\t\tlock_port(params->port);\n+\t\tstat = rte_ethtool_net_set_mac_addr(params->port,\n+\t\t\t&params->mac);\n+\t\tmark_port_newmac(params->port);\n+\t\tunlock_port(params->port);\n+\t\tif (stat == 0) {\n+\t\t\tprintf(\"MAC address changed\\n\");\n+\t\t\treturn;\n+\t\t}\n+\t} else {\n+\t\tstat = rte_ethtool_net_get_mac_addr(params->port, &mac_addr);\n+\t\tif (stat == 0) {\n+\t\t\tprintf(\n+\t\t\t\t\"Port %i MAC Address: %02x:%02x:%02x:%02x:%02x:%02x\\n\",\n+\t\t\t\tparams->port,\n+\t\t\t\tmac_addr.addr_bytes[0],\n+\t\t\t\tmac_addr.addr_bytes[1],\n+\t\t\t\tmac_addr.addr_bytes[2],\n+\t\t\t\tmac_addr.addr_bytes[3],\n+\t\t\t\tmac_addr.addr_bytes[4],\n+\t\t\t\tmac_addr.addr_bytes[5]);\n+\t\t\treturn;\n+\t\t}\n+\t}\n+\n+\tprintf(\"Port %i: Error %s\\n\", params->port,\n+\t       strerror(-stat));\n+}\n+\n+static void\n+pcmd_mtu_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+\tint stat;\n+\tint new_mtu;\n+\tchar *ptr_parse_end;\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+\tnew_mtu = atoi(params->opt);\n+\tnew_mtu = strtoul(params->opt, &ptr_parse_end, 10);\n+\tif (*ptr_parse_end != '\\0' ||\n+\t\t\tnew_mtu < ETHER_MIN_MTU ||\n+\t\t\tnew_mtu > ETHER_MAX_JUMBO_FRAME_LEN) {\n+\t\tprintf(\"Port %i: Invalid MTU value\\n\", params->port);\n+\t\treturn;\n+\t}\n+\tstat = rte_ethtool_net_change_mtu(params->port, new_mtu);\n+\tif (stat == 0)\n+\t\tprintf(\"Port %i: MTU set to %i\\n\", params->port, new_mtu);\n+\telse if (stat == -ENOTSUP)\n+\t\tprintf(\"Port %i: Operation not supported\\n\", params->port);\n+\telse\n+\t\tprintf(\"Port %i: Error setting MTU\\n\", params->port);\n+}\n+\n+\n+\n+static void pcmd_portstats_callback(__rte_unused void *ptr_params,\n+\t__rte_unused struct cmdline *ctx,\n+\t__rte_unused void *ptr_data)\n+{\n+\tstruct pcmd_int_params *params = ptr_params;\n+\tstruct rte_eth_stats stat_info;\n+\tint stat;\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+\tstat = rte_ethtool_net_get_stats64(params->port, &stat_info);\n+\tif (stat == 0) {\n+\t\t/* Most of rte_eth_stats is deprecated.. */\n+\t\tprintf(\"Port %i stats\\n\", params->port);\n+\t\tprintf(\"   In: %\" PRIu64 \" (%\" PRIu64 \" bytes)\\n\"\n+\t\t\t\"  Out: %\"PRIu64\" (%\"PRIu64 \" bytes)\\n\"\n+\t\t\t\"  Err: %\"PRIu64\"\\n\",\n+\t\t\tstat_info.ipackets,\n+\t\t\tstat_info.ibytes,\n+\t\t\tstat_info.opackets,\n+\t\t\tstat_info.obytes,\n+\t\t\tstat_info.ierrors+stat_info.oerrors\n+\t\t      );\n+\t} else if (stat == -ENOTSUP)\n+\t\tprintf(\"Port %i: Operation not supported\\n\", params->port);\n+\telse\n+\t\tprintf(\"Port %i: Error fetching statistics\\n\", params->port);\n+}\n+\n+static void pcmd_ringparam_callback(__rte_unused void *ptr_params,\n+\t__rte_unused struct cmdline *ctx,\n+\tvoid *ptr_data)\n+{\n+\tstruct pcmd_intintint_params *params = ptr_params;\n+\tstruct ethtool_ringparam ring_data;\n+\tstruct ethtool_ringparam ring_params;\n+\tint stat;\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+\tif (ptr_data == NULL) {\n+\t\tstat = rte_ethtool_get_ringparam(params->port, &ring_data);\n+\t\tif (stat == 0) {\n+\t\t\tprintf(\"Port %i ring parameters\\n\"\n+\t\t\t\t\"  Rx Pending: %i (%i max)\\n\"\n+\t\t\t\t\"  Tx Pending: %i (%i max)\\n\",\n+\t\t\t\tparams->port,\n+\t\t\t\tring_data.rx_pending,\n+\t\t\t\tring_data.rx_max_pending,\n+\t\t\t\tring_data.tx_pending,\n+\t\t\t\tring_data.tx_max_pending);\n+\t\t}\n+\t} else {\n+\t\tif (params->tx < 1 || params->rx < 1) {\n+\t\t\tprintf(\"Error: Invalid parameters\\n\");\n+\t\t\treturn;\n+\t\t}\n+\t\tmemset(&ring_params, 0, sizeof(struct ethtool_ringparam));\n+\t\tring_params.tx_pending = params->tx;\n+\t\tring_params.rx_pending = params->rx;\n+\t\tlock_port(params->port);\n+\t\tstat = rte_ethtool_set_ringparam(params->port, &ring_params);\n+\t\tunlock_port(params->port);\n+\t}\n+\tif (stat == 0)\n+\t\treturn;\n+\telse if (stat == -ENOTSUP)\n+\t\tprintf(\"Port %i: Operation not supported\\n\", params->port);\n+\telse\n+\t\tprintf(\"Port %i: Error fetching statistics\\n\", params->port);\n+}\n+\n+static void pcmd_validate_callback(void *ptr_params,\n+\t__rte_unused struct cmdline *ctx,\n+\t__rte_unused void *ptr_data)\n+{\n+\tstruct pcmd_intmac_params *params = ptr_params;\n+\n+\tif (rte_ethtool_net_validate_addr(0, &params->mac))\n+\t\tprintf(\"Address is unicast\\n\");\n+\telse\n+\t\tprintf(\"Address is not unicast\\n\");\n+}\n+\n+\n+static void pcmd_vlan_callback(__rte_unused void *ptr_params,\n+\t__rte_unused struct cmdline *ctx,\n+\t__rte_unused void *ptr_data)\n+{\n+\tstruct pcmd_vlan_params *params = ptr_params;\n+\tint stat;\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+\tstat = 0;\n+\n+\tif (strcasecmp(\"add\", params->mode) == 0) {\n+\t\tstat = rte_ethtool_net_vlan_rx_add_vid(\n+\t\t\tparams->port, params->vid\n+\t\t\t);\n+\t\tif (stat == 0)\n+\t\t\tprintf(\"VLAN vid %i added\\n\", params->vid);\n+\n+\t} else if (strcasecmp(\"del\", params->mode) == 0) {\n+\t\tstat = rte_ethtool_net_vlan_rx_kill_vid(\n+\t\t\tparams->port, params->vid\n+\t\t\t);\n+\t\tif (stat == 0)\n+\t\t\tprintf(\"VLAN vid %i removed\\n\", params->vid);\n+\t} else {\n+\t\t/* Should not happen! */\n+\t\tprintf(\"Error: Bad mode %s\\n\", params->mode);\n+\t}\n+\tif (stat == -ENOTSUP)\n+\t\tprintf(\"Port %i: Operation not supported\\n\", params->port);\n+\telse if (stat == -ENOSYS)\n+\t\tprintf(\"Port %i: VLAN filtering disabled\\n\", params->port);\n+\telse if (stat != 0)\n+\t\tprintf(\"Port %i: Error changing VLAN setup (code %i)\\n\",\n+\t\t\tparams->port, -stat);\n+}\n+\n+\n+cmdline_parse_inst_t pcmd_quit = {\n+\t.f = pcmd_quit_callback,\n+\t.data = NULL,\n+\t.help_str = \"quit\\n     Exit program\",\n+\t.tokens = {(void *)&pcmd_quit_token_cmd, NULL},\n+};\n+cmdline_parse_inst_t pcmd_drvinfo = {\n+\t.f = pcmd_drvinfo_callback,\n+\t.data = NULL,\n+\t.help_str = \"drvinfo\\n     Print driver info\",\n+\t.tokens = {(void *)&pcmd_drvinfo_token_cmd, NULL},\n+};\n+cmdline_parse_inst_t pcmd_link = {\n+\t.f = pcmd_link_callback,\n+\t.data = NULL,\n+\t.help_str = \"link\\n     Print port link states\",\n+\t.tokens = {(void *)&pcmd_link_token_cmd, NULL},\n+};\n+cmdline_parse_inst_t pcmd_regs = {\n+\t.f = pcmd_regs_callback,\n+\t.data = NULL,\n+\t.help_str = \"regs <port_id> <filename>\\n\"\n+\t\t\"     Dump port register(s) to file\",\n+\t.tokens = {\n+\t\t(void *)&pcmd_regs_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_eeprom = {\n+\t.f = pcmd_eeprom_callback,\n+\t.data = NULL,\n+\t.help_str = \"eeprom <port_id> <filename>\\n    Dump EEPROM to file\",\n+\t.tokens = {\n+\t\t(void *)&pcmd_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+\t.help_str = \"pause <port_id>\\n     Print port pause state\",\n+\t.tokens = {\n+\t\t(void *)&pcmd_pause_token_cmd,\n+\t\t(void *)&pcmd_pause_token_port,\n+\t\tNULL\n+\t},\n+};\n+cmdline_parse_inst_t pcmd_pause = {\n+\t.f = pcmd_pause_callback,\n+\t.data = NULL,\n+\t.help_str =\n+\t\t\"pause <port_id> <all|tx|rx|none>\\n     Pause/unpause port\",\n+\t.tokens = {\n+\t\t(void *)&pcmd_pause_token_cmd,\n+\t\t(void *)&pcmd_pause_token_port,\n+\t\t(void *)&pcmd_pause_token_opt,\n+\t\tNULL\n+\t},\n+};\n+cmdline_parse_inst_t pcmd_open = {\n+\t.f = pcmd_open_callback,\n+\t.data = NULL,\n+\t.help_str = \"open <port_id>\\n     Open port\",\n+\t.tokens = {\n+\t\t(void *)&pcmd_open_token_cmd,\n+\t\t(void *)&pcmd_int_token_port,\n+\t\tNULL\n+\t},\n+};\n+cmdline_parse_inst_t pcmd_stop = {\n+\t.f = pcmd_stop_callback,\n+\t.data = NULL,\n+\t.help_str = \"stop <port_id>\\n     Stop port\",\n+\t.tokens = {\n+\t\t(void *)&pcmd_stop_token_cmd,\n+\t\t(void *)&pcmd_int_token_port,\n+\t\tNULL\n+\t},\n+};\n+cmdline_parse_inst_t pcmd_rxmode = {\n+\t.f = pcmd_rxmode_callback,\n+\t.data = NULL,\n+\t.help_str = \"rxmode <port_id>\\n     Toggle port Rx mode\",\n+\t.tokens = {\n+\t\t(void *)&pcmd_rxmode_token_cmd,\n+\t\t(void *)&pcmd_int_token_port,\n+\t\tNULL\n+\t},\n+};\n+cmdline_parse_inst_t pcmd_macaddr_get = {\n+\t.f = pcmd_macaddr_callback,\n+\t.data = NULL,\n+\t.help_str = \"macaddr <port_id>\\n\"\n+\t\t\"     Get MAC address\",\n+\t.tokens = {\n+\t\t(void *)&pcmd_macaddr_token_cmd,\n+\t\t(void *)&pcmd_intstr_token_port,\n+\t\tNULL\n+\t},\n+};\n+cmdline_parse_inst_t pcmd_macaddr = {\n+\t.f = pcmd_macaddr_callback,\n+\t.data = (void *)0x01,\n+\t.help_str =\n+\t\t\"macaddr <port_id> <mac_addr>\\n\"\n+\t\t\"     Set MAC address\",\n+\t.tokens = {\n+\t\t(void *)&pcmd_macaddr_token_cmd,\n+\t\t(void *)&pcmd_intmac_token_port,\n+\t\t(void *)&pcmd_intmac_token_mac,\n+\t\tNULL\n+\t},\n+};\n+cmdline_parse_inst_t pcmd_mtu = {\n+\t.f = pcmd_mtu_callback,\n+\t.data = NULL,\n+\t.help_str = \"mtu <port_id> <mtu_value>\\n\"\n+\t\t\"     Change MTU\",\n+\t.tokens = {\n+\t\t(void *)&pcmd_mtu_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_portstats = {\n+\t.f = pcmd_portstats_callback,\n+\t.data = NULL,\n+\t.help_str = \"portstats <port_id>\\n\"\n+\t\t\"     Print port eth statistics\",\n+\t.tokens = {\n+\t\t(void *)&pcmd_portstats_token_cmd,\n+\t\t(void *)&pcmd_int_token_port,\n+\t\tNULL\n+\t},\n+};\n+cmdline_parse_inst_t pcmd_ringparam = {\n+\t.f = pcmd_ringparam_callback,\n+\t.data = NULL,\n+\t.help_str = \"ringparam <port_id>\\n\"\n+\t\t\"     Print ring parameters\",\n+\t.tokens = {\n+\t\t(void *)&pcmd_ringparam_token_cmd,\n+\t\t(void *)&pcmd_intintint_token_port,\n+\t\tNULL\n+\t},\n+};\n+cmdline_parse_inst_t pcmd_ringparam_set = {\n+\t.f = pcmd_ringparam_callback,\n+\t.data = (void *)1,\n+\t.help_str = \"ringparam <port_id> <tx_param> <rx_param>\\n\"\n+\t\t\"     Set ring parameters\",\n+\t.tokens = {\n+\t\t(void *)&pcmd_ringparam_token_cmd,\n+\t\t(void *)&pcmd_intintint_token_port,\n+\t\t(void *)&pcmd_intintint_token_tx,\n+\t\t(void *)&pcmd_intintint_token_rx,\n+\t\tNULL\n+\t},\n+};\n+cmdline_parse_inst_t pcmd_validate = {\n+\t.f = pcmd_validate_callback,\n+\t.data = NULL,\n+\t.help_str = \"validate <mac_addr>\\n\"\n+\t\t\"     Check that MAC address is valid unicast address\",\n+\t.tokens = {\n+\t\t(void *)&pcmd_validate_token_cmd,\n+\t\t(void *)&pcmd_intmac_token_mac,\n+\t\tNULL\n+\t},\n+};\n+cmdline_parse_inst_t pcmd_vlan = {\n+\t.f = pcmd_vlan_callback,\n+\t.data = NULL,\n+\t.help_str = \"vlan <port_id> <add|del> <vlan_id>\\n\"\n+\t\t\"     Add/remove VLAN id\",\n+\t.tokens = {\n+\t\t(void *)&pcmd_vlan_token_cmd,\n+\t\t(void *)&pcmd_vlan_token_port,\n+\t\t(void *)&pcmd_vlan_token_mode,\n+\t\t(void *)&pcmd_vlan_token_vid,\n+\t\tNULL\n+\t},\n+};\n+\n+\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_link,\n+\t(cmdline_parse_inst_t *)&pcmd_macaddr_get,\n+\t(cmdline_parse_inst_t *)&pcmd_macaddr,\n+\t(cmdline_parse_inst_t *)&pcmd_mtu,\n+\t(cmdline_parse_inst_t *)&pcmd_open,\n+\t(cmdline_parse_inst_t *)&pcmd_pause_noopt,\n+\t(cmdline_parse_inst_t *)&pcmd_pause,\n+\t(cmdline_parse_inst_t *)&pcmd_portstats,\n+\t(cmdline_parse_inst_t *)&pcmd_regs,\n+\t(cmdline_parse_inst_t *)&pcmd_ringparam,\n+\t(cmdline_parse_inst_t *)&pcmd_ringparam_set,\n+\t(cmdline_parse_inst_t *)&pcmd_rxmode,\n+\t(cmdline_parse_inst_t *)&pcmd_stop,\n+\t(cmdline_parse_inst_t *)&pcmd_validate,\n+\t(cmdline_parse_inst_t *)&pcmd_vlan,\n+\t(cmdline_parse_inst_t *)&pcmd_quit,\n+\tNULL\n+};\n+\n+\n+void ethapp_main(void)\n+{\n+\tstruct cmdline *ctx_cmdline;\n+\n+\tctx_cmdline = cmdline_stdin_new(list_prompt_commands, \"EthApp> \");\n+\tcmdline_interact(ctx_cmdline);\n+\tcmdline_stdin_exit(ctx_cmdline);\n+}\ndiff --git a/examples/ethtool/ethapp.h b/examples/ethtool/ethapp.h\nnew file mode 100644\nindex 0000000..bd48c7c\n--- /dev/null\n+++ b/examples/ethtool/ethapp.h\n@@ -0,0 +1,41 @@\n+/*-\n+ *   BSD LICENSE\n+ *\n+ *   Copyright(c) 2015-2016 Intel Corporation. All rights reserved.\n+ *   All rights reserved.\n+ *\n+ *   Redistribution and use in source and binary forms, with or without\n+ *   modification, are permitted provided that the following conditions\n+ *   are met:\n+ *\n+ *     * Redistributions of source code must retain the above copyright\n+ *       notice, this list of conditions and the following disclaimer.\n+ *     * Redistributions in binary form must reproduce the above copyright\n+ *       notice, this list of conditions and the following disclaimer in\n+ *       the documentation and/or other materials provided with the\n+ *       distribution.\n+ *     * Neither the name of Intel Corporation nor the names of its\n+ *       contributors may be used to endorse or promote products derived\n+ *       from this software without specific prior written permission.\n+ *\n+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n+ *   \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+ */\n+\n+\n+void ethapp_main(void);\n+void print_stats(void);\n+void lock_port(int idx_port);\n+void unlock_port(int idx_port);\n+void mark_port_inactive(int idx_port);\n+void mark_port_active(int idx_port);\n+void mark_port_newmac(int idx_port);\ndiff --git a/examples/ethtool/ethtool-app/Makefile b/examples/ethtool/ethtool-app/Makefile\ndeleted file mode 100644\nindex 09c66ad..0000000\n--- a/examples/ethtool/ethtool-app/Makefile\n+++ /dev/null\n@@ -1,54 +0,0 @@\n-#   BSD LICENSE\n-#\n-#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.\n-#   All rights reserved.\n-#\n-#   Redistribution and use in source and binary forms, with or without\n-#   modification, are permitted provided that the following conditions\n-#   are met:\n-#\n-#     * Redistributions of source code must retain the above copyright\n-#       notice, this list of conditions and the following disclaimer.\n-#     * Redistributions in binary form must reproduce the above copyright\n-#       notice, this list of conditions and the following disclaimer in\n-#       the documentation and/or other materials provided with the\n-#       distribution.\n-#     * Neither the name of Intel Corporation nor the names of its\n-#       contributors may be used to endorse or promote products derived\n-#       from this software without specific prior written permission.\n-#\n-#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n-#   \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n-#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n-#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n-#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n-#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n-#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n-#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n-#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n-#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n-#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n-\n-ifeq ($(RTE_SDK),)\n-$(error \"Please define RTE_SDK environment variable\")\n-endif\n-\n-# Default target, can be overridden by command line or environment\n-RTE_TARGET ?= x86_64-native-linuxapp-gcc\n-\n-include $(RTE_SDK)/mk/rte.vars.mk\n-\n-# binary name\n-APP = ethtool\n-\n-# all source are stored in SRCS-y\n-SRCS-y := main.c ethapp.c\n-\n-CFLAGS += -O3 -D_GNU_SOURCE -pthread -I$(SRCDIR)/../lib\n-CFLAGS += $(WERROR_FLAGS)\n-\n-LDLIBS += -L$(subst ethtool-app,lib,$(RTE_OUTPUT))/lib\n-LDLIBS += -lrte_ethtool\n-\n-\n-include $(RTE_SDK)/mk/rte.extapp.mk\ndiff --git a/examples/ethtool/ethtool-app/ethapp.c b/examples/ethtool/ethtool-app/ethapp.c\ndeleted file mode 100644\nindex 2ed4796..0000000\n--- a/examples/ethtool/ethtool-app/ethapp.c\n+++ /dev/null\n@@ -1,873 +0,0 @@\n-/*-\n- *   BSD LICENSE\n- *\n- *   Copyright(c) 2015 Intel Corporation. All rights reserved.\n- *   All rights reserved.\n- *\n- *   Redistribution and use in source and binary forms, with or without\n- *   modification, are permitted provided that the following conditions\n- *   are met:\n- *\n- *     * Redistributions of source code must retain the above copyright\n- *       notice, this list of conditions and the following disclaimer.\n- *     * Redistributions in binary form must reproduce the above copyright\n- *       notice, this list of conditions and the following disclaimer in\n- *       the documentation and/or other materials provided with the\n- *       distribution.\n- *     * Neither the name of Intel Corporation nor the names of its\n- *       contributors may be used to endorse or promote products derived\n- *       from this software without specific prior written permission.\n- *\n- *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n- *   \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n- *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n- *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n- *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n- *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n- *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n- *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n- *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n- *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n- *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n- */\n-\n-#include <cmdline_parse.h>\n-#include <cmdline_parse_num.h>\n-#include <cmdline_parse_string.h>\n-#include <cmdline_parse_etheraddr.h>\n-#include <cmdline_socket.h>\n-#include <cmdline.h>\n-\n-#include \"rte_ethtool.h\"\n-#include \"ethapp.h\"\n-\n-#define EEPROM_DUMP_CHUNKSIZE 1024\n-\n-\n-struct pcmd_get_params {\n-\tcmdline_fixed_string_t cmd;\n-};\n-struct pcmd_int_params {\n-\tcmdline_fixed_string_t cmd;\n-\tuint16_t port;\n-};\n-struct pcmd_intstr_params {\n-\tcmdline_fixed_string_t cmd;\n-\tuint16_t port;\n-\tcmdline_fixed_string_t opt;\n-};\n-struct pcmd_intmac_params {\n-\tcmdline_fixed_string_t cmd;\n-\tuint16_t port;\n-\tstruct ether_addr mac;\n-};\n-struct pcmd_str_params {\n-\tcmdline_fixed_string_t cmd;\n-\tcmdline_fixed_string_t opt;\n-};\n-struct pcmd_vlan_params {\n-\tcmdline_fixed_string_t cmd;\n-\tuint16_t port;\n-\tcmdline_fixed_string_t mode;\n-\tuint16_t vid;\n-};\n-struct pcmd_intintint_params {\n-\tcmdline_fixed_string_t cmd;\n-\tuint16_t port;\n-\tuint16_t tx;\n-\tuint16_t rx;\n-};\n-\n-\n-/* Parameter-less commands */\n-cmdline_parse_token_string_t pcmd_quit_token_cmd =\n-\tTOKEN_STRING_INITIALIZER(struct pcmd_get_params, cmd, \"quit\");\n-cmdline_parse_token_string_t pcmd_stats_token_cmd =\n-\tTOKEN_STRING_INITIALIZER(struct pcmd_get_params, cmd, \"stats\");\n-cmdline_parse_token_string_t pcmd_drvinfo_token_cmd =\n-\tTOKEN_STRING_INITIALIZER(struct pcmd_get_params, cmd, \"drvinfo\");\n-cmdline_parse_token_string_t pcmd_link_token_cmd =\n-\tTOKEN_STRING_INITIALIZER(struct pcmd_get_params, cmd, \"link\");\n-\n-/* Commands taking just port id */\n-cmdline_parse_token_string_t pcmd_open_token_cmd =\n-\tTOKEN_STRING_INITIALIZER(struct pcmd_int_params, cmd, \"open\");\n-cmdline_parse_token_string_t pcmd_stop_token_cmd =\n-\tTOKEN_STRING_INITIALIZER(struct pcmd_int_params, cmd, \"stop\");\n-cmdline_parse_token_string_t pcmd_rxmode_token_cmd =\n-\tTOKEN_STRING_INITIALIZER(struct pcmd_int_params, cmd, \"rxmode\");\n-cmdline_parse_token_string_t pcmd_portstats_token_cmd =\n-\tTOKEN_STRING_INITIALIZER(struct pcmd_int_params, cmd, \"portstats\");\n-cmdline_parse_token_num_t pcmd_int_token_port =\n-\tTOKEN_NUM_INITIALIZER(struct pcmd_int_params, port, UINT16);\n-\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_mtu_token_cmd =\n-\tTOKEN_STRING_INITIALIZER(struct pcmd_intstr_params, cmd, \"mtu\");\n-cmdline_parse_token_string_t pcmd_regs_token_cmd =\n-\tTOKEN_STRING_INITIALIZER(struct pcmd_intstr_params, cmd, \"regs\");\n-\n-cmdline_parse_token_num_t pcmd_intstr_token_port =\n-\tTOKEN_NUM_INITIALIZER(struct pcmd_intstr_params, port, UINT16);\n-cmdline_parse_token_string_t pcmd_intstr_token_opt =\n-\tTOKEN_STRING_INITIALIZER(struct pcmd_intstr_params, opt, NULL);\n-\n-/* Commands taking port id and a MAC address string */\n-cmdline_parse_token_string_t pcmd_macaddr_token_cmd =\n-\tTOKEN_STRING_INITIALIZER(struct pcmd_intmac_params, cmd, \"macaddr\");\n-cmdline_parse_token_num_t pcmd_intmac_token_port =\n-\tTOKEN_NUM_INITIALIZER(struct pcmd_intmac_params, port, UINT16);\n-cmdline_parse_token_etheraddr_t pcmd_intmac_token_mac =\n-\tTOKEN_ETHERADDR_INITIALIZER(struct pcmd_intmac_params, mac);\n-\n-/* Command taking just a MAC address */\n-cmdline_parse_token_string_t pcmd_validate_token_cmd =\n-\tTOKEN_STRING_INITIALIZER(struct pcmd_intmac_params, cmd, \"validate\");\n-\n-\n-/* Commands taking port id and two integers */\n-cmdline_parse_token_string_t pcmd_ringparam_token_cmd =\n-\tTOKEN_STRING_INITIALIZER(struct pcmd_intintint_params, cmd,\n-\t\t\"ringparam\");\n-cmdline_parse_token_num_t pcmd_intintint_token_port =\n-\tTOKEN_NUM_INITIALIZER(struct pcmd_intintint_params, port, UINT16);\n-cmdline_parse_token_num_t pcmd_intintint_token_tx =\n-\tTOKEN_NUM_INITIALIZER(struct pcmd_intintint_params, tx, UINT16);\n-cmdline_parse_token_num_t pcmd_intintint_token_rx =\n-\tTOKEN_NUM_INITIALIZER(struct pcmd_intintint_params, rx, UINT16);\n-\n-\n-/* Pause commands */\n-cmdline_parse_token_string_t pcmd_pause_token_cmd =\n-\tTOKEN_STRING_INITIALIZER(struct pcmd_intstr_params, cmd, \"pause\");\n-cmdline_parse_token_num_t pcmd_pause_token_port =\n-\tTOKEN_NUM_INITIALIZER(struct pcmd_intstr_params, port, UINT16);\n-cmdline_parse_token_string_t pcmd_pause_token_opt =\n-\tTOKEN_STRING_INITIALIZER(struct pcmd_intstr_params,\n-\t\topt, \"all#tx#rx#none\");\n-\n-/* VLAN commands */\n-cmdline_parse_token_string_t pcmd_vlan_token_cmd =\n-\tTOKEN_STRING_INITIALIZER(struct pcmd_vlan_params, cmd, \"vlan\");\n-cmdline_parse_token_num_t pcmd_vlan_token_port =\n-\tTOKEN_NUM_INITIALIZER(struct pcmd_vlan_params, port, UINT16);\n-cmdline_parse_token_string_t pcmd_vlan_token_mode =\n-\tTOKEN_STRING_INITIALIZER(struct pcmd_vlan_params, mode, \"add#del\");\n-cmdline_parse_token_num_t pcmd_vlan_token_vid =\n-\tTOKEN_NUM_INITIALIZER(struct pcmd_vlan_params, vid, UINT16);\n-\n-\n-static void\n-pcmd_quit_callback(__rte_unused void *ptr_params,\n-\tstruct cmdline *ctx,\n-\t__rte_unused void *ptr_data)\n-{\n-\tcmdline_quit(ctx);\n-}\n-\n-\n-static void\n-pcmd_drvinfo_callback(__rte_unused void *ptr_params,\n-\t__rte_unused struct cmdline *ctx,\n-\t__rte_unused void *ptr_data)\n-{\n-\tstruct ethtool_drvinfo info;\n-\tint id_port;\n-\n-\tfor (id_port = 0; id_port < rte_eth_dev_count(); id_port++) {\n-\t\tif (rte_ethtool_get_drvinfo(id_port, &info)) {\n-\t\t\tprintf(\"Error getting info for port %i\\n\", id_port);\n-\t\t\treturn;\n-\t\t}\n-\t\tprintf(\"Port %i driver: %s (ver: %s)\\n\",\n-\t\t\tid_port, info.driver, info.version\n-\t\t      );\n-\t}\n-}\n-\n-\n-static void\n-pcmd_link_callback(__rte_unused void *ptr_params,\n-\t__rte_unused struct cmdline *ctx,\n-\t__rte_unused void *ptr_data)\n-{\n-\tint num_ports = rte_eth_dev_count();\n-\tint id_port, stat_port;\n-\n-\tfor (id_port = 0; id_port < num_ports; id_port++) {\n-\t\tif (!rte_eth_dev_is_valid_port(id_port))\n-\t\t\tcontinue;\n-\t\tstat_port = rte_ethtool_get_link(id_port);\n-\t\tswitch (stat_port) {\n-\t\tcase 0:\n-\t\t\tprintf(\"Port %i: Down\\n\", id_port);\n-\t\t\tbreak;\n-\t\tcase 1:\n-\t\t\tprintf(\"Port %i: Up\\n\", id_port);\n-\t\t\tbreak;\n-\t\tdefault:\n-\t\t\tprintf(\"Port %i: Error getting link status\\n\",\n-\t\t\t\tid_port\n-\t\t\t\t);\n-\t\t\tbreak;\n-\t\t}\n-\t}\n-\tprintf(\"\\n\");\n-}\n-\n-\n-static void\n-pcmd_regs_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-\tint len_regs;\n-\tstruct ethtool_regs regs;\n-\tunsigned char *buf_data;\n-\tFILE *fp_regs;\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-\tlen_regs = rte_ethtool_get_regs_len(params->port);\n-\tif (len_regs > 0) {\n-\t\tprintf(\"Port %i: %i bytes\\n\", params->port, len_regs);\n-\t\tbuf_data = malloc(len_regs);\n-\t\tif (buf_data == NULL) {\n-\t\t\tprintf(\"Error allocating %i bytes for buffer\\n\",\n-\t\t\t\tlen_regs);\n-\t\t\treturn;\n-\t\t}\n-\t\tif (!rte_ethtool_get_regs(params->port, &regs, buf_data)) {\n-\t\t\tfp_regs = fopen(params->opt, \"wb\");\n-\t\t\tif (fp_regs == NULL) {\n-\t\t\t\tprintf(\"Error opening '%s' for writing\\n\",\n-\t\t\t\t\tparams->opt);\n-\t\t\t} else {\n-\t\t\t\tif ((int)fwrite(buf_data,\n-\t\t\t\t\t\t1, len_regs,\n-\t\t\t\t\t\tfp_regs) != len_regs)\n-\t\t\t\t\tprintf(\"Error writing '%s'\\n\",\n-\t\t\t\t\t\tparams->opt);\n-\t\t\t\tfclose(fp_regs);\n-\t\t\t}\n-\t\t}\n-\t\tfree(buf_data);\n-\t} else if (len_regs == -ENOTSUP)\n-\t\tprintf(\"Port %i: Operation not supported\\n\", params->port);\n-\telse\n-\t\tprintf(\"Port %i: Error getting registers\\n\", params->port);\n-}\n-\n-\n-static void\n-pcmd_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-\tint len_eeprom;\n-\tint pos_eeprom;\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-\tlen_eeprom = rte_ethtool_get_eeprom_len(params->port);\n-\tif (len_eeprom > 0) {\n-\t\tfp_eeprom = fopen(params->opt, \"wb\");\n-\t\tif (fp_eeprom == NULL) {\n-\t\t\tprintf(\"Error opening '%s' for writing\\n\",\n-\t\t\t\tparams->opt);\n-\t\t\treturn;\n-\t\t}\n-\t\tprintf(\"Total EEPROM length: %i bytes\\n\", len_eeprom);\n-\t\tinfo_eeprom.len = EEPROM_DUMP_CHUNKSIZE;\n-\t\tfor (pos_eeprom = 0;\n-\t\t\t\tpos_eeprom < len_eeprom;\n-\t\t\t\tpos_eeprom += EEPROM_DUMP_CHUNKSIZE) {\n-\t\t\tinfo_eeprom.offset = pos_eeprom;\n-\t\t\tif (pos_eeprom + EEPROM_DUMP_CHUNKSIZE > len_eeprom)\n-\t\t\t\tinfo_eeprom.len = len_eeprom - pos_eeprom;\n-\t\t\telse\n-\t\t\t\tinfo_eeprom.len = EEPROM_DUMP_CHUNKSIZE;\n-\t\t\tstat = rte_ethtool_get_eeprom(\n-\t\t\t\tparams->port, &info_eeprom, bytes_eeprom\n-\t\t\t\t);\n-\t\t\tif (stat != 0) {\n-\t\t\t\tprintf(\"EEPROM read error %i\\n\", stat);\n-\t\t\t\tbreak;\n-\t\t\t}\n-\t\t\tif (fwrite(bytes_eeprom,\n-\t\t\t\t\t1, info_eeprom.len,\n-\t\t\t\t\tfp_eeprom) != info_eeprom.len) {\n-\t\t\t\tprintf(\"Error writing '%s'\\n\", params->opt);\n-\t\t\t\tbreak;\n-\t\t\t}\n-\t\t}\n-\t\tfclose(fp_eeprom);\n-\t} else if (len_eeprom == 0)\n-\t\tprintf(\"Port %i: Device does not have EEPROM\\n\", params->port);\n-\telse if (len_eeprom == -ENOTSUP)\n-\t\tprintf(\"Port %i: Operation not supported\\n\", params->port);\n-\telse\n-\t\tprintf(\"Port %i: Error getting EEPROM\\n\", params->port);\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-{\n-\tstruct pcmd_intstr_params *params = ptr_params;\n-\tstruct ethtool_pauseparam info;\n-\tint stat;\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-\tif (ptr_data != NULL) {\n-\t\tstat = rte_ethtool_get_pauseparam(params->port, &info);\n-\t} else {\n-\t\tmemset(&info, 0, sizeof(info));\n-\t\tif (strcasecmp(\"all\", params->opt) == 0) {\n-\t\t\tinfo.tx_pause = 1;\n-\t\t\tinfo.rx_pause = 1;\n-\t\t} else if (strcasecmp(\"tx\", params->opt) == 0) {\n-\t\t\tinfo.tx_pause = 1;\n-\t\t\tinfo.rx_pause = 0;\n-\t\t} else if (strcasecmp(\"rx\", params->opt) == 0) {\n-\t\t\tinfo.tx_pause = 0;\n-\t\t\tinfo.rx_pause = 1;\n-\t\t} else {\n-\t\t\tinfo.tx_pause = 0;\n-\t\t\tinfo.rx_pause = 0;\n-\t\t}\n-\t\t/* Assume auto-negotiation wanted */\n-\t\tinfo.autoneg = 1;\n-\t\tstat = rte_ethtool_set_pauseparam(params->port, &info);\n-\t}\n-\tif (stat == 0) {\n-\t\tif (info.rx_pause && info.tx_pause)\n-\t\t\tprintf(\"Port %i: Tx & Rx Paused\\n\", params->port);\n-\t\telse if (info.rx_pause)\n-\t\t\tprintf(\"Port %i: Rx Paused\\n\", params->port);\n-\t\telse if (info.tx_pause)\n-\t\t\tprintf(\"Port %i: Tx Paused\\n\", params->port);\n-\t\telse\n-\t\t\tprintf(\"Port %i: Tx & Rx not paused\\n\", params->port);\n-\t} else if (stat == -ENOTSUP)\n-\t\tprintf(\"Port %i: Operation not supported\\n\", params->port);\n-\telse\n-\t\tprintf(\"Port %i: Error %i\\n\", params->port, stat);\n-}\n-\n-\n-static void\n-pcmd_open_callback(__rte_unused void *ptr_params,\n-\t__rte_unused struct cmdline *ctx,\n-\t__rte_unused void *ptr_data)\n-{\n-\tstruct pcmd_int_params *params = ptr_params;\n-\tint stat;\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-\tlock_port(params->port);\n-\tstat = rte_ethtool_net_open(params->port);\n-\tmark_port_active(params->port);\n-\tunlock_port(params->port);\n-\tif (stat == 0)\n-\t\treturn;\n-\telse if (stat == -ENOTSUP)\n-\t\tprintf(\"Port %i: Operation not supported\\n\", params->port);\n-\telse\n-\t\tprintf(\"Port %i: Error opening device\\n\", params->port);\n-}\n-\n-static void\n-pcmd_stop_callback(__rte_unused void *ptr_params,\n-\t__rte_unused struct cmdline *ctx,\n-\t__rte_unused void *ptr_data)\n-{\n-\tstruct pcmd_int_params *params = ptr_params;\n-\tint stat;\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-\tlock_port(params->port);\n-\tstat = rte_ethtool_net_stop(params->port);\n-\tmark_port_inactive(params->port);\n-\tunlock_port(params->port);\n-\tif (stat == 0)\n-\t\treturn;\n-\telse if (stat == -ENOTSUP)\n-\t\tprintf(\"Port %i: Operation not supported\\n\", params->port);\n-\telse\n-\t\tprintf(\"Port %i: Error stopping device\\n\", params->port);\n-}\n-\n-\n-static void\n-pcmd_rxmode_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-\tint stat;\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-\tstat = rte_ethtool_net_set_rx_mode(params->port);\n-\tif (stat == 0)\n-\t\treturn;\n-\telse if (stat == -ENOTSUP)\n-\t\tprintf(\"Port %i: Operation not supported\\n\", params->port);\n-\telse\n-\t\tprintf(\"Port %i: Error setting rx mode\\n\", params->port);\n-}\n-\n-\n-static void\n-pcmd_macaddr_callback(void *ptr_params,\n-\t__rte_unused struct cmdline *ctx,\n-\tvoid *ptr_data)\n-{\n-\tstruct pcmd_intmac_params *params = ptr_params;\n-\tstruct ether_addr mac_addr;\n-\tint stat;\n-\n-\tstat = 0;\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-\tif (ptr_data != NULL) {\n-\t\tlock_port(params->port);\n-\t\tstat = rte_ethtool_net_set_mac_addr(params->port,\n-\t\t\t&params->mac);\n-\t\tmark_port_newmac(params->port);\n-\t\tunlock_port(params->port);\n-\t\tif (stat == 0) {\n-\t\t\tprintf(\"MAC address changed\\n\");\n-\t\t\treturn;\n-\t\t}\n-\t} else {\n-\t\tstat = rte_ethtool_net_get_mac_addr(params->port, &mac_addr);\n-\t\tif (stat == 0) {\n-\t\t\tprintf(\n-\t\t\t\t\"Port %i MAC Address: %02x:%02x:%02x:%02x:%02x:%02x\\n\",\n-\t\t\t\tparams->port,\n-\t\t\t\tmac_addr.addr_bytes[0],\n-\t\t\t\tmac_addr.addr_bytes[1],\n-\t\t\t\tmac_addr.addr_bytes[2],\n-\t\t\t\tmac_addr.addr_bytes[3],\n-\t\t\t\tmac_addr.addr_bytes[4],\n-\t\t\t\tmac_addr.addr_bytes[5]);\n-\t\t\treturn;\n-\t\t}\n-\t}\n-\n-\tprintf(\"Port %i: Error %s\\n\", params->port,\n-\t       strerror(-stat));\n-}\n-\n-static void\n-pcmd_mtu_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-\tint stat;\n-\tint new_mtu;\n-\tchar *ptr_parse_end;\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-\tnew_mtu = atoi(params->opt);\n-\tnew_mtu = strtoul(params->opt, &ptr_parse_end, 10);\n-\tif (*ptr_parse_end != '\\0' ||\n-\t\t\tnew_mtu < ETHER_MIN_MTU ||\n-\t\t\tnew_mtu > ETHER_MAX_JUMBO_FRAME_LEN) {\n-\t\tprintf(\"Port %i: Invalid MTU value\\n\", params->port);\n-\t\treturn;\n-\t}\n-\tstat = rte_ethtool_net_change_mtu(params->port, new_mtu);\n-\tif (stat == 0)\n-\t\tprintf(\"Port %i: MTU set to %i\\n\", params->port, new_mtu);\n-\telse if (stat == -ENOTSUP)\n-\t\tprintf(\"Port %i: Operation not supported\\n\", params->port);\n-\telse\n-\t\tprintf(\"Port %i: Error setting MTU\\n\", params->port);\n-}\n-\n-\n-\n-static void pcmd_portstats_callback(__rte_unused void *ptr_params,\n-\t__rte_unused struct cmdline *ctx,\n-\t__rte_unused void *ptr_data)\n-{\n-\tstruct pcmd_int_params *params = ptr_params;\n-\tstruct rte_eth_stats stat_info;\n-\tint stat;\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-\tstat = rte_ethtool_net_get_stats64(params->port, &stat_info);\n-\tif (stat == 0) {\n-\t\t/* Most of rte_eth_stats is deprecated.. */\n-\t\tprintf(\"Port %i stats\\n\", params->port);\n-\t\tprintf(\"   In: %\" PRIu64 \" (%\" PRIu64 \" bytes)\\n\"\n-\t\t\t\"  Out: %\"PRIu64\" (%\"PRIu64 \" bytes)\\n\"\n-\t\t\t\"  Err: %\"PRIu64\"\\n\",\n-\t\t\tstat_info.ipackets,\n-\t\t\tstat_info.ibytes,\n-\t\t\tstat_info.opackets,\n-\t\t\tstat_info.obytes,\n-\t\t\tstat_info.ierrors+stat_info.oerrors\n-\t\t      );\n-\t} else if (stat == -ENOTSUP)\n-\t\tprintf(\"Port %i: Operation not supported\\n\", params->port);\n-\telse\n-\t\tprintf(\"Port %i: Error fetching statistics\\n\", params->port);\n-}\n-\n-static void pcmd_ringparam_callback(__rte_unused void *ptr_params,\n-\t__rte_unused struct cmdline *ctx,\n-\tvoid *ptr_data)\n-{\n-\tstruct pcmd_intintint_params *params = ptr_params;\n-\tstruct ethtool_ringparam ring_data;\n-\tstruct ethtool_ringparam ring_params;\n-\tint stat;\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-\tif (ptr_data == NULL) {\n-\t\tstat = rte_ethtool_get_ringparam(params->port, &ring_data);\n-\t\tif (stat == 0) {\n-\t\t\tprintf(\"Port %i ring parameters\\n\"\n-\t\t\t\t\"  Rx Pending: %i (%i max)\\n\"\n-\t\t\t\t\"  Tx Pending: %i (%i max)\\n\",\n-\t\t\t\tparams->port,\n-\t\t\t\tring_data.rx_pending,\n-\t\t\t\tring_data.rx_max_pending,\n-\t\t\t\tring_data.tx_pending,\n-\t\t\t\tring_data.tx_max_pending);\n-\t\t}\n-\t} else {\n-\t\tif (params->tx < 1 || params->rx < 1) {\n-\t\t\tprintf(\"Error: Invalid parameters\\n\");\n-\t\t\treturn;\n-\t\t}\n-\t\tmemset(&ring_params, 0, sizeof(struct ethtool_ringparam));\n-\t\tring_params.tx_pending = params->tx;\n-\t\tring_params.rx_pending = params->rx;\n-\t\tlock_port(params->port);\n-\t\tstat = rte_ethtool_set_ringparam(params->port, &ring_params);\n-\t\tunlock_port(params->port);\n-\t}\n-\tif (stat == 0)\n-\t\treturn;\n-\telse if (stat == -ENOTSUP)\n-\t\tprintf(\"Port %i: Operation not supported\\n\", params->port);\n-\telse\n-\t\tprintf(\"Port %i: Error fetching statistics\\n\", params->port);\n-}\n-\n-static void pcmd_validate_callback(void *ptr_params,\n-\t__rte_unused struct cmdline *ctx,\n-\t__rte_unused void *ptr_data)\n-{\n-\tstruct pcmd_intmac_params *params = ptr_params;\n-\n-\tif (rte_ethtool_net_validate_addr(0, &params->mac))\n-\t\tprintf(\"Address is unicast\\n\");\n-\telse\n-\t\tprintf(\"Address is not unicast\\n\");\n-}\n-\n-\n-static void pcmd_vlan_callback(__rte_unused void *ptr_params,\n-\t__rte_unused struct cmdline *ctx,\n-\t__rte_unused void *ptr_data)\n-{\n-\tstruct pcmd_vlan_params *params = ptr_params;\n-\tint stat;\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-\tstat = 0;\n-\n-\tif (strcasecmp(\"add\", params->mode) == 0) {\n-\t\tstat = rte_ethtool_net_vlan_rx_add_vid(\n-\t\t\tparams->port, params->vid\n-\t\t\t);\n-\t\tif (stat == 0)\n-\t\t\tprintf(\"VLAN vid %i added\\n\", params->vid);\n-\n-\t} else if (strcasecmp(\"del\", params->mode) == 0) {\n-\t\tstat = rte_ethtool_net_vlan_rx_kill_vid(\n-\t\t\tparams->port, params->vid\n-\t\t\t);\n-\t\tif (stat == 0)\n-\t\t\tprintf(\"VLAN vid %i removed\\n\", params->vid);\n-\t} else {\n-\t\t/* Should not happen! */\n-\t\tprintf(\"Error: Bad mode %s\\n\", params->mode);\n-\t}\n-\tif (stat == -ENOTSUP)\n-\t\tprintf(\"Port %i: Operation not supported\\n\", params->port);\n-\telse if (stat == -ENOSYS)\n-\t\tprintf(\"Port %i: VLAN filtering disabled\\n\", params->port);\n-\telse if (stat != 0)\n-\t\tprintf(\"Port %i: Error changing VLAN setup (code %i)\\n\",\n-\t\t\tparams->port, -stat);\n-}\n-\n-\n-cmdline_parse_inst_t pcmd_quit = {\n-\t.f = pcmd_quit_callback,\n-\t.data = NULL,\n-\t.help_str = \"quit\\n     Exit program\",\n-\t.tokens = {(void *)&pcmd_quit_token_cmd, NULL},\n-};\n-cmdline_parse_inst_t pcmd_drvinfo = {\n-\t.f = pcmd_drvinfo_callback,\n-\t.data = NULL,\n-\t.help_str = \"drvinfo\\n     Print driver info\",\n-\t.tokens = {(void *)&pcmd_drvinfo_token_cmd, NULL},\n-};\n-cmdline_parse_inst_t pcmd_link = {\n-\t.f = pcmd_link_callback,\n-\t.data = NULL,\n-\t.help_str = \"link\\n     Print port link states\",\n-\t.tokens = {(void *)&pcmd_link_token_cmd, NULL},\n-};\n-cmdline_parse_inst_t pcmd_regs = {\n-\t.f = pcmd_regs_callback,\n-\t.data = NULL,\n-\t.help_str = \"regs <port_id> <filename>\\n\"\n-\t\t\"     Dump port register(s) to file\",\n-\t.tokens = {\n-\t\t(void *)&pcmd_regs_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_eeprom = {\n-\t.f = pcmd_eeprom_callback,\n-\t.data = NULL,\n-\t.help_str = \"eeprom <port_id> <filename>\\n    Dump EEPROM to file\",\n-\t.tokens = {\n-\t\t(void *)&pcmd_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-\t.help_str = \"pause <port_id>\\n     Print port pause state\",\n-\t.tokens = {\n-\t\t(void *)&pcmd_pause_token_cmd,\n-\t\t(void *)&pcmd_pause_token_port,\n-\t\tNULL\n-\t},\n-};\n-cmdline_parse_inst_t pcmd_pause = {\n-\t.f = pcmd_pause_callback,\n-\t.data = NULL,\n-\t.help_str =\n-\t\t\"pause <port_id> <all|tx|rx|none>\\n     Pause/unpause port\",\n-\t.tokens = {\n-\t\t(void *)&pcmd_pause_token_cmd,\n-\t\t(void *)&pcmd_pause_token_port,\n-\t\t(void *)&pcmd_pause_token_opt,\n-\t\tNULL\n-\t},\n-};\n-cmdline_parse_inst_t pcmd_open = {\n-\t.f = pcmd_open_callback,\n-\t.data = NULL,\n-\t.help_str = \"open <port_id>\\n     Open port\",\n-\t.tokens = {\n-\t\t(void *)&pcmd_open_token_cmd,\n-\t\t(void *)&pcmd_int_token_port,\n-\t\tNULL\n-\t},\n-};\n-cmdline_parse_inst_t pcmd_stop = {\n-\t.f = pcmd_stop_callback,\n-\t.data = NULL,\n-\t.help_str = \"stop <port_id>\\n     Stop port\",\n-\t.tokens = {\n-\t\t(void *)&pcmd_stop_token_cmd,\n-\t\t(void *)&pcmd_int_token_port,\n-\t\tNULL\n-\t},\n-};\n-cmdline_parse_inst_t pcmd_rxmode = {\n-\t.f = pcmd_rxmode_callback,\n-\t.data = NULL,\n-\t.help_str = \"rxmode <port_id>\\n     Toggle port Rx mode\",\n-\t.tokens = {\n-\t\t(void *)&pcmd_rxmode_token_cmd,\n-\t\t(void *)&pcmd_int_token_port,\n-\t\tNULL\n-\t},\n-};\n-cmdline_parse_inst_t pcmd_macaddr_get = {\n-\t.f = pcmd_macaddr_callback,\n-\t.data = NULL,\n-\t.help_str = \"macaddr <port_id>\\n\"\n-\t\t\"     Get MAC address\",\n-\t.tokens = {\n-\t\t(void *)&pcmd_macaddr_token_cmd,\n-\t\t(void *)&pcmd_intstr_token_port,\n-\t\tNULL\n-\t},\n-};\n-cmdline_parse_inst_t pcmd_macaddr = {\n-\t.f = pcmd_macaddr_callback,\n-\t.data = (void *)0x01,\n-\t.help_str =\n-\t\t\"macaddr <port_id> <mac_addr>\\n\"\n-\t\t\"     Set MAC address\",\n-\t.tokens = {\n-\t\t(void *)&pcmd_macaddr_token_cmd,\n-\t\t(void *)&pcmd_intmac_token_port,\n-\t\t(void *)&pcmd_intmac_token_mac,\n-\t\tNULL\n-\t},\n-};\n-cmdline_parse_inst_t pcmd_mtu = {\n-\t.f = pcmd_mtu_callback,\n-\t.data = NULL,\n-\t.help_str = \"mtu <port_id> <mtu_value>\\n\"\n-\t\t\"     Change MTU\",\n-\t.tokens = {\n-\t\t(void *)&pcmd_mtu_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_portstats = {\n-\t.f = pcmd_portstats_callback,\n-\t.data = NULL,\n-\t.help_str = \"portstats <port_id>\\n\"\n-\t\t\"     Print port eth statistics\",\n-\t.tokens = {\n-\t\t(void *)&pcmd_portstats_token_cmd,\n-\t\t(void *)&pcmd_int_token_port,\n-\t\tNULL\n-\t},\n-};\n-cmdline_parse_inst_t pcmd_ringparam = {\n-\t.f = pcmd_ringparam_callback,\n-\t.data = NULL,\n-\t.help_str = \"ringparam <port_id>\\n\"\n-\t\t\"     Print ring parameters\",\n-\t.tokens = {\n-\t\t(void *)&pcmd_ringparam_token_cmd,\n-\t\t(void *)&pcmd_intintint_token_port,\n-\t\tNULL\n-\t},\n-};\n-cmdline_parse_inst_t pcmd_ringparam_set = {\n-\t.f = pcmd_ringparam_callback,\n-\t.data = (void *)1,\n-\t.help_str = \"ringparam <port_id> <tx_param> <rx_param>\\n\"\n-\t\t\"     Set ring parameters\",\n-\t.tokens = {\n-\t\t(void *)&pcmd_ringparam_token_cmd,\n-\t\t(void *)&pcmd_intintint_token_port,\n-\t\t(void *)&pcmd_intintint_token_tx,\n-\t\t(void *)&pcmd_intintint_token_rx,\n-\t\tNULL\n-\t},\n-};\n-cmdline_parse_inst_t pcmd_validate = {\n-\t.f = pcmd_validate_callback,\n-\t.data = NULL,\n-\t.help_str = \"validate <mac_addr>\\n\"\n-\t\t\"     Check that MAC address is valid unicast address\",\n-\t.tokens = {\n-\t\t(void *)&pcmd_validate_token_cmd,\n-\t\t(void *)&pcmd_intmac_token_mac,\n-\t\tNULL\n-\t},\n-};\n-cmdline_parse_inst_t pcmd_vlan = {\n-\t.f = pcmd_vlan_callback,\n-\t.data = NULL,\n-\t.help_str = \"vlan <port_id> <add|del> <vlan_id>\\n\"\n-\t\t\"     Add/remove VLAN id\",\n-\t.tokens = {\n-\t\t(void *)&pcmd_vlan_token_cmd,\n-\t\t(void *)&pcmd_vlan_token_port,\n-\t\t(void *)&pcmd_vlan_token_mode,\n-\t\t(void *)&pcmd_vlan_token_vid,\n-\t\tNULL\n-\t},\n-};\n-\n-\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_link,\n-\t(cmdline_parse_inst_t *)&pcmd_macaddr_get,\n-\t(cmdline_parse_inst_t *)&pcmd_macaddr,\n-\t(cmdline_parse_inst_t *)&pcmd_mtu,\n-\t(cmdline_parse_inst_t *)&pcmd_open,\n-\t(cmdline_parse_inst_t *)&pcmd_pause_noopt,\n-\t(cmdline_parse_inst_t *)&pcmd_pause,\n-\t(cmdline_parse_inst_t *)&pcmd_portstats,\n-\t(cmdline_parse_inst_t *)&pcmd_regs,\n-\t(cmdline_parse_inst_t *)&pcmd_ringparam,\n-\t(cmdline_parse_inst_t *)&pcmd_ringparam_set,\n-\t(cmdline_parse_inst_t *)&pcmd_rxmode,\n-\t(cmdline_parse_inst_t *)&pcmd_stop,\n-\t(cmdline_parse_inst_t *)&pcmd_validate,\n-\t(cmdline_parse_inst_t *)&pcmd_vlan,\n-\t(cmdline_parse_inst_t *)&pcmd_quit,\n-\tNULL\n-};\n-\n-\n-void ethapp_main(void)\n-{\n-\tstruct cmdline *ctx_cmdline;\n-\n-\tctx_cmdline = cmdline_stdin_new(list_prompt_commands, \"EthApp> \");\n-\tcmdline_interact(ctx_cmdline);\n-\tcmdline_stdin_exit(ctx_cmdline);\n-}\ndiff --git a/examples/ethtool/ethtool-app/ethapp.h b/examples/ethtool/ethtool-app/ethapp.h\ndeleted file mode 100644\nindex ba438ee..0000000\n--- a/examples/ethtool/ethtool-app/ethapp.h\n+++ /dev/null\n@@ -1,41 +0,0 @@\n-/*-\n- *   BSD LICENSE\n- *\n- *   Copyright(c) 2015 Intel Corporation. All rights reserved.\n- *   All rights reserved.\n- *\n- *   Redistribution and use in source and binary forms, with or without\n- *   modification, are permitted provided that the following conditions\n- *   are met:\n- *\n- *     * Redistributions of source code must retain the above copyright\n- *       notice, this list of conditions and the following disclaimer.\n- *     * Redistributions in binary form must reproduce the above copyright\n- *       notice, this list of conditions and the following disclaimer in\n- *       the documentation and/or other materials provided with the\n- *       distribution.\n- *     * Neither the name of Intel Corporation nor the names of its\n- *       contributors may be used to endorse or promote products derived\n- *       from this software without specific prior written permission.\n- *\n- *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n- *   \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n- *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n- *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n- *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n- *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n- *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n- *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n- *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n- *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n- *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n- */\n-\n-\n-void ethapp_main(void);\n-void print_stats(void);\n-void lock_port(int idx_port);\n-void unlock_port(int idx_port);\n-void mark_port_inactive(int idx_port);\n-void mark_port_active(int idx_port);\n-void mark_port_newmac(int idx_port);\ndiff --git a/examples/ethtool/ethtool-app/main.c b/examples/ethtool/ethtool-app/main.c\ndeleted file mode 100644\nindex 2c655d8..0000000\n--- a/examples/ethtool/ethtool-app/main.c\n+++ /dev/null\n@@ -1,305 +0,0 @@\n-/*-\n- *   BSD LICENSE\n- *\n- *   Copyright(c) 2015 Intel Corporation. All rights reserved.\n- *   All rights reserved.\n- *\n- *   Redistribution and use in source and binary forms, with or without\n- *   modification, are permitted provided that the following conditions\n- *   are met:\n- *\n- *     * Redistributions of source code must retain the above copyright\n- *       notice, this list of conditions and the following disclaimer.\n- *     * Redistributions in binary form must reproduce the above copyright\n- *       notice, this list of conditions and the following disclaimer in\n- *       the documentation and/or other materials provided with the\n- *       distribution.\n- *     * Neither the name of Intel Corporation nor the names of its\n- *       contributors may be used to endorse or promote products derived\n- *       from this software without specific prior written permission.\n- *\n- *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n- *   \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n- *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n- *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n- *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n- *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n- *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n- *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n- *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n- *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n- *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n- */\n-\n-\n-#include <stdio.h>\n-#include <stdlib.h>\n-\n-#include <rte_common.h>\n-#include <rte_spinlock.h>\n-#include <rte_eal.h>\n-#include <rte_ethdev.h>\n-#include <rte_ether.h>\n-#include <rte_ip.h>\n-#include <rte_memory.h>\n-#include <rte_mempool.h>\n-#include <rte_mbuf.h>\n-\n-#include \"ethapp.h\"\n-\n-#define MAX_PORTS RTE_MAX_ETHPORTS\n-#define MAX_BURST_LENGTH 32\n-#define PORT_RX_QUEUE_SIZE 128\n-#define PORT_TX_QUEUE_SIZE 256\n-#define PKTPOOL_EXTRA_SIZE 512\n-#define PKTPOOL_CACHE 32\n-\n-\n-struct txq_port {\n-\tuint16_t cnt_unsent;\n-\tstruct rte_mbuf *buf_frames[MAX_BURST_LENGTH];\n-};\n-\n-struct app_port {\n-\tstruct ether_addr mac_addr;\n-\tstruct txq_port txq;\n-\trte_spinlock_t lock;\n-\tint port_active;\n-\tint port_dirty;\n-\tint idx_port;\n-\tstruct rte_mempool *pkt_pool;\n-};\n-\n-struct app_config {\n-\tstruct app_port ports[MAX_PORTS];\n-\tint cnt_ports;\n-\tint exit_now;\n-};\n-\n-\n-struct app_config app_cfg;\n-\n-\n-void lock_port(int idx_port)\n-{\n-\tstruct app_port *ptr_port = &app_cfg.ports[idx_port];\n-\n-\trte_spinlock_lock(&ptr_port->lock);\n-}\n-\n-void unlock_port(int idx_port)\n-{\n-\tstruct app_port *ptr_port = &app_cfg.ports[idx_port];\n-\n-\trte_spinlock_unlock(&ptr_port->lock);\n-}\n-\n-void mark_port_active(int idx_port)\n-{\n-\tstruct app_port *ptr_port = &app_cfg.ports[idx_port];\n-\n-\tptr_port->port_active = 1;\n-}\n-\n-void mark_port_inactive(int idx_port)\n-{\n-\tstruct app_port *ptr_port = &app_cfg.ports[idx_port];\n-\n-\tptr_port->port_active = 0;\n-}\n-\n-void mark_port_newmac(int idx_port)\n-{\n-\tstruct app_port *ptr_port = &app_cfg.ports[idx_port];\n-\n-\tptr_port->port_dirty = 1;\n-}\n-\n-static void setup_ports(struct app_config *app_cfg, int cnt_ports)\n-{\n-\tint idx_port;\n-\tint size_pktpool;\n-\tstruct rte_eth_conf cfg_port;\n-\tstruct rte_eth_dev_info dev_info;\n-\tchar str_name[16];\n-\n-\tmemset(&cfg_port, 0, sizeof(cfg_port));\n-\tcfg_port.txmode.mq_mode = ETH_MQ_TX_NONE;\n-\n-\tfor (idx_port = 0; idx_port < cnt_ports; idx_port++) {\n-\t\tstruct app_port *ptr_port = &app_cfg->ports[idx_port];\n-\n-\t\trte_eth_dev_info_get(idx_port, &dev_info);\n-\t\tsize_pktpool = dev_info.rx_desc_lim.nb_max +\n-\t\t\tdev_info.tx_desc_lim.nb_max + PKTPOOL_EXTRA_SIZE;\n-\n-\t\tsnprintf(str_name, 16, \"pkt_pool%i\", idx_port);\n-\t\tptr_port->pkt_pool = rte_pktmbuf_pool_create(\n-\t\t\tstr_name,\n-\t\t\tsize_pktpool, PKTPOOL_CACHE,\n-\t\t\t0,\n-\t\t\tRTE_MBUF_DEFAULT_BUF_SIZE,\n-\t\t\trte_socket_id()\n-\t\t\t);\n-\t\tif (ptr_port->pkt_pool == NULL)\n-\t\t\trte_exit(EXIT_FAILURE,\n-\t\t\t\t\"rte_pktmbuf_pool_create failed\"\n-\t\t\t\t);\n-\n-\t\tprintf(\"Init port %i..\\n\", idx_port);\n-\t\tptr_port->port_active = 1;\n-\t\tptr_port->port_dirty = 0;\n-\t\tptr_port->idx_port = idx_port;\n-\n-\t\tif (rte_eth_dev_configure(idx_port, 1, 1, &cfg_port) < 0)\n-\t\t\trte_exit(EXIT_FAILURE,\n-\t\t\t\t \"rte_eth_dev_configure failed\");\n-\t\tif (rte_eth_rx_queue_setup(\n-\t\t\t    idx_port, 0, PORT_RX_QUEUE_SIZE,\n-\t\t\t    rte_eth_dev_socket_id(idx_port), NULL,\n-\t\t\t    ptr_port->pkt_pool) < 0)\n-\t\t\trte_exit(EXIT_FAILURE,\n-\t\t\t\t \"rte_eth_rx_queue_setup failed\"\n-\t\t\t\t);\n-\t\tif (rte_eth_tx_queue_setup(\n-\t\t\t    idx_port, 0, PORT_TX_QUEUE_SIZE,\n-\t\t\t    rte_eth_dev_socket_id(idx_port), NULL) < 0)\n-\t\t\trte_exit(EXIT_FAILURE,\n-\t\t\t\t \"rte_eth_tx_queue_setup failed\"\n-\t\t\t\t);\n-\t\tif (rte_eth_dev_start(idx_port) < 0)\n-\t\t\trte_exit(EXIT_FAILURE,\n-\t\t\t\t \"%s:%i: rte_eth_dev_start failed\",\n-\t\t\t\t __FILE__, __LINE__\n-\t\t\t\t);\n-\t\trte_eth_promiscuous_enable(idx_port);\n-\t\trte_eth_macaddr_get(idx_port, &ptr_port->mac_addr);\n-\t\trte_spinlock_init(&ptr_port->lock);\n-\t}\n-}\n-\n-static void process_frame(struct app_port *ptr_port,\n-\tstruct rte_mbuf *ptr_frame)\n-{\n-\tstruct ether_hdr *ptr_mac_hdr;\n-\n-\tptr_mac_hdr = rte_pktmbuf_mtod(ptr_frame, struct ether_hdr *);\n-\tether_addr_copy(&ptr_mac_hdr->s_addr, &ptr_mac_hdr->d_addr);\n-\tether_addr_copy(&ptr_port->mac_addr, &ptr_mac_hdr->s_addr);\n-}\n-\n-static int slave_main(__attribute__((unused)) void *ptr_data)\n-{\n-\tstruct app_port *ptr_port;\n-\tstruct rte_mbuf *ptr_frame;\n-\tstruct txq_port *txq;\n-\n-\tuint16_t cnt_recv_frames;\n-\tuint16_t idx_frame;\n-\tuint16_t cnt_sent;\n-\tuint16_t idx_port;\n-\tuint16_t lock_result;\n-\n-\twhile (app_cfg.exit_now == 0) {\n-\t\tfor (idx_port = 0; idx_port < app_cfg.cnt_ports; idx_port++) {\n-\t\t\t/* Check that port is active and unlocked */\n-\t\t\tptr_port = &app_cfg.ports[idx_port];\n-\t\t\tlock_result = rte_spinlock_trylock(&ptr_port->lock);\n-\t\t\tif (lock_result == 0)\n-\t\t\t\tcontinue;\n-\t\t\tif (ptr_port->port_active == 0) {\n-\t\t\t\trte_spinlock_unlock(&ptr_port->lock);\n-\t\t\t\tcontinue;\n-\t\t\t}\n-\t\t\ttxq = &ptr_port->txq;\n-\n-\t\t\t/* MAC address was updated */\n-\t\t\tif (ptr_port->port_dirty == 1) {\n-\t\t\t\trte_eth_macaddr_get(ptr_port->idx_port,\n-\t\t\t\t\t&ptr_port->mac_addr);\n-\t\t\t\tptr_port->port_dirty = 0;\n-\t\t\t}\n-\n-\t\t\t/* Incoming frames */\n-\t\t\tcnt_recv_frames = rte_eth_rx_burst(\n-\t\t\t\tptr_port->idx_port, 0,\n-\t\t\t\t&txq->buf_frames[txq->cnt_unsent],\n-\t\t\t\tRTE_DIM(txq->buf_frames) - txq->cnt_unsent\n-\t\t\t\t);\n-\t\t\tif (cnt_recv_frames > 0) {\n-\t\t\t\tfor (idx_frame = 0;\n-\t\t\t\t\tidx_frame < cnt_recv_frames;\n-\t\t\t\t\tidx_frame++) {\n-\t\t\t\t\tptr_frame = txq->buf_frames[\n-\t\t\t\t\t\tidx_frame + txq->cnt_unsent];\n-\t\t\t\t\tprocess_frame(ptr_port, ptr_frame);\n-\t\t\t\t}\n-\t\t\t\ttxq->cnt_unsent += cnt_recv_frames;\n-\t\t\t}\n-\n-\t\t\t/* Outgoing frames */\n-\t\t\tif (txq->cnt_unsent > 0) {\n-\t\t\t\tcnt_sent = rte_eth_tx_burst(\n-\t\t\t\t\tptr_port->idx_port, 0,\n-\t\t\t\t\ttxq->buf_frames,\n-\t\t\t\t\ttxq->cnt_unsent\n-\t\t\t\t\t);\n-\t\t\t\t/* Shuffle up unsent frame pointers */\n-\t\t\t\tfor (idx_frame = cnt_sent;\n-\t\t\t\t\tidx_frame < txq->cnt_unsent;\n-\t\t\t\t\tidx_frame++)\n-\t\t\t\t\ttxq->buf_frames[idx_frame - cnt_sent] =\n-\t\t\t\t\t\ttxq->buf_frames[idx_frame];\n-\t\t\t\ttxq->cnt_unsent -= cnt_sent;\n-\t\t\t}\n-\t\t\trte_spinlock_unlock(&ptr_port->lock);\n-\t\t} /* end for( idx_port ) */\n-\t} /* end for(;;) */\n-\n-\treturn 0;\n-}\n-\n-int main(int argc, char **argv)\n-{\n-\tint cnt_args_parsed;\n-\tuint32_t id_core;\n-\tuint32_t cnt_ports;\n-\n-\t/* Init runtime enviornment */\n-\tcnt_args_parsed = rte_eal_init(argc, argv);\n-\tif (cnt_args_parsed < 0)\n-\t\trte_exit(EXIT_FAILURE, \"rte_eal_init(): Failed\");\n-\n-\tcnt_ports = rte_eth_dev_count();\n-\tprintf(\"Number of NICs: %i\\n\", cnt_ports);\n-\tif (cnt_ports == 0)\n-\t\trte_exit(EXIT_FAILURE, \"No available NIC ports!\\n\");\n-\tif (cnt_ports > MAX_PORTS) {\n-\t\tprintf(\"Info: Using only %i of %i ports\\n\",\n-\t\t\tcnt_ports, MAX_PORTS\n-\t\t\t);\n-\t\tcnt_ports = MAX_PORTS;\n-\t}\n-\n-\tsetup_ports(&app_cfg, cnt_ports);\n-\n-\tapp_cfg.exit_now = 0;\n-\tapp_cfg.cnt_ports = cnt_ports;\n-\n-\tif (rte_lcore_count() < 2)\n-\t\trte_exit(EXIT_FAILURE, \"No available slave core!\\n\");\n-\t/* Assume there is an available slave.. */\n-\tid_core = rte_lcore_id();\n-\tid_core = rte_get_next_lcore(id_core, 1, 1);\n-\trte_eal_remote_launch(slave_main, NULL, id_core);\n-\n-\tethapp_main();\n-\n-\tapp_cfg.exit_now = 1;\n-\tRTE_LCORE_FOREACH_SLAVE(id_core) {\n-\t\tif (rte_eal_wait_lcore(id_core) < 0)\n-\t\t\treturn -1;\n-\t}\n-\n-\treturn 0;\n-}\ndiff --git a/examples/ethtool/lib/Makefile b/examples/ethtool/lib/Makefile\ndeleted file mode 100644\nindex d7ee955..0000000\n--- a/examples/ethtool/lib/Makefile\n+++ /dev/null\n@@ -1,57 +0,0 @@\n-#   BSD LICENSE\n-#\n-#   Copyright(c) 2015 Intel Corporation. All rights reserved.\n-#   All rights reserved.\n-#\n-#   Redistribution and use in source and binary forms, with or without\n-#   modification, are permitted provided that the following conditions\n-#   are met:\n-#\n-#     * Redistributions of source code must retain the above copyright\n-#       notice, this list of conditions and the following disclaimer.\n-#     * Redistributions in binary form must reproduce the above copyright\n-#       notice, this list of conditions and the following disclaimer in\n-#       the documentation and/or other materials provided with the\n-#       distribution.\n-#     * Neither the name of Intel Corporation nor the names of its\n-#       contributors may be used to endorse or promote products derived\n-#       from this software without specific prior written permission.\n-#\n-#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n-#   \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n-#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n-#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n-#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n-#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n-#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n-#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n-#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n-#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n-#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n-\n-ifeq ($(RTE_SDK),)\n-$(error \"Please define RTE_SDK environment variable\")\n-endif\n-\n-# Default target, can be overwritten by command line or environment\n-RTE_TARGET ?= x86_64-native-linuxapp-gcc\n-\n-include $(RTE_SDK)/mk/rte.vars.mk\n-\n-ifneq ($(CONFIG_RTE_EXEC_ENV),\"linuxapp\")\n-$(error This application can only operate in a linuxapp environment, \\\n-please change the definition of the RTE_TARGET environment variable)\n-endif\n-\n-# library name\n-LIB = librte_ethtool.a\n-\n-LIBABIVER := 1\n-\n-# all source are stored in SRC-Y\n-SRCS-y := rte_ethtool.c\n-\n-CFLAGS += -O3\n-CFLAGS += $(WERROR_FLAGS)\n-\n-include $(RTE_SDK)/mk/rte.extlib.mk\ndiff --git a/examples/ethtool/lib/rte_ethtool.c b/examples/ethtool/lib/rte_ethtool.c\ndeleted file mode 100644\nindex 42e05f1..0000000\n--- a/examples/ethtool/lib/rte_ethtool.c\n+++ /dev/null\n@@ -1,423 +0,0 @@\n-/*-\n- *   BSD LICENSE\n- *\n- *   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.\n- *   All rights reserved.\n- *\n- *   Redistribution and use in source and binary forms, with or without\n- *   modification, are permitted provided that the following conditions\n- *   are met:\n- *\n- *     * Redistributions of source code must retain the above copyright\n- *       notice, this list of conditions and the following disclaimer.\n- *     * Redistributions in binary form must reproduce the above copyright\n- *       notice, this list of conditions and the following disclaimer in\n- *       the documentation and/or other materials provided with the\n- *       distribution.\n- *     * Neither the name of Intel Corporation nor the names of its\n- *       contributors may be used to endorse or promote products derived\n- *       from this software without specific prior written permission.\n- *\n- *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n- *   \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n- *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n- *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n- *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n- *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n- *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n- *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n- *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n- *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n- *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n- */\n-#include <stdio.h>\n-#include <string.h>\n-#include <stdint.h>\n-#include <rte_version.h>\n-#include <rte_ethdev.h>\n-#include <rte_ether.h>\n-#include \"rte_ethtool.h\"\n-\n-#define PKTPOOL_SIZE 512\n-#define PKTPOOL_CACHE 32\n-\n-\n-int\n-rte_ethtool_get_drvinfo(uint8_t port_id, struct ethtool_drvinfo *drvinfo)\n-{\n-\tstruct rte_eth_dev_info dev_info;\n-\tint n;\n-\n-\tif (drvinfo == NULL)\n-\t\treturn -EINVAL;\n-\n-\tif (!rte_eth_dev_is_valid_port(port_id))\n-\t\treturn -ENODEV;\n-\n-\tmemset(&dev_info, 0, sizeof(dev_info));\n-\trte_eth_dev_info_get(port_id, &dev_info);\n-\n-\tsnprintf(drvinfo->driver, sizeof(drvinfo->driver), \"%s\",\n-\t\tdev_info.driver_name);\n-\tsnprintf(drvinfo->version, sizeof(drvinfo->version), \"%s\",\n-\t\trte_version());\n-\tsnprintf(drvinfo->bus_info, sizeof(drvinfo->bus_info),\n-\t\t\"%04x:%02x:%02x.%x\",\n-\t\tdev_info.pci_dev->addr.domain, dev_info.pci_dev->addr.bus,\n-\t\tdev_info.pci_dev->addr.devid, dev_info.pci_dev->addr.function);\n-\n-\tn = rte_eth_dev_get_reg_length(port_id);\n-\tif (n > 0)\n-\t\tdrvinfo->regdump_len = n;\n-\telse\n-\t\tdrvinfo->regdump_len = 0;\n-\n-\tn = rte_eth_dev_get_eeprom_length(port_id);\n-\tif (n > 0)\n-\t\tdrvinfo->eedump_len = n;\n-\telse\n-\t\tdrvinfo->eedump_len = 0;\n-\n-\tdrvinfo->n_stats = sizeof(struct rte_eth_stats) / sizeof(uint64_t);\n-\tdrvinfo->testinfo_len = 0;\n-\n-\treturn 0;\n-}\n-\n-int\n-rte_ethtool_get_regs_len(uint8_t port_id)\n-{\n-\tint count_regs;\n-\n-\tcount_regs = rte_eth_dev_get_reg_length(port_id);\n-\tif (count_regs > 0)\n-\t\treturn count_regs * sizeof(uint32_t);\n-\treturn count_regs;\n-}\n-\n-int\n-rte_ethtool_get_regs(uint8_t port_id, struct ethtool_regs *regs, void *data)\n-{\n-\tstruct rte_dev_reg_info reg_info;\n-\tint status;\n-\n-\tif (regs == NULL || data == NULL)\n-\t\treturn -EINVAL;\n-\n-\treg_info.data = data;\n-\treg_info.length = 0;\n-\n-\tstatus = rte_eth_dev_get_reg_info(port_id, &reg_info);\n-\tif (status)\n-\t\treturn status;\n-\tregs->version = reg_info.version;\n-\n-\treturn 0;\n-}\n-\n-int\n-rte_ethtool_get_link(uint8_t port_id)\n-{\n-\tstruct rte_eth_link link;\n-\n-\tif (!rte_eth_dev_is_valid_port(port_id))\n-\t\treturn -ENODEV;\n-\trte_eth_link_get(port_id, &link);\n-\treturn link.link_status;\n-}\n-\n-int\n-rte_ethtool_get_eeprom_len(uint8_t port_id)\n-{\n-\treturn rte_eth_dev_get_eeprom_length(port_id);\n-}\n-\n-int\n-rte_ethtool_get_eeprom(uint8_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_eeprom(port_id, &eeprom_info);\n-\tif (status)\n-\t\treturn status;\n-\n-\teeprom->magic = eeprom_info.magic;\n-\n-\treturn 0;\n-}\n-\n-int\n-rte_ethtool_set_eeprom(uint8_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 || eeprom->offset >= eeprom->len)\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_set_eeprom(port_id, &eeprom_info);\n-\tif (status)\n-\t\treturn status;\n-\n-\teeprom->magic = eeprom_info.magic;\n-\n-\treturn 0;\n-}\n-\n-int\n-rte_ethtool_get_pauseparam(uint8_t port_id,\n-\tstruct ethtool_pauseparam *pause_param)\n-{\n-\tstruct rte_eth_fc_conf fc_conf;\n-\tint status;\n-\n-\tif (pause_param == NULL)\n-\t\treturn -EINVAL;\n-\n-\tstatus = rte_eth_dev_flow_ctrl_get(port_id, &fc_conf);\n-\tif (status)\n-\t\treturn status;\n-\n-\tpause_param->tx_pause = 0;\n-\tpause_param->rx_pause = 0;\n-\tswitch (fc_conf.mode) {\n-\tcase RTE_FC_RX_PAUSE:\n-\t\tpause_param->rx_pause = 1;\n-\t\tbreak;\n-\tcase RTE_FC_TX_PAUSE:\n-\t\tpause_param->tx_pause = 1;\n-\t\tbreak;\n-\tcase RTE_FC_FULL:\n-\t\tpause_param->rx_pause = 1;\n-\t\tpause_param->tx_pause = 1;\n-\tdefault:\n-\t\t/* dummy block to avoid compiler warning */\n-\t\tbreak;\n-\t}\n-\tpause_param->autoneg = (uint32_t)fc_conf.autoneg;\n-\n-\treturn 0;\n-}\n-\n-int\n-rte_ethtool_set_pauseparam(uint8_t port_id,\n-\tstruct ethtool_pauseparam *pause_param)\n-{\n-\tstruct rte_eth_fc_conf fc_conf;\n-\tint status;\n-\n-\tif (pause_param == NULL)\n-\t\treturn -EINVAL;\n-\n-\t/*\n-\t * Read device flow control parameter first since\n-\t * ethtool set_pauseparam op doesn't have all the information.\n-\t * as defined in struct rte_eth_fc_conf.\n-\t * This API requires the device to support both\n-\t * rte_eth_dev_flow_ctrl_get and rte_eth_dev_flow_ctrl_set, otherwise\n-\t * return -ENOTSUP\n-\t */\n-\tstatus = rte_eth_dev_flow_ctrl_get(port_id, &fc_conf);\n-\tif (status)\n-\t\treturn status;\n-\n-\tfc_conf.autoneg = (uint8_t)pause_param->autoneg;\n-\n-\tif (pause_param->tx_pause) {\n-\t\tif (pause_param->rx_pause)\n-\t\t\tfc_conf.mode = RTE_FC_FULL;\n-\t\telse\n-\t\t\tfc_conf.mode = RTE_FC_TX_PAUSE;\n-\t} else {\n-\t\tif (pause_param->rx_pause)\n-\t\t\tfc_conf.mode = RTE_FC_RX_PAUSE;\n-\t\telse\n-\t\t\tfc_conf.mode = RTE_FC_NONE;\n-\t}\n-\n-\tstatus = rte_eth_dev_flow_ctrl_set(port_id, &fc_conf);\n-\tif (status)\n-\t\treturn status;\n-\n-\treturn 0;\n-}\n-\n-int\n-rte_ethtool_net_open(uint8_t port_id)\n-{\n-\trte_eth_dev_stop(port_id);\n-\n-\treturn rte_eth_dev_start(port_id);\n-}\n-\n-int\n-rte_ethtool_net_stop(uint8_t port_id)\n-{\n-\tif (!rte_eth_dev_is_valid_port(port_id))\n-\t\treturn -ENODEV;\n-\trte_eth_dev_stop(port_id);\n-\n-\treturn 0;\n-}\n-\n-int\n-rte_ethtool_net_get_mac_addr(uint8_t port_id, struct ether_addr *addr)\n-{\n-\tif (!rte_eth_dev_is_valid_port(port_id))\n-\t\treturn -ENODEV;\n-\tif (addr == NULL)\n-\t\treturn -EINVAL;\n-\trte_eth_macaddr_get(port_id, addr);\n-\n-\treturn 0;\n-}\n-\n-int\n-rte_ethtool_net_set_mac_addr(uint8_t port_id, struct ether_addr *addr)\n-{\n-\tif (addr == NULL)\n-\t\treturn -EINVAL;\n-\treturn rte_eth_dev_default_mac_addr_set(port_id, addr);\n-}\n-\n-int\n-rte_ethtool_net_validate_addr(uint8_t port_id __rte_unused,\n-\tstruct ether_addr *addr)\n-{\n-\tif (addr == NULL)\n-\t\treturn -EINVAL;\n-\treturn is_valid_assigned_ether_addr(addr);\n-}\n-\n-int\n-rte_ethtool_net_change_mtu(uint8_t port_id, int mtu)\n-{\n-\tif (mtu < 0 || mtu > UINT16_MAX)\n-\t\treturn -EINVAL;\n-\treturn rte_eth_dev_set_mtu(port_id, (uint16_t)mtu);\n-}\n-\n-int\n-rte_ethtool_net_get_stats64(uint8_t port_id, struct rte_eth_stats *stats)\n-{\n-\tif (stats == NULL)\n-\t\treturn -EINVAL;\n-\treturn rte_eth_stats_get(port_id, stats);\n-}\n-\n-int\n-rte_ethtool_net_vlan_rx_add_vid(uint8_t port_id, uint16_t vid)\n-{\n-\treturn rte_eth_dev_vlan_filter(port_id, vid, 1);\n-}\n-\n-int\n-rte_ethtool_net_vlan_rx_kill_vid(uint8_t port_id, uint16_t vid)\n-{\n-\treturn rte_eth_dev_vlan_filter(port_id, vid, 0);\n-}\n-\n-/*\n- * The set_rx_mode provides driver-specific rx mode setting.\n- * This implementation implements rx mode setting based upon\n- * ixgbe/igb drivers. Further improvement is to provide a\n- * callback op field over struct rte_eth_dev::dev_ops so each\n- * driver can register device-specific implementation\n- */\n-int\n-rte_ethtool_net_set_rx_mode(uint8_t port_id)\n-{\n-\tuint16_t num_vfs;\n-\tstruct rte_eth_dev_info dev_info;\n-\tuint16_t vf;\n-\n-\tmemset(&dev_info, 0, sizeof(dev_info));\n-\trte_eth_dev_info_get(port_id, &dev_info);\n-\tnum_vfs = dev_info.max_vfs;\n-\n-\t/* Set VF vf_rx_mode, VF unsupport status is discard */\n-\tfor (vf = 0; vf < num_vfs; vf++)\n-\t\trte_eth_dev_set_vf_rxmode(port_id, vf,\n-\t\t\tETH_VMDQ_ACCEPT_UNTAG, 0);\n-\n-\t/* Enable Rx vlan filter, VF unspport status is discard */\n-\trte_eth_dev_set_vlan_offload(port_id, ETH_VLAN_FILTER_MASK);\n-\n-\treturn 0;\n-}\n-\n-\n-int\n-rte_ethtool_get_ringparam(uint8_t port_id,\n-\tstruct ethtool_ringparam *ring_param)\n-{\n-\tstruct rte_eth_dev_info dev_info;\n-\tstruct rte_eth_rxq_info rx_qinfo;\n-\tstruct rte_eth_txq_info tx_qinfo;\n-\tint stat;\n-\n-\tif (ring_param == NULL)\n-\t\treturn -EINVAL;\n-\n-\trte_eth_dev_info_get(port_id, &dev_info);\n-\n-\tstat = rte_eth_rx_queue_info_get(port_id, 0, &rx_qinfo);\n-\tif (stat != 0)\n-\t\treturn stat;\n-\n-\tstat = rte_eth_tx_queue_info_get(port_id, 0, &tx_qinfo);\n-\tif (stat != 0)\n-\t\treturn stat;\n-\n-\tmemset(ring_param, 0, sizeof(*ring_param));\n-\tring_param->rx_pending = rx_qinfo.nb_desc;\n-\tring_param->rx_max_pending = dev_info.rx_desc_lim.nb_max;\n-\tring_param->tx_pending = tx_qinfo.nb_desc;\n-\tring_param->tx_max_pending = dev_info.tx_desc_lim.nb_max;\n-\n-\treturn 0;\n-}\n-\n-\n-int\n-rte_ethtool_set_ringparam(uint8_t port_id,\n-\tstruct ethtool_ringparam *ring_param)\n-{\n-\tstruct rte_eth_rxq_info rx_qinfo;\n-\tint stat;\n-\n-\tif (ring_param == NULL)\n-\t\treturn -EINVAL;\n-\n-\tstat = rte_eth_rx_queue_info_get(port_id, 0, &rx_qinfo);\n-\tif (stat != 0)\n-\t\treturn stat;\n-\n-\trte_eth_dev_stop(port_id);\n-\n-\tstat = rte_eth_tx_queue_setup(port_id, 0, ring_param->tx_pending,\n-\t\trte_socket_id(), NULL);\n-\tif (stat != 0)\n-\t\treturn stat;\n-\n-\tstat = rte_eth_rx_queue_setup(port_id, 0, ring_param->rx_pending,\n-\t\trte_socket_id(), NULL, rx_qinfo.mp);\n-\tif (stat != 0)\n-\t\treturn stat;\n-\n-\treturn rte_eth_dev_start(port_id);\n-}\ndiff --git a/examples/ethtool/lib/rte_ethtool.h b/examples/ethtool/lib/rte_ethtool.h\ndeleted file mode 100644\nindex 2e79d45..0000000\n--- a/examples/ethtool/lib/rte_ethtool.h\n+++ /dev/null\n@@ -1,410 +0,0 @@\n-/*-\n- *   BSD LICENSE\n- *\n- *   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.\n- *   All rights reserved.\n- *\n- *   Redistribution and use in source and binary forms, with or without\n- *   modification, are permitted provided that the following conditions\n- *   are met:\n- *\n- *     * Redistributions of source code must retain the above copyright\n- *       notice, this list of conditions and the following disclaimer.\n- *     * Redistributions in binary form must reproduce the above copyright\n- *       notice, this list of conditions and the following disclaimer in\n- *       the documentation and/or other materials provided with the\n- *       distribution.\n- *     * Neither the name of Intel Corporation nor the names of its\n- *       contributors may be used to endorse or promote products derived\n- *       from this software without specific prior written permission.\n- *\n- *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n- *   \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n- *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n- *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n- *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n- *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n- *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n- *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n- *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n- *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n- *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n- */\n-\n-#ifndef _RTE_ETHTOOL_H_\n-#define _RTE_ETHTOOL_H_\n-\n-/*\n- * This new interface is designed to provide a user-space shim layer for\n- * Ethtool and Netdevice op API.\n- *\n- * rte_ethtool_get_driver:          ethtool_ops::get_driverinfo\n- * rte_ethtool_get_link:            ethtool_ops::get_link\n- * rte_ethtool_get_regs_len:        ethtool_ops::get_regs_len\n- * rte_ethtool_get_regs:            ethtool_ops::get_regs\n- * rte_ethtool_get_eeprom_len:      ethtool_ops::get_eeprom_len\n- * rte_ethtool_get_eeprom:          ethtool_ops::get_eeprom\n- * rte_ethtool_set_eeprom:          ethtool_ops::set_eeprom\n- * rte_ethtool_get_pauseparam:      ethtool_ops::get_pauseparam\n- * rte_ethtool_set_pauseparam:      ethtool_ops::set_pauseparam\n- *\n- * rte_ethtool_net_open:            net_device_ops::ndo_open\n- * rte_ethtool_net_stop:            net_device_ops::ndo_stop\n- * rte_ethtool_net_set_mac_addr:    net_device_ops::ndo_set_mac_address\n- * rte_ethtool_net_validate_addr:   net_device_ops::ndo_validate_addr\n- * rte_ethtool_net_change_mtu:      net_device_ops::rte_net_change_mtu\n- * rte_ethtool_net_get_stats64:     net_device_ops::ndo_get_stats64\n- * rte_ethtool_net_vlan_rx_add_vid  net_device_ops::ndo_vlan_rx_add_vid\n- * rte_ethtool_net_vlan_rx_kill_vid net_device_ops::ndo_vlan_rx_kill_vid\n- * rte_ethtool_net_set_rx_mode      net_device_ops::ndo_set_rx_mode\n- *\n- */\n-#ifdef __cplusplus\n-extern \"C\" {\n-#endif\n-\n-#include <stdint.h>\n-#include <rte_ethdev.h>\n-#include <linux/ethtool.h>\n-\n-/**\n- * Retrieve the Ethernet device driver information according to\n- * attributes described by ethtool data structure, ethtool_drvinfo.\n- *\n- * @param port_id\n- *   The port identifier of the Ethernet device.\n- * @param drvinfo\n- *   A pointer to get driver information\n- * @return\n- *   - (0) if successful.\n- *   - (-ENODEV) if *port_id* invalid.\n- */\n-int rte_ethtool_get_drvinfo(uint8_t port_id, struct ethtool_drvinfo *drvinfo);\n-\n-/**\n- * Retrieve the Ethernet device register length in bytes.\n- *\n- * @param port_id\n- *   The port identifier of the Ethernet device.\n- * @return\n- *   - (> 0) # of device registers (in bytes) available for dump\n- *   - (0) no registers available for dump.\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_regs_len(uint8_t port_id);\n-\n-/**\n- * Retrieve the Ethernet device register information according to\n- * attributes described by ethtool data structure, ethtool_regs\n- *\n- * @param port_id\n- *   The port identifier of the Ethernet device.\n- * @param reg\n- *   A pointer to ethtool_regs that has register information\n- * @param data\n- *   A pointer to a buffer that is used to retrieve device register content\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_regs(uint8_t port_id, struct ethtool_regs *regs,\n-\t\t\t    void *data);\n-\n-/**\n- * Retrieve the Ethernet device link status\n- *\n- * @param port_id\n- *   The port identifier of the Ethernet device.\n- * @return\n- *   - (1) if link up.\n- *   - (0) if link down.\n- *   - (-ENOTSUP) if hardware doesn't support.\n- *   - (-ENODEV) if *port_id* invalid.\n- *   - (-EINVAL) if parameters invalid.\n- *   - others depends on the specific operations implementation.\n- */\n-int rte_ethtool_get_link(uint8_t port_id);\n-\n-/**\n- * Retrieve the Ethernet device EEPROM size\n- *\n- * @param port_id\n- *   The port identifier of the Ethernet device.\n- * @return\n- *\t - (> 0) device EEPROM size in bytes\n- *   - (0) device has NO EEPROM\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_eeprom_len(uint8_t port_id);\n-\n-/**\n- * Retrieve EEPROM content based upon eeprom range described in ethtool\n- * data structure, ethtool_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 eeprom range\n- * @param words\n- *\t A buffer that holds data read from 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_eeprom(uint8_t port_id, struct ethtool_eeprom *eeprom,\n-\t\t\t      void *words);\n-\n-/**\n- * Setting EEPROM content based upon eeprom range described in ethtool\n- * data structure, ethtool_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 eeprom range\n- * @param words\n- *\t A buffer that holds data to be written into eeprom\n- * @return\n- *   - (0) if successful.\n- *   - (-ENOTSUP) if hardware doesn't support.\n- *   - (-ENODEV) if *port_id* invalid.\n- *   - (-EINVAL) if parameters invalid.\n- *   - others depends on the specific operations implementation.\n- */\n-int rte_ethtool_set_eeprom(uint8_t port_id, struct ethtool_eeprom *eeprom,\n-\t\t\t      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- *\n- * @param port_id\n- *   The port identifier of the Ethernet device.\n- * @param pause_param\n- *\t The pointer of ethtool_coalesce that gets pause frame\n- *\t configuration parameters\n- * @return\n- *   - (0) if successful.\n- *   - (-ENOTSUP) if hardware doesn't support.\n- *   - (-ENODEV) if *port_id* invalid.\n- *   - (-EINVAL) if parameters invalid.\n- *   - others depends on the specific operations implementation.\n- */\n-int rte_ethtool_get_pauseparam(uint8_t port_id,\n-\t\t\t\t   struct ethtool_pauseparam *pause_param);\n-\n-/**\n- * Setting the Ethernet device pause frame configuration according to\n- * parameter attributes desribed by ethtool data structure, ethtool_pauseparam.\n- *\n- * @param port_id\n- *   The port identifier of the Ethernet device.\n- * @param pause_param\n- *\t The pointer of ethtool_coalesce that gets ring configuration parameters\n- * @return\n- *   - (0) if successful.\n- *   - (-ENOTSUP) if hardware doesn't support.\n- *   - (-ENODEV) if *port_id* invalid.\n- *   - (-EINVAL) if parameters invalid.\n- *   - others depends on the specific operations implementation.\n- */\n-int rte_ethtool_set_pauseparam(uint8_t port_id,\n-\t\t\t\t   struct ethtool_pauseparam *param);\n-\n-/**\n- * Start the Ethernet device.\n- *\n- * @param port_id\n- *   The port identifier of the Ethernet device.\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_net_open(uint8_t port_id);\n-\n-/**\n- * Stop the Ethernet device.\n- *\n- * @param port_id\n- *   The port identifier of the Ethernet device.\n- * @return\n- *   - (0) if successful.\n- *   - (-ENODEV) if *port_id* invalid.\n- */\n-int rte_ethtool_net_stop(uint8_t port_id);\n-\n-/**\n- * Get the Ethernet device MAC address.\n- *\n- * @param port_id\n- *   The port identifier of the Ethernet device.\n- * @param addr\n- *\t MAC address of the Ethernet device.\n- * @return\n- *   - (0) if successful.\n- *   - (-ENODEV) if *port_id* invalid.\n- */\n-int rte_ethtool_net_get_mac_addr(uint8_t port_id, struct ether_addr *addr);\n-\n-/**\n- * Setting the Ethernet device MAC address.\n- *\n- * @param port_id\n- *   The port identifier of the Ethernet device.\n- * @param addr\n- *\t The new MAC addr.\n- * @return\n- *   - (0) if successful.\n- *   - (-ENOTSUP) if hardware doesn't support.\n- *   - (-ENODEV) if *port_id* invalid.\n- *   - (-EINVAL) if parameters invalid.\n- *   - others depends on the specific operations implementation.\n- */\n-int rte_ethtool_net_set_mac_addr(uint8_t port_id, struct ether_addr *addr);\n-\n-/**\n- * Validate if the provided MAC address is valid unicast address\n- *\n- * @param port_id\n- *   The port identifier of the Ethernet device.\n- * @param addr\n- *\t A pointer to a buffer (6-byte, 48bit) for the target MAC address\n- * @return\n- *   - (0) if successful.\n- *   - (-ENOTSUP) if hardware doesn't support.\n- *   - (-ENODEV) if *port_id* invalid.\n- *   - (-EINVAL) if parameters invalid.\n- *   - others depends on the specific operations implementation.\n- */\n-int rte_ethtool_net_validate_addr(uint8_t port_id, struct ether_addr *addr);\n-\n-/**\n- * Setting the Ethernet device maximum Tx unit.\n- *\n- * @param port_id\n- *   The port identifier of the Ethernet device.\n- * @param mtu\n- *\t New MTU\n- * @return\n- *   - (0) if successful.\n- *   - (-ENOTSUP) if hardware doesn't support.\n- *   - (-ENODEV) if *port_id* invalid.\n- *   - (-EINVAL) if parameters invalid.\n- *   - others depends on the specific operations implementation.\n- */\n-int rte_ethtool_net_change_mtu(uint8_t port_id, int mtu);\n-\n-/**\n- * Retrieve the Ethernet device traffic statistics\n- *\n- * @param port_id\n- *   The port identifier of the Ethernet device.\n- * @param stats\n- *\t A pointer to struct rte_eth_stats for statistics parameters\n- * @return\n- *   - (0) if successful.\n- *   - (-ENOTSUP) if hardware doesn't support.\n- *   - (-ENODEV) if *port_id* invalid.\n- *   - (-EINVAL) if parameters invalid.\n- *   - others depends on the specific operations implementation.\n- */\n-int rte_ethtool_net_get_stats64(uint8_t port_id, struct rte_eth_stats *stats);\n-\n-/**\n- * Update the Ethernet device VLAN filter with new vid\n- *\n- * @param port_id\n- *   The port identifier of the Ethernet device.\n- * @param vid\n- *\t A new VLAN id\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_net_vlan_rx_add_vid(uint8_t port_id, uint16_t vid);\n-\n-/**\n- * Remove VLAN id from Ethernet device.\n- *\n- * @param port_id\n- *   The port identifier of the Ethernet device.\n- * @param vid\n- *\t A new VLAN id\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_net_vlan_rx_kill_vid(uint8_t port_id, uint16_t vid);\n-\n-/**\n- * Setting the Ethernet device rx mode.\n- *\n- * @param port_id\n- *   The port identifier of the Ethernet device.\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_net_set_rx_mode(uint8_t port_id);\n-\n-/**\n- * Getting ring paramaters for Ethernet device.\n- *\n- * @param port_id\n- *   The port identifier of the Ethernet device.\n- * @param ring_param\n- *   Pointer to struct ethrool_ringparam to receive parameters.\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- * @note\n- *   Only the tx_pending and rx_pending fields of struct ethtool_ringparam\n- *   are used, and the function only gets parameters for queue 0.\n- */\n-int rte_ethtool_get_ringparam(uint8_t port_id,\n-\tstruct ethtool_ringparam *ring_param);\n-\n-/**\n- * Setting ring paramaters for Ethernet device.\n- *\n- * @param port_id\n- *   The port identifier of the Ethernet device.\n- * @param ring_param\n- *   Pointer to struct ethrool_ringparam with parameters to set.\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- * @note\n- *   Only the tx_pending and rx_pending fields of struct ethtool_ringparam\n- *   are used, and the function only sets parameters for queue 0.\n- */\n-int rte_ethtool_set_ringparam(uint8_t port_id,\n-\tstruct ethtool_ringparam *ring_param);\n-\n-\n-#ifdef __cplusplus\n-}\n-#endif\n-\n-#endif /* _RTE_ETHTOOL_H_ */\ndiff --git a/examples/ethtool/main.c b/examples/ethtool/main.c\nnew file mode 100644\nindex 0000000..2c655d8\n--- /dev/null\n+++ b/examples/ethtool/main.c\n@@ -0,0 +1,305 @@\n+/*-\n+ *   BSD LICENSE\n+ *\n+ *   Copyright(c) 2015 Intel Corporation. All rights reserved.\n+ *   All rights reserved.\n+ *\n+ *   Redistribution and use in source and binary forms, with or without\n+ *   modification, are permitted provided that the following conditions\n+ *   are met:\n+ *\n+ *     * Redistributions of source code must retain the above copyright\n+ *       notice, this list of conditions and the following disclaimer.\n+ *     * Redistributions in binary form must reproduce the above copyright\n+ *       notice, this list of conditions and the following disclaimer in\n+ *       the documentation and/or other materials provided with the\n+ *       distribution.\n+ *     * Neither the name of Intel Corporation nor the names of its\n+ *       contributors may be used to endorse or promote products derived\n+ *       from this software without specific prior written permission.\n+ *\n+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n+ *   \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+ */\n+\n+\n+#include <stdio.h>\n+#include <stdlib.h>\n+\n+#include <rte_common.h>\n+#include <rte_spinlock.h>\n+#include <rte_eal.h>\n+#include <rte_ethdev.h>\n+#include <rte_ether.h>\n+#include <rte_ip.h>\n+#include <rte_memory.h>\n+#include <rte_mempool.h>\n+#include <rte_mbuf.h>\n+\n+#include \"ethapp.h\"\n+\n+#define MAX_PORTS RTE_MAX_ETHPORTS\n+#define MAX_BURST_LENGTH 32\n+#define PORT_RX_QUEUE_SIZE 128\n+#define PORT_TX_QUEUE_SIZE 256\n+#define PKTPOOL_EXTRA_SIZE 512\n+#define PKTPOOL_CACHE 32\n+\n+\n+struct txq_port {\n+\tuint16_t cnt_unsent;\n+\tstruct rte_mbuf *buf_frames[MAX_BURST_LENGTH];\n+};\n+\n+struct app_port {\n+\tstruct ether_addr mac_addr;\n+\tstruct txq_port txq;\n+\trte_spinlock_t lock;\n+\tint port_active;\n+\tint port_dirty;\n+\tint idx_port;\n+\tstruct rte_mempool *pkt_pool;\n+};\n+\n+struct app_config {\n+\tstruct app_port ports[MAX_PORTS];\n+\tint cnt_ports;\n+\tint exit_now;\n+};\n+\n+\n+struct app_config app_cfg;\n+\n+\n+void lock_port(int idx_port)\n+{\n+\tstruct app_port *ptr_port = &app_cfg.ports[idx_port];\n+\n+\trte_spinlock_lock(&ptr_port->lock);\n+}\n+\n+void unlock_port(int idx_port)\n+{\n+\tstruct app_port *ptr_port = &app_cfg.ports[idx_port];\n+\n+\trte_spinlock_unlock(&ptr_port->lock);\n+}\n+\n+void mark_port_active(int idx_port)\n+{\n+\tstruct app_port *ptr_port = &app_cfg.ports[idx_port];\n+\n+\tptr_port->port_active = 1;\n+}\n+\n+void mark_port_inactive(int idx_port)\n+{\n+\tstruct app_port *ptr_port = &app_cfg.ports[idx_port];\n+\n+\tptr_port->port_active = 0;\n+}\n+\n+void mark_port_newmac(int idx_port)\n+{\n+\tstruct app_port *ptr_port = &app_cfg.ports[idx_port];\n+\n+\tptr_port->port_dirty = 1;\n+}\n+\n+static void setup_ports(struct app_config *app_cfg, int cnt_ports)\n+{\n+\tint idx_port;\n+\tint size_pktpool;\n+\tstruct rte_eth_conf cfg_port;\n+\tstruct rte_eth_dev_info dev_info;\n+\tchar str_name[16];\n+\n+\tmemset(&cfg_port, 0, sizeof(cfg_port));\n+\tcfg_port.txmode.mq_mode = ETH_MQ_TX_NONE;\n+\n+\tfor (idx_port = 0; idx_port < cnt_ports; idx_port++) {\n+\t\tstruct app_port *ptr_port = &app_cfg->ports[idx_port];\n+\n+\t\trte_eth_dev_info_get(idx_port, &dev_info);\n+\t\tsize_pktpool = dev_info.rx_desc_lim.nb_max +\n+\t\t\tdev_info.tx_desc_lim.nb_max + PKTPOOL_EXTRA_SIZE;\n+\n+\t\tsnprintf(str_name, 16, \"pkt_pool%i\", idx_port);\n+\t\tptr_port->pkt_pool = rte_pktmbuf_pool_create(\n+\t\t\tstr_name,\n+\t\t\tsize_pktpool, PKTPOOL_CACHE,\n+\t\t\t0,\n+\t\t\tRTE_MBUF_DEFAULT_BUF_SIZE,\n+\t\t\trte_socket_id()\n+\t\t\t);\n+\t\tif (ptr_port->pkt_pool == NULL)\n+\t\t\trte_exit(EXIT_FAILURE,\n+\t\t\t\t\"rte_pktmbuf_pool_create failed\"\n+\t\t\t\t);\n+\n+\t\tprintf(\"Init port %i..\\n\", idx_port);\n+\t\tptr_port->port_active = 1;\n+\t\tptr_port->port_dirty = 0;\n+\t\tptr_port->idx_port = idx_port;\n+\n+\t\tif (rte_eth_dev_configure(idx_port, 1, 1, &cfg_port) < 0)\n+\t\t\trte_exit(EXIT_FAILURE,\n+\t\t\t\t \"rte_eth_dev_configure failed\");\n+\t\tif (rte_eth_rx_queue_setup(\n+\t\t\t    idx_port, 0, PORT_RX_QUEUE_SIZE,\n+\t\t\t    rte_eth_dev_socket_id(idx_port), NULL,\n+\t\t\t    ptr_port->pkt_pool) < 0)\n+\t\t\trte_exit(EXIT_FAILURE,\n+\t\t\t\t \"rte_eth_rx_queue_setup failed\"\n+\t\t\t\t);\n+\t\tif (rte_eth_tx_queue_setup(\n+\t\t\t    idx_port, 0, PORT_TX_QUEUE_SIZE,\n+\t\t\t    rte_eth_dev_socket_id(idx_port), NULL) < 0)\n+\t\t\trte_exit(EXIT_FAILURE,\n+\t\t\t\t \"rte_eth_tx_queue_setup failed\"\n+\t\t\t\t);\n+\t\tif (rte_eth_dev_start(idx_port) < 0)\n+\t\t\trte_exit(EXIT_FAILURE,\n+\t\t\t\t \"%s:%i: rte_eth_dev_start failed\",\n+\t\t\t\t __FILE__, __LINE__\n+\t\t\t\t);\n+\t\trte_eth_promiscuous_enable(idx_port);\n+\t\trte_eth_macaddr_get(idx_port, &ptr_port->mac_addr);\n+\t\trte_spinlock_init(&ptr_port->lock);\n+\t}\n+}\n+\n+static void process_frame(struct app_port *ptr_port,\n+\tstruct rte_mbuf *ptr_frame)\n+{\n+\tstruct ether_hdr *ptr_mac_hdr;\n+\n+\tptr_mac_hdr = rte_pktmbuf_mtod(ptr_frame, struct ether_hdr *);\n+\tether_addr_copy(&ptr_mac_hdr->s_addr, &ptr_mac_hdr->d_addr);\n+\tether_addr_copy(&ptr_port->mac_addr, &ptr_mac_hdr->s_addr);\n+}\n+\n+static int slave_main(__attribute__((unused)) void *ptr_data)\n+{\n+\tstruct app_port *ptr_port;\n+\tstruct rte_mbuf *ptr_frame;\n+\tstruct txq_port *txq;\n+\n+\tuint16_t cnt_recv_frames;\n+\tuint16_t idx_frame;\n+\tuint16_t cnt_sent;\n+\tuint16_t idx_port;\n+\tuint16_t lock_result;\n+\n+\twhile (app_cfg.exit_now == 0) {\n+\t\tfor (idx_port = 0; idx_port < app_cfg.cnt_ports; idx_port++) {\n+\t\t\t/* Check that port is active and unlocked */\n+\t\t\tptr_port = &app_cfg.ports[idx_port];\n+\t\t\tlock_result = rte_spinlock_trylock(&ptr_port->lock);\n+\t\t\tif (lock_result == 0)\n+\t\t\t\tcontinue;\n+\t\t\tif (ptr_port->port_active == 0) {\n+\t\t\t\trte_spinlock_unlock(&ptr_port->lock);\n+\t\t\t\tcontinue;\n+\t\t\t}\n+\t\t\ttxq = &ptr_port->txq;\n+\n+\t\t\t/* MAC address was updated */\n+\t\t\tif (ptr_port->port_dirty == 1) {\n+\t\t\t\trte_eth_macaddr_get(ptr_port->idx_port,\n+\t\t\t\t\t&ptr_port->mac_addr);\n+\t\t\t\tptr_port->port_dirty = 0;\n+\t\t\t}\n+\n+\t\t\t/* Incoming frames */\n+\t\t\tcnt_recv_frames = rte_eth_rx_burst(\n+\t\t\t\tptr_port->idx_port, 0,\n+\t\t\t\t&txq->buf_frames[txq->cnt_unsent],\n+\t\t\t\tRTE_DIM(txq->buf_frames) - txq->cnt_unsent\n+\t\t\t\t);\n+\t\t\tif (cnt_recv_frames > 0) {\n+\t\t\t\tfor (idx_frame = 0;\n+\t\t\t\t\tidx_frame < cnt_recv_frames;\n+\t\t\t\t\tidx_frame++) {\n+\t\t\t\t\tptr_frame = txq->buf_frames[\n+\t\t\t\t\t\tidx_frame + txq->cnt_unsent];\n+\t\t\t\t\tprocess_frame(ptr_port, ptr_frame);\n+\t\t\t\t}\n+\t\t\t\ttxq->cnt_unsent += cnt_recv_frames;\n+\t\t\t}\n+\n+\t\t\t/* Outgoing frames */\n+\t\t\tif (txq->cnt_unsent > 0) {\n+\t\t\t\tcnt_sent = rte_eth_tx_burst(\n+\t\t\t\t\tptr_port->idx_port, 0,\n+\t\t\t\t\ttxq->buf_frames,\n+\t\t\t\t\ttxq->cnt_unsent\n+\t\t\t\t\t);\n+\t\t\t\t/* Shuffle up unsent frame pointers */\n+\t\t\t\tfor (idx_frame = cnt_sent;\n+\t\t\t\t\tidx_frame < txq->cnt_unsent;\n+\t\t\t\t\tidx_frame++)\n+\t\t\t\t\ttxq->buf_frames[idx_frame - cnt_sent] =\n+\t\t\t\t\t\ttxq->buf_frames[idx_frame];\n+\t\t\t\ttxq->cnt_unsent -= cnt_sent;\n+\t\t\t}\n+\t\t\trte_spinlock_unlock(&ptr_port->lock);\n+\t\t} /* end for( idx_port ) */\n+\t} /* end for(;;) */\n+\n+\treturn 0;\n+}\n+\n+int main(int argc, char **argv)\n+{\n+\tint cnt_args_parsed;\n+\tuint32_t id_core;\n+\tuint32_t cnt_ports;\n+\n+\t/* Init runtime enviornment */\n+\tcnt_args_parsed = rte_eal_init(argc, argv);\n+\tif (cnt_args_parsed < 0)\n+\t\trte_exit(EXIT_FAILURE, \"rte_eal_init(): Failed\");\n+\n+\tcnt_ports = rte_eth_dev_count();\n+\tprintf(\"Number of NICs: %i\\n\", cnt_ports);\n+\tif (cnt_ports == 0)\n+\t\trte_exit(EXIT_FAILURE, \"No available NIC ports!\\n\");\n+\tif (cnt_ports > MAX_PORTS) {\n+\t\tprintf(\"Info: Using only %i of %i ports\\n\",\n+\t\t\tcnt_ports, MAX_PORTS\n+\t\t\t);\n+\t\tcnt_ports = MAX_PORTS;\n+\t}\n+\n+\tsetup_ports(&app_cfg, cnt_ports);\n+\n+\tapp_cfg.exit_now = 0;\n+\tapp_cfg.cnt_ports = cnt_ports;\n+\n+\tif (rte_lcore_count() < 2)\n+\t\trte_exit(EXIT_FAILURE, \"No available slave core!\\n\");\n+\t/* Assume there is an available slave.. */\n+\tid_core = rte_lcore_id();\n+\tid_core = rte_get_next_lcore(id_core, 1, 1);\n+\trte_eal_remote_launch(slave_main, NULL, id_core);\n+\n+\tethapp_main();\n+\n+\tapp_cfg.exit_now = 1;\n+\tRTE_LCORE_FOREACH_SLAVE(id_core) {\n+\t\tif (rte_eal_wait_lcore(id_core) < 0)\n+\t\t\treturn -1;\n+\t}\n+\n+\treturn 0;\n+}\ndiff --git a/lib/Makefile b/lib/Makefile\nindex ef172ea..ce8f0f9 100644\n--- a/lib/Makefile\n+++ b/lib/Makefile\n@@ -58,6 +58,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_PORT) += librte_port\n DIRS-$(CONFIG_RTE_LIBRTE_TABLE) += librte_table\n DIRS-$(CONFIG_RTE_LIBRTE_PIPELINE) += librte_pipeline\n DIRS-$(CONFIG_RTE_LIBRTE_REORDER) += librte_reorder\n+DIRS-$(CONFIG_RTE_LIBRTE_ETHTOOL) += librte_ethtool\n \n ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)\n DIRS-$(CONFIG_RTE_LIBRTE_KNI) += librte_kni\ndiff --git a/lib/librte_ethtool/Makefile b/lib/librte_ethtool/Makefile\nnew file mode 100644\nindex 0000000..8be7105\n--- /dev/null\n+++ b/lib/librte_ethtool/Makefile\n@@ -0,0 +1,57 @@\n+#   BSD LICENSE\n+#\n+#   Copyright(c) 2015-2016 Intel Corporation. All rights reserved.\n+#   All rights reserved.\n+#\n+#   Redistribution and use in source and binary forms, with or without\n+#   modification, are permitted provided that the following conditions\n+#   are met:\n+#\n+#     * Redistributions of source code must retain the above copyright\n+#       notice, this list of conditions and the following disclaimer.\n+#     * Redistributions in binary form must reproduce the above copyright\n+#       notice, this list of conditions and the following disclaimer in\n+#       the documentation and/or other materials provided with the\n+#       distribution.\n+#     * Neither the name of Intel Corporation nor the names of its\n+#       contributors may be used to endorse or promote products derived\n+#       from this software without specific prior written permission.\n+#\n+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n+#   \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n+#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n+#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n+#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n+#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n+#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n+#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n+#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n+#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n+#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+\n+include $(RTE_SDK)/mk/rte.vars.mk\n+\n+#\n+# library name\n+#\n+LIB = librte_ethtool.a\n+\n+CFLAGS += -O3\n+CFLAGS += $(WERROR_FLAGS)\n+\n+EXPORT_MAP := rte_ethtool_version.map\n+\n+LIBABIVER := 1\n+\n+# all source are stored in SRC-Y\n+SRCS-y := rte_ethtool.c\n+\n+#\n+# Export include files\n+#\n+SYMLINK-y-include += rte_ethtool.h\n+\n+# this lib depends upon:\n+DEPDIRS-y += lib/librte_eal lib/librte_ether\n+\n+include $(RTE_SDK)/mk/rte.lib.mk\ndiff --git a/lib/librte_ethtool/rte_ethtool.c b/lib/librte_ethtool/rte_ethtool.c\nnew file mode 100644\nindex 0000000..d9c5408\n--- /dev/null\n+++ b/lib/librte_ethtool/rte_ethtool.c\n@@ -0,0 +1,423 @@\n+/*-\n+ *   BSD LICENSE\n+ *\n+ *   Copyright(c) 2010-2016 Intel Corporation. All rights reserved.\n+ *   All rights reserved.\n+ *\n+ *   Redistribution and use in source and binary forms, with or without\n+ *   modification, are permitted provided that the following conditions\n+ *   are met:\n+ *\n+ *     * Redistributions of source code must retain the above copyright\n+ *       notice, this list of conditions and the following disclaimer.\n+ *     * Redistributions in binary form must reproduce the above copyright\n+ *       notice, this list of conditions and the following disclaimer in\n+ *       the documentation and/or other materials provided with the\n+ *       distribution.\n+ *     * Neither the name of Intel Corporation nor the names of its\n+ *       contributors may be used to endorse or promote products derived\n+ *       from this software without specific prior written permission.\n+ *\n+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n+ *   \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+ */\n+#include <stdio.h>\n+#include <string.h>\n+#include <stdint.h>\n+#include <rte_version.h>\n+#include <rte_ethdev.h>\n+#include <rte_ether.h>\n+#include \"rte_ethtool.h\"\n+\n+#define PKTPOOL_SIZE 512\n+#define PKTPOOL_CACHE 32\n+\n+\n+int\n+rte_ethtool_get_drvinfo(uint8_t port_id, struct ethtool_drvinfo *drvinfo)\n+{\n+\tstruct rte_eth_dev_info dev_info;\n+\tint n;\n+\n+\tif (drvinfo == NULL)\n+\t\treturn -EINVAL;\n+\n+\tif (!rte_eth_dev_is_valid_port(port_id))\n+\t\treturn -ENODEV;\n+\n+\tmemset(&dev_info, 0, sizeof(dev_info));\n+\trte_eth_dev_info_get(port_id, &dev_info);\n+\n+\tsnprintf(drvinfo->driver, sizeof(drvinfo->driver), \"%s\",\n+\t\tdev_info.driver_name);\n+\tsnprintf(drvinfo->version, sizeof(drvinfo->version), \"%s\",\n+\t\trte_version());\n+\tsnprintf(drvinfo->bus_info, sizeof(drvinfo->bus_info),\n+\t\t\"%04x:%02x:%02x.%x\",\n+\t\tdev_info.pci_dev->addr.domain, dev_info.pci_dev->addr.bus,\n+\t\tdev_info.pci_dev->addr.devid, dev_info.pci_dev->addr.function);\n+\n+\tn = rte_eth_dev_get_reg_length(port_id);\n+\tif (n > 0)\n+\t\tdrvinfo->regdump_len = n;\n+\telse\n+\t\tdrvinfo->regdump_len = 0;\n+\n+\tn = rte_eth_dev_get_eeprom_length(port_id);\n+\tif (n > 0)\n+\t\tdrvinfo->eedump_len = n;\n+\telse\n+\t\tdrvinfo->eedump_len = 0;\n+\n+\tdrvinfo->n_stats = sizeof(struct rte_eth_stats) / sizeof(uint64_t);\n+\tdrvinfo->testinfo_len = 0;\n+\n+\treturn 0;\n+}\n+\n+int\n+rte_ethtool_get_regs_len(uint8_t port_id)\n+{\n+\tint count_regs;\n+\n+\tcount_regs = rte_eth_dev_get_reg_length(port_id);\n+\tif (count_regs > 0)\n+\t\treturn count_regs * sizeof(uint32_t);\n+\treturn count_regs;\n+}\n+\n+int\n+rte_ethtool_get_regs(uint8_t port_id, struct ethtool_regs *regs, void *data)\n+{\n+\tstruct rte_dev_reg_info reg_info;\n+\tint status;\n+\n+\tif (regs == NULL || data == NULL)\n+\t\treturn -EINVAL;\n+\n+\treg_info.data = data;\n+\treg_info.length = 0;\n+\n+\tstatus = rte_eth_dev_get_reg_info(port_id, &reg_info);\n+\tif (status)\n+\t\treturn status;\n+\tregs->version = reg_info.version;\n+\n+\treturn 0;\n+}\n+\n+int\n+rte_ethtool_get_link(uint8_t port_id)\n+{\n+\tstruct rte_eth_link link;\n+\n+\tif (!rte_eth_dev_is_valid_port(port_id))\n+\t\treturn -ENODEV;\n+\trte_eth_link_get(port_id, &link);\n+\treturn link.link_status;\n+}\n+\n+int\n+rte_ethtool_get_eeprom_len(uint8_t port_id)\n+{\n+\treturn rte_eth_dev_get_eeprom_length(port_id);\n+}\n+\n+int\n+rte_ethtool_get_eeprom(uint8_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_eeprom(port_id, &eeprom_info);\n+\tif (status)\n+\t\treturn status;\n+\n+\teeprom->magic = eeprom_info.magic;\n+\n+\treturn 0;\n+}\n+\n+int\n+rte_ethtool_set_eeprom(uint8_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 || eeprom->offset >= eeprom->len)\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_set_eeprom(port_id, &eeprom_info);\n+\tif (status)\n+\t\treturn status;\n+\n+\teeprom->magic = eeprom_info.magic;\n+\n+\treturn 0;\n+}\n+\n+int\n+rte_ethtool_get_pauseparam(uint8_t port_id,\n+\tstruct ethtool_pauseparam *pause_param)\n+{\n+\tstruct rte_eth_fc_conf fc_conf;\n+\tint status;\n+\n+\tif (pause_param == NULL)\n+\t\treturn -EINVAL;\n+\n+\tstatus = rte_eth_dev_flow_ctrl_get(port_id, &fc_conf);\n+\tif (status)\n+\t\treturn status;\n+\n+\tpause_param->tx_pause = 0;\n+\tpause_param->rx_pause = 0;\n+\tswitch (fc_conf.mode) {\n+\tcase RTE_FC_RX_PAUSE:\n+\t\tpause_param->rx_pause = 1;\n+\t\tbreak;\n+\tcase RTE_FC_TX_PAUSE:\n+\t\tpause_param->tx_pause = 1;\n+\t\tbreak;\n+\tcase RTE_FC_FULL:\n+\t\tpause_param->rx_pause = 1;\n+\t\tpause_param->tx_pause = 1;\n+\tdefault:\n+\t\t/* dummy block to avoid compiler warning */\n+\t\tbreak;\n+\t}\n+\tpause_param->autoneg = (uint32_t)fc_conf.autoneg;\n+\n+\treturn 0;\n+}\n+\n+int\n+rte_ethtool_set_pauseparam(uint8_t port_id,\n+\tstruct ethtool_pauseparam *pause_param)\n+{\n+\tstruct rte_eth_fc_conf fc_conf;\n+\tint status;\n+\n+\tif (pause_param == NULL)\n+\t\treturn -EINVAL;\n+\n+\t/*\n+\t * Read device flow control parameter first since\n+\t * ethtool set_pauseparam op doesn't have all the information.\n+\t * as defined in struct rte_eth_fc_conf.\n+\t * This API requires the device to support both\n+\t * rte_eth_dev_flow_ctrl_get and rte_eth_dev_flow_ctrl_set, otherwise\n+\t * return -ENOTSUP\n+\t */\n+\tstatus = rte_eth_dev_flow_ctrl_get(port_id, &fc_conf);\n+\tif (status)\n+\t\treturn status;\n+\n+\tfc_conf.autoneg = (uint8_t)pause_param->autoneg;\n+\n+\tif (pause_param->tx_pause) {\n+\t\tif (pause_param->rx_pause)\n+\t\t\tfc_conf.mode = RTE_FC_FULL;\n+\t\telse\n+\t\t\tfc_conf.mode = RTE_FC_TX_PAUSE;\n+\t} else {\n+\t\tif (pause_param->rx_pause)\n+\t\t\tfc_conf.mode = RTE_FC_RX_PAUSE;\n+\t\telse\n+\t\t\tfc_conf.mode = RTE_FC_NONE;\n+\t}\n+\n+\tstatus = rte_eth_dev_flow_ctrl_set(port_id, &fc_conf);\n+\tif (status)\n+\t\treturn status;\n+\n+\treturn 0;\n+}\n+\n+int\n+rte_ethtool_net_open(uint8_t port_id)\n+{\n+\trte_eth_dev_stop(port_id);\n+\n+\treturn rte_eth_dev_start(port_id);\n+}\n+\n+int\n+rte_ethtool_net_stop(uint8_t port_id)\n+{\n+\tif (!rte_eth_dev_is_valid_port(port_id))\n+\t\treturn -ENODEV;\n+\trte_eth_dev_stop(port_id);\n+\n+\treturn 0;\n+}\n+\n+int\n+rte_ethtool_net_get_mac_addr(uint8_t port_id, struct ether_addr *addr)\n+{\n+\tif (!rte_eth_dev_is_valid_port(port_id))\n+\t\treturn -ENODEV;\n+\tif (addr == NULL)\n+\t\treturn -EINVAL;\n+\trte_eth_macaddr_get(port_id, addr);\n+\n+\treturn 0;\n+}\n+\n+int\n+rte_ethtool_net_set_mac_addr(uint8_t port_id, struct ether_addr *addr)\n+{\n+\tif (addr == NULL)\n+\t\treturn -EINVAL;\n+\treturn rte_eth_dev_default_mac_addr_set(port_id, addr);\n+}\n+\n+int\n+rte_ethtool_net_validate_addr(uint8_t port_id __rte_unused,\n+\tstruct ether_addr *addr)\n+{\n+\tif (addr == NULL)\n+\t\treturn -EINVAL;\n+\treturn is_valid_assigned_ether_addr(addr);\n+}\n+\n+int\n+rte_ethtool_net_change_mtu(uint8_t port_id, int mtu)\n+{\n+\tif (mtu < 0 || mtu > UINT16_MAX)\n+\t\treturn -EINVAL;\n+\treturn rte_eth_dev_set_mtu(port_id, (uint16_t)mtu);\n+}\n+\n+int\n+rte_ethtool_net_get_stats64(uint8_t port_id, struct rte_eth_stats *stats)\n+{\n+\tif (stats == NULL)\n+\t\treturn -EINVAL;\n+\treturn rte_eth_stats_get(port_id, stats);\n+}\n+\n+int\n+rte_ethtool_net_vlan_rx_add_vid(uint8_t port_id, uint16_t vid)\n+{\n+\treturn rte_eth_dev_vlan_filter(port_id, vid, 1);\n+}\n+\n+int\n+rte_ethtool_net_vlan_rx_kill_vid(uint8_t port_id, uint16_t vid)\n+{\n+\treturn rte_eth_dev_vlan_filter(port_id, vid, 0);\n+}\n+\n+/*\n+ * The set_rx_mode provides driver-specific rx mode setting.\n+ * This implementation implements rx mode setting based upon\n+ * ixgbe/igb drivers. Further improvement is to provide a\n+ * callback op field over struct rte_eth_dev::dev_ops so each\n+ * driver can register device-specific implementation\n+ */\n+int\n+rte_ethtool_net_set_rx_mode(uint8_t port_id)\n+{\n+\tuint16_t num_vfs;\n+\tstruct rte_eth_dev_info dev_info;\n+\tuint16_t vf;\n+\n+\tmemset(&dev_info, 0, sizeof(dev_info));\n+\trte_eth_dev_info_get(port_id, &dev_info);\n+\tnum_vfs = dev_info.max_vfs;\n+\n+\t/* Set VF vf_rx_mode, VF unsupport status is discard */\n+\tfor (vf = 0; vf < num_vfs; vf++)\n+\t\trte_eth_dev_set_vf_rxmode(port_id, vf,\n+\t\t\tETH_VMDQ_ACCEPT_UNTAG, 0);\n+\n+\t/* Enable Rx vlan filter, VF unspport status is discard */\n+\trte_eth_dev_set_vlan_offload(port_id, ETH_VLAN_FILTER_MASK);\n+\n+\treturn 0;\n+}\n+\n+\n+int\n+rte_ethtool_get_ringparam(uint8_t port_id,\n+\tstruct ethtool_ringparam *ring_param)\n+{\n+\tstruct rte_eth_dev_info dev_info;\n+\tstruct rte_eth_rxq_info rx_qinfo;\n+\tstruct rte_eth_txq_info tx_qinfo;\n+\tint stat;\n+\n+\tif (ring_param == NULL)\n+\t\treturn -EINVAL;\n+\n+\trte_eth_dev_info_get(port_id, &dev_info);\n+\n+\tstat = rte_eth_rx_queue_info_get(port_id, 0, &rx_qinfo);\n+\tif (stat != 0)\n+\t\treturn stat;\n+\n+\tstat = rte_eth_tx_queue_info_get(port_id, 0, &tx_qinfo);\n+\tif (stat != 0)\n+\t\treturn stat;\n+\n+\tmemset(ring_param, 0, sizeof(*ring_param));\n+\tring_param->rx_pending = rx_qinfo.nb_desc;\n+\tring_param->rx_max_pending = dev_info.rx_desc_lim.nb_max;\n+\tring_param->tx_pending = tx_qinfo.nb_desc;\n+\tring_param->tx_max_pending = dev_info.tx_desc_lim.nb_max;\n+\n+\treturn 0;\n+}\n+\n+\n+int\n+rte_ethtool_set_ringparam(uint8_t port_id,\n+\tstruct ethtool_ringparam *ring_param)\n+{\n+\tstruct rte_eth_rxq_info rx_qinfo;\n+\tint stat;\n+\n+\tif (ring_param == NULL)\n+\t\treturn -EINVAL;\n+\n+\tstat = rte_eth_rx_queue_info_get(port_id, 0, &rx_qinfo);\n+\tif (stat != 0)\n+\t\treturn stat;\n+\n+\trte_eth_dev_stop(port_id);\n+\n+\tstat = rte_eth_tx_queue_setup(port_id, 0, ring_param->tx_pending,\n+\t\trte_socket_id(), NULL);\n+\tif (stat != 0)\n+\t\treturn stat;\n+\n+\tstat = rte_eth_rx_queue_setup(port_id, 0, ring_param->rx_pending,\n+\t\trte_socket_id(), NULL, rx_qinfo.mp);\n+\tif (stat != 0)\n+\t\treturn stat;\n+\n+\treturn rte_eth_dev_start(port_id);\n+}\ndiff --git a/lib/librte_ethtool/rte_ethtool.h b/lib/librte_ethtool/rte_ethtool.h\nnew file mode 100644\nindex 0000000..c60f7bb\n--- /dev/null\n+++ b/lib/librte_ethtool/rte_ethtool.h\n@@ -0,0 +1,413 @@\n+/*-\n+ *   BSD LICENSE\n+ *\n+ *   Copyright(c) 2010-2016 Intel Corporation. All rights reserved.\n+ *   All rights reserved.\n+ *\n+ *   Redistribution and use in source and binary forms, with or without\n+ *   modification, are permitted provided that the following conditions\n+ *   are met:\n+ *\n+ *     * Redistributions of source code must retain the above copyright\n+ *       notice, this list of conditions and the following disclaimer.\n+ *     * Redistributions in binary form must reproduce the above copyright\n+ *       notice, this list of conditions and the following disclaimer in\n+ *       the documentation and/or other materials provided with the\n+ *       distribution.\n+ *     * Neither the name of Intel Corporation nor the names of its\n+ *       contributors may be used to endorse or promote products derived\n+ *       from this software without specific prior written permission.\n+ *\n+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n+ *   \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+ */\n+\n+#ifndef _RTE_ETHTOOL_H_\n+#define _RTE_ETHTOOL_H_\n+\n+/**\n+ * @file\n+ *\n+ * This new interface is designed to provide a user-space shim layer for\n+ * Ethtool and Netdevice op API.\n+ *\n+ * rte_ethtool_get_drvinfo:         ethtool_ops::get_driverinfo \\n\n+ * rte_ethtool_get_link:            ethtool_ops::get_link \\n\n+ * rte_ethtool_get_regs_len:        ethtool_ops::get_regs_len \\n\n+ * rte_ethtool_get_regs:            ethtool_ops::get_regs \\n\n+ * rte_ethtool_get_eeprom_len:      ethtool_ops::get_eeprom_len \\n\n+ * rte_ethtool_get_eeprom:          ethtool_ops::get_eeprom \\n\n+ * rte_ethtool_set_eeprom:          ethtool_ops::set_eeprom \\n\n+ * rte_ethtool_get_pauseparam:      ethtool_ops::get_pauseparam \\n\n+ * rte_ethtool_set_pauseparam:      ethtool_ops::set_pauseparam \\n\n+ * rte_ethtool_get_ringparam:       ethtool_ops::set_ringparam \\n\n+ * rte_ethtool_set_ringparam:       ethtool_ops::set_ringparam \\n\n+ *\n+ * rte_ethtool_net_open:            net_device_ops::ndo_open \\n\n+ * rte_ethtool_net_stop:            net_device_ops::ndo_stop \\n\n+ * rte_ethtool_net_set_mac_addr:    net_device_ops::ndo_set_mac_address \\n\n+ * rte_ethtool_net_validate_addr:   net_device_ops::ndo_validate_addr \\n\n+ * rte_ethtool_net_change_mtu:      net_device_ops::rte_net_change_mtu \\n\n+ * rte_ethtool_net_get_stats64:     net_device_ops::ndo_get_stats64 \\n\n+ * rte_ethtool_net_vlan_rx_add_vid  net_device_ops::ndo_vlan_rx_add_vid \\n\n+ * rte_ethtool_net_vlan_rx_kill_vid net_device_ops::ndo_vlan_rx_kill_vid \\n\n+ * rte_ethtool_net_set_rx_mode      net_device_ops::ndo_set_rx_mode \\n\n+ *\n+ */\n+#ifdef __cplusplus\n+extern \"C\" {\n+#endif\n+\n+#include <stdint.h>\n+#include <rte_ethdev.h>\n+#include <linux/ethtool.h>\n+\n+/**\n+ * Retrieve the Ethernet device driver information according to\n+ * attributes described by ethtool data structure, ethtool_drvinfo.\n+ *\n+ * @param port_id\n+ *   The port identifier of the Ethernet device.\n+ * @param drvinfo\n+ *   A pointer to get driver information\n+ * @return\n+ *   - (0) if successful.\n+ *   - (-ENODEV) if *port_id* invalid.\n+ */\n+int rte_ethtool_get_drvinfo(uint8_t port_id, struct ethtool_drvinfo *drvinfo);\n+\n+/**\n+ * Retrieve the Ethernet device register length in bytes.\n+ *\n+ * @param port_id\n+ *   The port identifier of the Ethernet device.\n+ * @return\n+ *   - (> 0) # of device registers (in bytes) available for dump\n+ *   - (0) no registers available for dump.\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_regs_len(uint8_t port_id);\n+\n+/**\n+ * Retrieve the Ethernet device register information according to\n+ * attributes described by ethtool data structure, ethtool_regs\n+ *\n+ * @param port_id\n+ *   The port identifier of the Ethernet device.\n+ * @param regs\n+ *   A pointer to ethtool_regs that has register information\n+ * @param data\n+ *   A pointer to a buffer that is used to retrieve device register content\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_regs(uint8_t port_id, struct ethtool_regs *regs,\n+\t\tvoid *data);\n+\n+/**\n+ * Retrieve the Ethernet device link status\n+ *\n+ * @param port_id\n+ *   The port identifier of the Ethernet device.\n+ * @return\n+ *   - (1) if link up.\n+ *   - (0) if link down.\n+ *   - (-ENOTSUP) if hardware doesn't support.\n+ *   - (-ENODEV) if *port_id* invalid.\n+ *   - (-EINVAL) if parameters invalid.\n+ *   - others depends on the specific operations implementation.\n+ */\n+int rte_ethtool_get_link(uint8_t port_id);\n+\n+/**\n+ * Retrieve the Ethernet device EEPROM size\n+ *\n+ * @param port_id\n+ *   The port identifier of the Ethernet device.\n+ * @return\n+ *   - (> 0) device EEPROM size in bytes\n+ *   - (0) device has NO EEPROM\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_eeprom_len(uint8_t port_id);\n+\n+/**\n+ * Retrieve EEPROM content based upon eeprom range described in ethtool\n+ * data structure, ethtool_eeprom\n+ *\n+ * @param port_id\n+ *   The port identifier of the Ethernet device.\n+ * @param eeprom\n+ *   The pointer of ethtool_eeprom that provides eeprom range\n+ * @param words\n+ *   A buffer that holds data read from 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_eeprom(uint8_t port_id, struct ethtool_eeprom *eeprom,\n+\t\tvoid *words);\n+\n+/**\n+ * Setting EEPROM content based upon eeprom range described in ethtool\n+ * data structure, ethtool_eeprom\n+ *\n+ * @param port_id\n+ *   The port identifier of the Ethernet device.\n+ * @param eeprom\n+ *   The pointer of ethtool_eeprom that provides eeprom range\n+ * @param words\n+ *   A buffer that holds data to be written into eeprom\n+ * @return\n+ *   - (0) if successful.\n+ *   - (-ENOTSUP) if hardware doesn't support.\n+ *   - (-ENODEV) if *port_id* invalid.\n+ *   - (-EINVAL) if parameters invalid.\n+ *   - others depends on the specific operations implementation.\n+ */\n+int rte_ethtool_set_eeprom(uint8_t port_id, struct ethtool_eeprom *eeprom,\n+\t\tvoid *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+ *\n+ * @param port_id\n+ *   The port identifier of the Ethernet device.\n+ * @param pause_param\n+ *   The pointer of ethtool_coalesce that gets pause frame\n+ *   configuration parameters\n+ * @return\n+ *   - (0) if successful.\n+ *   - (-ENOTSUP) if hardware doesn't support.\n+ *   - (-ENODEV) if *port_id* invalid.\n+ *   - (-EINVAL) if parameters invalid.\n+ *   - others depends on the specific operations implementation.\n+ */\n+int rte_ethtool_get_pauseparam(uint8_t port_id,\n+\t\tstruct ethtool_pauseparam *pause_param);\n+\n+/**\n+ * Setting the Ethernet device pause frame configuration according to\n+ * parameter attributes desribed by ethtool data structure, ethtool_pauseparam.\n+ *\n+ * @param port_id\n+ *   The port identifier of the Ethernet device.\n+ * @param param\n+ *   The pointer of ethtool_coalesce that gets ring configuration parameters\n+ * @return\n+ *   - (0) if successful.\n+ *   - (-ENOTSUP) if hardware doesn't support.\n+ *   - (-ENODEV) if *port_id* invalid.\n+ *   - (-EINVAL) if parameters invalid.\n+ *   - others depends on the specific operations implementation.\n+ */\n+int rte_ethtool_set_pauseparam(uint8_t port_id,\n+\t\tstruct ethtool_pauseparam *param);\n+\n+/**\n+ * Start the Ethernet device.\n+ *\n+ * @param port_id\n+ *   The port identifier of the Ethernet device.\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_net_open(uint8_t port_id);\n+\n+/**\n+ * Stop the Ethernet device.\n+ *\n+ * @param port_id\n+ *   The port identifier of the Ethernet device.\n+ * @return\n+ *   - (0) if successful.\n+ *   - (-ENODEV) if *port_id* invalid.\n+ */\n+int rte_ethtool_net_stop(uint8_t port_id);\n+\n+/**\n+ * Get the Ethernet device MAC address.\n+ *\n+ * @param port_id\n+ *   The port identifier of the Ethernet device.\n+ * @param addr\n+ *   MAC address of the Ethernet device.\n+ * @return\n+ *   - (0) if successful.\n+ *   - (-ENODEV) if *port_id* invalid.\n+ */\n+int rte_ethtool_net_get_mac_addr(uint8_t port_id, struct ether_addr *addr);\n+\n+/**\n+ * Setting the Ethernet device MAC address.\n+ *\n+ * @param port_id\n+ *   The port identifier of the Ethernet device.\n+ * @param addr\n+ *   The new MAC addr.\n+ * @return\n+ *   - (0) if successful.\n+ *   - (-ENOTSUP) if hardware doesn't support.\n+ *   - (-ENODEV) if *port_id* invalid.\n+ *   - (-EINVAL) if parameters invalid.\n+ *   - others depends on the specific operations implementation.\n+ */\n+int rte_ethtool_net_set_mac_addr(uint8_t port_id, struct ether_addr *addr);\n+\n+/**\n+ * Validate if the provided MAC address is valid unicast address\n+ *\n+ * @param port_id\n+ *   The port identifier of the Ethernet device.\n+ * @param addr\n+ *   A pointer to a buffer (6-byte, 48bit) for the target MAC address\n+ * @return\n+ *   - (0) if successful.\n+ *   - (-ENOTSUP) if hardware doesn't support.\n+ *   - (-ENODEV) if *port_id* invalid.\n+ *   - (-EINVAL) if parameters invalid.\n+ *   - others depends on the specific operations implementation.\n+ */\n+int rte_ethtool_net_validate_addr(uint8_t port_id, struct ether_addr *addr);\n+\n+/**\n+ * Setting the Ethernet device maximum Tx unit.\n+ *\n+ * @param port_id\n+ *   The port identifier of the Ethernet device.\n+ * @param mtu\n+ *   New MTU\n+ * @return\n+ *   - (0) if successful.\n+ *   - (-ENOTSUP) if hardware doesn't support.\n+ *   - (-ENODEV) if *port_id* invalid.\n+ *   - (-EINVAL) if parameters invalid.\n+ *   - others depends on the specific operations implementation.\n+ */\n+int rte_ethtool_net_change_mtu(uint8_t port_id, int mtu);\n+\n+/**\n+ * Retrieve the Ethernet device traffic statistics\n+ *\n+ * @param port_id\n+ *   The port identifier of the Ethernet device.\n+ * @param stats\n+ *   A pointer to struct rte_eth_stats for statistics parameters\n+ * @return\n+ *   - (0) if successful.\n+ *   - (-ENOTSUP) if hardware doesn't support.\n+ *   - (-ENODEV) if *port_id* invalid.\n+ *   - (-EINVAL) if parameters invalid.\n+ *   - others depends on the specific operations implementation.\n+ */\n+int rte_ethtool_net_get_stats64(uint8_t port_id, struct rte_eth_stats *stats);\n+\n+/**\n+ * Update the Ethernet device VLAN filter with new vid\n+ *\n+ * @param port_id\n+ *   The port identifier of the Ethernet device.\n+ * @param vid\n+ *   A new VLAN id\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_net_vlan_rx_add_vid(uint8_t port_id, uint16_t vid);\n+\n+/**\n+ * Remove VLAN id from Ethernet device.\n+ *\n+ * @param port_id\n+ *   The port identifier of the Ethernet device.\n+ * @param vid\n+ *   A new VLAN id\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_net_vlan_rx_kill_vid(uint8_t port_id, uint16_t vid);\n+\n+/**\n+ * Setting the Ethernet device rx mode.\n+ *\n+ * @param port_id\n+ *   The port identifier of the Ethernet device.\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_net_set_rx_mode(uint8_t port_id);\n+\n+/**\n+ * Getting ring paramaters for Ethernet device.\n+ *\n+ * @param port_id\n+ *   The port identifier of the Ethernet device.\n+ * @param ring_param\n+ *   Pointer to struct ethrool_ringparam to receive parameters.\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+ * @note\n+ *   Only the tx_pending and rx_pending fields of struct ethtool_ringparam\n+ *   are used, and the function only gets parameters for queue 0.\n+ */\n+int rte_ethtool_get_ringparam(uint8_t port_id,\n+\t\tstruct ethtool_ringparam *ring_param);\n+\n+/**\n+ * Setting ring paramaters for Ethernet device.\n+ *\n+ * @param port_id\n+ *   The port identifier of the Ethernet device.\n+ * @param ring_param\n+ *   Pointer to struct ethrool_ringparam with parameters to set.\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+ * @note\n+ *   Only the tx_pending and rx_pending fields of struct ethtool_ringparam\n+ *   are used, and the function only sets parameters for queue 0.\n+ */\n+int rte_ethtool_set_ringparam(uint8_t port_id,\n+\t\tstruct ethtool_ringparam *ring_param);\n+\n+#ifdef __cplusplus\n+}\n+#endif\n+\n+#endif /* _RTE_ETHTOOL_H_ */\ndiff --git a/lib/librte_ethtool/rte_ethtool_version.map b/lib/librte_ethtool/rte_ethtool_version.map\nnew file mode 100644\nindex 0000000..4544c3a\n--- /dev/null\n+++ b/lib/librte_ethtool/rte_ethtool_version.map\n@@ -0,0 +1,28 @@\n+DPDK_2.3 {\n+\tglobal:\n+\n+\trte_ethtool_get_drvinfo;\n+\trte_ethtool_get_link;\n+\trte_ethtool_get_regs_len;\n+\trte_ethtool_get_regs;\n+\trte_ethtool_get_eeprom_len;\n+\trte_ethtool_get_eeprom;\n+\trte_ethtool_set_eeprom;\n+\trte_ethtool_get_pauseparam;\n+\trte_ethtool_set_pauseparam;\n+\trte_ethtool_get_ringparam;\n+\trte_ethtool_set_ringparam;\n+\n+\trte_ethtool_net_open;\n+\trte_ethtool_net_stop;\n+\trte_ethtool_net_get_mac_addr;\n+\trte_ethtool_net_set_mac_addr;\n+\trte_ethtool_net_validate_addr;\n+\trte_ethtool_net_change_mtu;\n+\trte_ethtool_net_get_stats64;\n+\trte_ethtool_net_vlan_rx_add_vid;\n+\trte_ethtool_net_vlan_rx_kill_vid;\n+\trte_ethtool_net_set_rx_mode;\n+\n+\tlocal: *;\n+};\ndiff --git a/mk/rte.app.mk b/mk/rte.app.mk\nindex 8ecab41..32f76b1 100644\n--- a/mk/rte.app.mk\n+++ b/mk/rte.app.mk\n@@ -122,6 +122,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_MBUF)           += -lrte_mbuf\n _LDLIBS-$(CONFIG_RTE_LIBRTE_MBUF_OFFLOAD)   += -lrte_mbuf_offload\n _LDLIBS-$(CONFIG_RTE_LIBRTE_IP_FRAG)        += -lrte_ip_frag\n _LDLIBS-$(CONFIG_RTE_LIBRTE_ETHER)          += -lethdev\n+_LDLIBS-$(CONFIG_RTE_LIBRTE_ETHTOOL)        += -lrte_ethtool\n _LDLIBS-$(CONFIG_RTE_LIBRTE_CRYPTODEV)      += -lrte_cryptodev\n _LDLIBS-$(CONFIG_RTE_LIBRTE_MEMPOOL)        += -lrte_mempool\n _LDLIBS-$(CONFIG_RTE_LIBRTE_RING)           += -lrte_ring\n",
    "prefixes": [
        "dpdk-dev",
        "v3",
        "1/4"
    ]
}