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: <ef471e23-e0e2-4e7b-91a7-c56569e526dd@amd.com>
Date: Tue, 1 Jul 2025 12:12:21 +0530
From: "Rangoju, Raju" <raju.rangoju@....com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: andrew+netdev@...n.ch, davem@...emloft.net, edumazet@...gle.com,
 pabeni@...hat.com, netdev@...r.kernel.org, Shyam-sundar.S-k@....com
Subject: Re: [PATCH net v2] amd-xgbe: do not double read link status



On 7/1/2025 6:42 AM, Jakub Kicinski wrote:
> On Wed, 25 Jun 2025 15:23:15 +0530 Raju Rangoju wrote:
>> The link status is latched low so that momentary link drops
>> can be detected. Avoid double-reading the status to identify
>> short link interruptions, unless the link was already down.
> 
> Took me a minute to understand this. How about:
> 
> The link status is latched low so that momentary link drops
> can be detected. Always double-reading the status defeats this
> design feature. Only double read if link was already down.

Sounds good, I'll update commit message accordingly.

> 
>> -	reg = XMDIO_READ(pdata, MDIO_MMD_PCS, MDIO_STAT1);
>> -	reg = XMDIO_READ(pdata, MDIO_MMD_PCS, MDIO_STAT1);
>> +	if (!pdata->phy.link) {
>> +		reg = XMDIO_READ(pdata, MDIO_MMD_PCS, MDIO_STAT1);
>> +		if (reg < 0)
>> +			return reg;
>> +
>> +		if (reg & MDIO_STAT1_LSTATUS)
>> +			goto skip_read;
>> +	}
>>   
>> +	reg = XMDIO_READ(pdata, MDIO_MMD_PCS, MDIO_STAT1);
>> +	if (reg < 0)
>> +		return reg;
>> +skip_read:
>>   	if (pdata->en_rx_adap) {
>>   		/* if the link is available and adaptation is done,
>>   		 * declare link up
> 
> Don't use gotos for normal function control flow :/

Sure. I'll re-spin v3 with the suggested changes.

> 
> 	reg = XMDIO_READ(pdata, MDIO_MMD_PCS, MDIO_STAT1);
> 	if (reg < 0)
> 		return reg;
> 	/* Link status is latched low so that momentary link drops
> 	 * can be detected. If link was already down read again
> 	 * to get the latest state.
>   	 */
> 	if (!pdata->phy.link && !(reg & MDIO_STAT1_LSTATUS)) {
>   		reg = XMDIO_READ(pdata, MDIO_MMD_PCS, MDIO_STAT1);
> 		if (reg < 0)
> 			return reg;
> 	}
> 
> 	if (pdata->en_rx_adap) {
>   		/* if the link is available and adaptation is done,


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ