lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Tue, 29 Aug 2023 17:12:48 +0200
From: Nicolò Veronese <nicveronese@...il.com>
To: netdev@...r.kernel.org
Cc: simonebortolin@...k-gpon.org, nanomad@...k-gpon.org, 
	Federico Cappon <dududede371@...il.com>, daniel@...rotopia.org, lorenzo@...nel.org, 
	ftp21@...21.eu, pierto88@...k-gpon.org, hitech95@...k-gpon.org, 
	davem@...emloft.net, andrew@...n.ch, edumazet@...gle.com, 
	hkallweit1@...il.com, kuba@...nel.org, pabeni@...hat.com, 
	linux@...linux.org.uk, nbd@....name
Subject: [RFC] RJ45 to SFP auto-sensing and switching in mux-ed single-mac
 devices (XOR RJ/SFP)

Hi,

I and some folks in CC are working to properly port all the
 functions of a Zyxel ex5601-t0 to OpenWrt.

The manufacturer decided to use a single SerDes connected
 to both an SPF cage and an RJ45 phy. A simple GPIO is
 used to control a 2 Channel 2:1 MUX to switch the two SGMII pairs
 between the RJ45 and the SFP.

  ┌─────┐  ┌──────┐   ┌─────────┐
  │     │  │      │   │         │
  │     │  │      ├───┤ SFP     │
  │     │  │      │   └─────────┘
  │     │  │      │
  │ MAC ├──┤ MUX  │   ┌─────────┐
  │     │  │      │   │         │
  │     │  │      │   │ RJ45    │
  │     │  │      ├───┤ 2.5G PHY│
  │     │  │      │   │         │
  └─────┘  └───▲──┘   └─────────┘
               │
  MUX-GPIO ────┘

Other vendors may implement this differently (e.g. Keenetic
 KN-1011 has a similar setup, although the PHY is doing all the work),
 but this seems a common enough approach to produce cheap CPEs
 with multiple interface types for fiber internet.

In this particular case, Zyxel implemented a user-land script[1] that is
 continuously polling GPIO 57 (Moddef0) of the SFP cage.

Once an SFP module is detected the process continues as follows:
- An MDIO command disables the RJ45 PHY
- A GPIO write to GPIO 10 that switches the MUX to the SFP interface
- The MAC is then re-configured by writing directly to the SoC registers
 using a mix of lookup tables and heuristics/try-catch.

This allows Zyxel to configure the MAC with the supposedly correct SFP
 interface speed, bypassing any well-established interface speed
 auto-detection and negotiation logic.

Zyxel also configures the GMAC at boot with a fixed speed of 2500M
 forcing the link status to be always up irrespective of the real
 physical interface status.

On SFP disconnect the process is simply applied in reverse.

We are looking for guidance on how to design changes that could achieve
 the following goals and could be accepted upstream in the future:

 - SFP and RJ45 speed auto-sensing and auto-negotiation working
 - Automatic SFP/RJ45 switching
 - Failsafe logic in case both media are connected.
 - Reduce overall potential power consumption and rate-adaption by not
   having the GMAC always switched to 2500M mode without reason.
 - (optional) default configurable logic for both failsafe and idle status

References:
[1]: https://github.com/pameruoso/zyxel-ex5601t0/blob/V5.70(ACDZ.0)C0/target/linux/mediatek/ex5601t0/base-files/bin/sfp_wan.sh

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ