[netdevice] Add the concept of an insomniac network device

Some network devices (observed with the SNP interface to the wireless
network card on an HP Elitebook 840 G10) will stop working if they are
left for too long without being polled.

Add the concept of an insomniac network device, that must continue to
be polled even when closed.

Note that drivers are already permitted to call netdev_rx() et al even
when closed: this will already be happening for USB devices since
polling operates at the level of the whole USB bus, rather than at the
level of individual USB devices.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2025-04-17 00:27:13 +01:00
parent c88ebf2ac6
commit b07cc851f0
2 changed files with 16 additions and 2 deletions

View File

@@ -611,8 +611,8 @@ void netdev_rx_err ( struct net_device *netdev,
*/
void netdev_poll ( struct net_device *netdev ) {
/* Avoid calling poll() on unopened network devices */
if ( ! netdev_is_open ( netdev ) )
/* Call poll() only on open (or insomniac) network devices */
if ( ! ( netdev->state & ( NETDEV_OPEN | NETDEV_INSOMNIAC ) ) )
return;
/* Guard against re-entry */