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-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7f460a37-d6f5-603f-2a6c-c65bae56f76b@gmail.com>
Date:   Thu, 8 Dec 2022 22:35:43 +0100
From:   Heiner Kallweit <hkallweit1@...il.com>
To:     Hau <hau@...ltek.com>
Cc:     "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        nic_swsd <nic_swsd@...ltek.com>, Andrew Lunn <andrew@...n.ch>
Subject: Re: [PATCH net-next v5] r8169: add support for rtl8168h(revid 0x2a) +
 rtl8211fs fiber application

On 08.12.2022 16:59, Hau wrote:
>> On 07.12.2022 18:43, Hau wrote:
>>>>
>>>> On 01.12.2022 15:39, Chunhao Lin wrote:
>>>>> rtl8168h(revid 0x2a) + rtl8211fs is for utp to fiber application.
>>>>> rtl8168h is connected to rtl8211fs utp interface. And fiber is
>>>>> connected to rtl8211fs sfp interface. rtl8168h use its eeprm or gpo
>>>>> pins to control rtl8211fs mdio bus.
>>>>>
>>>>
>>>> I found a datasheet for RTL8211FS and it doesn't mention SFP support.
>>>> For the fiber use case it mentions RGMII for MAC/PHY connection and
>>>> SerDes for connecting the PHY to the fiber module. Is this the mode
>>>> you'd like to support?
>>>> "utp to fiber" sounds like the media converter application, and I
>>>> think that's not what we want here. So it's misleading.
>>> This application is not listed in datasheet. But it is similar to utp to fiber
>> application. Fiber connects to rtl8211fs through SerDes interface.
>>> rtl8168h connects to rtl8211fs through mdi interface. rtl8168h also
>>> connects to rtl8211fs mdc/mdio interface through its eeprom or gpo pins
>> for controlling rtl8211fs. The link between rtl8211fs and fiber, and the link
>> between rtl8211fs and rtl8168h should be the same.
>>>  Driver just needs to set the link capability of rtl8168h to auto negation and
>> rtl8211fs will propagate the link status between fiber and itself to rtl8168h.
>>> But rtl8168h will not know the link capability of fiber. So when system
>> suspend, if wol is enabled, driver cannot speed down rtl8168h's phy.
>>> Or rtl8168h cannot be waken up.
>>>
>>> I will submit a new patch according your advice. But we are considering not
>> to use driver(r8169) to setup rtl8211fs. So next patch maybe simpler.
>>>
>>
>> Sounds strange that RTL8168H connects to RTL8211FS via MDI. Typically you
>> would use RGMII here.
>> Is it because RTL8168H has no pins for RGMII to external PHY's?
>>
>> Then my understanding would be that you do it like this:
>> RTL8168H MAC -> <internal RGMII> -> RTL8168H PHY -> <MDI> -> RTL8211FS -
>>> <SerDes> -> Fiber module
>>    |                                                             |
>>     -------------------bit-banged MDIO---------------------------
>>
>> Sou you would need to control both PHY's, right? Because setup wouldn't
>> work if e.g. RTL8168H-internal PHY is powered down.
>> Is the RTL8211FS interrupt pin connected to RTL8168H? Or has polling to be
>> used to get the status from RTL8211FS?
>>
> rtl8168H is an integrated Ethernet controller, it contains MAC and PHY. It has no RGMII interface to connect to external PHY.
> In this application, driver r8169 controls two PHY. One is rtl8168h's PHY, another PHY is rtl8211fs.
> What r8169 have to do is to enable all link capability. rtl8211fs firmware will propagate fiber's link status to rtl8168h. 
> rtl8168h will know the fiber's link status from its MAC register 0x6c. This the same as before. So rtl8211fs's interrupt pin 
> will not connect to rtl8168h. And rtl8168h does not have to polling the link status of rtl8211fs.
> 
> RTL8168H MAC -> <internal RGMII> -> RTL8168H PHY -> <MDI> -> RTL8211FS -> <SerDes> -> Fiber module
>    |                                                                                                                                    |
>     -------------------bit-banged MDIO(use eeprom or gpo pin)--------------------
> 
> Because rtl8211fs's firmware will set link capability to 100M and GIGA when fiber link is from off to on..
> So when system suspend, if wol is enabled, rtl8168h will speed down to 100M(because rtl8211fs advertise 100M and giga to rtl8168h).

Can't you disable 100M advertising in RTL8211FS using the standard PHY advertisement register?
This would be more straight-forward and the hack to disable speed-down isn't needed in r8169.
The described firmware behavior to enable 100M advertisement even with 1Gbps speed on fiber side
doesn't seem to make sense.

> The link speed between rtl8168h and fiber will mismatch. That will cause wol fail.
> 
> And in the application, we also need to setup rtl8211fs. Or it may always link down.
> 
>  ------Please consider the environment before printing this e-mail.

OK, I think I get a better idea of your setup.
So it seems RTL8211FS indeed acts as media converter. Link status on MDI side of RTL8211FS reflects link status on fiber/serdes side.
RTL8168H PHY has no idea whether it's connected to RJ45 magnetics or to the MDI side of a RTL8211FS.

I think for configuring RTL8211FS you have two options:
1. Extend the Realtek PHY driver to support RTL8211FS fiber mode
2. Configure RTL8211FS from userspace (phytool, mii-tool, ..). However to be able to do this you may need to add a dummy netdevice
   that RTL8211FS is attached to. When going with this option it may be better to avoid phylib taking control of RTL8211FS.
   This can be done by setting the phy_mask of the bit-banged mii_bus.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ