git: ef3c76fd2030 - main - mii: call only PHY_STATUS() from mii_pollstat()

From: Gleb Smirnoff <glebius_at_FreeBSD.org>
Date: Thu, 19 Nov 2026 22:54:53 UTC
The branch main has been updated by glebius:

URL: https://cgit.FreeBSD.org/src/commit/?id=ef3c76fd2030a4c7d0f9c981b7129595398e3f21

commit ef3c76fd2030a4c7d0f9c981b7129595398e3f21
Author:     Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2026-11-19 21:58:02 +0000
Commit:     Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2026-11-19 22:54:43 +0000

    mii: call only PHY_STATUS() from mii_pollstat()
    
    When we are in mii_pollstat() which effectively is called only from
    ue_mii_sts methods of various drivers, we are interested in polling the
    status and not making any actions.
    
    What PHY_SERVICE(,, MII_POLLSTAT) effectively did was PHY_STATUS()
    followed by mii_phy_update().  The latter is undesired, as we already may
    be servicing a link state change event and posting a second one is not
    what we want.  Usually mostly harmless, this second event would panic when
    device is calling into mii during its detach (e.g. USB device).
    
    NB: there are few drivers that would do extra stuff between PHY_STATUS()
    and mii_phy_update() in their mii_service methods. This seems irrelevant
    to me when we are in ue_mii_stat/mii_pollstat. But I could be wrong.
    
    See the PR for longer discussion.
    
    PR:             290417
---
 sys/dev/mii/mii.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/dev/mii/mii.c b/sys/dev/mii/mii.c
index b63bfb6285bb..00bffe4dc546 100644
--- a/sys/dev/mii/mii.c
+++ b/sys/dev/mii/mii.c
@@ -613,7 +613,7 @@ mii_pollstat(struct mii_data *mii)
 		 */
 		if (IFM_INST(ife->ifm_media) != child->mii_inst)
 			continue;
-		(void)PHY_SERVICE(child, mii, MII_POLLSTAT);
+		PHY_STATUS(child);
 	}
 }