Compaq AA-RNG2A-TE Network Card User Manual


 
9
Implementing the Start Section
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();
1
if (!simple_lock_try(&sc->el_softc_lock)) { 2
splx(s); 3
return;
}
1 Calls the splimp( ) routine to mask all LAN hardware interrupts.
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 91