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: <aG6Ja_Y9JNKkEon6@pengutronix.de>
Date: Wed, 9 Jul 2025 17:23:23 +0200
From: Oleksij Rempel <o.rempel@...gutronix.de>
To: Andrew Lunn <andrew@...n.ch>
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()

On Wed, Jul 09, 2025 at 04:10:48PM +0200, Andrew Lunn wrote:
> >  	/* 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.

Ah, good point! I forgot about it.

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ