Implementing The Reset Section; Implementing The El_Reset Routine - Compaq Tru64 UNIX Installation Manual

Writing network device drivers
Table of Contents

Advertisement

The reset section of a network device driver contains the code that resets the
LAN adapter when there is a network failure and there is a need to restart
the device. It resets all of the counters and local variables and can free up
and reallocate all of the buffers that the network driver uses.
The if_el device driver implements the following routines in its reset
section:
el_reset( ) (Section 11.1)
el_reset_locked( ) (Section 11.2)

11.1 Implementing the el_reset Routine

The el_reset( ) routine is a jacket routine that performs the following
tasks:
Determines whether the user removes the PCMCIA card from the slot
Sets the IPL and obtains the simple lock
Calls the el_reset_locked( ) routine to reset the device
Releases the simple lock and resets the IPL
The following code shows how this is done:
static void el_reset(int unit)
{
struct el_softc *sc = el_softc[unit];
struct ifnet *ifp = &sc->is_if;
int s;
if (sc->cardout) return;
s = splimp(); 2
simple_lock(sc->el_softc_lock);
el_reset_locked(sc, ifp, unit);
simple_unlock(sc->el_softc_lock);
splx(s);
If the user has removed the PCMCIA card from the slot, returns to
1
the calling routine.
Calls the splimp( ) routine to mask all LAN hardware interrupts
2
before obtaining the simple lock for the el_softc resource.

Implementing the Reset Section

1
3
4
Implementing the Reset Section 11–1
11

Advertisement

Table of Contents
loading

Table of Contents