Linux kernel & device driver programming

Cross-Referenced Linux and Device Driver Code

[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ]
Version: [ 2.6.11.8 ] [ 2.6.25 ] [ 2.6.25.8 ] [ 2.6.31.13 ] Architecture: [ i386 ]
  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. 
 12  * 
 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:
 37  * RNDIS_STATUS_Xxx -> NDIS_STATUS_Xxx 
 38  */
 39 
 40 /* Message Set for Connectionless (802.3) Devices */
 41 #define REMOTE_NDIS_INITIALIZE_MSG      0x00000002U     /* Initialize device */
 42 #define REMOTE_NDIS_HALT_MSG            0x00000003U
 43 #define REMOTE_NDIS_QUERY_MSG           0x00000004U
 44 #define REMOTE_NDIS_SET_MSG             0x00000005U
 45 #define REMOTE_NDIS_RESET_MSG           0x00000006U
 46 #define REMOTE_NDIS_INDICATE_STATUS_MSG 0x00000007U
 47 #define REMOTE_NDIS_KEEPALIVE_MSG       0x00000008U
 48 
 49 /* Message completion */
 50 #define REMOTE_NDIS_INITIALIZE_CMPLT    0x80000002U
 51 #define REMOTE_NDIS_QUERY_CMPLT         0x80000004U
 52 #define REMOTE_NDIS_SET_CMPLT           0x80000005U
 53 #define REMOTE_NDIS_RESET_CMPLT         0x80000006U
 54 #define REMOTE_NDIS_KEEPALIVE_CMPLT     0x80000008U
 55 
 56 /* Device Flags */
 57 #define RNDIS_DF_CONNECTIONLESS         0x00000001U
 58 #define RNDIS_DF_CONNECTION_ORIENTED    0x00000002U
 59 
 60 #define RNDIS_MEDIUM_802_3              0x00000000U
 61 
 62 /* from drivers/net/sk98lin/h/skgepnmi.h */
 63 #define OID_PNP_CAPABILITIES                    0xFD010100
 64 #define OID_PNP_SET_POWER                       0xFD010101
 65 #define OID_PNP_QUERY_POWER                     0xFD010102
 66 #define OID_PNP_ADD_WAKE_UP_PATTERN             0xFD010103
 67 #define OID_PNP_REMOVE_WAKE_UP_PATTERN          0xFD010104
 68 #define OID_PNP_ENABLE_WAKE_UP                  0xFD010106
 69 
 70 
 71 /* supported OIDs */
 72 static const u32 oid_supported_list [] = 
 73 {
 74         /* the general stuff */
 75         OID_GEN_SUPPORTED_LIST,
 76         OID_GEN_HARDWARE_STATUS,
 77         OID_GEN_MEDIA_SUPPORTED,
 78         OID_GEN_MEDIA_IN_USE,
 79         OID_GEN_MAXIMUM_FRAME_SIZE,
 80         OID_GEN_LINK_SPEED,
 81         OID_GEN_TRANSMIT_BLOCK_SIZE,
 82         OID_GEN_RECEIVE_BLOCK_SIZE,
 83         OID_GEN_VENDOR_ID,
 84         OID_GEN_VENDOR_DESCRIPTION,
 85         OID_GEN_VENDOR_DRIVER_VERSION,
 86         OID_GEN_CURRENT_PACKET_FILTER,
 87         OID_GEN_MAXIMUM_TOTAL_SIZE,
 88         OID_GEN_MEDIA_CONNECT_STATUS,
 89         OID_GEN_PHYSICAL_MEDIUM,
 90 #if 0
 91         OID_GEN_RNDIS_CONFIG_PARAMETER,
 92 #endif
 93         
 94         /* the statistical stuff */
 95         OID_GEN_XMIT_OK,
 96         OID_GEN_RCV_OK,
 97         OID_GEN_XMIT_ERROR,
 98         OID_GEN_RCV_ERROR,
 99         OID_GEN_RCV_NO_BUFFER,
100 #ifdef  RNDIS_OPTIONAL_STATS
101         OID_GEN_DIRECTED_BYTES_XMIT,
102         OID_GEN_DIRECTED_FRAMES_XMIT,
103         OID_GEN_MULTICAST_BYTES_XMIT,
104         OID_GEN_MULTICAST_FRAMES_XMIT,
105         OID_GEN_BROADCAST_BYTES_XMIT,
106         OID_GEN_BROADCAST_FRAMES_XMIT,
107         OID_GEN_DIRECTED_BYTES_RCV,
108         OID_GEN_DIRECTED_FRAMES_RCV,
109         OID_GEN_MULTICAST_BYTES_RCV,
110         OID_GEN_MULTICAST_FRAMES_RCV,
111         OID_GEN_BROADCAST_BYTES_RCV,
112         OID_GEN_BROADCAST_FRAMES_RCV,
113         OID_GEN_RCV_CRC_ERROR,
114         OID_GEN_TRANSMIT_QUEUE_LENGTH,
115 #endif  /* RNDIS_OPTIONAL_STATS */
116 
117         /* mandatory 802.3 */
118         /* the general stuff */
119         OID_802_3_PERMANENT_ADDRESS,
120         OID_802_3_CURRENT_ADDRESS,
121         OID_802_3_MULTICAST_LIST,
122         OID_802_3_MAC_OPTIONS,
123         OID_802_3_MAXIMUM_LIST_SIZE,
124         
125         /* the statistical stuff */
126         OID_802_3_RCV_ERROR_ALIGNMENT,
127         OID_802_3_XMIT_ONE_COLLISION,
128         OID_802_3_XMIT_MORE_COLLISIONS,
129 #ifdef  RNDIS_OPTIONAL_STATS
130         OID_802_3_XMIT_DEFERRED,
131         OID_802_3_XMIT_MAX_COLLISIONS,
132         OID_802_3_RCV_OVERRUN,
133         OID_802_3_XMIT_UNDERRUN,
134         OID_802_3_XMIT_HEARTBEAT_FAILURE,
135         OID_802_3_XMIT_TIMES_CRS_LOST,
136         OID_802_3_XMIT_LATE_COLLISIONS,
137 #endif  /* RNDIS_OPTIONAL_STATS */
138 
139 #ifdef  RNDIS_PM
140         /* PM and wakeup are mandatory for USB: */
141 
142         /* power management */
143         OID_PNP_CAPABILITIES,
144         OID_PNP_QUERY_POWER,
145         OID_PNP_SET_POWER,
146 
147         /* wake up host */
148         OID_PNP_ENABLE_WAKE_UP,
149         OID_PNP_ADD_WAKE_UP_PATTERN,
150         OID_PNP_REMOVE_WAKE_UP_PATTERN,
151 #endif
152 };
153 
154 
155 typedef struct rndis_init_msg_type 
156 {
157         u32     MessageType;
158         u32     MessageLength;
159         u32     RequestID;
160         u32     MajorVersion;
161         u32     MinorVersion;
162         u32     MaxTransferSize;
163 } rndis_init_msg_type;
164 
165 typedef struct rndis_init_cmplt_type
166 {
167         u32     MessageType;
168         u32     MessageLength;
169         u32     RequestID;
170         u32     Status;
171         u32     MajorVersion;
172         u32     MinorVersion;
173         u32     DeviceFlags;
174         u32     Medium;
175         u32     MaxPacketsPerTransfer;
176         u32     MaxTransferSize;
177         u32     PacketAlignmentFactor;
178         u32     AFListOffset;
179         u32     AFListSize;
180 } rndis_init_cmplt_type;
181 
182 typedef struct rndis_halt_msg_type
183 {
184         u32     MessageType;
185         u32     MessageLength;
186         u32     RequestID;
187 } rndis_halt_msg_type;
188 
189 typedef struct rndis_query_msg_type
190 {
191         u32     MessageType;
192         u32     MessageLength;
193         u32     RequestID;
194         u32     OID;
195         u32     InformationBufferLength;
196         u32     InformationBufferOffset;
197         u32     DeviceVcHandle;
198 } rndis_query_msg_type;
199 
200 typedef struct rndis_query_cmplt_type
201 {
202         u32     MessageType;
203         u32     MessageLength;
204         u32     RequestID;
205         u32     Status;
206         u32     InformationBufferLength;
207         u32     InformationBufferOffset;
208 } rndis_query_cmplt_type;
209 
210 typedef struct rndis_set_msg_type
211 {
212         u32     MessageType;
213         u32     MessageLength;
214         u32     RequestID;
215         u32     OID;
216         u32     InformationBufferLength;
217         u32     InformationBufferOffset;
218         u32     DeviceVcHandle;
219 } rndis_set_msg_type;
220 
221 typedef struct rndis_set_cmplt_type
222 {
223         u32     MessageType;
224         u32     MessageLength;
225         u32     RequestID;
226         u32     Status;
227 } rndis_set_cmplt_type;
228 
229 typedef struct rndis_reset_msg_type
230 {
231         u32     MessageType;
232         u32     MessageLength;
233         u32     Reserved;
234 } rndis_reset_msg_type;
235 
236 typedef struct rndis_reset_cmplt_type
237 {
238         u32     MessageType;
239         u32     MessageLength;
240         u32     Status;
241         u32     AddressingReset;
242 } rndis_reset_cmplt_type;
243 
244 typedef struct rndis_indicate_status_msg_type
245 {
246         u32     MessageType;
247         u32     MessageLength;
248         u32     Status;
249         u32     StatusBufferLength;
250         u32     StatusBufferOffset;
251 } rndis_indicate_status_msg_type;
252 
253 typedef struct rndis_keepalive_msg_type
254 {
255         u32     MessageType;
256         u32     MessageLength;
257         u32     RequestID;
258 } rndis_keepalive_msg_type;
259 
260 typedef struct rndis_keepalive_cmplt_type
261 {
262         u32     MessageType;
263         u32     MessageLength;
264         u32     RequestID;
265         u32     Status;
266 } rndis_keepalive_cmplt_type;
267 
268 struct rndis_packet_msg_type
269 {
270         u32     MessageType;
271         u32     MessageLength;
272         u32     DataOffset;
273         u32     DataLength;
274         u32     OOBDataOffset;
275         u32     OOBDataLength;
276         u32     NumOOBDataElements;
277         u32     PerPacketInfoOffset;
278         u32     PerPacketInfoLength;
279         u32     VcHandle;
280         u32     Reserved;
281 };
282 
283 struct rndis_config_parameter
284 {
285         u32     ParameterNameOffset;
286         u32     ParameterNameLength;
287         u32     ParameterType;
288         u32     ParameterValueOffset;
289         u32     ParameterValueLength;
290 };
291 
292 /* implementation specific */
293 enum rndis_state
294 {
295         RNDIS_UNINITIALIZED,
296         RNDIS_INITIALIZED,
297         RNDIS_DATA_INITIALIZED,
298 };
299 
300 typedef struct rndis_resp_t
301 {
302         struct list_head        list;
303         u8                      *buf;
304         u32                     length;
305         int                     send;
306 } rndis_resp_t;
307 
308 typedef struct rndis_params
309 {
310         u8                      confignr;
311         int                     used;
312         enum rndis_state        state;
313         u32                     filter;
314         u32                     medium;
315         u32                     speed;
316         u32                     media_state;
317         const u8                *host_mac;
318         struct net_device       *dev;
319         struct net_device_stats *stats;
320         u32                     vendorID;
321         const char              *vendorDescr;
322         int                     (*ack) (struct net_device *);
323         struct list_head        resp_queue;
324 } rndis_params;
325 
326 /* RNDIS Message parser and other useless functions */
327 int  rndis_msg_parser (u8 configNr, u8 *buf);
328 int  rndis_register (int (*rndis_control_ack) (struct net_device *));
329 void rndis_deregister (int configNr);
330 int  rndis_set_param_dev (u8 configNr, struct net_device *dev,
331                          struct net_device_stats *stats);
332 int  rndis_set_param_vendor (u8 configNr, u32 vendorID, 
333                             const char *vendorDescr);
334 int  rndis_set_param_medium (u8 configNr, u32 medium, u32 speed);
335 void rndis_add_hdr (struct sk_buff *skb);
336 int  rndis_rm_hdr (u8 *buf, u32 *length);
337 u8   *rndis_get_next_response (int configNr, u32 *length);
338 void rndis_free_response (int configNr, u8 *buf);
339 
340 int  rndis_signal_connect (int configNr);
341 int  rndis_signal_disconnect (int configNr);
342 int  rndis_state (int configNr);
343 extern void rndis_set_host_mac (int configNr, const u8 *addr);
344 
345 int __init rndis_init (void);
346 void rndis_exit (void);
347 
348 #endif  /* _LINUX_RNDIS_H */
349 
  This page was automatically generated by the LXR engine.