From: "Rangoju, Raju" <raju.rangoju@amd.com>
To: Andrew Lunn <andrew@lunn.ch>, g@lunn.ch
Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, Shyam-sundar.S-k@amd.com
Subject: Re: [PATCH net] amd-xgbe: read link status twice to avoid inconsistencies
Date: Wed, 25 Jun 2025 15:12:33 +0530 [thread overview]
Message-ID: <ba3d6047-0edd-4830-a5c2-bd7af463b688@amd.com> (raw)
In-Reply-To: <acca227d-c2a9-4fc3-a6fc-3001472370a3@lunn.ch>
On 5/15/2025 5:37 AM, Andrew Lunn wrote:
> On Thu, May 15, 2025 at 01:11:45AM +0530, Raju Rangoju wrote:
>> The link status is latched low, so read the register twice to get the
>> current status and avoid link inconsistencies.
>>
>> As per IEEE 802.3 "Table 22-8 - Status register bit definitions"
>> 1.2 Link Status 1 = link is up 0 = link is down RO/LL
>>
>> Fixes: 4f3b20bfbb75 ("amd-xgbe: add support for rx-adaptation")
>> Signed-off-by: Raju Rangoju <Raju.Rangoju@amd.com>
>> ---
>> drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c | 4 ++++
>> 1 file changed, 4 insertions(+)
>>
>> diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
>> index 268399dfcf22..d233e3faa1a9 100644
>> --- a/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
>> +++ b/drivers/net/ethernet/amd/xgbe/xgbe-phy-v2.c
>> @@ -2914,6 +2914,10 @@ static int xgbe_phy_link_status(struct xgbe_prv_data *pdata, int *an_restart)
>> }
>>
>> /* check again for the link and adaptation status */
>> + /* Link status is latched low, so read once to clear
>> + * and then read again to get current state
>> + */
>> + reg = XMDIO_READ(pdata, MDIO_MMD_PCS, MDIO_STAT1);
>
>
> Since this is not a phylib user, i don't care too much, but:
>
> https://elixir.bootlin.com/linux/v6.14.6/source/drivers/net/phy/phy_device.c#L2514
>
> /* The link state is latched low so that momentary link
> * drops can be detected. Do not double-read the status
> * in polling mode to detect such short link drops except
> * the link was already down.
> */
>
> So you don't care about short link drops? You don't want to tell user
> space the link went away and came back? It never happened.
Thanks Andrew for point this out. I'll re-spin v2 addressing these.
>
> Andrew
prev parent reply other threads:[~2025-06-25 9:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-14 19:41 Raju Rangoju
2025-05-15 0:07 ` Andrew Lunn
2025-06-25 9:42 ` Rangoju, Raju [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ba3d6047-0edd-4830-a5c2-bd7af463b688@amd.com \
--to=raju.rangoju@amd.com \
--cc=Shyam-sundar.S-k@amd.com \
--cc=andrew+netdev@lunn.ch \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=g@lunn.ch \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®