Technical information

8-9
Sample Driver
Two Receive Queues
The AIC-6915 offers the ability to use two Receive Completion Descriptors Queues and
two Receive Buffer Descriptor Queues. Two Receive Buffer Descriptor Queues are
selected through the
R
X
D
ESC
Q
UEUE
2C
TRL
register. There is a corresponding register,
R
X
C
OMPLETION
Q
UEUE
2C
TRL
, if two receive completion queues are used. Use of two
completion queues does not dictate the use of two receive descriptor queues, and vice
versa.
If a single completion queue is used with two buffer queues, the completion queue points
to the buffer queue for each received packet through the
B
UFFER
Q
UEUE
bit in the
S
TATUS
1
field in the Receive Completion Descriptor.
There are several options available for the use of two receive descriptor queues. Incoming
frames are sorted based on the criteria selected in the driver, and are placed in the
appropriate receive queue. The developer may choose among the criteria of sorting based
on size, VLAN priority, or on priority as defined in the Perfect Addressing table.
Receive Producer/Consumer Model
There are two different receive models available in the AIC-6915. One option is to use a
producer-consumer model to manage receive resources. In this case, the software is the
producer of Receive Buffer Descriptors, since it makes the receive buffer resource
available at initialization time and also again after processing each receive interrupt. The
driver writes an updated value to the
R
X
D
ESC
Q1P
RODUCER
field in the
R
X
D
ESC
Q
UEUE
1P
TRS
register following receive processing. The AIC-6915 is then the
consumer of Receive Buffer Descriptors, as it uses the buffer resources provided by the
driver. The AIC-6915 writes entries to the Receive Completion Descriptor Queue, and is
therefore the producer of Receive Completion Descriptors. The software is the consumer
in this case. It is responsible for writing the
R
X
C
OMPLETION
Q1C
ONSUMER
I
NDEX
field in
register
C
OMPLETION
Q
UEUE
1C
ONSUMER
I
NDEX
.
Receive Polling Model
The software developer may choose to implement the polling model instead of the
producer-consumer model for receive buffers. In this model, the AIC-6915 does not rely
on the producer index to determine that a buffer descriptor is available. Instead, the
V
ALID
bit in the next Receive Buffer Descriptor is examined. If the
V
ALID
bit is set,
AIC-6915 uses the descriptor. The software manages the setting of the
V
ALID
bit after
processing receive complete interrupts. The
E
ND
bit in the Receive Buffer Descriptor
indicates the last descriptor in the list, and must be set by the driver when using the
polling model. Receive Completion Descriptors are handled in a manner identical to that
used in the producer-consumer model.
Receive Initialization
There are several registers which must be defined before the AIC-6915 can begin to receive
packets. These registers and the fields which must be initialized in the driver are
summarized below for the case of 32-bit addressing. Control bit fields which require
initialization are described. Register bits which are not explicitly described here may be
left at the default reset value. The developer must determine if these default values need
to be modified for the driver under development. These registers may be initialized in
any order. Refer to Chapter 7 for more detailed information on these registers.