Windows NT 4.0 source code leak
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

954 lines
22 KiB

4 years ago
  1. /*++
  2. Copyright (c) 1991 Microsoft Corporation
  3. Module Name:
  4. request.c
  5. Abstract:
  6. This file contains code to implement request processing.
  7. This driver conforms to the NDIS 3.0 miniport interface.
  8. Author:
  9. Johnson R. Apacible (JohnsonA) 10-June-1991
  10. Environment:
  11. Revision History:
  12. --*/
  13. #include <ne3200sw.h>
  14. extern
  15. NDIS_STATUS
  16. NE3200ChangeClass(
  17. PNE3200_ADAPTER Adapter,
  18. IN UINT NewFilterClasses
  19. )
  20. /*++
  21. Routine Description:
  22. Action routine that will get called when a particular filter
  23. class is first used or last cleared.
  24. Arguments:
  25. NewFilterClasses - The current value of the class filter
  26. Return Value:
  27. None.
  28. --*/
  29. {
  30. //
  31. // Holds the change that should be returned to the filtering package.
  32. //
  33. NDIS_STATUS StatusOfChange;
  34. //
  35. // Holds the list of changes;
  36. //
  37. UINT PacketChanges;
  38. //
  39. // This points to the public Command Block.
  40. //
  41. PNE3200_SUPER_COMMAND_BLOCK CommandBlock;
  42. //
  43. // This points to the adapter's configuration block.
  44. //
  45. PNE3200_CONFIGURATION_BLOCK ConfigurationBlock =
  46. Adapter->ConfigurationBlock;
  47. //
  48. // The NE3200 has no method for easily disabling multicast
  49. // packets. Therefore, we'll only reconfigure the 82586
  50. // when there is a change in either directed, broadcast, or
  51. // promiscuous filtering.
  52. //
  53. PacketChanges = (Adapter->CurrentPacketFilter ^ NewFilterClasses) &
  54. (NDIS_PACKET_TYPE_PROMISCUOUS |
  55. NDIS_PACKET_TYPE_BROADCAST |
  56. NDIS_PACKET_TYPE_DIRECTED);
  57. if (!PacketChanges) {
  58. return(NDIS_STATUS_SUCCESS);
  59. }
  60. //
  61. // Use the generic command block
  62. //
  63. IF_LOG('F');
  64. NE3200AcquirePublicCommandBlock(
  65. Adapter,
  66. &CommandBlock
  67. );
  68. //
  69. // This from a set.
  70. //
  71. CommandBlock->Set = TRUE;
  72. //
  73. // Setup the command block.
  74. //
  75. CommandBlock->NextCommand = NULL;
  76. CommandBlock->Hardware.State = NE3200_STATE_WAIT_FOR_ADAPTER;
  77. CommandBlock->Hardware.Status = 0;
  78. CommandBlock->Hardware.NextPending = NE3200_NULL;
  79. CommandBlock->Hardware.CommandCode =
  80. NE3200_COMMAND_CONFIGURE_82586;
  81. CommandBlock->Hardware.PARAMETERS.CONFIGURE.ConfigurationBlock =
  82. NdisGetPhysicalAddressLow(Adapter->ConfigurationBlockPhysical);
  83. //
  84. // Update the configuration block to reflect the new
  85. // packet filtering.
  86. //
  87. if (NewFilterClasses == 0) {
  88. ConfigurationBlock->PromiscuousMode = 0;
  89. ConfigurationBlock->MacBinPromiscuous = 0;
  90. ConfigurationBlock->DisableBroadcast = 1;
  91. } else {
  92. ConfigurationBlock->MacBinEnablePacketReception = 1;
  93. if (PacketChanges & NDIS_PACKET_TYPE_PROMISCUOUS) {
  94. ConfigurationBlock->PromiscuousMode = 1;
  95. ConfigurationBlock->MacBinPromiscuous = 1;
  96. } else {
  97. ConfigurationBlock->PromiscuousMode = 0;
  98. ConfigurationBlock->MacBinPromiscuous = 0;
  99. }
  100. if (PacketChanges & NDIS_PACKET_TYPE_BROADCAST) {
  101. ConfigurationBlock->DisableBroadcast = 0;
  102. } else {
  103. ConfigurationBlock->DisableBroadcast = 1;
  104. }
  105. }
  106. //
  107. // Now that we've got the command block built,
  108. // let's do it!
  109. //
  110. NE3200SubmitCommandBlock(Adapter, CommandBlock);
  111. StatusOfChange = NDIS_STATUS_PENDING;
  112. return StatusOfChange;
  113. }
  114. STATIC
  115. NDIS_STATUS
  116. NE3200UpdateMulticastTable(
  117. IN PNE3200_ADAPTER Adapter,
  118. IN UINT CurrentAddressCount,
  119. IN CHAR CurrentAddresses[][NE3200_LENGTH_OF_ADDRESS]
  120. )
  121. /*++
  122. Routine Description:
  123. This routine is called to update the list of multicast addreses
  124. on the adapter.
  125. Arguments:
  126. Adapter - The adapter where the multicast is to be changed.
  127. CurrentAddressCount - The number of addresses in the address array.
  128. CurrentAddresses - An array of multicast addresses. Note that this
  129. array already contains the new address.
  130. Return Value:
  131. None.
  132. --*/
  133. {
  134. //
  135. // This points to the public Command Block.
  136. //
  137. PNE3200_SUPER_COMMAND_BLOCK CommandBlock;
  138. //
  139. // Holds the status that should be returned to the filtering package.
  140. //
  141. NDIS_STATUS StatusOfUpdate;
  142. //
  143. // Multicast address table
  144. //
  145. PUCHAR MulticastAddressTable;
  146. IF_LOG('f');
  147. //
  148. // See if we can acquire a private command block.
  149. //
  150. NE3200AcquirePublicCommandBlock(Adapter, &CommandBlock);
  151. //
  152. // Store the request that uses this command block.
  153. //
  154. CommandBlock->Set = TRUE;
  155. //
  156. // Get the multicast address table.
  157. //
  158. MulticastAddressTable = Adapter->CardMulticastTable;
  159. //
  160. // Clear out the old address
  161. //
  162. NdisZeroMemory(
  163. MulticastAddressTable,
  164. CurrentAddressCount * NE3200_SIZE_OF_MULTICAST_TABLE_ENTRY
  165. );
  166. {
  167. //
  168. // Simple iteration counter.
  169. //
  170. UINT i;
  171. //
  172. // Pointer into the multicast address table.
  173. //
  174. PCHAR OriginalAddress;
  175. //
  176. // Pointer into our temporary buffer.
  177. //
  178. PCHAR MungedAddress;
  179. //
  180. // Munge the address to 16 bytes per entry.
  181. //
  182. OriginalAddress = &CurrentAddresses[0][0];
  183. MungedAddress = MulticastAddressTable;
  184. for ( i = CurrentAddressCount ; i > 0 ; i-- ) {
  185. NdisMoveMemory(
  186. MungedAddress,
  187. OriginalAddress,
  188. NE3200_LENGTH_OF_ADDRESS
  189. );
  190. OriginalAddress += NE3200_LENGTH_OF_ADDRESS;
  191. MungedAddress += NE3200_SIZE_OF_MULTICAST_TABLE_ENTRY;
  192. }
  193. //
  194. // Setup the command block.
  195. //
  196. CommandBlock->NextCommand = NULL;
  197. CommandBlock->Hardware.State = NE3200_STATE_WAIT_FOR_ADAPTER;
  198. CommandBlock->Hardware.Status = 0;
  199. CommandBlock->Hardware.NextPending = NE3200_NULL;
  200. CommandBlock->Hardware.CommandCode = NE3200_COMMAND_SET_MULTICAST_ADDRESS;
  201. CommandBlock->Hardware.PARAMETERS.MULTICAST.NumberOfMulticastAddresses =
  202. (USHORT)CurrentAddressCount;
  203. if (CurrentAddressCount == 0) {
  204. CommandBlock->Hardware.PARAMETERS.MULTICAST.MulticastAddressTable =
  205. (NE3200_PHYSICAL_ADDRESS)NULL;
  206. } else {
  207. CommandBlock->Hardware.PARAMETERS.MULTICAST.MulticastAddressTable =
  208. NdisGetPhysicalAddressLow(Adapter->CardMulticastTablePhysical);
  209. }
  210. //
  211. // Now that we've got the command block built,
  212. // let's do it!
  213. //
  214. NE3200SubmitCommandBlock(Adapter, CommandBlock);
  215. StatusOfUpdate = NDIS_STATUS_PENDING;
  216. }
  217. return StatusOfUpdate;
  218. }
  219. extern
  220. NDIS_STATUS
  221. NE3200SetInformation(
  222. IN NDIS_HANDLE MiniportAdapterContext,
  223. IN NDIS_OID Oid,
  224. IN PVOID InformationBuffer,
  225. IN ULONG InformationBufferLength,
  226. OUT PULONG BytesRead,
  227. OUT PULONG BytesNeeded
  228. )
  229. /*++
  230. Routine Description:
  231. NE3200SetInformation handles a set operation for a
  232. single OID.
  233. Arguments:
  234. MiniportAdapterContext - The adapter that the set is for.
  235. Oid - The OID of the set.
  236. InformationBuffer - Holds the data to be set.
  237. InformationBufferLength - The length of InformationBuffer.
  238. BytesRead - If the call is successful, returns the number
  239. of bytes read from InformationBuffer.
  240. BytesNeeded - If there is not enough data in OvbBuffer
  241. to satisfy the OID, returns the amount of storage needed.
  242. Return Value:
  243. NDIS_STATUS_SUCCESS
  244. NDIS_STATUS_PENDING
  245. NDIS_STATUS_INVALID_LENGTH
  246. NDIS_STATUS_INVALID_OID
  247. --*/
  248. {
  249. //
  250. // Variable to hold the new packet filter
  251. //
  252. ULONG PacketFilter;
  253. //
  254. // The adapter to process the request for.
  255. //
  256. PNE3200_ADAPTER Adapter = PNE3200_ADAPTER_FROM_CONTEXT_HANDLE(MiniportAdapterContext);
  257. //
  258. // Status of NDIS operation
  259. //
  260. NDIS_STATUS Status;
  261. IF_LOG('w');
  262. //
  263. // Now check for the most common OIDs
  264. //
  265. switch (Oid) {
  266. case OID_802_3_MULTICAST_LIST:
  267. if (InformationBufferLength % NE3200_LENGTH_OF_ADDRESS != 0) {
  268. //
  269. // The data must be a multiple of the Ethernet
  270. // address size.
  271. //
  272. return(NDIS_STATUS_INVALID_DATA);
  273. }
  274. //
  275. // Now call the routine that does this.
  276. //
  277. Status = NE3200UpdateMulticastTable(
  278. Adapter,
  279. InformationBufferLength /
  280. NE3200_LENGTH_OF_ADDRESS,
  281. InformationBuffer
  282. );
  283. *BytesRead = InformationBufferLength;
  284. break;
  285. case OID_GEN_CURRENT_PACKET_FILTER:
  286. if (InformationBufferLength != 4) {
  287. return NDIS_STATUS_INVALID_DATA;
  288. }
  289. //
  290. // Now call the filter package to set the packet filter.
  291. //
  292. NdisMoveMemory ((PVOID)&PacketFilter, InformationBuffer, sizeof(ULONG));
  293. //
  294. // Verify bits
  295. //
  296. if (PacketFilter & (NDIS_PACKET_TYPE_SOURCE_ROUTING |
  297. NDIS_PACKET_TYPE_SMT |
  298. NDIS_PACKET_TYPE_MAC_FRAME |
  299. NDIS_PACKET_TYPE_FUNCTIONAL |
  300. NDIS_PACKET_TYPE_ALL_FUNCTIONAL |
  301. NDIS_PACKET_TYPE_ALL_MULTICAST |
  302. NDIS_PACKET_TYPE_GROUP
  303. )) {
  304. Status = NDIS_STATUS_NOT_SUPPORTED;
  305. *BytesRead = 4;
  306. *BytesNeeded = 0;
  307. break;
  308. }
  309. //
  310. // Submit the change
  311. //
  312. Status = NE3200ChangeClass(
  313. Adapter,
  314. PacketFilter
  315. );
  316. *BytesRead = InformationBufferLength;
  317. break;
  318. case OID_GEN_CURRENT_LOOKAHEAD:
  319. *BytesRead = 4;
  320. Status = NDIS_STATUS_SUCCESS;
  321. break;
  322. default:
  323. Status = NDIS_STATUS_INVALID_OID;
  324. break;
  325. }
  326. if (Status == NDIS_STATUS_PENDING) {
  327. Adapter->RequestInProgress = TRUE;
  328. }
  329. IF_LOG('W');
  330. return Status;
  331. }
  332. STATIC
  333. NDIS_STATUS
  334. NE3200QueryInformation(
  335. IN NDIS_HANDLE MiniportAdapterContext,
  336. IN NDIS_OID Oid,
  337. IN PVOID InformationBuffer,
  338. IN ULONG InformationBufferLength,
  339. OUT PULONG BytesWritten,
  340. OUT PULONG BytesNeeded
  341. )
  342. /*++
  343. Routine Description:
  344. The NE3200QueryInformation process a Query request for
  345. NDIS_OIDs that are specific about the Driver.
  346. Arguments:
  347. MiniportAdapterContext - a pointer to the adapter.
  348. Oid - the NDIS_OID to process.
  349. InformationBuffer - a pointer into the
  350. NdisRequest->InformationBuffer into which store the result of the query.
  351. InformationBufferLength - a pointer to the number of bytes left in the
  352. InformationBuffer.
  353. BytesWritten - a pointer to the number of bytes written into the
  354. InformationBuffer.
  355. BytesNeeded - If there is not enough room in the information buffer
  356. then this will contain the number of bytes needed to complete the
  357. request.
  358. Return Value:
  359. The function value is the status of the operation.
  360. --*/
  361. {
  362. //
  363. // The command block for getting the statistics from the adapter.
  364. //
  365. PNE3200_SUPER_COMMAND_BLOCK CommandBlock;
  366. //
  367. // The adapter to process the request for.
  368. //
  369. PNE3200_ADAPTER Adapter = PNE3200_ADAPTER_FROM_CONTEXT_HANDLE(MiniportAdapterContext);
  370. //
  371. // Save the information about the request
  372. //
  373. Adapter->BytesWritten = BytesWritten;
  374. Adapter->BytesNeeded = BytesNeeded;
  375. Adapter->Oid = Oid;
  376. Adapter->InformationBuffer = InformationBuffer;
  377. Adapter->InformationBufferLength = InformationBufferLength;
  378. IF_LOG('?');
  379. //
  380. // Get a public command block. This will succeed since
  381. // the wrapper will only give one request at a time, and
  382. // there are more than 1 public command block.
  383. //
  384. NE3200AcquirePublicCommandBlock(Adapter,
  385. &CommandBlock
  386. );
  387. //
  388. // Store the request that uses this CB
  389. //
  390. CommandBlock->Set = TRUE;
  391. //
  392. // Setup the command block.
  393. //
  394. CommandBlock->NextCommand = NULL;
  395. CommandBlock->Hardware.State = NE3200_STATE_WAIT_FOR_ADAPTER;
  396. CommandBlock->Hardware.Status = 0;
  397. CommandBlock->Hardware.NextPending = NE3200_NULL;
  398. CommandBlock->Hardware.CommandCode = NE3200_COMMAND_READ_ADAPTER_STATISTICS;
  399. //
  400. // Now that we're set up, let's do it!
  401. //
  402. Adapter->RequestInProgress = TRUE;
  403. NE3200SubmitCommandBlock(Adapter, CommandBlock);
  404. //
  405. // Catch the ball at the interrupt handler
  406. //
  407. IF_LOG('/');
  408. return NDIS_STATUS_PENDING;
  409. }
  410. STATIC
  411. VOID
  412. NE3200FinishQueryInformation(
  413. IN PNE3200_ADAPTER Adapter
  414. )
  415. /*++
  416. Routine Description:
  417. The NE3200FinishQueryInformation finish processing a Query request for
  418. NDIS_OIDs that are specific about the Driver.
  419. Arguments:
  420. Adapter - a pointer to the adapter.
  421. Return Value:
  422. The function value is the status of the operation.
  423. --*/
  424. {
  425. static
  426. NDIS_OID NE3200GlobalSupportedOids[] = {
  427. OID_GEN_SUPPORTED_LIST,
  428. OID_GEN_HARDWARE_STATUS,
  429. OID_GEN_MEDIA_SUPPORTED,
  430. OID_GEN_MEDIA_IN_USE,
  431. OID_GEN_MAXIMUM_LOOKAHEAD,
  432. OID_GEN_MAXIMUM_FRAME_SIZE,
  433. OID_GEN_MAXIMUM_TOTAL_SIZE,
  434. OID_GEN_MAC_OPTIONS,
  435. OID_GEN_PROTOCOL_OPTIONS,
  436. OID_GEN_LINK_SPEED,
  437. OID_GEN_TRANSMIT_BUFFER_SPACE,
  438. OID_GEN_RECEIVE_BUFFER_SPACE,
  439. OID_GEN_TRANSMIT_BLOCK_SIZE,
  440. OID_GEN_RECEIVE_BLOCK_SIZE,
  441. OID_GEN_VENDOR_ID,
  442. OID_GEN_VENDOR_DESCRIPTION,
  443. OID_GEN_DRIVER_VERSION,
  444. OID_GEN_CURRENT_PACKET_FILTER,
  445. OID_GEN_CURRENT_LOOKAHEAD,
  446. OID_GEN_XMIT_OK,
  447. OID_GEN_RCV_OK,
  448. OID_GEN_XMIT_ERROR,
  449. OID_GEN_RCV_ERROR,
  450. OID_GEN_RCV_NO_BUFFER,
  451. OID_GEN_RCV_CRC_ERROR,
  452. OID_GEN_TRANSMIT_QUEUE_LENGTH,
  453. OID_802_3_PERMANENT_ADDRESS,
  454. OID_802_3_CURRENT_ADDRESS,
  455. OID_802_3_MULTICAST_LIST,
  456. OID_802_3_MAXIMUM_LIST_SIZE,
  457. OID_802_3_RCV_ERROR_ALIGNMENT,
  458. OID_802_3_XMIT_ONE_COLLISION,
  459. OID_802_3_XMIT_MORE_COLLISIONS,
  460. OID_802_3_XMIT_DEFERRED,
  461. OID_802_3_XMIT_MAX_COLLISIONS,
  462. OID_802_3_RCV_OVERRUN,
  463. OID_802_3_XMIT_UNDERRUN,
  464. OID_802_3_XMIT_HEARTBEAT_FAILURE,
  465. OID_802_3_XMIT_TIMES_CRS_LOST,
  466. OID_802_3_XMIT_LATE_COLLISIONS
  467. };
  468. //
  469. // Get the saved information about the request.
  470. //
  471. PUINT BytesWritten = Adapter->BytesWritten;
  472. PUINT BytesNeeded = Adapter->BytesNeeded;
  473. NDIS_OID Oid = Adapter->Oid;
  474. PVOID InformationBuffer = Adapter->InformationBuffer;
  475. UINT InformationBufferLength = Adapter->InformationBufferLength;
  476. //
  477. // Variables for holding the data that satisfies the request.
  478. //
  479. NDIS_MEDIUM Medium = NdisMedium802_3;
  480. UINT GenericUlong;
  481. USHORT GenericUShort;
  482. UCHAR GenericArray[6];
  483. NDIS_HARDWARE_STATUS HardwareStatus;
  484. //
  485. // Common variables for pointing to result of query
  486. //
  487. PVOID MoveSource = (PVOID)(&GenericUlong);
  488. ULONG MoveBytes = sizeof(ULONG);
  489. //
  490. // The status of the request.
  491. //
  492. NDIS_STATUS Status = NDIS_STATUS_SUCCESS;
  493. //
  494. // Initialize the result
  495. //
  496. *BytesWritten = 0;
  497. *BytesNeeded = 0;
  498. IF_LOG('!');
  499. //
  500. // Switch on request type
  501. //
  502. switch(Oid){
  503. case OID_GEN_MAC_OPTIONS:
  504. GenericUlong = (ULONG)(NDIS_MAC_OPTION_TRANSFERS_NOT_PEND |
  505. NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA |
  506. NDIS_MAC_OPTION_RECEIVE_SERIALIZED |
  507. NDIS_MAC_OPTION_NO_LOOPBACK
  508. );
  509. break;
  510. case OID_GEN_SUPPORTED_LIST:
  511. MoveSource = (PVOID)(NE3200GlobalSupportedOids);
  512. MoveBytes = sizeof(NE3200GlobalSupportedOids);
  513. break;
  514. case OID_GEN_HARDWARE_STATUS:
  515. if (Adapter->ResetInProgress){
  516. HardwareStatus = NdisHardwareStatusReset;
  517. } else {
  518. HardwareStatus = NdisHardwareStatusReady;
  519. }
  520. MoveSource = (PVOID)(&HardwareStatus);
  521. MoveBytes = sizeof(NDIS_HARDWARE_STATUS);
  522. break;
  523. case OID_GEN_MEDIA_SUPPORTED:
  524. case OID_GEN_MEDIA_IN_USE:
  525. MoveSource = (PVOID) (&Medium);
  526. MoveBytes = sizeof(NDIS_MEDIUM);
  527. break;
  528. case OID_GEN_MAXIMUM_LOOKAHEAD:
  529. case OID_GEN_CURRENT_LOOKAHEAD:
  530. case OID_GEN_MAXIMUM_FRAME_SIZE:
  531. GenericUlong = (ULONG) (MAXIMUM_ETHERNET_PACKET_SIZE - NE3200_HEADER_SIZE);
  532. break;
  533. case OID_GEN_MAXIMUM_TOTAL_SIZE:
  534. case OID_GEN_TRANSMIT_BLOCK_SIZE:
  535. case OID_GEN_RECEIVE_BLOCK_SIZE:
  536. GenericUlong = (ULONG) (MAXIMUM_ETHERNET_PACKET_SIZE);
  537. break;
  538. case OID_GEN_LINK_SPEED:
  539. //
  540. // 10 Mbps
  541. //
  542. GenericUlong = (ULONG)100000;
  543. break;
  544. case OID_GEN_TRANSMIT_BUFFER_SPACE:
  545. GenericUlong = (ULONG) MAXIMUM_ETHERNET_PACKET_SIZE *
  546. NE3200_NUMBER_OF_TRANSMIT_BUFFERS;
  547. break;
  548. case OID_GEN_RECEIVE_BUFFER_SPACE:
  549. GenericUlong = (ULONG) MAXIMUM_ETHERNET_PACKET_SIZE *
  550. NE3200_NUMBER_OF_RECEIVE_BUFFERS;
  551. break;
  552. case OID_GEN_VENDOR_ID:
  553. NdisMoveMemory(
  554. (PVOID)&GenericUlong,
  555. Adapter->NetworkAddress,
  556. 3
  557. );
  558. GenericUlong &= 0xFFFFFF00;
  559. MoveSource = (PVOID)(&GenericUlong);
  560. MoveBytes = sizeof(GenericUlong);
  561. break;
  562. case OID_GEN_VENDOR_DESCRIPTION:
  563. MoveSource = (PVOID)"NE3200 Adapter";
  564. MoveBytes = 15;
  565. break;
  566. case OID_GEN_DRIVER_VERSION:
  567. GenericUShort = (USHORT)0x0300;
  568. MoveSource = (PVOID)(&GenericUShort);
  569. MoveBytes = sizeof(GenericUShort);
  570. break;
  571. case OID_802_3_PERMANENT_ADDRESS:
  572. NdisMoveMemory(
  573. (PCHAR)GenericArray,
  574. Adapter->NetworkAddress,
  575. NE3200_LENGTH_OF_ADDRESS
  576. );
  577. MoveSource = (PVOID)(GenericArray);
  578. MoveBytes = NE3200_LENGTH_OF_ADDRESS;
  579. break;
  580. case OID_802_3_CURRENT_ADDRESS:
  581. NdisMoveMemory(
  582. (PCHAR)GenericArray,
  583. Adapter->CurrentAddress,
  584. NE3200_LENGTH_OF_ADDRESS
  585. );
  586. MoveSource = (PVOID)(GenericArray);
  587. MoveBytes = NE3200_LENGTH_OF_ADDRESS;
  588. break;
  589. case OID_802_3_MAXIMUM_LIST_SIZE:
  590. GenericUlong = (ULONG) NE3200_MAXIMUM_MULTICAST;
  591. break;
  592. default:
  593. switch(Oid){
  594. case OID_GEN_XMIT_OK:
  595. GenericUlong = (ULONG) Adapter->GoodTransmits;
  596. break;
  597. case OID_GEN_RCV_OK:
  598. GenericUlong = (ULONG) Adapter->GoodReceives;
  599. break;
  600. case OID_GEN_XMIT_ERROR:
  601. GenericUlong = (ULONG) (Adapter->RetryFailure +
  602. Adapter->LostCarrier +
  603. Adapter->UnderFlow +
  604. Adapter->NoClearToSend);
  605. break;
  606. case OID_GEN_RCV_ERROR:
  607. GenericUlong = (ULONG) (Adapter->CrcErrors +
  608. Adapter->AlignmentErrors +
  609. Adapter->OutOfResources +
  610. Adapter->DmaOverruns);
  611. break;
  612. case OID_GEN_RCV_NO_BUFFER:
  613. GenericUlong = (ULONG) Adapter->OutOfResources;
  614. break;
  615. case OID_GEN_RCV_CRC_ERROR:
  616. GenericUlong = (ULONG) Adapter->CrcErrors;
  617. break;
  618. case OID_GEN_TRANSMIT_QUEUE_LENGTH:
  619. GenericUlong = (ULONG) Adapter->TransmitsQueued;
  620. break;
  621. case OID_802_3_RCV_ERROR_ALIGNMENT:
  622. GenericUlong = (ULONG) Adapter->AlignmentErrors;
  623. break;
  624. case OID_802_3_XMIT_ONE_COLLISION:
  625. GenericUlong = (ULONG) Adapter->OneRetry;
  626. break;
  627. case OID_802_3_XMIT_MORE_COLLISIONS:
  628. GenericUlong = (ULONG) Adapter->MoreThanOneRetry;
  629. break;
  630. case OID_802_3_XMIT_DEFERRED:
  631. GenericUlong = (ULONG) Adapter->Deferred;
  632. break;
  633. case OID_802_3_XMIT_MAX_COLLISIONS:
  634. GenericUlong = (ULONG) Adapter->RetryFailure;
  635. break;
  636. case OID_802_3_RCV_OVERRUN:
  637. GenericUlong = (ULONG) Adapter->DmaOverruns;
  638. break;
  639. case OID_802_3_XMIT_UNDERRUN:
  640. GenericUlong = (ULONG) Adapter->UnderFlow;
  641. break;
  642. case OID_802_3_XMIT_HEARTBEAT_FAILURE:
  643. GenericUlong = (ULONG) Adapter->NoClearToSend;
  644. break;
  645. case OID_802_3_XMIT_TIMES_CRS_LOST:
  646. GenericUlong = (ULONG) Adapter->LostCarrier;
  647. break;
  648. default:
  649. Status = NDIS_STATUS_NOT_SUPPORTED;
  650. break;
  651. }
  652. }
  653. if (Status == NDIS_STATUS_SUCCESS) {
  654. if (MoveBytes > InformationBufferLength) {
  655. //
  656. // Not enough room in InformationBuffer. Punt
  657. //
  658. *BytesNeeded = MoveBytes;
  659. Status = NDIS_STATUS_INVALID_LENGTH;
  660. } else {
  661. //
  662. // Copy result into InformationBuffer
  663. //
  664. *BytesWritten = MoveBytes;
  665. if (MoveBytes > 0) {
  666. NE3200_MOVE_MEMORY(
  667. InformationBuffer,
  668. MoveSource,
  669. MoveBytes
  670. );
  671. }
  672. }
  673. }
  674. Adapter->RequestInProgress = FALSE;
  675. //
  676. // Complete the request
  677. //
  678. NdisMQueryInformationComplete(
  679. Adapter->MiniportAdapterHandle,
  680. Status
  681. );
  682. IF_LOG('@');
  683. return;
  684. }