15630257fSFerruh Yigit.. SPDX-License-Identifier: BSD-3-Clause 25630257fSFerruh Yigit Copyright(c) 2015 Intel Corporation. 3bda68ab9SRemy Horton 4bda68ab9SRemy HortonEthtool Sample Application 5bda68ab9SRemy Horton========================== 6bda68ab9SRemy Horton 7*8750576fSNandini PersadThis chapter describes the Ethtool sample application 8*8750576fSNandini Persadthat is part of the Data Plane Development Kit (DPDK). 9*8750576fSNandini Persad 10*8750576fSNandini PersadOverview 11*8750576fSNandini Persad-------- 12*8750576fSNandini Persad 13bda68ab9SRemy HortonThe Ethtool sample application shows an implementation of an 14bda68ab9SRemy Hortonethtool-like API and provides a console environment that allows 15bda68ab9SRemy Hortonits use to query and change Ethernet card parameters. The sample 16bda68ab9SRemy Hortonis based upon a simple L2 frame reflector. 17bda68ab9SRemy Horton 18bda68ab9SRemy HortonCompiling the Application 19bda68ab9SRemy Horton------------------------- 20bda68ab9SRemy Horton 217cacb056SHerakliusz LipiecTo compile the sample application see :doc:`compiling`. 22bda68ab9SRemy Horton 237cacb056SHerakliusz LipiecThe application is located in the ``ethtool`` sub-directory. 24bda68ab9SRemy Horton 25bda68ab9SRemy HortonRunning the Application 26bda68ab9SRemy Horton----------------------- 27bda68ab9SRemy Horton 28bda68ab9SRemy HortonThe application requires an available core for each port, plus one. 29bda68ab9SRemy HortonThe only available options are the standard ones for the EAL: 30bda68ab9SRemy Horton 31bda68ab9SRemy Horton.. code-block:: console 32bda68ab9SRemy Horton 33e2a94f9aSCiara Power ./<build_dir>/examples/dpdk-ethtool [EAL options] 34bda68ab9SRemy Horton 35bda68ab9SRemy HortonRefer to the *DPDK Getting Started Guide* for general information on 36bda68ab9SRemy Hortonrunning applications and the Environment Abstraction Layer (EAL) 37bda68ab9SRemy Hortonoptions. 38bda68ab9SRemy Horton 39bda68ab9SRemy HortonThe application is console-driven using the cmdline DPDK interface: 40bda68ab9SRemy Horton 41bda68ab9SRemy Horton.. code-block:: console 42bda68ab9SRemy Horton 43bda68ab9SRemy Horton EthApp> 44bda68ab9SRemy Horton 45*8750576fSNandini PersadFrom this interface, the available commands and descriptions 46*8750576fSNandini Persadof what they do are as follows: 47bda68ab9SRemy Horton 48bda68ab9SRemy Horton* ``drvinfo``: Print driver info 49bda68ab9SRemy Horton* ``eeprom``: Dump EEPROM to file 5099d8ebcfSZijie Pan* ``module-eeprom``: Dump plugin module EEPROM to file 51bda68ab9SRemy Horton* ``link``: Print port link states 52bda68ab9SRemy Horton* ``macaddr``: Gets/sets MAC address 53bda68ab9SRemy Horton* ``mtu``: Set NIC MTU 54bda68ab9SRemy Horton* ``open``: Open port 55bda68ab9SRemy Horton* ``pause``: Get/set port pause state 56bda68ab9SRemy Horton* ``portstats``: Print port statistics 57bda68ab9SRemy Horton* ``regs``: Dump port register(s) to file 58bda68ab9SRemy Horton* ``ringparam``: Get/set ring parameters 59bda68ab9SRemy Horton* ``rxmode``: Toggle port Rx mode 60bda68ab9SRemy Horton* ``stop``: Stop port 61bda68ab9SRemy Horton* ``validate``: Check that given MAC address is valid unicast address 62bda68ab9SRemy Horton* ``vlan``: Add/remove VLAN id 63bda68ab9SRemy Horton* ``quit``: Exit program 64bda68ab9SRemy Horton 65bda68ab9SRemy Horton 66bda68ab9SRemy HortonExplanation 67bda68ab9SRemy Horton----------- 68bda68ab9SRemy Horton 69bda68ab9SRemy HortonThe sample program has two parts: A background `packet reflector`_ 70cb056611SStephen Hemmingerthat runs on a worker core, and a foreground `Ethtool Shell`_ that 71cb056611SStephen Hemmingerruns on the main core. These are described below. 72bda68ab9SRemy Horton 73bda68ab9SRemy HortonPacket Reflector 74bda68ab9SRemy Horton~~~~~~~~~~~~~~~~ 75bda68ab9SRemy Horton 76bda68ab9SRemy HortonThe background packet reflector is intended to demonstrate basic 77bda68ab9SRemy Hortonpacket processing on NIC ports controlled by the Ethtool shim. 78bda68ab9SRemy HortonEach incoming MAC frame is rewritten so that it is returned to 79bda68ab9SRemy Hortonthe sender, using the port in question's own MAC address as the 80bda68ab9SRemy Hortonsource address, and is then sent out on the same port. 81bda68ab9SRemy Horton 82bda68ab9SRemy HortonEthtool Shell 83bda68ab9SRemy Horton~~~~~~~~~~~~~ 84bda68ab9SRemy Horton 85bda68ab9SRemy HortonThe foreground part of the Ethtool sample is a console-based 86*8750576fSNandini Persadinterface that accepts commands as described in `running the 87bda68ab9SRemy Hortonapplication`_. Individual call-back functions handle the detail 88bda68ab9SRemy Hortonassociated with each command, which make use of the functions 89bda68ab9SRemy Hortondefined in the `Ethtool interface`_ to the DPDK functions. 90bda68ab9SRemy Horton 91bda68ab9SRemy HortonEthtool interface 92bda68ab9SRemy Horton----------------- 93bda68ab9SRemy Horton 94bda68ab9SRemy HortonThe Ethtool interface is built as a separate library, and implements 95bda68ab9SRemy Hortonthe following functions: 96bda68ab9SRemy Horton 97bda68ab9SRemy Horton- ``rte_ethtool_get_drvinfo()`` 98bda68ab9SRemy Horton- ``rte_ethtool_get_regs_len()`` 99bda68ab9SRemy Horton- ``rte_ethtool_get_regs()`` 100bda68ab9SRemy Horton- ``rte_ethtool_get_link()`` 101bda68ab9SRemy Horton- ``rte_ethtool_get_eeprom_len()`` 102bda68ab9SRemy Horton- ``rte_ethtool_get_eeprom()`` 103bda68ab9SRemy Horton- ``rte_ethtool_set_eeprom()`` 10499d8ebcfSZijie Pan- ``rte_ethtool_get_module_info()`` 10599d8ebcfSZijie Pan- ``rte_ethtool_get_module_eeprom()`` 106bda68ab9SRemy Horton- ``rte_ethtool_get_pauseparam()`` 107bda68ab9SRemy Horton- ``rte_ethtool_set_pauseparam()`` 108bda68ab9SRemy Horton- ``rte_ethtool_net_open()`` 109bda68ab9SRemy Horton- ``rte_ethtool_net_stop()`` 110bda68ab9SRemy Horton- ``rte_ethtool_net_get_mac_addr()`` 111bda68ab9SRemy Horton- ``rte_ethtool_net_set_mac_addr()`` 112bda68ab9SRemy Horton- ``rte_ethtool_net_validate_addr()`` 113bda68ab9SRemy Horton- ``rte_ethtool_net_change_mtu()`` 114bda68ab9SRemy Horton- ``rte_ethtool_net_get_stats64()`` 115bda68ab9SRemy Horton- ``rte_ethtool_net_vlan_rx_add_vid()`` 116bda68ab9SRemy Horton- ``rte_ethtool_net_vlan_rx_kill_vid()`` 117bda68ab9SRemy Horton- ``rte_ethtool_net_set_rx_mode()`` 118bda68ab9SRemy Horton- ``rte_ethtool_get_ringparam()`` 119bda68ab9SRemy Horton- ``rte_ethtool_set_ringparam()`` 120