Implementing The Start Section; Implementing The El_Start Routine; Setting The Ipl And Obtaining The Simple Lock - Compaq Tru64 UNIX Installation Manual

Writing network device drivers
Table of Contents

Advertisement

The start section of a network device driver transmits data packets across
the network. When the network protocol has a data packet to transmit,
it prepares the packet, then calls the start interface for the appropriate
network device driver. The start interface transmits the packet. When
the transmission is complete, it frees up the buffers that are associated
with the packet.
The if_el device driver implements the following routines in its start
section:
el_start( ) (Section 9.1)
el_start_locked( ) (Section 9.2)

9.1 Implementing the el_start Routine

The el_start( ) routine is a jacket routine that performs the following
tasks:
Sets the IPL and obtains the simple lock (Section 9.1.1)
Calls the el_start_locked( ) routine (Section 9.1.2)
Releases the simple lock and resets the IPL (Section 9.1.3)

9.1.1 Setting the IPL and Obtaining the Simple Lock

The following code shows how the el_start( ) routine sets the IPL and
acquires the simple lock.
static void el_start(struct ifnet *ifp)
{
register int unit = ifp->if_unit, s;
register struct el_softc *sc = el_softc[unit];
s = splimp();
if (!simple_lock_try(&sc->el_softc_lock)) {
splx(s);
3
return;
}
Calls the splimp( ) routine to mask all LAN hardware interrupts.
1
On successful completion, splimp( ) stores an integer value in the s
variable. This integer value represents the CPU priority level that
existed before the call to splimp( ).

Implementing the Start Section

1
2
Implementing the Start Section 9–1
9

Advertisement

Table of Contents
loading

Table of Contents