[ethernet] Document lock-free polling rationale in RP2040 loop

Explain why linkStatus() and connected() are called without
LwIPLock — linkStatus() only reads the W5500 PHY via SPI, and
connected() does a single atomic 32-bit read of netif->ip_addr.
This commit is contained in:
J. Nick Koston
2026-03-14 16:57:00 -10:00
parent 7fd801fe45
commit f109473707
@@ -80,7 +80,11 @@ void EthernetComponent::setup() {
}
void EthernetComponent::loop() {
// On RP2040, we need to poll connection state since there are no events
// On RP2040, we need to poll connection state since there are no events.
// linkStatus() reads the W5500 PHY register via SPI — no lwip state involved.
// connected() reads netif->ip_addr without LwIPLock, but this is a single
// 32-bit aligned read (atomic on ARM) — worst case is a one-iteration-stale
// value, which is benign for polling.
if (this->eth_ != nullptr) {
bool link_up = this->eth_->linkStatus() == LinkON;
bool has_ip = this->eth_->connected();