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