Support for new Archer c5 v4

For those that wants some adventure, https://github.com/luizluca/openwrt/tree/c5v4_dsa is my current DSA branch based on https://github.com/openwrt/openwrt/pull/14418, to be used with the kernel 6.1.

You can start with this simple .config:

CONFIG_TARGET_ramips=y
CONFIG_TARGET_ramips_mt7620=y
CONFIG_TARGET_ramips_mt7620_DEVICE_tplink_archer-c5-v4=y
CONFIG_TESTING_KERNEL=y

And it should work. It is still using some pending upstream patches (861-net-dsa-realtek-openwrt.patch) that will be converted into backports once they got merged upstream.

Remember that this DSA driver still does not offload packet forwarding.

Updated. Some debug info added and force correct vlan config (pvids of default config)

Thanx. I understand why but I can't localize where :slight_smile:

Here are the logs, can you comment what changes are needed that you're implementing?

Bootlog:

root@OpenWrt:/# dmesg
[    0.000000] Linux version 4.14.275 (builder@buildhost) (gcc version 7.5.0 (OpenWrt GCC 7.5.0 r11427-9ce6aa9d8d)) #0 Sat Apr 16 13:13:32 2022
[    0.000000] Board has DDR2
[    0.000000] Analog PMU set to hw control
[    0.000000] Digital PMU set to hw control
[    0.000000] SoC Type: MediaTek MT7620A ver:2 eco:6
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 00019650 (MIPS 24KEc)
[    0.000000] MIPS: machine is TP-Link Archer C5 v4
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 04000000 @ 00000000 (usable)
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x0000000003ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x0000000003ffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000003ffffff]
[    0.000000] On node 0 totalpages: 16384
[    0.000000] free_area_init_node: node 0, pgdat 80486670, node_mem_map 81000040
[    0.000000]   Normal zone: 128 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 16384 pages, LIFO batch:3
[    0.000000] random: get_random_bytes called from 0x80487740 with crng_init=0
[    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[    0.000000] pcpu-alloc: [0] 0
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 16256
[    0.000000] Kernel command line: console=ttyS0,115200 rootfstype=squashfs,jffs2
[    0.000000] PID hash table entries: 256 (order: -2, 1024 bytes)
[    0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Writing ErrCtl register=0000a066
[    0.000000] Readback ErrCtl register=0000a066
[    0.000000] Memory: 58804K/65536K available (3937K kernel code, 185K rwdata, 504K rodata, 1188K init, 215K bss, 6732K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS: 256
[    0.000000] CPU Clock: 580MHz
[    0.000000] clocksource: systick: mask: 0xffff max_cycles: 0xffff, max_idle_ns: 583261500 ns
[    0.000000] systick: enable autosleep mode
[    0.000000] systick: running - mult: 214748, shift: 32
[    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 6590553264 ns
[    0.000009] sched_clock: 32 bits at 290MHz, resolution 3ns, wraps every 7405115902ns
[    0.007619] Calibrating delay loop... 385.84 BogoMIPS (lpj=1929216)
[    0.073564] pid_max: default: 32768 minimum: 301
[    0.078256] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.084640] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.097105] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.106652] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.112618] pinctrl core: initialized pinctrl subsystem
[    0.118922] NET: Registered protocol family 16
[    0.380826] PCI host bridge /pcie@10140000 ranges:
[    0.385434]  MEM 0x0000000020000000..0x000000002fffffff
[    0.390510]   IO 0x0000000010160000..0x000000001016ffff
[    0.413031] rt2880_gpio 10000600.gpio: registering 24 gpios
[    0.418426] rt2880_gpio 10000600.gpio: registering 24 irq handlers
[    0.424800] rt2880_gpio 10000660.gpio: registering 32 gpios
[    0.430172] rt2880_gpio 10000660.gpio: registering 32 irq handlers
[    0.436996] PCI host bridge to bus 0000:00
[    0.440917] pci_bus 0000:00: root bus resource [mem 0x20000000-0x2fffffff]
[    0.447641] pci_bus 0000:00: root bus resource [io  0x10160000-0x1016ffff]
[    0.454266] pci_bus 0000:00: root bus resource [??? 0x00000000 flags 0x0]
[    0.460873] pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff]
[    0.468587] pci 0000:00:00.0: [1814:0801] type 01 class 0x060400
[    0.468629] pci 0000:00:00.0: reg 0x10: [mem 0x00000000-0x7fffffff]
[    0.468643] pci 0000:00:00.0: reg 0x14: [mem 0x00000000-0x0000ffff]
[    0.468715] pci 0000:00:00.0: supports D1
[    0.468725] pci 0000:00:00.0: PME# supported from D0 D1 D3hot
[    0.468951] pci 0000:00:00.0: bridge configuration invalid ([bus 00-00]), reconfiguring
[    0.476889] pci 0000:01:00.0: [14c3:7662] type 00 class 0x028000
[    0.476953] pci 0000:01:00.0: reg 0x10: [mem 0x00000000-0x000fffff 64bit]
[    0.477007] pci 0000:01:00.0: reg 0x30: [mem 0x00000000-0x0000ffff pref]
[    0.477112] pci 0000:01:00.0: PME# supported from D0 D3hot D3cold
[    0.477293] pci_bus 0000:01: busn_res: [bus 01-ff] end is updated to 01
[    0.477311] pci_bus 0000:00: busn_res: [bus 00-ff] end is updated to 01
[    0.477358] pci 0000:00:00.0: BAR 0: no space for [mem size 0x80000000]
[    0.483719] pci 0000:00:00.0: BAR 0: failed to assign [mem size 0x80000000]
[    0.490537] pci 0000:00:00.0: BAR 8: assigned [mem 0x20000000-0x200fffff]
[    0.497076] pci 0000:00:00.0: BAR 9: assigned [mem 0x20100000-0x201fffff pref]
[    0.504108] pci 0000:00:00.0: BAR 1: assigned [mem 0x20200000-0x2020ffff]
[    0.510694] pci 0000:01:00.0: BAR 0: assigned [mem 0x20000000-0x200fffff 64bit]
[    0.517817] pci 0000:01:00.0: BAR 6: assigned [mem 0x20100000-0x2010ffff pref]
[    0.524798] pci 0000:00:00.0: PCI bridge to [bus 01]
[    0.529636] pci 0000:00:00.0:   bridge window [mem 0x20000000-0x200fffff]
[    0.536210] pci 0000:00:00.0:   bridge window [mem 0x20100000-0x201fffff pref]
[    0.547592] clocksource: Switched to clocksource systick
[    0.553829] NET: Registered protocol family 2
[    0.558228] IP idents hash table entries: 2048 (order: 2, 16384 bytes)
[    0.565262] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.572050] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.578186] TCP: Hash tables configured (established 1024 bind 1024)
[    0.584476] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.590148] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.596385] NET: Registered protocol family 1
[    0.600659] PCI: CLS 0 bytes, default 32
[    0.603364] rt-timer 10000100.timer: maximum frequency is 1220Hz
[    0.610019] Crashlog allocated RAM at address 0x3f00000
[    0.616756] workingset: timestamp_bits=30 max_order=14 bucket_order=0
[    0.628472] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.634073] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.654083] io scheduler noop registered
[    0.657891] io scheduler deadline registered (default)
[    0.663677] Serial: 8250/16550 driver, 16 ports, IRQ sharing enabled
[    0.672482] console [ttyS0] disabled
[    0.675930] 10000c00.uartlite: ttyS0 at MMIO 0x10000c00 (irq = 20, base_baud = 2500000) is a Palmchip BK-3103
[    0.685612] console [ttyS0] enabled
[    0.692645] bootconsole [early0] disabled
[    0.708567] spi spi0.0: force spi mode3
[    0.713171] m25p80 spi0.0: en25qh64 (8192 Kbytes)
[    0.718092] 6 fixed-partitions partitions found on MTD device spi0.0
[    0.724571] Creating 6 MTD partitions on "spi0.0":
[    0.729494] 0x000000000000-0x000000020000 : "u-boot"
[    0.735421] 0x000000020000-0x0000007c0000 : "firmware"
[    0.743259] 2 tplink-fw partitions found on MTD device firmware
[    0.749376] Creating 2 MTD partitions on "firmware":
[    0.754453] 0x000000000000-0x0000001802ca : "kernel"
[    0.760377] 0x0000001802cc-0x0000007a0000 : "rootfs"
[    0.766133] mtd: device 3 (rootfs) set to be root filesystem
[    0.773463] 1 squashfs-split partitions found on MTD device rootfs
[    0.779850] 0x000000400000-0x0000007a0000 : "rootfs_data"
[    0.786172] 0x0000007c0000-0x0000007d0000 : "config"
[    0.792108] 0x0000007d0000-0x0000007e0000 : "rom"
[    0.797718] 0x0000007e0000-0x0000007f0000 : "romfile"
[    0.803663] 0x0000007f0000-0x000000800000 : "radio"
[    0.821297] gsw: setting port4 to ephy mode
[    0.825916] mtk_soc_eth 10100000.ethernet: using fixed link parameters
[    0.832707] mtk_soc_eth 10100000.ethernet: loaded mt7620 driver
[    0.839352] mtk_soc_eth 10100000.ethernet eth0: mediatek frame engine at 0xb0100000, irq 5
[    0.848332] rt2880_wdt 10000120.watchdog: Initialized
[    0.854705] NET: Registered protocol family 10
[    0.863424] Segment Routing with IPv6
[    0.867263] NET: Registered protocol family 17
[    0.871927] bridge: filtering via arp/ip/ip6tables is no longer available by default. Update your scripts to load br_netfilter if you need this.
[    0.885173] 8021q: 802.1Q VLAN Support v1.8
[    0.898796] VFS: Mounted root (squashfs filesystem) readonly on device 31:3.
[    0.912491] Freeing unused kernel memory: 1188K
[    0.917113] This architecture does not have kernel memory protection.
[    1.824981] init: Console is alive
[    1.828803] init: - watchdog -
[    2.337558] random: fast init done
[    2.952564] kmodloader: loading kernel modules from /etc/modules-boot.d/*
[    3.051706] usbcore: registered new interface driver usbfs
[    3.057374] usbcore: registered new interface driver hub
[    3.062958] usbcore: registered new device driver usb
[    3.074336] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    3.082704] ehci-platform: EHCI generic platform driver
[    3.098440] phy phy-usbphy.0: remote usb device wakeup disabled
[    3.104494] phy phy-usbphy.0: UTMI 16bit 30MHz
[    3.109063] ehci-platform 101c0000.ehci: EHCI Host Controller
[    3.114963] ehci-platform 101c0000.ehci: new USB bus registered, assigned bus number 1
[    3.123176] ehci-platform 101c0000.ehci: irq 26, io mem 0x101c0000
[    3.139009] ehci-platform 101c0000.ehci: USB 2.0 started, EHCI 1.00
[    3.146327] hub 1-0:1.0: USB hub found
[    3.150617] hub 1-0:1.0: 1 port detected
[    3.157809] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    3.165731] ohci-platform: OHCI generic platform driver
[    3.171439] ohci-platform 101c1000.ohci: Generic Platform OHCI controller
[    3.178398] ohci-platform 101c1000.ohci: new USB bus registered, assigned bus number 2
[    3.186634] ohci-platform 101c1000.ohci: irq 26, io mem 0x101c1000
[    3.220255] hub 2-0:1.0: USB hub found
[    3.224473] hub 2-0:1.0: 1 port detected
[    3.234081] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
[    3.245686] init: - preinit -
[    4.420874] mtk_soc_eth 10100000.ethernet eth0: port 5 link up (1000Mbps/Full duplex)
[    4.429654] 8021q: adding VLAN 0 to HW filter on device eth0
[    4.572949] random: procd: uninitialized urandom read (4 bytes read)
[    5.853828] jffs2: notice: (428) jffs2_build_xattr_subsystem: complete building xattr subsystem, 1 of xdatum (0 unchecked, 1 orphan) and 1 of xref (1 dead, 0 orphan) found.
[    5.871239] mount_root: switching to jffs2 overlay
[    5.905293] overlayfs: upper fs does not support tmpfile.
[    5.916627] urandom-seed: Seeding with /etc/urandom.seed
[    6.062764] mtk_soc_eth 10100000.ethernet eth0: port 5 link down
[    6.080468] procd: - early -
[    6.083529] procd: - watchdog -
[    6.518858] procd: - watchdog -
[    6.522497] procd: - ubus -
[    6.727752] random: ubusd: uninitialized urandom read (4 bytes read)
[    6.819461] random: ubusd: uninitialized urandom read (4 bytes read)
[    6.826579] random: ubusd: uninitialized urandom read (4 bytes read)
[    6.834103] procd: - init -
[    7.617951] kmodloader: loading kernel modules from /etc/modules.d/*
[    7.807843] ip6_tables: (C) 2000-2006 Netfilter Core Team
[    7.833404] rtl8367b rtl8367rb: switch phy addr=29
[    7.838310] rtl8367b rtl8367rb: using MDIO bus 'mdio'
[    7.844663] rtl8367b rtl8367rb: RTL8367D chip found
[    7.988871] urngd: jent-rng init failed, err: 2
[    8.295202] rtl8367b rtl8367rb: checking chip_num=0x6642 ver=0x10...
[    8.318986] rtl8367b rtl8367rb: rtl8367d overwrite rgmii txdelay/rxdelay=1/4
[    8.371501] rtl8367b rtl8367rb: get vlan4k vid 1
[    8.377132] rtl8367b rtl8367rb: set vlan4k vid 1
[    8.440191] rtl8367b rtl8367rb: no mc enrty for vid 1, try to find empty one
[    8.448301] rtl8367b rtl8367rb: get vlan4k vid 1
[    8.453909] rtl8367b rtl8367rb: set vlanmc index 0 vid 1
[    8.459347] rtl8367b rtl8367rb: VLAN initialization failed, err=-22
[    8.465782] rtl8367b: probe of rtl8367rb failed with error -22
[    8.477302] Loading modules backported from Linux version v4.19.237-0-ga6e4a1818efa
[    8.485203] Backport generated by backports.git v4.19.237-1-0-gffb89fd9
[    8.495318] ip_tables: (C) 2000-2006 Netfilter Core Team
[    8.510290] nf_conntrack version 0.5.0 (1024 buckets, 4096 max)
[    8.582679] xt_time: kernel timezone is -0000
[    8.644717] PPP generic driver version 2.4.2
[    8.651850] NET: Registered protocol family 24
[    8.684201] rt2800_wmac 10180000.wmac: loaded eeprom from mtd device "radio"
[    8.691412] ieee80211 phy0: rt2x00_set_rt: Info - RT chipset 6352, rev 0500 detected
[    8.699441] ieee80211 phy0: rt2x00_set_rf: Info - RF chipset 7620 detected
[    8.707237] ieee80211 phy0: Selected rate control algorithm 'minstrel_ht'
[    8.724373] kmodloader: done loading kernel modules from /etc/modules.d/*
[   19.579730] mtk_soc_eth 10100000.ethernet eth0: port 5 link up (1000Mbps/Full duplex)
[   19.588611] 8021q: adding VLAN 0 to HW filter on device eth0
[   19.642996] br-lan: port 1(eth0.1) entered blocking state
[   19.648593] br-lan: port 1(eth0.1) entered disabled state
[   19.654478] device eth0.1 entered promiscuous mode
[   19.659373] device eth0 entered promiscuous mode
[   19.744208] br-lan: port 1(eth0.1) entered blocking state
[   19.749733] br-lan: port 1(eth0.1) entered forwarding state
[   19.755676] IPv6: ADDRCONF(NETDEV_UP): br-lan: link is not ready
[   20.614575] IPv6: ADDRCONF(NETDEV_CHANGE): br-lan: link becomes ready
[   23.603526] ieee80211 phy0: rt2800_init_registers: Warning - system bus clock undefined
[   23.611790] ieee80211 phy0: rt2800_init_registers: Info - set US_CYC=193MHz
[   23.639705] Recalibrated RF b0r7=28
[   23.643487] ieee80211 phy0: rt2800_rf_self_txdc_cal: Info - RF Tx self calibration start
[   23.652288] ieee80211 phy0: rt2800_rf_self_txdc_cal: Info - RF Tx self calibration end
[   23.982213] ieee80211 phy0: rt2800_loft_iq_calibration: Info - LOFT Calibration Done!
[   23.994180] ieee80211 phy0: rt2800_iq_search: Info - IQCalibration Start!
[   24.015514] ieee80211 phy0: rt2800_iq_search: Info - IQCalibration Done! CH = 0, (gain= f, phase= 2)
[   24.025762] ieee80211 phy0: rt2800_iq_search: Info - IQCalibration Start!
[   24.047075] ieee80211 phy0: rt2800_iq_search: Info - IQCalibration Done! CH = 1, (gain= 0, phase=3d)
[   24.056437] ieee80211 phy0: rt2800_loft_iq_calibration: Info - TX IQ Calibration Done!
[   24.079246] ieee80211 phy0: rt2800_rxiq_calibration: Info - RXIQ G_imb=3, Ph_rx=-7
[   24.097229] ieee80211 phy0: rt2800_rxiq_calibration: Info - RXIQ G_imb=-1, Ph_rx=-3
[   24.107957] ieee80211 phy0: rt2800_config_channel: Info - Correct RF for eLNA!
[   24.122952] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
[   24.135152] br-lan: port 2(wlan0) entered blocking state
[   24.140587] br-lan: port 2(wlan0) entered disabled state
[   24.146464] device wlan0 entered promiscuous mode
[   24.669995] ieee80211 phy0: rt2800_config_channel: Info - Correct RF for eLNA!
[   24.681182] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
[   24.687936] br-lan: port 2(wlan0) entered blocking state
[   24.693361] br-lan: port 2(wlan0) entered forwarding state
[   40.419018] random: crng init done
[   40.422509] random: 6 urandom warning(s) missed due to ratelimiting

switch0:

root@OpenWrt:/# swconfig dev switch0 show
Global attributes:
        enable_vlan: 0
        p5id: 2
        mib: Switch MIB counters
PPE_AC_BCNT0: 0
PPE_AC_PCNT0: 0
PPE_AC_BCNT63: 0
PPE_AC_PCNT63: 0
PPE_MTR_CNT0: 0
PPE_MTR_CNT63: 0
GDM1_TX_GBCNT: 0
GDM1_TX_GPCNT: 0
GDM1_TX_SKIPCNT: 0
GDM1_TX_COLCNT: 0
GDM1_RX_GBCNT1: 0
GDM1_RX_GPCNT1: 0
GDM1_RX_OERCNT: 0
GDM1_RX_FERCNT: 0
GDM1_RX_SERCNT: 0
GDM1_RX_LERCNT: 0
GDM1_RX_CERCNT: 0
GDM1_RX_FCCNT: 0
GDM2_TX_GBCNT: 0
GDM2_TX_GPCNT: 0
GDM2_TX_SKIPCNT: 0
GDM2_TX_COLCNT: 0
GDM2_RX_GBCNT: 0
GDM2_RX_GPCNT: 0
GDM2_RX_OERCNT: 0
GDM2_RX_FERCNT: 0
GDM2_RX_SERCNT: 0
GDM2_RX_LERCNT: 3
GDM2_RX_CERCNT: 0
GDM2_RX_FCCNT: 0

Port 0:
        mib: Port 0 MIB counters
TxGPC      : 0
TxBOC      : 0
TxGOC      : 0
TxEPC      : 0
RxGPC      : 0
RxBOC      : 0
RxGOC      : 0
RxEPC1     : 0
RxEPC2     : 0

        pvid: 0
        link: port:0 link:down
Port 1:
        mib: Port 1 MIB counters
TxGPC      : 0
TxBOC      : 0
TxGOC      : 0
TxEPC      : 0
RxGPC      : 0
RxBOC      : 0
RxGOC      : 0
RxEPC1     : 0
RxEPC2     : 0

        pvid: 0
        link: port:1 link:down
Port 2:
        mib: Port 2 MIB counters
TxGPC      : 0
TxBOC      : 0
TxGOC      : 0
TxEPC      : 0
RxGPC      : 0
RxBOC      : 0
RxGOC      : 0
RxEPC1     : 0
RxEPC2     : 0

        pvid: 0
        link: port:2 link:down
Port 3:
        mib: Port 3 MIB counters
TxGPC      : 0
TxBOC      : 0
TxGOC      : 0
TxEPC      : 0
RxGPC      : 0
RxBOC      : 0
RxGOC      : 0
RxEPC1     : 0
RxEPC2     : 0

        pvid: 0
        link: port:3 link:down
Port 4:
        mib: Port 4 MIB counters
TxGPC      : 0
TxBOC      : 0
TxGOC      : 0
TxEPC      : 0
RxGPC      : 0
RxBOC      : 0
RxGOC      : 0
RxEPC1     : 0
RxEPC2     : 0

        pvid: 0
        link: port:4 link:down
Port 5:
        mib: Port 5 MIB counters
TxGPC      : 190
TxBOC      : 0
TxGOC      : 55765
TxEPC      : 0
RxGPC      : 15986
RxBOC      : 0
RxGOC      : 1039125
RxEPC1     : 0
RxEPC2     : 0

        pvid: 0
        link: port:5 link:up speed:1000baseT full-duplex
Port 6:
        mib: Port 6 MIB counters
TxGPC      : 426
TxBOC      : 0
TxGOC      : 43285
TxEPC      : 0
RxGPC      : 274
RxBOC      : 0
RxGOC      : 84641
RxEPC1     : 0
RxEPC2     : 0

        pvid: 0
        link: port:6 link:up speed:1000baseT full-duplex
Port 7:
        mib: Port 7 MIB counters
TxGPC      : 0
TxBOC      : 0
TxGOC      : 0
TxEPC      : 0
RxGPC      : 0
RxBOC      : 0
RxGOC      : 0
RxEPC1     : 0
RxEPC2     : 0

        pvid: 0
        link: port:7 link:down
root@OpenWrt:/#

ifconfig:

root@OpenWrt:/# ifconfig
br-lan    Link encap:Ethernet  HWaddr AC:15:A2:A8:A5:89
          inet addr:192.168.1.1  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::ae15:a2ff:fea8:a589/64 Scope:Link
          inet6 addr: fd06:d8b9:98c0::1/60 Scope:Global
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:2272 (2.2 KiB)

eth0      Link encap:Ethernet  HWaddr AC:15:A2:A8:A5:89
          inet6 addr: fe80::ae15:a2ff:fea8:a589/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:426 errors:0 dropped:11 overruns:0 frame:0
          TX packets:274 errors:1 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:41581 (40.6 KiB)  TX bytes:83545 (81.5 KiB)
          Interrupt:5

eth0.1    Link encap:Ethernet  HWaddr AC:15:A2:A8:A5:89
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:2272 (2.2 KiB)

eth0.2    Link encap:Ethernet  HWaddr AC:15:A2:A8:A5:8A
          inet6 addr: fe80::ae15:a2ff:fea8:a58a/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:258 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:83156 (81.2 KiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:224 errors:0 dropped:0 overruns:0 frame:0
          TX packets:224 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:15232 (14.8 KiB)  TX bytes:15232 (14.8 KiB)

wlan0     Link encap:Ethernet  HWaddr AC:15:A2:A8:A5:89
          inet6 addr: fe80::ae15:a2ff:fea8:a589/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:10 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:1344 (1.3 KiB)

Archer C5 v4 (with RTL8367C/S switch) support has just been added to OpenWRT: https://github.com/openwrt/openwrt/commit/fdd3a05c407d2d0793ec9434cd31197b15846f8d

2 Likes

Does this apply to my version? If it does how should I compile it? I mean the make menuconfig options.

No this apply to RTL8367C. You has RTL8367D.

It's very good news. I've backported changes (really simply copy of code) to openwrt 19 (for 4/32 and 8/64 devices it's last compatible version) and it works at first glance. So I'll rebase my patches.

I can publicate patches If you want compile yourself. After accepting support of rtl8367s into mainstream it simplifies the process.

I don't have a router with this chipset so I'm trying to add rtl8137d support based on your code: https://github.com/openwrt/openwrt/pull/14804
However, as you noticed, the VLAN problem still needs to be solved.

Sure, I'm ok with that, also I can learn something on the way. If you can also provide the instructions to compile it that'd be cool (besides the official ones, I've done that but don't know which options to choose in menuconfig).

Target System -> Mediatek Ralink Mips
Subtarget->MT7620 Based Boards
Target Profile ->TP-Llink Archer C5 v4
Luci->Collections->luci *

1 Like

Updated archive for test.

Last archive (in message above) contain patched (rebase on snapshot).

Bootlog:

root@OpenWrt:/# dmesg
[    0.000000] Linux version 4.14.275 (builder@buildhost) (gcc version 7.5.0 (OpenWrt GCC 7.5.0 r11427-9ce6aa9d8d)) #0 Sat Apr 16 13:13:32 2022
[    0.000000] Board has DDR2
[    0.000000] Analog PMU set to hw control
[    0.000000] Digital PMU set to hw control
[    0.000000] SoC Type: MediaTek MT7620A ver:2 eco:6
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 00019650 (MIPS 24KEc)
[    0.000000] MIPS: machine is TP-Link Archer C5 v4
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 04000000 @ 00000000 (usable)
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x0000000003ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x0000000003ffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000003ffffff]
[    0.000000] On node 0 totalpages: 16384
[    0.000000] free_area_init_node: node 0, pgdat 80486670, node_mem_map 81000040
[    0.000000]   Normal zone: 128 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 16384 pages, LIFO batch:3
[    0.000000] random: get_random_bytes called from 0x80487740 with crng_init=0
[    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[    0.000000] pcpu-alloc: [0] 0
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 16256
[    0.000000] Kernel command line: console=ttyS0,115200 rootfstype=squashfs,jffs2
[    0.000000] PID hash table entries: 256 (order: -2, 1024 bytes)
[    0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Writing ErrCtl register=0000a066
[    0.000000] Readback ErrCtl register=0000a066
[    0.000000] Memory: 58804K/65536K available (3937K kernel code, 185K rwdata, 504K rodata, 1188K init, 215K bss, 6732K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS: 256
[    0.000000] CPU Clock: 580MHz
[    0.000000] clocksource: systick: mask: 0xffff max_cycles: 0xffff, max_idle_ns: 583261500 ns
[    0.000000] systick: enable autosleep mode
[    0.000000] systick: running - mult: 214748, shift: 32
[    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 6590553264 ns
[    0.000009] sched_clock: 32 bits at 290MHz, resolution 3ns, wraps every 7405115902ns
[    0.007616] Calibrating delay loop... 385.84 BogoMIPS (lpj=1929216)
[    0.073556] pid_max: default: 32768 minimum: 301
[    0.078247] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.084631] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.097101] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.106649] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.112625] pinctrl core: initialized pinctrl subsystem
[    0.118922] NET: Registered protocol family 16
[    0.380818] PCI host bridge /pcie@10140000 ranges:
[    0.385426]  MEM 0x0000000020000000..0x000000002fffffff
[    0.390502]   IO 0x0000000010160000..0x000000001016ffff
[    0.413034] rt2880_gpio 10000600.gpio: registering 24 gpios
[    0.418427] rt2880_gpio 10000600.gpio: registering 24 irq handlers
[    0.424802] rt2880_gpio 10000660.gpio: registering 32 gpios
[    0.430174] rt2880_gpio 10000660.gpio: registering 32 irq handlers
[    0.437002] PCI host bridge to bus 0000:00
[    0.440923] pci_bus 0000:00: root bus resource [mem 0x20000000-0x2fffffff]
[    0.447645] pci_bus 0000:00: root bus resource [io  0x10160000-0x1016ffff]
[    0.454272] pci_bus 0000:00: root bus resource [??? 0x00000000 flags 0x0]
[    0.460879] pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff]
[    0.468593] pci 0000:00:00.0: [1814:0801] type 01 class 0x060400
[    0.468634] pci 0000:00:00.0: reg 0x10: [mem 0x00000000-0x7fffffff]
[    0.468649] pci 0000:00:00.0: reg 0x14: [mem 0x00000000-0x0000ffff]
[    0.468720] pci 0000:00:00.0: supports D1
[    0.468731] pci 0000:00:00.0: PME# supported from D0 D1 D3hot
[    0.468957] pci 0000:00:00.0: bridge configuration invalid ([bus 00-00]), reconfiguring
[    0.476897] pci 0000:01:00.0: [14c3:7662] type 00 class 0x028000
[    0.476961] pci 0000:01:00.0: reg 0x10: [mem 0x00000000-0x000fffff 64bit]
[    0.477015] pci 0000:01:00.0: reg 0x30: [mem 0x00000000-0x0000ffff pref]
[    0.477120] pci 0000:01:00.0: PME# supported from D0 D3hot D3cold
[    0.477298] pci_bus 0000:01: busn_res: [bus 01-ff] end is updated to 01
[    0.477316] pci_bus 0000:00: busn_res: [bus 00-ff] end is updated to 01
[    0.477362] pci 0000:00:00.0: BAR 0: no space for [mem size 0x80000000]
[    0.483723] pci 0000:00:00.0: BAR 0: failed to assign [mem size 0x80000000]
[    0.490541] pci 0000:00:00.0: BAR 8: assigned [mem 0x20000000-0x200fffff]
[    0.497080] pci 0000:00:00.0: BAR 9: assigned [mem 0x20100000-0x201fffff pref]
[    0.504112] pci 0000:00:00.0: BAR 1: assigned [mem 0x20200000-0x2020ffff]
[    0.510697] pci 0000:01:00.0: BAR 0: assigned [mem 0x20000000-0x200fffff 64bit]
[    0.517821] pci 0000:01:00.0: BAR 6: assigned [mem 0x20100000-0x2010ffff pref]
[    0.524803] pci 0000:00:00.0: PCI bridge to [bus 01]
[    0.529640] pci 0000:00:00.0:   bridge window [mem 0x20000000-0x200fffff]
[    0.536214] pci 0000:00:00.0:   bridge window [mem 0x20100000-0x201fffff pref]
[    0.547582] clocksource: Switched to clocksource systick
[    0.553819] NET: Registered protocol family 2
[    0.558217] IP idents hash table entries: 2048 (order: 2, 16384 bytes)
[    0.565249] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.572037] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.578173] TCP: Hash tables configured (established 1024 bind 1024)
[    0.584463] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.590135] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.596371] NET: Registered protocol family 1
[    0.600646] PCI: CLS 0 bytes, default 32
[    0.603351] rt-timer 10000100.timer: maximum frequency is 1220Hz
[    0.610006] Crashlog allocated RAM at address 0x3f00000
[    0.616746] workingset: timestamp_bits=30 max_order=14 bucket_order=0
[    0.628468] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.634069] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.654047] io scheduler noop registered
[    0.657855] io scheduler deadline registered (default)
[    0.663643] Serial: 8250/16550 driver, 16 ports, IRQ sharing enabled
[    0.672458] console [ttyS0] disabled
[    0.675905] 10000c00.uartlite: ttyS0 at MMIO 0x10000c00 (irq = 20, base_baud = 2500000) is a Palmchip BK-3103
[    0.685588] console [ttyS0] enabled
[    0.692621] bootconsole [early0] disabled
[    0.708567] spi spi0.0: force spi mode3
[    0.713167] m25p80 spi0.0: en25qh64 (8192 Kbytes)
[    0.718088] 6 fixed-partitions partitions found on MTD device spi0.0
[    0.724566] Creating 6 MTD partitions on "spi0.0":
[    0.729489] 0x000000000000-0x000000020000 : "u-boot"
[    0.735413] 0x000000020000-0x0000007c0000 : "firmware"
[    0.743250] 2 tplink-fw partitions found on MTD device firmware
[    0.749367] Creating 2 MTD partitions on "firmware":
[    0.754443] 0x000000000000-0x0000001802ca : "kernel"
[    0.760375] 0x0000001802cc-0x0000007a0000 : "rootfs"
[    0.766124] mtd: device 3 (rootfs) set to be root filesystem
[    0.773454] 1 squashfs-split partitions found on MTD device rootfs
[    0.779842] 0x000000400000-0x0000007a0000 : "rootfs_data"
[    0.786171] 0x0000007c0000-0x0000007d0000 : "config"
[    0.792101] 0x0000007d0000-0x0000007e0000 : "rom"
[    0.797712] 0x0000007e0000-0x0000007f0000 : "romfile"
[    0.803654] 0x0000007f0000-0x000000800000 : "radio"
[    0.821255] gsw: setting port4 to ephy mode
[    0.825873] mtk_soc_eth 10100000.ethernet: using fixed link parameters
[    0.832663] mtk_soc_eth 10100000.ethernet: loaded mt7620 driver
[    0.839307] mtk_soc_eth 10100000.ethernet eth0: mediatek frame engine at 0xb0100000, irq 5
[    0.848287] rt2880_wdt 10000120.watchdog: Initialized
[    0.854671] NET: Registered protocol family 10
[    0.863369] Segment Routing with IPv6
[    0.867209] NET: Registered protocol family 17
[    0.871873] bridge: filtering via arp/ip/ip6tables is no longer available by default. Update your scripts to load br_netfilter if you need this.
[    0.885119] 8021q: 802.1Q VLAN Support v1.8
[    0.899376] VFS: Mounted root (squashfs filesystem) readonly on device 31:3.
[    0.913082] Freeing unused kernel memory: 1188K
[    0.917741] This architecture does not have kernel memory protection.
[    1.825858] init: Console is alive
[    1.829684] init: - watchdog -
[    2.337577] random: fast init done
[    2.953073] kmodloader: loading kernel modules from /etc/modules-boot.d/*
[    3.052525] usbcore: registered new interface driver usbfs
[    3.058271] usbcore: registered new interface driver hub
[    3.063778] usbcore: registered new device driver usb
[    3.074949] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    3.083301] ehci-platform: EHCI generic platform driver
[    3.099041] phy phy-usbphy.0: remote usb device wakeup disabled
[    3.105095] phy phy-usbphy.0: UTMI 16bit 30MHz
[    3.109663] ehci-platform 101c0000.ehci: EHCI Host Controller
[    3.115563] ehci-platform 101c0000.ehci: new USB bus registered, assigned bus number 1
[    3.123774] ehci-platform 101c0000.ehci: irq 26, io mem 0x101c0000
[    3.139407] ehci-platform 101c0000.ehci: USB 2.0 started, EHCI 1.00
[    3.146728] hub 1-0:1.0: USB hub found
[    3.151018] hub 1-0:1.0: 1 port detected
[    3.158212] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    3.166130] ohci-platform: OHCI generic platform driver
[    3.171836] ohci-platform 101c1000.ohci: Generic Platform OHCI controller
[    3.178793] ohci-platform 101c1000.ohci: new USB bus registered, assigned bus number 2
[    3.187032] ohci-platform 101c1000.ohci: irq 26, io mem 0x101c1000
[    3.220651] hub 2-0:1.0: USB hub found
[    3.224868] hub 2-0:1.0: 1 port detected
[    3.234468] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
[    3.246071] init: - preinit -
[    4.421262] mtk_soc_eth 10100000.ethernet eth0: port 5 link up (1000Mbps/Full duplex)
[    4.430050] 8021q: adding VLAN 0 to HW filter on device eth0
[    4.573134] random: procd: uninitialized urandom read (4 bytes read)
[    5.808070] mount_root: jffs2 not ready yet, using temporary tmpfs overlay
[    5.845647] urandom-seed: Seed file not found (/etc/urandom.seed)
[    5.981159] mtk_soc_eth 10100000.ethernet eth0: port 5 link down
[    5.998172] procd: - early -
[    6.002044] procd: - watchdog -
[    6.432615] procd: - watchdog -
[    6.436177] procd: - ubus -
[    6.639687] random: ubusd: uninitialized urandom read (4 bytes read)
[    6.729755] random: ubusd: uninitialized urandom read (4 bytes read)
[    6.736772] random: ubusd: uninitialized urandom read (4 bytes read)
[    6.744280] procd: - init -
[    7.515757] kmodloader: loading kernel modules from /etc/modules.d/*
[    7.714242] ip6_tables: (C) 2000-2006 Netfilter Core Team
[    7.738672] rtl8367b rtl8367rb: using MDIO bus 'mdio'
[    7.745057] rtl8367b rtl8367rb: checking chip num:6642 ver:0010, mode:0014
[    7.752092] rtl8367b rtl8367rb: RTL8367D chip found
[    7.893405] urngd: jent-rng init failed, err: 2
[    8.222500] rtl8367b rtl8367rb: rtl8367d overwrite rgmii txdelay/rxdelay=1/4
[    8.324406] rtl8367b rtl8367rb: VLAN initialization failed, err=-22
[    8.330827] rtl8367b: probe of rtl8367rb failed with error -22
[    8.342340] Loading modules backported from Linux version v4.19.237-0-ga6e4a1818efa
[    8.350243] Backport generated by backports.git v4.19.237-1-0-gffb89fd9
[    8.360314] ip_tables: (C) 2000-2006 Netfilter Core Team
[    8.375339] nf_conntrack version 0.5.0 (1024 buckets, 4096 max)
[    8.446311] xt_time: kernel timezone is -0000
[    8.507927] PPP generic driver version 2.4.2
[    8.515126] NET: Registered protocol family 24
[    8.546993] rt2800_wmac 10180000.wmac: loaded eeprom from mtd device "radio"
[    8.554270] ieee80211 phy0: rt2x00_set_rt: Info - RT chipset 6352, rev 0500 detected
[    8.562269] ieee80211 phy0: rt2x00_set_rf: Info - RF chipset 7620 detected
[    8.570069] ieee80211 phy0: Selected rate control algorithm 'minstrel_ht'
[    8.583262] kmodloader: done loading kernel modules from /etc/modules.d/*
[   29.006072] jffs2_scan_eraseblock(): End of filesystem marker found at 0x0
[   29.017501] jffs2_build_filesystem(): unlocking the mtd device...
[   29.017516] done.
[   29.025865] jffs2_build_filesystem(): erasing all blocks after the end marker...
[   29.290649] mtk_soc_eth 10100000.ethernet eth0: port 5 link up (1000Mbps/Full duplex)
[   29.307175] 8021q: adding VLAN 0 to HW filter on device eth0
[   29.386379] br-lan: port 1(eth0.1) entered blocking state
[   29.391977] br-lan: port 1(eth0.1) entered disabled state
[   29.397842] device eth0.1 entered promiscuous mode
[   29.402795] device eth0 entered promiscuous mode
[   29.488675] br-lan: port 1(eth0.1) entered blocking state
[   29.494200] br-lan: port 1(eth0.1) entered forwarding state
[   29.500166] IPv6: ADDRCONF(NETDEV_UP): br-lan: link is not ready
[   30.359058] IPv6: ADDRCONF(NETDEV_CHANGE): br-lan: link becomes ready
[   33.599430] ieee80211 phy0: rt2800_init_registers: Warning - system bus clock undefined
[   33.607620] ieee80211 phy0: rt2800_init_registers: Info - set US_CYC=193MHz
[   33.670661] Recalibrated RF b0r7=30
[   33.674446] ieee80211 phy0: rt2800_rf_self_txdc_cal: Info - RF Tx self calibration start
[   33.683251] ieee80211 phy0: rt2800_rf_self_txdc_cal: Info - RF Tx self calibration end
[   34.380530] ieee80211 phy0: rt2800_loft_iq_calibration: Info - LOFT Calibration Done!
[   34.392500] ieee80211 phy0: rt2800_iq_search: Info - IQCalibration Start!
[   34.413830] ieee80211 phy0: rt2800_iq_search: Info - IQCalibration Done! CH = 0, (gain= f, phase= 2)
[   34.424073] ieee80211 phy0: rt2800_iq_search: Info - IQCalibration Start!
[   34.445387] ieee80211 phy0: rt2800_iq_search: Info - IQCalibration Done! CH = 1, (gain= 1, phase=3d)
[   34.454749] ieee80211 phy0: rt2800_loft_iq_calibration: Info - TX IQ Calibration Done!
[   34.688626] ieee80211 phy0: rt2800_rxiq_calibration: Info - RXIQ G_imb=3, Ph_rx=-8
[   34.706616] ieee80211 phy0: rt2800_rxiq_calibration: Info - RXIQ G_imb=-1, Ph_rx=-3
[   34.763515] ieee80211 phy0: rt2800_config_channel: Info - Correct RF for eLNA!
[   34.800478] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
[   34.822301] br-lan: port 2(wlan0) entered blocking state
[   34.827737] br-lan: port 2(wlan0) entered disabled state
[   34.833619] device wlan0 entered promiscuous mode
[   36.240150] ieee80211 phy0: rt2800_config_channel: Info - Correct RF for eLNA!
[   36.302331] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
[   36.309205] br-lan: port 2(wlan0) entered blocking state
[   36.314632] br-lan: port 2(wlan0) entered forwarding state
[   43.547964] done.
[   43.550010] jffs2: notice: (1257) jffs2_build_xattr_subsystem: complete building xattr subsystem, 0 of xdatum (0 unchecked, 0 orphan) and 0 of xref (0 dead, 0 orphan) found.
[   43.757918] overlayfs: upper fs does not support tmpfile.
[   55.693729] random: crng init done
[   55.697221] random: 6 urandom warning(s) missed due to ratelimiting
root@OpenWrt:/#

swconfig and ifconfig:

root@OpenWrt:/# swconfig dev switch0 show
Global attributes:
        enable_vlan: 0
        p5id: 2
        mib: Switch MIB counters
PPE_AC_BCNT0: 0
PPE_AC_PCNT0: 0
PPE_AC_BCNT63: 0
PPE_AC_PCNT63: 0
PPE_MTR_CNT0: 0
PPE_MTR_CNT63: 0
GDM1_TX_GBCNT: 0
GDM1_TX_GPCNT: 0
GDM1_TX_SKIPCNT: 0
GDM1_TX_COLCNT: 0
GDM1_RX_GBCNT1: 0
GDM1_RX_GPCNT1: 0
GDM1_RX_OERCNT: 0
GDM1_RX_FERCNT: 0
GDM1_RX_SERCNT: 0
GDM1_RX_LERCNT: 0
GDM1_RX_CERCNT: 0
GDM1_RX_FCCNT: 0
GDM2_TX_GBCNT: 0
GDM2_TX_GPCNT: 0
GDM2_TX_SKIPCNT: 0
GDM2_TX_COLCNT: 0
GDM2_RX_GBCNT: 0
GDM2_RX_GPCNT: 0
GDM2_RX_OERCNT: 0
GDM2_RX_FERCNT: 0
GDM2_RX_SERCNT: 0
GDM2_RX_LERCNT: 3
GDM2_RX_CERCNT: 0
GDM2_RX_FCCNT: 0

Port 0:
        mib: Port 0 MIB counters
TxGPC      : 0
TxBOC      : 0
TxGOC      : 0
TxEPC      : 0
RxGPC      : 0
RxBOC      : 0
RxGOC      : 0
RxEPC1     : 0
RxEPC2     : 0

        pvid: 0
        link: port:0 link:down
Port 1:
        mib: Port 1 MIB counters
TxGPC      : 0
TxBOC      : 0
TxGOC      : 0
TxEPC      : 0
RxGPC      : 0
RxBOC      : 0
RxGOC      : 0
RxEPC1     : 0
RxEPC2     : 0

        pvid: 0
        link: port:1 link:down
Port 2:
        mib: Port 2 MIB counters
TxGPC      : 0
TxBOC      : 0
TxGOC      : 0
TxEPC      : 0
RxGPC      : 0
RxBOC      : 0
RxGOC      : 0
RxEPC1     : 0
RxEPC2     : 0

        pvid: 0
        link: port:2 link:down
Port 3:
        mib: Port 3 MIB counters
TxGPC      : 0
TxBOC      : 0
TxGOC      : 0
TxEPC      : 0
RxGPC      : 0
RxBOC      : 0
RxGOC      : 0
RxEPC1     : 0
RxEPC2     : 0

        pvid: 0
        link: port:3 link:down
Port 4:
        mib: Port 4 MIB counters
TxGPC      : 0
TxBOC      : 0
TxGOC      : 0
TxEPC      : 0
RxGPC      : 0
RxBOC      : 0
RxGOC      : 0
RxEPC1     : 0
RxEPC2     : 0

        pvid: 0
        link: port:4 link:down
Port 5:
        mib: Port 5 MIB counters
TxGPC      : 88
TxBOC      : 0
TxGOC      : 21831
TxEPC      : 0
RxGPC      : 283
RxBOC      : 0
RxGOC      : 30236
RxEPC1     : 0
RxEPC2     : 0

        pvid: 0
        link: port:5 link:up speed:1000baseT full-duplex
Port 6:
        mib: Port 6 MIB counters
TxGPC      : 283
TxBOC      : 0
TxGOC      : 30236
TxEPC      : 0
RxGPC      : 88
RxBOC      : 0
RxGOC      : 21831
RxEPC1     : 0
RxEPC2     : 0

        pvid: 0
        link: port:6 link:up speed:1000baseT full-duplex
Port 7:
        mib: Port 7 MIB counters
TxGPC      : 0
TxBOC      : 0
TxGOC      : 0
TxEPC      : 0
RxGPC      : 0
RxBOC      : 0
RxGOC      : 0
RxEPC1     : 0
RxEPC2     : 0

        pvid: 0
        link: port:7 link:down
root@OpenWrt:/# ifconfig
br-lan    Link encap:Ethernet  HWaddr AC:15:A2:A8:A5:89
          inet addr:192.168.1.1  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::ae15:a2ff:fea8:a589/64 Scope:Link
          inet6 addr: fd19:e8ff:7d2::1/60 Scope:Global
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:14 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:1964 (1.9 KiB)

eth0      Link encap:Ethernet  HWaddr AC:15:A2:A8:A5:89
          inet6 addr: fe80::ae15:a2ff:fea8:a589/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:284 errors:0 dropped:4 overruns:0 frame:0
          TX packets:92 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:29433 (28.7 KiB)  TX bytes:22685 (22.1 KiB)
          Interrupt:5

eth0.1    Link encap:Ethernet  HWaddr AC:15:A2:A8:A5:89
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:14 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:1964 (1.9 KiB)

eth0.2    Link encap:Ethernet  HWaddr AC:15:A2:A8:A5:8A
          inet6 addr: fe80::ae15:a2ff:fea8:a58a/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:64 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:18024 (17.6 KiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:128 errors:0 dropped:0 overruns:0 frame:0
          TX packets:128 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:8704 (8.5 KiB)  TX bytes:8704 (8.5 KiB)

wlan0     Link encap:Ethernet  HWaddr AC:15:A2:A8:A5:89
          inet6 addr: fe80::ae15:a2ff:fea8:a589/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:960 (960.0 B)

root@OpenWrt:/#

Ok. Can you change network config:

  1. Remove wan interface
  2. For lan interface change etho.1 device to eth0
    and reboot?
    Just to test that without vlans rtl8367d work correctly. As good result you wired client device must connect to router and get address.

I just updated https://github.com/openwrt/openwrt/pull/14804 as a base for further fixes for rtl8367d.

Last archive updated. To simplify test results show only output of:

dmesg | grep rtl8367rb
swconfig dev switch0 port 5 show
swconfig dev switch1 show

Last patch is uncommited because only set/get_vlan4k is needed if I correctly localize error.

This worked ok. I'll check the new package now and come back with the results.