David Brownell | 7e27f18 | 2006-06-13 09:54:40 -0700 | [diff] [blame] | 1 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | * RNDIS Definitions for Remote NDIS |
David Brownell | 7e27f18 | 2006-06-13 09:54:40 -0700 | [diff] [blame] | 3 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4 | * Version: $Id: rndis.h,v 1.15 2004/03/25 21:33:46 robert Exp $ |
David Brownell | 7e27f18 | 2006-06-13 09:54:40 -0700 | [diff] [blame] | 5 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6 | * Authors: Benedikt Spranger, Pengutronix |
David Brownell | 7e27f18 | 2006-06-13 09:54:40 -0700 | [diff] [blame] | 7 | * Robert Schwebel, Pengutronix |
| 8 | * |
| 9 | * This program is free software; you can redistribute it and/or |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | * modify it under the terms of the GNU General Public License |
David Brownell | 7e27f18 | 2006-06-13 09:54:40 -0700 | [diff] [blame] | 11 | * version 2, as published by the Free Software Foundation. |
| 12 | * |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | * This software was originally developed in conformance with |
| 14 | * Microsoft's Remote NDIS Specification License Agreement. |
| 15 | */ |
| 16 | |
| 17 | #ifndef _LINUX_RNDIS_H |
| 18 | #define _LINUX_RNDIS_H |
| 19 | |
| 20 | #include "ndis.h" |
| 21 | |
| 22 | #define RNDIS_MAXIMUM_FRAME_SIZE 1518 |
| 23 | #define RNDIS_MAX_TOTAL_SIZE 1558 |
| 24 | |
| 25 | /* Remote NDIS Versions */ |
| 26 | #define RNDIS_MAJOR_VERSION 1 |
| 27 | #define RNDIS_MINOR_VERSION 0 |
| 28 | |
| 29 | /* Status Values */ |
| 30 | #define RNDIS_STATUS_SUCCESS 0x00000000U /* Success */ |
| 31 | #define RNDIS_STATUS_FAILURE 0xC0000001U /* Unspecified error */ |
| 32 | #define RNDIS_STATUS_INVALID_DATA 0xC0010015U /* Invalid data */ |
| 33 | #define RNDIS_STATUS_NOT_SUPPORTED 0xC00000BBU /* Unsupported request */ |
| 34 | #define RNDIS_STATUS_MEDIA_CONNECT 0x4001000BU /* Device connected */ |
| 35 | #define RNDIS_STATUS_MEDIA_DISCONNECT 0x4001000CU /* Device disconnected */ |
| 36 | /* For all not specified status messages: |
David Brownell | 7e27f18 | 2006-06-13 09:54:40 -0700 | [diff] [blame] | 37 | * RNDIS_STATUS_Xxx -> NDIS_STATUS_Xxx |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 38 | */ |
| 39 | |
| 40 | /* Message Set for Connectionless (802.3) Devices */ |
David Brownell | 6cdee10 | 2005-04-18 17:39:34 -0700 | [diff] [blame] | 41 | #define REMOTE_NDIS_PACKET_MSG 0x00000001U |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | #define REMOTE_NDIS_INITIALIZE_MSG 0x00000002U /* Initialize device */ |
| 43 | #define REMOTE_NDIS_HALT_MSG 0x00000003U |
| 44 | #define REMOTE_NDIS_QUERY_MSG 0x00000004U |
| 45 | #define REMOTE_NDIS_SET_MSG 0x00000005U |
| 46 | #define REMOTE_NDIS_RESET_MSG 0x00000006U |
| 47 | #define REMOTE_NDIS_INDICATE_STATUS_MSG 0x00000007U |
| 48 | #define REMOTE_NDIS_KEEPALIVE_MSG 0x00000008U |
| 49 | |
| 50 | /* Message completion */ |
| 51 | #define REMOTE_NDIS_INITIALIZE_CMPLT 0x80000002U |
| 52 | #define REMOTE_NDIS_QUERY_CMPLT 0x80000004U |
| 53 | #define REMOTE_NDIS_SET_CMPLT 0x80000005U |
| 54 | #define REMOTE_NDIS_RESET_CMPLT 0x80000006U |
| 55 | #define REMOTE_NDIS_KEEPALIVE_CMPLT 0x80000008U |
| 56 | |
| 57 | /* Device Flags */ |
| 58 | #define RNDIS_DF_CONNECTIONLESS 0x00000001U |
| 59 | #define RNDIS_DF_CONNECTION_ORIENTED 0x00000002U |
| 60 | |
| 61 | #define RNDIS_MEDIUM_802_3 0x00000000U |
| 62 | |
| 63 | /* from drivers/net/sk98lin/h/skgepnmi.h */ |
| 64 | #define OID_PNP_CAPABILITIES 0xFD010100 |
| 65 | #define OID_PNP_SET_POWER 0xFD010101 |
| 66 | #define OID_PNP_QUERY_POWER 0xFD010102 |
| 67 | #define OID_PNP_ADD_WAKE_UP_PATTERN 0xFD010103 |
| 68 | #define OID_PNP_REMOVE_WAKE_UP_PATTERN 0xFD010104 |
| 69 | #define OID_PNP_ENABLE_WAKE_UP 0xFD010106 |
| 70 | |
| 71 | |
David Brownell | 7e27f18 | 2006-06-13 09:54:40 -0700 | [diff] [blame] | 72 | typedef struct rndis_init_msg_type |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 73 | { |
| 74 | __le32 MessageType; |
| 75 | __le32 MessageLength; |
| 76 | __le32 RequestID; |
| 77 | __le32 MajorVersion; |
| 78 | __le32 MinorVersion; |
| 79 | __le32 MaxTransferSize; |
| 80 | } rndis_init_msg_type; |
| 81 | |
| 82 | typedef struct rndis_init_cmplt_type |
| 83 | { |
| 84 | __le32 MessageType; |
| 85 | __le32 MessageLength; |
| 86 | __le32 RequestID; |
| 87 | __le32 Status; |
| 88 | __le32 MajorVersion; |
| 89 | __le32 MinorVersion; |
| 90 | __le32 DeviceFlags; |
| 91 | __le32 Medium; |
| 92 | __le32 MaxPacketsPerTransfer; |
| 93 | __le32 MaxTransferSize; |
| 94 | __le32 PacketAlignmentFactor; |
| 95 | __le32 AFListOffset; |
| 96 | __le32 AFListSize; |
| 97 | } rndis_init_cmplt_type; |
| 98 | |
| 99 | typedef struct rndis_halt_msg_type |
| 100 | { |
| 101 | __le32 MessageType; |
| 102 | __le32 MessageLength; |
| 103 | __le32 RequestID; |
| 104 | } rndis_halt_msg_type; |
| 105 | |
| 106 | typedef struct rndis_query_msg_type |
| 107 | { |
| 108 | __le32 MessageType; |
| 109 | __le32 MessageLength; |
| 110 | __le32 RequestID; |
| 111 | __le32 OID; |
| 112 | __le32 InformationBufferLength; |
| 113 | __le32 InformationBufferOffset; |
| 114 | __le32 DeviceVcHandle; |
| 115 | } rndis_query_msg_type; |
| 116 | |
| 117 | typedef struct rndis_query_cmplt_type |
| 118 | { |
| 119 | __le32 MessageType; |
| 120 | __le32 MessageLength; |
| 121 | __le32 RequestID; |
| 122 | __le32 Status; |
| 123 | __le32 InformationBufferLength; |
| 124 | __le32 InformationBufferOffset; |
| 125 | } rndis_query_cmplt_type; |
| 126 | |
| 127 | typedef struct rndis_set_msg_type |
| 128 | { |
| 129 | __le32 MessageType; |
| 130 | __le32 MessageLength; |
| 131 | __le32 RequestID; |
| 132 | __le32 OID; |
| 133 | __le32 InformationBufferLength; |
| 134 | __le32 InformationBufferOffset; |
| 135 | __le32 DeviceVcHandle; |
| 136 | } rndis_set_msg_type; |
| 137 | |
| 138 | typedef struct rndis_set_cmplt_type |
| 139 | { |
| 140 | __le32 MessageType; |
| 141 | __le32 MessageLength; |
| 142 | __le32 RequestID; |
| 143 | __le32 Status; |
| 144 | } rndis_set_cmplt_type; |
| 145 | |
| 146 | typedef struct rndis_reset_msg_type |
| 147 | { |
| 148 | __le32 MessageType; |
| 149 | __le32 MessageLength; |
| 150 | __le32 Reserved; |
| 151 | } rndis_reset_msg_type; |
| 152 | |
| 153 | typedef struct rndis_reset_cmplt_type |
| 154 | { |
| 155 | __le32 MessageType; |
| 156 | __le32 MessageLength; |
| 157 | __le32 Status; |
| 158 | __le32 AddressingReset; |
| 159 | } rndis_reset_cmplt_type; |
| 160 | |
| 161 | typedef struct rndis_indicate_status_msg_type |
| 162 | { |
| 163 | __le32 MessageType; |
| 164 | __le32 MessageLength; |
| 165 | __le32 Status; |
| 166 | __le32 StatusBufferLength; |
| 167 | __le32 StatusBufferOffset; |
| 168 | } rndis_indicate_status_msg_type; |
| 169 | |
| 170 | typedef struct rndis_keepalive_msg_type |
| 171 | { |
| 172 | __le32 MessageType; |
| 173 | __le32 MessageLength; |
| 174 | __le32 RequestID; |
| 175 | } rndis_keepalive_msg_type; |
| 176 | |
| 177 | typedef struct rndis_keepalive_cmplt_type |
| 178 | { |
| 179 | __le32 MessageType; |
| 180 | __le32 MessageLength; |
| 181 | __le32 RequestID; |
| 182 | __le32 Status; |
| 183 | } rndis_keepalive_cmplt_type; |
| 184 | |
| 185 | struct rndis_packet_msg_type |
| 186 | { |
| 187 | __le32 MessageType; |
| 188 | __le32 MessageLength; |
| 189 | __le32 DataOffset; |
| 190 | __le32 DataLength; |
| 191 | __le32 OOBDataOffset; |
| 192 | __le32 OOBDataLength; |
| 193 | __le32 NumOOBDataElements; |
| 194 | __le32 PerPacketInfoOffset; |
| 195 | __le32 PerPacketInfoLength; |
| 196 | __le32 VcHandle; |
| 197 | __le32 Reserved; |
| 198 | }; |
| 199 | |
| 200 | struct rndis_config_parameter |
| 201 | { |
| 202 | __le32 ParameterNameOffset; |
| 203 | __le32 ParameterNameLength; |
| 204 | __le32 ParameterType; |
| 205 | __le32 ParameterValueOffset; |
| 206 | __le32 ParameterValueLength; |
| 207 | }; |
| 208 | |
| 209 | /* implementation specific */ |
| 210 | enum rndis_state |
| 211 | { |
| 212 | RNDIS_UNINITIALIZED, |
| 213 | RNDIS_INITIALIZED, |
| 214 | RNDIS_DATA_INITIALIZED, |
| 215 | }; |
| 216 | |
| 217 | typedef struct rndis_resp_t |
| 218 | { |
| 219 | struct list_head list; |
| 220 | u8 *buf; |
| 221 | u32 length; |
| 222 | int send; |
| 223 | } rndis_resp_t; |
| 224 | |
| 225 | typedef struct rndis_params |
| 226 | { |
| 227 | u8 confignr; |
David Brownell | 340600a | 2005-04-28 13:45:25 -0700 | [diff] [blame] | 228 | u8 used; |
| 229 | u16 saved_filter; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 230 | enum rndis_state state; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 231 | u32 medium; |
| 232 | u32 speed; |
| 233 | u32 media_state; |
David Brownell | 340600a | 2005-04-28 13:45:25 -0700 | [diff] [blame] | 234 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 235 | const u8 *host_mac; |
David Brownell | 340600a | 2005-04-28 13:45:25 -0700 | [diff] [blame] | 236 | u16 *filter; |
David Brownell | 7e27f18 | 2006-06-13 09:54:40 -0700 | [diff] [blame] | 237 | struct net_device *dev; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 238 | struct net_device_stats *stats; |
David Brownell | 340600a | 2005-04-28 13:45:25 -0700 | [diff] [blame] | 239 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 240 | u32 vendorID; |
| 241 | const char *vendorDescr; |
David Brownell | 7e27f18 | 2006-06-13 09:54:40 -0700 | [diff] [blame] | 242 | int (*ack) (struct net_device *); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 243 | struct list_head resp_queue; |
| 244 | } rndis_params; |
| 245 | |
| 246 | /* RNDIS Message parser and other useless functions */ |
| 247 | int rndis_msg_parser (u8 configNr, u8 *buf); |
| 248 | int rndis_register (int (*rndis_control_ack) (struct net_device *)); |
| 249 | void rndis_deregister (int configNr); |
| 250 | int rndis_set_param_dev (u8 configNr, struct net_device *dev, |
David Brownell | 340600a | 2005-04-28 13:45:25 -0700 | [diff] [blame] | 251 | struct net_device_stats *stats, |
| 252 | u16 *cdc_filter); |
David Brownell | 7e27f18 | 2006-06-13 09:54:40 -0700 | [diff] [blame] | 253 | int rndis_set_param_vendor (u8 configNr, u32 vendorID, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 254 | const char *vendorDescr); |
| 255 | int rndis_set_param_medium (u8 configNr, u32 medium, u32 speed); |
| 256 | void rndis_add_hdr (struct sk_buff *skb); |
David Brownell | 6cdee10 | 2005-04-18 17:39:34 -0700 | [diff] [blame] | 257 | int rndis_rm_hdr (struct sk_buff *skb); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 258 | u8 *rndis_get_next_response (int configNr, u32 *length); |
| 259 | void rndis_free_response (int configNr, u8 *buf); |
| 260 | |
David Brownell | 340600a | 2005-04-28 13:45:25 -0700 | [diff] [blame] | 261 | void rndis_uninit (int configNr); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 262 | int rndis_signal_connect (int configNr); |
| 263 | int rndis_signal_disconnect (int configNr); |
| 264 | int rndis_state (int configNr); |
| 265 | extern void rndis_set_host_mac (int configNr, const u8 *addr); |
| 266 | |
David Brownell | a353678 | 2006-07-06 15:48:53 -0700 | [diff] [blame] | 267 | int __devinit rndis_init (void); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 268 | void rndis_exit (void); |
| 269 | |
| 270 | #endif /* _LINUX_RNDIS_H */ |