1139743Simp/*- 2123474Swpaul * Copyright (c) 2003 3123474Swpaul * Bill Paul <wpaul@windriver.com>. All rights reserved. 4123474Swpaul * 5123474Swpaul * Redistribution and use in source and binary forms, with or without 6123474Swpaul * modification, are permitted provided that the following conditions 7123474Swpaul * are met: 8123474Swpaul * 1. Redistributions of source code must retain the above copyright 9123474Swpaul * notice, this list of conditions and the following disclaimer. 10123474Swpaul * 2. Redistributions in binary form must reproduce the above copyright 11123474Swpaul * notice, this list of conditions and the following disclaimer in the 12123474Swpaul * documentation and/or other materials provided with the distribution. 13123474Swpaul * 3. All advertising materials mentioning features or use of this software 14123474Swpaul * must display the following acknowledgement: 15123474Swpaul * This product includes software developed by Bill Paul. 16123474Swpaul * 4. Neither the name of the author nor the names of any co-contributors 17123474Swpaul * may be used to endorse or promote products derived from this software 18123474Swpaul * without specific prior written permission. 19123474Swpaul * 20123474Swpaul * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND 21123474Swpaul * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22123474Swpaul * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23123474Swpaul * ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD 24123474Swpaul * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25123474Swpaul * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26123474Swpaul * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27123474Swpaul * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28123474Swpaul * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29123474Swpaul * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 30123474Swpaul * THE POSSIBILITY OF SUCH DAMAGE. 31123474Swpaul * 32123474Swpaul * $FreeBSD$ 33123474Swpaul */ 34123474Swpaul 35123474Swpaul#ifndef _NDIS_VAR_H_ 36189488Sweongyo#define _NDIS_VAR_H_ 37123474Swpaul 38123474Swpaul/* Forward declarations */ 39123474Swpaulstruct ndis_miniport_block; 40123474Swpaulstruct ndis_mdriver_block; 41123474Swpaultypedef struct ndis_miniport_block ndis_miniport_block; 42123474Swpaultypedef struct ndis_mdriver_block ndis_mdriver_block; 43123474Swpaul 44123474Swpaul/* Base types */ 45123474Swpaultypedef uint32_t ndis_status; 46123474Swpaultypedef void *ndis_handle; 47123474Swpaultypedef uint32_t ndis_oid; 48123474Swpaultypedef uint32_t ndis_error_code; 49124582Sobrientypedef register_t ndis_kspin_lock; 50123474Swpaultypedef uint8_t ndis_kirql; 51123474Swpaul 52123474Swpaul/* 53123474Swpaul * NDIS status codes (there are lots of them). The ones that 54123474Swpaul * don't seem to fit the pattern are actually mapped to generic 55123474Swpaul * NT status codes. 56123474Swpaul */ 57123474Swpaul 58189488Sweongyo#define NDIS_STATUS_SUCCESS 0 59189488Sweongyo#define NDIS_STATUS_PENDING 0x00000103 60189488Sweongyo#define NDIS_STATUS_NOT_RECOGNIZED 0x00010001 61189488Sweongyo#define NDIS_STATUS_NOT_COPIED 0x00010002 62189488Sweongyo#define NDIS_STATUS_NOT_ACCEPTED 0x00010003 63189488Sweongyo#define NDIS_STATUS_CALL_ACTIVE 0x00010007 64189488Sweongyo#define NDIS_STATUS_ONLINE 0x40010003 65189488Sweongyo#define NDIS_STATUS_RESET_START 0x40010004 66189488Sweongyo#define NDIS_STATUS_RESET_END 0x40010005 67189488Sweongyo#define NDIS_STATUS_RING_STATUS 0x40010006 68189488Sweongyo#define NDIS_STATUS_CLOSED 0x40010007 69189488Sweongyo#define NDIS_STATUS_WAN_LINE_UP 0x40010008 70189488Sweongyo#define NDIS_STATUS_WAN_LINE_DOWN 0x40010009 71189488Sweongyo#define NDIS_STATUS_WAN_FRAGMENT 0x4001000A 72189488Sweongyo#define NDIS_STATUS_MEDIA_CONNECT 0x4001000B 73189488Sweongyo#define NDIS_STATUS_MEDIA_DISCONNECT 0x4001000C 74189488Sweongyo#define NDIS_STATUS_HARDWARE_LINE_UP 0x4001000D 75189488Sweongyo#define NDIS_STATUS_HARDWARE_LINE_DOWN 0x4001000E 76189488Sweongyo#define NDIS_STATUS_INTERFACE_UP 0x4001000F 77189488Sweongyo#define NDIS_STATUS_INTERFACE_DOWN 0x40010010 78189488Sweongyo#define NDIS_STATUS_MEDIA_BUSY 0x40010011 79189488Sweongyo#define NDIS_STATUS_MEDIA_SPECIFIC_INDICATION 0x40010012 80189488Sweongyo#define NDIS_STATUS_WW_INDICATION NDIS_STATUS_MEDIA_SPECIFIC_INDICATION 81189488Sweongyo#define NDIS_STATUS_LINK_SPEED_CHANGE 0x40010013 82189488Sweongyo#define NDIS_STATUS_WAN_GET_STATS 0x40010014 83189488Sweongyo#define NDIS_STATUS_WAN_CO_FRAGMENT 0x40010015 84189488Sweongyo#define NDIS_STATUS_WAN_CO_LINKPARAMS 0x40010016 85189488Sweongyo#define NDIS_STATUS_NOT_RESETTABLE 0x80010001 86189488Sweongyo#define NDIS_STATUS_SOFT_ERRORS 0x80010003 87189488Sweongyo#define NDIS_STATUS_HARD_ERRORS 0x80010004 88189488Sweongyo#define NDIS_STATUS_BUFFER_OVERFLOW 0x80000005 89189488Sweongyo#define NDIS_STATUS_FAILURE 0xC0000001 90189488Sweongyo#define NDIS_STATUS_RESOURCES 0xC000009A 91189488Sweongyo#define NDIS_STATUS_CLOSING 0xC0010002 92189488Sweongyo#define NDIS_STATUS_BAD_VERSION 0xC0010004 93189488Sweongyo#define NDIS_STATUS_BAD_CHARACTERISTICS 0xC0010005 94189488Sweongyo#define NDIS_STATUS_ADAPTER_NOT_FOUND 0xC0010006 95189488Sweongyo#define NDIS_STATUS_OPEN_FAILED 0xC0010007 96189488Sweongyo#define NDIS_STATUS_DEVICE_FAILED 0xC0010008 97189488Sweongyo#define NDIS_STATUS_MULTICAST_FULL 0xC0010009 98189488Sweongyo#define NDIS_STATUS_MULTICAST_EXISTS 0xC001000A 99189488Sweongyo#define NDIS_STATUS_MULTICAST_NOT_FOUND 0xC001000B 100189488Sweongyo#define NDIS_STATUS_REQUEST_ABORTED 0xC001000C 101189488Sweongyo#define NDIS_STATUS_RESET_IN_PROGRESS 0xC001000D 102189488Sweongyo#define NDIS_STATUS_CLOSING_INDICATING 0xC001000E 103189488Sweongyo#define NDIS_STATUS_NOT_SUPPORTED 0xC00000BB 104189488Sweongyo#define NDIS_STATUS_INVALID_PACKET 0xC001000F 105189488Sweongyo#define NDIS_STATUS_OPEN_LIST_FULL 0xC0010010 106189488Sweongyo#define NDIS_STATUS_ADAPTER_NOT_READY 0xC0010011 107189488Sweongyo#define NDIS_STATUS_ADAPTER_NOT_OPEN 0xC0010012 108189488Sweongyo#define NDIS_STATUS_NOT_INDICATING 0xC0010013 109189488Sweongyo#define NDIS_STATUS_INVALID_LENGTH 0xC0010014 110189488Sweongyo#define NDIS_STATUS_INVALID_DATA 0xC0010015 111189488Sweongyo#define NDIS_STATUS_BUFFER_TOO_SHORT 0xC0010016 112189488Sweongyo#define NDIS_STATUS_INVALID_OID 0xC0010017 113189488Sweongyo#define NDIS_STATUS_ADAPTER_REMOVED 0xC0010018 114189488Sweongyo#define NDIS_STATUS_UNSUPPORTED_MEDIA 0xC0010019 115189488Sweongyo#define NDIS_STATUS_GROUP_ADDRESS_IN_USE 0xC001001A 116189488Sweongyo#define NDIS_STATUS_FILE_NOT_FOUND 0xC001001B 117189488Sweongyo#define NDIS_STATUS_ERROR_READING_FILE 0xC001001C 118189488Sweongyo#define NDIS_STATUS_ALREADY_MAPPED 0xC001001D 119189488Sweongyo#define NDIS_STATUS_RESOURCE_CONFLICT 0xC001001E 120189488Sweongyo#define NDIS_STATUS_NO_CABLE 0xC001001F 121189488Sweongyo#define NDIS_STATUS_INVALID_SAP 0xC0010020 122189488Sweongyo#define NDIS_STATUS_SAP_IN_USE 0xC0010021 123189488Sweongyo#define NDIS_STATUS_INVALID_ADDRESS 0xC0010022 124189488Sweongyo#define NDIS_STATUS_VC_NOT_ACTIVATED 0xC0010023 125189488Sweongyo#define NDIS_STATUS_DEST_OUT_OF_ORDER 0xC0010024 126189488Sweongyo#define NDIS_STATUS_VC_NOT_AVAILABLE 0xC0010025 127189488Sweongyo#define NDIS_STATUS_CELLRATE_NOT_AVAILABLE 0xC0010026 128189488Sweongyo#define NDIS_STATUS_INCOMPATABLE_QOS 0xC0010027 129189488Sweongyo#define NDIS_STATUS_AAL_PARAMS_UNSUPPORTED 0xC0010028 130189488Sweongyo#define NDIS_STATUS_NO_ROUTE_TO_DESTINATION 0xC0010029 131189488Sweongyo#define NDIS_STATUS_TOKEN_RING_OPEN_ERROR 0xC0011000 132189488Sweongyo#define NDIS_STATUS_INVALID_DEVICE_REQUEST 0xC0000010 133189488Sweongyo#define NDIS_STATUS_NETWORK_UNREACHABLE 0xC000023C 134123474Swpaul 135123474Swpaul/* 136123474Swpaul * NDIS event codes. They are usually reported to NdisWriteErrorLogEntry(). 137123474Swpaul */ 138123474Swpaul 139189488Sweongyo#define EVENT_NDIS_RESOURCE_CONFLICT 0xC0001388 140189488Sweongyo#define EVENT_NDIS_OUT_OF_RESOURCE 0xC0001389 141189488Sweongyo#define EVENT_NDIS_HARDWARE_FAILURE 0xC000138A 142189488Sweongyo#define EVENT_NDIS_ADAPTER_NOT_FOUND 0xC000138B 143189488Sweongyo#define EVENT_NDIS_INTERRUPT_CONNECT 0xC000138C 144189488Sweongyo#define EVENT_NDIS_DRIVER_FAILURE 0xC000138D 145189488Sweongyo#define EVENT_NDIS_BAD_VERSION 0xC000138E 146189488Sweongyo#define EVENT_NDIS_TIMEOUT 0x8000138F 147189488Sweongyo#define EVENT_NDIS_NETWORK_ADDRESS 0xC0001390 148189488Sweongyo#define EVENT_NDIS_UNSUPPORTED_CONFIGURATION 0xC0001391 149189488Sweongyo#define EVENT_NDIS_INVALID_VALUE_FROM_ADAPTER 0xC0001392 150189488Sweongyo#define EVENT_NDIS_MISSING_CONFIGURATION_PARAMETER 0xC0001393 151189488Sweongyo#define EVENT_NDIS_BAD_IO_BASE_ADDRESS 0xC0001394 152189488Sweongyo#define EVENT_NDIS_RECEIVE_SPACE_SMALL 0x40001395 153189488Sweongyo#define EVENT_NDIS_ADAPTER_DISABLED 0x80001396 154189488Sweongyo#define EVENT_NDIS_IO_PORT_CONFLICT 0x80001397 155189488Sweongyo#define EVENT_NDIS_PORT_OR_DMA_CONFLICT 0x80001398 156189488Sweongyo#define EVENT_NDIS_MEMORY_CONFLICT 0x80001399 157189488Sweongyo#define EVENT_NDIS_INTERRUPT_CONFLICT 0x8000139A 158189488Sweongyo#define EVENT_NDIS_DMA_CONFLICT 0x8000139B 159189488Sweongyo#define EVENT_NDIS_INVALID_DOWNLOAD_FILE_ERROR 0xC000139C 160189488Sweongyo#define EVENT_NDIS_MAXRECEIVES_ERROR 0x8000139D 161189488Sweongyo#define EVENT_NDIS_MAXTRANSMITS_ERROR 0x8000139E 162189488Sweongyo#define EVENT_NDIS_MAXFRAMESIZE_ERROR 0x8000139F 163189488Sweongyo#define EVENT_NDIS_MAXINTERNALBUFS_ERROR 0x800013A0 164189488Sweongyo#define EVENT_NDIS_MAXMULTICAST_ERROR 0x800013A1 165189488Sweongyo#define EVENT_NDIS_PRODUCTID_ERROR 0x800013A2 166189488Sweongyo#define EVENT_NDIS_LOBE_FAILUE_ERROR 0x800013A3 167189488Sweongyo#define EVENT_NDIS_SIGNAL_LOSS_ERROR 0x800013A4 168189488Sweongyo#define EVENT_NDIS_REMOVE_RECEIVED_ERROR 0x800013A5 169189488Sweongyo#define EVENT_NDIS_TOKEN_RING_CORRECTION 0x400013A6 170189488Sweongyo#define EVENT_NDIS_ADAPTER_CHECK_ERROR 0xC00013A7 171189488Sweongyo#define EVENT_NDIS_RESET_FAILURE_ERROR 0x800013A8 172189488Sweongyo#define EVENT_NDIS_CABLE_DISCONNECTED_ERROR 0x800013A9 173189488Sweongyo#define EVENT_NDIS_RESET_FAILURE_CORRECTION 0x800013AA 174123474Swpaul 175123474Swpaul/* 176123474Swpaul * NDIS OIDs used by the queryinfo/setinfo routines. 177123474Swpaul * Some are required by all NDIS drivers, some are specific to 178123474Swpaul * a particular type of device, and some are purely optional. 179123474Swpaul * Unfortunately, one of the purely optional OIDs is the one 180123474Swpaul * that lets us set the MAC address of the device. 181123474Swpaul */ 182123474Swpaul 183123474Swpaul/* Required OIDs */ 184189488Sweongyo#define OID_GEN_SUPPORTED_LIST 0x00010101 185189488Sweongyo#define OID_GEN_HARDWARE_STATUS 0x00010102 186189488Sweongyo#define OID_GEN_MEDIA_SUPPORTED 0x00010103 187189488Sweongyo#define OID_GEN_MEDIA_IN_USE 0x00010104 188189488Sweongyo#define OID_GEN_MAXIMUM_LOOKAHEAD 0x00010105 189189488Sweongyo#define OID_GEN_MAXIMUM_FRAME_SIZE 0x00010106 190189488Sweongyo#define OID_GEN_LINK_SPEED 0x00010107 191189488Sweongyo#define OID_GEN_TRANSMIT_BUFFER_SPACE 0x00010108 192189488Sweongyo#define OID_GEN_RECEIVE_BUFFER_SPACE 0x00010109 193189488Sweongyo#define OID_GEN_TRANSMIT_BLOCK_SIZE 0x0001010A 194189488Sweongyo#define OID_GEN_RECEIVE_BLOCK_SIZE 0x0001010B 195189488Sweongyo#define OID_GEN_VENDOR_ID 0x0001010C 196189488Sweongyo#define OID_GEN_VENDOR_DESCRIPTION 0x0001010D 197189488Sweongyo#define OID_GEN_CURRENT_PACKET_FILTER 0x0001010E 198189488Sweongyo#define OID_GEN_CURRENT_LOOKAHEAD 0x0001010F 199189488Sweongyo#define OID_GEN_DRIVER_VERSION 0x00010110 200189488Sweongyo#define OID_GEN_MAXIMUM_TOTAL_SIZE 0x00010111 201189488Sweongyo#define OID_GEN_PROTOCOL_OPTIONS 0x00010112 202189488Sweongyo#define OID_GEN_MAC_OPTIONS 0x00010113 203189488Sweongyo#define OID_GEN_MEDIA_CONNECT_STATUS 0x00010114 204189488Sweongyo#define OID_GEN_MAXIMUM_SEND_PACKETS 0x00010115 205189488Sweongyo#define OID_GEN_VENDOR_DRIVER_VERSION 0x00010116 206189488Sweongyo#define OID_GEN_SUPPORTED_GUIDS 0x00010117 207189488Sweongyo#define OID_GEN_NETWORK_LAYER_ADDRESSES 0x00010118 /* Set only */ 208189488Sweongyo#define OID_GEN_TRANSPORT_HEADER_OFFSET 0x00010119 /* Set only */ 209189488Sweongyo#define OID_GEN_MACHINE_NAME 0x0001021A 210189488Sweongyo#define OID_GEN_RNDIS_CONFIG_PARAMETER 0x0001021B /* Set only */ 211189488Sweongyo#define OID_GEN_VLAN_ID 0x0001021C 212123474Swpaul 213123474Swpaul/* Optional OIDs. */ 214189488Sweongyo#define OID_GEN_MEDIA_CAPABILITIES 0x00010201 215189488Sweongyo#define OID_GEN_PHYSICAL_MEDIUM 0x00010202 216123474Swpaul 217123474Swpaul/* Required statistics OIDs. */ 218189488Sweongyo#define OID_GEN_XMIT_OK 0x00020101 219189488Sweongyo#define OID_GEN_RCV_OK 0x00020102 220189488Sweongyo#define OID_GEN_XMIT_ERROR 0x00020103 221189488Sweongyo#define OID_GEN_RCV_ERROR 0x00020104 222189488Sweongyo#define OID_GEN_RCV_NO_BUFFER 0x00020105 223123474Swpaul 224123474Swpaul/* Optional OID statistics */ 225189488Sweongyo#define OID_GEN_DIRECTED_BYTES_XMIT 0x00020201 226189488Sweongyo#define OID_GEN_DIRECTED_FRAMES_XMIT 0x00020202 227189488Sweongyo#define OID_GEN_MULTICAST_BYTES_XMIT 0x00020203 228189488Sweongyo#define OID_GEN_MULTICAST_FRAMES_XMIT 0x00020204 229189488Sweongyo#define OID_GEN_BROADCAST_BYTES_XMIT 0x00020205 230189488Sweongyo#define OID_GEN_BROADCAST_FRAMES_XMIT 0x00020206 231189488Sweongyo#define OID_GEN_DIRECTED_BYTES_RCV 0x00020207 232189488Sweongyo#define OID_GEN_DIRECTED_FRAMES_RCV 0x00020208 233189488Sweongyo#define OID_GEN_MULTICAST_BYTES_RCV 0x00020209 234189488Sweongyo#define OID_GEN_MULTICAST_FRAMES_RCV 0x0002020A 235189488Sweongyo#define OID_GEN_BROADCAST_BYTES_RCV 0x0002020B 236189488Sweongyo#define OID_GEN_BROADCAST_FRAMES_RCV 0x0002020C 237189488Sweongyo#define OID_GEN_RCV_CRC_ERROR 0x0002020D 238189488Sweongyo#define OID_GEN_TRANSMIT_QUEUE_LENGTH 0x0002020E 239189488Sweongyo#define OID_GEN_GET_TIME_CAPS 0x0002020F 240189488Sweongyo#define OID_GEN_GET_NETCARD_TIME 0x00020210 241189488Sweongyo#define OID_GEN_NETCARD_LOAD 0x00020211 242189488Sweongyo#define OID_GEN_DEVICE_PROFILE 0x00020212 243123474Swpaul 244123474Swpaul/* 802.3 (ethernet) OIDs */ 245189488Sweongyo#define OID_802_3_PERMANENT_ADDRESS 0x01010101 246189488Sweongyo#define OID_802_3_CURRENT_ADDRESS 0x01010102 247189488Sweongyo#define OID_802_3_MULTICAST_LIST 0x01010103 248189488Sweongyo#define OID_802_3_MAXIMUM_LIST_SIZE 0x01010104 249189488Sweongyo#define OID_802_3_MAC_OPTIONS 0x01010105 250189488Sweongyo#define NDIS_802_3_MAC_OPTION_PRIORITY 0x00000001 251189488Sweongyo#define OID_802_3_RCV_ERROR_ALIGNMENT 0x01020101 252189488Sweongyo#define OID_802_3_XMIT_ONE_COLLISION 0x01020102 253189488Sweongyo#define OID_802_3_XMIT_MORE_COLLISIONS 0x01020103 254189488Sweongyo#define OID_802_3_XMIT_DEFERRED 0x01020201 255189488Sweongyo#define OID_802_3_XMIT_MAX_COLLISIONS 0x01020202 256189488Sweongyo#define OID_802_3_RCV_OVERRUN 0x01020203 257189488Sweongyo#define OID_802_3_XMIT_UNDERRUN 0x01020204 258189488Sweongyo#define OID_802_3_XMIT_HEARTBEAT_FAILURE 0x01020205 259189488Sweongyo#define OID_802_3_XMIT_TIMES_CRS_LOST 0x01020206 260189488Sweongyo#define OID_802_3_XMIT_LATE_COLLISIONS 0x01020207 261123474Swpaul 262123474Swpaul/* PnP and power management OIDs */ 263189488Sweongyo#define OID_PNP_CAPABILITIES 0xFD010100 264189488Sweongyo#define OID_PNP_SET_POWER 0xFD010101 265189488Sweongyo#define OID_PNP_QUERY_POWER 0xFD010102 266189488Sweongyo#define OID_PNP_ADD_WAKE_UP_PATTERN 0xFD010103 267189488Sweongyo#define OID_PNP_REMOVE_WAKE_UP_PATTERN 0xFD010104 268189488Sweongyo#define OID_PNP_WAKE_UP_PATTERN_LIST 0xFD010105 269189488Sweongyo#define OID_PNP_ENABLE_WAKE_UP 0xFD010106 270123474Swpaul 271151207Swpaul/* 272151207Swpaul * These are the possible power states for 273151207Swpaul * OID_PNP_SET_POWER and OID_PNP_QUERY_POWER. 274151207Swpaul */ 275189488Sweongyo#define NDIS_POWERSTATE_UNSPEC 0 276189488Sweongyo#define NDIS_POWERSTATE_D0 1 277189488Sweongyo#define NDIS_POWERSTATE_D1 2 278189488Sweongyo#define NDIS_POWERSTATE_D2 3 279189488Sweongyo#define NDIS_POWERSTATE_D3 4 280151207Swpaul 281151207Swpaul/* 282151207Swpaul * These are used with the MiniportPnpEventNotify() method. 283151207Swpaul */ 284151207Swpaul 285189488Sweongyo#define NDIS_POWERPROFILE_BATTERY 0 286189488Sweongyo#define NDIS_POWERPROFILE_ACONLINE 1 287151207Swpaul 288189488Sweongyo#define NDIS_PNP_EVENT_QUERY_REMOVED 0 289189488Sweongyo#define NDIS_PNP_EVENT_REMOVED 1 290189488Sweongyo#define NDIS_PNP_EVENT_SURPRISE_REMOVED 2 291189488Sweongyo#define NDIS_PNP_EVENT_QUERY_STOPPED 3 292189488Sweongyo#define NDIS_PNP_EVENT_STOPPED 4 293189488Sweongyo#define NDIS_PNP_EVENT_PROFILECHANGED 5 294151207Swpaul 295151207Swpaul 296123474Swpaul/* PnP/PM Statistics (Optional). */ 297189488Sweongyo#define OID_PNP_WAKE_UP_OK 0xFD020200 298189488Sweongyo#define OID_PNP_WAKE_UP_ERROR 0xFD020201 299123474Swpaul 300123474Swpaul/* The following bits are defined for OID_PNP_ENABLE_WAKE_UP */ 301189488Sweongyo#define NDIS_PNP_WAKE_UP_MAGIC_PACKET 0x00000001 302189488Sweongyo#define NDIS_PNP_WAKE_UP_PATTERN_MATCH 0x00000002 303189488Sweongyo#define NDIS_PNP_WAKE_UP_LINK_CHANGE 0x00000004 304123474Swpaul 305123474Swpaul/* 802.11 OIDs */ 306189488Sweongyo#define OID_802_11_BSSID 0x0D010101 307189488Sweongyo#define OID_802_11_SSID 0x0D010102 308189488Sweongyo#define OID_802_11_NETWORK_TYPES_SUPPORTED 0x0D010203 309189488Sweongyo#define OID_802_11_NETWORK_TYPE_IN_USE 0x0D010204 310189488Sweongyo#define OID_802_11_TX_POWER_LEVEL 0x0D010205 311189488Sweongyo#define OID_802_11_RSSI 0x0D010206 312189488Sweongyo#define OID_802_11_RSSI_TRIGGER 0x0D010207 313189488Sweongyo#define OID_802_11_INFRASTRUCTURE_MODE 0x0D010108 314189488Sweongyo#define OID_802_11_FRAGMENTATION_THRESHOLD 0x0D010209 315189488Sweongyo#define OID_802_11_RTS_THRESHOLD 0x0D01020A 316189488Sweongyo#define OID_802_11_NUMBER_OF_ANTENNAS 0x0D01020B 317189488Sweongyo#define OID_802_11_RX_ANTENNA_SELECTED 0x0D01020C 318189488Sweongyo#define OID_802_11_TX_ANTENNA_SELECTED 0x0D01020D 319189488Sweongyo#define OID_802_11_SUPPORTED_RATES 0x0D01020E 320189488Sweongyo#define OID_802_11_DESIRED_RATES 0x0D010210 321189488Sweongyo#define OID_802_11_CONFIGURATION 0x0D010211 322189488Sweongyo#define OID_802_11_STATISTICS 0x0D020212 323189488Sweongyo#define OID_802_11_ADD_WEP 0x0D010113 324189488Sweongyo#define OID_802_11_REMOVE_WEP 0x0D010114 325189488Sweongyo#define OID_802_11_DISASSOCIATE 0x0D010115 326189488Sweongyo#define OID_802_11_POWER_MODE 0x0D010216 327189488Sweongyo#define OID_802_11_BSSID_LIST 0x0D010217 328189488Sweongyo#define OID_802_11_AUTHENTICATION_MODE 0x0D010118 329189488Sweongyo#define OID_802_11_PRIVACY_FILTER 0x0D010119 330189488Sweongyo#define OID_802_11_BSSID_LIST_SCAN 0x0D01011A 331189488Sweongyo#define OID_802_11_WEP_STATUS 0x0D01011B 332189488Sweongyo#define OID_802_11_ENCRYPTION_STATUS OID_802_11_WEP_STATUS 333189488Sweongyo#define OID_802_11_RELOAD_DEFAULTS 0x0D01011C 334189488Sweongyo#define OID_802_11_ADD_KEY 0x0D01011D 335189488Sweongyo#define OID_802_11_REMOVE_KEY 0x0D01011E 336189488Sweongyo#define OID_802_11_ASSOCIATION_INFORMATION 0x0D01011F 337189488Sweongyo#define OID_802_11_TEST 0x0D010120 338189488Sweongyo#define OID_802_11_CAPABILITY 0x0D010122 339189488Sweongyo#define OID_802_11_PMKID 0x0D010123 340123474Swpaul 341123474Swpaul/* structures/definitions for 802.11 */ 342189488Sweongyo#define NDIS_80211_NETTYPE_11FH 0x00000000 343189488Sweongyo#define NDIS_80211_NETTYPE_11DS 0x00000001 344189488Sweongyo#define NDIS_80211_NETTYPE_11OFDM5 0x00000002 345189488Sweongyo#define NDIS_80211_NETTYPE_11OFDM24 0x00000003 346189488Sweongyo#define NDIS_80211_NETTYPE_AUTO 0x00000004 347123474Swpaul 348123474Swpaulstruct ndis_80211_nettype_list { 349123474Swpaul uint32_t ntl_items; 350123474Swpaul uint32_t ntl_type[1]; 351123474Swpaul}; 352123474Swpaul 353189488Sweongyo#define NDIS_80211_POWERMODE_CAM 0x00000000 354189488Sweongyo#define NDIS_80211_POWERMODE_MAX_PSP 0x00000001 355189488Sweongyo#define NDIS_80211_POWERMODE_FAST_PSP 0x00000002 356123474Swpaul 357123474Swpaultypedef uint32_t ndis_80211_power; /* Power in milliwatts */ 358123474Swpaultypedef uint32_t ndis_80211_rssi; /* Signal strength in dBm */ 359123474Swpaul 360123474Swpaulstruct ndis_80211_config_fh { 361123474Swpaul uint32_t ncf_length; 362123474Swpaul uint32_t ncf_hoppatterh; 363123474Swpaul uint32_t ncf_hopset; 364123474Swpaul uint32_t ncf_dwelltime; 365123474Swpaul}; 366123474Swpaul 367123474Swpaultypedef struct ndis_80211_config_fh ndis_80211_config_fh; 368123474Swpaul 369123474Swpaulstruct ndis_80211_config { 370123474Swpaul uint32_t nc_length; 371123474Swpaul uint32_t nc_beaconperiod; 372123474Swpaul uint32_t nc_atimwin; 373123474Swpaul uint32_t nc_dsconfig; 374123474Swpaul ndis_80211_config_fh nc_fhconfig; 375123474Swpaul}; 376123474Swpaul 377123474Swpaultypedef struct ndis_80211_config ndis_80211_config; 378123474Swpaul 379123474Swpaulstruct ndis_80211_stats { 380123474Swpaul uint32_t ns_length; 381123474Swpaul uint64_t ns_txfragcnt; 382123474Swpaul uint64_t ns_txmcastcnt; 383123474Swpaul uint64_t ns_failedcnt; 384123474Swpaul uint64_t ns_retrycnt; 385123474Swpaul uint64_t ns_multiretrycnt; 386123474Swpaul uint64_t ns_rtssuccesscnt; 387123474Swpaul uint64_t ns_rtsfailcnt; 388123474Swpaul uint64_t ns_ackfailcnt; 389123474Swpaul uint64_t ns_dupeframecnt; 390123474Swpaul uint64_t ns_rxfragcnt; 391123474Swpaul uint64_t ns_rxmcastcnt; 392123474Swpaul uint64_t ns_fcserrcnt; 393123474Swpaul}; 394123474Swpaul 395123474Swpaultypedef struct ndis_80211_stats ndis_80211_stats; 396123474Swpaul 397123474Swpaultypedef uint32_t ndis_80211_key_idx; 398123474Swpaul 399123474Swpaulstruct ndis_80211_wep { 400123474Swpaul uint32_t nw_length; 401123474Swpaul uint32_t nw_keyidx; 402123474Swpaul uint32_t nw_keylen; 403124005Swpaul uint8_t nw_keydata[256]; 404123474Swpaul}; 405123474Swpaul 406123474Swpaultypedef struct ndis_80211_wep ndis_80211_wep; 407123474Swpaul 408189488Sweongyo#define NDIS_80211_WEPKEY_TX 0x80000000 409189488Sweongyo#define NDIS_80211_WEPKEY_PERCLIENT 0x40000000 410124005Swpaul 411189488Sweongyo#define NDIS_80211_NET_INFRA_IBSS 0x00000000 412189488Sweongyo#define NDIS_80211_NET_INFRA_BSS 0x00000001 413189488Sweongyo#define NDIS_80211_NET_INFRA_AUTO 0x00000002 414123474Swpaul 415189488Sweongyo#define NDIS_80211_AUTHMODE_OPEN 0x00000000 416189488Sweongyo#define NDIS_80211_AUTHMODE_SHARED 0x00000001 417189488Sweongyo#define NDIS_80211_AUTHMODE_AUTO 0x00000002 418189488Sweongyo#define NDIS_80211_AUTHMODE_WPA 0x00000003 419189488Sweongyo#define NDIS_80211_AUTHMODE_WPAPSK 0x00000004 420189488Sweongyo#define NDIS_80211_AUTHMODE_WPANONE 0x00000005 421189488Sweongyo#define NDIS_80211_AUTHMODE_WPA2 0x00000006 422189488Sweongyo#define NDIS_80211_AUTHMODE_WPA2PSK 0x00000007 423123474Swpaul 424123474Swpaultypedef uint8_t ndis_80211_rates[8]; 425124005Swpaultypedef uint8_t ndis_80211_rates_ex[16]; 426123474Swpaultypedef uint8_t ndis_80211_macaddr[6]; 427123474Swpaul 428123474Swpaulstruct ndis_80211_ssid { 429123474Swpaul uint32_t ns_ssidlen; 430123474Swpaul uint8_t ns_ssid[32]; 431123474Swpaul}; 432123474Swpaul 433123474Swpaultypedef struct ndis_80211_ssid ndis_80211_ssid; 434123474Swpaul 435123474Swpaulstruct ndis_wlan_bssid { 436123474Swpaul uint32_t nwb_length; 437123474Swpaul ndis_80211_macaddr nwb_macaddr; 438123474Swpaul uint8_t nwb_rsvd[2]; 439123474Swpaul ndis_80211_ssid nwb_ssid; 440123474Swpaul uint32_t nwb_privacy; 441123474Swpaul ndis_80211_rssi nwb_rssi; 442123474Swpaul uint32_t nwb_nettype; 443123474Swpaul ndis_80211_config nwb_config; 444123474Swpaul uint32_t nwb_netinfra; 445123474Swpaul ndis_80211_rates nwb_supportedrates; 446123474Swpaul}; 447123474Swpaul 448123474Swpaultypedef struct ndis_wlan_bssid ndis_wlan_bssid; 449123474Swpaul 450123474Swpaulstruct ndis_80211_bssid_list { 451123474Swpaul uint32_t nbl_items; 452123474Swpaul ndis_wlan_bssid nbl_bssid[1]; 453123474Swpaul}; 454123474Swpaul 455123474Swpaultypedef struct ndis_80211_bssid_list ndis_80211_bssid_list; 456123474Swpaul 457124005Swpaulstruct ndis_wlan_bssid_ex { 458124005Swpaul uint32_t nwbx_len; 459124005Swpaul ndis_80211_macaddr nwbx_macaddr; 460124005Swpaul uint8_t nwbx_rsvd[2]; 461124005Swpaul ndis_80211_ssid nwbx_ssid; 462124005Swpaul uint32_t nwbx_privacy; 463124005Swpaul ndis_80211_rssi nwbx_rssi; 464124005Swpaul uint32_t nwbx_nettype; 465124005Swpaul ndis_80211_config nwbx_config; 466124005Swpaul uint32_t nwbx_netinfra; 467124005Swpaul ndis_80211_rates_ex nwbx_supportedrates; 468124005Swpaul uint32_t nwbx_ielen; 469174141Sthompsa uint8_t nwbx_ies[1]; 470124005Swpaul}; 471124005Swpaul 472124005Swpaultypedef struct ndis_wlan_bssid_ex ndis_wlan_bssid_ex; 473124005Swpaul 474124005Swpaulstruct ndis_80211_bssid_list_ex { 475124005Swpaul uint32_t nblx_items; 476124409Swpaul ndis_wlan_bssid_ex nblx_bssid[1]; 477124005Swpaul}; 478124005Swpaul 479124005Swpaultypedef struct ndis_80211_bssid_list_ex ndis_80211_bssid_list_ex; 480124005Swpaul 481124005Swpaulstruct ndis_80211_fixed_ies { 482124005Swpaul uint8_t nfi_tstamp[8]; 483124005Swpaul uint16_t nfi_beaconint; 484124005Swpaul uint16_t nfi_caps; 485124005Swpaul}; 486124005Swpaul 487124005Swpaulstruct ndis_80211_variable_ies { 488124005Swpaul uint8_t nvi_elemid; 489124005Swpaul uint8_t nvi_len; 490124005Swpaul uint8_t nvi_data[1]; 491124005Swpaul}; 492124005Swpaul 493123474Swpaultypedef uint32_t ndis_80211_fragthresh; 494123474Swpaultypedef uint32_t ndis_80211_rtsthresh; 495123474Swpaultypedef uint32_t ndis_80211_antenna; 496123474Swpaul 497189488Sweongyo#define NDIS_80211_PRIVFILT_ACCEPTALL 0x00000000 498189488Sweongyo#define NDIS_80211_PRIVFILT_8021XWEP 0x00000001 499123474Swpaul 500189488Sweongyo#define NDIS_80211_WEPSTAT_ENABLED 0x00000000 501189488Sweongyo#define NDIS_80211_WEPSTAT_ENC1ENABLED NDIS_80211_WEPSTAT_ENABLED 502189488Sweongyo#define NDIS_80211_WEPSTAT_DISABLED 0x00000001 503189488Sweongyo#define NDIS_80211_WEPSTAT_ENCDISABLED NDIS_80211_WEPSTAT_DISABLED 504189488Sweongyo#define NDIS_80211_WEPSTAT_KEYABSENT 0x00000002 505189488Sweongyo#define NDIS_80211_WEPSTAT_ENC1KEYABSENT NDIS_80211_WEPSTAT_KEYABSENT 506189488Sweongyo#define NDIS_80211_WEPSTAT_NOTSUPPORTED 0x00000003 507189488Sweongyo#define NDIS_80211_WEPSTAT_ENCNOTSUPPORTED NDIS_80211_WEPSTAT_NOTSUPPORTED 508189488Sweongyo#define NDIS_80211_WEPSTAT_ENC2ENABLED 0x00000004 509189488Sweongyo#define NDIS_80211_WEPSTAT_ENC2KEYABSENT 0x00000005 510189488Sweongyo#define NDIS_80211_WEPSTAT_ENC3ENABLED 0x00000006 511189488Sweongyo#define NDIS_80211_WEPSTAT_ENC3KEYABSENT 0x00000007 512123474Swpaul 513189488Sweongyo#define NDIS_80211_RELOADDEFAULT_WEP 0x00000000 514123474Swpaul 515189488Sweongyo#define NDIS_80211_STATUSTYPE_AUTH 0x00000000 516189488Sweongyo#define NDIS_80211_STATUSTYPE_PMKIDLIST 0x00000001 517124005Swpaul 518124005Swpaulstruct ndis_80211_status_indication { 519124005Swpaul uint32_t nsi_type; 520124005Swpaul}; 521124005Swpaul 522124005Swpaultypedef struct ndis_80211_status_indication ndis_80211_status_indication; 523124005Swpaul 524189488Sweongyo#define NDIS_802_11_AUTH_REQUEST_REAUTH 0x01 525189488Sweongyo#define NDIS_802_11_AUTH_REQUEST_KEYUPDATE 0x02 526189488Sweongyo#define NDIS_802_11_AUTH_REQUEST_PAIRWISE_ERROR 0x06 527189488Sweongyo#define NDIS_802_11_AUTH_REQUEST_GROUP_ERROR 0x0E 528151207Swpaul 529124005Swpaulstruct ndis_80211_auth_request { 530124005Swpaul uint32_t nar_len; 531124005Swpaul ndis_80211_macaddr nar_bssid; 532124005Swpaul uint32_t nar_flags; 533124005Swpaul}; 534124005Swpaul 535124005Swpaultypedef struct ndis_80211_auth_request ndis_80211_auth_request; 536124005Swpaul 537124005Swpaulstruct ndis_80211_key { 538124005Swpaul uint32_t nk_len; 539124005Swpaul uint32_t nk_keyidx; 540124005Swpaul uint32_t nk_keylen; 541124005Swpaul ndis_80211_macaddr nk_bssid; 542151207Swpaul uint8_t nk_pad[6]; 543124005Swpaul uint64_t nk_keyrsc; 544151207Swpaul uint8_t nk_keydata[32]; 545124005Swpaul}; 546124005Swpaul 547124005Swpaultypedef struct ndis_80211_key ndis_80211_key; 548124005Swpaul 549124005Swpaulstruct ndis_80211_remove_key { 550124005Swpaul uint32_t nk_len; 551124005Swpaul uint32_t nk_keyidx; 552124005Swpaul ndis_80211_macaddr nk_bssid; 553124005Swpaul}; 554124005Swpaul 555124005Swpaultypedef struct ndis_80211_remove_key ndis_80211_remove_key; 556124005Swpaul 557189488Sweongyo#define NDIS_80211_AI_REQFI_CAPABILITIES 0x00000001 558189488Sweongyo#define NDIS_80211_AI_REQFI_LISTENINTERVAL 0x00000002 559189488Sweongyo#define NDIS_80211_AI_REQFI_CURRENTAPADDRESS 0x00000004 560124005Swpaul 561189488Sweongyo#define NDIS_80211_AI_RESFI_CAPABILITIES 0x00000001 562189488Sweongyo#define NDIS_80211_AI_RESFI_STATUSCODE 0x00000002 563189488Sweongyo#define NDIS_80211_AI_RESFI_ASSOCIATIONID 0x00000004 564124005Swpaul 565124005Swpaulstruct ndis_80211_ai_reqfi { 566124005Swpaul uint16_t naq_caps; 567124005Swpaul uint16_t naq_listentint; 568124005Swpaul ndis_80211_macaddr naq_currentapaddr; 569124005Swpaul}; 570124005Swpaul 571124005Swpaultypedef struct ndis_80211_ai_reqfi ndis_80211_ai_reqfi; 572124005Swpaul 573124005Swpaulstruct ndis_80211_ai_resfi { 574124005Swpaul uint16_t nas_caps; 575124005Swpaul uint16_t nas_statuscode; 576124005Swpaul uint16_t nas_associd; 577124005Swpaul}; 578124005Swpaul 579124005Swpaultypedef struct ndis_80211_ai_resfi ndis_80211_ai_resfi; 580124005Swpaul 581124005Swpaulstruct ndis_80211_assoc_info { 582124005Swpaul uint32_t nai_len; 583124005Swpaul uint16_t nai_avail_req_fixed_ies; 584124005Swpaul ndis_80211_ai_reqfi nai_req_fixed_ies; 585124005Swpaul uint32_t nai_req_ielen; 586124005Swpaul uint32_t nai_offset_req_ies; 587124005Swpaul uint16_t nai_avail_resp_fixed_ies; 588124005Swpaul ndis_80211_ai_resfi nai_resp_fixed_iex; 589124005Swpaul uint32_t nai_resp_ielen; 590124005Swpaul uint32_t nai_offset_resp_ies; 591124005Swpaul}; 592124005Swpaul 593124005Swpaultypedef struct ndis_80211_assoc_info ndis_80211_assoc_info; 594124005Swpaul 595124005Swpaulstruct ndis_80211_auth_event { 596124005Swpaul ndis_80211_status_indication nae_status; 597124005Swpaul ndis_80211_auth_request nae_request[1]; 598124005Swpaul}; 599124005Swpaul 600124005Swpaultypedef struct ndis_80211_auth_event ndis_80211_auth_event; 601124005Swpaul 602124005Swpaulstruct ndis_80211_test { 603124005Swpaul uint32_t nt_len; 604124005Swpaul uint32_t nt_type; 605124005Swpaul union { 606124005Swpaul ndis_80211_auth_event nt_authevent; 607124005Swpaul uint32_t nt_rssitrigger; 608124005Swpaul } u; 609124005Swpaul}; 610124005Swpaul 611124005Swpaultypedef struct ndis_80211_test ndis_80211_test; 612124005Swpaul 613151207Swpaulstruct ndis_80211_auth_encrypt { 614151207Swpaul uint32_t ne_authmode; 615151207Swpaul uint32_t ne_cryptstat; 616151207Swpaul}; 617151207Swpaul 618151207Swpaultypedef struct ndis_80211_auth_encrypt ndis_80211_auth_encrypt; 619189488Sweongyo 620151207Swpaulstruct ndis_80211_caps { 621151207Swpaul uint32_t nc_len; 622151207Swpaul uint32_t nc_ver; 623151207Swpaul uint32_t nc_numpmkids; 624151207Swpaul ndis_80211_auth_encrypt nc_authencs[1]; 625151207Swpaul}; 626151207Swpaul 627151207Swpaultypedef struct ndis_80211_caps ndis_80211_caps; 628151207Swpaul 629151207Swpaulstruct ndis_80211_bssidinfo { 630151207Swpaul ndis_80211_macaddr nb_bssid; 631151207Swpaul uint8_t nb_pmkid[16]; 632151207Swpaul}; 633151207Swpaul 634151207Swpaultypedef struct ndis_80211_bssidinfo ndis_80211_bssidinfo; 635151207Swpaul 636151207Swpaulstruct ndis_80211_pmkid { 637151207Swpaul uint32_t np_len; 638151207Swpaul uint32_t np_bssidcnt; 639151207Swpaul ndis_80211_bssidinfo np_bssidinfo[1]; 640151207Swpaul}; 641151207Swpaul 642151207Swpaultypedef struct ndis_80211_pmkid ndis_80211_pmkid; 643151207Swpaul 644151207Swpaulstruct ndis_80211_pmkid_cand { 645151207Swpaul ndis_80211_macaddr npc_bssid; 646151207Swpaul uint32_t npc_flags; 647151207Swpaul}; 648151207Swpaul 649151207Swpaultypedef struct ndis_80211_pmkid_cand ndis_80211_pmkid_cand; 650151207Swpaul 651189488Sweongyo#define NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED (0x01) 652151207Swpaul 653151207Swpaulstruct ndis_80211_pmkid_candidate_list { 654151207Swpaul uint32_t npcl_version; 655151207Swpaul uint32_t npcl_numcandidates; 656151207Swpaul ndis_80211_pmkid_cand npcl_candidatelist[1]; 657151207Swpaul}; 658151207Swpaul 659151207Swpaultypedef struct ndis_80211_pmkid_candidate_list ndis_80211_pmkid_candidate_list; 660151207Swpaul 661151207Swpaulstruct ndis_80211_enc_indication { 662151207Swpaul uint32_t nei_statustype; 663151207Swpaul ndis_80211_pmkid_candidate_list nei_pmkidlist; 664151207Swpaul}; 665151207Swpaul 666151207Swpaultypedef struct ndis_80211_enc_indication ndis_80211_enc_indication; 667151207Swpaul 668124813Swpaul/* TCP OIDs. */ 669124813Swpaul 670189488Sweongyo#define OID_TCP_TASK_OFFLOAD 0xFC010201 671189488Sweongyo#define OID_TCP_TASK_IPSEC_ADD_SA 0xFC010202 672189488Sweongyo#define OID_TCP_TASK_IPSEC_DELETE_SA 0xFC010203 673189488Sweongyo#define OID_TCP_SAN_SUPPORT 0xFC010204 674124813Swpaul 675124813Swpaul 676189488Sweongyo#define NDIS_TASK_OFFLOAD_VERSION 1 677124813Swpaul 678189488Sweongyo#define NDIS_TASK_TCPIP_CSUM 0x00000000 679189488Sweongyo#define NDIS_TASK_IPSEC 0x00000001 680189488Sweongyo#define NDIS_TASK_TCP_LARGESEND 0x00000002 681124813Swpaul 682189488Sweongyo#define NDIS_ENCAP_UNSPEC 0x00000000 683189488Sweongyo#define NDIS_ENCAP_NULL 0x00000001 684189488Sweongyo#define NDIS_ENCAP_IEEE802_3 0x00000002 685189488Sweongyo#define NDIS_ENCAP_IEEE802_5 0x00000003 686189488Sweongyo#define NDIS_ENCAP_SNAP_ROUTED 0x00000004 687189488Sweongyo#define NDIS_ENCAP_SNAP_BRIDGED 0x00000005 688124813Swpaul 689189488Sweongyo#define NDIS_ENCAPFLAG_FIXEDHDRLEN 0x00000001 690124813Swpaul 691124813Swpaulstruct ndis_encap_fmt { 692124813Swpaul uint32_t nef_encap; 693124813Swpaul uint32_t nef_flags; 694124813Swpaul uint32_t nef_encaphdrlen; 695124813Swpaul}; 696124813Swpaul 697124813Swpaultypedef struct ndis_encap_fmt ndis_encap_fmt; 698124813Swpaul 699124813Swpaulstruct ndis_task_offload_hdr { 700124813Swpaul uint32_t ntoh_vers; 701124813Swpaul uint32_t ntoh_len; 702124813Swpaul uint32_t ntoh_rsvd; 703124813Swpaul uint32_t ntoh_offset_firsttask; 704124813Swpaul ndis_encap_fmt ntoh_encapfmt; 705124813Swpaul}; 706124813Swpaul 707124813Swpaultypedef struct ndis_task_offload_hdr ndis_task_offload_hdr; 708124813Swpaul 709124813Swpaulstruct ndis_task_offload { 710124813Swpaul uint32_t nto_vers; 711124813Swpaul uint32_t nto_len; 712124813Swpaul uint32_t nto_task; 713124813Swpaul uint32_t nto_offset_nexttask; 714124813Swpaul uint32_t nto_taskbuflen; 715124813Swpaul uint8_t nto_taskbuf[1]; 716124813Swpaul}; 717124813Swpaul 718124813Swpaultypedef struct ndis_task_offload ndis_task_offload; 719124813Swpaul 720189488Sweongyo#define NDIS_TCPSUM_FLAGS_IP_OPTS 0x00000001 721189488Sweongyo#define NDIS_TCPSUM_FLAGS_TCP_OPTS 0x00000002 722189488Sweongyo#define NDIS_TCPSUM_FLAGS_TCP_CSUM 0x00000004 723189488Sweongyo#define NDIS_TCPSUM_FLAGS_UDP_CSUM 0x00000008 724189488Sweongyo#define NDIS_TCPSUM_FLAGS_IP_CSUM 0x00000010 725124813Swpaul 726124813Swpaulstruct ndis_task_tcpip_csum { 727124813Swpaul uint32_t nttc_v4tx; 728124813Swpaul uint32_t nttc_v4rx; 729124813Swpaul uint32_t nttc_v6tx; 730124813Swpaul uint32_t nttc_v6rx; 731124813Swpaul}; 732124813Swpaul 733124813Swpaultypedef struct ndis_task_tcpip_csum ndis_task_tcpip_csum; 734124813Swpaul 735124813Swpaulstruct ndis_task_tcp_largesend { 736124813Swpaul uint32_t nttl_vers; 737124813Swpaul uint32_t nttl_maxofflen; 738124813Swpaul uint32_t nttl_minsegcnt; 739124813Swpaul uint8_t nttl_tcpopt; 740124813Swpaul uint8_t nttl_ipopt; 741124813Swpaul}; 742124813Swpaul 743124813Swpaultypedef struct ndis_task_tcp_largesend ndis_task_tcp_largesend; 744124813Swpaul 745189488Sweongyo#define NDIS_IPSEC_AH_MD5 0x00000001 746189488Sweongyo#define NDIS_IPSEC_AH_SHA1 0x00000002 747189488Sweongyo#define NDIS_IPSEC_AH_TRANSPORT 0x00000004 748189488Sweongyo#define NDIS_IPSEC_AH_TUNNEL 0x00000008 749189488Sweongyo#define NDIS_IPSEC_AH_SEND 0x00000010 750189488Sweongyo#define NDIS_IPSEC_AH_RECEIVE 0x00000020 751124813Swpaul 752189488Sweongyo#define NDIS_IPSEC_ESP_DES 0x00000001 753189488Sweongyo#define NDIS_IPSEC_ESP_RSVD 0x00000002 754189488Sweongyo#define NDIS_IPSEC_ESP_3DES 0x00000004 755189488Sweongyo#define NDIS_IPSEC_ESP_NULL 0x00000008 756189488Sweongyo#define NDIS_IPSEC_ESP_TRANSPORT 0x00000010 757189488Sweongyo#define NDIS_IPSEC_ESP_TUNNEL 0x00000020 758189488Sweongyo#define NDIS_IPSEC_ESP_SEND 0x00000040 759189488Sweongyo#define NDIS_IPSEC_ESP_RECEIVE 0x00000080 760124813Swpaul 761124813Swpaulstruct ndis_task_ipsec { 762124813Swpaul uint32_t nti_ah_esp_combined; 763124813Swpaul uint32_t nti_ah_transport_tunnel_combined; 764124813Swpaul uint32_t nti_v4_options; 765124813Swpaul uint32_t nti_rsvd; 766124813Swpaul uint32_t nti_v4ah; 767124813Swpaul uint32_t nti_v4esp; 768124813Swpaul}; 769124813Swpaul 770124813Swpaultypedef struct ndis_task_ipsec ndis_task_ipsec; 771124813Swpaul 772123474Swpaul/* 773123474Swpaul * Attribures of NDIS drivers. Not all drivers support 774123474Swpaul * all attributes. 775123474Swpaul */ 776123474Swpaul 777189488Sweongyo#define NDIS_ATTRIBUTE_IGNORE_PACKET_TIMEOUT 0x00000001 778189488Sweongyo#define NDIS_ATTRIBUTE_IGNORE_REQUEST_TIMEOUT 0x00000002 779189488Sweongyo#define NDIS_ATTRIBUTE_IGNORE_TOKEN_RING_ERRORS 0x00000004 780189488Sweongyo#define NDIS_ATTRIBUTE_BUS_MASTER 0x00000008 781189488Sweongyo#define NDIS_ATTRIBUTE_INTERMEDIATE_DRIVER 0x00000010 782189488Sweongyo#define NDIS_ATTRIBUTE_DESERIALIZE 0x00000020 783189488Sweongyo#define NDIS_ATTRIBUTE_NO_HALT_ON_SUSPEND 0x00000040 784189488Sweongyo#define NDIS_ATTRIBUTE_SURPRISE_REMOVE_OK 0x00000080 785189488Sweongyo#define NDIS_ATTRIBUTE_NOT_CO_NDIS 0x00000100 786189488Sweongyo#define NDIS_ATTRIBUTE_USES_SAFE_BUFFER_APIS 0x00000200 787123474Swpaul 788189488Sweongyo#define NDIS_SERIALIZED(block) \ 789144174Swpaul (((block)->nmb_flags & NDIS_ATTRIBUTE_DESERIALIZE) == 0) 790144174Swpaul 791123474Swpaulenum ndis_media_state { 792123474Swpaul nmc_connected, 793123474Swpaul nmc_disconnected 794123474Swpaul}; 795123474Swpaul 796123474Swpaultypedef enum ndis_media_state ndis_media_state; 797123474Swpaul 798123474Swpaul/* Ndis Packet Filter Bits (OID_GEN_CURRENT_PACKET_FILTER). */ 799123474Swpaul 800189488Sweongyo#define NDIS_PACKET_TYPE_DIRECTED 0x00000001 801189488Sweongyo#define NDIS_PACKET_TYPE_MULTICAST 0x00000002 802189488Sweongyo#define NDIS_PACKET_TYPE_ALL_MULTICAST 0x00000004 803189488Sweongyo#define NDIS_PACKET_TYPE_BROADCAST 0x00000008 804189488Sweongyo#define NDIS_PACKET_TYPE_SOURCE_ROUTING 0x00000010 805189488Sweongyo#define NDIS_PACKET_TYPE_PROMISCUOUS 0x00000020 806189488Sweongyo#define NDIS_PACKET_TYPE_SMT 0x00000040 807189488Sweongyo#define NDIS_PACKET_TYPE_ALL_LOCAL 0x00000080 808189488Sweongyo#define NDIS_PACKET_TYPE_GROUP 0x00001000 809189488Sweongyo#define NDIS_PACKET_TYPE_ALL_FUNCTIONAL 0x00002000 810189488Sweongyo#define NDIS_PACKET_TYPE_FUNCTIONAL 0x00004000 811189488Sweongyo#define NDIS_PACKET_TYPE_MAC_FRAME 0x00008000 812123474Swpaul 813123474Swpaul 814123474Swpaul/* Ndis MAC option bits (OID_GEN_MAC_OPTIONS). */ 815123474Swpaul 816189488Sweongyo#define NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA 0x00000001 817189488Sweongyo#define NDIS_MAC_OPTION_RECEIVE_SERIALIZED 0x00000002 818189488Sweongyo#define NDIS_MAC_OPTION_TRANSFERS_NOT_PEND 0x00000004 819189488Sweongyo#define NDIS_MAC_OPTION_NO_LOOPBACK 0x00000008 820189488Sweongyo#define NDIS_MAC_OPTION_FULL_DUPLEX 0x00000010 821189488Sweongyo#define NDIS_MAC_OPTION_EOTX_INDICATION 0x00000020 822189488Sweongyo#define NDIS_MAC_OPTION_8021P_PRIORITY 0x00000040 823189488Sweongyo#define NDIS_MAC_OPTION_SUPPORTS_MAC_ADDRESS_OVERWRITE 0x00000080 824189488Sweongyo#define NDIS_MAC_OPTION_RECEIVE_AT_DPC 0x00000100 825189488Sweongyo#define NDIS_MAC_OPTION_8021Q_VLAN 0x00000200 826189488Sweongyo#define NDIS_MAC_OPTION_RESERVED 0x80000000 827123474Swpaul 828189488Sweongyo#define NDIS_DMA_24BITS 0x00 829189488Sweongyo#define NDIS_DMA_32BITS 0x01 830189488Sweongyo#define NDIS_DMA_64BITS 0x02 831123474Swpaul 832141963Swpaul/* 833123474Swpaulstruct ndis_physaddr { 834141963Swpaul#ifdef __i386__ 835123474Swpaul uint64_t np_quad; 836141963Swpaul#endif 837141963Swpaul#ifdef __amd64__ 838141963Swpaul uint32_t np_low; 839141963Swpaul uint32_t np_high; 840189488Sweongyo#define np_quad np_low 841141963Swpaul#endif 842123474Swpaul#ifdef notdef 843123474Swpaul uint32_t np_low; 844123474Swpaul uint32_t np_high; 845123474Swpaul#endif 846123474Swpaul}; 847141963Swpaul*/ 848123474Swpaul 849141963Swpaultypedef struct physaddr ndis_physaddr; 850123474Swpaul 851123474Swpaulstruct ndis_ansi_string { 852123474Swpaul uint16_t nas_len; 853123474Swpaul uint16_t nas_maxlen; 854123474Swpaul char *nas_buf; 855123474Swpaul}; 856123474Swpaul 857123474Swpaultypedef struct ndis_ansi_string ndis_ansi_string; 858123474Swpaul 859141524Swpaul#ifdef notdef 860123474Swpaul/* 861123474Swpaul * nus_buf is really a wchar_t *, but it's inconvenient to include 862123474Swpaul * all the necessary header goop needed to define it, and it's a 863123474Swpaul * pointer anyway, so for now, just make it a uint16_t *. 864123474Swpaul */ 865123474Swpaulstruct ndis_unicode_string { 866123474Swpaul uint16_t nus_len; 867123474Swpaul uint16_t nus_maxlen; 868123474Swpaul uint16_t *nus_buf; 869123474Swpaul}; 870123474Swpaultypedef struct ndis_unicode_string ndis_unicode_string; 871141524Swpaul#endif 872123474Swpaul 873141524Swpaultypedef unicode_string ndis_unicode_string; 874123474Swpaul 875123474Swpaulenum ndis_parm_type { 876123474Swpaul ndis_parm_int, 877123474Swpaul ndis_parm_hexint, 878123474Swpaul ndis_parm_string, 879123474Swpaul ndis_parm_multistring, 880123474Swpaul ndis_parm_binary 881123474Swpaul}; 882123474Swpaul 883123474Swpaultypedef enum ndis_parm_type ndis_parm_type; 884123474Swpaul 885123474Swpaulstruct ndis_binary_data { 886123474Swpaul uint16_t nbd_len; 887123474Swpaul void *nbd_buf; 888123474Swpaul}; 889123474Swpaul 890123474Swpaultypedef struct ndis_binary_data ndis_binary_data; 891123474Swpaul 892123474Swpaulstruct ndis_config_parm { 893123474Swpaul ndis_parm_type ncp_type; 894123474Swpaul union { 895123474Swpaul uint32_t ncp_intdata; 896123474Swpaul ndis_unicode_string ncp_stringdata; 897123474Swpaul ndis_binary_data ncp_binarydata; 898123474Swpaul } ncp_parmdata; 899123474Swpaul}; 900123474Swpaul 901151207Swpaul/* 902151207Swpaul * Not part of Windows NDIS spec; we uses this to keep a 903151207Swpaul * list of ndis_config_parm structures that we've allocated. 904151207Swpaul */ 905151207Swpaul 906123474Swpaultypedef struct ndis_config_parm ndis_config_parm; 907123474Swpaul 908151207Swpaulstruct ndis_parmlist_entry { 909151207Swpaul list_entry np_list; 910151207Swpaul ndis_config_parm np_parm; 911151207Swpaul}; 912151207Swpaul 913151207Swpaultypedef struct ndis_parmlist_entry ndis_parmlist_entry; 914151207Swpaul 915125551Swpaul#ifdef notdef 916123474Swpaulstruct ndis_list_entry { 917123474Swpaul struct ndis_list_entry *nle_flink; 918123474Swpaul struct ndis_list_entry *nle_blink; 919123474Swpaul}; 920123474Swpaul 921123474Swpaultypedef struct ndis_list_entry ndis_list_entry; 922125551Swpaul#endif 923123474Swpaul 924123474Swpaulstruct ndis_bind_paths { 925123474Swpaul uint32_t nbp_number; 926123474Swpaul ndis_unicode_string nbp_paths[1]; 927123474Swpaul}; 928123474Swpaul 929123474Swpaultypedef struct ndis_bind_paths ndis_bind_paths; 930123474Swpaul 931125551Swpaul#ifdef notdef 932123474Swpaulstruct dispatch_header { 933123474Swpaul uint8_t dh_type; 934123474Swpaul uint8_t dh_abs; 935123474Swpaul uint8_t dh_size; 936123474Swpaul uint8_t dh_inserted; 937123474Swpaul uint32_t dh_sigstate; 938125551Swpaul list_entry dh_waitlisthead; 939123474Swpaul}; 940125551Swpaul#endif 941123474Swpaul 942189488Sweongyo#define dispatch_header nt_dispatch_header 943125551Swpaul 944123474Swpaulstruct ndis_ktimer { 945123474Swpaul struct dispatch_header nk_header; 946123474Swpaul uint64_t nk_duetime; 947125551Swpaul list_entry nk_timerlistentry; 948123474Swpaul void *nk_dpc; 949123474Swpaul uint32_t nk_period; 950123474Swpaul}; 951123474Swpaul 952123474Swpaulstruct ndis_kevent { 953123474Swpaul struct dispatch_header nk_header; 954123474Swpaul}; 955123474Swpaul 956123474Swpaulstruct ndis_event { 957127248Swpaul struct nt_kevent ne_event; 958123474Swpaul}; 959123474Swpaul 960123474Swpaultypedef struct ndis_event ndis_event; 961123474Swpaul 962123474Swpaul/* Kernel defered procedure call (i.e. timer callback) */ 963123474Swpaul 964123474Swpaulstruct ndis_kdpc; 965123474Swpaultypedef void (*ndis_kdpc_func)(struct ndis_kdpc *, void *, void *, void *); 966123474Swpaul 967123474Swpaulstruct ndis_kdpc { 968123474Swpaul uint16_t nk_type; 969123474Swpaul uint8_t nk_num; 970123474Swpaul uint8_t nk_importance; 971125551Swpaul list_entry nk_dpclistentry; 972123474Swpaul ndis_kdpc_func nk_deferedfunc; 973123474Swpaul void *nk_deferredctx; 974123474Swpaul void *nk_sysarg1; 975123474Swpaul void *nk_sysarg2; 976123474Swpaul uint32_t *nk_lock; 977123474Swpaul}; 978123474Swpaul 979123474Swpaulstruct ndis_timer { 980127248Swpaul struct ktimer nt_ktimer; 981127248Swpaul struct kdpc nt_kdpc; 982123474Swpaul}; 983123474Swpaul 984123474Swpaultypedef struct ndis_timer ndis_timer; 985123474Swpaul 986144888Swpaultypedef void (*ndis_timer_function)(void *, void *, void *, void *); 987123474Swpaul 988123474Swpaulstruct ndis_miniport_timer { 989127248Swpaul struct ktimer nmt_ktimer; 990127248Swpaul struct kdpc nmt_kdpc; 991123474Swpaul ndis_timer_function nmt_timerfunc; 992123474Swpaul void *nmt_timerctx; 993127248Swpaul ndis_miniport_block *nmt_block; 994123474Swpaul struct ndis_miniport_timer *nmt_nexttimer; 995123474Swpaul}; 996123474Swpaul 997123474Swpaultypedef struct ndis_miniport_timer ndis_miniport_timer; 998123474Swpaul 999123474Swpaulstruct ndis_spin_lock { 1000123474Swpaul ndis_kspin_lock nsl_spinlock; 1001123474Swpaul ndis_kirql nsl_kirql; 1002123474Swpaul}; 1003123474Swpaul 1004123474Swpaultypedef struct ndis_spin_lock ndis_spin_lock; 1005123474Swpaul 1006145895Swpaulstruct ndis_rw_lock { 1007145895Swpaul union { 1008145895Swpaul kspin_lock nrl_spinlock; 1009145895Swpaul void *nrl_ctx; 1010145895Swpaul } u; 1011145895Swpaul uint8_t nrl_rsvd[16]; 1012145895Swpaul}; 1013145895Swpaul 1014189488Sweongyo#define nrl_spinlock u.nrl_spinlock 1015189488Sweongyo#define nrl_ctx u.nrl_ctx; 1016145895Swpaul 1017145895Swpaultypedef struct ndis_rw_lock ndis_rw_lock; 1018145895Swpaul 1019145895Swpaulstruct ndis_lock_state { 1020145895Swpaul uint16_t nls_lockstate; 1021145895Swpaul ndis_kirql nls_oldirql; 1022145895Swpaul}; 1023145895Swpaul 1024145895Swpaultypedef struct ndis_lock_state ndis_lock_state; 1025145895Swpaul 1026123474Swpaulstruct ndis_request { 1027123474Swpaul uint8_t nr_macreserved[4*sizeof(void *)]; 1028123474Swpaul uint32_t nr_requesttype; 1029123474Swpaul union _ndis_data { 1030123474Swpaul struct _ndis_query_information { 1031123474Swpaul ndis_oid nr_oid; 1032123474Swpaul void *nr_infobuf; 1033123474Swpaul uint32_t nr_infobuflen; 1034123474Swpaul uint32_t nr_byteswritten; 1035123474Swpaul uint32_t nr_bytesneeded; 1036123474Swpaul } ndis_query_information; 1037123474Swpaul struct _ndis_set_information { 1038123474Swpaul ndis_oid nr_oid; 1039123474Swpaul void *nr_infobuf; 1040123474Swpaul uint32_t nr_infobuflen; 1041123474Swpaul uint32_t nr_byteswritten; 1042123474Swpaul uint32_t nr_bytesneeded; 1043123474Swpaul } ndis_set_information; 1044123474Swpaul } ndis_data; 1045123474Swpaul /* NDIS 5.0 extentions */ 1046123474Swpaul uint8_t nr_ndis_rsvd[9 * sizeof(void *)]; 1047123474Swpaul union { 1048123474Swpaul uint8_t nr_callmgr_rsvd[2 * sizeof(void *)]; 1049123474Swpaul uint8_t nr_protocol_rsvd[2 * sizeof(void *)]; 1050123474Swpaul } u; 1051123474Swpaul uint8_t nr_miniport_rsvd[2 * sizeof(void *)]; 1052123474Swpaul}; 1053123474Swpaul 1054123474Swpaultypedef struct ndis_request ndis_request; 1055123474Swpaul 1056123474Swpaul/* 1057123474Swpaul * Filler, not used. 1058123474Swpaul */ 1059123474Swpaulstruct ndis_miniport_interrupt { 1060151207Swpaul kinterrupt *ni_introbj; 1061124246Swpaul ndis_kspin_lock ni_dpccountlock; 1062123474Swpaul void *ni_rsvd; 1063123474Swpaul void *ni_isrfunc; 1064123474Swpaul void *ni_dpcfunc; 1065151207Swpaul kdpc ni_dpc; 1066123474Swpaul ndis_miniport_block *ni_block; 1067123474Swpaul uint8_t ni_dpccnt; 1068123474Swpaul uint8_t ni_filler1; 1069151207Swpaul struct nt_kevent ni_dpcevt; 1070123474Swpaul uint8_t ni_shared; 1071123474Swpaul uint8_t ni_isrreq; 1072123474Swpaul}; 1073123474Swpaul 1074123474Swpaultypedef struct ndis_miniport_interrupt ndis_miniport_interrupt; 1075123474Swpaul 1076123474Swpaulenum ndis_interrupt_mode { 1077123474Swpaul nim_level, 1078123474Swpaul nim_latched 1079123474Swpaul}; 1080123474Swpaul 1081123474Swpaultypedef enum ndis_interrupt_mode ndis_interrupt_mode; 1082123474Swpaul 1083189488Sweongyo#define NUMBER_OF_SINGLE_WORK_ITEMS 6 1084123474Swpaul 1085146273Swpaulstruct ndis_work_item; 1086124122Swpaul 1087146273Swpaultypedef void (*ndis_proc)(struct ndis_work_item *, void *); 1088146273Swpaul 1089146273Swpaulstruct ndis_work_item { 1090146273Swpaul void *nwi_ctx; 1091146273Swpaul ndis_proc nwi_func; 1092146273Swpaul uint8_t nwi_wraprsvd[sizeof(void *) * 8]; 1093146273Swpaul}; 1094146273Swpaul 1095146273Swpaultypedef struct ndis_work_item ndis_work_item; 1096146273Swpaul 1097189488Sweongyo#define NdisInitializeWorkItem(w, f, c) \ 1098146273Swpaul do { \ 1099146273Swpaul (w)->nwi_ctx = c; \ 1100146273Swpaul (w)->nwi_func = f; \ 1101146273Swpaul } while (0) 1102146273Swpaul 1103140751Swpaul#ifdef notdef 1104123474Swpaulstruct ndis_buffer { 1105123474Swpaul struct ndis_buffer *nb_next; 1106123474Swpaul uint16_t nb_size; 1107123474Swpaul uint16_t nb_flags; 1108123474Swpaul void *nb_process; 1109123474Swpaul void *nb_mappedsystemva; 1110123474Swpaul void *nb_startva; 1111123474Swpaul uint32_t nb_bytecount; 1112123474Swpaul uint32_t nb_byteoffset; 1113123474Swpaul}; 1114123474Swpaul 1115123474Swpaultypedef struct ndis_buffer ndis_buffer; 1116140751Swpaul#endif 1117123474Swpaul 1118123474Swpaulstruct ndis_sc_element { 1119123474Swpaul ndis_physaddr nse_addr; 1120123474Swpaul uint32_t nse_len; 1121123474Swpaul uint32_t *nse_rsvd; 1122123474Swpaul}; 1123123474Swpaul 1124123474Swpaultypedef struct ndis_sc_element ndis_sc_element; 1125123474Swpaul 1126189488Sweongyo#define NDIS_MAXSEG 32 1127189488Sweongyo#define NDIS_BUS_SPACE_SHARED_MAXADDR 0x3E7FFFFF 1128131750Swpaul 1129123474Swpaulstruct ndis_sc_list { 1130123474Swpaul uint32_t nsl_frags; 1131123474Swpaul uint32_t *nsl_rsvd; 1132123474Swpaul ndis_sc_element nsl_elements[NDIS_MAXSEG]; 1133123474Swpaul}; 1134123474Swpaul 1135123474Swpaultypedef struct ndis_sc_list ndis_sc_list; 1136123474Swpaul 1137124813Swpaulstruct ndis_tcpip_csum { 1138124813Swpaul union { 1139124813Swpaul uint32_t ntc_txflags; 1140124813Swpaul uint32_t ntc_rxflags; 1141124813Swpaul uint32_t ntc_val; 1142124813Swpaul } u; 1143124813Swpaul}; 1144124813Swpaul 1145124813Swpaultypedef struct ndis_tcpip_csum ndis_tcpip_csum; 1146124813Swpaul 1147189488Sweongyo#define NDIS_TXCSUM_DO_IPV4 0x00000001 1148189488Sweongyo#define NDIS_TXCSUM_DO_IPV6 0x00000002 1149189488Sweongyo#define NDIS_TXCSUM_DO_TCP 0x00000004 1150189488Sweongyo#define NDIS_TXCSUM_DO_UDP 0x00000008 1151189488Sweongyo#define NDIS_TXCSUM_DO_IP 0x00000010 1152124813Swpaul 1153189488Sweongyo#define NDIS_RXCSUM_TCP_FAILED 0x00000001 1154189488Sweongyo#define NDIS_RXCSUM_UDP_FAILED 0x00000002 1155189488Sweongyo#define NDIS_RXCSUM_IP_FAILED 0x00000004 1156189488Sweongyo#define NDIS_RXCSUM_TCP_PASSED 0x00000008 1157189488Sweongyo#define NDIS_RXCSUM_UDP_PASSED 0x00000010 1158189488Sweongyo#define NDIS_RXCSUM_IP_PASSED 0x00000020 1159189488Sweongyo#define NDIS_RXCSUM_LOOPBACK 0x00000040 1160124813Swpaul 1161124813Swpaulstruct ndis_vlan { 1162124813Swpaul union { 1163124813Swpaul struct { 1164124813Swpaul uint32_t nvt_userprio:3; 1165124813Swpaul uint32_t nvt_canformatid:1; 1166124813Swpaul uint32_t nvt_vlanid:12; 1167124813Swpaul uint32_t nvt_rsvd:16; 1168124813Swpaul } nv_taghdr; 1169124813Swpaul } u; 1170124813Swpaul}; 1171124813Swpaul 1172124813Swpaultypedef struct ndis_vlan ndis_vlan; 1173124813Swpaul 1174123474Swpaulenum ndis_perpkt_info { 1175123474Swpaul ndis_tcpipcsum_info, 1176123474Swpaul ndis_ipsec_info, 1177123474Swpaul ndis_largesend_info, 1178123474Swpaul ndis_classhandle_info, 1179123474Swpaul ndis_rsvd, 1180123474Swpaul ndis_sclist_info, 1181123474Swpaul ndis_ieee8021q_info, 1182123474Swpaul ndis_originalpkt_info, 1183189488Sweongyo ndis_packetcancelid, 1184123474Swpaul ndis_maxpkt_info 1185123474Swpaul}; 1186123474Swpaul 1187123474Swpaultypedef enum ndis_perpkt_info ndis_perpkt_info; 1188123474Swpaul 1189123474Swpaulstruct ndis_packet_extension { 1190123474Swpaul void *npe_info[ndis_maxpkt_info]; 1191123474Swpaul}; 1192123474Swpaul 1193123474Swpaultypedef struct ndis_packet_extension ndis_packet_extension; 1194123474Swpaul 1195123474Swpaulstruct ndis_packet_private { 1196123474Swpaul uint32_t npp_physcnt; 1197123474Swpaul uint32_t npp_totlen; 1198123474Swpaul ndis_buffer *npp_head; 1199123474Swpaul ndis_buffer *npp_tail; 1200123474Swpaul 1201123474Swpaul void *npp_pool; 1202123474Swpaul uint32_t npp_count; 1203123474Swpaul uint32_t npp_flags; 1204123474Swpaul uint8_t npp_validcounts; 1205123474Swpaul uint8_t npp_ndispktflags; 1206123474Swpaul uint16_t npp_packetooboffset; 1207123474Swpaul}; 1208123474Swpaul 1209189488Sweongyo#define NDIS_FLAGS_PROTOCOL_ID_MASK 0x0000000F 1210189488Sweongyo#define NDIS_FLAGS_MULTICAST_PACKET 0x00000010 1211189488Sweongyo#define NDIS_FLAGS_RESERVED2 0x00000020 1212189488Sweongyo#define NDIS_FLAGS_RESERVED3 0x00000040 1213189488Sweongyo#define NDIS_FLAGS_DONT_LOOPBACK 0x00000080 1214189488Sweongyo#define NDIS_FLAGS_IS_LOOPBACK_PACKET 0x00000100 1215189488Sweongyo#define NDIS_FLAGS_LOOPBACK_ONLY 0x00000200 1216189488Sweongyo#define NDIS_FLAGS_RESERVED4 0x00000400 1217189488Sweongyo#define NDIS_FLAGS_DOUBLE_BUFFERED 0x00000800 1218189488Sweongyo#define NDIS_FLAGS_SENT_AT_DPC 0x00001000 1219189488Sweongyo#define NDIS_FLAGS_USES_SG_BUFFER_LIST 0x00002000 1220123474Swpaul 1221189488Sweongyo#define NDIS_PACKET_WRAPPER_RESERVED 0x3F 1222189488Sweongyo#define NDIS_PACKET_CONTAINS_MEDIA_SPECIFIC_INFO 0x40 1223189488Sweongyo#define NDIS_PACKET_ALLOCATED_BY_NDIS 0x80 1224124278Swpaul 1225189488Sweongyo#define NDIS_PROTOCOL_ID_DEFAULT 0x00 1226189488Sweongyo#define NDIS_PROTOCOL_ID_TCP_IP 0x02 1227189488Sweongyo#define NDIS_PROTOCOL_ID_IPX 0x06 1228189488Sweongyo#define NDIS_PROTOCOL_ID_NBF 0x07 1229189488Sweongyo#define NDIS_PROTOCOL_ID_MAX 0x0F 1230189488Sweongyo#define NDIS_PROTOCOL_ID_MASK 0x0F 1231123474Swpaul 1232123474Swpaultypedef struct ndis_packet_private ndis_packet_private; 1233123474Swpaul 1234123474Swpaulenum ndis_classid { 1235123474Swpaul ndis_class_802_3prio, 1236123474Swpaul ndis_class_wirelesswan_mbx, 1237123474Swpaul ndis_class_irda_packetinfo, 1238123474Swpaul ndis_class_atm_aainfo 1239123474Swpaul}; 1240123474Swpaul 1241123474Swpaultypedef enum ndis_classid ndis_classid; 1242123474Swpaul 1243123474Swpaulstruct ndis_mediaspecific_info { 1244123474Swpaul uint32_t nmi_nextentoffset; 1245123474Swpaul ndis_classid nmi_classid; 1246123474Swpaul uint32_t nmi_size; 1247123474Swpaul uint8_t nmi_classinfo[1]; 1248123474Swpaul}; 1249123474Swpaul 1250123474Swpaultypedef struct ndis_mediaspecific_info ndis_mediaspecific_info; 1251123474Swpaul 1252123474Swpaulstruct ndis_packet_oob { 1253123474Swpaul union { 1254123474Swpaul uint64_t npo_timetotx; 1255123474Swpaul uint64_t npo_timetxed; 1256123474Swpaul } u; 1257123474Swpaul uint64_t npo_timerxed; 1258123474Swpaul uint32_t npo_hdrlen; 1259123474Swpaul uint32_t npo_mediaspecific_len; 1260123474Swpaul void *npo_mediaspecific; 1261123474Swpaul ndis_status npo_status; 1262123474Swpaul}; 1263123474Swpaul 1264123474Swpaultypedef struct ndis_packet_oob ndis_packet_oob; 1265123474Swpaul 1266146230Swpaul/* 1267146230Swpaul * Our protocol private region for handling ethernet. 1268146230Swpaul * We need this to stash some of the things returned 1269146230Swpaul * by NdisMEthIndicateReceive(). 1270146230Swpaul */ 1271146230Swpaul 1272146230Swpaulstruct ndis_ethpriv { 1273146230Swpaul void *nep_ctx; /* packet context */ 1274146230Swpaul long nep_offset; /* residual data to transfer */ 1275146230Swpaul void *nep_pad[2]; 1276146230Swpaul}; 1277146230Swpaul 1278146230Swpaultypedef struct ndis_ethpriv ndis_ethpriv; 1279146230Swpaul 1280189488Sweongyo#define PROTOCOL_RESERVED_SIZE_IN_PACKET (4 * sizeof(void *)) 1281145895Swpaul 1282123474Swpaulstruct ndis_packet { 1283123474Swpaul ndis_packet_private np_private; 1284123474Swpaul union { 1285123535Swpaul /* For connectionless miniports. */ 1286123474Swpaul struct { 1287123474Swpaul uint8_t np_miniport_rsvd[2 * sizeof(void *)]; 1288123474Swpaul uint8_t np_wrapper_rsvd[2 * sizeof(void *)]; 1289123535Swpaul } np_clrsvd; 1290123535Swpaul /* For de-serialized miniports */ 1291123474Swpaul struct { 1292123474Swpaul uint8_t np_miniport_rsvdex[3 * sizeof(void *)]; 1293123474Swpaul uint8_t np_wrapper_rsvdex[sizeof(void *)]; 1294123535Swpaul } np_dsrsvd; 1295123474Swpaul struct { 1296123474Swpaul uint8_t np_mac_rsvd[4 * sizeof(void *)]; 1297123474Swpaul } np_macrsvd; 1298123474Swpaul } u; 1299123474Swpaul uint32_t *np_rsvd[2]; 1300146230Swpaul uint8_t np_protocolreserved[PROTOCOL_RESERVED_SIZE_IN_PACKET]; 1301123474Swpaul 1302123474Swpaul /* 1303123474Swpaul * This next part is probably wrong, but we need some place 1304123474Swpaul * to put the out of band data structure... 1305123474Swpaul */ 1306123474Swpaul ndis_packet_oob np_oob; 1307123474Swpaul ndis_packet_extension np_ext; 1308123474Swpaul ndis_sc_list np_sclist; 1309123826Swpaul 1310123826Swpaul /* BSD-specific stuff which should be invisible to drivers. */ 1311123826Swpaul 1312123826Swpaul uint32_t np_refcnt; 1313123826Swpaul void *np_softc; 1314123826Swpaul void *np_m0; 1315123826Swpaul int np_txidx; 1316151451Swpaul list_entry np_list; 1317123474Swpaul}; 1318123474Swpaul 1319123474Swpaultypedef struct ndis_packet ndis_packet; 1320123474Swpaul 1321151451Swpaulstruct ndis_packet_pool { 1322151451Swpaul slist_header np_head; 1323151451Swpaul int np_dead; 1324151451Swpaul nt_kevent np_event; 1325151451Swpaul kspin_lock np_lock; 1326151451Swpaul int np_cnt; 1327151451Swpaul int np_len; 1328151451Swpaul int np_protrsvd; 1329151451Swpaul void *np_pktmem; 1330151451Swpaul}; 1331151451Swpaul 1332151451Swpaultypedef struct ndis_packet_pool ndis_packet_pool; 1333151451Swpaul 1334123535Swpaul/* mbuf ext type for NDIS */ 1335189488Sweongyo#define EXT_NDIS EXT_NET_DRV 1336123535Swpaul 1337128229Swpaul/* mtx type for NDIS */ 1338189488Sweongyo#define MTX_NDIS_LOCK "NDIS lock" 1339128229Swpaul 1340123474Swpaulstruct ndis_filterdbs { 1341123474Swpaul union { 1342123474Swpaul void *nf_ethdb; 1343123474Swpaul void *nf_nulldb; 1344123474Swpaul } u; 1345123474Swpaul void *nf_trdb; 1346123474Swpaul void *nf_fddidb; 1347123474Swpaul void *nf_arcdb; 1348123474Swpaul}; 1349123474Swpaul 1350123474Swpaultypedef struct ndis_filterdbs ndis_filterdbs; 1351123474Swpaul 1352189488Sweongyo#define nf_ethdb u.nf_ethdb 1353146230Swpaul 1354123474Swpaulenum ndis_medium { 1355123474Swpaul NdisMedium802_3, 1356123474Swpaul NdisMedium802_5, 1357123474Swpaul NdisMediumFddi, 1358123474Swpaul NdisMediumWan, 1359123474Swpaul NdisMediumLocalTalk, 1360123474Swpaul NdisMediumDix, /* defined for convenience, not a real medium */ 1361123474Swpaul NdisMediumArcnetRaw, 1362123474Swpaul NdisMediumArcnet878_2, 1363123474Swpaul NdisMediumAtm, 1364123474Swpaul NdisMediumWirelessWan, 1365123474Swpaul NdisMediumIrda, 1366123474Swpaul NdisMediumBpc, 1367123474Swpaul NdisMediumCoWan, 1368123474Swpaul NdisMedium1394, 1369123474Swpaul NdisMediumMax 1370123474Swpaul}; 1371123474Swpaul 1372123474Swpaultypedef enum ndis_medium ndis_medium; 1373123474Swpaul/* 1374123474Swpaulenum interface_type { 1375123474Swpaul InterfaceTypeUndefined = -1, 1376123474Swpaul Internal, 1377123474Swpaul Isa, 1378123474Swpaul Eisa, 1379123474Swpaul MicroChannel, 1380123474Swpaul TurboChannel, 1381123474Swpaul PCIBus, 1382123474Swpaul VMEBus, 1383123474Swpaul NuBus, 1384123474Swpaul PCMCIABus, 1385123474Swpaul CBus, 1386123474Swpaul MPIBus, 1387123474Swpaul MPSABus, 1388123474Swpaul ProcessorInternal, 1389123474Swpaul InternalPowerBus, 1390123474Swpaul PNPISABus, 1391123474Swpaul PNPBus, 1392123474Swpaul MaximumInterfaceType 1393123474Swpaul}; 1394123474Swpaul*/ 1395123474Swpaulenum ndis_interface_type { 1396123474Swpaul NdisInterfaceInternal = Internal, 1397123474Swpaul NdisInterfaceIsa = Isa, 1398123474Swpaul NdisInterfaceEisa = Eisa, 1399123474Swpaul NdisInterfaceMca = MicroChannel, 1400123474Swpaul NdisInterfaceTurboChannel = TurboChannel, 1401123474Swpaul NdisInterfacePci = PCIBus, 1402123474Swpaul NdisInterfacePcMcia = PCMCIABus 1403123474Swpaul}; 1404123474Swpaul 1405123474Swpaultypedef enum ndis_interface_type ndis_interface_type; 1406123474Swpaul 1407123474Swpaulstruct ndis_paddr_unit { 1408123474Swpaul ndis_physaddr npu_physaddr; 1409123474Swpaul uint32_t npu_len; 1410123474Swpaul}; 1411123474Swpaul 1412123474Swpaultypedef struct ndis_paddr_unit ndis_paddr_unit; 1413123474Swpaul 1414123474Swpaulstruct ndis_map_arg { 1415123474Swpaul ndis_paddr_unit *nma_fraglist; 1416123474Swpaul int nma_cnt; 1417123474Swpaul int nma_max; 1418123474Swpaul}; 1419123474Swpaul 1420123474Swpaul/* 1421123474Swpaul * Miniport characteristics were originally defined in the NDIS 3.0 1422123474Swpaul * spec and then extended twice, in NDIS 4.0 and 5.0. 1423123474Swpaul */ 1424123474Swpaul 1425123474Swpaulstruct ndis_miniport_characteristics { 1426123474Swpaul 1427123474Swpaul /* NDIS 3.0 */ 1428123474Swpaul 1429123474Swpaul uint8_t nmc_version_major; 1430123474Swpaul uint8_t nmc_version_minor; 1431123474Swpaul uint16_t nmc_pad; 1432123474Swpaul uint32_t nmc_rsvd; 1433123474Swpaul void * nmc_checkhang_func; 1434123474Swpaul void * nmc_disable_interrupts_func; 1435123474Swpaul void * nmc_enable_interrupts_func; 1436123474Swpaul void * nmc_halt_func; 1437123474Swpaul void * nmc_interrupt_func; 1438123474Swpaul void * nmc_init_func; 1439123474Swpaul void * nmc_isr_func; 1440123474Swpaul void * nmc_queryinfo_func; 1441123474Swpaul void * nmc_reconfig_func; 1442123474Swpaul void * nmc_reset_func; 1443123474Swpaul void * nmc_sendsingle_func; 1444123474Swpaul void * nmc_setinfo_func; 1445123474Swpaul void * nmc_transferdata_func; 1446123474Swpaul 1447123474Swpaul /* NDIS 4.0 extentions */ 1448123474Swpaul 1449123474Swpaul void * nmc_return_packet_func; 1450123474Swpaul void * nmc_sendmulti_func; 1451123474Swpaul void * nmc_allocate_complete_func; 1452123474Swpaul 1453123474Swpaul /* NDIS 5.0 extensions */ 1454123474Swpaul 1455123474Swpaul void * nmc_cocreatevc_func; 1456123474Swpaul void * nmc_codeletevc_func; 1457123474Swpaul void * nmc_coactivatevc_func; 1458123474Swpaul void * nmc_codeactivatevc_func; 1459123474Swpaul void * nmc_comultisend_func; 1460123474Swpaul void * nmc_corequest_func; 1461123474Swpaul 1462123474Swpaul /* NDIS 5.1 extentions */ 1463123474Swpaul 1464123474Swpaul void * nmc_canceltxpkts_handler; 1465123474Swpaul void * nmc_pnpevent_handler; 1466123474Swpaul void * nmc_shutdown_handler; 1467123474Swpaul void * nmc_rsvd0; 1468123474Swpaul void * nmc_rsvd1; 1469123474Swpaul void * nmc_rsvd2; 1470123474Swpaul void * nmc_rsvd3; 1471123474Swpaul}; 1472123474Swpaul 1473123474Swpaultypedef struct ndis_miniport_characteristics ndis_miniport_characteristics; 1474123474Swpaul 1475123474Swpaulstruct ndis_driver_object { 1476123474Swpaul char *ndo_ifname; 1477123474Swpaul void *ndo_softc; 1478123474Swpaul ndis_miniport_characteristics ndo_chars; 1479123474Swpaul}; 1480123474Swpaul 1481123474Swpaultypedef struct ndis_driver_object ndis_driver_object; 1482123474Swpaul 1483123474Swpaulstruct ndis_reference { 1484123474Swpaul ndis_kspin_lock nr_spinlock; 1485123474Swpaul uint16_t nr_refcnt; 1486123474Swpaul uint8_t nr_closing; 1487123474Swpaul}; 1488123474Swpaul 1489123474Swpaultypedef struct ndis_reference ndis_reference; 1490123474Swpaul 1491123821Swpaulstruct ndis_timer_entry { 1492123832Swpaul struct callout nte_ch; 1493123821Swpaul ndis_miniport_timer *nte_timer; 1494123821Swpaul TAILQ_ENTRY(ndis_timer_entry) link; 1495123821Swpaul}; 1496123821Swpaul 1497123821SwpaulTAILQ_HEAD(nte_head, ndis_timer_entry); 1498123821Swpaul 1499189488Sweongyo#define NDIS_FH_TYPE_VFS 0 1500189488Sweongyo#define NDIS_FH_TYPE_MODULE 1 1501132973Swpaul 1502124246Swpaulstruct ndis_fh { 1503132973Swpaul int nf_type; 1504145895Swpaul char *nf_name; 1505124246Swpaul void *nf_vp; 1506124246Swpaul void *nf_map; 1507189488Sweongyo uint32_t nf_maplen; 1508124246Swpaul}; 1509124246Swpaul 1510124246Swpaultypedef struct ndis_fh ndis_fh; 1511124246Swpaul 1512123474Swpaul/* 1513123474Swpaul * The miniport block is basically the internal NDIS handle. We need 1514123474Swpaul * to define this because, unfortunately, it is not entirely opaque 1515123474Swpaul * to NDIS drivers. For one thing, it contains the function pointer 1516123474Swpaul * to the NDIS packet receive handler, which is invoked out of the 1517123474Swpaul * NDIS block via a macro rather than a function pointer. (The 1518123474Swpaul * NdisMIndicateReceivePacket() routine is a macro rather than 1519123474Swpaul * a function.) For another, the driver maintains a pointer to the 1520123474Swpaul * miniport block and passes it as a handle to various NDIS functions. 1521123474Swpaul * (The driver never really knows this because it's hidden behind 1522123474Swpaul * an ndis_handle though.) 1523123474Swpaul * 1524123474Swpaul * The miniport block has two parts: the first part contains fields 1525123474Swpaul * that must never change, since they are referenced by driver 1526123474Swpaul * binaries through macros. The second part is ignored by the driver, 1527123474Swpaul * but contains various things used internaly by NDIS.SYS. In our 1528123474Swpaul * case, we define the first 'immutable' part exactly as it appears 1529123474Swpaul * in Windows, but don't bother duplicating the Windows definitions 1530123474Swpaul * for the second part. Instead, we replace them with a few BSD-specific 1531123474Swpaul * things. 1532123474Swpaul */ 1533123474Swpaul 1534123474Swpaulstruct ndis_miniport_block { 1535123474Swpaul /* 1536123474Swpaul * Windows-specific portion -- DO NOT MODIFY OR NDIS 1537123474Swpaul * DRIVERS WILL NOT WORK. 1538189488Sweongyo */ 1539123474Swpaul void *nmb_signature; /* magic number */ 1540123474Swpaul ndis_miniport_block *nmb_nextminiport; 1541123474Swpaul ndis_mdriver_block *nmb_driverhandle; 1542123474Swpaul ndis_handle nmb_miniportadapterctx; 1543123474Swpaul ndis_unicode_string nmb_name; 1544123474Swpaul ndis_bind_paths *nmb_bindpaths; 1545123474Swpaul ndis_handle nmb_openqueue; 1546123474Swpaul ndis_reference nmb_ref; 1547123474Swpaul ndis_handle nmb_devicectx; 1548123474Swpaul uint8_t nmb_padding; 1549123474Swpaul uint8_t nmb_lockacquired; 1550123474Swpaul uint8_t nmb_pmodeopens; 1551123474Swpaul uint8_t nmb_assignedcpu; 1552123474Swpaul ndis_kspin_lock nmb_lock; 1553123474Swpaul ndis_request *nmb_mediarequest; 1554123474Swpaul ndis_miniport_interrupt *nmb_interrupt; 1555123474Swpaul uint32_t nmb_flags; 1556123474Swpaul uint32_t nmb_pnpflags; 1557125551Swpaul list_entry nmb_packetlist; 1558123474Swpaul ndis_packet *nmb_firstpendingtxpacket; 1559123474Swpaul ndis_packet *nmb_returnpacketqueue; 1560123474Swpaul uint32_t nmb_requestbuffer; 1561123474Swpaul void *nmb_setmcastbuf; 1562123474Swpaul ndis_miniport_block *nmb_primaryminiport; 1563123474Swpaul void *nmb_wrapperctx; 1564123474Swpaul void *nmb_busdatactx; 1565123474Swpaul uint32_t nmb_pnpcaps; 1566123474Swpaul cm_resource_list *nmb_resources; 1567123474Swpaul ndis_timer nmb_wkupdpctimer; 1568123474Swpaul ndis_unicode_string nmb_basename; 1569123474Swpaul ndis_unicode_string nmb_symlinkname; 1570123474Swpaul uint32_t nmb_checkforhangsecs; 1571123474Swpaul uint16_t nmb_cfhticks; 1572123474Swpaul uint16_t nmb_cfhcurrticks; 1573123474Swpaul ndis_status nmb_resetstatus; 1574123474Swpaul ndis_handle nmb_resetopen; 1575123474Swpaul ndis_filterdbs nmb_filterdbs; 1576123474Swpaul void *nmb_pktind_func; 1577123474Swpaul void *nmb_senddone_func; 1578123474Swpaul void *nmb_sendrsrc_func; 1579123474Swpaul void *nmb_resetdone_func; 1580123474Swpaul ndis_medium nmb_medium; 1581123474Swpaul uint32_t nmb_busnum; 1582141524Swpaul uint32_t nmb_bustype; 1583123474Swpaul uint32_t nmb_adaptertype; 1584141524Swpaul device_object *nmb_deviceobj; /* Functional device */ 1585141524Swpaul device_object *nmb_physdeviceobj; /* Physical device */ 1586141524Swpaul device_object *nmb_nextdeviceobj; /* Next dev in stack */ 1587123474Swpaul void *nmb_mapreg; 1588123474Swpaul void *nmb_callmgraflist; 1589123474Swpaul void *nmb_miniportthread; 1590123474Swpaul void *nmb_setinfobuf; 1591123474Swpaul uint16_t nmb_setinfobuflen; 1592123474Swpaul uint16_t nmb_maxsendpkts; 1593123474Swpaul ndis_status nmb_fakestatus; 1594123474Swpaul void *nmb_lockhandler; 1595123474Swpaul ndis_unicode_string *nmb_adapterinstancename; 1596123474Swpaul void *nmb_timerqueue; 1597123474Swpaul uint32_t nmb_mactoptions; 1598123474Swpaul ndis_request *nmb_pendingreq; 1599123474Swpaul uint32_t nmb_maxlongaddrs; 1600123474Swpaul uint32_t nmb_maxshortaddrs; 1601123474Swpaul uint32_t nmb_currlookahead; 1602123474Swpaul uint32_t nmb_maxlookahead; 1603123474Swpaul void *nmb_interrupt_func; 1604123474Swpaul void *nmb_disableintr_func; 1605123474Swpaul void *nmb_enableintr_func; 1606123474Swpaul void *nmb_sendpkts_func; 1607123474Swpaul void *nmb_deferredsend_func; 1608123474Swpaul void *nmb_ethrxindicate_func; 1609123474Swpaul void *nmb_txrxindicate_func; 1610123474Swpaul void *nmb_fddirxindicate_func; 1611123474Swpaul void *nmb_ethrxdone_func; 1612123474Swpaul void *nmb_txrxdone_func; 1613123474Swpaul void *nmb_fddirxcond_func; 1614123474Swpaul void *nmb_status_func; 1615123474Swpaul void *nmb_statusdone_func; 1616123474Swpaul void *nmb_tdcond_func; 1617123474Swpaul void *nmb_querydone_func; 1618123474Swpaul void *nmb_setdone_func; 1619123474Swpaul void *nmb_wantxdone_func; 1620123474Swpaul void *nmb_wanrx_func; 1621123474Swpaul void *nmb_wanrxdone_func; 1622123474Swpaul /* 1623123474Swpaul * End of windows-specific portion of miniport block. Everything 1624123474Swpaul * below is BSD-specific. 1625123474Swpaul */ 1626151207Swpaul list_entry nmb_parmlist; 1627123474Swpaul ndis_resource_list *nmb_rlist; 1628123695Swpaul ndis_status nmb_getstat; 1629151248Swpaul nt_kevent nmb_getevent; 1630123695Swpaul ndis_status nmb_setstat; 1631151248Swpaul nt_kevent nmb_setevent; 1632151248Swpaul nt_kevent nmb_resetevent; 1633151451Swpaul io_workitem *nmb_returnitem; 1634145895Swpaul ndis_miniport_timer *nmb_timerlist; 1635146230Swpaul ndis_handle nmb_rxpool; 1636151451Swpaul list_entry nmb_returnlist; 1637151451Swpaul kspin_lock nmb_returnlock; 1638125057Swpaul TAILQ_ENTRY(ndis_miniport_block) link; 1639123474Swpaul}; 1640123474Swpaul 1641125057SwpaulTAILQ_HEAD(nd_head, ndis_miniport_block); 1642125057Swpaul 1643123474Swpaultypedef ndis_status (*ndis_init_handler)(ndis_status *, uint32_t *, 1644123474Swpaul ndis_medium *, uint32_t, ndis_handle, ndis_handle); 1645123474Swpaultypedef ndis_status (*ndis_queryinfo_handler)(ndis_handle, ndis_oid, 1646123474Swpaul void *, uint32_t, uint32_t *, uint32_t *); 1647123474Swpaultypedef ndis_status (*ndis_setinfo_handler)(ndis_handle, ndis_oid, 1648123474Swpaul void *, uint32_t, uint32_t *, uint32_t *); 1649123474Swpaultypedef ndis_status (*ndis_sendsingle_handler)(ndis_handle, 1650123474Swpaul ndis_packet *, uint32_t); 1651123474Swpaultypedef ndis_status (*ndis_sendmulti_handler)(ndis_handle, 1652123474Swpaul ndis_packet **, uint32_t); 1653123474Swpaultypedef void (*ndis_isr_handler)(uint8_t *, uint8_t *, ndis_handle); 1654123474Swpaultypedef void (*ndis_interrupt_handler)(ndis_handle); 1655127887Swpaultypedef int (*ndis_reset_handler)(uint8_t *, ndis_handle); 1656123474Swpaultypedef void (*ndis_halt_handler)(ndis_handle); 1657123474Swpaultypedef void (*ndis_return_handler)(ndis_handle, ndis_packet *); 1658123474Swpaultypedef void (*ndis_enable_interrupts_handler)(ndis_handle); 1659123474Swpaultypedef void (*ndis_disable_interrupts_handler)(ndis_handle); 1660123474Swpaultypedef void (*ndis_shutdown_handler)(void *); 1661186507Sweongyotypedef void (*ndis_pnpevent_handler)(void *, int, void *, uint32_t); 1662123474Swpaultypedef void (*ndis_allocdone_handler)(ndis_handle, void *, 1663123474Swpaul ndis_physaddr *, uint32_t, void *); 1664123474Swpaultypedef uint8_t (*ndis_checkforhang_handler)(ndis_handle); 1665123474Swpaul 1666144888Swpaultypedef ndis_status (*driver_entry)(void *, unicode_string *); 1667123474Swpaul 1668123474Swpaulextern image_patch_table ndis_functbl[]; 1669123474Swpaul 1670189488Sweongyo#define NDIS_TASKQUEUE 1 1671189488Sweongyo#define NDIS_SWI 2 1672124697Swpaul 1673189488Sweongyo#define NDIS_PSTATE_RUNNING 1 1674189488Sweongyo#define NDIS_PSTATE_SLEEPING 2 1675125814Swpaul 1676189488Sweongyo#define NdisQueryPacket(p, pbufcnt, bufcnt, firstbuf, plen) \ 1677144174Swpaul do { \ 1678144174Swpaul if ((firstbuf) != NULL) { \ 1679144174Swpaul ndis_buffer **_first; \ 1680144174Swpaul _first = firstbuf; \ 1681144174Swpaul *(_first) = (p)->np_private.npp_head; \ 1682144174Swpaul } \ 1683144174Swpaul if ((plen) || (bufcnt) || (pbufcnt)) { \ 1684144174Swpaul if ((p)->np_private.npp_validcounts == FALSE) { \ 1685144174Swpaul ndis_buffer *tmp; \ 1686144174Swpaul unsigned int tlen = 0, pcnt = 0; \ 1687144174Swpaul unsigned int add = 0; \ 1688144174Swpaul unsigned int pktlen, off; \ 1689144174Swpaul \ 1690144174Swpaul tmp = (p)->np_private.npp_head; \ 1691144174Swpaul while (tmp != NULL) { \ 1692144174Swpaul off = MmGetMdlByteOffset(tmp); \ 1693144174Swpaul pktlen = MmGetMdlByteCount(tmp);\ 1694144174Swpaul tlen += pktlen; \ 1695144174Swpaul pcnt += \ 1696144174Swpaul NDIS_BUFFER_TO_SPAN_PAGES(tmp); \ 1697144174Swpaul add++; \ 1698144174Swpaul tmp = tmp->mdl_next; \ 1699144174Swpaul } \ 1700144174Swpaul (p)->np_private.npp_count = add; \ 1701144174Swpaul (p)->np_private.npp_totlen = tlen; \ 1702144174Swpaul (p)->np_private.npp_physcnt = pcnt; \ 1703144174Swpaul (p)->np_private.npp_validcounts = TRUE; \ 1704144174Swpaul } \ 1705144174Swpaul if (pbufcnt) { \ 1706144174Swpaul unsigned int *_pbufcnt; \ 1707144174Swpaul _pbufcnt = (pbufcnt); \ 1708144174Swpaul *(_pbufcnt) = (p)->np_private.npp_physcnt; \ 1709144174Swpaul } \ 1710144174Swpaul if (bufcnt) { \ 1711144174Swpaul unsigned int *_bufcnt; \ 1712144174Swpaul _bufcnt = (bufcnt); \ 1713144174Swpaul *(_bufcnt) = (p)->np_private.npp_count; \ 1714144174Swpaul } \ 1715144174Swpaul if (plen) { \ 1716144174Swpaul unsigned int *_plen; \ 1717144174Swpaul _plen = (plen); \ 1718144174Swpaul *(_plen) = (p)->np_private.npp_totlen; \ 1719144174Swpaul } \ 1720144174Swpaul } \ 1721144174Swpaul } while (0) 1722144174Swpaul 1723123474Swpaul__BEGIN_DECLS 1724123474Swpaulextern int ndis_libinit(void); 1725123474Swpaulextern int ndis_libfini(void); 1726123474Swpaulextern int ndis_load_driver(vm_offset_t, void *); 1727123474Swpaulextern int ndis_unload_driver(void *); 1728123474Swpaulextern int ndis_mtop(struct mbuf *, ndis_packet **); 1729123474Swpaulextern int ndis_ptom(struct mbuf **, ndis_packet *); 1730123474Swpaulextern int ndis_get_info(void *, ndis_oid, void *, int *); 1731123474Swpaulextern int ndis_set_info(void *, ndis_oid, void *, int *); 1732216242Sbschmidtextern void *ndis_get_routine_address(struct image_patch_table *, char *); 1733123474Swpaulextern int ndis_get_supported_oids(void *, ndis_oid **, int *); 1734123474Swpaulextern int ndis_send_packets(void *, ndis_packet **, int); 1735123474Swpaulextern int ndis_send_packet(void *, ndis_packet *); 1736123474Swpaulextern int ndis_convert_res(void *); 1737123474Swpaulextern int ndis_alloc_amem(void *); 1738131953Swpaulextern void ndis_free_amem(void *); 1739123474Swpaulextern void ndis_free_packet(ndis_packet *); 1740123474Swpaulextern void ndis_free_bufs(ndis_buffer *); 1741123474Swpaulextern int ndis_reset_nic(void *); 1742123474Swpaulextern int ndis_halt_nic(void *); 1743123474Swpaulextern int ndis_shutdown_nic(void *); 1744186507Sweongyoextern int ndis_pnpevent_nic(void *, int); 1745123474Swpaulextern int ndis_init_nic(void *); 1746254842Sandreextern int ndis_return_packet(struct mbuf *, void *, void *); 1747123474Swpaulextern int ndis_init_dma(void *); 1748123474Swpaulextern int ndis_destroy_dma(void *); 1749123474Swpaulextern int ndis_create_sysctls(void *); 1750123474Swpaulextern int ndis_add_sysctl(void *, char *, char *, char *, int); 1751123474Swpaulextern int ndis_flush_sysctls(void *); 1752141963Swpaul 1753144888Swpaulextern uint32_t NdisAddDevice(driver_object *, device_object *); 1754144888Swpaulextern void NdisAllocatePacketPool(ndis_status *, 1755189488Sweongyo ndis_handle *, uint32_t, uint32_t); 1756144888Swpaulextern void NdisAllocatePacketPoolEx(ndis_status *, 1757189488Sweongyo ndis_handle *, uint32_t, uint32_t, uint32_t); 1758144888Swpaulextern uint32_t NdisPacketPoolUsage(ndis_handle); 1759144888Swpaulextern void NdisFreePacketPool(ndis_handle); 1760144888Swpaulextern void NdisAllocatePacket(ndis_status *, 1761141963Swpaul ndis_packet **, ndis_handle); 1762144888Swpaulextern void NdisFreePacket(ndis_packet *); 1763145895Swpaulextern ndis_status NdisScheduleWorkItem(ndis_work_item *); 1764151451Swpaulextern void NdisMSleep(uint32_t); 1765123474Swpaul__END_DECLS 1766123474Swpaul 1767123474Swpaul#endif /* _NDIS_VAR_H_ */ 1768