Thanks!
You should be able to try an unused port, and plug in a patch cable and leave the other end unplugged to get output like this (using a 10m cable):
root@ap15:~# ethtool --cable-test eth1
Cable test started for device eth1.
Cable test completed for device eth1.
Pair A code Open Circuit
Pair B code Open Circuit
Pair C code Open Circuit
Pair D code Open Circuit
Pair A, fault length: 10.40m
Pair B, fault length: 10.40m
Pair C, fault length: 10.40m
Pair D, fault length: 10.40m
This can be useful for diagnosing bad fixed cabling in the building. It can be useful to run several times to get an average or to spot marginal cabling.
You’re correct that your --cable-test-tdr
is truncated output. Do you see a message in the kernel log messages Timeout while waiting for cable test to finish
?
If you have time this patch should fix the missing output and would add some useful dmesg
debug output for me to fine tune the timings before submitting to the linux-net mailing list for inclusion into the upstream mainline kernel.
Once we know that complete output is created with the patch applied, then the time to complete a test would also be useful with time ethtool --cable-test-tdr eth2 > /dev/null
.
The patch is for OpenWrt snapshot, but should also apply to earlier kernels as well as mainline Linux.
Index: linux-6.6.61/drivers/net/phy/marvell.c
===================================================================
--- linux-6.6.61.orig/drivers/net/phy/marvell.c
+++ linux-6.6.61/drivers/net/phy/marvell.c
@@ -38,6 +38,9 @@
#include <asm/irq.h>
#include <linux/uaccess.h>
+/* For timing debugging only TODO remove */
+#include <linux/time.h>
+
#define MII_MARVELL_PHY_PAGE 22
#define MII_MARVELL_COPPER_PAGE 0x00
#define MII_MARVELL_FIBER_PAGE 0x01
@@ -2042,14 +2045,24 @@ static int marvell_vct5_wait_complete(st
{
int i;
int val;
+ u64 entrystamp, exitstamp;
+ entrystamp = ktime_get_ns();
+
+ usleep_range(5000, 10000);
+ /* msleep(10); */
- for (i = 0; i < 32; i++) {
+ for (i = 0; i < 100; i++) {
val = __phy_read(phydev, MII_VCT5_CTRL);
if (val < 0)
return val;
- if (val & MII_VCT5_CTRL_COMPLETE)
+ if (val & MII_VCT5_CTRL_COMPLETE) {
+ exitstamp = ktime_get_ns();
+ phydev_warn(phydev, "Got VCT5 ctrl data after polling %d times\n", i);
+ phydev_warn(phydev, "Got VCT5 after %llu ns\n", exitstamp - entrystamp);
return 0;
+ }
+ usleep_range(800, 1200);
}
phydev_err(phydev, "Timeout while waiting for cable test to finish\n");
If you prefer I can also build a test kernel for you to try…