[PATCH] aic7xxx_osm build fix
[cris-mirror.git] / drivers / usb / gadget / rndis.h
blob2b5b55df3cfd3042bfc189c12e6cbbc8fea54a4b
1 /*
2 * RNDIS Definitions for Remote NDIS
3 *
4 * Version: $Id: rndis.h,v 1.15 2004/03/25 21:33:46 robert Exp $
5 *
6 * Authors: Benedikt Spranger, Pengutronix
7 * Robert Schwebel, Pengutronix
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * version 2, as published by the Free Software Foundation.
13 * This software was originally developed in conformance with
14 * Microsoft's Remote NDIS Specification License Agreement.
17 #ifndef _LINUX_RNDIS_H
18 #define _LINUX_RNDIS_H
20 #include "ndis.h"
22 #define RNDIS_MAXIMUM_FRAME_SIZE 1518
23 #define RNDIS_MAX_TOTAL_SIZE 1558
25 /* Remote NDIS Versions */
26 #define RNDIS_MAJOR_VERSION 1
27 #define RNDIS_MINOR_VERSION 0
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:
37 * RNDIS_STATUS_Xxx -> NDIS_STATUS_Xxx
40 /* Message Set for Connectionless (802.3) Devices */
41 #define REMOTE_NDIS_PACKET_MSG 0x00000001U
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
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
57 /* Device Flags */
58 #define RNDIS_DF_CONNECTIONLESS 0x00000001U
59 #define RNDIS_DF_CONNECTION_ORIENTED 0x00000002U
61 #define RNDIS_MEDIUM_802_3 0x00000000U
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
72 /* supported OIDs */
73 static const u32 oid_supported_list [] =
75 /* the general stuff */
76 OID_GEN_SUPPORTED_LIST,
77 OID_GEN_HARDWARE_STATUS,
78 OID_GEN_MEDIA_SUPPORTED,
79 OID_GEN_MEDIA_IN_USE,
80 OID_GEN_MAXIMUM_FRAME_SIZE,
81 OID_GEN_LINK_SPEED,
82 OID_GEN_TRANSMIT_BLOCK_SIZE,
83 OID_GEN_RECEIVE_BLOCK_SIZE,
84 OID_GEN_VENDOR_ID,
85 OID_GEN_VENDOR_DESCRIPTION,
86 OID_GEN_VENDOR_DRIVER_VERSION,
87 OID_GEN_CURRENT_PACKET_FILTER,
88 OID_GEN_MAXIMUM_TOTAL_SIZE,
89 OID_GEN_MEDIA_CONNECT_STATUS,
90 OID_GEN_PHYSICAL_MEDIUM,
91 #if 0
92 OID_GEN_RNDIS_CONFIG_PARAMETER,
93 #endif
95 /* the statistical stuff */
96 OID_GEN_XMIT_OK,
97 OID_GEN_RCV_OK,
98 OID_GEN_XMIT_ERROR,
99 OID_GEN_RCV_ERROR,
100 OID_GEN_RCV_NO_BUFFER,
101 #ifdef RNDIS_OPTIONAL_STATS
102 OID_GEN_DIRECTED_BYTES_XMIT,
103 OID_GEN_DIRECTED_FRAMES_XMIT,
104 OID_GEN_MULTICAST_BYTES_XMIT,
105 OID_GEN_MULTICAST_FRAMES_XMIT,
106 OID_GEN_BROADCAST_BYTES_XMIT,
107 OID_GEN_BROADCAST_FRAMES_XMIT,
108 OID_GEN_DIRECTED_BYTES_RCV,
109 OID_GEN_DIRECTED_FRAMES_RCV,
110 OID_GEN_MULTICAST_BYTES_RCV,
111 OID_GEN_MULTICAST_FRAMES_RCV,
112 OID_GEN_BROADCAST_BYTES_RCV,
113 OID_GEN_BROADCAST_FRAMES_RCV,
114 OID_GEN_RCV_CRC_ERROR,
115 OID_GEN_TRANSMIT_QUEUE_LENGTH,
116 #endif /* RNDIS_OPTIONAL_STATS */
118 /* mandatory 802.3 */
119 /* the general stuff */
120 OID_802_3_PERMANENT_ADDRESS,
121 OID_802_3_CURRENT_ADDRESS,
122 OID_802_3_MULTICAST_LIST,
123 OID_802_3_MAC_OPTIONS,
124 OID_802_3_MAXIMUM_LIST_SIZE,
126 /* the statistical stuff */
127 OID_802_3_RCV_ERROR_ALIGNMENT,
128 OID_802_3_XMIT_ONE_COLLISION,
129 OID_802_3_XMIT_MORE_COLLISIONS,
130 #ifdef RNDIS_OPTIONAL_STATS
131 OID_802_3_XMIT_DEFERRED,
132 OID_802_3_XMIT_MAX_COLLISIONS,
133 OID_802_3_RCV_OVERRUN,
134 OID_802_3_XMIT_UNDERRUN,
135 OID_802_3_XMIT_HEARTBEAT_FAILURE,
136 OID_802_3_XMIT_TIMES_CRS_LOST,
137 OID_802_3_XMIT_LATE_COLLISIONS,
138 #endif /* RNDIS_OPTIONAL_STATS */
140 #ifdef RNDIS_PM
141 /* PM and wakeup are mandatory for USB: */
143 /* power management */
144 OID_PNP_CAPABILITIES,
145 OID_PNP_QUERY_POWER,
146 OID_PNP_SET_POWER,
148 /* wake up host */
149 OID_PNP_ENABLE_WAKE_UP,
150 OID_PNP_ADD_WAKE_UP_PATTERN,
151 OID_PNP_REMOVE_WAKE_UP_PATTERN,
152 #endif
156 typedef struct rndis_init_msg_type
158 __le32 MessageType;
159 __le32 MessageLength;
160 __le32 RequestID;
161 __le32 MajorVersion;
162 __le32 MinorVersion;
163 __le32 MaxTransferSize;
164 } rndis_init_msg_type;
166 typedef struct rndis_init_cmplt_type
168 __le32 MessageType;
169 __le32 MessageLength;
170 __le32 RequestID;
171 __le32 Status;
172 __le32 MajorVersion;
173 __le32 MinorVersion;
174 __le32 DeviceFlags;
175 __le32 Medium;
176 __le32 MaxPacketsPerTransfer;
177 __le32 MaxTransferSize;
178 __le32 PacketAlignmentFactor;
179 __le32 AFListOffset;
180 __le32 AFListSize;
181 } rndis_init_cmplt_type;
183 typedef struct rndis_halt_msg_type
185 __le32 MessageType;
186 __le32 MessageLength;
187 __le32 RequestID;
188 } rndis_halt_msg_type;
190 typedef struct rndis_query_msg_type
192 __le32 MessageType;
193 __le32 MessageLength;
194 __le32 RequestID;
195 __le32 OID;
196 __le32 InformationBufferLength;
197 __le32 InformationBufferOffset;
198 __le32 DeviceVcHandle;
199 } rndis_query_msg_type;
201 typedef struct rndis_query_cmplt_type
203 __le32 MessageType;
204 __le32 MessageLength;
205 __le32 RequestID;
206 __le32 Status;
207 __le32 InformationBufferLength;
208 __le32 InformationBufferOffset;
209 } rndis_query_cmplt_type;
211 typedef struct rndis_set_msg_type
213 __le32 MessageType;
214 __le32 MessageLength;
215 __le32 RequestID;
216 __le32 OID;
217 __le32 InformationBufferLength;
218 __le32 InformationBufferOffset;
219 __le32 DeviceVcHandle;
220 } rndis_set_msg_type;
222 typedef struct rndis_set_cmplt_type
224 __le32 MessageType;
225 __le32 MessageLength;
226 __le32 RequestID;
227 __le32 Status;
228 } rndis_set_cmplt_type;
230 typedef struct rndis_reset_msg_type
232 __le32 MessageType;
233 __le32 MessageLength;
234 __le32 Reserved;
235 } rndis_reset_msg_type;
237 typedef struct rndis_reset_cmplt_type
239 __le32 MessageType;
240 __le32 MessageLength;
241 __le32 Status;
242 __le32 AddressingReset;
243 } rndis_reset_cmplt_type;
245 typedef struct rndis_indicate_status_msg_type
247 __le32 MessageType;
248 __le32 MessageLength;
249 __le32 Status;
250 __le32 StatusBufferLength;
251 __le32 StatusBufferOffset;
252 } rndis_indicate_status_msg_type;
254 typedef struct rndis_keepalive_msg_type
256 __le32 MessageType;
257 __le32 MessageLength;
258 __le32 RequestID;
259 } rndis_keepalive_msg_type;
261 typedef struct rndis_keepalive_cmplt_type
263 __le32 MessageType;
264 __le32 MessageLength;
265 __le32 RequestID;
266 __le32 Status;
267 } rndis_keepalive_cmplt_type;
269 struct rndis_packet_msg_type
271 __le32 MessageType;
272 __le32 MessageLength;
273 __le32 DataOffset;
274 __le32 DataLength;
275 __le32 OOBDataOffset;
276 __le32 OOBDataLength;
277 __le32 NumOOBDataElements;
278 __le32 PerPacketInfoOffset;
279 __le32 PerPacketInfoLength;
280 __le32 VcHandle;
281 __le32 Reserved;
284 struct rndis_config_parameter
286 __le32 ParameterNameOffset;
287 __le32 ParameterNameLength;
288 __le32 ParameterType;
289 __le32 ParameterValueOffset;
290 __le32 ParameterValueLength;
293 /* implementation specific */
294 enum rndis_state
296 RNDIS_UNINITIALIZED,
297 RNDIS_INITIALIZED,
298 RNDIS_DATA_INITIALIZED,
301 typedef struct rndis_resp_t
303 struct list_head list;
304 u8 *buf;
305 u32 length;
306 int send;
307 } rndis_resp_t;
309 typedef struct rndis_params
311 u8 confignr;
312 int used;
313 enum rndis_state state;
314 u32 filter;
315 u32 medium;
316 u32 speed;
317 u32 media_state;
318 const u8 *host_mac;
319 struct net_device *dev;
320 struct net_device_stats *stats;
321 u32 vendorID;
322 const char *vendorDescr;
323 int (*ack) (struct net_device *);
324 struct list_head resp_queue;
325 } rndis_params;
327 /* RNDIS Message parser and other useless functions */
328 int rndis_msg_parser (u8 configNr, u8 *buf);
329 int rndis_register (int (*rndis_control_ack) (struct net_device *));
330 void rndis_deregister (int configNr);
331 int rndis_set_param_dev (u8 configNr, struct net_device *dev,
332 struct net_device_stats *stats);
333 int rndis_set_param_vendor (u8 configNr, u32 vendorID,
334 const char *vendorDescr);
335 int rndis_set_param_medium (u8 configNr, u32 medium, u32 speed);
336 void rndis_add_hdr (struct sk_buff *skb);
337 int rndis_rm_hdr (struct sk_buff *skb);
338 u8 *rndis_get_next_response (int configNr, u32 *length);
339 void rndis_free_response (int configNr, u8 *buf);
341 int rndis_signal_connect (int configNr);
342 int rndis_signal_disconnect (int configNr);
343 int rndis_state (int configNr);
344 extern void rndis_set_host_mac (int configNr, const u8 *addr);
346 int __init rndis_init (void);
347 void rndis_exit (void);
349 #endif /* _LINUX_RNDIS_H */