OpenWrt support for Sitecom WLR-4100 v1 001

As I undersatnd you remove switch0 vlan config. Then show current network config, pls.

This is the config active while gathering the statistics above:

root@OpenWrt:/# cat /etc/config/network

config interface 'loopback'
        option ifname 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config globals 'globals'
        option ula_prefix 'fd22:3258:3e56::/48'

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

config device 'lan_eth0_1_dev'
        option name 'eth0.1'
        option macaddr 'xx'

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

config device 'wan_eth0_2_dev'
        option name 'eth0.2'
        option macaddr 'xx'

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

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

config switch_vlan
        option device 'switch1'
        option vlan '1'
        option ports '0 1 2 3 6t'

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

When I modify it to include the appropriate settings for switch0 and restart the network, still no traffic is possible.

new config
root@OpenWrt:/# cat /etc/config/network

config interface 'loopback'
        option ifname 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config globals 'globals'
        option ula_prefix 'fd22:3258:3e56::/48'

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

config device 'lan_eth0_1_dev'
        option name 'eth0.1'
        option macaddr 'xx'

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

config device 'wan_eth0_2_dev'
        option name 'eth0.2'
        option macaddr 'xx'

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

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

config switch_vlan
        option device 'switch1'
        option vlan '1'
        option ports '0 1 2 3 6t'

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

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

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

config switch_vlan
        option device 'switch0'
        option vlan '2'
        option ports '5t 6t'
switch0 vlans
root@OpenWrt:/# swconfig dev switch0 vlan 1 show
VLAN 1:
        ports: 5t 6t
root@OpenWrt:/# swconfig dev switch0 vlan 2 show
VLAN 2:
        ports: 5t 6t
switch1 vlans
root@OpenWrt:/# swconfig dev switch1 vlan 1 show
VLAN 1:
        info: VLAN 1: Ports: '01236t', members=004f, untag=000f, fid=0
        ports: 0 1 2 3 6t
root@OpenWrt:/# swconfig dev switch1 vlan 2 show
VLAN 2:
        info: VLAN 2: Ports: '46t', members=0050, untag=0010, fid=0
        ports: 4 6t
ifconfig
root@OpenWrt:/# ifconfig
br-lan    Link encap:Ethernet  HWaddr xx
          inet addr:192.168.1.1  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fd22:3258:3e56::1/60 Scope:Global
          inet6 addr: fe80::66d1:xx/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2 errors:0 dropped:0 overruns:0 frame:0
          TX packets:43 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:374 (374.0 B)  TX bytes:3558 (3.4 KiB)

eth0      Link encap:Ethernet  HWaddr xx
          inet6 addr: fe80::66d1:xx/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:90 errors:0 dropped:0 overruns:0 frame:2
          TX packets:304 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:7852 (7.6 KiB)  TX bytes:60973 (59.5 KiB)
          Interrupt:5

eth0.1    Link encap:Ethernet  HWaddr xx
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:12 errors:0 dropped:0 overruns:0 frame:0
          TX packets:43 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:834 (834.0 B)  TX bytes:3558 (3.4 KiB)

eth0.2    Link encap:Ethernet  HWaddr xx
          inet6 addr: fe80::66d1:xx/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:31 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:6768 (6.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:219 errors:0 dropped:0 overruns:0 frame:0
          TX packets:219 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:16080 (15.7 KiB)  TX bytes:16080 (15.7 KiB)
switch0 port 5
root@OpenWrt:/# swconfig dev switch0 port 5 show
Port 5:
        disable: 0
        doubletag: 0
        untag: 0
        led: ???
        lan: 1
        recv_bad: 295
        recv_good: 6229
        tr_bad: ???
        tr_good: ???
        pvid: 0
        link: port:5 link:up speed:1000baseT full-duplex
switch1 port 6
root@OpenWrt:/# swconfig dev switch1 port 6 show
Port 6:
        mib: Port 6 MIB counters
ifInOctets                          : 26919
dot3StatsFCSErrors                  : 125
dot3StatsSymbolErrors               : 65
dot3InPauseFrames                   : 0
dot3ControlInUnknownOpcodes         : 0
etherStatsFragments                 : 0
etherStatsJabbers                   : 0
ifInUcastPkts                       : 0
etherStatsDropEvents                : 0
ifInMulticastPkts                   : 0
ifInBroadcastPkts                   : 0
inMldChecksumError                  : 0
inIgmpChecksumError                 : 0
inMldSpecificQuery                  : 0
inMldGeneralQuery                   : 0
inIgmpSpecificQuery                 : 0
inIgmpGeneralQuery                  : 0
inMldLeaves                         : 0
inIgmpLeaves                        : 0
etherStatsOctets                    : 42487
etherStatsUnderSizePkts             : 0
etherOversizeStats                  : 0
etherStatsPkts64Octets              : 14
etherStatsPkts65to127Octets         : 142
etherStatsPkts128to255Octets        : 23
etherStatsPkts256to511Octets        : 76
etherStatsPkts512to1023Octets       : 0
etherStatsPkts1024to1518Octets      : 0
ifOutOctets                         : 15568
dot3StatsSingleCollisionFrames      : 0
dot3StatMultipleCollisionFrames     : 0
dot3sDeferredTransmissions          : 0
dot3StatsLateCollisions             : 0
etherStatsCollisions                : 0
dot3StatsExcessiveCollisions        : 0
dot3OutPauseFrames                  : 0
ifOutDiscards                       : 0
dot1dTpPortInDiscards               : 0
ifOutUcastPkts                      : 80
ifOutMulticastPkts                  : 14
ifOutBroadcastPkts                  : 36
outOampduPkts                       : 0
inOampduPkts                        : 0
inIgmpJoinsSuccess                  : 0
inIgmpJoinsFail                     : 0
inMldJoinsSuccess                   : 0
inMldJoinsFail                      : 0
inReportSuppressionDrop             : 0
inLeaveSuppressionDrop              : 0
outIgmpReports                      : 0
outIgmpLeaves                       : 0
outIgmpGeneralQuery                 : 0
outIgmpSpecificQuery                : 0
outMldReports                       : 0
outMldLeaves                        : 0
outMldGeneralQuery                  : 0
outMldSpecificQuery                 : 0
inKnownMulticastPkts                : 0

        pvid: 1
        link: port:6 link:up speed:1000baseT full-duplex txflow rxflow

Try to change ralink,fpa2 = <0x1f003fff>; to ralink,fpa2 = <0x1f503ffa>;.

Again making progress, with this modification I can now see ARP traffic leaving the device while pinging, though no traffic seems to be picked up by the device as ping does not actually work, nor does arp on the router show a valid mac address for the pinged device.

P5 and M6 statistics?

I can see traffic leaving the device with and without applying VLAN tags to the SoC switch. Interestingly, the recv_good counter never seems to increase, but also does not seem to reset following a reboot of the device.

root@OpenWrt:/# swconfig dev switch0 port 5 show
Port 5:
        disable: 0
        doubletag: 0
        untag: 0
        led: ???
        lan: 1
        recv_bad: 283
        recv_good: 6146
        tr_bad: ???
        tr_good: ???
        pvid: 0
        link: port:5 link:up speed:1000baseT full-duplex

The same command, a minute or two later, while pinging from client to router:

root@OpenWrt:/# swconfig dev switch0 port 5 show
Port 5:
        disable: 0
        doubletag: 0
        untag: 0
        led: ???
        lan: 1
        recv_bad: 506
        recv_good: 6146
        tr_bad: ???
        tr_good: ???
        pvid: 0
        link: port:5 link:up speed:1000baseT full-duplex

Port 6:

root@OpenWrt:/# swconfig dev switch1 port 6 show
Port 6:
        mib: Port 6 MIB counters
ifInOctets                          : 40040
dot3StatsFCSErrors                  : 0
dot3StatsSymbolErrors               : 0
dot3InPauseFrames                   : 0
dot3ControlInUnknownOpcodes         : 0
etherStatsFragments                 : 0
etherStatsJabbers                   : 0
ifInUcastPkts                       : 0
etherStatsDropEvents                : 0
ifInMulticastPkts                   : 34
ifInBroadcastPkts                   : 111
inMldChecksumError                  : 0
inIgmpChecksumError                 : 0
inMldSpecificQuery                  : 0
inMldGeneralQuery                   : 0
inIgmpSpecificQuery                 : 0
inIgmpGeneralQuery                  : 0
inMldLeaves                         : 0
inIgmpLeaves                        : 0
etherStatsOctets                    : 85349
etherStatsUnderSizePkts             : 0
etherOversizeStats                  : 0
etherStatsPkts64Octets              : 12
etherStatsPkts65to127Octets         : 380
etherStatsPkts128to255Octets        : 28
etherStatsPkts256to511Octets        : 130
etherStatsPkts512to1023Octets       : 0
etherStatsPkts1024to1518Octets      : 0
ifOutOctets                         : 45309
dot3StatsSingleCollisionFrames      : 0
dot3StatMultipleCollisionFrames     : 0
dot3sDeferredTransmissions          : 0
dot3StatsLateCollisions             : 0
etherStatsCollisions                : 0
dot3StatsExcessiveCollisions        : 0
dot3OutPauseFrames                  : 0
ifOutDiscards                       : 0
dot1dTpPortInDiscards               : 119
ifOutUcastPkts                      : 325
ifOutMulticastPkts                  : 20
ifOutBroadcastPkts                  : 60
outOampduPkts                       : 0
inOampduPkts                        : 0
inIgmpJoinsSuccess                  : 0
inIgmpJoinsFail                     : 0
inMldJoinsSuccess                   : 18
inMldJoinsFail                      : 0
inReportSuppressionDrop             : 0
inLeaveSuppressionDrop              : 0
outIgmpReports                      : 0
outIgmpLeaves                       : 0
outIgmpGeneralQuery                 : 0
outIgmpSpecificQuery                : 0
outMldReports                       : 0
outMldLeaves                        : 0
outMldGeneralQuery                  : 0
outMldSpecificQuery                 : 0
inKnownMulticastPkts                : 0

        pvid: 1
        link: port:6 link:up speed:1000baseT full-duplex txflow rxflow

EDIT: after reboot, the recv_good counter for switch0 port 5 was 6139, but again did not increase.

Ok. I think that I've located the problem

  1. In short: Test these change
    ralink,fpa2 = <0x1f103ffa>;
    realtek,extif1 = <2 0 1 1 1 1 1 1 2>;
    which set P5 rxid=0/txid=1 and M6 rxid=0/txid=2 (about rxid/txid see below)
  2. More long story :slight_smile:
    RGMII interface sometimes need rx/tx delays for synchronization.
    Without sync received data is corrupted that results in frame checksum error at least (see M6 inpkt statistics in 1st test).
dot3StatsFCSErrors                  : 125

Both rt3352 and rtl8367rb switches support rx/tx internal delay (rxid/txid) settings.
Moreover these settings may be tuned in dts-file:

  • ralink,fpa2 bits[21:20]=txid, bits[23:22]=rxid for P5;
  • first 2 value of realtek,extif1 are txid and rxid for M6;
    In 2nd test we reset P5 rxid/txid to default values and get synchronization in P5->M6 direction
    (no frame checksum error and good mcast/bcast inpkts - I think arp request).
dot3StatsFCSErrors                  : 0
dot3StatsSymbolErrors               : 0
dot3InPauseFrames                   : 0
dot3ControlInUnknownOpcodes         : 0
etherStatsFragments                 : 0
etherStatsJabbers                   : 0
ifInUcastPkts                       : 0
etherStatsDropEvents                : 0
ifInMulticastPkts                   : 34
ifInBroadcastPkts                   : 111

Now we need to get synchronization in M6->P5 direction.
So in 3rd test we set P5 rxid=0 and increase M6 txid to 2 (may be txid=1 is good too but because of poor rt3352 statistics we can't see details). BTW Can you run tcpdump on eth0.1 interface?

P.S. rt3352 switch support statistics reset but no implementation in driver code. So only cold reset :frowning:

It definitely seems you're on the right track with the synchronization stuff. Ping is now sometimes successful, and my laptop even received a DHCP lease:

root@OpenWrt:/# tcpdump -i eth0.1
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0.1, link-type EN10MB (Ethernet), capture size 262144 bytes
10:07:10.712701 IP MacBook-Pro.lan > OpenWrt.lan: ICMP echo request, id 36377, seq 153, length 64
10:07:10.713169 IP OpenWrt.lan > MacBook-Pro.lan: ICMP echo reply, id 36377, seq 153, length 64
10:07:15.684691 IP MacBook-Pro.lan > OpenWrt.lan: ICMP echo request, id 36377, seq 158, length 64
10:07:15.685150 IP OpenWrt.lan > MacBook-Pro.lan: ICMP echo reply, id 36377, seq 158, length 64
10:07:15.743758 ARP, Request who-has MacBook-Pro.lan tell OpenWrt.lan, length 28
10:07:16.783699 ARP, Request who-has MacBook-Pro.lan tell OpenWrt.lan, length 28
10:07:17.823699 ARP, Request who-has MacBook-Pro.lan tell OpenWrt.lan, length 28
10:07:17.824139 ARP, Reply MacBook-Pro.lan is-at xx (oui Unknown), length 46
10:07:19.668781 IP MacBook-Pro.lan > OpenWrt.lan: ICMP echo request, id 36377, seq 162, length 64
10:07:19.669232 IP OpenWrt.lan > MacBook-Pro.lan: ICMP echo reply, id 36377, seq 162, length 64
10:07:20.664184 IP MacBook-Pro.lan > OpenWrt.lan: ICMP echo request, id 36377, seq 163, length 64
10:07:20.664639 IP OpenWrt.lan > MacBook-Pro.lan: ICMP echo reply, id 36377, seq 163, length 64

I tried both realtek,extif1 = <2 0 1 1 1 1 1 1 2>; and realtek,extif1 = <1 0 1 1 1 1 1 1 2>; in the .dts file, both with the same sometimes-successful ping results. These are the results of pinging from my laptop to the device for 30 seconds:

ping -c 30 192.168.1.1
PING 192.168.1.1 (192.168.1.1): 56 data bytes
Request timeout for icmp_seq 0
Request timeout for icmp_seq 1
64 bytes from 192.168.1.1: icmp_seq=2 ttl=64 time=0.997 ms
Request timeout for icmp_seq 3
Request timeout for icmp_seq 4
Request timeout for icmp_seq 5
Request timeout for icmp_seq 6
Request timeout for icmp_seq 7
Request timeout for icmp_seq 8
Request timeout for icmp_seq 9
Request timeout for icmp_seq 10
Request timeout for icmp_seq 11
Request timeout for icmp_seq 12
Request timeout for icmp_seq 13
64 bytes from 192.168.1.1: icmp_seq=14 ttl=64 time=0.836 ms
Request timeout for icmp_seq 15
64 bytes from 192.168.1.1: icmp_seq=16 ttl=64 time=0.779 ms
Request timeout for icmp_seq 17
Request timeout for icmp_seq 18
Request timeout for icmp_seq 19
Request timeout for icmp_seq 20
Request timeout for icmp_seq 21
Request timeout for icmp_seq 22
64 bytes from 192.168.1.1: icmp_seq=23 ttl=64 time=0.889 ms
Request timeout for icmp_seq 24
Request timeout for icmp_seq 25
Request timeout for icmp_seq 26
Request timeout for icmp_seq 27
Request timeout for icmp_seq 28
64 bytes from 192.168.1.1: icmp_seq=29 ttl=64 time=0.915 ms

--- 192.168.1.1 ping statistics ---
30 packets transmitted, 5 packets received, 83.3% packet loss
round-trip min/avg/max/stddev = 0.779/0.883/0.997/0.074 ms

switch1 port 6 statistics:

Port 6:
        mib: Port 6 MIB counters
ifInOctets                          : 58614
dot3StatsFCSErrors                  : 0
dot3StatsSymbolErrors               : 0
dot3InPauseFrames                   : 0
dot3ControlInUnknownOpcodes         : 0
etherStatsFragments                 : 0
etherStatsJabbers                   : 0
ifInUcastPkts                       : 46
etherStatsDropEvents                : 0
ifInMulticastPkts                   : 41
ifInBroadcastPkts                   : 149
inMldChecksumError                  : 0
inIgmpChecksumError                 : 0
inMldSpecificQuery                  : 0
inMldGeneralQuery                   : 0
inIgmpSpecificQuery                 : 0
inIgmpGeneralQuery                  : 0
inMldLeaves                         : 0
inIgmpLeaves                        : 0
etherStatsOctets                    : 88977
etherStatsUnderSizePkts             : 0
etherOversizeStats                  : 0
etherStatsPkts64Octets              : 30
etherStatsPkts65to127Octets         : 281
etherStatsPkts128to255Octets        : 33
etherStatsPkts256to511Octets        : 154
etherStatsPkts512to1023Octets       : 0
etherStatsPkts1024to1518Octets      : 0
ifOutOctets                         : 30363
dot3StatsSingleCollisionFrames      : 0
dot3StatMultipleCollisionFrames     : 0
dot3sDeferredTransmissions          : 0
dot3StatsLateCollisions             : 0
etherStatsCollisions                : 0
dot3StatsExcessiveCollisions        : 0
dot3OutPauseFrames                  : 0
ifOutDiscards                       : 0
dot1dTpPortInDiscards               : 154
ifOutUcastPkts                      : 206
ifOutMulticastPkts                  : 20
ifOutBroadcastPkts                  : 36
outOampduPkts                       : 0
inOampduPkts                        : 0
inIgmpJoinsSuccess                  : 0
inIgmpJoinsFail                     : 0
inMldJoinsSuccess                   : 24
inMldJoinsFail                      : 0
inReportSuppressionDrop             : 0
inLeaveSuppressionDrop              : 0
outIgmpReports                      : 0
outIgmpLeaves                       : 0
outIgmpGeneralQuery                 : 0
outIgmpSpecificQuery                : 0
outMldReports                       : 0
outMldLeaves                        : 0
outMldGeneralQuery                  : 0
outMldSpecificQuery                 : 0
inKnownMulticastPkts                : 0

        pvid: 1
        link: port:6 link:up speed:1000baseT full-duplex txflow rxflow

Ok. In this case P5 statistics is more informative.
Just inspect rtl8367rb source - M6 txid valid values are 0 an 1 only. Check txid=0, pls.
If no sync, you can try fix M6 txid and increase P5 rxid step by step from 0 to 3.

That did it! ralink,fpa2 = <0x1f103ffa>; and realtek,extif1 = <0 0 1 1 1 1 1 1 2>; is the magic combination. The device and switch are now fully operational:

ping -c 10 192.168.1.1
PING 192.168.1.1 (192.168.1.1): 56 data bytes
64 bytes from 192.168.1.1: icmp_seq=0 ttl=64 time=1.543 ms
64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=0.833 ms
64 bytes from 192.168.1.1: icmp_seq=2 ttl=64 time=0.850 ms
64 bytes from 192.168.1.1: icmp_seq=3 ttl=64 time=0.806 ms
64 bytes from 192.168.1.1: icmp_seq=4 ttl=64 time=0.822 ms
64 bytes from 192.168.1.1: icmp_seq=5 ttl=64 time=0.783 ms
64 bytes from 192.168.1.1: icmp_seq=6 ttl=64 time=1.004 ms
64 bytes from 192.168.1.1: icmp_seq=7 ttl=64 time=1.025 ms
64 bytes from 192.168.1.1: icmp_seq=8 ttl=64 time=0.965 ms
64 bytes from 192.168.1.1: icmp_seq=9 ttl=64 time=0.896 ms

--- 192.168.1.1 ping statistics ---
10 packets transmitted, 10 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.783/0.953/1.543/0.213 ms
2 Likes

Ok. But just for test try increase P5 rxid.
Ping time 1.5 - 0.8 ms is too big for gigabit lan. Typical STABLE value 0.5-0.4 ms.
And check P5 statistics.

This translates into the following values for ralink,fpa2 right?

<0x1f103ffa>
<0x1f303ffa>
<0x1f503ffa>
<0x1f703ffa>

I have tried all of them, where <0x1f103ffa> and <0x1f503ffa> appear to be equally stable with only 1 or 2 in the recv_bad stat for P5 after some time of operation. The other values resulted in high packet loss and a higher and steadily rising recv_bad stat. Ping times will not go lower unfortunately.

EDIT: pinging the device on its WAN port from another device than my laptop results in slightly better response times, even though passing through two network switches:

ping -c 10 10.0.50.237
PING 10.0.50.237 (10.0.50.237) 56(84) bytes of data.
64 bytes from 10.0.50.237: icmp_seq=1 ttl=64 time=0.698 ms
64 bytes from 10.0.50.237: icmp_seq=2 ttl=64 time=0.628 ms
64 bytes from 10.0.50.237: icmp_seq=3 ttl=64 time=0.607 ms
64 bytes from 10.0.50.237: icmp_seq=4 ttl=64 time=0.710 ms
64 bytes from 10.0.50.237: icmp_seq=5 ttl=64 time=0.613 ms
64 bytes from 10.0.50.237: icmp_seq=6 ttl=64 time=0.598 ms
64 bytes from 10.0.50.237: icmp_seq=7 ttl=64 time=0.596 ms
64 bytes from 10.0.50.237: icmp_seq=8 ttl=64 time=0.612 ms
64 bytes from 10.0.50.237: icmp_seq=9 ttl=64 time=0.622 ms
64 bytes from 10.0.50.237: icmp_seq=10 ttl=64 time=0.602 ms

--- 10.0.50.237 ping statistics ---
10 packets transmitted, 10 received, 0% packet loss, time 9206ms
rtt min/avg/max/mdev = 0.596/0.628/0.710/0.038 ms

Ok. You've checked

<0x1f103ffa> - rxid=0 txid=1
<0x1f303ffa> - rxid=0 txid=3
<0x1f503ffa> - rxid=1 txid=1
<0x1f703ffa> - rxid=1 txid=3

It will be better to test rxid=0,1,2,3 wit fixed txid=1.
But at any case low recv_bad is a key point. So I don't think that additinal tests are very necesary.
And low stable wan interface ping is strange for me.

Good luck!

I also have a Sitecom X4 N300 (Rev. A)

Can you please elaborate on the compilation and flashing steps? I Would very much like to recycle the router :slight_smile:

If I understand correctly from the comments below, the dts file should be this:

/dts-v1/;

#include "rt3352.dtsi"

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>

/ {
        compatible = "sitecom,wlr-4100-1001", "ralink,rt3352-soc";
        model = "Sitecom WLR-4100 v1 001";

        aliases {
                led-boot = &led_power;
                led-failsafe = &led_power;
                led-running = &led_power;
                led-upgrade = &led_power;
                mdio-gpio0 = &mdio0;
        };

        mdio0: mdio {
                compatible = "virtual,mdio-gpio";
                #address-cells = <1>;
                #size-cells = <0>;
                gpios = <&gpio0 23 GPIO_ACTIVE_HIGH &gpio0 22 GPIO_ACTIVE_HIGH>;
        };

        leds {
                compatible = "gpio-leds";

                led_power: power {
                        label = "wl-4100:amber:power";
                        gpios = <&gpio0 9 GPIO_ACTIVE_LOW>;
                };

                led_wps: wps {
                        label = "wl-4100:white:wps";
                        gpios = <&gpio0 14 GPIO_ACTIVE_LOW>;
                };
        };

        keys {
                compatible = "gpio-keys-polled";
                poll-interval = <20>;

                wps {
                        label = "wps";
                        gpios = <&gpio0 0 GPIO_ACTIVE_LOW>;
                        linux,code = <KEY_WPS_BUTTON>;
                };

        };

        rtl8367rb {
                compatible = "realtek,rtl8367b", "rtl8367b";
                mii-bus = <&mdio0>;
                realtek,extif1 = <0 0 1 1 1 1 1 1 2>;
                cpu_port = <6>;
        };
};

&spi0 {
        status = "okay";

        m25p90@0 {
                compatible = "jedec,spi-nor";
                reg = <0>;
                spi-max-frequency = <10000000>;

                partitions {
                        compatible = "fixed-partitions";
                        #address-cells = <1>;
                        #size-cells = <1>;

                        partition@0 {
                                label = "u-boot";
                                reg = <0x0 0x30000>;
                                read-only;
                        };

                        partition@30000 {
                                label = "u-boot-env";
                                reg = <0x30000 0x10000>;
                        };

                        factory: partition@40000 {
                                label = "rf-data";
                                reg = <0x40000 0x10000>;
                                read-only;
                        };

                        partition@50000 {
                                compatible = "denx,uimage";
                                label = "kernel";
                                reg = <0x50000 0x7b0000>;
                        };

                };
        };
};

&pinctrl {
        state_default: pinctrl0 {
                gpio {
                        ralink,group = "i2c", "jtag", "uartf", "mdio";
                        ralink,function = "gpio";
                };
        };
};

&ethernet {
        mtd-mac-address = <&factory 0x4>;
        pinctrl-names = "default";
        pinctrl-0 = <&rgmii_pins>;

        port@5 {
                phy-mode = "rgmii";
        };

};

&esw {
        ralink,rgmii = <1>;
        mediatek,portmap = <0x3f>;
        ralink,fct2 = <0x0002500c>;
        ralink,fpa2 = <0x1f103ffa>;
};

&wmac {
        ralink,mtd-eeprom = <&factory 0>;
};

I named it rt3352_sitecom_wlr4100_v1_001.dts and placed it in /target/linux/ramips/dts
(got the naming and path from this PR: ramips: add support for Sitecom WLR-4100 v1 002 by polex · Pull Request #4308 · openwrt/openwrt · GitHub

But now I'm stuck.
[OpenWrt Wiki] Build system usage
and
[OpenWrt Wiki] Adding a new device

Do not give me enough information on how to build this image. Also, I don't know what other file additions/modifications might be required.

@BAJansen do you still have the files somewhere laying around? Could you perhaps add those as a PR, or elaborate some more on the steps you've taken to build the image?

To build the image some additional files need to be modified. I more or less dropped my efforts for formally adding support for the device as wifi appears to be physically broken on my device and I wouldn't be able to test all features. I am still running my build and using it more or less as a managed switch and it appears to be reasonable stable:

I still have my modified source code, but it is based on OpenWRT master sometime after the 19.07 release. Here is my full .dts file and a diff of the changes to other files:

DTS:

/dts-v1/;

#include "rt3352.dtsi"

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>

/ {
        compatible = "sitecom,wlr-4100-1001", "ralink,rt3352-soc";
        model = "Sitecom WLR-4100 v1 001";

        aliases {
                led-boot = &led_power;
                led-failsafe = &led_power;
                led-running = &led_power;
                led-upgrade = &led_power;
                mdio-gpio0 = &mdio0;
        };

        mdio0: mdio {
                compatible = "virtual,mdio-gpio";
                #address-cells = <1>;
                #size-cells = <0>;
                gpios = <&gpio0 23 GPIO_ACTIVE_HIGH &gpio0 22 GPIO_ACTIVE_HIGH>;
        };

        leds {
                compatible = "gpio-leds";

                led_power: power {
                        label = "wl-4100:amber:power";
                        gpios = <&gpio0 9 GPIO_ACTIVE_LOW>;
                };

                ops {
                        label = "wl-4100:white:ops";
                        gpios = <&gpio0 14 GPIO_ACTIVE_LOW>;
                };
        };

        keys {
                compatible = "gpio-keys-polled";
                poll-interval = <20>;

                ops {
                        label = "ops";
                        gpios = <&gpio0 0 GPIO_ACTIVE_LOW>;
                        linux,code = <KEY_WPS_BUTTON>;
                };

        };

        rtl8367rb {
                compatible = "realtek,rtl8367b", "rtl8367b";
                mii-bus = <&mdio0>;
                realtek,extif1 = <0 0 1 1 1 1 1 1 2>;
        };
};

&spi0 {
        status = "okay";

        m25p90@0 {
                compatible = "jedec,spi-nor";
                reg = <0>;
                spi-max-frequency = <10000000>;

                partitions {
                        compatible = "fixed-partitions";
                        #address-cells = <1>;
                        #size-cells = <1>;

                        partition@0 {
                                label = "u-boot";
                                reg = <0x0 0x30000>;
                                read-only;
                        };

                        partition@30000 {
                                label = "u-boot-env";
                                reg = <0x30000 0x10000>;
                        };

                        factory: partition@40000 {
                                label = "rf-data";
                                reg = <0x40000 0x10000>;
                                read-only;
                        };

                        partition@50000 {
                                compatible = "denx,uimage";
                                label = "firmware";
                                reg = <0x50000 0x7b0000>;
                        };

                };
        };
};

&pinctrl {
        state_default: pinctrl0 {
                gpio {
                        ralink,group = "i2c", "jtag", "uartf", "mdio";
                        ralink,function = "gpio";
                };
        };
};

&ethernet {
        mtd-mac-address = <&factory 0x4>;
        pinctrl-names = "default";
        pinctrl-0 = <&rgmii_pins>;

        port@5 {
                phy-mode = "rgmii";
        };

};

&esw {
        ralink,rgmii = <1>;
        mediatek,portmap = <0x3f>;
        ralink,fct2 = <0x0002500c>;
        ralink,fpa2 = <0x1f503ffa>;
};

&wmac {
        ralink,mtd-eeprom = <&factory 0>;
};

Diff:

bernardus@prutsbuntu:~/src/openwrt$ git diff HEAD
diff --git a/target/linux/ramips/image/rt305x.mk b/target/linux/ramips/image/rt305x.mk
index 7d145c3992..bb65e29f3b 100644
--- a/target/linux/ramips/image/rt305x.mk
+++ b/target/linux/ramips/image/rt305x.mk
@@ -962,6 +962,18 @@ define Device/sitecom_wl-351
 endef
 TARGET_DEVICES += sitecom_wl-351

+define Device/sitecom_wlr-4100-1001
+  SOC := rt3352
+  BLOCKSIZE := 64k
+  IMAGE_SIZE := 7872k
+  DEVICE_VENDOR := Sitecom
+  DEVICE_MODEL := WLR-4100 v1 001
+  DEVICE_PACKAGES := kmod-switch-rtl8367b kmod-swconfig swconfig kmod-mdio-gpio
+  SUPPORTED_DEVICES += wlr-4100-1001
+  DEFAULT := n
+endef
+TARGET_DEVICES += sitecom_wlr-4100-1001
+
 define Device/skyline_sl-r7205
   SOC := rt3052
   BLOCKSIZE := 64k
diff --git a/target/linux/ramips/rt305x/base-files/etc/board.d/02_network b/target/linux/ramips/rt305x/base-files/etc/board.d/02_network
index 56c786bc95..81fa5eaf78 100755
--- a/target/linux/ramips/rt305x/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/rt305x/base-files/etc/board.d/02_network
@@ -156,6 +156,10 @@ ramips_setup_interfaces()
                ucidef_add_switch "switch0" \
                        "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "5@eth0"
                ;;
+       sitecom,wlr-4100-1001)
+               ucidef_add_switch "switch0" \
+                       "0:lan:4" "1:lan:3" "2:lan:2" "3:lan:1" "4:wan" "6@eth0"
+               ;;
        sparklan,wcr-150gn)
                ucidef_add_switch "switch0" \
                        "0:lan" "6t@eth0"

Thanks @BAJansen
I saw that you have a github repository, but couldn't find the changes i needed.

Are these 2 files all I need to create a PR?
And do you have any advice on how to build a test image locally? Which approach did you take?

I made a Pullrequest using those 2 files. Would like to test it, but building locally wasn't much of a succes..

Added support for Sitecom wlr4100 v1 001 by JoostvdB94 · Pull Request #4985 · openwrt/openwrt (github.com)

Commented on your github pull request. Besides from just not seeing the switch and therefor no wan/lan it may also need some *.dlf factory image creation. Also in original firmware LABEL/LAN/WIFI use same mac address but the WAN address is a lower number that is magnitudes off other than a couple of numbers up/down.

By using this method and comparing 2 original firmware files from Sitecom I was able to make the header partly match but I'm not sure which other padding $$ | $$$$ Checksize etc is needed since the OEM webinterface still errors about it:

senao-header -r 0x0222 -p 0x004A -t 2

Other strange facts about this device is that the u-boot bootloader reports that the device is a esr9850v(EnGenius ), the Sitecom GPL sources a D-link 615 (see rev G/H).

Sorry for not being active. I'm willing to donate my router to someone who has time for it. I'm living in the Netherlands.