fs: use kmem_cache_zalloc instead
[pv_ops_mirror.git] / drivers / usb / gadget / rndis.h
blob397b149f3ca78bd24ea9209b9c5d0b815c61ec69
1 /*
2 * RNDIS Definitions for Remote NDIS
4 * Version: $Id: rndis.h,v 1.15 2004/03/25 21:33:46 robert Exp $
6 * Authors: Benedikt Spranger, Pengutronix
7 * Robert Schwebel, Pengutronix
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 typedef struct rndis_init_msg_type
74 __le32 MessageType;
75 __le32 MessageLength;
76 __le32 RequestID;
77 __le32 MajorVersion;
78 __le32 MinorVersion;
79 __le32 MaxTransferSize;
80 } rndis_init_msg_type;
82 typedef struct rndis_init_cmplt_type
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;
99 typedef struct rndis_halt_msg_type
101 __le32 MessageType;
102 __le32 MessageLength;
103 __le32 RequestID;
104 } rndis_halt_msg_type;
106 typedef struct rndis_query_msg_type
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;
117 typedef struct rndis_query_cmplt_type
119 __le32 MessageType;
120 __le32 MessageLength;
121 __le32 RequestID;
122 __le32 Status;
123 __le32 InformationBufferLength;
124 __le32 InformationBufferOffset;
125 } rndis_query_cmplt_type;
127 typedef struct rndis_set_msg_type
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;
138 typedef struct rndis_set_cmplt_type
140 __le32 MessageType;
141 __le32 MessageLength;
142 __le32 RequestID;
143 __le32 Status;
144 } rndis_set_cmplt_type;
146 typedef struct rndis_reset_msg_type
148 __le32 MessageType;
149 __le32 MessageLength;
150 __le32 Reserved;
151 } rndis_reset_msg_type;
153 typedef struct rndis_reset_cmplt_type
155 __le32 MessageType;
156 __le32 MessageLength;
157 __le32 Status;
158 __le32 AddressingReset;
159 } rndis_reset_cmplt_type;
161 typedef struct rndis_indicate_status_msg_type
163 __le32 MessageType;
164 __le32 MessageLength;
165 __le32 Status;
166 __le32 StatusBufferLength;
167 __le32 StatusBufferOffset;
168 } rndis_indicate_status_msg_type;
170 typedef struct rndis_keepalive_msg_type
172 __le32 MessageType;
173 __le32 MessageLength;
174 __le32 RequestID;
175 } rndis_keepalive_msg_type;
177 typedef struct rndis_keepalive_cmplt_type
179 __le32 MessageType;
180 __le32 MessageLength;
181 __le32 RequestID;
182 __le32 Status;
183 } rndis_keepalive_cmplt_type;
185 struct rndis_packet_msg_type
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 } __attribute__ ((packed));
200 struct rndis_config_parameter
202 __le32 ParameterNameOffset;
203 __le32 ParameterNameLength;
204 __le32 ParameterType;
205 __le32 ParameterValueOffset;
206 __le32 ParameterValueLength;
209 /* implementation specific */
210 enum rndis_state
212 RNDIS_UNINITIALIZED,
213 RNDIS_INITIALIZED,
214 RNDIS_DATA_INITIALIZED,
217 typedef struct rndis_resp_t
219 struct list_head list;
220 u8 *buf;
221 u32 length;
222 int send;
223 } rndis_resp_t;
225 typedef struct rndis_params
227 u8 confignr;
228 u8 used;
229 u16 saved_filter;
230 enum rndis_state state;
231 u32 medium;
232 u32 speed;
233 u32 media_state;
235 const u8 *host_mac;
236 u16 *filter;
237 struct net_device *dev;
238 struct net_device_stats *stats;
240 u32 vendorID;
241 const char *vendorDescr;
242 int (*ack) (struct net_device *);
243 struct list_head resp_queue;
244 } rndis_params;
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,
251 struct net_device_stats *stats,
252 u16 *cdc_filter);
253 int rndis_set_param_vendor (u8 configNr, u32 vendorID,
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);
257 int rndis_rm_hdr (struct sk_buff *skb);
258 u8 *rndis_get_next_response (int configNr, u32 *length);
259 void rndis_free_response (int configNr, u8 *buf);
261 void rndis_uninit (int configNr);
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);
267 int __devinit rndis_init (void);
268 void rndis_exit (void);
270 #endif /* _LINUX_RNDIS_H */