Examining The First Part Of The Packet - Compaq Tru64 UNIX Installation Manual

Writing network device drivers
Table of Contents

Advertisement

Looks for errors.
2
Processes the error.
3
Processes the overrun error case.
4
Processes the runt and oversized error cases.
5
Processes the CRC error case.
6
Processes the alignment error case.
7
Discards the packet if none of the previous cases apply. This indicates a
8
size error.
Allocates a buffer for the received data. If the length of the received
9
data is less than a small mbuf, allocates a small mbuf. Otherwise, a 2K
cluster mbuf is allocated. This code is an optimization. In most cases,
a driver does not know the size of a receive packet when the buffer
resource is allocated.

13.2.3 Examining the First Part of the Packet

The following code shows how the el_rint( ) routine examines the first
part of the received packet:
if (m != NULL) {
m->m_pkthdr.len = m->m_len = len - sizeof(struct ether_header); 2
m->m_pkthdr.rcvif = ifp;
m->m_data += 2;
dat = mtod(m, unsigned char *);
len = (len + 3) & ~3;
if ((ifp->if_flags & (IFF_PROMISC|IFF_ALLMULTI)) == 0) {
1
3
io_blockread(sc->data,
(vm_offset_t)dat,
2UL*4UL,
HANDLE_LONGWORD);
len -= (2*4);
dat += (2*4);
if (*mtod(m, unsigned char *) & 0x01) {
Implementing the Interrupt Section 13–7
4
5
6
7

Advertisement

Table of Contents
loading

Table of Contents