xref: /reactos/drivers/network/dd/rtl8139/info.c (revision 34593d93)
1*c2c66affSColin Finck /*
2*c2c66affSColin Finck  * ReactOS Realtek 8139 Driver
3*c2c66affSColin Finck  *
4*c2c66affSColin Finck  * Copyright (C) 2013 Cameron Gutman
5*c2c66affSColin Finck  *
6*c2c66affSColin Finck  * This program is free software; you can redistribute it and/or modify
7*c2c66affSColin Finck  * it under the terms of the GNU General Public License as published by
8*c2c66affSColin Finck  * the Free Software Foundation; either version 2 of the License, or
9*c2c66affSColin Finck  * (at your option) any later version.
10*c2c66affSColin Finck  *
11*c2c66affSColin Finck  * This program is distributed in the hope that it will be useful,
12*c2c66affSColin Finck  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13*c2c66affSColin Finck  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14*c2c66affSColin Finck  * GNU General Public License for more details.
15*c2c66affSColin Finck  *
16*c2c66affSColin Finck  * You should have received a copy of the GNU General Public License along
17*c2c66affSColin Finck  * with this program; if not, write to the Free Software Foundation, Inc.,
18*c2c66affSColin Finck  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19*c2c66affSColin Finck  *
20*c2c66affSColin Finck  */
21*c2c66affSColin Finck 
22*c2c66affSColin Finck #include "nic.h"
23*c2c66affSColin Finck 
24*c2c66affSColin Finck #define NDEBUG
25*c2c66affSColin Finck #include <debug.h>
26*c2c66affSColin Finck 
27*c2c66affSColin Finck static ULONG SupportedOidList[] =
28*c2c66affSColin Finck {
29*c2c66affSColin Finck     OID_GEN_SUPPORTED_LIST,
30*c2c66affSColin Finck     OID_GEN_HARDWARE_STATUS,
31*c2c66affSColin Finck     OID_GEN_MEDIA_SUPPORTED,
32*c2c66affSColin Finck     OID_GEN_MEDIA_IN_USE,
33*c2c66affSColin Finck     OID_GEN_MAXIMUM_LOOKAHEAD,
34*c2c66affSColin Finck     OID_GEN_MAXIMUM_FRAME_SIZE,
35*c2c66affSColin Finck     OID_GEN_LINK_SPEED,
36*c2c66affSColin Finck     OID_GEN_TRANSMIT_BUFFER_SPACE,
37*c2c66affSColin Finck     OID_GEN_RECEIVE_BUFFER_SPACE,
38*c2c66affSColin Finck     OID_GEN_RECEIVE_BLOCK_SIZE,
39*c2c66affSColin Finck     OID_GEN_TRANSMIT_BLOCK_SIZE,
40*c2c66affSColin Finck     OID_GEN_VENDOR_ID,
41*c2c66affSColin Finck     OID_GEN_VENDOR_DESCRIPTION,
42*c2c66affSColin Finck     OID_GEN_VENDOR_DRIVER_VERSION,
43*c2c66affSColin Finck     OID_GEN_CURRENT_PACKET_FILTER,
44*c2c66affSColin Finck     OID_GEN_CURRENT_LOOKAHEAD,
45*c2c66affSColin Finck     OID_GEN_DRIVER_VERSION,
46*c2c66affSColin Finck     OID_GEN_MAXIMUM_TOTAL_SIZE,
47*c2c66affSColin Finck     OID_GEN_PROTOCOL_OPTIONS,
48*c2c66affSColin Finck     OID_GEN_MAC_OPTIONS,
49*c2c66affSColin Finck     OID_GEN_MEDIA_CONNECT_STATUS,
50*c2c66affSColin Finck     OID_GEN_MAXIMUM_SEND_PACKETS,
51*c2c66affSColin Finck     OID_GEN_XMIT_OK,
52*c2c66affSColin Finck     OID_GEN_RCV_OK,
53*c2c66affSColin Finck     OID_GEN_XMIT_ERROR,
54*c2c66affSColin Finck     OID_GEN_RCV_ERROR,
55*c2c66affSColin Finck     OID_GEN_RCV_NO_BUFFER,
56*c2c66affSColin Finck     OID_GEN_RCV_CRC_ERROR,
57*c2c66affSColin Finck     OID_802_3_PERMANENT_ADDRESS,
58*c2c66affSColin Finck     OID_802_3_CURRENT_ADDRESS,
59*c2c66affSColin Finck     OID_802_3_MULTICAST_LIST,
60*c2c66affSColin Finck     OID_802_3_MAXIMUM_LIST_SIZE,
61*c2c66affSColin Finck     OID_802_3_MAC_OPTIONS,
62*c2c66affSColin Finck     OID_802_3_RCV_ERROR_ALIGNMENT,
63*c2c66affSColin Finck     OID_802_3_XMIT_ONE_COLLISION,
64*c2c66affSColin Finck     OID_802_3_XMIT_MORE_COLLISIONS
65*c2c66affSColin Finck };
66*c2c66affSColin Finck 
67*c2c66affSColin Finck NDIS_STATUS
68*c2c66affSColin Finck NTAPI
MiniportQueryInformation(IN NDIS_HANDLE MiniportAdapterContext,IN NDIS_OID Oid,IN PVOID InformationBuffer,IN ULONG InformationBufferLength,OUT PULONG BytesWritten,OUT PULONG BytesNeeded)69*c2c66affSColin Finck MiniportQueryInformation (
70*c2c66affSColin Finck     IN NDIS_HANDLE MiniportAdapterContext,
71*c2c66affSColin Finck     IN NDIS_OID Oid,
72*c2c66affSColin Finck     IN PVOID InformationBuffer,
73*c2c66affSColin Finck     IN ULONG InformationBufferLength,
74*c2c66affSColin Finck     OUT PULONG BytesWritten,
75*c2c66affSColin Finck     OUT PULONG BytesNeeded
76*c2c66affSColin Finck     )
77*c2c66affSColin Finck {
78*c2c66affSColin Finck     PRTL_ADAPTER adapter = (PRTL_ADAPTER)MiniportAdapterContext;
79*c2c66affSColin Finck     ULONG genericUlong;
80*c2c66affSColin Finck     ULONG copyLength;
81*c2c66affSColin Finck     PVOID copySource;
82*c2c66affSColin Finck     NDIS_STATUS status;
83*c2c66affSColin Finck 
84*c2c66affSColin Finck     status = NDIS_STATUS_SUCCESS;
85*c2c66affSColin Finck     copySource = &genericUlong;
86*c2c66affSColin Finck     copyLength = sizeof(ULONG);
87*c2c66affSColin Finck 
88*c2c66affSColin Finck     NdisAcquireSpinLock(&adapter->Lock);
89*c2c66affSColin Finck 
90*c2c66affSColin Finck     switch (Oid)
91*c2c66affSColin Finck     {
92*c2c66affSColin Finck         case OID_GEN_SUPPORTED_LIST:
93*c2c66affSColin Finck             copySource = (PVOID)&SupportedOidList;
94*c2c66affSColin Finck             copyLength = sizeof(SupportedOidList);
95*c2c66affSColin Finck             break;
96*c2c66affSColin Finck 
97*c2c66affSColin Finck         case OID_GEN_CURRENT_PACKET_FILTER:
98*c2c66affSColin Finck             genericUlong = adapter->PacketFilter;
99*c2c66affSColin Finck             break;
100*c2c66affSColin Finck 
101*c2c66affSColin Finck         case OID_GEN_HARDWARE_STATUS:
102*c2c66affSColin Finck             genericUlong = (ULONG)NdisHardwareStatusReady; //FIXME
103*c2c66affSColin Finck             break;
104*c2c66affSColin Finck 
105*c2c66affSColin Finck         case OID_GEN_MEDIA_SUPPORTED:
106*c2c66affSColin Finck         case OID_GEN_MEDIA_IN_USE:
107*c2c66affSColin Finck         {
108*c2c66affSColin Finck             static const NDIS_MEDIUM medium = NdisMedium802_3;
109*c2c66affSColin Finck             copySource = (PVOID)&medium;
110*c2c66affSColin Finck             copyLength = sizeof(medium);
111*c2c66affSColin Finck             break;
112*c2c66affSColin Finck         }
113*c2c66affSColin Finck 
114*c2c66affSColin Finck         case OID_GEN_RECEIVE_BLOCK_SIZE:
115*c2c66affSColin Finck         case OID_GEN_TRANSMIT_BLOCK_SIZE:
116*c2c66affSColin Finck         case OID_GEN_CURRENT_LOOKAHEAD:
117*c2c66affSColin Finck         case OID_GEN_MAXIMUM_LOOKAHEAD:
118*c2c66affSColin Finck         case OID_GEN_MAXIMUM_FRAME_SIZE:
119*c2c66affSColin Finck             genericUlong = MAXIMUM_FRAME_SIZE - sizeof(ETH_HEADER);
120*c2c66affSColin Finck             break;
121*c2c66affSColin Finck 
122*c2c66affSColin Finck         case OID_GEN_LINK_SPEED:
123*c2c66affSColin Finck             genericUlong = adapter->LinkSpeedMbps * 1000;
124*c2c66affSColin Finck             break;
125*c2c66affSColin Finck 
126*c2c66affSColin Finck         case OID_GEN_TRANSMIT_BUFFER_SPACE:
127*c2c66affSColin Finck             genericUlong = MAXIMUM_FRAME_SIZE;
128*c2c66affSColin Finck             break;
129*c2c66affSColin Finck 
130*c2c66affSColin Finck         case OID_GEN_RECEIVE_BUFFER_SPACE:
131*c2c66affSColin Finck             genericUlong = RECEIVE_BUFFER_SIZE;
132*c2c66affSColin Finck             break;
133*c2c66affSColin Finck 
134*c2c66affSColin Finck         case OID_GEN_VENDOR_ID:
135*c2c66affSColin Finck             //
136*c2c66affSColin Finck             // The 3 bytes of the MAC address is the vendor ID
137*c2c66affSColin Finck             //
138*c2c66affSColin Finck             genericUlong = 0;
139*c2c66affSColin Finck             genericUlong |= (adapter->PermanentMacAddress[0] << 16);
140*c2c66affSColin Finck             genericUlong |= (adapter->PermanentMacAddress[1] << 8);
141*c2c66affSColin Finck             genericUlong |= (adapter->PermanentMacAddress[2] & 0xFF);
142*c2c66affSColin Finck             break;
143*c2c66affSColin Finck 
144*c2c66affSColin Finck         case OID_GEN_VENDOR_DESCRIPTION:
145*c2c66affSColin Finck         {
146*c2c66affSColin Finck             static UCHAR vendorDesc[] = "ReactOS Team";
147*c2c66affSColin Finck             copySource = vendorDesc;
148*c2c66affSColin Finck             copyLength = sizeof(vendorDesc);
149*c2c66affSColin Finck             break;
150*c2c66affSColin Finck         }
151*c2c66affSColin Finck 
152*c2c66affSColin Finck         case OID_GEN_VENDOR_DRIVER_VERSION:
153*c2c66affSColin Finck             genericUlong = DRIVER_VERSION;
154*c2c66affSColin Finck             break;
155*c2c66affSColin Finck 
156*c2c66affSColin Finck         case OID_GEN_DRIVER_VERSION:
157*c2c66affSColin Finck         {
158*c2c66affSColin Finck             static const USHORT driverVersion =
159*c2c66affSColin Finck                  (NDIS_MINIPORT_MAJOR_VERSION << 8) + NDIS_MINIPORT_MINOR_VERSION;
160*c2c66affSColin Finck             copySource = (PVOID)&driverVersion;
161*c2c66affSColin Finck             copyLength = sizeof(driverVersion);
162*c2c66affSColin Finck             break;
163*c2c66affSColin Finck         }
164*c2c66affSColin Finck 
165*c2c66affSColin Finck         case OID_GEN_MAXIMUM_TOTAL_SIZE:
166*c2c66affSColin Finck             genericUlong = MAXIMUM_FRAME_SIZE;
167*c2c66affSColin Finck             break;
168*c2c66affSColin Finck 
169*c2c66affSColin Finck         case OID_GEN_PROTOCOL_OPTIONS:
170*c2c66affSColin Finck             NDIS_DbgPrint(MIN_TRACE, ("OID_GEN_PROTOCOL_OPTIONS is unimplemented\n"));
171*c2c66affSColin Finck             status = NDIS_STATUS_NOT_SUPPORTED;
172*c2c66affSColin Finck             break;
173*c2c66affSColin Finck 
174*c2c66affSColin Finck         case OID_GEN_MAC_OPTIONS:
175*c2c66affSColin Finck             genericUlong = NDIS_MAC_OPTION_RECEIVE_SERIALIZED |
176*c2c66affSColin Finck                            NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA |
177*c2c66affSColin Finck                            NDIS_MAC_OPTION_TRANSFERS_NOT_PEND |
178*c2c66affSColin Finck                            NDIS_MAC_OPTION_NO_LOOPBACK;
179*c2c66affSColin Finck             break;
180*c2c66affSColin Finck 
181*c2c66affSColin Finck         case OID_GEN_MEDIA_CONNECT_STATUS:
182*c2c66affSColin Finck             genericUlong = adapter->MediaState;
183*c2c66affSColin Finck             break;
184*c2c66affSColin Finck 
185*c2c66affSColin Finck         case OID_GEN_MAXIMUM_SEND_PACKETS:
186*c2c66affSColin Finck             genericUlong = 1;
187*c2c66affSColin Finck             break;
188*c2c66affSColin Finck 
189*c2c66affSColin Finck         case OID_802_3_CURRENT_ADDRESS:
190*c2c66affSColin Finck             copySource = adapter->CurrentMacAddress;
191*c2c66affSColin Finck             copyLength = IEEE_802_ADDR_LENGTH;
192*c2c66affSColin Finck             break;
193*c2c66affSColin Finck 
194*c2c66affSColin Finck         case OID_802_3_PERMANENT_ADDRESS:
195*c2c66affSColin Finck             copySource = adapter->PermanentMacAddress;
196*c2c66affSColin Finck             copyLength = IEEE_802_ADDR_LENGTH;
197*c2c66affSColin Finck             break;
198*c2c66affSColin Finck 
199*c2c66affSColin Finck         case OID_802_3_MAXIMUM_LIST_SIZE:
200*c2c66affSColin Finck             genericUlong = MAXIMUM_MULTICAST_ADDRESSES;
201*c2c66affSColin Finck             break;
202*c2c66affSColin Finck 
203*c2c66affSColin Finck         case OID_GEN_XMIT_OK:
204*c2c66affSColin Finck             genericUlong = adapter->TransmitOk;
205*c2c66affSColin Finck             break;
206*c2c66affSColin Finck 
207*c2c66affSColin Finck         case OID_GEN_RCV_OK:
208*c2c66affSColin Finck             genericUlong = adapter->ReceiveOk;
209*c2c66affSColin Finck             break;
210*c2c66affSColin Finck 
211*c2c66affSColin Finck         case OID_GEN_XMIT_ERROR:
212*c2c66affSColin Finck             genericUlong = adapter->TransmitError;
213*c2c66affSColin Finck             break;
214*c2c66affSColin Finck 
215*c2c66affSColin Finck         case OID_GEN_RCV_ERROR:
216*c2c66affSColin Finck             genericUlong = adapter->ReceiveError;
217*c2c66affSColin Finck             break;
218*c2c66affSColin Finck 
219*c2c66affSColin Finck         case OID_GEN_RCV_NO_BUFFER:
220*c2c66affSColin Finck             genericUlong = adapter->ReceiveNoBufferSpace;
221*c2c66affSColin Finck             break;
222*c2c66affSColin Finck 
223*c2c66affSColin Finck         case OID_GEN_RCV_CRC_ERROR:
224*c2c66affSColin Finck             genericUlong = adapter->ReceiveCrcError;
225*c2c66affSColin Finck             break;
226*c2c66affSColin Finck 
227*c2c66affSColin Finck         case OID_802_3_RCV_ERROR_ALIGNMENT:
228*c2c66affSColin Finck             genericUlong = adapter->ReceiveAlignmentError;
229*c2c66affSColin Finck             break;
230*c2c66affSColin Finck 
231*c2c66affSColin Finck         case OID_802_3_XMIT_ONE_COLLISION:
232*c2c66affSColin Finck             genericUlong = adapter->TransmitOneCollision;
233*c2c66affSColin Finck             break;
234*c2c66affSColin Finck 
235*c2c66affSColin Finck         case OID_802_3_XMIT_MORE_COLLISIONS:
236*c2c66affSColin Finck             genericUlong = adapter->TransmitMoreCollisions;
237*c2c66affSColin Finck             break;
238*c2c66affSColin Finck 
239*c2c66affSColin Finck         default:
240*c2c66affSColin Finck             NDIS_DbgPrint(MIN_TRACE, ("Unknown OID\n"));
241*c2c66affSColin Finck             status = NDIS_STATUS_NOT_SUPPORTED;
242*c2c66affSColin Finck             break;
243*c2c66affSColin Finck     }
244*c2c66affSColin Finck 
245*c2c66affSColin Finck     if (status == NDIS_STATUS_SUCCESS)
246*c2c66affSColin Finck     {
247*c2c66affSColin Finck         if (copyLength > InformationBufferLength)
248*c2c66affSColin Finck         {
249*c2c66affSColin Finck             *BytesNeeded = copyLength;
250*c2c66affSColin Finck             *BytesWritten = 0;
251*c2c66affSColin Finck             status = NDIS_STATUS_INVALID_LENGTH;
252*c2c66affSColin Finck         }
253*c2c66affSColin Finck         else
254*c2c66affSColin Finck         {
255*c2c66affSColin Finck             NdisMoveMemory(InformationBuffer, copySource, copyLength);
256*c2c66affSColin Finck             *BytesWritten = copyLength;
257*c2c66affSColin Finck             *BytesNeeded = copyLength;
258*c2c66affSColin Finck         }
259*c2c66affSColin Finck     }
260*c2c66affSColin Finck     else
261*c2c66affSColin Finck     {
262*c2c66affSColin Finck         *BytesWritten = 0;
263*c2c66affSColin Finck         *BytesNeeded = 0;
264*c2c66affSColin Finck     }
265*c2c66affSColin Finck 
266*c2c66affSColin Finck     NdisReleaseSpinLock(&adapter->Lock);
267*c2c66affSColin Finck 
268*c2c66affSColin Finck     NDIS_DbgPrint(MAX_TRACE, ("Query OID 0x%x: Completed with status 0x%x (%d, %d)\n",
269*c2c66affSColin Finck                               Oid, status, *BytesWritten, *BytesNeeded));
270*c2c66affSColin Finck 
271*c2c66affSColin Finck     return status;
272*c2c66affSColin Finck }
273*c2c66affSColin Finck 
274*c2c66affSColin Finck NDIS_STATUS
275*c2c66affSColin Finck NTAPI
MiniportSetInformation(IN NDIS_HANDLE MiniportAdapterContext,IN NDIS_OID Oid,IN PVOID InformationBuffer,IN ULONG InformationBufferLength,OUT PULONG BytesRead,OUT PULONG BytesNeeded)276*c2c66affSColin Finck MiniportSetInformation (
277*c2c66affSColin Finck     IN NDIS_HANDLE MiniportAdapterContext,
278*c2c66affSColin Finck     IN NDIS_OID Oid,
279*c2c66affSColin Finck     IN PVOID InformationBuffer,
280*c2c66affSColin Finck     IN ULONG InformationBufferLength,
281*c2c66affSColin Finck     OUT PULONG BytesRead,
282*c2c66affSColin Finck     OUT PULONG BytesNeeded
283*c2c66affSColin Finck     )
284*c2c66affSColin Finck {
285*c2c66affSColin Finck     PRTL_ADAPTER adapter = (PRTL_ADAPTER)MiniportAdapterContext;
286*c2c66affSColin Finck     ULONG genericUlong;
287*c2c66affSColin Finck     NDIS_STATUS status;
288*c2c66affSColin Finck 
289*c2c66affSColin Finck     status = NDIS_STATUS_SUCCESS;
290*c2c66affSColin Finck 
291*c2c66affSColin Finck     NdisAcquireSpinLock(&adapter->Lock);
292*c2c66affSColin Finck 
293*c2c66affSColin Finck     switch (Oid)
294*c2c66affSColin Finck     {
295*c2c66affSColin Finck         case OID_GEN_CURRENT_PACKET_FILTER:
296*c2c66affSColin Finck             if (InformationBufferLength < sizeof(ULONG))
297*c2c66affSColin Finck             {
298*c2c66affSColin Finck                 *BytesRead = 0;
299*c2c66affSColin Finck                 *BytesNeeded = sizeof(ULONG);
300*c2c66affSColin Finck                 status = NDIS_STATUS_INVALID_LENGTH;
301*c2c66affSColin Finck                 break;
302*c2c66affSColin Finck             }
303*c2c66affSColin Finck 
304*c2c66affSColin Finck             NdisMoveMemory(&genericUlong, InformationBuffer, sizeof(ULONG));
305*c2c66affSColin Finck 
306*c2c66affSColin Finck             if (genericUlong &
307*c2c66affSColin Finck                 (NDIS_PACKET_TYPE_ALL_FUNCTIONAL |
308*c2c66affSColin Finck                  NDIS_PACKET_TYPE_FUNCTIONAL |
309*c2c66affSColin Finck                  NDIS_PACKET_TYPE_GROUP |
310*c2c66affSColin Finck                  NDIS_PACKET_TYPE_MAC_FRAME |
311*c2c66affSColin Finck                  NDIS_PACKET_TYPE_SMT |
312*c2c66affSColin Finck                  NDIS_PACKET_TYPE_SOURCE_ROUTING))
313*c2c66affSColin Finck             {
314*c2c66affSColin Finck                 *BytesRead = sizeof(ULONG);
315*c2c66affSColin Finck                 *BytesNeeded = sizeof(ULONG);
316*c2c66affSColin Finck                 status = NDIS_STATUS_NOT_SUPPORTED;
317*c2c66affSColin Finck                 break;
318*c2c66affSColin Finck             }
319*c2c66affSColin Finck 
320*c2c66affSColin Finck             adapter->PacketFilter = genericUlong;
321*c2c66affSColin Finck 
322*c2c66affSColin Finck             status = NICApplyPacketFilter(adapter);
323*c2c66affSColin Finck             if (status != NDIS_STATUS_SUCCESS)
324*c2c66affSColin Finck             {
325*c2c66affSColin Finck                 NDIS_DbgPrint(MIN_TRACE, ("Failed to apply new packet filter\n"));
326*c2c66affSColin Finck                 break;
327*c2c66affSColin Finck             }
328*c2c66affSColin Finck 
329*c2c66affSColin Finck             break;
330*c2c66affSColin Finck 
331*c2c66affSColin Finck         case OID_GEN_CURRENT_LOOKAHEAD:
332*c2c66affSColin Finck             if (InformationBufferLength < sizeof(ULONG))
333*c2c66affSColin Finck             {
334*c2c66affSColin Finck                 *BytesRead = 0;
335*c2c66affSColin Finck                 *BytesNeeded = sizeof(ULONG);
336*c2c66affSColin Finck                 status = NDIS_STATUS_INVALID_LENGTH;
337*c2c66affSColin Finck                 break;
338*c2c66affSColin Finck             }
339*c2c66affSColin Finck 
340*c2c66affSColin Finck             NdisMoveMemory(&genericUlong, InformationBuffer, sizeof(ULONG));
341*c2c66affSColin Finck 
342*c2c66affSColin Finck             if (genericUlong > MAXIMUM_FRAME_SIZE - sizeof(ETH_HEADER))
343*c2c66affSColin Finck             {
344*c2c66affSColin Finck                 status = NDIS_STATUS_INVALID_DATA;
345*c2c66affSColin Finck             }
346*c2c66affSColin Finck             else
347*c2c66affSColin Finck             {
348*c2c66affSColin Finck                 // Ignore this...
349*c2c66affSColin Finck             }
350*c2c66affSColin Finck 
351*c2c66affSColin Finck             break;
352*c2c66affSColin Finck 
353*c2c66affSColin Finck         case OID_802_3_MULTICAST_LIST:
354*c2c66affSColin Finck             if (InformationBufferLength % IEEE_802_ADDR_LENGTH)
355*c2c66affSColin Finck             {
356*c2c66affSColin Finck                 *BytesRead = 0;
357*c2c66affSColin Finck                 *BytesNeeded = InformationBufferLength + (InformationBufferLength % IEEE_802_ADDR_LENGTH);
358*c2c66affSColin Finck                 status = NDIS_STATUS_INVALID_LENGTH;
359*c2c66affSColin Finck                 break;
360*c2c66affSColin Finck             }
361*c2c66affSColin Finck 
362*c2c66affSColin Finck             if (InformationBufferLength / 6 > MAXIMUM_MULTICAST_ADDRESSES)
363*c2c66affSColin Finck             {
364*c2c66affSColin Finck                 *BytesNeeded = MAXIMUM_MULTICAST_ADDRESSES * IEEE_802_ADDR_LENGTH;
365*c2c66affSColin Finck                 *BytesRead = 0;
366*c2c66affSColin Finck                 status = NDIS_STATUS_INVALID_LENGTH;
367*c2c66affSColin Finck                 break;
368*c2c66affSColin Finck             }
369*c2c66affSColin Finck 
370*c2c66affSColin Finck             NdisMoveMemory(adapter->MulticastList, InformationBuffer, InformationBufferLength);
371*c2c66affSColin Finck 
372*c2c66affSColin Finck             // FIXME: Write to device
373*c2c66affSColin Finck 
374*c2c66affSColin Finck             break;
375*c2c66affSColin Finck 
376*c2c66affSColin Finck         default:
377*c2c66affSColin Finck             NDIS_DbgPrint(MIN_TRACE, ("Unknown OID\n"));
378*c2c66affSColin Finck             status = NDIS_STATUS_NOT_SUPPORTED;
379*c2c66affSColin Finck             *BytesRead = 0;
380*c2c66affSColin Finck             *BytesNeeded = 0;
381*c2c66affSColin Finck             break;
382*c2c66affSColin Finck     }
383*c2c66affSColin Finck 
384*c2c66affSColin Finck     if (status == NDIS_STATUS_SUCCESS)
385*c2c66affSColin Finck     {
386*c2c66affSColin Finck         *BytesRead = InformationBufferLength;
387*c2c66affSColin Finck         *BytesNeeded = 0;
388*c2c66affSColin Finck     }
389*c2c66affSColin Finck 
390*c2c66affSColin Finck     NdisReleaseSpinLock(&adapter->Lock);
391*c2c66affSColin Finck 
392*c2c66affSColin Finck     return status;
393*c2c66affSColin Finck }
394