Ethtool is a Linux utility to query or control network driver and hardware settings, particularly for wired Ethernet drvices. It's also useful when you do network performance tuning

Query Ethernet Device properties

# ethtool eth0
Settings for eth0:
    Supported ports: [ FIBRE ]
    Supported link modes:   10000baseT/Full
    Supported pause frame use: No
    Supports auto-negotiation: No
    Advertised link modes:  10000baseT/Full
    Advertised pause frame use: No
    Advertised auto-negotiation: No
    Speed: 10000Mb/s
    Duplex: Full
    Port: FIBRE
    PHYAD: 0
    Transceiver: external
    Auto-negotiation: off
    Supports Wake-on: d
    Wake-on: d
    Current message level: 0x00000014 (20)
                   link ifdown
    Link detected: yes

This above ethtool output displays ethernet card properties such as speed, wake on, duplex and the link detection status. Following are the three types of duplexes available.

Query Ethernet Device driver and firmware info

# ethtool -i eth0
driver: mlx4_en (IBM0DB0000010_CX-2)
version: 1.5.10 (Jan 2013)
firmware-version: 2.9.1000
bus-info: 0000:1f:00.0
supports-statistics: yes
supports-test: yes
supports-eeprom-access: no
supports-register-dump: no
supports-priv-flags: no

Ethernet Device pause parameter

How to query run:

# ethtool -a eth0
Pause parameters for eth0:
Autonegotiate:    off
RX:        on
TX:        on

Above shows pause autonegotiation is off, RX and TX pause are enabled.

How to change it run:

ethtool -A eth0 [autoneg on|off] [rx on|off] [tx on|off]

Network Device Adaptive RX/TX

The network driver uses adaptive interrupt moderation for the receive path, which adjusts the moderation time to the traffic pattern,

How to query run:

#ethtool -c eth<x>

To change it run:

#ethtool -C eth<x> adaptive-rx on|off

rx-usec and rx-frames

To set interrupt coalescing settings when adaptive moderation is disabled, use:

# ethtool -c eth<x> [rx-usecs N] [rx-frames N]

Note: usec settings correspond to the time to wait after the *last* packet is sent/received before triggering an interrupt.

Offload feature

To query stateless offload status run:

# ethtool -k eth<x> 

To set stateless offload status run:

# ethtool -K eth<x> [rx on|off] [tx on|off] [sg on|off] [tso on|off]

Ring size

To query ring size values run:

# ethtool -g eth<x>

To modify rings size run:

# ethtool -G eth<x> [rx <N>] [tx <N>]

Number of ring entries

To query ring entries run:

#ethtool -l eth<x>

To set ring entries run:

#ethtool -L eth<x>  [rx N] [tx N] [other N] [combined N]

Note: some network card driver don't support 'number of ring entries' and 'ring size' operations. And, when you change two options, mostly both value can't be set to max value at the same time according to Hardware and driver limit.

Network Statistics of Specific Ethernet Device

# ethtool -S eth0
NIC statistics:
     rx_packets: 41608338680
     tx_packets: 118446383396
     rx_bytes: 45816192326260
     tx_bytes: 187368636179826
     rx_errors: 0
     tx_errors: 0
     rx_dropped: 0
     tx_dropped: 0
     multicast: 329978
     collisions: 0
     rx_length_errors: 0
     rx_over_errors: 0
     rx_crc_errors: 0
     rx_frame_errors: 0
     rx_fifo_errors: 0
     rx_missed_errors: 0
     tx_aborted_errors: 0
     tx_carrier_errors: 0
     tx_fifo_errors: 0
     tx_heartbeat_errors: 0
     tx_window_errors: 0
     lro_aggregated: 26821893354
     lro_flushed: 9267974079
     lro_no_desc: 0
     tso_packets: 14315413915
     queue_stopped: 350443
     wake_queue: 350446
     tx_timeout: 0
     rx_alloc_failed: 0
     rx_csum_good: 41603007942
     rx_csum_none: 5330738
     tx_chksum_offload: 15560661595
     tx0_packets: 7399207049
     tx0_bytes: 11697053894529
     tx1_packets: 7387603228
     tx1_bytes: 11673344293668
     tx2_packets: 7399054619
     tx2_bytes: 11719795293285
     tx3_packets: 7364985232
     tx3_bytes: 11625605171166
     tx4_packets: 7465447273
     tx4_bytes: 11804575269645
     tx5_packets: 7549848074
     tx5_bytes: 11940476141702
     tx6_packets: 7335788537
     tx6_bytes: 11632543102090
     tx7_packets: 7245246842
     tx7_bytes: 11473415425115
     tx8_packets: 7521740574
     tx8_bytes: 11933276118059
     tx9_packets: 7432193499
     tx9_bytes: 11722934692934
     tx10_packets: 7447235114
     tx10_bytes: 11790881920510
     tx11_packets: 7404085472
     tx11_bytes: 11629344363207
     tx12_packets: 7285018641
     tx12_bytes: 11526371116219
     tx13_packets: 7325127436
     tx13_bytes: 11623796998054
     tx14_packets: 7404020289
     tx14_bytes: 11749871924114
     tx15_packets: 7479784907
     tx15_bytes: 11825357644346
     rx0_packets: 2574661969
     rx0_bytes: 2847319620406
     rx1_packets: 2595537641
     rx1_bytes: 2842359740793
     rx2_packets: 2628481233
     rx2_bytes: 2943192453530
     rx3_packets: 2621049003
     rx3_bytes: 2861512182394
     rx4_packets: 2521558882
     rx4_bytes: 2741990120499
     rx5_packets: 2557435199
     rx5_bytes: 2759357911866
     rx6_packets: 2694562321
     rx6_bytes: 3005667341993
     rx7_packets: 2630441101
     rx7_bytes: 2914643258685
     rx8_packets: 2584000602
     rx8_bytes: 2849798789337
     rx9_packets: 2545305060
     rx9_bytes: 2777518352673
     rx10_packets: 2642449617
     rx10_bytes: 2934528284749
     rx11_packets: 2606934039
     rx11_bytes: 2853727586235
     rx12_packets: 2593707018
     rx12_bytes: 2852436972009
     rx13_packets: 2569064892
     rx13_bytes: 2813724231571
     rx14_packets: 2617862012
     rx14_bytes: 2878447620701
     rx15_packets: 2625289961
     rx15_bytes: 2939970063854
     broadcast: 1438075
     rx_prio_0: 0
     rx_prio_1: 0
     rx_prio_2: 0
     rx_prio_3: 0
     rx_prio_4: 0
     rx_prio_5: 0
     rx_prio_6: 0
     rx_prio_7: 0
     tx_prio_0: 0
     tx_prio_1: 0
     tx_prio_2: 0
     tx_prio_3: 0
     tx_prio_4: 0
     tx_prio_5: 0
     tx_prio_6: 0
     tx_prio_7: 0