Adaptec 1737100 Programmer Manual - Page 169

Two Receive Queues, Receive Producer/Consumer Model, Receive Polling Model, Receive Initialization

Page 169 highlights

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 RXDESCQUEUE2CTRL register. There is a corresponding register, RXCOMPLETIONQUEUE2CTRL, 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 BUFFERQUEUE bit in the STATUS1 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 RXDESCQ1PRODUCER field in the RXDESCQUEUE1PTRS 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 RXCOMPLETIONQ1CONSUMERINDEX field in register COMPLETIONQUEUE1CONSUMERINDEX. 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 VALID bit in the next Receive Buffer Descriptor is examined. If the VALID bit is set, AIC-6915 uses the descriptor. The software manages the setting of the VALID bit after processing receive complete interrupts. The END 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. 8-9

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171
  • 172
  • 173
  • 174
  • 175
  • 176
  • 177
  • 178
  • 179
  • 180
  • 181
  • 182
  • 183
  • 184
  • 185
  • 186
  • 187
  • 188
  • 189
  • 190

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.