SMSC LAN1198 Manual De Usuario

Descargar
Página de 45
LAN9118 Family Programmer Reference Guide
SMSC AN 12.12
29
Revision 1.0 (12-14-09)
APPLICATION NOTE
 
6.4   Packet Transfer Completion: Management Statistics
Once a data packet has been transferred into the TX_Data_FIFO, most protocol stacks have no need
for the sending thread to acknowledge the transfer result; the upper protocol layers are expected to
deal with failures, such as a TCP layer re-transmit.  There is a need in a managed host however, to
maintain statistics per device such as the number of packets or bytes sent, the number of packet that
have been deferred, collisions, under runs, etc.  After a packet has been processed by the device, a
TX Status word is appended to the end of the device’s TX_Status_FIFO for checking individual packet
transfer status whether the packet has been transmitted or dropped; the driver can update the transmit
statistics periodically from a separate thread or call to examine these values.  The Packet Tag field is
copied from the TX_CMD_B word used in the packet transfer, while Error Status is a 1-bit summation
of the remaining TX Status error flags; 0 means no errors, i.e., that the packet has been sent.
The TX_FIFO_INF:TSUSED field gives a count of many TX Status words are pending to be read from
the  TX_STATUS_FIFO register.  A status word is added to the Status FIFO whenever a packet
completes processing, whether or not the packet was transmitted successfully. The count field does
not account for packets that are currently in the Transmit Data FIFO and have not yet been transmitted.
Use of the count field and its associated interrupt allows a driver some flexibility towards management
style.  If no management is required, the driver can choose to ignore status word processing
completely and save code space and processing time.  The strictest style of management can be
achieved by programming the FIFO to stop sending packets when the TX_Status_FIFO is full, and
examining every status word until TSUSED is again 0.  A looser style of management could also be
achieved by allowing the TSUSED counter to overrun, and thus simply make a “best effort” at
managing the device.
Table 6.1  ransmit Status Word
TX STATUS
Packet Tag (31:16)
Error 
Status
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
0x1234