Adaptec 1737100 Programmer Manual - Page 167

Receive Process

Page 167 highlights

Sample Driver // Specify which interrupts we want InterruptEnValue.RxQ1DoneIntEn = 1; // interrupt on receive DMA InterruptEnValue.TxDmaDoneIntEn = 1; // interrupt on transmit DMA // The hardware is now ready to transmit and receive packets! Receive Process The receive process in the AIC-6915 is based on the use of a receive completion queue and receive buffers. Their relationship is discussed below. Receive Completion Descriptor Queue When a packet has been received and DMA-transferred to host memory, the AIC-6915 adds a new entry to the Receive Completion Descriptor Queue. The memory for this queue is allocated by the driver and is passed to AIC-6915 via the RXCOMPLETIONQUEUE1CTRL register (offset BCh). The size of this queue is fixed at 1024 entries. There are four different descriptor format types available: the 4-byte short descriptor (Type 0), the 8-byte basic descriptor (Type 1), the 8-byte checksum descriptor (Type 2), and the 16-byte full descriptor (Type 3). Therefore, depending upon the descriptor type, 4KByte, 8KByte, or 16KByte of memory is required to accommodate the Receive Completion Descriptor Queue. These descriptors are discussed in more detail below. The completion descriptor type is programmed using the RXCOMPLETIONQ1TYPE field in the RXCOMPLETIONQUEUE1CTRL register. There is a corresponding field in RXCOMPLETIONQUEUE2CTRL if two Receive Completion Queues are used. The developer may choose to implement two receive completion queues if the protocol environment can utilize packet sorting based on priority or size. The AIC-6915 controller offers the choices of sorting based on address filtering priority, VLAN priority, or packet size. This option is programmed in the RXDMAQUEUEMODE field in register RXDMACTRL. For address filtering and AIC-6915 ID sorting, refer to the description of register RXADDRESSFILTERINGCTRL. Each entry in the Receive Completion Descriptor Queue points to one or more entries in the Receive Buffer Descriptor Queue, depending upon the size of the received frame. There is one Receive Completion Descriptor Queue entry for each received frame. Receive Completion Descriptor Types Type 0 Completion Descriptor The Type 0 descriptor is known as the short completion descriptor. This descriptor consists of a four byte entry (one word). It contains a descriptor ID, a status field, an end index which points to the associated Receive Buffer Descriptor Queue entry, and a length field indicating the length of the received packet. To program the AIC-6915 to use a Type 0 descriptor, the developer must set RXCOMPLETIONQ1TYPE in register RXCOMPLETIONQUEUE1CTRL to 00b. Type 1 Completion Descriptor The Type 1 descriptor is also known as the basic completion descriptor. It consists of two word entries. The first word is identical to the Type 0 descriptor. The second word contains extended status information and a VLAN ID and priority. To program the AIC-6915 to use a Type 1 descriptor, the developer must set RXCOMPLETIONQ1TYPE in register RXCOMPLETIONQUEUE1CTRL to 01b. 8-7

  • 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-7
Sample Driver
// Specify which interrupts we want
InterruptEnValue.RxQ1DoneIntEn = 1;
// interrupt on receive DMA
InterruptEnValue.TxDmaDoneIntEn = 1;
// interrupt on transmit DMA
// The hardware is now ready to transmit and receive packets!
Receive Process
The receive process in the AIC-6915 is based on the use of a receive completion queue and
receive buffers.
Their relationship is discussed below.
Receive Completion Descriptor Queue
When a packet has been received and DMA-transferred to host memory, the AIC-6915
adds a new entry to the Receive Completion Descriptor Queue.
The memory for this
queue is allocated by the driver and is passed to AIC-6915 via the
R
X
C
OMPLETION
Q
UEUE
1C
TRL
register (offset BCh).
The size of this queue is fixed at 1024
entries.
There are four different descriptor format types available: the 4-byte short
descriptor (Type 0), the 8-byte basic descriptor (Type 1), the 8-byte checksum descriptor
(Type 2), and the 16-byte full descriptor (Type 3).
Therefore, depending upon the
descriptor type, 4KByte, 8KByte, or 16KByte of memory is required to accommodate the
Receive Completion Descriptor Queue.
These descriptors are discussed in more detail
below.
The completion descriptor type is programmed using the
R
X
C
OMPLETION
Q1T
YPE
field in the
R
X
C
OMPLETION
Q
UEUE
1C
TRL
register.
There is a corresponding field in
R
X
C
OMPLETION
Q
UEUE
2C
TRL
if two Receive Completion Queues are used.
The developer
may choose to implement two receive completion queues if the protocol environment can
utilize packet sorting based on priority or size.
The AIC-6915 controller offers the choices
of sorting based on address filtering priority, VLAN priority, or packet size.
This option is
programmed in the
R
X
D
MA
Q
UEUE
M
ODE
field in register
R
X
D
MA
C
TRL
.
For address
filtering and AIC-6915 ID sorting, refer to the description of register
R
X
A
DDRESS
F
ILTERING
C
TRL
.
Each entry in the Receive Completion Descriptor Queue points to one or more entries in
the Receive Buffer Descriptor Queue, depending upon the size of the received frame.
There is one Receive Completion Descriptor Queue entry for each received frame.
Receive Completion Descriptor Types
Type 0 Completion Descriptor
The Type 0 descriptor is known as the short completion descriptor.
This descriptor
consists of a four byte entry (one word).
It contains a descriptor ID, a status field, an end
index which points to the associated Receive Buffer Descriptor Queue entry, and a length
field indicating the length of the received packet.
To program the AIC-6915 to use a Type
0 descriptor, the developer must set
R
X
C
OMPLETION
Q1T
YPE
in register
R
X
C
OMPLETION
Q
UEUE
1C
TRL
to 00b.
Type 1 Completion Descriptor
The Type 1 descriptor is also known as the basic completion descriptor.
It consists of two
word entries.
The first word is identical to the Type 0 descriptor.
The second word
contains extended status information and a VLAN ID and priority.
To program the
AIC-6915 to use a Type 1 descriptor, the developer must set
R
X
C
OMPLETION
Q1T
YPE
in
register
R
X
C
OMPLETION
Q
UEUE
1C
TRL
to 01b.