[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e0b00f28-051e-4af6-afcb-7cdb5dc76549@lunn.ch>
Date: Wed, 9 Jul 2025 16:10:48 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Oleksij Rempel <o.rempel@...gutronix.de>
Cc: 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>,
kernel@...gutronix.de, linux-kernel@...r.kernel.org,
Russell King <linux@...linux.org.uk>, netdev@...r.kernel.org,
Andre Edich <andre.edich@...rochip.com>,
Lukas Wunner <lukas@...ner.de>
Subject: Re: [PATCH net v2 2/3] net: phy: allow drivers to disable polling
via get_next_update_time()
> /* Only re-schedule a PHY state machine change if we are polling the
> - * PHY, if PHY_MAC_INTERRUPT is set, then we will be moving
> - * between states from phy_mac_interrupt().
> + * PHY. If PHY_MAC_INTERRUPT is set or get_next_update_time() returns
> + * PHY_STATE_IRQ, then we rely on interrupts for state changes.
> *
> * In state PHY_HALTED the PHY gets suspended, so rescheduling the
> * state machine would be pointless and possibly error prone when
> * called from phy_disconnect() synchronously.
> */
> - if (phy_polling_mode(phydev) && phy_is_started(phydev))
> - phy_queue_state_machine(phydev,
> - phy_get_next_update_time(phydev));
> + if (phy_polling_mode(phydev) && phy_is_started(phydev)) {
> + unsigned int next_time = phy_get_next_update_time(phydev);
> +
> + /* Drivers returning PHY_STATE_IRQ opt out of polling.
> + * Use IRQ-only mode by not re-queuing the state machine.
> + */
> + if (next_time != PHY_STATE_IRQ)
> + phy_queue_state_machine(phydev, next_time);
> + }
How does this interact with update_stats()?
phy_polling_mode() returns true because the update_stats() op is
implemented. phy_get_next_update_time() returns PHY_STATE_IRQ, because
the PHY is in a state where interrupts works, and then the statistics
overflow.
It seems like this code needs to be somehow made part of
phy_polling_mode(), so that it has the full picture of why polling is
being used.
Andrew
---
pw-bot: cr
Powered by blists - more mailing lists