Compaq AA-RNG2A-TE manual Implementing the Start Section

Models: AA-RNG2A-TE

1 159
Download 159 pages 42.56 Kb
Page 117
Image 117

mp = ms; 8

mn = mp->m_next; 9 len = mp->m_len; 10 while (mn != NULL) { 11

if (mn->m_len == 0) { mp->m_next = mn->m_next; mn->m_next = NULL; m_free(mn);

} else { 12

len += mn->m_len; mp = mn;

}

mn = mp->m_next;

}

1While true, removes packets from the pending queue and has the device transmit the packets.

2Calls 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 is the instance of the mbuf data structure called m.

3Checks that the total packet length is less than the number of bytes left in the transmit first-in/first-out (FIFO).

4Eliminates any zero-length segments. The ms mbuf pointer will point to the first buffer segment with data.

5Skips over any leading zero-length segments.

6Stores the next memory buffer in the chain of mbuf data structures in the ms mbuf pointer. The m_next member stores the next memory buffer in the chain. Network device drivers typically reference this member through the alternate name m_next, which is defined in the mbuf.h header file.

7If this is a zero-length transmit, calls the m_freem( ) routine to free the mbuf buffer chain.

8Stores the first memory buffer in the chain of mbuf data structures in the mp mbuf pointer.

9Stores the next memory buffer in the chain of mbuf data structures in the mn mbuf pointer.

10

Stores the amount of data in the mp mbuf in the len variable. The mh_len member of the mbuf data structure pointer stores the amount of data in this mbuf data structure. Network device drivers typically reference this member through the alternate name m_len, which is defined in the mbuf.h header file.

11

While the mn mbuf is not NULL, manipulates the mh_len and mh_next members of the mbuf data structure to eliminate any zero-length buffers

Implementing the Start Section 9–5

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