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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <788b01dbe016$b92c4470$2b84cd50$@gmx.de>
Date: Wed, 18 Jun 2025 08:03:25 +0200
From: <markus.stockhausen@....de>
To: "'Andrew Lunn'" <andrew@...n.ch>,
	<Chris.Packham@...iedtelesis.co.nz>
Cc: <hkallweit1@...il.com>,
	<linux@...linux.org.uk>,
	<davem@...emloft.net>,
	<edumazet@...gle.com>,
	<kuba@...nel.org>,
	<pabeni@...hat.com>,
	<michael@...sekall.de>,
	<daniel@...rotopia.org>,
	<netdev@...r.kernel.org>
Subject: AW: [PATCH] net: phy: realtek: convert RTL8226-CG to c45 only

> Von: Andrew Lunn <andrew@...n.ch> 
> Gesendet: Dienstag, 17. Juni 2025 17:36
> An: Markus Stockhausen <markus.stockhausen@....de>
> Betreff: Re: [PATCH] net: phy: realtek: convert RTL8226-CG to c45 only
> 
> On Tue, Jun 17, 2025 at 11:01:47AM -0400, Markus Stockhausen wrote:
> > The RTL8226-CG can be found on devices like the Zyxel XGS1210-12. These
> > are driven by a RTL9302B SoC that has active phy hardware polling in
> > the background.
> 
> It would be a lot better to just turn that polling off.

This is our challenge:
https://elixir.bootlin.com/linux/v6.16-rc2/source/drivers/net/mdio/mdio-real
tek-rtl9300.c#L366

>
> > As soon as this is active and set to c45 most c22
> > register accesses are blocked and will stop working. Convert the
> > phy to a c45-only function set.
> > 
> > For documentation purposes some register extracts that where taken to
> > verify proper detection.
>
> Please could you show us the output from ethtool before/after.
>
> >  		PHY_ID_MATCH_EXACT(0x001cc838),
> >  		.name           = "RTL8226-CG 2.5Gbps PHY",
> > -		.get_features   = rtl822x_get_features,
>
> You can see this calls genphy_read_abilities(phydev) at the end, so
> reading information about 10/100/1G speeds, using the standard C22
> registers.
>
> > -		.config_aneg    = rtl822x_config_aneg,
> > -		.read_status    = rtl822x_read_status,
> > -		.suspend        = genphy_suspend,
> > -		.resume         = rtlgen_resume,
> > +		.soft_reset     = rtl822x_c45_soft_reset,
> > +		.get_features   = rtl822x_c45_get_features,
>
> This only calls genphy_c45_pma_read_abilities(). So i expect 10/100/1G
> is missing.

I had to patch the mdio driver to make the existing RTL8226 phy driver work
with
It. So whenever a c22 command is sent it will toggle the protocol. I do not
believe
that this is what it was designed for but maybe Chris has some more
experience.

Output with patched bus:

[   49.552627] toggle bus 1 from c45 to c22 to read port 24 page 0 register
1
[   49.560663] toggle bus 1 from c22 to c45
...
# ethtool lan9 
Settings for lan9:
        Supported ports: [ TP MII ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full
                                2500baseT/Full
        Supported pause frame use: Symmetric Receive-only
        Supports auto-negotiation: Yes
        Supported FEC modes: Not reported
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full
                                2500baseT/Full
        Advertised pause frame use: Symmetric Receive-only
        Advertised auto-negotiation: Yes
        Advertised FEC modes: Not reported
        Speed: Unknown!
        Duplex: Unknown! (255)
        Port: Twisted Pair
        PHYAD: 24
        Transceiver: external
        Auto-negotiation: on
        MDI-X: Unknown
        Supports Wake-on: d
        Wake-on: d
        Link detected: no

The RTL8226 seems to support proper MDIO_PMA_EXTABLE flags.
So genphy_c45_pma_read_abilities() can conveniently call
genphy_c45_pma_read_ext_abilities() and 10/100/1000 is 
populated right.

Outputs with patched driver:

# ethtool lan9
Settings for lan9:
        Supported ports: [ TP ]
        Supported link modes:   10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full
                                2500baseT/Full
        Supported pause frame use: Symmetric Receive-only
        Supports auto-negotiation: Yes
        Supported FEC modes: Not reported
        Advertised link modes:  10baseT/Half 10baseT/Full
                                100baseT/Half 100baseT/Full
                                1000baseT/Full
                                2500baseT/Full
        Advertised pause frame use: Symmetric Receive-only
        Advertised auto-negotiation: Yes
        Advertised FEC modes: Not reported
        Speed: Unknown!
        Duplex: Unknown! (255)
        Port: Twisted Pair
        PHYAD: 24
        Transceiver: external
        Auto-negotiation: on
        MDI-X: Unknown
        Supports Wake-on: d
        Wake-on: d
        Link detected: no

Markus


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ