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