1 2.. BSD LICENSE 3 Copyright(c) 2015 Intel Corporation. All rights reserved. 4 All rights reserved. 5 6 Redistribution and use in source and binary forms, with or without 7 modification, are permitted provided that the following conditions 8 are met: 9 10 * Redistributions of source code must retain the above copyright 11 notice, this list of conditions and the following disclaimer. 12 * Redistributions in binary form must reproduce the above copyright 13 notice, this list of conditions and the following disclaimer in 14 the documentation and/or other materials provided with the 15 distribution. 16 * Neither the name of Intel Corporation nor the names of its 17 contributors may be used to endorse or promote products derived 18 from this software without specific prior written permission. 19 20 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 32Ethtool Sample Application 33========================== 34 35The Ethtool sample application shows an implementation of an 36ethtool-like API and provides a console environment that allows 37its use to query and change Ethernet card parameters. The sample 38is based upon a simple L2 frame reflector. 39 40Compiling the Application 41------------------------- 42 43To compile the sample application see :doc:`compiling`. 44 45The application is located in the ``ethtool`` sub-directory. 46 47Running the Application 48----------------------- 49 50The application requires an available core for each port, plus one. 51The only available options are the standard ones for the EAL: 52 53.. code-block:: console 54 55 ./ethtool-app/ethtool-app/${RTE_TARGET}/ethtool [EAL options] 56 57Refer to the *DPDK Getting Started Guide* for general information on 58running applications and the Environment Abstraction Layer (EAL) 59options. 60 61Using the application 62--------------------- 63 64The application is console-driven using the cmdline DPDK interface: 65 66.. code-block:: console 67 68 EthApp> 69 70From this interface the available commands and descriptions of what 71they do as as follows: 72 73* ``drvinfo``: Print driver info 74* ``eeprom``: Dump EEPROM to file 75* ``link``: Print port link states 76* ``macaddr``: Gets/sets MAC address 77* ``mtu``: Set NIC MTU 78* ``open``: Open port 79* ``pause``: Get/set port pause state 80* ``portstats``: Print port statistics 81* ``regs``: Dump port register(s) to file 82* ``ringparam``: Get/set ring parameters 83* ``rxmode``: Toggle port Rx mode 84* ``stop``: Stop port 85* ``validate``: Check that given MAC address is valid unicast address 86* ``vlan``: Add/remove VLAN id 87* ``quit``: Exit program 88 89 90Explanation 91----------- 92 93The sample program has two parts: A background `packet reflector`_ 94that runs on a slave core, and a foreground `Ethtool Shell`_ that 95runs on the master core. These are described below. 96 97Packet Reflector 98~~~~~~~~~~~~~~~~ 99 100The background packet reflector is intended to demonstrate basic 101packet processing on NIC ports controlled by the Ethtool shim. 102Each incoming MAC frame is rewritten so that it is returned to 103the sender, using the port in question's own MAC address as the 104source address, and is then sent out on the same port. 105 106Ethtool Shell 107~~~~~~~~~~~~~ 108 109The foreground part of the Ethtool sample is a console-based 110interface that accepts commands as described in `using the 111application`_. Individual call-back functions handle the detail 112associated with each command, which make use of the functions 113defined in the `Ethtool interface`_ to the DPDK functions. 114 115Ethtool interface 116----------------- 117 118The Ethtool interface is built as a separate library, and implements 119the following functions: 120 121- ``rte_ethtool_get_drvinfo()`` 122- ``rte_ethtool_get_regs_len()`` 123- ``rte_ethtool_get_regs()`` 124- ``rte_ethtool_get_link()`` 125- ``rte_ethtool_get_eeprom_len()`` 126- ``rte_ethtool_get_eeprom()`` 127- ``rte_ethtool_set_eeprom()`` 128- ``rte_ethtool_get_pauseparam()`` 129- ``rte_ethtool_set_pauseparam()`` 130- ``rte_ethtool_net_open()`` 131- ``rte_ethtool_net_stop()`` 132- ``rte_ethtool_net_get_mac_addr()`` 133- ``rte_ethtool_net_set_mac_addr()`` 134- ``rte_ethtool_net_validate_addr()`` 135- ``rte_ethtool_net_change_mtu()`` 136- ``rte_ethtool_net_get_stats64()`` 137- ``rte_ethtool_net_vlan_rx_add_vid()`` 138- ``rte_ethtool_net_vlan_rx_kill_vid()`` 139- ``rte_ethtool_net_set_rx_mode()`` 140- ``rte_ethtool_get_ringparam()`` 141- ``rte_ethtool_set_ringparam()`` 142