summaryrefslogblamecommitdiffstats
path: root/private/ntos/ndis/htdsu/request.c
blob: 7f9dd80c1d04585a18762e207eb0fe6a5b13cd22 (plain) (tree)
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
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661




















































































































































































































































































































































































































































































































































































































































































                                                                                            
/***************************************************************************\
|* Copyright (c) 1994  Microsoft Corporation                               *|
|* Developed for Microsoft by TriplePoint, Inc. Beaverton, Oregon          *|
|*                                                                         *|
|* This file is part of the HT Communications DSU41 WAN Miniport Driver.   *|
\***************************************************************************/
#include "version.h"
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Module Name:

    request.c

Abstract:

    This module implements the NDIS request routines for the Miniport driver.
        MiniportQueryInformation()
        MiniportSetInformation()

    This driver conforms to the NDIS 3.0 Miniport interface.

Author:

    Larry Hattery - TriplePoint, Inc. (larryh@tpi.com) Jun-94

Environment:

    Windows NT 3.5 kernel mode Miniport driver or equivalent.

Revision History:

---------------------------------------------------------------------------*/

#define  __FILEID__     5       // Unique file ID for error logging

#include "htdsu.h"

/*
// The following is a list of all the possible NDIS QuereyInformation requests
// that might be directed to the miniport.
// Comment out any that are not supported by this driver.
*/
static const NDIS_OID SupportedOidArray[] =
{
        OID_GEN_HARDWARE_STATUS,
        OID_GEN_MEDIA_SUPPORTED,
        OID_GEN_MEDIA_IN_USE,
        OID_GEN_MAXIMUM_LOOKAHEAD,
        OID_GEN_MAXIMUM_FRAME_SIZE,
        OID_GEN_MAXIMUM_TOTAL_SIZE,
        OID_GEN_MAC_OPTIONS,
        OID_GEN_LINK_SPEED,
        OID_GEN_TRANSMIT_BUFFER_SPACE,
        OID_GEN_RECEIVE_BUFFER_SPACE,
        OID_GEN_TRANSMIT_BLOCK_SIZE,
        OID_GEN_RECEIVE_BLOCK_SIZE,
        OID_GEN_VENDOR_ID,
        OID_GEN_VENDOR_DESCRIPTION,
        OID_GEN_DRIVER_VERSION,
        OID_GEN_CURRENT_LOOKAHEAD,

        OID_WAN_MEDIUM_SUBTYPE,
        OID_WAN_GET_INFO,
        OID_WAN_PERMANENT_ADDRESS,
        OID_WAN_CURRENT_ADDRESS,
        OID_WAN_GET_LINK_INFO,
        OID_WAN_SET_LINK_INFO,
#ifdef FUTURE_OIDS
        OID_WAN_QUALITY_OF_SERVICE,
        OID_WAN_PROTOCOL_TYPE,
        OID_WAN_HEADER_FORMAT,
        OID_WAN_LINE_COUNT,
        OID_WAN_GET_BRIDGE_INFO,
        OID_WAN_SET_BRIDGE_INFO,
        OID_WAN_GET_COMP_INFO,
        OID_WAN_SET_COMP_INFO,
#endif // FUTURE_OIDS
        0
};

#if DBG

/*
// Make sure the following list is in the same order as the list above!
*/
static char *SupportedOidNames[] =
{
        "OID_GEN_HARDWARE_STATUS",
        "OID_GEN_MEDIA_SUPPORTED",
        "OID_GEN_MEDIA_IN_USE",
        "OID_GEN_MAXIMUM_LOOKAHEAD",
        "OID_GEN_MAXIMUM_FRAME_SIZE",
        "OID_GEN_MAXIMUM_TOTAL_SIZE",
        "OID_GEN_MAC_OPTIONS",
        "OID_GEN_LINK_SPEED",
        "OID_GEN_TRANSMIT_BUFFER_SPACE",
        "OID_GEN_RECEIVE_BUFFER_SPACE",
        "OID_GEN_TRANSMIT_BLOCK_SIZE",
        "OID_GEN_RECEIVE_BLOCK_SIZE",
        "OID_GEN_VENDOR_ID",
        "OID_GEN_VENDOR_DESCRIPTION",
        "OID_GEN_DRIVER_VERSION",
        "OID_GEN_CURRENT_LOOKAHEAD",

        "OID_WAN_MEDIUM_SUBTYPE",
        "OID_WAN_GET_INFO",
        "OID_WAN_PERMANENT_ADDRESS",
        "OID_WAN_CURRENT_ADDRESS",
        "OID_WAN_GET_LINK_INFO",
        "OID_WAN_SET_LINK_INFO",
#ifdef FUTURE_OIDS
        "OID_WAN_QUALITY_OF_SERVICE",
        "OID_WAN_PROTOCOL_TYPE",
        "OID_WAN_HEADER_FORMAT",
        "OID_WAN_LINE_COUNT",
        "OID_WAN_GET_BRIDGE_INFO",
        "OID_WAN_SET_BRIDGE_INFO",
        "OID_WAN_GET_COMP_INFO",
        "OID_WAN_SET_COMP_INFO",
#endif // FUTURE_OIDS
        "OID_UNKNOWN"
};

#define NUM_OID_ENTRIES (sizeof(SupportedOidArray) / sizeof(SupportedOidArray[0]))

/*
// This debug routine will lookup the printable name for the selected OID.
*/
char *
HtGetOidString(NDIS_OID Oid)
{
    UINT i;

    for (i = 0; i < NUM_OID_ENTRIES-1; i++)
    {
        if (SupportedOidArray[i] == Oid)
        {
            break;
        }
    }
    return(SupportedOidNames[i]);
}

#endif // DBG

/*
// Returned from an OID_WAN_PERMANENT_ADDRESS HtDsuQueryInformation request.
// The WAN wrapper wants the miniport to return a unique address for this
// adapter.  This is used as an ethernet address presented to the protocols.
// The least significant bit of the first byte must not be a 1, or it could
// be interpreted as an ethernet multicast address.  If the vendor has an
// assigned ethernet vendor code (the first 3 bytes), they should be used
// to assure that the address does not conflict with another vendor's address.
// The last digit is replaced during the call with the adapter instance number.
*/
static UCHAR HtDsuWanAddress[6] = {'H','t','D','s','u','0'};

/*
// Returned from an OID_GEN_VENDOR_ID HtDsuQueryInformation request.
// Again, the vendor's assigned ethernet vendor code should be used if possible.
*/
static UCHAR HtDsuVendorID[4] = HTDSU_VENDOR_ID;

/*
// Returned from an OID_GEN_VENDOR_DESCRIPTION HtDsuQueryInformation request.
// This is an arbitrary string which may be used by upper layers to present
// a user friendly description of the adapter.
*/
static UCHAR HtDsuVendorDescription[] = HTDSU_VENDOR_DESCRPTION;


NDIS_STATUS
HtDsuQueryInformation(
    IN PHTDSU_ADAPTER Adapter,
    IN NDIS_OID Oid,
    IN PVOID InformationBuffer,
    IN ULONG InformationBufferLength,
    OUT PULONG BytesWritten,
    OUT PULONG BytesNeeded
    )

/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Functional Description:

    The MiniportQueryInformation request allows the inspection of the
    Miniport driver's capabilities and current status.

    If the Miniport does not complete the call immediately (by returning
    NDIS_STATUS_PENDING), it must call NdisMQueryInformationComplete to
    complete the call.  The Miniport controls the buffers pointed to by
    InformationBuffer, BytesWritten, and BytesNeeded until the request
    completes.

    No other requests will be submitted to the Miniport driver until
    this request has been completed.

    Note that the wrapper will intercept all queries of the following OIDs:
        OID_GEN_CURRENT_PACKET_FILTER,
        OID_GEN_PROTOCOL_OPTIONS,
        OID_802_5_CURRENT_FUNCTIONAL,
        OID_802_3_MULTICAST_LIST,
        OID_FDDI_LONG_MULTICAST_LIST,
        OID_FDDI_SHORT_MULTICAST_LIST.

    Interrupts are in any state during this call.

Parameters:

    MiniportAdapterContext _ The adapter handle passed to NdisMSetAttributes
                             during MiniportInitialize.

    Oid _ The OID.  (See section 7.4 of the NDIS 3.0 specification for a
          complete description of OIDs.)

    InformationBuffer _ The buffer that will receive the information.
                        (See section 7.4 of the NDIS 3.0 specification
                        for a description of the length required for each
                        OID.)

    InformationBufferLength _ The length in bytes of InformationBuffer.

    BytesWritten _ Returns the number of bytes written into
                   InformationBuffer.

    BytesNeeded _ This parameter returns the number of additional bytes
                  needed to satisfy the OID.

Return Values:

    NDIS_STATUS_INVALID_DATA
    NDIS_STATUS_INVALID_LENGTH
    NDIS_STATUS_INVALID_OID
    NDIS_STATUS_NOT_ACCEPTED
    NDIS_STATUS_NOT_SUPPORTED
    NDIS_STATUS_PENDING
    NDIS_STATUS_RESOURCES
    NDIS_STATUS_SUCCESS

---------------------------------------------------------------------------*/

{
    DBG_FUNC("HtDsuQueryInformation")

    /*
    // Holds the status result returned by this function.
    */
    NDIS_STATUS Status = NDIS_STATUS_NOT_SUPPORTED;

    /*
    // Pointer to driver data to be copied back to caller's InformationBuffer
    */
    PVOID SourceBuffer;

    /*
    // Number of bytes to be copied from driver.
    */
    ULONG SourceBufferLength;

    /*
    // Most return values are long integers, so this is used to hold the
    // return value of a constant or computed result.
    */
    ULONG GenericUlong = 0;

    /*
    // Like above, only short.
    */
    USHORT GenericUshort;

    /*
    // If this is a TAPI OID, pass it on over.
    */
    if ((Oid & 0xFFFFFF00L) == (OID_TAPI_ACCEPT & 0xFFFFFF00L))
    {
        Status = HtTapiQueryInformation(Adapter,
                        Oid,
                        InformationBuffer,
                        InformationBufferLength,
                        BytesWritten,
                        BytesNeeded
                        );
        return (Status);
    }

    DBG_ENTER(Adapter);
    DBG_FILTER(Adapter,DBG_REQUEST_ON,
              ("(OID=%s=%08x)\n\t\tInfoLength=%d InfoBuffer=%Xh\n",
               HtGetOidString(Oid),Oid,
               InformationBufferLength,
               InformationBuffer
              ));

    /*
    // Initialize these once, since this is the majority of cases.
    */
    SourceBuffer = &GenericUlong;
    SourceBufferLength = sizeof(ULONG);

    /*
    // Determine which OID is being requested and do the right thing.
    // Refer to section 7.4 of the NDIS 3.0 specification for a complete 
    // description of OIDs and their return values.
    */
    switch (Oid)
    {
    case OID_GEN_HARDWARE_STATUS:
        GenericUlong = Adapter->NeedReset ? 
                            NdisHardwareStatusNotReady :
                            NdisHardwareStatusReady;
        break;

    case OID_GEN_MEDIA_SUPPORTED:
        GenericUlong = NdisMediumWan;
        break;

    case OID_GEN_MEDIA_IN_USE:
        GenericUlong = NdisMediumWan;
        break;

    case OID_GEN_MAXIMUM_LOOKAHEAD:
        GenericUlong = HTDSU_MAX_LOOKAHEAD;
        break;

    case OID_GEN_MAXIMUM_FRAME_SIZE:
        GenericUlong = HTDSU_MAX_FRAME_SIZE;
        break;

    case OID_GEN_LINK_SPEED:
        GenericUlong = HTDSU_LINK_SPEED;
        break;

    case OID_GEN_TRANSMIT_BUFFER_SPACE:
        GenericUlong = HTDSU_MAX_PACKET_SIZE;
        break;

    case OID_GEN_RECEIVE_BUFFER_SPACE:
        GenericUlong = HTDSU_MAX_PACKET_SIZE;
        break;

    case OID_GEN_TRANSMIT_BLOCK_SIZE:
        GenericUlong = HTDSU_MAX_PACKET_SIZE;
        break;

    case OID_GEN_RECEIVE_BLOCK_SIZE:
        GenericUlong = HTDSU_MAX_PACKET_SIZE;
        break;

    case OID_GEN_VENDOR_ID:
        SourceBuffer = HtDsuVendorID;
        SourceBufferLength = sizeof(HtDsuVendorID);
        break;

    case OID_GEN_VENDOR_DESCRIPTION:
        SourceBuffer = HtDsuVendorDescription;
        SourceBufferLength = strlen(HtDsuVendorDescription) + 1;
        break;

    case OID_GEN_CURRENT_LOOKAHEAD:
        GenericUlong = HTDSU_MAX_LOOKAHEAD;
        break;

    case OID_GEN_MAC_OPTIONS:
        GenericUlong = NDIS_MAC_OPTION_RECEIVE_SERIALIZED |
                       NDIS_MAC_OPTION_NO_LOOPBACK |
                       NDIS_MAC_OPTION_TRANSFERS_NOT_PEND;
        break;

    case OID_GEN_DRIVER_VERSION:
        GenericUshort = (NDIS_MAJOR_VERSION << 8) + NDIS_MINOR_VERSION;
        SourceBuffer = &GenericUshort;
        SourceBufferLength = sizeof(USHORT);
        break;

    case OID_GEN_MAXIMUM_TOTAL_SIZE:
        GenericUlong = HTDSU_MAX_PACKET_SIZE;
        break;

    case OID_WAN_MEDIUM_SUBTYPE:
        GenericUlong = NdisWanMediumSW56K;
        break;

    case OID_WAN_GET_INFO:
        SourceBuffer = &Adapter->WanInfo;
        SourceBufferLength = sizeof(NDIS_WAN_INFO);
        break;

    case OID_WAN_PERMANENT_ADDRESS:
    case OID_WAN_CURRENT_ADDRESS:
        HtDsuWanAddress[5] = Adapter->InstanceNumber + '0';
        SourceBuffer = HtDsuWanAddress;
        SourceBufferLength = sizeof(HtDsuWanAddress);
        break;

    case OID_WAN_GET_LINK_INFO:
        {
            /*
            // The first field in the info buffer is a MiniportLinkContext
            // which is really a pointer to an entry in our link information.
            // If this aint so, bail out...
            */
            PHTDSU_LINK Link = (PHTDSU_LINK)
                (((PNDIS_WAN_SET_LINK_INFO)InformationBuffer)->NdisLinkHandle);

            if (!IS_VALID_LINK(Adapter, Link))
            {
                SourceBufferLength = 0;
                Status = NDIS_STATUS_INVALID_DATA;
                break;
            }

            DBG_NOTICE(Adapter,("Returning:\n"
                        "NdisLinkHandle   = %08lX\n"
                        "MaxSendFrameSize = %08lX\n"
                        "MaxRecvFrameSize = %08lX\n"
                        "SendFramingBits  = %08lX\n"
                        "RecvFramingBits  = %08lX\n"
                        "SendACCM         = %08lX\n"
                        "RecvACCM         = %08lX\n",
                        Link->WanLinkInfo.NdisLinkHandle   ,
                        Link->WanLinkInfo.MaxSendFrameSize ,
                        Link->WanLinkInfo.MaxRecvFrameSize ,
                        Link->WanLinkInfo.SendFramingBits  ,
                        Link->WanLinkInfo.RecvFramingBits  ,
                        Link->WanLinkInfo.SendACCM         ,
                        Link->WanLinkInfo.RecvACCM         ));

            SourceBuffer = &(Link->WanLinkInfo);
            SourceBufferLength = sizeof(NDIS_WAN_GET_LINK_INFO);
        }
        break;

    default:
        /*
        // Unknown OID
        */
        Status = NDIS_STATUS_INVALID_OID;
        SourceBufferLength = 0;
        break;
    }

    /*
    // Now we copy the data into the caller's buffer if there's enough room,
    // otherwise, we report the error and tell em how much we need.
    */
    if (SourceBufferLength > InformationBufferLength)
    {
        *BytesNeeded = SourceBufferLength;
        Status = NDIS_STATUS_INVALID_LENGTH;
    }
    else if (SourceBufferLength)
    {
        NdisMoveMemory(InformationBuffer,
                       SourceBuffer,
                       SourceBufferLength
                      );
        *BytesNeeded = *BytesWritten = SourceBufferLength;
        Status = NDIS_STATUS_SUCCESS;
    }
    else
    {
        *BytesNeeded = *BytesWritten = 0;
    }
    DBG_FILTER(Adapter,DBG_REQUEST_ON,
              ("RETURN: Status=%Xh Needed=%d Written=%d\n",
               Status, *BytesNeeded, *BytesWritten));
    DBG_LEAVE(Adapter);

    return (Status);
}


NDIS_STATUS
HtDsuSetInformation(
    IN PHTDSU_ADAPTER Adapter,
    IN NDIS_OID Oid,
    IN PVOID InformationBuffer,
    IN ULONG InformationBufferLength,
    OUT PULONG BytesRead,
    OUT PULONG BytesNeeded
    )

/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Functional Description:

    The MiniportSetInformation request allows for control of the Miniport
    by changing information maintained by the Miniport driver.

    Any of the settable NDIS Global Oids may be used. (see section 7.4 of
    the NDIS 3.0 specification for a complete description of the NDIS Oids.)

    If the Miniport does not complete the call immediately (by returning
    NDIS_STATUS_PENDING), it must call NdisMSetInformationComplete to
    complete the call.  The Miniport controls the buffers pointed to by
    InformationBuffer, BytesRead, and BytesNeeded until the request completes.

    Interrupts are in any state during the call, and no other requests will
    be submitted to the Miniport until this request is completed.

Parameters:

    MiniportAdapterContext _ The adapter handle passed to NdisMSetAttributes
                             during MiniportInitialize.

    Oid _ The OID.  (See section 7.4 of the NDIS 3.0 specification for
          a complete description of OIDs.)

    InformationBuffer _ The buffer that will receive the information.
                        (See section 7.4 of the NDIS 3.0 specification for
                        a description of the length required for each OID.)

    InformationBufferLength _ The length in bytes of InformationBuffer.

    BytesRead_ Returns the number of bytes read from InformationBuffer.

    BytesNeeded _ This parameter returns the number of additional bytes
                  expected to satisfy the OID.

Return Values:

    NDIS_STATUS_INVALID_DATA
    NDIS_STATUS_INVALID_LENGTH
    NDIS_STATUS_INVALID_OID
    NDIS_STATUS_NOT_ACCEPTED
    NDIS_STATUS_NOT_SUPPORTED
    NDIS_STATUS_PENDING
    NDIS_STATUS_RESOURCES
    NDIS_STATUS_SUCCESS

---------------------------------------------------------------------------*/

{
    DBG_FUNC("HtDsuSetInformation")

    /*
    // Holds the status result returned by this function.
    */
    NDIS_STATUS Status;

    /*
    // If this is a TAPI OID, pass it on over.
    */
    if ((Oid & 0xFFFFFF00L) == (OID_TAPI_ACCEPT & 0xFFFFFF00L))
    {
        Status = HtTapiSetInformation(Adapter,
                        Oid,
                        InformationBuffer,
                        InformationBufferLength,
                        BytesRead,
                        BytesNeeded
                        );
        return (Status);
    }

    DBG_ENTER(Adapter);
    DBG_FILTER(Adapter,DBG_REQUEST_ON,
              ("(OID=%s=%08x)\n\t\tInfoLength=%d InfoBuffer=%Xh\n",
               HtGetOidString(Oid),Oid,
               InformationBufferLength,
               InformationBuffer
              ));

    /*
    // Assume no extra bytes are needed.
    */
    ASSERT(BytesRead && BytesNeeded);
    *BytesRead = 0;
    *BytesNeeded = 0;

    /*
    // Determine which OID is being requested and do the right thing.
    */
    switch (Oid)
    {
    case OID_GEN_CURRENT_LOOKAHEAD:
        /*
        // WAN drivers always indicate the entire packet regardless of the
        // lookahead size.  So this request should be politely ignored.
        */
        DBG_NOTICE(Adapter,("OID_GEN_CURRENT_LOOKAHEAD: set=%d expected=%d\n",
                    *(PULONG) InformationBuffer, HTDSU_MAX_LOOKAHEAD));
        ASSERT(InformationBufferLength == sizeof(ULONG));
        *BytesNeeded = *BytesRead = sizeof(ULONG);
        Status = NDIS_STATUS_SUCCESS;
        break;

    case OID_WAN_SET_LINK_INFO:

        if (InformationBufferLength == sizeof(NDIS_WAN_SET_LINK_INFO))
        {
            /*
            // The first field in the info buffer is a MiniportLinkContext
            // which is really a pointer to an entry in our WanLinkArray.
            // If this aint so, bail out...
            */
            PHTDSU_LINK Link = (PHTDSU_LINK)
                (((PNDIS_WAN_SET_LINK_INFO)InformationBuffer)->NdisLinkHandle);

            if (Link == NULL)
            {
                Status = NDIS_STATUS_INVALID_DATA;
                break;
            }

            ASSERT(Link->WanLinkInfo.NdisLinkHandle == Link);
            ASSERT(Link->WanLinkInfo.MaxSendFrameSize <= Adapter->WanInfo.MaxFrameSize);
            ASSERT(Link->WanLinkInfo.MaxRecvFrameSize <= Adapter->WanInfo.MaxFrameSize);
            ASSERT(!(Link->WanLinkInfo.SendFramingBits & ~Adapter->WanInfo.FramingBits));
            ASSERT(!(Link->WanLinkInfo.RecvFramingBits & ~Adapter->WanInfo.FramingBits));

            /*
            // Copy the data into our WanLinkInfo sturcture.
            */
            NdisMoveMemory(&(Link->WanLinkInfo),
                           InformationBuffer,
                           InformationBufferLength
                          );
            *BytesRead = sizeof(NDIS_WAN_SET_LINK_INFO);
            Status = NDIS_STATUS_SUCCESS;

            DBG_NOTICE(Adapter,("\n                   setting    expected\n"
                        "NdisLinkHandle   = %08lX=?=%08lX\n"
                        "MaxSendFrameSize = %08lX=?=%08lX\n"
                        "MaxRecvFrameSize = %08lX=?=%08lX\n"
                        "SendFramingBits  = %08lX=?=%08lX\n"
                        "RecvFramingBits  = %08lX=?=%08lX\n"
                        "SendACCM         = %08lX=?=%08lX\n"
                        "RecvACCM         = %08lX=?=%08lX\n",
                        Link->WanLinkInfo.NdisLinkHandle   , Link,
                        Link->WanLinkInfo.MaxSendFrameSize , Adapter->WanInfo.MaxFrameSize,
                        Link->WanLinkInfo.MaxRecvFrameSize , Adapter->WanInfo.MaxFrameSize,
                        Link->WanLinkInfo.SendFramingBits  , Adapter->WanInfo.FramingBits,
                        Link->WanLinkInfo.RecvFramingBits  , Adapter->WanInfo.FramingBits,
                        Link->WanLinkInfo.SendACCM         , Adapter->WanInfo.DesiredACCM,
                        Link->WanLinkInfo.RecvACCM         , Adapter->WanInfo.DesiredACCM));
        }
        else
        {
            DBG_WARNING(Adapter, ("OID_WAN_SET_LINK_INFO: Invalid size:%d expected:%d\n",
                        InformationBufferLength, sizeof(NDIS_WAN_SET_LINK_INFO)));
            Status = NDIS_STATUS_INVALID_LENGTH;
        }
        *BytesNeeded = sizeof(NDIS_WAN_SET_LINK_INFO);
        break;

    default:
        /*
        // Unknown OID
        */
        Status = NDIS_STATUS_INVALID_OID;
        break;
    }
    DBG_FILTER(Adapter,DBG_REQUEST_ON,
              ("RETURN: Status=%Xh Needed=%d Read=%d\n",
               Status, *BytesNeeded, *BytesRead));
    DBG_LEAVE(Adapter);

    return (Status);
}