Compaq AA-RNG2A-TE Network Card User Manual


 
2 Copies transmit data from memory to the card using 32-bit writes. Only
a multiple of 4 bytes can be copied this way.
3 If some number of bytes (fewer than 4) remain in the current memory
buffer, the driver either copies those bytes directly to the card (if they
were the last bytes for the entire frame), or combines those bytes with
bytes from the next memory buffer (if there is more data for this frame).
9.2.4 Accounting for Outgoing Bytes
The following code shows how the el_start_locked( ) routine accounts
for the outgoing bytes:
sc->txfree -= ((m->m_pkthdr.len + 3) & ~0x3); 1
sc->txfree -= 4;
1 Maintains the number of bytes free in the transmit FIFO.
9.2.5 Updating Counters, Freeing the Transmit Buffer, and Marking
the Output Process as Active
The following code shows how the el_start_locked( ) routine updates
counters, frees the transmit buffer, and marks the output process as active:
ADD_XMIT_PACKET(ifp, sc, m->m_pkthdr.len);
1
eh = mtod(m, struct ether_header *);
if (eh->ether_dhost[0] & 0x1) {
ADD_XMIT_MPACKET(ifp, sc, m->m_pkthdr.len);
}
m_freem(m);
2
ifp->if_flags |= IFF_OACTIVE;
} else if (m) {
3
IF_PREPEND(&ifp->if_snd, m);
break;
} else
break;
}
1 Updates the counters using the ADD_XMIT_PACKET and possibly the
ADD_XMIT_MPACKET (for multicast packets) macros. These macros are
defined in the lan_common.h file. Most network drivers perform this
task in the transmit complete interface.
2 Calls the m_freem( ) routine to free the mbuf buffer. Network drivers
must free the buffer after the transmit operation is complete.
3 If there is no room for this transmit, puts the mbuf back on the queue.
Implementing the Start Section 97