Show lan port speed or unconnected

In command line, how do I read the state of the port ?
The switch is the MT7530 inside the MT7621 chip
system message show alone:

[  630.238798] mt7530 mdio-bus:1f lan1: Link is Down
[  656.153255] mt7530 mdio-bus:1f lan1: Link is Up - 1Gbps/Full - flow control rx/tx

But every attempt to ask it has failed.

root@OpenWrt:/# swconfig dev switch0 port 0 show
Failed to connect to the switch. Use the "list" command to see which switches are available.
root@OpenWrt:/# swconfig list
root@OpenWrt:/# swconfig show
swconfig list

mt7530 does not use swconfig, it's dsa based (and I'd expect ethtool to work).


Maybe something like this would give you inspiration

There’s only a handful of lines in there that are Gargoyle specific, and they shouldn’t impact you on DSA.

This is very complex for my understanding skills.
But I think it use the same command that doesn't work for me.

99 LINK=$(swconfig dev switch0 port $LOGICAL get link | cut -f2,3 -d" ")

As per the other reply, you need to be looking at DSA anyway, so you’re in the wrong part of the script. Forget about swconfig (on this device).

Rather than trying to understand the script, you could just give it a go.
Or if you post the contents of /etc/board.json, I’ll run the script against it and show you what the output would be. If you want to use it further you can go from there.

This work:

ethtool lan1
Speed: 1000Mb/s
Speed: Unknown!
Speed: 100Mb/s

I am trying to show 10Mb/s, but for the moment it does not appear, connecting only two eth wire.

I have an RGB LED for ETH and I want to do,
Blue 1000
Green 100
Red 10

How to show 10Ms ?
ethol show it is possible.
2 wire, only green or only orange, do not connect
Orange to green or green to orange, do not connect.

Router is TP-Link Archer C6
Maybe this router cannot work at 10Ms ?

root@OpenWrt:/# ethtool lan1
Settings for lan1:
        Supported ports: [ TP MII ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/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
        Advertised pause frame use: Symmetric Receive-only
        Advertised auto-negotiation: Yes
        Advertised FEC modes: Not reported
        Speed: Unknown!
        Duplex: Unknown! (255)
        Port: Twisted Pair
        PHYAD: 4
        Transceiver: external
        Auto-negotiation: on
        MDI-X: Unknown
        Supports Wake-on: d
        Wake-on: d
        Link detected: no

It doesn't work this way. You need at least 2 pairs.

1 Like