1d30ea906Sjfb8856606..  SPDX-License-Identifier: BSD-3-Clause
2d30ea906Sjfb8856606    Copyright(c) 2015 Intel Corporation.
3a9643ea8Slogwang
4a9643ea8SlogwangEthtool Sample Application
5a9643ea8Slogwang==========================
6a9643ea8Slogwang
7a9643ea8SlogwangThe Ethtool sample application shows an implementation of an
8a9643ea8Slogwangethtool-like API and provides a console environment that allows
9a9643ea8Slogwangits use to query and change Ethernet card parameters. The sample
10a9643ea8Slogwangis based upon a simple L2 frame reflector.
11a9643ea8Slogwang
12a9643ea8SlogwangCompiling the Application
13a9643ea8Slogwang-------------------------
14a9643ea8Slogwang
152bfe3f2eSlogwangTo compile the sample application see :doc:`compiling`.
16a9643ea8Slogwang
172bfe3f2eSlogwangThe application is located in the ``ethtool`` sub-directory.
18a9643ea8Slogwang
19a9643ea8SlogwangRunning the Application
20a9643ea8Slogwang-----------------------
21a9643ea8Slogwang
22a9643ea8SlogwangThe application requires an available core for each port, plus one.
23a9643ea8SlogwangThe only available options are the standard ones for the EAL:
24a9643ea8Slogwang
25a9643ea8Slogwang.. code-block:: console
26a9643ea8Slogwang
27*2d9fd380Sjfb8856606    ./<build_dir>/examples/dpdk-ethtool [EAL options]
28a9643ea8Slogwang
29a9643ea8SlogwangRefer to the *DPDK Getting Started Guide* for general information on
30a9643ea8Slogwangrunning applications and the Environment Abstraction Layer (EAL)
31a9643ea8Slogwangoptions.
32a9643ea8Slogwang
33a9643ea8SlogwangUsing the application
34a9643ea8Slogwang---------------------
35a9643ea8Slogwang
36a9643ea8SlogwangThe application is console-driven using the cmdline DPDK interface:
37a9643ea8Slogwang
38a9643ea8Slogwang.. code-block:: console
39a9643ea8Slogwang
40a9643ea8Slogwang        EthApp>
41a9643ea8Slogwang
42a9643ea8SlogwangFrom this interface the available commands and descriptions of what
434418919fSjohnjiangthey do as follows:
44a9643ea8Slogwang
45a9643ea8Slogwang* ``drvinfo``: Print driver info
46a9643ea8Slogwang* ``eeprom``: Dump EEPROM to file
47d30ea906Sjfb8856606* ``module-eeprom``: Dump plugin module EEPROM to file
48a9643ea8Slogwang* ``link``: Print port link states
49a9643ea8Slogwang* ``macaddr``: Gets/sets MAC address
50a9643ea8Slogwang* ``mtu``: Set NIC MTU
51a9643ea8Slogwang* ``open``: Open port
52a9643ea8Slogwang* ``pause``: Get/set port pause state
53a9643ea8Slogwang* ``portstats``: Print port statistics
54a9643ea8Slogwang* ``regs``: Dump port register(s) to file
55a9643ea8Slogwang* ``ringparam``: Get/set ring parameters
56a9643ea8Slogwang* ``rxmode``: Toggle port Rx mode
57a9643ea8Slogwang* ``stop``: Stop port
58a9643ea8Slogwang* ``validate``: Check that given MAC address is valid unicast address
59a9643ea8Slogwang* ``vlan``: Add/remove VLAN id
60a9643ea8Slogwang* ``quit``: Exit program
61a9643ea8Slogwang
62a9643ea8Slogwang
63a9643ea8SlogwangExplanation
64a9643ea8Slogwang-----------
65a9643ea8Slogwang
66a9643ea8SlogwangThe sample program has two parts: A background `packet reflector`_
67*2d9fd380Sjfb8856606that runs on a worker core, and a foreground `Ethtool Shell`_ that
68*2d9fd380Sjfb8856606runs on the main core. These are described below.
69a9643ea8Slogwang
70a9643ea8SlogwangPacket Reflector
71a9643ea8Slogwang~~~~~~~~~~~~~~~~
72a9643ea8Slogwang
73a9643ea8SlogwangThe background packet reflector is intended to demonstrate basic
74a9643ea8Slogwangpacket processing on NIC ports controlled by the Ethtool shim.
75a9643ea8SlogwangEach incoming MAC frame is rewritten so that it is returned to
76a9643ea8Slogwangthe sender, using the port in question's own MAC address as the
77a9643ea8Slogwangsource address, and is then sent out on the same port.
78a9643ea8Slogwang
79a9643ea8SlogwangEthtool Shell
80a9643ea8Slogwang~~~~~~~~~~~~~
81a9643ea8Slogwang
82a9643ea8SlogwangThe foreground part of the Ethtool sample is a console-based
83a9643ea8Slogwanginterface that accepts commands as described in `using the
84a9643ea8Slogwangapplication`_. Individual call-back functions handle the detail
85a9643ea8Slogwangassociated with each command, which make use of the functions
86a9643ea8Slogwangdefined in the `Ethtool interface`_ to the DPDK functions.
87a9643ea8Slogwang
88a9643ea8SlogwangEthtool interface
89a9643ea8Slogwang-----------------
90a9643ea8Slogwang
91a9643ea8SlogwangThe Ethtool interface is built as a separate library, and implements
92a9643ea8Slogwangthe following functions:
93a9643ea8Slogwang
94a9643ea8Slogwang- ``rte_ethtool_get_drvinfo()``
95a9643ea8Slogwang- ``rte_ethtool_get_regs_len()``
96a9643ea8Slogwang- ``rte_ethtool_get_regs()``
97a9643ea8Slogwang- ``rte_ethtool_get_link()``
98a9643ea8Slogwang- ``rte_ethtool_get_eeprom_len()``
99a9643ea8Slogwang- ``rte_ethtool_get_eeprom()``
100a9643ea8Slogwang- ``rte_ethtool_set_eeprom()``
101d30ea906Sjfb8856606- ``rte_ethtool_get_module_info()``
102d30ea906Sjfb8856606- ``rte_ethtool_get_module_eeprom()``
103a9643ea8Slogwang- ``rte_ethtool_get_pauseparam()``
104a9643ea8Slogwang- ``rte_ethtool_set_pauseparam()``
105a9643ea8Slogwang- ``rte_ethtool_net_open()``
106a9643ea8Slogwang- ``rte_ethtool_net_stop()``
107a9643ea8Slogwang- ``rte_ethtool_net_get_mac_addr()``
108a9643ea8Slogwang- ``rte_ethtool_net_set_mac_addr()``
109a9643ea8Slogwang- ``rte_ethtool_net_validate_addr()``
110a9643ea8Slogwang- ``rte_ethtool_net_change_mtu()``
111a9643ea8Slogwang- ``rte_ethtool_net_get_stats64()``
112a9643ea8Slogwang- ``rte_ethtool_net_vlan_rx_add_vid()``
113a9643ea8Slogwang- ``rte_ethtool_net_vlan_rx_kill_vid()``
114a9643ea8Slogwang- ``rte_ethtool_net_set_rx_mode()``
115a9643ea8Slogwang- ``rte_ethtool_get_ringparam()``
116a9643ea8Slogwang- ``rte_ethtool_set_ringparam()``
117