Tool for VCT (Virtual Cable Test) for QCA switches and others wanted

Many devices containing switches have a cable test function available in the UI of the stock firmware, that leverages VCT functions available in e.g. the AR9331, QCA8337, and other chips.

I tried searching for tool, that I could use on Openwrt to (automatically?) measure cable lengths for all devices/individual_ports, but wasn't successful. Or is this built in, and some SNMP MIB makes this info available, if enabled somewhere?

Does somebody know a way? Or could I cobble (easily?) something together using some command-line MDIO-Write/Read tool?

1 Like

You may be interested in this link[1]. Ethtool has cable-test options. This requires support from the PHY driver :slight_smile:

  1. https://linuxplumbersconf.org/event/4/contributions/436/attachments/217/388/cable-diagnostics.pdf
2 Likes

Yes, ethtool has these options --cable-test & --cable-test-tdr, but I haven't found a device yet, where it works. I usually get something like:

netlink error: PHY driver does not support cable testing
netlink error: Operation not supported

Digging a bit, it seems to be implemented for (some? DSA?) Marvell drivers, and in the rpi4 (https://github.com/torvalds/linux/blob/master/drivers/net/phy/bcm-phy-lib.c) since commit https://github.com/torvalds/linux/commit/11ecf8c55b91806e4dc6a1b9fe7cbf68cdc9b006

Testing on Openwrt complains about missing netlink support in ethtool, which doesn't seem to be an explicit option in the build system, but may be included in ethtool-full. I'll try that later today.

@stragies i m interrested by the outcome of your experimentations, i digged the topic for the raspi4 unsuccessfully did you get any results .

1 Like

This piqued my curiosity based on the purportedly support on Marvell. This is what I get on Linksys WRT1900ACS on 23.05.3, X86-64 on SNAPSHOT 6.6, and Dell Vostro on Linux Mint:

"Summary”

Linksys WRT1900ACS on OpenWrt 23.05.3

root@WRT1900ACS-AP:~# ethtool --cable-test lan1 # Cable connected
Cable test started for device lan1.
Cable test completed for device lan1.
Pair A code OK
Pair B code OK
Pair C code OK
Pair D code OK

root@WRT1900ACS-AP:~# ethtool --cable-test lan2 # No cable connected
Cable test started for device lan2.
Cable test completed for device lan2.
Pair A code Open Circuit
Pair B code Open Circuit
Pair C code Open Circuit
Pair D code Open Circuit
Pair A, fault length: 9.60m
Pair B, fault length: 10.40m
Pair C, fault length: 8.80m
Pair D, fault length: 8.00m

root@WRT1900ACS-AP:~# ethtool --json --cable-test lan1 # Cable connected
[ {
"pair": "Pair A",
"code": "OK"
},{
"pair": "Pair B",
"code": "OK"
},{
"pair": "Pair C",
"code": "OK"
},{
"pair": "Pair D",
"code": "OK"
} ]

root@WRT1900ACS-AP:~# ethtool --json --cable-test lan2 # No cable connected
[ {
"pair": "Pair A",
"code": "Open Circuit"
},{
"pair": "Pair B",
"code": "Open Circuit"
},{
"pair": "Pair C",
"code": "Open Circuit"
},{
"pair": "Pair D",
"code": "Open Circuit"
},{
"pair": "Pair A",
"length": 8.8
},{
"pair": "Pair B",
"length": 6.4
},{
"pair": "Pair C",
"length": 8.8
},{
"pair": "Pair D",
"length": 8.8
} ]

root@WRT1900ACS-AP:~# ethtool --cable-test-tdr lan1
Cable test TDR started for device lan1.
Cable test TDR completed for device lan1.
TDR Pulse 1000mV
Step configuration: 0.80-149.73 meters in 0.80m steps
Pair A Amplitude -93
Pair B Amplitude -7
Pair C Amplitude 640
Pair D Amplitude 7
Pair A Amplitude -85
Pair B Amplitude -46
Pair C Amplitude 492
Pair D Amplitude -7
Pair A Amplitude -7
Pair B Amplitude -15
Pair C Amplitude 117
Pair D Amplitude 0
Pair A Amplitude -15
Pair B Amplitude -7
Pair C Amplitude -85
Pair D Amplitude -15

Linux Mint Intel

user@Vostro-7620:~$ ethtool --cable-test *
netlink error: Operation not permitted

X86-64 on Openwrt (6.6) SNAPSHOT

roott@RuralRoots:~# ethtool --cable-test-tdr eth0
netlink error: PHY driver does not support cable test TDR
netlink error: Not supported
root@RuralRoots:~# ethtool --cable-test eth0
netlink error: PHY driver does not support cable testing
netlink error: Not supported

So it is supported on Marvell, though results returned on subsequent repeated calls vary wildly - aka “needs work?”

1 Like