IF_DEQUEUE(&ifp->if_snd, m);

3

while (m) {

4

m_freem(m);

IF_DEQUEUE(&ifp->if_snd, m);

}

return;

}

1

2

3

4

Declares a pointer to an ether_header data structure called eh. The ether_header data structure contains information that is associated with a 10 Mb/s and 100 Mb/s Ethernet header.

If the cardout member of the el_softc data structure for this device is set to 1 (true), the user removed the PCMCIA card from the slot.

Calls the IF_DEQUEUE macro to remove an entry from the output queue. The output queue is referenced through the if_snd member of the ifnet data structure for this device. The memory buffer information that IF_DEQUEUE manipulates is specified in the instance of the mbuf data structure called m.

As long as a transmit request was dequeued from the output queue, calls m_freem( ) to free the request and IF_DEQUEUE to dequeue the next transmit request.

9.2.2Removing Packets from the Pending Queue and Preparing the Transmit Buffer

The following code shows how the el_start_locked( ) routine removes packets from the pending queue and prepares the transmit buffer:

while(1) { 1 IF_DEQUEUE(&ifp->if_snd, m); 2

if ((m) && ((m->m_pkthdr.len+8) < sc->txfree) ) { ms = m; 4

while (ms && (ms->m_len == 0)) 5

ms = ms->m_next; 6 if (ms == NULL) { 7

m_freem(m); continue;

}

3

9–4Implementing the Start Section

Page 116
Image 116
Compaq AA-RNG2A-TE manual 4Implementing the Start Section