The Transmit Buffer; Transmitting The Buffer - Compaq Tru64 UNIX Installation Manual

Writing network device drivers
Table of Contents

Advertisement

in the middle. The mfree( ) routine is called to free any zero-length
memory buffers.
Otherwise, adds the length and sets the next memory buffer in the
12
chain to the mp mbuf pointer.

9.2.3 Transmitting the Buffer

The following code shows how the el_start_locked( ) routine transmits
the buffer:
WRITE_DATA(sc, len | TX_INT);
dat = mtod(ms, unsigned char *);
len = ms->m_len;
while (ms != NULL) {
io_blockwrite((vm_offset_t)dat,
dat += (len & ~ 3);
ms = ms->m_next;
i = len % 4;
if (ms == NULL) {
if (i) {
val = 0;
for (j=0; j<i; j++)
val |= (*dat++ << (8*j));
WRITE_DATA(sc, val);
}
} else {
if (i) {
val = 0;
for (j=0; j<i; j++)
val |= (*dat++ << (8*j));
dat = mtod(ms, unsigned char *);
if (ms->m_len <= (4-i)) {
} else {
}
WRITE_DATA(sc, val);
} else {
dat = mtod(ms, unsigned char *);
len = ms->m_len;
}
}
}
Requests an interrupt upon completion of the transmit operation.
1
9–6 Implementing the Start Section
1
2
sc->data,
(u_long)(len & ~ 3),
HANDLE_LONGWORD);
3
for (j=0; j<ms->m_len; j++)
val |= (*dat++ << (8*(j+i)));
ms = NULL;
len = ms->m_len - (4-i);
for (j=i; j<4; j++)
val |= (*dat++ << (8*j));

Advertisement

Table of Contents
loading

Table of Contents