IF_DEQUEUE(&ifp->if_snd, m);
3
while (m) {
4
m_freem(m);
IF_DEQUEUE(&ifp->if_snd, m);
}
return;
}
1
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.
2
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.
3
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
.
4
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.2 Removing 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) ) {
3
ms = m;
4
while (ms && (ms->m_len == 0))
5
ms = ms->m_next;
6
if (ms == NULL) {
7
m_freem(m);
continue;
}
9–4 Implementing the Start Section