summaryrefslogtreecommitdiffstats
path: root/private/ntos/ndis/lsl/mlid.h
blob: fe33ac327eae5223114b8891c38b64726779b1d0 (plain) (blame)
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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
/*++

Copyright (c) 1990  Microsoft Corporation

Module Name:

    mlid.h

Abstract:

    This file contains all the structures for internals of this driver.

Author:

    Sean Selitrennikoff (SeanSe) 3-8-93

Environment:

    Kernel Mode.

Revision History:

--*/


//
// NDIS handle for this "protocol"
//
extern NDIS_HANDLE NdisMlidProtocolHandle;

//
// Spin lock for accessing MLID list
//
extern NDIS_SPIN_LOCK NdisMlidSpinLock;




typedef struct _MLID_MA_ {

    //
    // Number of allocated slots
    //
    UINT32 MAAllocated;

    //
    // Count of number of slots in use
    //
    UINT32 MACount;

    //
    // An array of counts of how many times each address has been enabled
    //
    PUINT32 EnableCounts;

    //
    // Array of Multicast Addresses stored as one long byte stream.
    //
    PUINT8 Addresses;

    //
    // Functional Address for Token rings -- Note that there is some weirdness
    // here.  ODI gives functional addresses as 6 byte strings and requires that
    // the MLID keep track of the number of time each bit in the functional addresses
    // has been enable.  To do this, we lop off the first two bytes (there are
    // the constant values C0-00) and then use the EnableCounts field to count
    // the references on each bit.
    //
    ULONG FunctionalAddr;

} MLID_MA, *PMLID_MA;


//
// Number of statistics kept for all MLIDS
//
#define NUM_GENERIC_COUNTS 15

//
// Number of statistics (max) kept by any media type
//
#define NUM_MEDIA_COUNTS 13

//
// Number of Token Ring statistics
//
#define NUM_TOKEN_RING_COUNTS 13

//
// Number of Ethernet statistics
//
#define NUM_ETHERNET_COUNTS 8

//
// Number of FDDI statistics
//
#define NUM_FDDI_COUNTS 10


typedef struct _NDISMLID_StatsTable {

    //
    // Number of Boards using this stats table
    //
    UINT32 References;

    //
    // The current statistic number that we are getting from the NDIS MAC
    //
    UINT32 StatisticNumber;

    //
    // Timer Object for gathering statistics
    //
    NDIS_TIMER StatisticTimer;

    //
    // Is the timer up and running
    //
    BOOLEAN StatisticsOperational;

    //
    // For issuing the requests to the MAC
    //
    NDIS_REQUEST NdisRequest;

    //
    // A buffer for holding the response
    //
    UINT32 StatisticValue;

    //
    // The MLID statistic table
    //
    MLID_StatsTable StatsTable;

    //
    // Entries for the GenericCountsPtr
    //
    StatTableEntry MLID_GenericCounts[NUM_GENERIC_COUNTS];

    //
    // Entries for Medium Specific Counts
    //
    StatTableEntry MLID_MediaCounts[NUM_MEDIA_COUNTS];

    //
    // Finally, the actual counters
    //
    UINT64 GenericCounts[NUM_GENERIC_COUNTS];
    UINT64 MediaCounts[NUM_MEDIA_COUNTS];

} NDISMLID_StatsTable, *PNDISMLID_StatsTable;

typedef struct _MLID_STRUCT_ {

    //
    // BoardNumber
    //
    UINT32 BoardNumber;

    //
    // Spin lock to guard accesses to this structure
    //
    NDIS_SPIN_LOCK MlidSpinLock;

    //
    // NdisBindingHandle - NDIS MAC Context.
    //
    NDIS_HANDLE NdisBindingHandle;

    //
    // Send packet pool for this MLID
    //
    NDIS_HANDLE SendPacketPool;

    //
    // Send Buffer pool for this MLID
    //
    NDIS_HANDLE SendBufferPool;

    //
    // Receive packet pool for this MLID
    //
    NDIS_HANDLE ReceivePacketPool;

    //
    // Receive Buffer pool for this MLID
    //
    NDIS_HANDLE ReceiveBufferPool;

    //
    // Queue of SendECBs that are waiting for resources
    //
    PECB FirstPendingSend;
    PECB LastPendingSend;
    BOOLEAN StageOpen;
    BOOLEAN InSendPacket;

    //
    // Flag that signals that the MLID is unloading
    //
    BOOLEAN Unloading;

    //
    // Event for signalling the end of a request made to the MLID
    //
    KEVENT MlidRequestCompleteEvent;
    BOOLEAN UsingEvent;

    //
    // Status of completed request
    //
    UINT32 RequestStatus;

    //
    // Count of Promiscuous mode enable calls
    //
    UINT32 PromiscuousModeEnables;

    //
    // Current NdisPacketFilter
    //
    UINT32 NdisPacketFilterValue;

    //
    // The MLID configuration table
    //
    MLID_ConfigTable ConfigTable;

    //
    // Pointer to the shared space
    //
    PNDISMLID_StatsTable StatsTable;

    //
    // Pointer to mulitcast address array
    //
    MLID_MA MulticastAddresses;

    //
    // LSL Control handler array
    //
    PINFO_BLOCK LSLFunctionList;

    //
    // Underlying Medium Type
    //
    NDIS_MEDIUM NdisMlidMedium;

    //
    // Adapter name, used for identifying multiple BoardNumbers on a the same
    // physical adapter.
    //
    UNICODE_STRING AdapterName;

} MLID_STRUCT, *PMLID_STRUCT;




typedef struct _MLID_BOARDS_ {

    //
    // Board Number
    //
    UINT32 BoardNumber;

    //
    // Adapter Name
    //
    PUNICODE_STRING AdapterName;

    //
    // Pointer to MLID
    //
    PMLID_STRUCT Mlid;

} MLID_BOARDS, *PMLID_BOARDS;

//
// Pointer to the array of board numbers
//
extern PMLID_BOARDS MlidBoards;

extern UINT32 CountMlidBoards;

extern UINT32 AllocatedMlidBoards;


//
// Defines on number of packets and buffers per MLID
//

#define NDISMLID_BUFFERS_PER_PACKET 6
#define NDISMLID_RECEIVES_PER_MLID (*KeNumberProcessors + 1)
#define NDISMLID_SENDS_PER_MLID 5


//
// Declarations for routines in mlidsend.c
//

extern
VOID
SendPackets(
    PMLID_STRUCT Mlid
    );


extern
VOID
ReturnSendPacketResources(
    PNDIS_PACKET NdisPacket
    );


//
// Declarations for routines in mlidrcv.c
//

UINT32
ReceiveGetFrameType(
    PMLID_STRUCT Mlid,
    PUINT8 MediaHeader,
    PUINT8 DataBuffer
    );


VOID
ReceiveGetProtocolID(
    PMLID_STRUCT Mlid,
    PLOOKAHEAD OdiLookAhead,
    UINT32 FrameID
    );

VOID
ReceiveSetDestinationType(
    PMLID_STRUCT Mlid,
    PLOOKAHEAD OdiLookAhead
    );

NDIS_STATUS
BuildReceiveBufferChain(
    PMLID_STRUCT Mlid,
    PNDIS_PACKET NdisReceivePacket,
    PECB ReceiveECB
    );

//
// Functions in mlidstat.c
//

VOID
NdisMlidStatisticTimer(
    IN PVOID SystemSpecific1,
    IN PVOID Context,
    IN PVOID SystemSpecific2,
    IN PVOID SystemSpecific3
    );