Ethernet cable test with raw TDR data reporting bug fix - testers needed

Yes, it seems to be working, too:

root@router:~# 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   62
Pair B Amplitude  148
Pair C Amplitude  203
Pair D Amplitude  140
Pair A Amplitude  148
Pair B Amplitude  203
Pair C Amplitude  132
Pair D Amplitude   31
Pair A Amplitude  171
Pair B Amplitude  101
Pair C Amplitude    7
Pair D Amplitude    0
...
1 Like

The basic "does it work or not?" can be done with the a standard release or snapshot build. If it doesn't work with the standard builds, and people are willing to try my debug patch (but aren't able to create debug images themselves), please let me know and I can create images for you to download (either to install to flash or to tftp boot so that it will stay in RAM and not touch your existing flash install).

1 Like

out of curiosity

root@192.168.1.19's password: 


BusyBox v1.36.1 (2023-10-19 22:41:41 UTC) built-in shell (ash)

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 OpenWrt 23.05.0, r23497-6637af95aa
 -----------------------------------------------------
root@EA8300:~# ethtool --cable-test lan1
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@EA8300:~# ethtool --cable-test-tdr lan1
netlink error: PHY driver does not support cable test TDR
netlink error: Not supported
root@EA8300:~# ethtool lan1
Settings for lan1:
	Supported ports: [ TP	 MII ]
	Supported link modes:   10baseT/Half 10baseT/Full
	                        100baseT/Half 100baseT/Full
	                        1000baseT/Full
	Supported pause frame use: Symmetric Receive-only
	Supports auto-negotiation: Yes
	Supported FEC modes: Not reported
	Advertised link modes:  10baseT/Half 10baseT/Full
	                        100baseT/Half 100baseT/Full
	                        1000baseT/Full
	Advertised pause frame use: Symmetric Receive-only
	Advertised auto-negotiation: Yes
	Advertised FEC modes: Not reported
	Link partner advertised link modes:  10baseT/Half 10baseT/Full
	                                     100baseT/Half 100baseT/Full
	                                     1000baseT/Full
	Link partner advertised pause frame use: Symmetric Receive-only
	Link partner advertised auto-negotiation: Yes
	Link partner advertised FEC modes: Not reported
	Speed: 1000Mb/s
	Duplex: Full
	Auto-negotiation: on
	Port: Twisted Pair
	PHYAD: 0
	Transceiver: external
	MDI-X: on (auto)
	Supports Wake-on: d
	Wake-on: d
	Link detected: yes
root@EA8300:~# ethtool --cable-test lan3
Cable test started for device lan3.
Cable test completed for device lan3.
Pair A code OK
Pair B code OK
Pair C code OK
Pair D code OK
root@EA8300:~# ethtool --cable-test-tdr lan3
netlink error: PHY driver does not support cable test TDR
netlink error: Not supported
root@EA8300:~# ethtool lan3
Settings for lan3:
	Supported ports: [ TP	 MII ]
	Supported link modes:   10baseT/Half 10baseT/Full
	                        100baseT/Half 100baseT/Full
	                        1000baseT/Full
	Supported pause frame use: Symmetric Receive-only
	Supports auto-negotiation: Yes
	Supported FEC modes: Not reported
	Advertised link modes:  10baseT/Half 10baseT/Full
	                        100baseT/Half 100baseT/Full
	                        1000baseT/Full
	Advertised pause frame use: Symmetric Receive-only
	Advertised auto-negotiation: Yes
	Advertised FEC modes: Not reported
	Link partner advertised link modes:  10baseT/Half 10baseT/Full
	                                     100baseT/Half 100baseT/Full
	                                     1000baseT/Full
	Link partner advertised pause frame use: Symmetric Receive-only
	Link partner advertised auto-negotiation: Yes
	Link partner advertised FEC modes: Not reported
	Speed: 1000Mb/s
	Duplex: Full
	Auto-negotiation: on
	Port: Twisted Pair
	PHYAD: 2
	Transceiver: external
	MDI-X: on (auto)
	Supports Wake-on: d
	Wake-on: d
	Link detected: yes
root@EA8300:~# 


root@EA8300:~# ethtool eth0
Settings for eth0:
	Supported ports: [ MII ]
	Supported link modes:   1000baseT/Full
	Supported pause frame use: Symmetric Receive-only
	Supports auto-negotiation: Yes
	Supported FEC modes: Not reported
	Advertised link modes:  1000baseT/Full
	Advertised pause frame use: Symmetric Receive-only
	Advertised auto-negotiation: No
	Advertised FEC modes: Not reported
	Link partner advertised link modes:  1000baseT/Full
	Link partner advertised pause frame use: Symmetric Receive-only
	Link partner advertised auto-negotiation: No
	Link partner advertised FEC modes: Not reported
	Speed: 1000Mb/s
	Duplex: Full
	Auto-negotiation: on
	Port: MII
	PHYAD: 0
	Transceiver: internal
	Link detected: yes
root@EA8300:~# ethtool --cable-test-tdr eth0
netlink error: Not supported
root@EA8300:~# ethtool --cable-test eth0
netlink error: Not supported


nice feacture :wink:

for ZyXEL GS1900-8 Switch not work at all

I install on both ethtool-full for test
cheers!

1 Like

That's going to require work. Have a look at the RTL83xx support thread and the source dumps. The rtl8218 phy has hardware support for cable tests, but it's not in the drivers in openwrt.

2 Likes

Ohhhh :roll_eyes: :grimacing: tnx for that info. I look in that thread for more info.

1 Like

Thanks for pointing this out. I just had to try.

I had an old and cheap copper SFP in a ZyXEL GS1900-10HP:

root@gs1900-10hp-f:~# ethtool -m lan9
        Identifier                                : 0x03 (SFP)
        Extended identifier                       : 0x04 (GBIC/SFP defined by 2-wire interface ID)
        Connector                                 : 0x00 (unknown or unspecified)
        Transceiver codes                         : 0x00 0x00 0x00 0x08 0x00 0x00 0x00 0x00 0x00
        Transceiver type                          : Ethernet: 1000BASE-T
        Encoding                                  : 0x01 (8B/10B)
        BR, Nominal                               : 1300MBd
        Rate identifier                           : 0x00 (unspecified)
        Length (SMF,km)                           : 0km
        Length (SMF)                              : 0m
        Length (50um)                             : 0m
        Length (62.5um)                           : 0m
        Length (Copper)                           : 100m
        Length (OM3)                              : 0m
        Laser wavelength                          : 0nm
        Vendor name                               : OEM
        Vendor OUI                                : 00:0b:40
        Vendor PN                                 : GLC-T
        Vendor rev                                : B
        Option values                             : 0x00 0x1a
        Option                                    : RX_LOS implemented
        Option                                    : TX_FAULT implemented
        Option                                    : TX_DISABLE implemented
        BR margin, max                            : 0%
        BR margin, min                            : 0%
        Vendor SN                                 : M0312A804
        Date code                                 : 130823

The phy inside that SFP is a Marvell 88E1111:

root@gs1900-10hp-f:~# grep . /sys/class/net/lan9/phydev/phy_id
0x01410cc2

I believe this is very common for 1G copper SFPs.

So I "backported" commit d133ef1ee2a2 ("net: phy: marvell: implement cable test for 88E1111") by simply copying it to target/linux/generic/backport-6.6/ along with a few commits touching the same driver (simpler than editing the patch). Complete list of commits:

  • 9cc8a6e62624 net: ethtool: Add impedance mismatch result code to cable test
  • ada9841e3e66 net: phy: marvell: add basic support of 88E308X/88E609X family
  • a9e4230d0b22 net: phy: marvell: implement cable-test for 88E308X/88E609X family
  • d133ef1ee2a2 net: phy: marvell: implement cable test for 88E1111

And I believe it works. Unfortunately I have nothing connected to that SFP, and the switch is in a remote location so I can't do anthing about it at the moment. So this is all I can show:

root@gs1900-10hp-f:~# ethtool  --cable-test lan9
Cable test started for device lan9.
Cable test completed for device lan9.
Pair A code Open Circuit
Pair A, fault length: 0.00m
Pair B code Open Circuit
Pair B, fault length: 0.00m
Pair C code Open Circuit
Pair C, fault length: 0.00m
Pair D code Open Circuit
Pair D, fault length: 0.00m

Really nice to have the abilty to test cables with equipment as cheap and easily available as that!

Would love to see cable tests implemented for the internal phys in that switch as well. A nice task for anyone interested. The functionality is documented in the realtek SDK code

6 Likes

The EA8300 supports cable test via it's QCA8075 switch chip (but not on the WAN port which has a different PHY with either no such capability, or no Linux driver support looks like the wan PHY is also supported). The cable test itself measures various parameters and likely includes TDR data, but doesn't have a way for the kernel to access the raw TDR data (or at least no driver support). If you put a patch cable in, but leave the other end disconnected, you'll probably see a "cable break at xx metres" type message.

1 Like

:clap::clap::clap: Fabulous !

OpenWrt 23.05.0, r23497-6637af95aa
 -----------------------------------------------------
root@EA8300:~# ethtool --cable-test lan1
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@EA8300:~# ethtool --cable-test lan2
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: 0.80m
Pair B, fault length: 0.00m
Pair C, fault length: 0.00m
Pair D, fault length: 0.80m
root@EA8300:~# ethtool --cable-test lan3
Cable test started for device lan3.
Cable test completed for device lan3.
Pair A code OK
Pair B code OK
Pair C code OK
Pair D code OK
root@EA8300:~# ethtool --cable-test lan4
Cable test started for device lan4.
Cable test completed for device lan4.
Pair A code Open Circuit
Pair B code Open Circuit
Pair C code Open Circuit
Pair D code Open Circuit
Pair A, fault length: 0.80m
Pair B, fault length: 0.00m
Pair C, fault length: 0.00m
Pair D, fault length: 0.80m
root@EA8300:~# ethtool --cable-test wan
Cable test started for device wan.
Cable test completed for device wan.
Pair A code Open Circuit
Pair B code Open Circuit
Pair C code Open Circuit
Pair D code Open Circuit
Pair A, fault length: 0.80m
Pair B, fault length: 0.00m
Pair C, fault length: 0.80m
Pair D, fault length: 0.80m
root@EA8300:~# debug1: client_input_channel_req: channel 0 rtype keepalive@openssh.com reply 1
root@EA8300:~# ethtool --cable-test wan
Cable test started for device wan.
Cable test completed for device wan.
Pair A code Open Circuit
Pair B code Open Circuit
Pair C code Open Circuit
Pair D code Open Circuit
Pair A, fault length: 0.80m
Pair B, fault length: 0.00m
Pair C, fault length: 0.80m
Pair D, fault length: 0.80m
root@EA8300:~# ethtool --cable-test lan4
Cable test started for device lan4.
Cable test completed for device lan4.
Pair A code Open Circuit
Pair B code Open Circuit
Pair C code Open Circuit
Pair D code Open Circuit
Pair A, fault length: 2.40m
Pair B, fault length: 2.40m
Pair C, fault length: 1.60m
Pair D, fault length: 2.40m
root@EA8300:~# ethtool --cable-test lan3
Cable test started for device lan3.
Cable test completed for device lan3.
Pair A code OK
Pair B code OK
Pair C code OK
Pair D code OK
root@EA8300:~# ethtool --cable-test lan2
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: 4.00m
Pair B, fault length: 3.20m
Pair C, fault length: 3.20m
Pair D, fault length: 4.00m
root@EA8300:~# ethtool --cable-test lan1
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@EA8300:~# debug1: client_input_channel_req: channel 0 rtype keepalive@openssh.com reply 1
debug1: client_input_channel_req: channel 0 rtype keepalive@openssh.com reply 1
root@EA8300:~# ethtool --cable-test lan1
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@EA8300:~# ethtool --cable-test lan2
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: 3.20m
Pair B, fault length: 3.20m
Pair C, fault length: 4.00m
Pair D, fault length: 3.20m
root@EA8300:~# ethtool --cable-test lan3
Cable test started for device lan3.
Cable test completed for device lan3.
Pair A code OK
Pair B code OK
Pair C code OK
Pair D code OK
root@EA8300:~# ethtool --cable-test lan4
Cable test started for device lan4.
Cable test completed for device lan4.
Pair A code Open Circuit
Pair B code Open Circuit
Pair C code Open Circuit
Pair D code Open Circuit
Pair A, fault length: 4.80m
Pair B, fault length: 4.80m
Pair C, fault length: 0.00m
Pair D, fault length: 4.80m
root@EA8300:~# ethtool --cable-test wan
Cable test started for device wan.
Cable test completed for device wan.
Pair A code Open Circuit
Pair B code Open Circuit
Pair C code Open Circuit
Pair D code Open Circuit
Pair A, fault length: 0.80m
Pair B, fault length: 1.60m
Pair C, fault length: 0.80m
Pair D, fault length: 0.80m
root@EA8300:~# ethtool --cable-test wan
Cable test started for device wan.
Cable test completed for device wan.
Pair A code Open Circuit
Pair B code Open Circuit
Pair C code Open Circuit
Pair D code Open Circuit
Pair A, fault length: 0.80m
Pair B, fault length: 1.60m
Pair C, fault length: 0.80m
Pair D, fault length: 0.80m
root@EA8300:~# debug1: client_input_channel_req: channel 0 rtype keepalive@openssh.com reply 1
root@EA8300:~# ethtool --cable-test wan
Cable test started for device wan.
Cable test completed for device wan.
Pair A code OK
Pair B code OK
Pair C code OK
Pair D code OK
root@EA8300:~# ethtool --cable-test lan4
Cable test started for device lan4.
Cable test completed for device lan4.
Pair A code OK
Pair B code OK
Pair C code OK
Pair D code OK
root@EA8300:~# ethtool --cable-test lan3
Cable test started for device lan3.
Cable test completed for device lan3.
Pair A code OK
Pair B code OK
Pair C code OK
Pair D code OK
root@EA8300:~# ethtool --cable-test lan2
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: 0.80m
Pair B, fault length: 1.60m
Pair C, fault length: 0.00m
Pair D, fault length: 0.80m
root@EA8300:~# ethtool --cable-test lan1
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@EA8300:~# ethtool --cable-test lan1
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@EA8300:~# ethtool --cable-test lan2
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: 2.40m
Pair B, fault length: 1.60m
Pair C, fault length: 0.00m
Pair D, fault length: 0.80m
root@EA8300:~# ethtool --cable-test lan3
Cable test started for device lan3.
Cable test completed for device lan3.
Pair A code OK
Pair B code OK
Pair C code OK
Pair D code OK
root@EA8300:~# ethtool --cable-test lan4
Cable test started for device lan4.
Cable test completed for device lan4.
Pair A code OK
Pair B code OK
Pair C code OK
Pair D code OK
root@EA8300:~# ethtool --cable-test wan
Cable test started for device wan.
Cable test completed for device wan.
Pair A code OK
Pair B code OK
Pair C code OK
Pair D code OK
root@EA8300:~# ethtool --cable-test wan
Cable test started for device wan.
Cable test completed for device wan.
Pair A code Open Circuit
Pair B code Open Circuit
Pair C code Open Circuit
Pair D code Open Circuit
Pair A, fault length: 8.00m
Pair B, fault length: 8.00m
Pair C, fault length: 8.00m
Pair D, fault length: 8.00m
root@EA8300:~# debug1: client_input_channel_req: channel 0 rtype keepalive@openssh.com reply 1
root@EA8300:~# ethtool --cable-test wan
Cable test started for device wan.
Cable test completed for device wan.
Pair A code Open Circuit
Pair B code Open Circuit
Pair C code Open Circuit
Pair D code Open Circuit
Pair A, fault length: 8.80m
Pair B, fault length: 8.00m
Pair C, fault length: 8.00m
Pair D, fault length: 8.00m
root@EA8300:~# ethtool --cable-test lan1
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@EA8300:~# ethtool --cable-test lan2
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: 2.40m
Pair B, fault length: 1.60m
Pair C, fault length: 0.00m
Pair D, fault length: 0.80m
root@EA8300:~# ethtool --cable-test lan3
Cable test started for device lan3.
Cable test completed for device lan3.
Pair A code OK
Pair B code OK
Pair C code OK
Pair D code OK
root@EA8300:~# ethtool --cable-test lan4
Cable test started for device lan4.
Cable test completed for device lan4.
Pair A code OK
Pair B code OK
Pair C code OK
Pair D code OK
root@EA8300:~# ethtool --cable-test wan
Cable test started for device wan.
Cable test completed for device wan.
Pair A code Open Circuit
Pair B code Open Circuit
Pair C code Open Circuit
Pair D code Open Circuit
Pair A, fault length: 8.80m
Pair B, fault length: 8.00m
Pair C, fault length: 8.00m
Pair D, fault length: 8.00m
root@EA8300:~# 


Well, I have tried several situations and the wan port connection does work.
Some are made with the cable disconnected, others connected. The last wan of the code is made with the cable disconnected so that it goes to R7800 to know the meters I have up to it.

The other measurements are with cables of:
1.5m
3.20m
4.80m to a rosette
8m from wan to lan1 of r7800
etc...with or without anything connected to the end of the cables.

QCA8075 yes thanks, I already knew that EA8300 had this switch

edit
for the record tdr dont work

root@EA8300:~# ethtool --cable-test-tdr lan1
netlink error: PHY driver does not support cable test TDR
netlink error: Not supported
root@EA8300:~# ethtool --cable-test-tdr wan
netlink error: PHY driver does not support cable test TDR
netlink error: Not supported

1 Like

Hi.
For TpLink 1043ND v2 with ethtool-full this switch not work as per abobe post

Sat Nov 30 22:45:45 2024 kern.info kernel: [    0.884335] switch0: Atheros AR8327 rev. 4 switch registered on mdio.0
Sat Nov 30 22:45:45 2024 kern.info kernel: [    1.538227] ag71xx 19000000.eth: connected to PHY at mdio.0:00 [uid=004dd034, driver=Atheros AR8216/AR8236/AR8316]
Sat Nov 30 22:45:45 2024 kern.info kernel: [    1.549383] eth0: Atheros AG71xx at 0xb9000000, irq 4, mode: rgmii
Sat Nov 30 22:45:45 2024 kern.info kernel: [    1.900935] ag71xx 1a000000.eth: connected to PHY at fixed-0:00 [uid=00000000, driver=Generic PHY]
Sat Nov 30 22:45:45 2024 kern.info kernel: [    1.910694] eth1: Atheros AG71xx at 0xba000000, irq 5, mode: sgmii
BusyBox v1.36.1 (2024-11-15 23:03:52 UTC) built-in shell (ash)

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 OpenWrt 23.05.0, r23497-6637af95aa
 -----------------------------------------------------
root@1043ND:~# ethtool --cable-test eth0
netlink error: PHY driver does not support cable testing
netlink error: Not supported
root@1043ND:~# ethtool --cable-test eth1
netlink error: PHY driver does not support cable testing
netlink error: Not supported
root@1043ND:~# ethtool --cable-test-tdr eth1
netlink error: PHY driver does not support cable test TDR
netlink error: Not supported
root@1043ND:~# ethtool --cable-test-tdr eth0
netlink error: PHY driver does not support cable test TDR
netlink error: Not supported
root@1043ND:~# 

I can confirm that.
cheers!

1 Like

QCA807x does not support TDR cable testing, it just has its own basic implementation

1 Like

Given the success with the 1000Base-T SFP, I wondered if something similar was possible with the typical 10GBase-T SFP+. The answer is unfortunately "most likely not".

The cheap FiberStore 30m 10GBase-T I have emulates a 10GBase-SR:

$ ethtool -m sfp2
        Identifier                                : 0x03 (SFP)
        Extended identifier                       : 0x04 (GBIC/SFP defined by 2-wire interface ID)
        Connector                                 : 0x07 (LC)
        Transceiver codes                         : 0x10 0x00 0x00 0x00 0x40 0x00 0x0c 0x00 0x00
        Transceiver type                          : 10G Ethernet: 10G Base-SR
        Transceiver type                          : FC: short distance (S)
        Transceiver type                          : FC: Multimode, 62.5um (M6)
        Transceiver type                          : FC: Multimode, 50um (M5)
        Encoding                                  : 0x06 (64B/66B)
        BR, Nominal                               : 10300MBd
        Rate identifier                           : 0x00 (unspecified)
        Length (SMF,km)                           : 0km
        Length (SMF)                              : 0m
        Length (50um)                             : 30m
        Length (62.5um)                           : 10m
        Length (Copper)                           : 0m
        Length (OM3)                              : 0m
        Laser wavelength                          : 850nm
        Vendor name                               : FS
        Vendor OUI                                : 00:00:00
        Vendor PN                                 : SFP-10G-T
        Vendor rev                                : 
        Option values                             : 0x00 0x1a
        Option                                    : RX_LOS implemented
        Option                                    : TX_FAULT implemented
        Option                                    : TX_DISABLE implemented
        BR margin, max                            : 10%
        BR margin, min                            : 88%
        Vendor SN                                 : F2220644072
        Date code                                 : 220824
[etc]

I assume it does this to work with any sort of SFP+ host, without requiring 10GBase-T or muligig support from the host. That's of course nice, as it makes both my Intel X520 and my Cisco C3560CX switch support multigig (by rate adaptation in the phy I assume).

The disadvantage is that the phy is completely hidden to the host, and so are all phy specific features like cable testing.

2 Likes

According to the datasheet "AR8327/AR8327N Seven-port Gigabit Ethernet Switch", there is cable test capability in the hardware (without raw TDR data access), but I assume there is no Linux driver support at the moment. I don't know how easy it would be to add because I haven't looked at the Atheros/Qualcomm cable test support and I'm not familiar with the kernel DSA code either. It might be relatively straightforward to add support (especially if the register layout is the same as other Atheros / Qualcomm switch chips).

1 Like

Thanks for the information
1043ndv2 still using switch config. DSA is not implemented.
Yes it's a shame this isn't here.

It also has Hardware NAT capabilities such as N. And it is not available in openwrt either.