Removing Packets From The Pending Queue And Preparing - Compaq Tru64 UNIX Installation Manual

Writing network device drivers
Table of Contents

Advertisement

IF_DEQUEUE(&ifp->if_snd, m);
while (m) {
m_freem(m);
IF_DEQUEUE(&ifp->if_snd, m);
}
return;
}
Declares a pointer to an ether_header data structure called eh. The
1
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
2
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.
3
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,
4
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);
if ((m) && ((m->m_pkthdr.len+8) < sc->txfree) ) {
ms = m;
while (ms && (ms->m_len == 0))
ms = ms->m_next;
if (ms == NULL) {
m_freem(m);
continue;
}
9–4 Implementing the Start Section
3
4
2
4
5
6
7
3

Advertisement

Table of Contents
loading

Table of Contents