blob: 4c3c7259f019bd072c3d205db4d563157b6a576c [file] [log] [blame]
David Brownell7e27f182006-06-13 09:54:40 -07001/*
Linus Torvalds1da177e2005-04-16 15:20:36 -07002 * RNDIS Definitions for Remote NDIS
David Brownell7e27f182006-06-13 09:54:40 -07003 *
Linus Torvalds1da177e2005-04-16 15:20:36 -07004 * Version: $Id: rndis.h,v 1.15 2004/03/25 21:33:46 robert Exp $
David Brownell7e27f182006-06-13 09:54:40 -07005 *
Linus Torvalds1da177e2005-04-16 15:20:36 -07006 * Authors: Benedikt Spranger, Pengutronix
David Brownell7e27f182006-06-13 09:54:40 -07007 * Robert Schwebel, Pengutronix
8 *
9 * This program is free software; you can redistribute it and/or
Linus Torvalds1da177e2005-04-16 15:20:36 -070010 * modify it under the terms of the GNU General Public License
David Brownell7e27f182006-06-13 09:54:40 -070011 * version 2, as published by the Free Software Foundation.
12 *
Linus Torvalds1da177e2005-04-16 15:20:36 -070013 * 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 Brownell7e27f182006-06-13 09:54:40 -070037 * RNDIS_STATUS_Xxx -> NDIS_STATUS_Xxx
Linus Torvalds1da177e2005-04-16 15:20:36 -070038 */
39
40/* Message Set for Connectionless (802.3) Devices */
David Brownell6cdee102005-04-18 17:39:34 -070041#define REMOTE_NDIS_PACKET_MSG 0x00000001U
Linus Torvalds1da177e2005-04-16 15:20:36 -070042#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 Brownell7e27f182006-06-13 09:54:40 -070072typedef struct rndis_init_msg_type
Linus Torvalds1da177e2005-04-16 15:20:36 -070073{
74 __le32 MessageType;
75 __le32 MessageLength;
76 __le32 RequestID;
77 __le32 MajorVersion;
78 __le32 MinorVersion;
79 __le32 MaxTransferSize;
80} rndis_init_msg_type;
81
82typedef 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
99typedef struct rndis_halt_msg_type
100{
101 __le32 MessageType;
102 __le32 MessageLength;
103 __le32 RequestID;
104} rndis_halt_msg_type;
105
106typedef 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
117typedef 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
127typedef 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
138typedef struct rndis_set_cmplt_type
139{
140 __le32 MessageType;
141 __le32 MessageLength;
142 __le32 RequestID;
143 __le32 Status;
144} rndis_set_cmplt_type;
145
146typedef struct rndis_reset_msg_type
147{
148 __le32 MessageType;
149 __le32 MessageLength;
150 __le32 Reserved;
151} rndis_reset_msg_type;
152
153typedef struct rndis_reset_cmplt_type
154{
155 __le32 MessageType;
156 __le32 MessageLength;
157 __le32 Status;
158 __le32 AddressingReset;
159} rndis_reset_cmplt_type;
160
161typedef 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
170typedef struct rndis_keepalive_msg_type
171{
172 __le32 MessageType;
173 __le32 MessageLength;
174 __le32 RequestID;
175} rndis_keepalive_msg_type;
176
177typedef struct rndis_keepalive_cmplt_type
178{
179 __le32 MessageType;
180 __le32 MessageLength;
181 __le32 RequestID;
182 __le32 Status;
183} rndis_keepalive_cmplt_type;
184
185struct 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
200struct rndis_config_parameter
201{
202 __le32 ParameterNameOffset;
203 __le32 ParameterNameLength;
204 __le32 ParameterType;
205 __le32 ParameterValueOffset;
206 __le32 ParameterValueLength;
207};
208
209/* implementation specific */
210enum rndis_state
211{
212 RNDIS_UNINITIALIZED,
213 RNDIS_INITIALIZED,
214 RNDIS_DATA_INITIALIZED,
215};
216
217typedef struct rndis_resp_t
218{
219 struct list_head list;
220 u8 *buf;
221 u32 length;
222 int send;
223} rndis_resp_t;
224
225typedef struct rndis_params
226{
227 u8 confignr;
David Brownell340600a2005-04-28 13:45:25 -0700228 u8 used;
229 u16 saved_filter;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700230 enum rndis_state state;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700231 u32 medium;
232 u32 speed;
233 u32 media_state;
David Brownell340600a2005-04-28 13:45:25 -0700234
Linus Torvalds1da177e2005-04-16 15:20:36 -0700235 const u8 *host_mac;
David Brownell340600a2005-04-28 13:45:25 -0700236 u16 *filter;
David Brownell7e27f182006-06-13 09:54:40 -0700237 struct net_device *dev;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700238 struct net_device_stats *stats;
David Brownell340600a2005-04-28 13:45:25 -0700239
Linus Torvalds1da177e2005-04-16 15:20:36 -0700240 u32 vendorID;
241 const char *vendorDescr;
David Brownell7e27f182006-06-13 09:54:40 -0700242 int (*ack) (struct net_device *);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700243 struct list_head resp_queue;
244} rndis_params;
245
246/* RNDIS Message parser and other useless functions */
247int rndis_msg_parser (u8 configNr, u8 *buf);
248int rndis_register (int (*rndis_control_ack) (struct net_device *));
249void rndis_deregister (int configNr);
250int rndis_set_param_dev (u8 configNr, struct net_device *dev,
David Brownell340600a2005-04-28 13:45:25 -0700251 struct net_device_stats *stats,
252 u16 *cdc_filter);
David Brownell7e27f182006-06-13 09:54:40 -0700253int rndis_set_param_vendor (u8 configNr, u32 vendorID,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700254 const char *vendorDescr);
255int rndis_set_param_medium (u8 configNr, u32 medium, u32 speed);
256void rndis_add_hdr (struct sk_buff *skb);
David Brownell6cdee102005-04-18 17:39:34 -0700257int rndis_rm_hdr (struct sk_buff *skb);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700258u8 *rndis_get_next_response (int configNr, u32 *length);
259void rndis_free_response (int configNr, u8 *buf);
260
David Brownell340600a2005-04-28 13:45:25 -0700261void rndis_uninit (int configNr);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700262int rndis_signal_connect (int configNr);
263int rndis_signal_disconnect (int configNr);
264int rndis_state (int configNr);
265extern void rndis_set_host_mac (int configNr, const u8 *addr);
266
David Brownella3536782006-07-06 15:48:53 -0700267int __devinit rndis_init (void);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700268void rndis_exit (void);
269
270#endif /* _LINUX_RNDIS_H */