Support for RTL838x based managed switches

Weird. The name and priority come directly from the config, so I can't see how that's messed up. What does your config file look like?

uh-oh. Hope you don't have to pay for that :slight_smile:

If it would help any, on my GS1900-8HP v1 (latest master, PoE PD on lan1, config here) yields this:

root@OpenWrt:~# realtek-poe -d
Failed to add object: Invalid argument
TX -> 0x20 0x01 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0x18

Hi @imaginator, I'm having exactly the same problem. I just flashed my DGS-1210-28 and with the vanilla config, it successfully works with IPv6. ARP seems to not be forwarded, so there is basically no IPv4 possible.

I'm running OpenWrt 21.02.2 r16495-bf0c965af0 / Linux 5.4.179

However, I noticed, when I reassign some ports (1-9) to VLAN 100, everything works and the switch can be used at least as a switch.

The second thing I noticed: When I connect a port of each VLAN (1 and 100) of the switch to my home network (with DHCP, etc.) there seem to be some loop created, because lights start flickering fast and Wireshark displays lots of ICMP Neighbor Advertisements.

A few posts above I read about VLAN1 being enabled on all ports, but that seems to has been fixed in #4323.

Is there anything I can do to help debugging this?

Config where switching between 1-9 works:

root@OpenWrt:~# cat /etc/config/network
config interface 'loopback'
	option device 'lo'
	option proto 'static'
	option ipaddr '127.0.0.1'
	option netmask '255.0.0.0'

config globals 'globals'
	option ula_prefix 'fd9f:ebb2:1abf::/48'

config device 'switch'
	option name 'switch'
	option type 'bridge'
	option macaddr 'bc:22:28:7a:21:40'
	list ports 'lan1'
	list ports 'lan10'
	list ports 'lan11'
	list ports 'lan12'
	list ports 'lan13'
	list ports 'lan14'
	list ports 'lan15'
	list ports 'lan16'
	list ports 'lan17'
	list ports 'lan18'
	list ports 'lan19'
	list ports 'lan2'
	list ports 'lan20'
	list ports 'lan21'
	list ports 'lan22'
	list ports 'lan23'
	list ports 'lan24'
	list ports 'lan25'
	list ports 'lan26'
	list ports 'lan27'
	list ports 'lan28'
	list ports 'lan3'
	list ports 'lan4'
	list ports 'lan5'
	list ports 'lan6'
	list ports 'lan7'
	list ports 'lan8'
	list ports 'lan9'
#	option ipv6 '0'
#	option sendredirects '0'
#	option multicast '0'

config bridge-vlan 'wan_vlan'
	option device 'switch'
	option vlan '1'
#	list ports 'lan3'
#	list ports 'lan4'
#	list ports 'lan6'
#	list ports 'lan7'
#	list ports 'lan8'
#	list ports 'lan9'
	list ports 'lan10'
	list ports 'lan11'
	list ports 'lan12'
	list ports 'lan13'
	list ports 'lan14'
	list ports 'lan15'
	list ports 'lan16'
	list ports 'lan17'
	list ports 'lan18'
	list ports 'lan19'
	list ports 'lan20'
	list ports 'lan21'
	list ports 'lan22'
	list ports 'lan23'
	list ports 'lan24'
	list ports 'lan25'
	list ports 'lan26'
	list ports 'lan27'
	list ports 'lan28'

config device
	option name 'switch.1'
	option macaddr 'bc:22:23:7a:21:40'

config bridge-vlan 'lan_vlan'
	option device 'switch'
	option vlan '100'
	list ports 'lan1:t'
	list ports 'lan2'
        list ports 'lan3'
        list ports 'lan4'
        list ports 'lan5'
        list ports 'lan6'
        list ports 'lan7'
        list ports 'lan8'
        list ports 'lan9'

config device
	option name 'switch.100'
	option macaddr 'be:22:28:7a:21:40'

config interface 'lan'
	option device 'switch.100'
	option proto 'dhcp'
#	option delegate '0'

Hi, using today's snapshot, the described issue with VLAN is solved. Seems I had a misconception which commits have landed in the last release.
However, I would like to suggest some modification to the device page of https://openwrt.org/toh/hwdata/d-link/d-link_dgs-1210-28. I was living under the assumption, that the device support has already 'production quality'. Sorry.

Have you tried the snapshot, @imaginator ?

Rather than suggesting modifications, why not make the modifications yourself? That's what a wiki is for!

Hi @RaylynnKnight,

unfortunately, I cannot change the commit message, linked as "Supported Since Commit" on this ToH page, which is in my opinion misleading:

To install, upload the sysupgrade image to the OEM webpage or sysupgrade
from the system running from initramfs image.

It has been developed and tested on device with F1 revision.

It is simply not true. The OEM web interface does not accept the current release or snapshot. Installation via serial console + tftp is necessary.
For the dgs-1210-28 it seems that the same information regarding installation are true as for the dgs-1210-16

What do you think of simply linking the wiki page of dgs-1210-16 for the time being and later move the information to a more generic page for the dgs-1210 series?

Btw: I'm running the switch on snapshot and deployed the switch in a production environment. Apart from small limitations regarding VLAN, it runs absolutely great since the installation four days ago.
Thank you all for the great work!

1 Like

Does installation from OEM work if you flash the initramfs image through the OEM web UI, then boot from the initramfs image, and run sysupgrade after that?

I tried sysupgrade and initramfs from both release and snapshot, but none of them is accepted.

The commit message is misleading and I believe the misleading part occurred because of copy/paste from another commit.

Boot initramfs image from U-Boot

  1. Press Escape key during Hit Esc key to stop autoboot prompt
  2. Press CTRL+C keys to get into real U-Boot prompt
  3. Init network with rtk network on command
  4. Load image with tftpboot 0x8f000000 openwrt-rtl838x-generic-d-link_dgs-1210-28-initramfs->kernel.bin command
  5. Boot the image with bootm command

To install, upload the sysupgrade image to the OEM webpage or sysupgrade
from the system running from initramfs image.

Note that the first line of the instructions is "Boot initramfs image from U-Boot". I think the last sentence was copy/pasted and not edited to remove the OEM webpage which as far as I know has never worked on the D-Link switches.

3 Likes

Has anybody tried using the SFPs yet? My SFP was not displayed using ethtool.

The SFPs are combo ports on this switch, aren't they? What does ethtool lanXX show for one of them? Can you select the FIBRE port instead of TP or MII or whatever it defaults to?

Something like

ethtool -s lanXX port fibre

Discalimer: I have no idea if any of the required phy support is actually there....

I think there is only one PHY (RTL8214FC) that supports these combo ports and this is supported. However we do not provide the necessary I2C access in order to read out the EEPROMS. I also do not know what exactly the limitations are in the kernel support if I2C is not available. I have the impression that things just seem to work, though.

The issue with I2C is due to the fact that on the RTL83xx platforms I2C is bit-banged and the Clock-line is shared between the SFP ports. The linux i2c-gpio driver does not support this. Otherwise it would be quite simple to set this up in the .dts after figuring out the GPIOs either through the "show tech-support" command or by probing the lines in the SFP modules.

1 Like

Haven’t tried it my self yet but as far as I can remember this subject about SFP has been up in this tread earlier.
If I recall right they are not hot pluggable so you need to connect the module and power on the switch. But you can connect the fiber or cable during operational drift. But not change the SFP module.

1 Like

I tested both SFP ports on the NETGEAR GS310T with both Fiber and Copper modules before sending the pull request. Have been side-tracked with other work, but will be resuming adding support for devices I have soon.

2 Likes

Hi @bmork and thanks for the suggestion. I was successfully able to set the configuration on the interface. Unfortunately it seems the configuration only applies to the TP port (see below). I could not test if it works, since my GPON SFP only provides auto negotiation when plugged into the fibre uplink. And currently I have no access to the uplink.

root@sw-doris:~# ethtool -s lan28 port fibre speed 1000 duplex full autoneg off
root@sw-doris:~# ethtool lan28
Settings for lan28:
	Supported ports: [ TP MII FIBRE ]
	Supported link modes:   10baseT/Half 10baseT/Full
	                        100baseT/Half 100baseT/Full
	                        1000baseT/Half 1000baseT/Full
	Supported pause frame use: Symmetric Receive-only
	Supports auto-negotiation: Yes
	Supported FEC modes: Not reported
	Advertised link modes:  1000baseT/Full
	Advertised pause frame use: Symmetric Receive-only
	Advertised auto-negotiation: No
	Advertised FEC modes: Not reported
	Speed: 1000Mb/s
	Duplex: Full
	Port: Twisted Pair
	PHYAD: 27
	Transceiver: external
	Auto-negotiation: off
	MDI-X: Unknown
	Supports Wake-on: d
	Wake-on: d
	Link detected: no

I tried setting up the correct IP address anyway, but I get no connection.

I don't know if this was meant only in the D-Link DGS-1210-28 specific context?

But this is certainly not true for the realtek target as such. There can of course be device specific exceptions, as the SFP slot implementations vary. I have no first hand experience with any devices with shared i2c clocks or multiplexing phys.

But what I can say is that the SFP slots on the ZyXEL GS1900-10HP are fully functional. This includes hot plug, eeprom access (including DOM), as well as auto-neg, fixed speed (10/100/1000) and duplex for copper SFPs. Which means that the OpenWrt feature set is more complete than the OEM feature set.

2 Likes

Do you have any idea why changing from TP to Fibre doesn't work? Am I doing something wrong?

DGS-1210-28 has non-working SFP-s because the SFP buses are not described and attached in the DTS at all.

1 Like

Hi, let me be a bit more specific. The GS 1900-10HP has the I2C busses for EEPROMS on the SFP modules desribed in the .dts. This enables features like hot plugging, reading out the EEPROMS, handling of Loss of signal and disabling the LEDs when not active. The kernel also knows what type of module is used such as SX, LX and the like and can adjust accordingly. This is not strictly necessary, to make SFP work. Some devices don't have the I2C bus described, either because of the gpiolib limitations or because the GPIOs are not known. Many things still work. I am just now developing on a Netgear GS728TPv2 and while I can have support for I2C on 2 out of the 4 ports (the other 2 share the clock lines with the first 2 ports), I have 1GBit copper and 1GBit SX modules happily working in any of these slots, however no hotplugging and no link adjustments other than what autoconf provides. So the SFP slots work with some basic functionality even without I2C bus support.

If you want to get the I2C busses working, then it is easiest if the OEM firmware supports the "show tech-support" command which will show the complete GPIO configuration of the SFP ports. Just add this to the .dts and that's it. If this command is not available, one needs a modified SFP module which allows to measure continuity between its interface pins and the pins of typically the RTL8231 GPIO expander it connects to.

That's all understood, the GPIO pins and I2C pins are known for 2 of the 4 SFP ports and with them, it will work fine.
For me, I count SFP ports not working properly if there is no way to automatically toggle the PHY mode based on the plugged SFP and for that you always need the SFP bus described with GPIO-s as well so that PHYLINK can be used

The other 2 need to be traced manually as there is no "show tech-support" or similar in D-Link FW

1 Like