Technical information

8-2
AIC-6915 Ethernet LAN Controller Programmer’s Manual
Producer-Consumer Model for the AIC-6915
The AIC-6915 uses the Producer-Consumer model for its operation and interaction with
the driver. One of the entities (AIC-6915 or the driver) "Produces" work items by placing
them in a shared queue, the other entity "Consumes" the work items by dequeueing them
from the queue.
For example, when the driver wants to transmit a packet, it Produces the work item by
queueing descriptors containing the addresses of the packet buffers in the Transmit DMA
Buffer Descriptors Queue. The AIC-6915 Consumes the packet buffers by dequeueing
them from the Transmit DMA buffer descriptors queue. After transmitting the packet, the
AIC-6915 Produces a transmit completion descriptor by queueing such a descriptor into
the Transmit Completion Queue. The driver then Consumes the transmit completion
descriptor by dequeueing and reading it from the Transmit Completion Queue.
Similarly, on the receive side, the driver Produces receive buffers by queueing descriptors
containing the buffer addresses in the Receive DMA Descriptors Queue. After an Ethernet
packet has been received from the network, the AIC-6915 Consumes a receive buffer by
dequeueing it from the Receive DMA Descriptors Queue and Produces a Receive
Completion Descriptor by writing it to the receive completion queue. The driver
Consumes the receive completion descriptor by reading and dequeueing it from the
Receive Completion Queue.
An easy way to remember who is the Producer and who is the Consumer for a particular
queue, is to consider who writes entries into the queue and who reads entries from the
queue. The entity (driver or AIC-6915) doing the writing is the Producer and the entity
doing the reading is the Consumer.
In order to keep track of how many entries have been written into a queue and how many
have been read, each queue has a Producer Index and a Consumer Index. The Producer
Index points to (using an offset from the base address of the queue) the next entry that will
be written to by the Producer. In other words, the last entry already written by the
Producer is the one pointed to by (Producer Index - 1). Similarly the Consumer Index
points to the next entry to be read by the Consumer. The last entry already read by the
Consumer is the one pointed to by (Consumer Index - 1).