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.
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.
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:
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:
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.
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.
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.
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".