2
Calls the
simple_lock( )
routine to assert a lock with exclusive access
for the resource that is associated with the
el_softc_lock
simple lock
data structure pointer. This means that no other kernel thread can
gain access to the locked resource until you call
simple_unlock( )
to
release it. Because simple locks are spin locks,
simple_lock( )
does
not return until the lock has been obtained.
10.2 Incrementing the Transmit Timeout Counter and
Resetting the Unit
The following code shows how the
el_watch( )
routine counts the number
of transmit timeouts, clears the timer, and resets the unit:
sc->x+;
1
ifp->if_timer = 0;
el_reset_locked(sc, ifp, unit);
2
1
Increments the transmit timeout counter, which stores the number
of times transmit timeouts occur.
2
Calls the
el_reset_locked( )
routine to reset the device.
10.3 Releasing the Simple Lock and Resetting the IPL
The following code shows how the
el_watch( )
routine releases the simple
lock and resets the IPL.
simple_unlock(&sc->el_softc_lock);
splx(s);
return(0);
}
10–2 Implementing a Watchdog Section