Pulling The Packets From The Fifo Buffer - Compaq Tru64 UNIX Installation Manual

Writing network device drivers
Table of Contents

Advertisement

13.2.2 Pulling the Packets from the FIFO Buffer

The following code shows how the el_rint( ) routine pulls the packets
from the first-in/first-out (FIFO) buffer. This task is specific to the hardware
device that is associated with the if_el device driver. If you need to perform
a similar task with your hardware device, use this example as a model.
while ((status > 0) && (count-- > 0)) {
len = status & RX_BYTES;
if ((status & RX_ER) || (len > 1518) || (len < 60)) {
if (status & RX_ER) {
status &= RX_EM;
if (sc->ctrblk.est_recvfail != 0xffff)
sc->ctrblk.est_recvfail++;
switch (status) {
case RX_EOR:
4
case RX_ERT:
case RX_EOS:
case RX_ECR:
case RX_EAL:
default:
}
} else
if ((sc->debug) && (len != 0))
printf("el%d: Received illegal size packet (%d)\n",
} else {
if (len <= MHLEN-2-4) {
MGETHDR(m, M_DONTWAIT, MT_DATA);
} else {
MGETHDR(m, M_DONTWAIT, MT_DATA);
if (m) {
}
}
Sets up a while loop that executes as long as there are complete
1
packets.
13–6 Implementing the Interrupt Section
1
3
if (sc->ctrblk.est_overrun != 0xffff)
sc->ctrblk.est_overrun++;
if (sc->debug)
printf("el%d: Overrun\n", ifp->if_unit);
break;
5
sc->ctrblk.est_recvfail_bm |= 4;
if (sc->debug)
printf("el%d: Bad Sized packet\n", ifp->if_unit);
break;
6
sc->ctrblk.est_recvfail_bm |= 1;
if (sc->debug)
printf("el%d: CRC\n", ifp->if_unit);
break;
7
sc->ctrblk.est_recvfail_bm |= 2;
if (sc->debug)
printf("el%d: Alignment\n", ifp->if_unit);
break;
8
ifp->if_unit, len);
9
MCLGET2(m, M_DONTWAIT);
if ((m->m_flags & M_EXT) == 0) {
m_freem(m);
m = (struct mbuf *)NULL;
}
2

Advertisement

Table of Contents
loading

Table of Contents