Re: [PATCH net v2 2/6] net: stmmac: selftests: Validate EEE based on the actual LPI timer value

From
Maxime Chevallier <maxime.chevallier@bootlin.com>
Date
2026-09-10 20:52:53
Also in
linux-arm-kernel, lkml
Reply to
Nicolai Buchwitz, 2026-09-10
Hi Nicolai,

On 9/10/26 20:50, Nicolai Buchwitz wrote:
quoted
+    max_duration = usecs_to_jiffies(2 * priv->tx_lpi_timer);
tx_lpi_timer comes direct from ethtool as an unvalidated u32. So if a (arguable privileged
user) does 'ethtool --set-eee eth0 tx-lpi-timer 1000000000', the code will sleep ~2000 seconds
under rtnl_lock. Tge old code capped it at 900 ms regardless of the timer.

Thus I think we should clamp it at some sane value. Feel free to keep my R-b with the clamp.
I was wondering if 802.3 said anything about the LPI timer value, but
Clause 78 says :

  78.1.2.1.3 When generated

  Specification of the time when this primitive is generated by the LPI
  client is out of the scope of this standard.

I'll clamp that as a safety precaution.

As a side-note, there are other limitations, that apply to both eee
and flow control. Even though we're in MAC loopback mode, the link
MUST be up for the selftests to run, and both EEE and Pause are
affected by the autoneg results, and this will affect the selftest
outcome.

I'll address that in another series though, but I'll send a V3 for the
clamping still :)

Thanks for taking a look,

Maxime
Thread (15 messages) 15 messages, 2 authors, last reply 2026-09-10
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help