Swconfig shows 7 Ports for TD-W8980

Hi, asking again for a help. I've just flashed OpenWrt on TD-W8980 using serial console and it's working pretty darn good so far.

Now I would like to setup VLANs on it. However luci switch config shows only LAN1 - LAN4 and CPU (eth0), but swconfig shows 7.

# swconfig dev switch0 show
Global attributes:
	enable_vlan: 1
Port 0:
	uvr: 0
	vsr: 0
	vinr: 0
	tvm: 0
	pvid: 1
	link: port:0 link:down
Port 1:
	uvr: 0
	vsr: 0
	vinr: 0
	tvm: 0
	pvid: 1
	link: port:1 link:down
Port 2:
	uvr: 0
	vsr: 0
	vinr: 0
	tvm: 0
	pvid: 1
	link: port:2 link:up speed:1000baseT full-duplex auto
Port 3:
	uvr: 0
	vsr: 0
	vinr: 0
	tvm: 0
	pvid: 1
	link: port:3 link:down
Port 4:
	uvr: 0
	vsr: 0
	vinr: 0
	tvm: 0
	pvid: 1
	link: port:4 link:down
Port 5:
	uvr: 0
	vsr: 0
	vinr: 0
	tvm: 0
	pvid: 1
	link: port:5 link:up speed:1000baseT full-duplex auto
Port 6:
	uvr: 0
	vsr: 0
	vinr: 0
	tvm: 0
	pvid: 1
	link: port:6 link:up speed:1000baseT full-duplex auto
VLAN 1:
	vid: 1
	enable: 1
	ports: 0 2 4 5 6t 

My question is why swconfig shows 7 ports?

Many thanks.

The switch needs to be connected to the CPU too, that makes five ports. The sixth one may be unused, or connected to the wireless chipset, it all depends on the hardware.

4 Likes

Could it also be dsl0? Considered as "switched" port?

Sorry, but I have no idea...

Googling suggests that uses the same SOC ( XWAY VRX268 with a PEF7071V) as the BT hub 5a.

On the BT hub the extra port is exposed as a WAN port, intended for use with an external modem when the internal VDSL modem is not used, so I'd guess it would likely be unused on yours.

See:- How can we make the lantiq xrx200 devices faster

The lantiq SoC supports an additional interface (WAN) which is used by only one modem supported by openwrt.

https://wikidevi.com/wiki/BT_Home_Hub_5A
Per the VRX268 product brief, the VRX268 SoC has an internal GbE switch
w/ two internal Ethernet PHYs (each functioning as either a single GbE PHY
or dual FE PHY) and support for three external PHYs via MII/RMII/RGMII.

1 Like

Sorry I feel stupid now (and bit ashamed), but swconfig actually shows 7 ports (starts from zero and ends by 6). I understand 0 = CPU (not real port). Then there are 4 physical ports on back side of router. Even with additional WAN, there is one more left. But I would rather say 2 unknown ports, because there are actually 3 physical LANs and 1 WAN port. So to recap:

0 - CPU
1 - LAN1
2 - LAN2
3 - LAN3
4 - WAN
5 - ???
6 - ???

This is not "strange" as many SoCs are designed for general use with 6 or 7 ports:

  • WAN
  • 4x LAN
  • CPU (making 6)
  • Second CPU (for 7)

The driver "sees" all seven, then the OpenWrt configuration "hides" the unconnected ones from the configuration (and often helpfully renumbers them for humans to read).

Here's one that caught my eye, where a "bizarre" numbering scheme is arranged for easier, end-user config:

        buffalo,wzr-hp-g302h-a1a0)
                ucidef_add_switch "switch0" \
                        "0@eth0" "1:lan:1" "3:lan:4" "4:lan:3" "5:lan:2" "2:wan"

As I recall, the first number is the switch-driver number, then a "use", then a config number. Without this, it probably would have shown up as

  • LAN 1
  • WAN
  • LAN 4
  • LAN 3
  • LAN 2

Edit: From a typical switch ASIC, which may not be the one in your device https://lafibre.info/images/doc/201106_spec_AR8327.pdf

2 Likes

thank you @jeff. Didn't though router having two CPUs appearing as ports in OpenWrt.

So my hopefully last question, will be regarding port tagging. So considering ports 6 and 7 are CPU and there is also port 0 being CPU too (just my speculation). You don't use ports 6 and 7 in VLAN tagging, but port 0 only. Right? So port 0 is some kind of aggregate for those 6 and 7 CPU ports?

"Port 0" Edit: "Port 6"1 is likely connected with "wires" inside the SoC, something called GMII or RGMII. So it is a real "port" as far as the switch goes, just not one that you can plug a cable into. Since there is only one connection to the CPU, VLAN tags are used to separate the WAN traffic from the LAN traffic. OpenWrt typically uses VLAN 1 and 2 for this, and both the CPU interface and the switch need to be tagged.

VLAN tags past that are of your choice as to how you want to use the accessible ports for your needs. Typically the CPU's interface needs to be aware of the VLAN (eth0.15 or whatever), the switch needs to have the VLAN declared and tagged on the CPU port, then your choice if it is tagged or untagged on the port(s) that you can access. (Two, untagged VLANs on the same port is generally misconfiguration.)

1 The TD-W8980 was later seen in source to use port 6 as the "CPU" port and use port 0 as a "LAN" port.

2 Likes

So it is a real "port" as far as the switch goes, just not one that you can plug a cable into

that's how I meant it

I believe I understand concept of VLANs (and also role of CPU in it). But still I scratch my about port 5 and 6. Like what is their purpose on this device. I've looked in product page https://openwrt.org/toh/tp-link/td-w8980 and I see config where port 6 is being used in classical WAN/LAN separation using VLANs, but for example ports 1 and 3 are not present in that configuration at all. I know that port ordering sometimes doesn't match with physical ports ordering.

config interface 'lan'
	option ifname 'eth0.1'
	option force_link '1'
	option type 'bridge'
	option proto 'static'
	option ipaddr '192.168.0.1'
	option netmask '255.255.255.0'
	option ip6assign '60'

config interface 'wan'
	option ifname 'eth0.2'
	option proto 'dhcp'

config interface 'wan6'
	option ifname 'eth0.2'
	option proto 'dhcpv6'

config switch
	option name 'switch0'
	option reset '1'
	option enable_vlan '1'

config switch_vlan
	option device 'switch0'
	option vlan '1'
	option ports '0 2 5 6t'

config switch_vlan
	option device 'switch0'
	option vlan '2'
	option ports '4 6t'

EDIT: So in this configuration port 6 looks like being CPU (tagged). Ports 1 and 3 are not present at all. And the ports 0, 2, 5, 4 being 3x LAN and one WAN. But who knows which one is what.

tplink,tdw8970|tplink,tdw8980)
        wan_mac=$(macaddr_add "$(mtd_get_mac_binary boardconfig 0xf100)" 1)
        ucidef_add_switch "switch0" \
                "0:lan:2" "2:lan:3" "4:lan:4" "5:lan:1" "6t@eth0"
        ;;

The TD-W8980 was added a long time ago (2015), back when the commit messages were often terse, so it's hard to say more than "it works that way".

1 Like

Awesome. This answers my question. So port 1 and 3 are really not used. Why swconfig is showing them then :)?

The driver doesn't know anything about how the ports are used or wired up. swconfig "talks" to the driver. One way to think of it is a USB driver that doesn't have anything plugged in. The driver says "there's a USB port there and you can configure it". Reality says "but without anything connected, it isn't going to gain you much if you do".

2 Likes

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.