OpenWrt support for Sitecom WLR-4100 v1 001

I did some snooping around through esw_rt3050.c, and it appears the line below is what enabled port 5 in the SoC switch. Apparently this line should also already enable port 6.

ralink,fpa2 = <0x1f003fff>;

The lines below here are equal to the defaults set in the source code, and do not appear to be of any significance:

mediatek,portmap = <0x3f>;
ralink,fct2 = <0x0002500c>;

Before I'll take a look into internal switch rt3352 source can you test this config changes:

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

?

I tried it, but it made no difference.
To be absolutely clear, this is what my .dts file currently looks like:

wlr-4100-1001.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>;
                };

                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 = <1 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 = <0x1f003fff>;
};

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

Just for clean statistics can you make test:

  1. Setup lan client ip 192.168.1.2 (or any from net 192.168.1.0/24)
  2. Cold reboot the router to clean up statistics.
  3. Ping 192.168.1.1 from client
  4. Ping 192.168.1.2 from the router.
  5. Show output of commands from the router command line:
ifconfig
swconfig dev switch0 port 5 show
swconfig dev switch1 port 6 show

I removed ralink,rgmii = <1>; from the .dts file so the SoC switch is exported:

root@OpenWrt:/# swconfig list
Found: switch0 - rt305x
Found: switch1 - rtl8367rb

I then pinged from client to router and router to client for at least a full minute, with no replies. I also ran wireshark on the client and saw no traffic leaving the router.

root@OpenWrt:/# swconfig dev switch0 port 5 show
Port 5:
        disable: 0
        doubletag: 1
        untag: 1
        led: ???
        lan: 1
        recv_bad: 188
        recv_good: 6174
        tr_bad: ???
        tr_good: ???
        pvid: 0
        link: port:5 link:up speed:1000baseT full-duplex
root@OpenWrt:/# swconfig dev switch1 port 6 show
Port 6:
        mib: Port 6 MIB counters
ifInOctets                          : 39018
dot3StatsFCSErrors                  : 197
dot3StatsSymbolErrors               : 68
dot3InPauseFrames                   : 0
dot3ControlInUnknownOpcodes         : 0
etherStatsFragments                 : 0
etherStatsJabbers                   : 0
ifInUcastPkts                       : 0
etherStatsDropEvents                : 0
ifInMulticastPkts                   : 1
ifInBroadcastPkts                   : 1
inMldChecksumError                  : 0
inIgmpChecksumError                 : 0
inMldSpecificQuery                  : 0
inMldGeneralQuery                   : 0
inIgmpSpecificQuery                 : 0
inIgmpGeneralQuery                  : 0
inMldLeaves                         : 0
inIgmpLeaves                        : 0
etherStatsOctets                    : 60003
etherStatsUnderSizePkts             : 0
etherOversizeStats                  : 0
etherStatsPkts64Octets              : 38
etherStatsPkts65to127Octets         : 214
etherStatsPkts128to255Octets        : 27
etherStatsPkts256to511Octets        : 102
etherStatsPkts512to1023Octets       : 1
etherStatsPkts1024to1518Octets      : 0
ifOutOctets                         : 20985
dot3StatsSingleCollisionFrames      : 0
dot3StatMultipleCollisionFrames     : 0
dot3sDeferredTransmissions          : 0
dot3StatsLateCollisions             : 0
etherStatsCollisions                : 0
dot3StatsExcessiveCollisions        : 0
dot3OutPauseFrames                  : 0
ifOutDiscards                       : 0
dot1dTpPortInDiscards               : 0
ifOutUcastPkts                      : 105
ifOutMulticastPkts                  : 18
ifOutBroadcastPkts                  : 60
outOampduPkts                       : 0
inOampduPkts                        : 0
inIgmpJoinsSuccess                  : 0
inIgmpJoinsFail                     : 0
inMldJoinsSuccess                   : 1
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
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: fd2e:b0bd:5a61::1/60 Scope:Global
          inet6 addr: fe80::66d1:xx/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:12 errors:0 dropped:0 overruns:0 frame:0
          TX packets:102 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1398 (1.3 KiB)  TX bytes:7740 (7.5 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:52 errors:0 dropped:0 overruns:0 frame:2
          TX packets:238 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:4170 (4.0 KiB)  TX bytes:49053 (47.9 KiB)
          Interrupt:5

eth0.1    Link encap:Ethernet  HWaddr xx
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:48 errors:0 dropped:0 overruns:0 frame:0
          TX packets:102 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:3054 (2.9 KiB)  TX bytes:7740 (7.5 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:121 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:36796 (35.9 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:202 errors:0 dropped:0 overruns:0 frame:0
          TX packets:202 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:15584 (15.2 KiB)  TX bytes:15584 (15.2 KiB)

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?