Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/8018/?format=api
https://patches.dpdk.org/api/patches/8018/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/1445875161-1808-3-git-send-email-remy.horton@intel.com/", "project": { "id": 1, "url": "https://patches.dpdk.org/api/projects/1/?format=api", "name": "DPDK", "link_name": "dpdk", "list_id": "dev.dpdk.org", "list_email": "dev@dpdk.org", "web_url": "http://core.dpdk.org", "scm_url": "git://dpdk.org/dpdk", "webscm_url": "http://git.dpdk.org/dpdk", "list_archive_url": "https://inbox.dpdk.org/dev", "list_archive_url_format": "https://inbox.dpdk.org/dev/{}", "commit_url_format": "" }, "msgid": "<1445875161-1808-3-git-send-email-remy.horton@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1445875161-1808-3-git-send-email-remy.horton@intel.com", "date": "2015-10-26T15:59:21", "name": "[dpdk-dev,v2,2/2] doc: User-space ethtool sample application", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "51926cbae1382739af2d7fedf10d9808c348357c", "submitter": { "id": 326, "url": "https://patches.dpdk.org/api/people/326/?format=api", "name": "Remy Horton", "email": "remy.horton@intel.com" }, "delegate": null, "mbox": "https://patches.dpdk.org/project/dpdk/patch/1445875161-1808-3-git-send-email-remy.horton@intel.com/mbox/", "series": [], "comments": "https://patches.dpdk.org/api/patches/8018/comments/", "check": "pending", "checks": "https://patches.dpdk.org/api/patches/8018/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 CD0878D9A;\n\tMon, 26 Oct 2015 16:59:57 +0100 (CET)", "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n\tby dpdk.org (Postfix) with ESMTP id E1A2A6A80\n\tfor <dev@dpdk.org>; Mon, 26 Oct 2015 16:59:52 +0100 (CET)", "from orsmga003.jf.intel.com ([10.7.209.27])\n\tby fmsmga101.fm.intel.com with ESMTP; 26 Oct 2015 08:59:31 -0700", "from unknown (HELO localhost.ger.corp.intel.com) ([10.252.26.253])\n\tby orsmga003.jf.intel.com with ESMTP; 26 Oct 2015 08:59:30 -0700" ], "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.20,201,1444719600\"; d=\"scan'208\";a=\"672006654\"", "From": "Remy Horton <remy.horton@intel.com>", "To": "dev@dpdk.org", "Date": "Mon, 26 Oct 2015 15:59:21 +0000", "Message-Id": "<1445875161-1808-3-git-send-email-remy.horton@intel.com>", "X-Mailer": "git-send-email 1.9.3", "In-Reply-To": "<1445875161-1808-1-git-send-email-remy.horton@intel.com>", "References": "<1445875161-1808-1-git-send-email-remy.horton@intel.com>", "Subject": "[dpdk-dev] [PATCH v2 2/2] doc: User-space ethtool sample application", "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": "Signed-off-by: Remy Horton <remy.horton@intel.com>\n---\n doc/guides/sample_app_ug/ethtool.rst | 265 +++++++++++++++++++++++++++++++++++\n doc/guides/sample_app_ug/index.rst | 1 +\n 2 files changed, 266 insertions(+)\n create mode 100644 doc/guides/sample_app_ug/ethtool.rst", "diff": "diff --git a/doc/guides/sample_app_ug/ethtool.rst b/doc/guides/sample_app_ug/ethtool.rst\nnew file mode 100644\nindex 0000000..6d71908\n--- /dev/null\n+++ b/doc/guides/sample_app_ug/ethtool.rst\n@@ -0,0 +1,265 @@\n+\n+.. BSD LICENSE\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+EthTool Sample Application\n+==========================\n+\n+The Ethtool sample application shows an implementation of an\n+EthTool-like API and provides a console environment that allows\n+its use to query and change Ethernet card parameters. The sample\n+is based upon a simple L2 frame reflector.\n+\n+\n+Compiling the Application\n+-------------------------\n+\n+To compile the application:\n+\n+#. Go to the sample application directory:\n+\n+ .. code-block:: console\n+\n+ export RTE_SDK=/path/to/rte_sdk cd ${RTE_SD}/examples/ethtool\n+\n+#. Set the target (a default target is used if not specified). For example:\n+\n+ .. code-block:: console\n+\n+ export RTE_TARGET=x86_64-native-linuxapp-gcc\n+\n+ See the *DPDK Getting Started Guide* for possible RTE_TARGET values.\n+\n+#. Build the application:\n+\n+ .. code-block:: console\n+\n+ make\n+\n+Running the Application\n+-----------------------\n+\n+The application requires an available core for each port, plus one.\n+The only available options are the standard ones for the EAL:\n+\n+.. code-block:: console\n+\n+ ./build/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+options.\n+\n+Using the application\n+---------------------\n+\n+The application is console-driven using the cmdline DPDK interface:\n+\n+.. code-block:: console\n+\n+ EthApp>\n+\n+From this interface the available commands and descriptions of what\n+they do as as follows:\n+\n+drvinfo\n+ Print driver info\n+eeprom\n+ Dump EEPROM to file\n+link\n+ Print port link states\n+macaddr\n+ Gets/sets MAC address\n+mtu\n+ Set NIC MTU\n+open\n+ Open port\n+pause\n+ Get/set port pause state\n+portstats\n+ Print port statistics\n+regs\n+ Dump port register(s) to file\n+ringparam\n+ Get/set ring parameters\n+rxmode\n+ Toggle port Rx mode\n+stop\n+ Stop port\n+validate\n+ Check that given MAC address is valid unicast address\n+vlan\n+ Add/remove VLAN id\n+quit\n+ Exit program\n+\n+\n+Explaination\n+------------\n+\n+The following sections describe the most important parts of the code.\n+\n+\n+Base program\n+~~~~~~~~~~~~\n+\n+The top-level, after some port initialisation routines, runs the following:\n+\n+.. code-block:: c\n+\n+\tfor (idx_port = 0; idx_port < cnt_ports; idx_port++) {\n+\t\tptr_port = &app_cfg.ports[idx_port];\n+\t\trte_eal_remote_launch(slave_main, ptr_port, idx_port + 1);\n+\t}\n+\n+\tethapp_main();\n+\n+Each slave core, or a subset of these cores if there are more cores then\n+NIC ports, runs the `slave core process`_ described below. The master core\n+then runs the `EthTool App`_ itself.\n+\n+\n+Slave core process\n+~~~~~~~~~~~~~~~~~~\n+\n+Each slave core is assigned one of the available ports, and runs\n+the following code that implements a simple MAC frame refector:\n+\n+.. code-block:: c\n+\n+\twhile (!ptr_port->exit_now) {\n+\t\trte_spinlock_lock(&ptr_port->lock);\n+\t\tif (ptr_port->port_active == 0 ) {\n+\t\t\trte_spinlock_unlock(&ptr_port->lock);\n+\t\t\tcontinue;\n+\t\t}\n+\n+\t\t/* Incoming frames */\n+\t\tcnt_backlog_frames = ptr_txq->cnt_frames;\n+\t\tcnt_recv_frames = rte_eth_rx_burst(\n+\t\t\tptr_port->idx_port, 0,\n+\t\t\t&buf_recv_frames[ptr_txq->cnt_frames],\n+\t\t\tMAX_BURST_LENGTH - cnt_backlog_frames\n+\t\t\t);\n+\t\tif (cnt_recv_frames > 0) {\n+\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\tptr_frame = buf_recv_frames[\n+\t\t\t\t\tidx_frame + cnt_backlog_frames];\n+\t\t\t\tprocess_frame(ptr_port, ptr_frame);\n+\t\t\t}\n+\t\t}\n+\n+\t\t/* Outgoing frames */\n+\t\tif (ptr_txq->cnt_frames > 0) {\n+\t\t\tcnt_sent = rte_eth_tx_burst(\n+\t\t\t\tptr_port->idx_port, 0,\n+\t\t\t\tptr_txq->ptr_frames,\n+\t\t\t\tptr_txq->cnt_frames\n+\t\t\t\t);\n+\t\t\t/* Shuffle up unsent frame pointers */\n+\t\t\tfor (idx_frame = cnt_sent;\n+\t\t\t\t\tidx_frame < ptr_txq->cnt_frames;\n+\t\t\t\t\tidx_frame++)\n+\t\t\t\tptr_txq->ptr_frames[idx_frame - cnt_sent] =\n+\t\t\t\t\tptr_txq->ptr_frames[idx_frame];\n+\t\t\tptr_txq->cnt_frames -= cnt_sent;\n+\t\t}\n+\t\trte_spinlock_unlock(&ptr_port->lock);\n+\n+\t} /* end for(;;) */\n+\n+There is a check to make sure the port is in an active state. A burst\n+of frames is read and each frame within this burst is processed as\n+described below. Outgoing frames are then dispatched as a single burst,\n+with unsent frames being shuffled to the front of the outgoing queue if\n+not all of the frames could be sent.\n+\n+The processing of individial frames consists of setting the destination\n+address to be the source address, setting the source address to be the\n+MAC address of the port being handled, and then queueing the frame for\n+transmission:\n+\n+.. code-block:: c\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+\trte_eth_macaddr_get(ptr_port->idx_port, &ptr_mac_hdr->s_addr);\n+\tptr_port->tx_queue.ptr_frames[ptr_port->tx_queue.cnt_frames++] =\n+\t\tptr_frame;\n+\n+\n+EthTool App\n+~~~~~~~~~~~\n+\n+The ``foreground`` part of the EthTool sample is a console-based\n+interface that accepts commands as described in `using the\n+application`_.\n+\n+.. code-block:: c\n+\n+\tctx_cmdline = cmdline_stdin_new(list_prompt_commands, \"EthApp> \");\n+\tcmdline_interact(ctx_cmdline);\n+\tcmdline_stdin_exit(ctx_cmdline);\n+\n+\n+Individual call-back functions handle the detail associated with each\n+command, which make use of the functions defined in the `EthTool interface`_\n+to the DPDK functions.\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/sample_app_ug/index.rst b/doc/guides/sample_app_ug/index.rst\nindex 9beedd9..086d3f2 100644\n--- a/doc/guides/sample_app_ug/index.rst\n+++ b/doc/guides/sample_app_ug/index.rst\n@@ -41,6 +41,7 @@ Sample Applications User Guide\n \n intro\n cmd_line\n+ ethtool\n exception_path\n hello_world\n skeleton\n", "prefixes": [ "dpdk-dev", "v2", "2/2" ] }{ "id": 8018, "url": "