mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Oleksij Rempel <o.rempel@pengutronix.de>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Heiner Kallweit <hkallweit1@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	kernel@pengutronix.de, linux-kernel@vger.kernel.org,
	Russell King <linux@armlinux.org.uk>,
	netdev@vger.kernel.org, Andre Edich <andre.edich@microchip.com>,
	Lukas Wunner <lukas@wunner.de>
Subject: Re: [PATCH net v2 2/3] net: phy: allow drivers to disable polling via get_next_update_time()
Date: Wed, 9 Jul 2025 17:23:23 +0200	[thread overview]
Message-ID: <aG6Ja_Y9JNKkEon6@pengutronix.de> (raw)
In-Reply-To: <e0b00f28-051e-4af6-afcb-7cdb5dc76549@lunn.ch>

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 |

  reply	other threads:[~2025-07-09 15:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-09 10:42 [PATCH net v2 0/3] net: phy: smsc: use IRQ + relaxed polling to fix missed link-up Oleksij Rempel
2025-07-09 10:42 ` [PATCH net v2 1/3] net: phy: enable polling when driver implements get_next_update_time Oleksij Rempel
2025-07-09 14:03   ` Andrew Lunn
2025-07-09 10:42 ` [PATCH net v2 2/3] net: phy: allow drivers to disable polling via get_next_update_time() Oleksij Rempel
2025-07-09 14:10   ` Andrew Lunn
2025-07-09 15:23     ` Oleksij Rempel [this message]
2025-07-09 10:42 ` [PATCH net v2 3/3] net: phy: smsc: recover missed link-up IRQs on LAN8700 with adaptive polling Oleksij Rempel

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=aG6Ja_Y9JNKkEon6@pengutronix.de \
    --to=o.rempel@pengutronix.de \
    --cc=andre.edich@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=lukas@wunner.de \
    --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®