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: <Z9haewIdFv4bed3H@a98shuttle.de>
Date: Mon, 17 Mar 2025 18:23:07 +0100
From: Michael Klein <michael@...sekall.de>
To: "Russell King (Oracle)" <linux@...linux.org.uk>
Cc: Andrew Lunn <andrew@...n.ch>, Heiner Kallweit <hkallweit1@...il.com>,
	"David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
	netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [net-next,v3,2/2] net: phy: realtek: Add support for PHY LEDs on
 RTL8211E

Thank you for your insights,

On Mon, Mar 17, 2025 at 11:15:11AM +0000, Russell King (Oracle) wrote:
>On Sun, Mar 16, 2025 at 01:14:23PM +0100, Michael Klein wrote:
>> +static int rtl8211e_led_hw_control_get(struct phy_device *phydev, u8 index,
>> +				       unsigned long *rules)
>> +{
>> +	int ret;
>> +	u16 cr1, cr2;
>> +
>> +	if (index >= RTL8211x_LED_COUNT)
>> +		return -EINVAL;
>> +
>> +	ret = rtl8211e_read_ext_page(phydev, RTL8211E_LEDCR_EXT_PAGE,
>> +				     RTL8211E_LEDCR1);
>> +	if (ret < 0)
>> +		return ret;
>> +
>> +	cr1 = ret >> RTL8211E_LEDCR1_SHIFT * index;
>> +	if (cr1 & RTL8211E_LEDCR1_ACT_TXRX) {
>> +		set_bit(TRIGGER_NETDEV_RX, rules);
>> +		set_bit(TRIGGER_NETDEV_TX, rules);
>> +	}
>> +
>> +	ret = rtl8211e_read_ext_page(phydev, RTL8211E_LEDCR_EXT_PAGE,
>> +				     RTL8211E_LEDCR2);
>> +	if (ret < 0)
>> +		return ret;
>> +
>> +	cr2 = ret >> RTL8211E_LEDCR2_SHIFT * index;
>> +	if (cr2 & RTL8211E_LEDCR2_LINK_10)
>> +		set_bit(TRIGGER_NETDEV_LINK_10, rules);
>> +
>> +	if (cr2 & RTL8211E_LEDCR2_LINK_100)
>> +		set_bit(TRIGGER_NETDEV_LINK_100, rules);
>> +
>> +	if (cr2 & RTL8211E_LEDCR2_LINK_1000)
>> +		set_bit(TRIGGER_NETDEV_LINK_1000, rules);
>
>Do you need these set_bit()s to be a heavy-weight atomic operation, or
>will __set_bit() being its lighter-weight non-atomic version be better?

I don't think this needs to be atomic at all, as the phydev lock is held 
by the one and only caller (phy_led_hw_control_get()).

rtl8211f_led_hw_control_get() also uses set_bit(). Should I change those 
also to __set_bit() in a separate patch while I'm at it?

-- 
Michael

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ