xvzf / zyxel-gpon-sfp

Telekom FTTH with OpenWRT/PfSense/VyOS/Mikrotik/... (Reverse engineering Zyxel PMG3000-D20B GPON SFP)
191 stars 26 forks source link

Is access to the web interface without fibre connection possible? #8

Closed frederictobiasc closed 2 years ago

frederictobiasc commented 2 years ago

Hi, I'm currently trying to set up the module in my pcengines APU6. Since I cannot access the web interface: Is this only possible when the SFP is physically connected to the GPON link?

ethtool reports the module correctly:

# ethtool enp1s0
Settings for enp1s0:
    Supported ports: [ FIBRE ]
    Supported link modes:   1000baseKX/Full
    Supported pause frame use: Symmetric
    Supports auto-negotiation: Yes
    Supported FEC modes: Not reported
    Advertised link modes:  1000baseKX/Full
    Advertised pause frame use: Symmetric
    Advertised auto-negotiation: Yes
    Advertised FEC modes: Not reported
    Speed: Unknown!
    Duplex: Unknown! (255)
    Auto-negotiation: on
    Port: FIBRE
    PHYAD: 0
    Transceiver: internal
    Supports Wake-on: pumbg
    Wake-on: g
        Current message level: 0x00000007 (7)
                               drv probe link
    Link detected: no
# ethtool -m enp1s0
    Identifier                                : 0x03 (SFP)
    Extended identifier                       : 0x04 (GBIC/SFP defined by 2-wire interface ID)
    Connector                                 : 0x01 (SC)
    Transceiver codes                         : 0x00 0x00 0x00 0x02 0x00 0x00 0x00 0x00 0x00
    Transceiver type                          : Ethernet: 1000BASE-LX
    Encoding                                  : 0x03 (NRZ)
    BR, Nominal                               : 1200MBd
    Rate identifier                           : 0x00 (unspecified)
    Length (SMF,km)                           : 20km
    Length (SMF)                              : 20000m
    Length (50um)                             : 0m
    Length (62.5um)                           : 0m
    Length (Copper)                           : 0m
    Length (OM3)                              : 0m
    Laser wavelength                          : 1310nm
    Vendor name                               : ZYXEL___________
    Vendor OUI                                : 00:00:00
    Vendor PN                                 : PMG3000-D20B____
    Vendor rev                                : V1.0
    Option values                             : 0x00 0x1a
    Option                                    : RX_LOS implemented
    Option                                    : TX_FAULT implemented
    Option                                    : TX_DISABLE implemented
    BR margin, max                            : 0%
    BR margin, min                            : 0%

But link is reported as DOWN:

#ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: enp1s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
    link/ether 00:0d:b9:5d:d2:e0 brd ff:ff:ff:ff:ff:ff
    inet 10.10.1.2/24 scope global enp1s0
       valid_lft forever preferred_lft forever
xvzf commented 2 years ago

On my module it is but I needed to hardcode the speed negotiation to 1G & manually bring the interface up

frederictobiasc commented 2 years ago

Hey, thanks for your response. Could you elaborate on what you mean by "hardcode the speed negotiation"? I also tried to turn off auto negotiation, set speed to 1000 & full duplex, but ethtool refuses to set that with an error message.

xvzf commented 2 years ago

exactly what you tried - can you post your error message here?

frederictobiasc commented 2 years ago

Yes, of course:

[istobic@rtr ~]$ sudo ethtool -s enp1s0 speed 1000 duplex full autoneg off
netlink error: link settings update failed
netlink error: Operation not supported
... change to root
[root@rtr ~]# ethtool -s enp1s0 autoneg off speed 1000 duplex full
netlink error: link settings update failed
netlink error: Operation not supported
[root@rtr ~]# ethtool -s enp1s0 autoneg off speed 100 duplex full
netlink error: link settings update failed
netlink error: Operation not supported
[root@rtr ~]# ethtool -s enp1s0 autoneg off speed 100 duplex half
netlink error: link settings update failed
netlink error: Operation not supported

I also tried bringing the interface down before with ip link set down enp1s0, but that does not change anything.

[root@rtr ~]# ethtool --version
ethtool version 5.16
[root@rtr ~]# uname -r
5.16.14-arch1-1
xvzf commented 2 years ago

@frederictobiasc what device are you running (e.g. NIC driver, linux kernel version, ...)? It's a bit weird you cannot set it

frederictobiasc commented 2 years ago

Hi @xvzf, I'm running on Linux 5.16.14 and I haven't installed an additional driver, so the Kernel IGB driver is used. The NIC is Intel i210IS (on PC Engines APU6B4). What hardware are you using? Do you have any idea what I can do to debug this?

frederictobiasc commented 2 years ago

Hi @xvzf, I tried the exact same command on different hardware, where it is executed without an error message. However I cannot access the GPON module there either. I think this is caused by the fact the device "lan28" is a shared port (RJ45 and SFP).

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

Do you have any hardware recommendation where hardwiring the settings work so that I can access the module without the GPON uplink?

frederictobiasc commented 2 years ago

Hi, I connected the GPON SFP to the fibre and then, auto negotiation succeeded. It seems, it depends on the hardware if you can hardwire the speed parameters for the SFP port. For me, it's not a big deal, since the module works perfectly on the APU6 once configured. Thanks for your help, @xvzf ! You can close this, if you want.

k0xak commented 2 years ago

Intel X520 + Zyxel SFP GPON --- ssh is working even without fibre connected.

piratensender commented 1 year ago

If the hardware do not support auto neg and the GPON Module is not reachable because it has no link, buy a ~18€ media converter TP Link MC220L - then you can brand using ssh everything or multiple GPONs. gpon

sodaws commented 1 year ago

Hi, I connected the GPON SFP to the fibre and then, auto negotiation succeeded. It seems, it depends on the hardware if you can hardwire the speed parameters for the SFP port. For me, it's not a big deal, since the module works perfectly on the APU6 once configured. Thanks for your help, @xvzf ! You can close this, if you want.

This is very interesting! I have a PCIe NIC which is based on the Intel i210IS just like your APU6 and I have seen the module also not working. However, I don't have FTTH yet, so I can't test whether it will work for me when I plug in a fibre.

But your oberservation has some implication. I won't go too much into detail but the Zyxel module should be using an SGMII interface for its PHY to talk to the i210 (see datasheet) . The i210 actually doesn't have universal support for this, except for some very specific PHYs and only when the module is inserted prior to driver initialisation. So I suspect this is the reason why it doesn't work out of the box.

This must mean that, as soon as a fibre is plugged in and a link to the OLT is established, the Zyxel's Lantiq SoC changes the communication mode of its integrated PHY (or the one that it is hooked up to) from SGMII to 1000BASE-X, presenting itself as a normal fibre SFP module to the i210, which makes it work.

This must also mean that there could be a way to change this mode from the module's shell. I haven't looked into it yet but I suspect the hal set speed x mode x only changes the advertised PHY capabilities over the MDIO or MDIO over I2C to the i210 and not the underlying communication mode, which the igb driver can't handle. When I enter hal set speed 1g mode full or hal set speed auto mode auto the module still cannot talk to the i210, so there must be some other setting. This functionality could also be part of a driver on the module....where my knowledge and skill ends.

@frederictobiasc what OS are you running on the APU6 and can you tell me the intel igb driver version that you are running?

sodaws commented 1 year ago

After digging through the filesystem and some menus, I found the potential config entry. @frederictobiasc could you ssh into the module in the connected state and run onu lan_port_cfg_get 0 and onu lan_port_status_get 0 ? An explanation of these values can be displayed with onu lan_port_cfg_get.

I want to see what happens, if I change the lan_mode_interface option (LAN_MODE_TBI_SERDES=14 seems interesting...) but it could cause me to lose ssh access to the module if I change to the wrong mode and it happens to be permanent. I would rather not have to solder onto serial...

I'm also trying to find out, if changing this setting with onu lan_port_cfg_set 0 xyzxyz survives a reboot. If this succeeds, it'd mean that we could be able to access the module without an active link on the fibre...could be helpful when debugging the connection.

3DJupp commented 8 months ago

Hey, is it possible to set the speed permanently? hal set speed 2.5g mode full won't be applied forever Butthere were similar issues with the serialnumber:

hal
sn ZYWNA1234567 (not persistent)
set sn ZYWNA1234567 (persistent)