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] [day] [month] [year] [list]
Message-ID: <02e3afc5-fccf-4a1b-83ad-7a790a5dbd56@gmail.com>
Date: Tue, 5 Nov 2024 23:50:07 +0100
From: Heiner Kallweit <hkallweit1@...il.com>
To: Andrew Lunn <andrew@...n.ch>
Cc: Realtek linux nic maintainers <nic_swsd@...ltek.com>,
 Andrew Lunn <andrew+netdev@...n.ch>, Paolo Abeni <pabeni@...hat.com>,
 Jakub Kicinski <kuba@...nel.org>, David Miller <davem@...emloft.net>,
 Eric Dumazet <edumazet@...gle.com>,
 "netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: [PATCH net-next] r8169: copy vendor driver 2.5G/5G EEE
 advertisement constraints

On 05.11.2024 22:06, Andrew Lunn wrote:
> On Mon, Nov 04, 2024 at 11:07:20PM +0100, Heiner Kallweit wrote:
>> Vendor driver r8125 doesn't advertise 2.5G EEE on RTL8125A, and r8126
>> doesn't advertise 5G EEE. Likely there are compatibility issues,
>> therefore do the same in r8169.
>> With this change we don't have to disable 2.5G EEE advertisement in
>> rtl8125a_config_eee_phy() any longer.
>> Note: We don't remove the potentially problematic modes from the
>> supported modes, so users can re-enable advertisement of these modes
>> if they work fine in their setup.
>>
>> Signed-off-by: Heiner Kallweit <hkallweit1@...il.com>
>> ---
>>  drivers/net/ethernet/realtek/r8169_main.c       |  7 +++++++
>>  drivers/net/ethernet/realtek/r8169_phy_config.c | 16 ++++------------
>>  2 files changed, 11 insertions(+), 12 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c
>> index e83c4841b..4f37d25e0 100644
>> --- a/drivers/net/ethernet/realtek/r8169_main.c
>> +++ b/drivers/net/ethernet/realtek/r8169_main.c
>> @@ -5318,6 +5318,13 @@ static int r8169_mdio_register(struct rtl8169_private *tp)
>>  		phy_support_eee(tp->phydev);
>>  	phy_support_asym_pause(tp->phydev);
>>  
>> +	/* mimic behavior of r8125/r8126 vendor drivers */
>> +	if (tp->mac_version == RTL_GIGA_MAC_VER_61)
>> +		linkmode_clear_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT,
>> +				   tp->phydev->advertising_eee);
>> +	linkmode_clear_bit(ETHTOOL_LINK_MODE_5000baseT_Full_BIT,
>> +			   tp->phydev->advertising_eee);
> 
> Hi Heiner
> 
> phy_device.c has:
> 
> /**
>  * phy_remove_link_mode - Remove a supported link mode
>  * @phydev: phy_device structure to remove link mode from
>  * @link_mode: Link mode to be removed
>  *
>  * Description: Some MACs don't support all link modes which the PHY
>  * does.  e.g. a 1G MAC often does not support 1000Half. Add a helper
>  * to remove a link mode.
>  */
> void phy_remove_link_mode(struct phy_device *phydev, u32 link_mode)
> {
>         linkmode_clear_bit(link_mode, phydev->supported);
>         phy_advertise_supported(phydev);
> }
> EXPORT_SYMBOL(phy_remove_link_mode);
> 
> Maybe we need a phy_remove_eee_link_mode()? That could also remove it
> from supported? At minimum, it would stop MAC drivers poking around
> the insides of phylib.
> 
I just do it in the MAC driver because PHY drivers don't have a good
place to initially disable a certain (EEE) mode.
Modifying the advertisement register in get_features(), so that
genphy_c45_read_eee_adv() reads the desired advertisement, would be
somewhat hacky.
My use case "remove a mode from advertisement initially, but keep it
in supported modes, so that user can re-enable it" isn't really supported
as of today. Of course we could add a simple setter like

void phy_remove_eee_mode_from_advertising(struct phy_device *phydev, u32 link_mode)
{
	linkmode_clear_bit(link_mode, phydev->advertising_eee);
}

But would this be worth it?

> 	Andrew

Heiner


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ