SkillPilotAI

ethtool (2/2)

Part 2 of ethtool covers the advanced features inside the NIC: RSS and ntuple flow rules, channels (queues), SFP/QSFP module EEPROM, EEE, tunables, reset, FEC, cable tests, PLCA, MAC Merge and PSE. These matter for server tuning (spreading load across CPUs) and for debugging links and optics.

186.1 Why is it used?

  • Spread incoming flows across queues and CPUs (RSS) so one CPU is not stuck at 100%.
  • Steer one flow (e.g. SSH) to its own queue, or drop a flow in NIC hardware before it reaches the CPU.
  • Read SFP/QSFP module info and power class, check FEC mismatches on 25G/100G links.
  • Test copper cable pairs for opens and shorts with the PHY.
  • Linux only; the driver and NIC do the real work. Lowercase options show (user), UPPERCASE set (root). On Windows/macOS these live in vendor driver tools.

186.2 How RSS and ntuple work

  • RSS (Receive Side Scaling): the NIC hashes source IP, destination IP and ports of each packet.
  • The indirection table maps the hash to a queue number; each queue has its own CPU.
  • Same flow = same hash = same queue (no reordering); different flows spread out.
  • ntuple rules (-N) override the hash: send a matching flow to a fixed queue, or action -1 to drop it in hardware.
RSS and an ntuple rule on the server NIC
  1. 1.Laptop 192.168.1.21 TCP flow reaches the server NIC (eth0)

  2. 2.NIC hashes src IP, dst IP and ports

  3. 3.Indirection table: hash -> Queue 0 (CPU 0); phone 192.168.1.22 flow -> Queue 1

  4. 4.ntuple rule flow-type tcp4 dst-port 22 action 1: SSH always to Queue 1

  5. 5.Rule with action -1 (e.g. Telnet dst-port 23): dropped in the NIC, no CPU load

Why veth says Not supported
  1. 1.ethtool (user space) sends a request over netlink

  2. 2.Kernel (ETHTOOL_NETLINK=y) forwards it to the driver

  3. 3.veth driver: no RSS, SFP or PHY, returns Not supported

  4. 4.Real NIC driver (PHY + SFP): answers the same request with real data

Not supported is the driver's answer, not a wrong command

186.3 Lab: which NIC?

Terminal
zcat /proc/config.gz | grep -E '^CONFIG_(ETHTOOL_NETLINK|VETH)='ethtool --versionethtool -i eth0
Output
$ ethtool -i eth0driver: vethversion: 1.0bus-info: supports-statistics: yessupports-test: nosupports-eeprom-access: nosupports-register-dump: nosupports-priv-flags: no
Terminal
ethtool -x eth0ethtool -m eth0ethtool --show-fec eth0ethtool --cable-test eth0
Output
$ ethtool -x eth0netlink error: Not supported$ ethtool -m eth0netlink error: Not supported$ ethtool --show-fec eth0netlink error: Not supported$ ethtool --cable-test eth0netlink error: Not supported

So for those sections the real NIC output comes from official docs (kernel scaling docs, NVIDIA Cumulus).

186.4 Flow classification: show and hash fields

Terminal
ethtool -n eth0                    # RX rules (= -u, --show-nfc, --show-ntuple)ethtool -n eth0 rx-flow-hash tcp4  # fields the hash usesethtool -n eth0 rule 5             # one rule
Output
$ ethtool -n eth0Cannot get RX rings: Not supportedrxclass: Cannot get RX class rule count: Not supportedRX classification rule retrieval failed$ ethtool -n eth0 rx-flow-hash tcp4Cannot get RX network flow hashing options: Not supported$ ethtool -n eth0 rule 5rxclass: Cannot get RX class rule: Not supportedCannot get RX classification rule
Hash letter (-N rx-flow-hash FLOW ...)Field
mL2 destination MAC
vVLAN tag
tL3 protocol field
s / dIP source / destination address
f / nL4 bytes 0-1 (source port) / 2-3 (destination port)
rDiscard packets of this flow type
  • Flow types: tcp4 udp4 ah4 esp4 sctp4 and the same with 6.
  • tcp4 sdfn = full 4-tuple hash, spreads flows best; udp4 sd = hash on IPs only.

186.5 Flow classification: rules

Output
# ethtool -N eth0 flow-type tcp6 dst-port 22 context 1Added rule with ID 1023# ethtool -N eth0 delete 1023
PartOptions
flow-typeether, ip4, tcp4, udp4, sctp4, ah4/esp4, ip6, tcp6, udp6, sctp6, ah6/esp6
Matchsrc/dst MAC, proto, src-ip/dst-ip [m mask], tos/tclass, l4proto, src-port/dst-port, spi, l4data, vlan-etype, vlan, user-def, dst-mac
actionN or queue N = steer to RX queue N; -1 = drop; -2 = Wake-on-LAN filter
Othercontext N (RSS context), vf N, loc N (rule location), delete N

186.6 RSS table and channels

CommandWhat it does
-x eth0Show indirection table, hash key, hash function
-X eth0 equal 4Spread equally over the first 4 queues
-X weight 6 2 1 1Spread by weights
-X start 2 equal 4Start from queue 2
-X defaultBack to the default table
-X hkey 6d:5a:... / hfunc toeplitzSet hash key / hash function
-X context new | context 1 ... | context 1 deleteCreate, use, delete an extra RSS context
Output
# ethtool -X eth0 equal 2 context 1# ethtool -x eth0 context 1RX flow hash indirection table for eth0 with 13 RX ring(s):  0:      0     1     0     1     0     1     0     1  8:      0     1     0     1     0     1     0     1[...]
Terminal
ethtool -l eth0            # channels and maximumsethtool -L eth0 rx 2 tx 2  # also: other N, combined Nethtool -l eth0ethtool -L eth0 rx 1 tx 1
Output
$ ethtool -L eth0 rx 2 tx 2$ ethtool -l eth0Current hardware settings:RX:             2TX:             2Other:          n/aCombined:       n/a$ ethtool -L eth0 rx 1 tx 1
  • veth has max 8 RX and 8 TX channels but no combined channels, so -L combined 2 errors (exceeds maximum).
  • Real NICs usually use combined (RX+TX pair per CPU).

186.7 Module EEPROM, private flags, EEE

Output
cumulus@switch:mgmt:~# sudo ethtool -m swp3Identifier                                : 0x11 (QSFP28)Extended identifier                       : 0xceExtended identifier description           : 3.5W max. Power consumption <= ignore for high power modulesExtended identifier description           : CDR present in TX, CDR present in RXExtended identifier description           : 4.5W max. Power consumption,  High Power Class (> 3.5 W) enabled <= Request 4.5W, enabled
  • -m (--module-info) decodes the SFP/QSFP EEPROM and DOM; raw on, hex on, offset/length, page, bank, i2c dump parts.
  • --show-priv-flags / --set-priv-flags eth0 legacy-rx on: driver's own named switches (veth: Not supported).
  • EEE (802.3az): --show-eee, --set-eee eee on|off, tx-lpi on tx-timer 100, advertise 0x028. Saves power when idle; copper PHY feature (veth: Not supported).

186.8 PHY tunables, driver tunables, reset

AreaExamplesPurpose
PHY tunables--set-phy-tunable eth0 downshift on count 3; fast-link-down on msecs 10; energy-detect-power-down onLower speed if gigabit fails, report link down fast, save power with no cable
Driver tunables--set-tunable eth0 rx-copybreak 256; tx-copybreak; tx-buf-size 4096; pfc-prevention-tout 100Small packets copied into a new buffer below copybreak
Reset--reset eth0 mac | phy | dma | irq | filter | offload | ram | ap | mgmt (+ -shared), dedicated, all, flags 0x3Reset NIC parts; breaks link and traffic
Per-queue-Q eth0 queue_mask 0x3 --coalesce rx-usecs 30Coalescing for selected queues only
Output
$ ethtool --get-phy-tunable eth0 downshiftCannot Get PHY downshift count: Not supported$ ethtool --get-tunable eth0 rx-copybreakrx-copybreak: Cannot get tunable$ ethtool -Q eth0 queue_mask 0x1 --show-coalesceCannot get device per queue parameters: Not supported

186.9 FEC and cable diagnostics

Output
cumulus@switch:~$ sudo ethtool --show-fec swp1FEC parameters for swp1:Configured FEC encodings: AutoActive FEC encoding: Off
  • FEC corrects bit errors at the receiver on high-speed links (RS-FEC on 25G/100G).
  • --set-fec eth0 encoding auto | off | rs | baser | llrs (combinable, e.g. auto rs).
  • If FEC does not match on both ends, the link does not come up at all.
Output
Command: ethtool --cable-test <interface> Cable test completed for device eth0.Pair A code OKPair B code OKPair C code Open Circuit
  • --cable-test reports each pair OK / open / short; Pair C Open Circuit = a break or loose connector on that pair.
  • --cable-test-tdr gives raw reflections in metres (first, last, step, pair options; 0-150 m).

186.10 Module power, PLCA, MAC Merge, PSE

FeatureCommandsWhat it is
Module power--show-module, --set-module power-mode-policy high|autoauto = low power when the port is down
PLCA (10BASE-T1S)--get-plca-cfg, --set-plca-cfg enable on node-id 0 node-cnt 8, --get-plca-statusMany nodes share one pair (cars, factories); round-robin turns; node 0 is coordinator
MAC Merge--show-mm, --set-mm pmac-enabled on tx-enabled on verify-enabled onFrame preemption: urgent frame interrupts a big frame (TSN)
PoDL PSE--show-pse, --set-pse podl-pse-admin-control enable|disablePower over the single-pair data cable
Output
$ ethtool --show-module eth0Module parameters for eth0:$ ethtool --show-pse eth0netlink error: No PHY foundnetlink error: Not supported

186.11 Common mistakes

  • Reading Not supported as a wrong command: the driver (veth) just does not implement it.
  • Running --reset or -X changes on a live production link outside a maintenance window.
  • Mismatched FEC on the two ends of a 25G/100G link: link stays down.
  • Leaving only one queue active, so one CPU handles all receive interrupts.

186.12 Interview tips

  • One CPU at 100%, others idle: check channels (-l) and the RSS table (-x); maybe only one queue is active.
  • Steer port 22 to a queue: check -l and ntuple in -k, add -N eth0 flow-type tcp4 dst-port 22 action 1, verify with -n; more queues via -X context new.
  • RSS = hash of IPs/ports -> indirection table -> queue -> CPU.
  • Link down on 100G with good optics: compare FEC on both ends (--show-fec).