Commit 007e5c8e6aad8526e234b2481d2104e3e1fe8b88

Authored by Linus Walleij
Committed by David S. Miller
1 parent 7591157e18

usb/net: rndis: remove ambigous status codes

The RNDIS status codes are redefined with much stranged ifdeffery
and only one of these codes was used in the hyperv driver, and
there it is very clearly referring to the RNDIS variant, not some
other status. So clarify this by explictly using the RNDIS_*
prefixed status code in the hyperv drivera and delete the
duplicate defines.

Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 2 changed files with 5 additions and 30 deletions Inline Diff

drivers/net/hyperv/rndis_filter.c
1 /* 1 /*
2 * Copyright (c) 2009, Microsoft Corporation. 2 * Copyright (c) 2009, Microsoft Corporation.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License, 5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation. 6 * version 2, as published by the Free Software Foundation.
7 * 7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT 8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details. 11 * more details.
12 * 12 *
13 * You should have received a copy of the GNU General Public License along with 13 * You should have received a copy of the GNU General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple 14 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
15 * Place - Suite 330, Boston, MA 02111-1307 USA. 15 * Place - Suite 330, Boston, MA 02111-1307 USA.
16 * 16 *
17 * Authors: 17 * Authors:
18 * Haiyang Zhang <haiyangz@microsoft.com> 18 * Haiyang Zhang <haiyangz@microsoft.com>
19 * Hank Janssen <hjanssen@microsoft.com> 19 * Hank Janssen <hjanssen@microsoft.com>
20 */ 20 */
21 #include <linux/kernel.h> 21 #include <linux/kernel.h>
22 #include <linux/sched.h> 22 #include <linux/sched.h>
23 #include <linux/wait.h> 23 #include <linux/wait.h>
24 #include <linux/highmem.h> 24 #include <linux/highmem.h>
25 #include <linux/slab.h> 25 #include <linux/slab.h>
26 #include <linux/io.h> 26 #include <linux/io.h>
27 #include <linux/if_ether.h> 27 #include <linux/if_ether.h>
28 #include <linux/netdevice.h> 28 #include <linux/netdevice.h>
29 #include <linux/if_vlan.h> 29 #include <linux/if_vlan.h>
30 30
31 #include "hyperv_net.h" 31 #include "hyperv_net.h"
32 32
33 33
34 struct rndis_request { 34 struct rndis_request {
35 struct list_head list_ent; 35 struct list_head list_ent;
36 struct completion wait_event; 36 struct completion wait_event;
37 37
38 /* 38 /*
39 * FIXME: We assumed a fixed size response here. If we do ever need to 39 * FIXME: We assumed a fixed size response here. If we do ever need to
40 * handle a bigger response, we can either define a max response 40 * handle a bigger response, we can either define a max response
41 * message or add a response buffer variable above this field 41 * message or add a response buffer variable above this field
42 */ 42 */
43 struct rndis_message response_msg; 43 struct rndis_message response_msg;
44 44
45 /* Simplify allocation by having a netvsc packet inline */ 45 /* Simplify allocation by having a netvsc packet inline */
46 struct hv_netvsc_packet pkt; 46 struct hv_netvsc_packet pkt;
47 struct hv_page_buffer buf; 47 struct hv_page_buffer buf;
48 /* FIXME: We assumed a fixed size request here. */ 48 /* FIXME: We assumed a fixed size request here. */
49 struct rndis_message request_msg; 49 struct rndis_message request_msg;
50 }; 50 };
51 51
52 static void rndis_filter_send_completion(void *ctx); 52 static void rndis_filter_send_completion(void *ctx);
53 53
54 static void rndis_filter_send_request_completion(void *ctx); 54 static void rndis_filter_send_request_completion(void *ctx);
55 55
56 56
57 57
58 static struct rndis_device *get_rndis_device(void) 58 static struct rndis_device *get_rndis_device(void)
59 { 59 {
60 struct rndis_device *device; 60 struct rndis_device *device;
61 61
62 device = kzalloc(sizeof(struct rndis_device), GFP_KERNEL); 62 device = kzalloc(sizeof(struct rndis_device), GFP_KERNEL);
63 if (!device) 63 if (!device)
64 return NULL; 64 return NULL;
65 65
66 spin_lock_init(&device->request_lock); 66 spin_lock_init(&device->request_lock);
67 67
68 INIT_LIST_HEAD(&device->req_list); 68 INIT_LIST_HEAD(&device->req_list);
69 69
70 device->state = RNDIS_DEV_UNINITIALIZED; 70 device->state = RNDIS_DEV_UNINITIALIZED;
71 71
72 return device; 72 return device;
73 } 73 }
74 74
75 static struct rndis_request *get_rndis_request(struct rndis_device *dev, 75 static struct rndis_request *get_rndis_request(struct rndis_device *dev,
76 u32 msg_type, 76 u32 msg_type,
77 u32 msg_len) 77 u32 msg_len)
78 { 78 {
79 struct rndis_request *request; 79 struct rndis_request *request;
80 struct rndis_message *rndis_msg; 80 struct rndis_message *rndis_msg;
81 struct rndis_set_request *set; 81 struct rndis_set_request *set;
82 unsigned long flags; 82 unsigned long flags;
83 83
84 request = kzalloc(sizeof(struct rndis_request), GFP_KERNEL); 84 request = kzalloc(sizeof(struct rndis_request), GFP_KERNEL);
85 if (!request) 85 if (!request)
86 return NULL; 86 return NULL;
87 87
88 init_completion(&request->wait_event); 88 init_completion(&request->wait_event);
89 89
90 rndis_msg = &request->request_msg; 90 rndis_msg = &request->request_msg;
91 rndis_msg->ndis_msg_type = msg_type; 91 rndis_msg->ndis_msg_type = msg_type;
92 rndis_msg->msg_len = msg_len; 92 rndis_msg->msg_len = msg_len;
93 93
94 /* 94 /*
95 * Set the request id. This field is always after the rndis header for 95 * Set the request id. This field is always after the rndis header for
96 * request/response packet types so we just used the SetRequest as a 96 * request/response packet types so we just used the SetRequest as a
97 * template 97 * template
98 */ 98 */
99 set = &rndis_msg->msg.set_req; 99 set = &rndis_msg->msg.set_req;
100 set->req_id = atomic_inc_return(&dev->new_req_id); 100 set->req_id = atomic_inc_return(&dev->new_req_id);
101 101
102 /* Add to the request list */ 102 /* Add to the request list */
103 spin_lock_irqsave(&dev->request_lock, flags); 103 spin_lock_irqsave(&dev->request_lock, flags);
104 list_add_tail(&request->list_ent, &dev->req_list); 104 list_add_tail(&request->list_ent, &dev->req_list);
105 spin_unlock_irqrestore(&dev->request_lock, flags); 105 spin_unlock_irqrestore(&dev->request_lock, flags);
106 106
107 return request; 107 return request;
108 } 108 }
109 109
110 static void put_rndis_request(struct rndis_device *dev, 110 static void put_rndis_request(struct rndis_device *dev,
111 struct rndis_request *req) 111 struct rndis_request *req)
112 { 112 {
113 unsigned long flags; 113 unsigned long flags;
114 114
115 spin_lock_irqsave(&dev->request_lock, flags); 115 spin_lock_irqsave(&dev->request_lock, flags);
116 list_del(&req->list_ent); 116 list_del(&req->list_ent);
117 spin_unlock_irqrestore(&dev->request_lock, flags); 117 spin_unlock_irqrestore(&dev->request_lock, flags);
118 118
119 kfree(req); 119 kfree(req);
120 } 120 }
121 121
122 static void dump_rndis_message(struct hv_device *hv_dev, 122 static void dump_rndis_message(struct hv_device *hv_dev,
123 struct rndis_message *rndis_msg) 123 struct rndis_message *rndis_msg)
124 { 124 {
125 struct net_device *netdev; 125 struct net_device *netdev;
126 struct netvsc_device *net_device; 126 struct netvsc_device *net_device;
127 127
128 net_device = hv_get_drvdata(hv_dev); 128 net_device = hv_get_drvdata(hv_dev);
129 netdev = net_device->ndev; 129 netdev = net_device->ndev;
130 130
131 switch (rndis_msg->ndis_msg_type) { 131 switch (rndis_msg->ndis_msg_type) {
132 case REMOTE_NDIS_PACKET_MSG: 132 case REMOTE_NDIS_PACKET_MSG:
133 netdev_dbg(netdev, "REMOTE_NDIS_PACKET_MSG (len %u, " 133 netdev_dbg(netdev, "REMOTE_NDIS_PACKET_MSG (len %u, "
134 "data offset %u data len %u, # oob %u, " 134 "data offset %u data len %u, # oob %u, "
135 "oob offset %u, oob len %u, pkt offset %u, " 135 "oob offset %u, oob len %u, pkt offset %u, "
136 "pkt len %u\n", 136 "pkt len %u\n",
137 rndis_msg->msg_len, 137 rndis_msg->msg_len,
138 rndis_msg->msg.pkt.data_offset, 138 rndis_msg->msg.pkt.data_offset,
139 rndis_msg->msg.pkt.data_len, 139 rndis_msg->msg.pkt.data_len,
140 rndis_msg->msg.pkt.num_oob_data_elements, 140 rndis_msg->msg.pkt.num_oob_data_elements,
141 rndis_msg->msg.pkt.oob_data_offset, 141 rndis_msg->msg.pkt.oob_data_offset,
142 rndis_msg->msg.pkt.oob_data_len, 142 rndis_msg->msg.pkt.oob_data_len,
143 rndis_msg->msg.pkt.per_pkt_info_offset, 143 rndis_msg->msg.pkt.per_pkt_info_offset,
144 rndis_msg->msg.pkt.per_pkt_info_len); 144 rndis_msg->msg.pkt.per_pkt_info_len);
145 break; 145 break;
146 146
147 case REMOTE_NDIS_INITIALIZE_CMPLT: 147 case REMOTE_NDIS_INITIALIZE_CMPLT:
148 netdev_dbg(netdev, "REMOTE_NDIS_INITIALIZE_CMPLT " 148 netdev_dbg(netdev, "REMOTE_NDIS_INITIALIZE_CMPLT "
149 "(len %u, id 0x%x, status 0x%x, major %d, minor %d, " 149 "(len %u, id 0x%x, status 0x%x, major %d, minor %d, "
150 "device flags %d, max xfer size 0x%x, max pkts %u, " 150 "device flags %d, max xfer size 0x%x, max pkts %u, "
151 "pkt aligned %u)\n", 151 "pkt aligned %u)\n",
152 rndis_msg->msg_len, 152 rndis_msg->msg_len,
153 rndis_msg->msg.init_complete.req_id, 153 rndis_msg->msg.init_complete.req_id,
154 rndis_msg->msg.init_complete.status, 154 rndis_msg->msg.init_complete.status,
155 rndis_msg->msg.init_complete.major_ver, 155 rndis_msg->msg.init_complete.major_ver,
156 rndis_msg->msg.init_complete.minor_ver, 156 rndis_msg->msg.init_complete.minor_ver,
157 rndis_msg->msg.init_complete.dev_flags, 157 rndis_msg->msg.init_complete.dev_flags,
158 rndis_msg->msg.init_complete.max_xfer_size, 158 rndis_msg->msg.init_complete.max_xfer_size,
159 rndis_msg->msg.init_complete. 159 rndis_msg->msg.init_complete.
160 max_pkt_per_msg, 160 max_pkt_per_msg,
161 rndis_msg->msg.init_complete. 161 rndis_msg->msg.init_complete.
162 pkt_alignment_factor); 162 pkt_alignment_factor);
163 break; 163 break;
164 164
165 case REMOTE_NDIS_QUERY_CMPLT: 165 case REMOTE_NDIS_QUERY_CMPLT:
166 netdev_dbg(netdev, "REMOTE_NDIS_QUERY_CMPLT " 166 netdev_dbg(netdev, "REMOTE_NDIS_QUERY_CMPLT "
167 "(len %u, id 0x%x, status 0x%x, buf len %u, " 167 "(len %u, id 0x%x, status 0x%x, buf len %u, "
168 "buf offset %u)\n", 168 "buf offset %u)\n",
169 rndis_msg->msg_len, 169 rndis_msg->msg_len,
170 rndis_msg->msg.query_complete.req_id, 170 rndis_msg->msg.query_complete.req_id,
171 rndis_msg->msg.query_complete.status, 171 rndis_msg->msg.query_complete.status,
172 rndis_msg->msg.query_complete. 172 rndis_msg->msg.query_complete.
173 info_buflen, 173 info_buflen,
174 rndis_msg->msg.query_complete. 174 rndis_msg->msg.query_complete.
175 info_buf_offset); 175 info_buf_offset);
176 break; 176 break;
177 177
178 case REMOTE_NDIS_SET_CMPLT: 178 case REMOTE_NDIS_SET_CMPLT:
179 netdev_dbg(netdev, 179 netdev_dbg(netdev,
180 "REMOTE_NDIS_SET_CMPLT (len %u, id 0x%x, status 0x%x)\n", 180 "REMOTE_NDIS_SET_CMPLT (len %u, id 0x%x, status 0x%x)\n",
181 rndis_msg->msg_len, 181 rndis_msg->msg_len,
182 rndis_msg->msg.set_complete.req_id, 182 rndis_msg->msg.set_complete.req_id,
183 rndis_msg->msg.set_complete.status); 183 rndis_msg->msg.set_complete.status);
184 break; 184 break;
185 185
186 case REMOTE_NDIS_INDICATE_STATUS_MSG: 186 case REMOTE_NDIS_INDICATE_STATUS_MSG:
187 netdev_dbg(netdev, "REMOTE_NDIS_INDICATE_STATUS_MSG " 187 netdev_dbg(netdev, "REMOTE_NDIS_INDICATE_STATUS_MSG "
188 "(len %u, status 0x%x, buf len %u, buf offset %u)\n", 188 "(len %u, status 0x%x, buf len %u, buf offset %u)\n",
189 rndis_msg->msg_len, 189 rndis_msg->msg_len,
190 rndis_msg->msg.indicate_status.status, 190 rndis_msg->msg.indicate_status.status,
191 rndis_msg->msg.indicate_status.status_buflen, 191 rndis_msg->msg.indicate_status.status_buflen,
192 rndis_msg->msg.indicate_status.status_buf_offset); 192 rndis_msg->msg.indicate_status.status_buf_offset);
193 break; 193 break;
194 194
195 default: 195 default:
196 netdev_dbg(netdev, "0x%x (len %u)\n", 196 netdev_dbg(netdev, "0x%x (len %u)\n",
197 rndis_msg->ndis_msg_type, 197 rndis_msg->ndis_msg_type,
198 rndis_msg->msg_len); 198 rndis_msg->msg_len);
199 break; 199 break;
200 } 200 }
201 } 201 }
202 202
203 static int rndis_filter_send_request(struct rndis_device *dev, 203 static int rndis_filter_send_request(struct rndis_device *dev,
204 struct rndis_request *req) 204 struct rndis_request *req)
205 { 205 {
206 int ret; 206 int ret;
207 struct hv_netvsc_packet *packet; 207 struct hv_netvsc_packet *packet;
208 208
209 /* Setup the packet to send it */ 209 /* Setup the packet to send it */
210 packet = &req->pkt; 210 packet = &req->pkt;
211 211
212 packet->is_data_pkt = false; 212 packet->is_data_pkt = false;
213 packet->total_data_buflen = req->request_msg.msg_len; 213 packet->total_data_buflen = req->request_msg.msg_len;
214 packet->page_buf_cnt = 1; 214 packet->page_buf_cnt = 1;
215 215
216 packet->page_buf[0].pfn = virt_to_phys(&req->request_msg) >> 216 packet->page_buf[0].pfn = virt_to_phys(&req->request_msg) >>
217 PAGE_SHIFT; 217 PAGE_SHIFT;
218 packet->page_buf[0].len = req->request_msg.msg_len; 218 packet->page_buf[0].len = req->request_msg.msg_len;
219 packet->page_buf[0].offset = 219 packet->page_buf[0].offset =
220 (unsigned long)&req->request_msg & (PAGE_SIZE - 1); 220 (unsigned long)&req->request_msg & (PAGE_SIZE - 1);
221 221
222 packet->completion.send.send_completion_ctx = req;/* packet; */ 222 packet->completion.send.send_completion_ctx = req;/* packet; */
223 packet->completion.send.send_completion = 223 packet->completion.send.send_completion =
224 rndis_filter_send_request_completion; 224 rndis_filter_send_request_completion;
225 packet->completion.send.send_completion_tid = (unsigned long)dev; 225 packet->completion.send.send_completion_tid = (unsigned long)dev;
226 226
227 ret = netvsc_send(dev->net_dev->dev, packet); 227 ret = netvsc_send(dev->net_dev->dev, packet);
228 return ret; 228 return ret;
229 } 229 }
230 230
231 static void rndis_filter_receive_response(struct rndis_device *dev, 231 static void rndis_filter_receive_response(struct rndis_device *dev,
232 struct rndis_message *resp) 232 struct rndis_message *resp)
233 { 233 {
234 struct rndis_request *request = NULL; 234 struct rndis_request *request = NULL;
235 bool found = false; 235 bool found = false;
236 unsigned long flags; 236 unsigned long flags;
237 struct net_device *ndev; 237 struct net_device *ndev;
238 238
239 ndev = dev->net_dev->ndev; 239 ndev = dev->net_dev->ndev;
240 240
241 spin_lock_irqsave(&dev->request_lock, flags); 241 spin_lock_irqsave(&dev->request_lock, flags);
242 list_for_each_entry(request, &dev->req_list, list_ent) { 242 list_for_each_entry(request, &dev->req_list, list_ent) {
243 /* 243 /*
244 * All request/response message contains RequestId as the 1st 244 * All request/response message contains RequestId as the 1st
245 * field 245 * field
246 */ 246 */
247 if (request->request_msg.msg.init_req.req_id 247 if (request->request_msg.msg.init_req.req_id
248 == resp->msg.init_complete.req_id) { 248 == resp->msg.init_complete.req_id) {
249 found = true; 249 found = true;
250 break; 250 break;
251 } 251 }
252 } 252 }
253 spin_unlock_irqrestore(&dev->request_lock, flags); 253 spin_unlock_irqrestore(&dev->request_lock, flags);
254 254
255 if (found) { 255 if (found) {
256 if (resp->msg_len <= sizeof(struct rndis_message)) { 256 if (resp->msg_len <= sizeof(struct rndis_message)) {
257 memcpy(&request->response_msg, resp, 257 memcpy(&request->response_msg, resp,
258 resp->msg_len); 258 resp->msg_len);
259 } else { 259 } else {
260 netdev_err(ndev, 260 netdev_err(ndev,
261 "rndis response buffer overflow " 261 "rndis response buffer overflow "
262 "detected (size %u max %zu)\n", 262 "detected (size %u max %zu)\n",
263 resp->msg_len, 263 resp->msg_len,
264 sizeof(struct rndis_filter_packet)); 264 sizeof(struct rndis_filter_packet));
265 265
266 if (resp->ndis_msg_type == 266 if (resp->ndis_msg_type ==
267 REMOTE_NDIS_RESET_CMPLT) { 267 REMOTE_NDIS_RESET_CMPLT) {
268 /* does not have a request id field */ 268 /* does not have a request id field */
269 request->response_msg.msg.reset_complete. 269 request->response_msg.msg.reset_complete.
270 status = STATUS_BUFFER_OVERFLOW; 270 status = RNDIS_STATUS_BUFFER_OVERFLOW;
271 } else { 271 } else {
272 request->response_msg.msg. 272 request->response_msg.msg.
273 init_complete.status = 273 init_complete.status =
274 STATUS_BUFFER_OVERFLOW; 274 RNDIS_STATUS_BUFFER_OVERFLOW;
275 } 275 }
276 } 276 }
277 277
278 complete(&request->wait_event); 278 complete(&request->wait_event);
279 } else { 279 } else {
280 netdev_err(ndev, 280 netdev_err(ndev,
281 "no rndis request found for this response " 281 "no rndis request found for this response "
282 "(id 0x%x res type 0x%x)\n", 282 "(id 0x%x res type 0x%x)\n",
283 resp->msg.init_complete.req_id, 283 resp->msg.init_complete.req_id,
284 resp->ndis_msg_type); 284 resp->ndis_msg_type);
285 } 285 }
286 } 286 }
287 287
288 static void rndis_filter_receive_indicate_status(struct rndis_device *dev, 288 static void rndis_filter_receive_indicate_status(struct rndis_device *dev,
289 struct rndis_message *resp) 289 struct rndis_message *resp)
290 { 290 {
291 struct rndis_indicate_status *indicate = 291 struct rndis_indicate_status *indicate =
292 &resp->msg.indicate_status; 292 &resp->msg.indicate_status;
293 293
294 if (indicate->status == RNDIS_STATUS_MEDIA_CONNECT) { 294 if (indicate->status == RNDIS_STATUS_MEDIA_CONNECT) {
295 netvsc_linkstatus_callback( 295 netvsc_linkstatus_callback(
296 dev->net_dev->dev, 1); 296 dev->net_dev->dev, 1);
297 } else if (indicate->status == RNDIS_STATUS_MEDIA_DISCONNECT) { 297 } else if (indicate->status == RNDIS_STATUS_MEDIA_DISCONNECT) {
298 netvsc_linkstatus_callback( 298 netvsc_linkstatus_callback(
299 dev->net_dev->dev, 0); 299 dev->net_dev->dev, 0);
300 } else { 300 } else {
301 /* 301 /*
302 * TODO: 302 * TODO:
303 */ 303 */
304 } 304 }
305 } 305 }
306 306
307 /* 307 /*
308 * Get the Per-Packet-Info with the specified type 308 * Get the Per-Packet-Info with the specified type
309 * return NULL if not found. 309 * return NULL if not found.
310 */ 310 */
311 static inline void *rndis_get_ppi(struct rndis_packet *rpkt, u32 type) 311 static inline void *rndis_get_ppi(struct rndis_packet *rpkt, u32 type)
312 { 312 {
313 struct rndis_per_packet_info *ppi; 313 struct rndis_per_packet_info *ppi;
314 int len; 314 int len;
315 315
316 if (rpkt->per_pkt_info_offset == 0) 316 if (rpkt->per_pkt_info_offset == 0)
317 return NULL; 317 return NULL;
318 318
319 ppi = (struct rndis_per_packet_info *)((ulong)rpkt + 319 ppi = (struct rndis_per_packet_info *)((ulong)rpkt +
320 rpkt->per_pkt_info_offset); 320 rpkt->per_pkt_info_offset);
321 len = rpkt->per_pkt_info_len; 321 len = rpkt->per_pkt_info_len;
322 322
323 while (len > 0) { 323 while (len > 0) {
324 if (ppi->type == type) 324 if (ppi->type == type)
325 return (void *)((ulong)ppi + ppi->ppi_offset); 325 return (void *)((ulong)ppi + ppi->ppi_offset);
326 len -= ppi->size; 326 len -= ppi->size;
327 ppi = (struct rndis_per_packet_info *)((ulong)ppi + ppi->size); 327 ppi = (struct rndis_per_packet_info *)((ulong)ppi + ppi->size);
328 } 328 }
329 329
330 return NULL; 330 return NULL;
331 } 331 }
332 332
333 static void rndis_filter_receive_data(struct rndis_device *dev, 333 static void rndis_filter_receive_data(struct rndis_device *dev,
334 struct rndis_message *msg, 334 struct rndis_message *msg,
335 struct hv_netvsc_packet *pkt) 335 struct hv_netvsc_packet *pkt)
336 { 336 {
337 struct rndis_packet *rndis_pkt; 337 struct rndis_packet *rndis_pkt;
338 u32 data_offset; 338 u32 data_offset;
339 struct ndis_pkt_8021q_info *vlan; 339 struct ndis_pkt_8021q_info *vlan;
340 340
341 rndis_pkt = &msg->msg.pkt; 341 rndis_pkt = &msg->msg.pkt;
342 342
343 /* 343 /*
344 * FIXME: Handle multiple rndis pkt msgs that maybe enclosed in this 344 * FIXME: Handle multiple rndis pkt msgs that maybe enclosed in this
345 * netvsc packet (ie TotalDataBufferLength != MessageLength) 345 * netvsc packet (ie TotalDataBufferLength != MessageLength)
346 */ 346 */
347 347
348 /* Remove the rndis header and pass it back up the stack */ 348 /* Remove the rndis header and pass it back up the stack */
349 data_offset = RNDIS_HEADER_SIZE + rndis_pkt->data_offset; 349 data_offset = RNDIS_HEADER_SIZE + rndis_pkt->data_offset;
350 350
351 pkt->total_data_buflen -= data_offset; 351 pkt->total_data_buflen -= data_offset;
352 352
353 /* 353 /*
354 * Make sure we got a valid RNDIS message, now total_data_buflen 354 * Make sure we got a valid RNDIS message, now total_data_buflen
355 * should be the data packet size plus the trailer padding size 355 * should be the data packet size plus the trailer padding size
356 */ 356 */
357 if (pkt->total_data_buflen < rndis_pkt->data_len) { 357 if (pkt->total_data_buflen < rndis_pkt->data_len) {
358 netdev_err(dev->net_dev->ndev, "rndis message buffer " 358 netdev_err(dev->net_dev->ndev, "rndis message buffer "
359 "overflow detected (got %u, min %u)" 359 "overflow detected (got %u, min %u)"
360 "...dropping this message!\n", 360 "...dropping this message!\n",
361 pkt->total_data_buflen, rndis_pkt->data_len); 361 pkt->total_data_buflen, rndis_pkt->data_len);
362 return; 362 return;
363 } 363 }
364 364
365 /* 365 /*
366 * Remove the rndis trailer padding from rndis packet message 366 * Remove the rndis trailer padding from rndis packet message
367 * rndis_pkt->data_len tell us the real data length, we only copy 367 * rndis_pkt->data_len tell us the real data length, we only copy
368 * the data packet to the stack, without the rndis trailer padding 368 * the data packet to the stack, without the rndis trailer padding
369 */ 369 */
370 pkt->total_data_buflen = rndis_pkt->data_len; 370 pkt->total_data_buflen = rndis_pkt->data_len;
371 pkt->data = (void *)((unsigned long)pkt->data + data_offset); 371 pkt->data = (void *)((unsigned long)pkt->data + data_offset);
372 372
373 pkt->is_data_pkt = true; 373 pkt->is_data_pkt = true;
374 374
375 vlan = rndis_get_ppi(rndis_pkt, IEEE_8021Q_INFO); 375 vlan = rndis_get_ppi(rndis_pkt, IEEE_8021Q_INFO);
376 if (vlan) { 376 if (vlan) {
377 pkt->vlan_tci = VLAN_TAG_PRESENT | vlan->vlanid | 377 pkt->vlan_tci = VLAN_TAG_PRESENT | vlan->vlanid |
378 (vlan->pri << VLAN_PRIO_SHIFT); 378 (vlan->pri << VLAN_PRIO_SHIFT);
379 } else { 379 } else {
380 pkt->vlan_tci = 0; 380 pkt->vlan_tci = 0;
381 } 381 }
382 382
383 netvsc_recv_callback(dev->net_dev->dev, pkt); 383 netvsc_recv_callback(dev->net_dev->dev, pkt);
384 } 384 }
385 385
386 int rndis_filter_receive(struct hv_device *dev, 386 int rndis_filter_receive(struct hv_device *dev,
387 struct hv_netvsc_packet *pkt) 387 struct hv_netvsc_packet *pkt)
388 { 388 {
389 struct netvsc_device *net_dev = hv_get_drvdata(dev); 389 struct netvsc_device *net_dev = hv_get_drvdata(dev);
390 struct rndis_device *rndis_dev; 390 struct rndis_device *rndis_dev;
391 struct rndis_message *rndis_msg; 391 struct rndis_message *rndis_msg;
392 struct net_device *ndev; 392 struct net_device *ndev;
393 393
394 if (!net_dev) 394 if (!net_dev)
395 return -EINVAL; 395 return -EINVAL;
396 396
397 ndev = net_dev->ndev; 397 ndev = net_dev->ndev;
398 398
399 /* Make sure the rndis device state is initialized */ 399 /* Make sure the rndis device state is initialized */
400 if (!net_dev->extension) { 400 if (!net_dev->extension) {
401 netdev_err(ndev, "got rndis message but no rndis device - " 401 netdev_err(ndev, "got rndis message but no rndis device - "
402 "dropping this message!\n"); 402 "dropping this message!\n");
403 return -ENODEV; 403 return -ENODEV;
404 } 404 }
405 405
406 rndis_dev = (struct rndis_device *)net_dev->extension; 406 rndis_dev = (struct rndis_device *)net_dev->extension;
407 if (rndis_dev->state == RNDIS_DEV_UNINITIALIZED) { 407 if (rndis_dev->state == RNDIS_DEV_UNINITIALIZED) {
408 netdev_err(ndev, "got rndis message but rndis device " 408 netdev_err(ndev, "got rndis message but rndis device "
409 "uninitialized...dropping this message!\n"); 409 "uninitialized...dropping this message!\n");
410 return -ENODEV; 410 return -ENODEV;
411 } 411 }
412 412
413 rndis_msg = pkt->data; 413 rndis_msg = pkt->data;
414 414
415 dump_rndis_message(dev, rndis_msg); 415 dump_rndis_message(dev, rndis_msg);
416 416
417 switch (rndis_msg->ndis_msg_type) { 417 switch (rndis_msg->ndis_msg_type) {
418 case REMOTE_NDIS_PACKET_MSG: 418 case REMOTE_NDIS_PACKET_MSG:
419 /* data msg */ 419 /* data msg */
420 rndis_filter_receive_data(rndis_dev, rndis_msg, pkt); 420 rndis_filter_receive_data(rndis_dev, rndis_msg, pkt);
421 break; 421 break;
422 422
423 case REMOTE_NDIS_INITIALIZE_CMPLT: 423 case REMOTE_NDIS_INITIALIZE_CMPLT:
424 case REMOTE_NDIS_QUERY_CMPLT: 424 case REMOTE_NDIS_QUERY_CMPLT:
425 case REMOTE_NDIS_SET_CMPLT: 425 case REMOTE_NDIS_SET_CMPLT:
426 /* completion msgs */ 426 /* completion msgs */
427 rndis_filter_receive_response(rndis_dev, rndis_msg); 427 rndis_filter_receive_response(rndis_dev, rndis_msg);
428 break; 428 break;
429 429
430 case REMOTE_NDIS_INDICATE_STATUS_MSG: 430 case REMOTE_NDIS_INDICATE_STATUS_MSG:
431 /* notification msgs */ 431 /* notification msgs */
432 rndis_filter_receive_indicate_status(rndis_dev, rndis_msg); 432 rndis_filter_receive_indicate_status(rndis_dev, rndis_msg);
433 break; 433 break;
434 default: 434 default:
435 netdev_err(ndev, 435 netdev_err(ndev,
436 "unhandled rndis message (type %u len %u)\n", 436 "unhandled rndis message (type %u len %u)\n",
437 rndis_msg->ndis_msg_type, 437 rndis_msg->ndis_msg_type,
438 rndis_msg->msg_len); 438 rndis_msg->msg_len);
439 break; 439 break;
440 } 440 }
441 441
442 return 0; 442 return 0;
443 } 443 }
444 444
445 static int rndis_filter_query_device(struct rndis_device *dev, u32 oid, 445 static int rndis_filter_query_device(struct rndis_device *dev, u32 oid,
446 void *result, u32 *result_size) 446 void *result, u32 *result_size)
447 { 447 {
448 struct rndis_request *request; 448 struct rndis_request *request;
449 u32 inresult_size = *result_size; 449 u32 inresult_size = *result_size;
450 struct rndis_query_request *query; 450 struct rndis_query_request *query;
451 struct rndis_query_complete *query_complete; 451 struct rndis_query_complete *query_complete;
452 int ret = 0; 452 int ret = 0;
453 int t; 453 int t;
454 454
455 if (!result) 455 if (!result)
456 return -EINVAL; 456 return -EINVAL;
457 457
458 *result_size = 0; 458 *result_size = 0;
459 request = get_rndis_request(dev, REMOTE_NDIS_QUERY_MSG, 459 request = get_rndis_request(dev, REMOTE_NDIS_QUERY_MSG,
460 RNDIS_MESSAGE_SIZE(struct rndis_query_request)); 460 RNDIS_MESSAGE_SIZE(struct rndis_query_request));
461 if (!request) { 461 if (!request) {
462 ret = -ENOMEM; 462 ret = -ENOMEM;
463 goto cleanup; 463 goto cleanup;
464 } 464 }
465 465
466 /* Setup the rndis query */ 466 /* Setup the rndis query */
467 query = &request->request_msg.msg.query_req; 467 query = &request->request_msg.msg.query_req;
468 query->oid = oid; 468 query->oid = oid;
469 query->info_buf_offset = sizeof(struct rndis_query_request); 469 query->info_buf_offset = sizeof(struct rndis_query_request);
470 query->info_buflen = 0; 470 query->info_buflen = 0;
471 query->dev_vc_handle = 0; 471 query->dev_vc_handle = 0;
472 472
473 ret = rndis_filter_send_request(dev, request); 473 ret = rndis_filter_send_request(dev, request);
474 if (ret != 0) 474 if (ret != 0)
475 goto cleanup; 475 goto cleanup;
476 476
477 t = wait_for_completion_timeout(&request->wait_event, 5*HZ); 477 t = wait_for_completion_timeout(&request->wait_event, 5*HZ);
478 if (t == 0) { 478 if (t == 0) {
479 ret = -ETIMEDOUT; 479 ret = -ETIMEDOUT;
480 goto cleanup; 480 goto cleanup;
481 } 481 }
482 482
483 /* Copy the response back */ 483 /* Copy the response back */
484 query_complete = &request->response_msg.msg.query_complete; 484 query_complete = &request->response_msg.msg.query_complete;
485 485
486 if (query_complete->info_buflen > inresult_size) { 486 if (query_complete->info_buflen > inresult_size) {
487 ret = -1; 487 ret = -1;
488 goto cleanup; 488 goto cleanup;
489 } 489 }
490 490
491 memcpy(result, 491 memcpy(result,
492 (void *)((unsigned long)query_complete + 492 (void *)((unsigned long)query_complete +
493 query_complete->info_buf_offset), 493 query_complete->info_buf_offset),
494 query_complete->info_buflen); 494 query_complete->info_buflen);
495 495
496 *result_size = query_complete->info_buflen; 496 *result_size = query_complete->info_buflen;
497 497
498 cleanup: 498 cleanup:
499 if (request) 499 if (request)
500 put_rndis_request(dev, request); 500 put_rndis_request(dev, request);
501 501
502 return ret; 502 return ret;
503 } 503 }
504 504
505 static int rndis_filter_query_device_mac(struct rndis_device *dev) 505 static int rndis_filter_query_device_mac(struct rndis_device *dev)
506 { 506 {
507 u32 size = ETH_ALEN; 507 u32 size = ETH_ALEN;
508 508
509 return rndis_filter_query_device(dev, 509 return rndis_filter_query_device(dev,
510 RNDIS_OID_802_3_PERMANENT_ADDRESS, 510 RNDIS_OID_802_3_PERMANENT_ADDRESS,
511 dev->hw_mac_adr, &size); 511 dev->hw_mac_adr, &size);
512 } 512 }
513 513
514 static int rndis_filter_query_device_link_status(struct rndis_device *dev) 514 static int rndis_filter_query_device_link_status(struct rndis_device *dev)
515 { 515 {
516 u32 size = sizeof(u32); 516 u32 size = sizeof(u32);
517 u32 link_status; 517 u32 link_status;
518 int ret; 518 int ret;
519 519
520 ret = rndis_filter_query_device(dev, 520 ret = rndis_filter_query_device(dev,
521 RNDIS_OID_GEN_MEDIA_CONNECT_STATUS, 521 RNDIS_OID_GEN_MEDIA_CONNECT_STATUS,
522 &link_status, &size); 522 &link_status, &size);
523 dev->link_state = (link_status != 0) ? true : false; 523 dev->link_state = (link_status != 0) ? true : false;
524 524
525 return ret; 525 return ret;
526 } 526 }
527 527
528 int rndis_filter_set_packet_filter(struct rndis_device *dev, u32 new_filter) 528 int rndis_filter_set_packet_filter(struct rndis_device *dev, u32 new_filter)
529 { 529 {
530 struct rndis_request *request; 530 struct rndis_request *request;
531 struct rndis_set_request *set; 531 struct rndis_set_request *set;
532 struct rndis_set_complete *set_complete; 532 struct rndis_set_complete *set_complete;
533 u32 status; 533 u32 status;
534 int ret, t; 534 int ret, t;
535 struct net_device *ndev; 535 struct net_device *ndev;
536 536
537 ndev = dev->net_dev->ndev; 537 ndev = dev->net_dev->ndev;
538 538
539 request = get_rndis_request(dev, REMOTE_NDIS_SET_MSG, 539 request = get_rndis_request(dev, REMOTE_NDIS_SET_MSG,
540 RNDIS_MESSAGE_SIZE(struct rndis_set_request) + 540 RNDIS_MESSAGE_SIZE(struct rndis_set_request) +
541 sizeof(u32)); 541 sizeof(u32));
542 if (!request) { 542 if (!request) {
543 ret = -ENOMEM; 543 ret = -ENOMEM;
544 goto cleanup; 544 goto cleanup;
545 } 545 }
546 546
547 /* Setup the rndis set */ 547 /* Setup the rndis set */
548 set = &request->request_msg.msg.set_req; 548 set = &request->request_msg.msg.set_req;
549 set->oid = RNDIS_OID_GEN_CURRENT_PACKET_FILTER; 549 set->oid = RNDIS_OID_GEN_CURRENT_PACKET_FILTER;
550 set->info_buflen = sizeof(u32); 550 set->info_buflen = sizeof(u32);
551 set->info_buf_offset = sizeof(struct rndis_set_request); 551 set->info_buf_offset = sizeof(struct rndis_set_request);
552 552
553 memcpy((void *)(unsigned long)set + sizeof(struct rndis_set_request), 553 memcpy((void *)(unsigned long)set + sizeof(struct rndis_set_request),
554 &new_filter, sizeof(u32)); 554 &new_filter, sizeof(u32));
555 555
556 ret = rndis_filter_send_request(dev, request); 556 ret = rndis_filter_send_request(dev, request);
557 if (ret != 0) 557 if (ret != 0)
558 goto cleanup; 558 goto cleanup;
559 559
560 t = wait_for_completion_timeout(&request->wait_event, 5*HZ); 560 t = wait_for_completion_timeout(&request->wait_event, 5*HZ);
561 561
562 if (t == 0) { 562 if (t == 0) {
563 netdev_err(ndev, 563 netdev_err(ndev,
564 "timeout before we got a set response...\n"); 564 "timeout before we got a set response...\n");
565 /* 565 /*
566 * We can't deallocate the request since we may still receive a 566 * We can't deallocate the request since we may still receive a
567 * send completion for it. 567 * send completion for it.
568 */ 568 */
569 goto exit; 569 goto exit;
570 } else { 570 } else {
571 set_complete = &request->response_msg.msg.set_complete; 571 set_complete = &request->response_msg.msg.set_complete;
572 status = set_complete->status; 572 status = set_complete->status;
573 } 573 }
574 574
575 cleanup: 575 cleanup:
576 if (request) 576 if (request)
577 put_rndis_request(dev, request); 577 put_rndis_request(dev, request);
578 exit: 578 exit:
579 return ret; 579 return ret;
580 } 580 }
581 581
582 582
583 static int rndis_filter_init_device(struct rndis_device *dev) 583 static int rndis_filter_init_device(struct rndis_device *dev)
584 { 584 {
585 struct rndis_request *request; 585 struct rndis_request *request;
586 struct rndis_initialize_request *init; 586 struct rndis_initialize_request *init;
587 struct rndis_initialize_complete *init_complete; 587 struct rndis_initialize_complete *init_complete;
588 u32 status; 588 u32 status;
589 int ret, t; 589 int ret, t;
590 590
591 request = get_rndis_request(dev, REMOTE_NDIS_INITIALIZE_MSG, 591 request = get_rndis_request(dev, REMOTE_NDIS_INITIALIZE_MSG,
592 RNDIS_MESSAGE_SIZE(struct rndis_initialize_request)); 592 RNDIS_MESSAGE_SIZE(struct rndis_initialize_request));
593 if (!request) { 593 if (!request) {
594 ret = -ENOMEM; 594 ret = -ENOMEM;
595 goto cleanup; 595 goto cleanup;
596 } 596 }
597 597
598 /* Setup the rndis set */ 598 /* Setup the rndis set */
599 init = &request->request_msg.msg.init_req; 599 init = &request->request_msg.msg.init_req;
600 init->major_ver = RNDIS_MAJOR_VERSION; 600 init->major_ver = RNDIS_MAJOR_VERSION;
601 init->minor_ver = RNDIS_MINOR_VERSION; 601 init->minor_ver = RNDIS_MINOR_VERSION;
602 /* FIXME: Use 1536 - rounded ethernet frame size */ 602 /* FIXME: Use 1536 - rounded ethernet frame size */
603 init->max_xfer_size = 2048; 603 init->max_xfer_size = 2048;
604 604
605 dev->state = RNDIS_DEV_INITIALIZING; 605 dev->state = RNDIS_DEV_INITIALIZING;
606 606
607 ret = rndis_filter_send_request(dev, request); 607 ret = rndis_filter_send_request(dev, request);
608 if (ret != 0) { 608 if (ret != 0) {
609 dev->state = RNDIS_DEV_UNINITIALIZED; 609 dev->state = RNDIS_DEV_UNINITIALIZED;
610 goto cleanup; 610 goto cleanup;
611 } 611 }
612 612
613 613
614 t = wait_for_completion_timeout(&request->wait_event, 5*HZ); 614 t = wait_for_completion_timeout(&request->wait_event, 5*HZ);
615 615
616 if (t == 0) { 616 if (t == 0) {
617 ret = -ETIMEDOUT; 617 ret = -ETIMEDOUT;
618 goto cleanup; 618 goto cleanup;
619 } 619 }
620 620
621 init_complete = &request->response_msg.msg.init_complete; 621 init_complete = &request->response_msg.msg.init_complete;
622 status = init_complete->status; 622 status = init_complete->status;
623 if (status == RNDIS_STATUS_SUCCESS) { 623 if (status == RNDIS_STATUS_SUCCESS) {
624 dev->state = RNDIS_DEV_INITIALIZED; 624 dev->state = RNDIS_DEV_INITIALIZED;
625 ret = 0; 625 ret = 0;
626 } else { 626 } else {
627 dev->state = RNDIS_DEV_UNINITIALIZED; 627 dev->state = RNDIS_DEV_UNINITIALIZED;
628 ret = -EINVAL; 628 ret = -EINVAL;
629 } 629 }
630 630
631 cleanup: 631 cleanup:
632 if (request) 632 if (request)
633 put_rndis_request(dev, request); 633 put_rndis_request(dev, request);
634 634
635 return ret; 635 return ret;
636 } 636 }
637 637
638 static void rndis_filter_halt_device(struct rndis_device *dev) 638 static void rndis_filter_halt_device(struct rndis_device *dev)
639 { 639 {
640 struct rndis_request *request; 640 struct rndis_request *request;
641 struct rndis_halt_request *halt; 641 struct rndis_halt_request *halt;
642 642
643 /* Attempt to do a rndis device halt */ 643 /* Attempt to do a rndis device halt */
644 request = get_rndis_request(dev, REMOTE_NDIS_HALT_MSG, 644 request = get_rndis_request(dev, REMOTE_NDIS_HALT_MSG,
645 RNDIS_MESSAGE_SIZE(struct rndis_halt_request)); 645 RNDIS_MESSAGE_SIZE(struct rndis_halt_request));
646 if (!request) 646 if (!request)
647 goto cleanup; 647 goto cleanup;
648 648
649 /* Setup the rndis set */ 649 /* Setup the rndis set */
650 halt = &request->request_msg.msg.halt_req; 650 halt = &request->request_msg.msg.halt_req;
651 halt->req_id = atomic_inc_return(&dev->new_req_id); 651 halt->req_id = atomic_inc_return(&dev->new_req_id);
652 652
653 /* Ignore return since this msg is optional. */ 653 /* Ignore return since this msg is optional. */
654 rndis_filter_send_request(dev, request); 654 rndis_filter_send_request(dev, request);
655 655
656 dev->state = RNDIS_DEV_UNINITIALIZED; 656 dev->state = RNDIS_DEV_UNINITIALIZED;
657 657
658 cleanup: 658 cleanup:
659 if (request) 659 if (request)
660 put_rndis_request(dev, request); 660 put_rndis_request(dev, request);
661 return; 661 return;
662 } 662 }
663 663
664 static int rndis_filter_open_device(struct rndis_device *dev) 664 static int rndis_filter_open_device(struct rndis_device *dev)
665 { 665 {
666 int ret; 666 int ret;
667 667
668 if (dev->state != RNDIS_DEV_INITIALIZED) 668 if (dev->state != RNDIS_DEV_INITIALIZED)
669 return 0; 669 return 0;
670 670
671 ret = rndis_filter_set_packet_filter(dev, 671 ret = rndis_filter_set_packet_filter(dev,
672 NDIS_PACKET_TYPE_BROADCAST | 672 NDIS_PACKET_TYPE_BROADCAST |
673 NDIS_PACKET_TYPE_ALL_MULTICAST | 673 NDIS_PACKET_TYPE_ALL_MULTICAST |
674 NDIS_PACKET_TYPE_DIRECTED); 674 NDIS_PACKET_TYPE_DIRECTED);
675 if (ret == 0) 675 if (ret == 0)
676 dev->state = RNDIS_DEV_DATAINITIALIZED; 676 dev->state = RNDIS_DEV_DATAINITIALIZED;
677 677
678 return ret; 678 return ret;
679 } 679 }
680 680
681 static int rndis_filter_close_device(struct rndis_device *dev) 681 static int rndis_filter_close_device(struct rndis_device *dev)
682 { 682 {
683 int ret; 683 int ret;
684 684
685 if (dev->state != RNDIS_DEV_DATAINITIALIZED) 685 if (dev->state != RNDIS_DEV_DATAINITIALIZED)
686 return 0; 686 return 0;
687 687
688 ret = rndis_filter_set_packet_filter(dev, 0); 688 ret = rndis_filter_set_packet_filter(dev, 0);
689 if (ret == 0) 689 if (ret == 0)
690 dev->state = RNDIS_DEV_INITIALIZED; 690 dev->state = RNDIS_DEV_INITIALIZED;
691 691
692 return ret; 692 return ret;
693 } 693 }
694 694
695 int rndis_filter_device_add(struct hv_device *dev, 695 int rndis_filter_device_add(struct hv_device *dev,
696 void *additional_info) 696 void *additional_info)
697 { 697 {
698 int ret; 698 int ret;
699 struct netvsc_device *net_device; 699 struct netvsc_device *net_device;
700 struct rndis_device *rndis_device; 700 struct rndis_device *rndis_device;
701 struct netvsc_device_info *device_info = additional_info; 701 struct netvsc_device_info *device_info = additional_info;
702 702
703 rndis_device = get_rndis_device(); 703 rndis_device = get_rndis_device();
704 if (!rndis_device) 704 if (!rndis_device)
705 return -ENODEV; 705 return -ENODEV;
706 706
707 /* 707 /*
708 * Let the inner driver handle this first to create the netvsc channel 708 * Let the inner driver handle this first to create the netvsc channel
709 * NOTE! Once the channel is created, we may get a receive callback 709 * NOTE! Once the channel is created, we may get a receive callback
710 * (RndisFilterOnReceive()) before this call is completed 710 * (RndisFilterOnReceive()) before this call is completed
711 */ 711 */
712 ret = netvsc_device_add(dev, additional_info); 712 ret = netvsc_device_add(dev, additional_info);
713 if (ret != 0) { 713 if (ret != 0) {
714 kfree(rndis_device); 714 kfree(rndis_device);
715 return ret; 715 return ret;
716 } 716 }
717 717
718 718
719 /* Initialize the rndis device */ 719 /* Initialize the rndis device */
720 net_device = hv_get_drvdata(dev); 720 net_device = hv_get_drvdata(dev);
721 721
722 net_device->extension = rndis_device; 722 net_device->extension = rndis_device;
723 rndis_device->net_dev = net_device; 723 rndis_device->net_dev = net_device;
724 724
725 /* Send the rndis initialization message */ 725 /* Send the rndis initialization message */
726 ret = rndis_filter_init_device(rndis_device); 726 ret = rndis_filter_init_device(rndis_device);
727 if (ret != 0) { 727 if (ret != 0) {
728 /* 728 /*
729 * TODO: If rndis init failed, we will need to shut down the 729 * TODO: If rndis init failed, we will need to shut down the
730 * channel 730 * channel
731 */ 731 */
732 } 732 }
733 733
734 /* Get the mac address */ 734 /* Get the mac address */
735 ret = rndis_filter_query_device_mac(rndis_device); 735 ret = rndis_filter_query_device_mac(rndis_device);
736 if (ret != 0) { 736 if (ret != 0) {
737 /* 737 /*
738 * TODO: shutdown rndis device and the channel 738 * TODO: shutdown rndis device and the channel
739 */ 739 */
740 } 740 }
741 741
742 memcpy(device_info->mac_adr, rndis_device->hw_mac_adr, ETH_ALEN); 742 memcpy(device_info->mac_adr, rndis_device->hw_mac_adr, ETH_ALEN);
743 743
744 rndis_filter_query_device_link_status(rndis_device); 744 rndis_filter_query_device_link_status(rndis_device);
745 745
746 device_info->link_state = rndis_device->link_state; 746 device_info->link_state = rndis_device->link_state;
747 747
748 dev_info(&dev->device, "Device MAC %pM link state %s\n", 748 dev_info(&dev->device, "Device MAC %pM link state %s\n",
749 rndis_device->hw_mac_adr, 749 rndis_device->hw_mac_adr,
750 device_info->link_state ? "down" : "up"); 750 device_info->link_state ? "down" : "up");
751 751
752 return ret; 752 return ret;
753 } 753 }
754 754
755 void rndis_filter_device_remove(struct hv_device *dev) 755 void rndis_filter_device_remove(struct hv_device *dev)
756 { 756 {
757 struct netvsc_device *net_dev = hv_get_drvdata(dev); 757 struct netvsc_device *net_dev = hv_get_drvdata(dev);
758 struct rndis_device *rndis_dev = net_dev->extension; 758 struct rndis_device *rndis_dev = net_dev->extension;
759 759
760 /* Halt and release the rndis device */ 760 /* Halt and release the rndis device */
761 rndis_filter_halt_device(rndis_dev); 761 rndis_filter_halt_device(rndis_dev);
762 762
763 kfree(rndis_dev); 763 kfree(rndis_dev);
764 net_dev->extension = NULL; 764 net_dev->extension = NULL;
765 765
766 netvsc_device_remove(dev); 766 netvsc_device_remove(dev);
767 } 767 }
768 768
769 769
770 int rndis_filter_open(struct hv_device *dev) 770 int rndis_filter_open(struct hv_device *dev)
771 { 771 {
772 struct netvsc_device *net_device = hv_get_drvdata(dev); 772 struct netvsc_device *net_device = hv_get_drvdata(dev);
773 773
774 if (!net_device) 774 if (!net_device)
775 return -EINVAL; 775 return -EINVAL;
776 776
777 return rndis_filter_open_device(net_device->extension); 777 return rndis_filter_open_device(net_device->extension);
778 } 778 }
779 779
780 int rndis_filter_close(struct hv_device *dev) 780 int rndis_filter_close(struct hv_device *dev)
781 { 781 {
782 struct netvsc_device *nvdev = hv_get_drvdata(dev); 782 struct netvsc_device *nvdev = hv_get_drvdata(dev);
783 783
784 if (!nvdev) 784 if (!nvdev)
785 return -EINVAL; 785 return -EINVAL;
786 786
787 return rndis_filter_close_device(nvdev->extension); 787 return rndis_filter_close_device(nvdev->extension);
788 } 788 }
789 789
790 int rndis_filter_send(struct hv_device *dev, 790 int rndis_filter_send(struct hv_device *dev,
791 struct hv_netvsc_packet *pkt) 791 struct hv_netvsc_packet *pkt)
792 { 792 {
793 int ret; 793 int ret;
794 struct rndis_filter_packet *filter_pkt; 794 struct rndis_filter_packet *filter_pkt;
795 struct rndis_message *rndis_msg; 795 struct rndis_message *rndis_msg;
796 struct rndis_packet *rndis_pkt; 796 struct rndis_packet *rndis_pkt;
797 u32 rndis_msg_size; 797 u32 rndis_msg_size;
798 bool isvlan = pkt->vlan_tci & VLAN_TAG_PRESENT; 798 bool isvlan = pkt->vlan_tci & VLAN_TAG_PRESENT;
799 799
800 /* Add the rndis header */ 800 /* Add the rndis header */
801 filter_pkt = (struct rndis_filter_packet *)pkt->extension; 801 filter_pkt = (struct rndis_filter_packet *)pkt->extension;
802 802
803 rndis_msg = &filter_pkt->msg; 803 rndis_msg = &filter_pkt->msg;
804 rndis_msg_size = RNDIS_MESSAGE_SIZE(struct rndis_packet); 804 rndis_msg_size = RNDIS_MESSAGE_SIZE(struct rndis_packet);
805 if (isvlan) 805 if (isvlan)
806 rndis_msg_size += NDIS_VLAN_PPI_SIZE; 806 rndis_msg_size += NDIS_VLAN_PPI_SIZE;
807 807
808 rndis_msg->ndis_msg_type = REMOTE_NDIS_PACKET_MSG; 808 rndis_msg->ndis_msg_type = REMOTE_NDIS_PACKET_MSG;
809 rndis_msg->msg_len = pkt->total_data_buflen + 809 rndis_msg->msg_len = pkt->total_data_buflen +
810 rndis_msg_size; 810 rndis_msg_size;
811 811
812 rndis_pkt = &rndis_msg->msg.pkt; 812 rndis_pkt = &rndis_msg->msg.pkt;
813 rndis_pkt->data_offset = sizeof(struct rndis_packet); 813 rndis_pkt->data_offset = sizeof(struct rndis_packet);
814 if (isvlan) 814 if (isvlan)
815 rndis_pkt->data_offset += NDIS_VLAN_PPI_SIZE; 815 rndis_pkt->data_offset += NDIS_VLAN_PPI_SIZE;
816 rndis_pkt->data_len = pkt->total_data_buflen; 816 rndis_pkt->data_len = pkt->total_data_buflen;
817 817
818 if (isvlan) { 818 if (isvlan) {
819 struct rndis_per_packet_info *ppi; 819 struct rndis_per_packet_info *ppi;
820 struct ndis_pkt_8021q_info *vlan; 820 struct ndis_pkt_8021q_info *vlan;
821 821
822 rndis_pkt->per_pkt_info_offset = sizeof(struct rndis_packet); 822 rndis_pkt->per_pkt_info_offset = sizeof(struct rndis_packet);
823 rndis_pkt->per_pkt_info_len = NDIS_VLAN_PPI_SIZE; 823 rndis_pkt->per_pkt_info_len = NDIS_VLAN_PPI_SIZE;
824 824
825 ppi = (struct rndis_per_packet_info *)((ulong)rndis_pkt + 825 ppi = (struct rndis_per_packet_info *)((ulong)rndis_pkt +
826 rndis_pkt->per_pkt_info_offset); 826 rndis_pkt->per_pkt_info_offset);
827 ppi->size = NDIS_VLAN_PPI_SIZE; 827 ppi->size = NDIS_VLAN_PPI_SIZE;
828 ppi->type = IEEE_8021Q_INFO; 828 ppi->type = IEEE_8021Q_INFO;
829 ppi->ppi_offset = sizeof(struct rndis_per_packet_info); 829 ppi->ppi_offset = sizeof(struct rndis_per_packet_info);
830 830
831 vlan = (struct ndis_pkt_8021q_info *)((ulong)ppi + 831 vlan = (struct ndis_pkt_8021q_info *)((ulong)ppi +
832 ppi->ppi_offset); 832 ppi->ppi_offset);
833 vlan->vlanid = pkt->vlan_tci & VLAN_VID_MASK; 833 vlan->vlanid = pkt->vlan_tci & VLAN_VID_MASK;
834 vlan->pri = (pkt->vlan_tci & VLAN_PRIO_MASK) >> VLAN_PRIO_SHIFT; 834 vlan->pri = (pkt->vlan_tci & VLAN_PRIO_MASK) >> VLAN_PRIO_SHIFT;
835 } 835 }
836 836
837 pkt->is_data_pkt = true; 837 pkt->is_data_pkt = true;
838 pkt->page_buf[0].pfn = virt_to_phys(rndis_msg) >> PAGE_SHIFT; 838 pkt->page_buf[0].pfn = virt_to_phys(rndis_msg) >> PAGE_SHIFT;
839 pkt->page_buf[0].offset = 839 pkt->page_buf[0].offset =
840 (unsigned long)rndis_msg & (PAGE_SIZE-1); 840 (unsigned long)rndis_msg & (PAGE_SIZE-1);
841 pkt->page_buf[0].len = rndis_msg_size; 841 pkt->page_buf[0].len = rndis_msg_size;
842 842
843 /* Add one page_buf if the rndis msg goes beyond page boundary */ 843 /* Add one page_buf if the rndis msg goes beyond page boundary */
844 if (pkt->page_buf[0].offset + rndis_msg_size > PAGE_SIZE) { 844 if (pkt->page_buf[0].offset + rndis_msg_size > PAGE_SIZE) {
845 int i; 845 int i;
846 for (i = pkt->page_buf_cnt; i > 1; i--) 846 for (i = pkt->page_buf_cnt; i > 1; i--)
847 pkt->page_buf[i] = pkt->page_buf[i-1]; 847 pkt->page_buf[i] = pkt->page_buf[i-1];
848 pkt->page_buf_cnt++; 848 pkt->page_buf_cnt++;
849 pkt->page_buf[0].len = PAGE_SIZE - pkt->page_buf[0].offset; 849 pkt->page_buf[0].len = PAGE_SIZE - pkt->page_buf[0].offset;
850 pkt->page_buf[1].pfn = virt_to_phys((void *)((ulong) 850 pkt->page_buf[1].pfn = virt_to_phys((void *)((ulong)
851 rndis_msg + pkt->page_buf[0].len)) >> PAGE_SHIFT; 851 rndis_msg + pkt->page_buf[0].len)) >> PAGE_SHIFT;
852 pkt->page_buf[1].offset = 0; 852 pkt->page_buf[1].offset = 0;
853 pkt->page_buf[1].len = rndis_msg_size - pkt->page_buf[0].len; 853 pkt->page_buf[1].len = rndis_msg_size - pkt->page_buf[0].len;
854 } 854 }
855 855
856 /* Save the packet send completion and context */ 856 /* Save the packet send completion and context */
857 filter_pkt->completion = pkt->completion.send.send_completion; 857 filter_pkt->completion = pkt->completion.send.send_completion;
858 filter_pkt->completion_ctx = 858 filter_pkt->completion_ctx =
859 pkt->completion.send.send_completion_ctx; 859 pkt->completion.send.send_completion_ctx;
860 860
861 /* Use ours */ 861 /* Use ours */
862 pkt->completion.send.send_completion = rndis_filter_send_completion; 862 pkt->completion.send.send_completion = rndis_filter_send_completion;
863 pkt->completion.send.send_completion_ctx = filter_pkt; 863 pkt->completion.send.send_completion_ctx = filter_pkt;
864 864
865 ret = netvsc_send(dev, pkt); 865 ret = netvsc_send(dev, pkt);
866 if (ret != 0) { 866 if (ret != 0) {
867 /* 867 /*
868 * Reset the completion to originals to allow retries from 868 * Reset the completion to originals to allow retries from
869 * above 869 * above
870 */ 870 */
871 pkt->completion.send.send_completion = 871 pkt->completion.send.send_completion =
872 filter_pkt->completion; 872 filter_pkt->completion;
873 pkt->completion.send.send_completion_ctx = 873 pkt->completion.send.send_completion_ctx =
874 filter_pkt->completion_ctx; 874 filter_pkt->completion_ctx;
875 } 875 }
876 876
877 return ret; 877 return ret;
878 } 878 }
879 879
880 static void rndis_filter_send_completion(void *ctx) 880 static void rndis_filter_send_completion(void *ctx)
881 { 881 {
882 struct rndis_filter_packet *filter_pkt = ctx; 882 struct rndis_filter_packet *filter_pkt = ctx;
883 883
884 /* Pass it back to the original handler */ 884 /* Pass it back to the original handler */
885 filter_pkt->completion(filter_pkt->completion_ctx); 885 filter_pkt->completion(filter_pkt->completion_ctx);
886 } 886 }
887 887
888 888
889 static void rndis_filter_send_request_completion(void *ctx) 889 static void rndis_filter_send_request_completion(void *ctx)
890 { 890 {
891 /* Noop */ 891 /* Noop */
892 } 892 }
893 893
include/linux/rndis.h
1 /* From include/linux/usb/rndis_host.h */ 1 /* From include/linux/usb/rndis_host.h */
2 2
3 #define RNDIS_MSG_COMPLETION 0x80000000 3 #define RNDIS_MSG_COMPLETION 0x80000000
4 4
5 /* codes for "msg_type" field of rndis messages; 5 /* codes for "msg_type" field of rndis messages;
6 * only the data channel uses packet messages (maybe batched); 6 * only the data channel uses packet messages (maybe batched);
7 * everything else goes on the control channel. 7 * everything else goes on the control channel.
8 */ 8 */
9 #define RNDIS_MSG_PACKET 0x00000001 /* 1-N packets */ 9 #define RNDIS_MSG_PACKET 0x00000001 /* 1-N packets */
10 #define RNDIS_MSG_INIT 0x00000002 10 #define RNDIS_MSG_INIT 0x00000002
11 #define RNDIS_MSG_INIT_C (RNDIS_MSG_INIT|RNDIS_MSG_COMPLETION) 11 #define RNDIS_MSG_INIT_C (RNDIS_MSG_INIT|RNDIS_MSG_COMPLETION)
12 #define RNDIS_MSG_HALT 0x00000003 12 #define RNDIS_MSG_HALT 0x00000003
13 #define RNDIS_MSG_QUERY 0x00000004 13 #define RNDIS_MSG_QUERY 0x00000004
14 #define RNDIS_MSG_QUERY_C (RNDIS_MSG_QUERY|RNDIS_MSG_COMPLETION) 14 #define RNDIS_MSG_QUERY_C (RNDIS_MSG_QUERY|RNDIS_MSG_COMPLETION)
15 #define RNDIS_MSG_SET 0x00000005 15 #define RNDIS_MSG_SET 0x00000005
16 #define RNDIS_MSG_SET_C (RNDIS_MSG_SET|RNDIS_MSG_COMPLETION) 16 #define RNDIS_MSG_SET_C (RNDIS_MSG_SET|RNDIS_MSG_COMPLETION)
17 #define RNDIS_MSG_RESET 0x00000006 17 #define RNDIS_MSG_RESET 0x00000006
18 #define RNDIS_MSG_RESET_C (RNDIS_MSG_RESET|RNDIS_MSG_COMPLETION) 18 #define RNDIS_MSG_RESET_C (RNDIS_MSG_RESET|RNDIS_MSG_COMPLETION)
19 #define RNDIS_MSG_INDICATE 0x00000007 19 #define RNDIS_MSG_INDICATE 0x00000007
20 #define RNDIS_MSG_KEEPALIVE 0x00000008 20 #define RNDIS_MSG_KEEPALIVE 0x00000008
21 #define RNDIS_MSG_KEEPALIVE_C (RNDIS_MSG_KEEPALIVE|RNDIS_MSG_COMPLETION) 21 #define RNDIS_MSG_KEEPALIVE_C (RNDIS_MSG_KEEPALIVE|RNDIS_MSG_COMPLETION)
22 22
23 23
24 /* codes for "status" field of completion messages */ 24 /* codes for "status" field of completion messages */
25 #define RNDIS_STATUS_SUCCESS 0x00000000 25 #define RNDIS_STATUS_SUCCESS 0x00000000
26 #define RNDIS_STATUS_FAILURE 0xc0000001 26 #define RNDIS_STATUS_FAILURE 0xc0000001
27 #define RNDIS_STATUS_INVALID_DATA 0xc0010015 27 #define RNDIS_STATUS_INVALID_DATA 0xc0010015
28 #define RNDIS_STATUS_NOT_SUPPORTED 0xc00000bb 28 #define RNDIS_STATUS_NOT_SUPPORTED 0xc00000bb
29 #define RNDIS_STATUS_MEDIA_CONNECT 0x4001000b 29 #define RNDIS_STATUS_MEDIA_CONNECT 0x4001000b
30 #define RNDIS_STATUS_MEDIA_DISCONNECT 0x4001000c 30 #define RNDIS_STATUS_MEDIA_DISCONNECT 0x4001000c
31 #define RNDIS_STATUS_MEDIA_SPECIFIC_INDICATION 0x40010012 31 #define RNDIS_STATUS_MEDIA_SPECIFIC_INDICATION 0x40010012
32 32
33 /* codes for OID_GEN_PHYSICAL_MEDIUM */ 33 /* codes for OID_GEN_PHYSICAL_MEDIUM */
34 #define RNDIS_PHYSICAL_MEDIUM_UNSPECIFIED 0x00000000 34 #define RNDIS_PHYSICAL_MEDIUM_UNSPECIFIED 0x00000000
35 #define RNDIS_PHYSICAL_MEDIUM_WIRELESS_LAN 0x00000001 35 #define RNDIS_PHYSICAL_MEDIUM_WIRELESS_LAN 0x00000001
36 #define RNDIS_PHYSICAL_MEDIUM_CABLE_MODEM 0x00000002 36 #define RNDIS_PHYSICAL_MEDIUM_CABLE_MODEM 0x00000002
37 #define RNDIS_PHYSICAL_MEDIUM_PHONE_LINE 0x00000003 37 #define RNDIS_PHYSICAL_MEDIUM_PHONE_LINE 0x00000003
38 #define RNDIS_PHYSICAL_MEDIUM_POWER_LINE 0x00000004 38 #define RNDIS_PHYSICAL_MEDIUM_POWER_LINE 0x00000004
39 #define RNDIS_PHYSICAL_MEDIUM_DSL 0x00000005 39 #define RNDIS_PHYSICAL_MEDIUM_DSL 0x00000005
40 #define RNDIS_PHYSICAL_MEDIUM_FIBRE_CHANNEL 0x00000006 40 #define RNDIS_PHYSICAL_MEDIUM_FIBRE_CHANNEL 0x00000006
41 #define RNDIS_PHYSICAL_MEDIUM_1394 0x00000007 41 #define RNDIS_PHYSICAL_MEDIUM_1394 0x00000007
42 #define RNDIS_PHYSICAL_MEDIUM_WIRELESS_WAN 0x00000008 42 #define RNDIS_PHYSICAL_MEDIUM_WIRELESS_WAN 0x00000008
43 #define RNDIS_PHYSICAL_MEDIUM_MAX 0x00000009 43 #define RNDIS_PHYSICAL_MEDIUM_MAX 0x00000009
44 44
45 /* NOTE: about 30 OIDs are "mandatory" for peripherals to support ... and 45 /* NOTE: about 30 OIDs are "mandatory" for peripherals to support ... and
46 * there are gobs more that may optionally be supported. We'll avoid as much 46 * there are gobs more that may optionally be supported. We'll avoid as much
47 * of that mess as possible. 47 * of that mess as possible.
48 */ 48 */
49 #define OID_802_3_PERMANENT_ADDRESS 0x01010101 49 #define OID_802_3_PERMANENT_ADDRESS 0x01010101
50 #define OID_GEN_MAXIMUM_FRAME_SIZE 0x00010106 50 #define OID_GEN_MAXIMUM_FRAME_SIZE 0x00010106
51 #define OID_GEN_CURRENT_PACKET_FILTER 0x0001010e 51 #define OID_GEN_CURRENT_PACKET_FILTER 0x0001010e
52 #define OID_GEN_PHYSICAL_MEDIUM 0x00010202 52 #define OID_GEN_PHYSICAL_MEDIUM 0x00010202
53 53
54 /* packet filter bits used by OID_GEN_CURRENT_PACKET_FILTER */ 54 /* packet filter bits used by OID_GEN_CURRENT_PACKET_FILTER */
55 #define RNDIS_PACKET_TYPE_DIRECTED 0x00000001 55 #define RNDIS_PACKET_TYPE_DIRECTED 0x00000001
56 #define RNDIS_PACKET_TYPE_MULTICAST 0x00000002 56 #define RNDIS_PACKET_TYPE_MULTICAST 0x00000002
57 #define RNDIS_PACKET_TYPE_ALL_MULTICAST 0x00000004 57 #define RNDIS_PACKET_TYPE_ALL_MULTICAST 0x00000004
58 #define RNDIS_PACKET_TYPE_BROADCAST 0x00000008 58 #define RNDIS_PACKET_TYPE_BROADCAST 0x00000008
59 #define RNDIS_PACKET_TYPE_SOURCE_ROUTING 0x00000010 59 #define RNDIS_PACKET_TYPE_SOURCE_ROUTING 0x00000010
60 #define RNDIS_PACKET_TYPE_PROMISCUOUS 0x00000020 60 #define RNDIS_PACKET_TYPE_PROMISCUOUS 0x00000020
61 #define RNDIS_PACKET_TYPE_SMT 0x00000040 61 #define RNDIS_PACKET_TYPE_SMT 0x00000040
62 #define RNDIS_PACKET_TYPE_ALL_LOCAL 0x00000080 62 #define RNDIS_PACKET_TYPE_ALL_LOCAL 0x00000080
63 #define RNDIS_PACKET_TYPE_GROUP 0x00001000 63 #define RNDIS_PACKET_TYPE_GROUP 0x00001000
64 #define RNDIS_PACKET_TYPE_ALL_FUNCTIONAL 0x00002000 64 #define RNDIS_PACKET_TYPE_ALL_FUNCTIONAL 0x00002000
65 #define RNDIS_PACKET_TYPE_FUNCTIONAL 0x00004000 65 #define RNDIS_PACKET_TYPE_FUNCTIONAL 0x00004000
66 #define RNDIS_PACKET_TYPE_MAC_FRAME 0x00008000 66 #define RNDIS_PACKET_TYPE_MAC_FRAME 0x00008000
67 67
68 /* From drivers/usb/gadget/ndis.h */ 68 /* From drivers/usb/gadget/ndis.h */
69 69
70 #define NDIS_STATUS_MULTICAST_FULL 0xC0010009 70 #define NDIS_STATUS_MULTICAST_FULL 0xC0010009
71 #define NDIS_STATUS_MULTICAST_EXISTS 0xC001000A 71 #define NDIS_STATUS_MULTICAST_EXISTS 0xC001000A
72 #define NDIS_STATUS_MULTICAST_NOT_FOUND 0xC001000B 72 #define NDIS_STATUS_MULTICAST_NOT_FOUND 0xC001000B
73 73
74 /* NDIS_PNP_CAPABILITIES.Flags constants */ 74 /* NDIS_PNP_CAPABILITIES.Flags constants */
75 #define NDIS_DEVICE_WAKE_UP_ENABLE 0x00000001 75 #define NDIS_DEVICE_WAKE_UP_ENABLE 0x00000001
76 #define NDIS_DEVICE_WAKE_ON_PATTERN_MATCH_ENABLE 0x00000002 76 #define NDIS_DEVICE_WAKE_ON_PATTERN_MATCH_ENABLE 0x00000002
77 #define NDIS_DEVICE_WAKE_ON_MAGIC_PACKET_ENABLE 0x00000004 77 #define NDIS_DEVICE_WAKE_ON_MAGIC_PACKET_ENABLE 0x00000004
78 78
79 /* Required Object IDs (OIDs) */ 79 /* Required Object IDs (OIDs) */
80 #define OID_GEN_SUPPORTED_LIST 0x00010101 80 #define OID_GEN_SUPPORTED_LIST 0x00010101
81 #define OID_GEN_HARDWARE_STATUS 0x00010102 81 #define OID_GEN_HARDWARE_STATUS 0x00010102
82 #define OID_GEN_MEDIA_SUPPORTED 0x00010103 82 #define OID_GEN_MEDIA_SUPPORTED 0x00010103
83 #define OID_GEN_MEDIA_IN_USE 0x00010104 83 #define OID_GEN_MEDIA_IN_USE 0x00010104
84 #define OID_GEN_MAXIMUM_LOOKAHEAD 0x00010105 84 #define OID_GEN_MAXIMUM_LOOKAHEAD 0x00010105
85 #define OID_GEN_LINK_SPEED 0x00010107 85 #define OID_GEN_LINK_SPEED 0x00010107
86 #define OID_GEN_TRANSMIT_BUFFER_SPACE 0x00010108 86 #define OID_GEN_TRANSMIT_BUFFER_SPACE 0x00010108
87 #define OID_GEN_RECEIVE_BUFFER_SPACE 0x00010109 87 #define OID_GEN_RECEIVE_BUFFER_SPACE 0x00010109
88 #define OID_GEN_TRANSMIT_BLOCK_SIZE 0x0001010A 88 #define OID_GEN_TRANSMIT_BLOCK_SIZE 0x0001010A
89 #define OID_GEN_RECEIVE_BLOCK_SIZE 0x0001010B 89 #define OID_GEN_RECEIVE_BLOCK_SIZE 0x0001010B
90 #define OID_GEN_VENDOR_ID 0x0001010C 90 #define OID_GEN_VENDOR_ID 0x0001010C
91 #define OID_GEN_VENDOR_DESCRIPTION 0x0001010D 91 #define OID_GEN_VENDOR_DESCRIPTION 0x0001010D
92 #define OID_GEN_CURRENT_LOOKAHEAD 0x0001010F 92 #define OID_GEN_CURRENT_LOOKAHEAD 0x0001010F
93 #define OID_GEN_DRIVER_VERSION 0x00010110 93 #define OID_GEN_DRIVER_VERSION 0x00010110
94 #define OID_GEN_MAXIMUM_TOTAL_SIZE 0x00010111 94 #define OID_GEN_MAXIMUM_TOTAL_SIZE 0x00010111
95 #define OID_GEN_PROTOCOL_OPTIONS 0x00010112 95 #define OID_GEN_PROTOCOL_OPTIONS 0x00010112
96 #define OID_GEN_MAC_OPTIONS 0x00010113 96 #define OID_GEN_MAC_OPTIONS 0x00010113
97 #define OID_GEN_MEDIA_CONNECT_STATUS 0x00010114 97 #define OID_GEN_MEDIA_CONNECT_STATUS 0x00010114
98 #define OID_GEN_MAXIMUM_SEND_PACKETS 0x00010115 98 #define OID_GEN_MAXIMUM_SEND_PACKETS 0x00010115
99 #define OID_GEN_VENDOR_DRIVER_VERSION 0x00010116 99 #define OID_GEN_VENDOR_DRIVER_VERSION 0x00010116
100 #define OID_GEN_SUPPORTED_GUIDS 0x00010117 100 #define OID_GEN_SUPPORTED_GUIDS 0x00010117
101 #define OID_GEN_NETWORK_LAYER_ADDRESSES 0x00010118 101 #define OID_GEN_NETWORK_LAYER_ADDRESSES 0x00010118
102 #define OID_GEN_TRANSPORT_HEADER_OFFSET 0x00010119 102 #define OID_GEN_TRANSPORT_HEADER_OFFSET 0x00010119
103 #define OID_GEN_MACHINE_NAME 0x0001021A 103 #define OID_GEN_MACHINE_NAME 0x0001021A
104 #define OID_GEN_RNDIS_CONFIG_PARAMETER 0x0001021B 104 #define OID_GEN_RNDIS_CONFIG_PARAMETER 0x0001021B
105 #define OID_GEN_VLAN_ID 0x0001021C 105 #define OID_GEN_VLAN_ID 0x0001021C
106 106
107 /* Optional OIDs */ 107 /* Optional OIDs */
108 #define OID_GEN_MEDIA_CAPABILITIES 0x00010201 108 #define OID_GEN_MEDIA_CAPABILITIES 0x00010201
109 109
110 /* Required statistics OIDs */ 110 /* Required statistics OIDs */
111 #define OID_GEN_XMIT_OK 0x00020101 111 #define OID_GEN_XMIT_OK 0x00020101
112 #define OID_GEN_RCV_OK 0x00020102 112 #define OID_GEN_RCV_OK 0x00020102
113 #define OID_GEN_XMIT_ERROR 0x00020103 113 #define OID_GEN_XMIT_ERROR 0x00020103
114 #define OID_GEN_RCV_ERROR 0x00020104 114 #define OID_GEN_RCV_ERROR 0x00020104
115 #define OID_GEN_RCV_NO_BUFFER 0x00020105 115 #define OID_GEN_RCV_NO_BUFFER 0x00020105
116 116
117 /* Optional statistics OIDs */ 117 /* Optional statistics OIDs */
118 #define OID_GEN_DIRECTED_BYTES_XMIT 0x00020201 118 #define OID_GEN_DIRECTED_BYTES_XMIT 0x00020201
119 #define OID_GEN_DIRECTED_FRAMES_XMIT 0x00020202 119 #define OID_GEN_DIRECTED_FRAMES_XMIT 0x00020202
120 #define OID_GEN_MULTICAST_BYTES_XMIT 0x00020203 120 #define OID_GEN_MULTICAST_BYTES_XMIT 0x00020203
121 #define OID_GEN_MULTICAST_FRAMES_XMIT 0x00020204 121 #define OID_GEN_MULTICAST_FRAMES_XMIT 0x00020204
122 #define OID_GEN_BROADCAST_BYTES_XMIT 0x00020205 122 #define OID_GEN_BROADCAST_BYTES_XMIT 0x00020205
123 #define OID_GEN_BROADCAST_FRAMES_XMIT 0x00020206 123 #define OID_GEN_BROADCAST_FRAMES_XMIT 0x00020206
124 #define OID_GEN_DIRECTED_BYTES_RCV 0x00020207 124 #define OID_GEN_DIRECTED_BYTES_RCV 0x00020207
125 #define OID_GEN_DIRECTED_FRAMES_RCV 0x00020208 125 #define OID_GEN_DIRECTED_FRAMES_RCV 0x00020208
126 #define OID_GEN_MULTICAST_BYTES_RCV 0x00020209 126 #define OID_GEN_MULTICAST_BYTES_RCV 0x00020209
127 #define OID_GEN_MULTICAST_FRAMES_RCV 0x0002020A 127 #define OID_GEN_MULTICAST_FRAMES_RCV 0x0002020A
128 #define OID_GEN_BROADCAST_BYTES_RCV 0x0002020B 128 #define OID_GEN_BROADCAST_BYTES_RCV 0x0002020B
129 #define OID_GEN_BROADCAST_FRAMES_RCV 0x0002020C 129 #define OID_GEN_BROADCAST_FRAMES_RCV 0x0002020C
130 #define OID_GEN_RCV_CRC_ERROR 0x0002020D 130 #define OID_GEN_RCV_CRC_ERROR 0x0002020D
131 #define OID_GEN_TRANSMIT_QUEUE_LENGTH 0x0002020E 131 #define OID_GEN_TRANSMIT_QUEUE_LENGTH 0x0002020E
132 #define OID_GEN_GET_TIME_CAPS 0x0002020F 132 #define OID_GEN_GET_TIME_CAPS 0x0002020F
133 #define OID_GEN_GET_NETCARD_TIME 0x00020210 133 #define OID_GEN_GET_NETCARD_TIME 0x00020210
134 #define OID_GEN_NETCARD_LOAD 0x00020211 134 #define OID_GEN_NETCARD_LOAD 0x00020211
135 #define OID_GEN_DEVICE_PROFILE 0x00020212 135 #define OID_GEN_DEVICE_PROFILE 0x00020212
136 #define OID_GEN_INIT_TIME_MS 0x00020213 136 #define OID_GEN_INIT_TIME_MS 0x00020213
137 #define OID_GEN_RESET_COUNTS 0x00020214 137 #define OID_GEN_RESET_COUNTS 0x00020214
138 #define OID_GEN_MEDIA_SENSE_COUNTS 0x00020215 138 #define OID_GEN_MEDIA_SENSE_COUNTS 0x00020215
139 #define OID_GEN_FRIENDLY_NAME 0x00020216 139 #define OID_GEN_FRIENDLY_NAME 0x00020216
140 #define OID_GEN_MINIPORT_INFO 0x00020217 140 #define OID_GEN_MINIPORT_INFO 0x00020217
141 #define OID_GEN_RESET_VERIFY_PARAMETERS 0x00020218 141 #define OID_GEN_RESET_VERIFY_PARAMETERS 0x00020218
142 142
143 /* IEEE 802.3 (Ethernet) OIDs */ 143 /* IEEE 802.3 (Ethernet) OIDs */
144 #define NDIS_802_3_MAC_OPTION_PRIORITY 0x00000001 144 #define NDIS_802_3_MAC_OPTION_PRIORITY 0x00000001
145 145
146 #define OID_802_3_CURRENT_ADDRESS 0x01010102 146 #define OID_802_3_CURRENT_ADDRESS 0x01010102
147 #define OID_802_3_MULTICAST_LIST 0x01010103 147 #define OID_802_3_MULTICAST_LIST 0x01010103
148 #define OID_802_3_MAXIMUM_LIST_SIZE 0x01010104 148 #define OID_802_3_MAXIMUM_LIST_SIZE 0x01010104
149 #define OID_802_3_MAC_OPTIONS 0x01010105 149 #define OID_802_3_MAC_OPTIONS 0x01010105
150 #define OID_802_3_RCV_ERROR_ALIGNMENT 0x01020101 150 #define OID_802_3_RCV_ERROR_ALIGNMENT 0x01020101
151 #define OID_802_3_XMIT_ONE_COLLISION 0x01020102 151 #define OID_802_3_XMIT_ONE_COLLISION 0x01020102
152 #define OID_802_3_XMIT_MORE_COLLISIONS 0x01020103 152 #define OID_802_3_XMIT_MORE_COLLISIONS 0x01020103
153 #define OID_802_3_XMIT_DEFERRED 0x01020201 153 #define OID_802_3_XMIT_DEFERRED 0x01020201
154 #define OID_802_3_XMIT_MAX_COLLISIONS 0x01020202 154 #define OID_802_3_XMIT_MAX_COLLISIONS 0x01020202
155 #define OID_802_3_RCV_OVERRUN 0x01020203 155 #define OID_802_3_RCV_OVERRUN 0x01020203
156 #define OID_802_3_XMIT_UNDERRUN 0x01020204 156 #define OID_802_3_XMIT_UNDERRUN 0x01020204
157 #define OID_802_3_XMIT_HEARTBEAT_FAILURE 0x01020205 157 #define OID_802_3_XMIT_HEARTBEAT_FAILURE 0x01020205
158 #define OID_802_3_XMIT_TIMES_CRS_LOST 0x01020206 158 #define OID_802_3_XMIT_TIMES_CRS_LOST 0x01020206
159 #define OID_802_3_XMIT_LATE_COLLISIONS 0x01020207 159 #define OID_802_3_XMIT_LATE_COLLISIONS 0x01020207
160 160
161 /* OID_GEN_MINIPORT_INFO constants */ 161 /* OID_GEN_MINIPORT_INFO constants */
162 #define NDIS_MINIPORT_BUS_MASTER 0x00000001 162 #define NDIS_MINIPORT_BUS_MASTER 0x00000001
163 #define NDIS_MINIPORT_WDM_DRIVER 0x00000002 163 #define NDIS_MINIPORT_WDM_DRIVER 0x00000002
164 #define NDIS_MINIPORT_SG_LIST 0x00000004 164 #define NDIS_MINIPORT_SG_LIST 0x00000004
165 #define NDIS_MINIPORT_SUPPORTS_MEDIA_QUERY 0x00000008 165 #define NDIS_MINIPORT_SUPPORTS_MEDIA_QUERY 0x00000008
166 #define NDIS_MINIPORT_INDICATES_PACKETS 0x00000010 166 #define NDIS_MINIPORT_INDICATES_PACKETS 0x00000010
167 #define NDIS_MINIPORT_IGNORE_PACKET_QUEUE 0x00000020 167 #define NDIS_MINIPORT_IGNORE_PACKET_QUEUE 0x00000020
168 #define NDIS_MINIPORT_IGNORE_REQUEST_QUEUE 0x00000040 168 #define NDIS_MINIPORT_IGNORE_REQUEST_QUEUE 0x00000040
169 #define NDIS_MINIPORT_IGNORE_TOKEN_RING_ERRORS 0x00000080 169 #define NDIS_MINIPORT_IGNORE_TOKEN_RING_ERRORS 0x00000080
170 #define NDIS_MINIPORT_INTERMEDIATE_DRIVER 0x00000100 170 #define NDIS_MINIPORT_INTERMEDIATE_DRIVER 0x00000100
171 #define NDIS_MINIPORT_IS_NDIS_5 0x00000200 171 #define NDIS_MINIPORT_IS_NDIS_5 0x00000200
172 #define NDIS_MINIPORT_IS_CO 0x00000400 172 #define NDIS_MINIPORT_IS_CO 0x00000400
173 #define NDIS_MINIPORT_DESERIALIZE 0x00000800 173 #define NDIS_MINIPORT_DESERIALIZE 0x00000800
174 #define NDIS_MINIPORT_REQUIRES_MEDIA_POLLING 0x00001000 174 #define NDIS_MINIPORT_REQUIRES_MEDIA_POLLING 0x00001000
175 #define NDIS_MINIPORT_SUPPORTS_MEDIA_SENSE 0x00002000 175 #define NDIS_MINIPORT_SUPPORTS_MEDIA_SENSE 0x00002000
176 #define NDIS_MINIPORT_NETBOOT_CARD 0x00004000 176 #define NDIS_MINIPORT_NETBOOT_CARD 0x00004000
177 #define NDIS_MINIPORT_PM_SUPPORTED 0x00008000 177 #define NDIS_MINIPORT_PM_SUPPORTED 0x00008000
178 #define NDIS_MINIPORT_SUPPORTS_MAC_ADDRESS_OVERWRITE 0x00010000 178 #define NDIS_MINIPORT_SUPPORTS_MAC_ADDRESS_OVERWRITE 0x00010000
179 #define NDIS_MINIPORT_USES_SAFE_BUFFER_APIS 0x00020000 179 #define NDIS_MINIPORT_USES_SAFE_BUFFER_APIS 0x00020000
180 #define NDIS_MINIPORT_HIDDEN 0x00040000 180 #define NDIS_MINIPORT_HIDDEN 0x00040000
181 #define NDIS_MINIPORT_SWENUM 0x00080000 181 #define NDIS_MINIPORT_SWENUM 0x00080000
182 #define NDIS_MINIPORT_SURPRISE_REMOVE_OK 0x00100000 182 #define NDIS_MINIPORT_SURPRISE_REMOVE_OK 0x00100000
183 #define NDIS_MINIPORT_NO_HALT_ON_SUSPEND 0x00200000 183 #define NDIS_MINIPORT_NO_HALT_ON_SUSPEND 0x00200000
184 #define NDIS_MINIPORT_HARDWARE_DEVICE 0x00400000 184 #define NDIS_MINIPORT_HARDWARE_DEVICE 0x00400000
185 #define NDIS_MINIPORT_SUPPORTS_CANCEL_SEND_PACKETS 0x00800000 185 #define NDIS_MINIPORT_SUPPORTS_CANCEL_SEND_PACKETS 0x00800000
186 #define NDIS_MINIPORT_64BITS_DMA 0x01000000 186 #define NDIS_MINIPORT_64BITS_DMA 0x01000000
187 187
188 #define NDIS_MEDIUM_802_3 0x00000000 188 #define NDIS_MEDIUM_802_3 0x00000000
189 #define NDIS_MEDIUM_802_5 0x00000001 189 #define NDIS_MEDIUM_802_5 0x00000001
190 #define NDIS_MEDIUM_FDDI 0x00000002 190 #define NDIS_MEDIUM_FDDI 0x00000002
191 #define NDIS_MEDIUM_WAN 0x00000003 191 #define NDIS_MEDIUM_WAN 0x00000003
192 #define NDIS_MEDIUM_LOCAL_TALK 0x00000004 192 #define NDIS_MEDIUM_LOCAL_TALK 0x00000004
193 #define NDIS_MEDIUM_DIX 0x00000005 193 #define NDIS_MEDIUM_DIX 0x00000005
194 #define NDIS_MEDIUM_ARCENT_RAW 0x00000006 194 #define NDIS_MEDIUM_ARCENT_RAW 0x00000006
195 #define NDIS_MEDIUM_ARCENT_878_2 0x00000007 195 #define NDIS_MEDIUM_ARCENT_878_2 0x00000007
196 #define NDIS_MEDIUM_ATM 0x00000008 196 #define NDIS_MEDIUM_ATM 0x00000008
197 #define NDIS_MEDIUM_WIRELESS_LAN 0x00000009 197 #define NDIS_MEDIUM_WIRELESS_LAN 0x00000009
198 #define NDIS_MEDIUM_IRDA 0x0000000A 198 #define NDIS_MEDIUM_IRDA 0x0000000A
199 #define NDIS_MEDIUM_BPC 0x0000000B 199 #define NDIS_MEDIUM_BPC 0x0000000B
200 #define NDIS_MEDIUM_CO_WAN 0x0000000C 200 #define NDIS_MEDIUM_CO_WAN 0x0000000C
201 #define NDIS_MEDIUM_1394 0x0000000D 201 #define NDIS_MEDIUM_1394 0x0000000D
202 202
203 #define NDIS_PACKET_TYPE_DIRECTED 0x00000001 203 #define NDIS_PACKET_TYPE_DIRECTED 0x00000001
204 #define NDIS_PACKET_TYPE_MULTICAST 0x00000002 204 #define NDIS_PACKET_TYPE_MULTICAST 0x00000002
205 #define NDIS_PACKET_TYPE_ALL_MULTICAST 0x00000004 205 #define NDIS_PACKET_TYPE_ALL_MULTICAST 0x00000004
206 #define NDIS_PACKET_TYPE_BROADCAST 0x00000008 206 #define NDIS_PACKET_TYPE_BROADCAST 0x00000008
207 #define NDIS_PACKET_TYPE_SOURCE_ROUTING 0x00000010 207 #define NDIS_PACKET_TYPE_SOURCE_ROUTING 0x00000010
208 #define NDIS_PACKET_TYPE_PROMISCUOUS 0x00000020 208 #define NDIS_PACKET_TYPE_PROMISCUOUS 0x00000020
209 #define NDIS_PACKET_TYPE_SMT 0x00000040 209 #define NDIS_PACKET_TYPE_SMT 0x00000040
210 #define NDIS_PACKET_TYPE_ALL_LOCAL 0x00000080 210 #define NDIS_PACKET_TYPE_ALL_LOCAL 0x00000080
211 #define NDIS_PACKET_TYPE_GROUP 0x00000100 211 #define NDIS_PACKET_TYPE_GROUP 0x00000100
212 #define NDIS_PACKET_TYPE_ALL_FUNCTIONAL 0x00000200 212 #define NDIS_PACKET_TYPE_ALL_FUNCTIONAL 0x00000200
213 #define NDIS_PACKET_TYPE_FUNCTIONAL 0x00000400 213 #define NDIS_PACKET_TYPE_FUNCTIONAL 0x00000400
214 #define NDIS_PACKET_TYPE_MAC_FRAME 0x00000800 214 #define NDIS_PACKET_TYPE_MAC_FRAME 0x00000800
215 215
216 #define NDIS_MEDIA_STATE_CONNECTED 0x00000000 216 #define NDIS_MEDIA_STATE_CONNECTED 0x00000000
217 #define NDIS_MEDIA_STATE_DISCONNECTED 0x00000001 217 #define NDIS_MEDIA_STATE_DISCONNECTED 0x00000001
218 218
219 #define NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA 0x00000001 219 #define NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA 0x00000001
220 #define NDIS_MAC_OPTION_RECEIVE_SERIALIZED 0x00000002 220 #define NDIS_MAC_OPTION_RECEIVE_SERIALIZED 0x00000002
221 #define NDIS_MAC_OPTION_TRANSFERS_NOT_PEND 0x00000004 221 #define NDIS_MAC_OPTION_TRANSFERS_NOT_PEND 0x00000004
222 #define NDIS_MAC_OPTION_NO_LOOPBACK 0x00000008 222 #define NDIS_MAC_OPTION_NO_LOOPBACK 0x00000008
223 #define NDIS_MAC_OPTION_FULL_DUPLEX 0x00000010 223 #define NDIS_MAC_OPTION_FULL_DUPLEX 0x00000010
224 #define NDIS_MAC_OPTION_EOTX_INDICATION 0x00000020 224 #define NDIS_MAC_OPTION_EOTX_INDICATION 0x00000020
225 #define NDIS_MAC_OPTION_8021P_PRIORITY 0x00000040 225 #define NDIS_MAC_OPTION_8021P_PRIORITY 0x00000040
226 #define NDIS_MAC_OPTION_RESERVED 0x80000000 226 #define NDIS_MAC_OPTION_RESERVED 0x80000000
227 227
228 /* From drivers/usb/gadget/rndis.h */ 228 /* From drivers/usb/gadget/rndis.h */
229 229
230 /* Remote NDIS Versions */ 230 /* Remote NDIS Versions */
231 #define RNDIS_MAJOR_VERSION 0x00000001 231 #define RNDIS_MAJOR_VERSION 0x00000001
232 #define RNDIS_MINOR_VERSION 0x00000000 232 #define RNDIS_MINOR_VERSION 0x00000000
233 233
234 /* For all not specified status messages: 234 /* For all not specified status messages:
235 * RNDIS_STATUS_Xxx -> NDIS_STATUS_Xxx 235 * RNDIS_STATUS_Xxx -> NDIS_STATUS_Xxx
236 */ 236 */
237 237
238 /* Message Set for Connectionless (802.3) Devices */ 238 /* Message Set for Connectionless (802.3) Devices */
239 #define REMOTE_NDIS_PACKET_MSG 0x00000001U 239 #define REMOTE_NDIS_PACKET_MSG 0x00000001U
240 #define REMOTE_NDIS_INITIALIZE_MSG 0x00000002U /* Initialize device */ 240 #define REMOTE_NDIS_INITIALIZE_MSG 0x00000002U /* Initialize device */
241 #define REMOTE_NDIS_HALT_MSG 0x00000003U 241 #define REMOTE_NDIS_HALT_MSG 0x00000003U
242 #define REMOTE_NDIS_QUERY_MSG 0x00000004U 242 #define REMOTE_NDIS_QUERY_MSG 0x00000004U
243 #define REMOTE_NDIS_SET_MSG 0x00000005U 243 #define REMOTE_NDIS_SET_MSG 0x00000005U
244 #define REMOTE_NDIS_RESET_MSG 0x00000006U 244 #define REMOTE_NDIS_RESET_MSG 0x00000006U
245 #define REMOTE_NDIS_INDICATE_STATUS_MSG 0x00000007U 245 #define REMOTE_NDIS_INDICATE_STATUS_MSG 0x00000007U
246 #define REMOTE_NDIS_KEEPALIVE_MSG 0x00000008U 246 #define REMOTE_NDIS_KEEPALIVE_MSG 0x00000008U
247 247
248 /* Message completion */ 248 /* Message completion */
249 #define REMOTE_NDIS_INITIALIZE_CMPLT 0x80000002U 249 #define REMOTE_NDIS_INITIALIZE_CMPLT 0x80000002U
250 #define REMOTE_NDIS_QUERY_CMPLT 0x80000004U 250 #define REMOTE_NDIS_QUERY_CMPLT 0x80000004U
251 #define REMOTE_NDIS_SET_CMPLT 0x80000005U 251 #define REMOTE_NDIS_SET_CMPLT 0x80000005U
252 #define REMOTE_NDIS_RESET_CMPLT 0x80000006U 252 #define REMOTE_NDIS_RESET_CMPLT 0x80000006U
253 #define REMOTE_NDIS_KEEPALIVE_CMPLT 0x80000008U 253 #define REMOTE_NDIS_KEEPALIVE_CMPLT 0x80000008U
254 254
255 /* Device Flags */ 255 /* Device Flags */
256 #define RNDIS_DF_CONNECTIONLESS 0x00000001U 256 #define RNDIS_DF_CONNECTIONLESS 0x00000001U
257 #define RNDIS_DF_CONNECTION_ORIENTED 0x00000002U 257 #define RNDIS_DF_CONNECTION_ORIENTED 0x00000002U
258 #define RNDIS_DF_RAW_DATA 0x00000004U 258 #define RNDIS_DF_RAW_DATA 0x00000004U
259 259
260 /* from drivers/net/sk98lin/h/skgepnmi.h */ 260 /* from drivers/net/sk98lin/h/skgepnmi.h */
261 #define OID_PNP_CAPABILITIES 0xFD010100 261 #define OID_PNP_CAPABILITIES 0xFD010100
262 #define OID_PNP_SET_POWER 0xFD010101 262 #define OID_PNP_SET_POWER 0xFD010101
263 #define OID_PNP_QUERY_POWER 0xFD010102 263 #define OID_PNP_QUERY_POWER 0xFD010102
264 #define OID_PNP_ADD_WAKE_UP_PATTERN 0xFD010103 264 #define OID_PNP_ADD_WAKE_UP_PATTERN 0xFD010103
265 #define OID_PNP_REMOVE_WAKE_UP_PATTERN 0xFD010104 265 #define OID_PNP_REMOVE_WAKE_UP_PATTERN 0xFD010104
266 #define OID_PNP_ENABLE_WAKE_UP 0xFD010106 266 #define OID_PNP_ENABLE_WAKE_UP 0xFD010106
267 267
268 /* From drivers/net/hyperv/hyperv_net.h */ 268 /* From drivers/net/hyperv/hyperv_net.h */
269 269
270 /* Status codes */ 270 /* Status codes */
271 271 #define RNDIS_STATUS_PENDING (0x00000103L)
272 #ifndef STATUS_SUCCESS
273 #define STATUS_SUCCESS (0x00000000L)
274 #endif
275
276 #ifndef STATUS_UNSUCCESSFUL
277 #define STATUS_UNSUCCESSFUL (0xC0000001L)
278 #endif
279
280 #ifndef STATUS_PENDING
281 #define STATUS_PENDING (0x00000103L)
282 #endif
283
284 #ifndef STATUS_INSUFFICIENT_RESOURCES
285 #define STATUS_INSUFFICIENT_RESOURCES (0xC000009AL)
286 #endif
287
288 #ifndef STATUS_BUFFER_OVERFLOW
289 #define STATUS_BUFFER_OVERFLOW (0x80000005L)
290 #endif
291
292 #ifndef STATUS_NOT_SUPPORTED
293 #define STATUS_NOT_SUPPORTED (0xC00000BBL)
294 #endif
295
296 #define RNDIS_STATUS_PENDING (STATUS_PENDING)
297 #define RNDIS_STATUS_NOT_RECOGNIZED (0x00010001L) 272 #define RNDIS_STATUS_NOT_RECOGNIZED (0x00010001L)
298 #define RNDIS_STATUS_NOT_COPIED (0x00010002L) 273 #define RNDIS_STATUS_NOT_COPIED (0x00010002L)
299 #define RNDIS_STATUS_NOT_ACCEPTED (0x00010003L) 274 #define RNDIS_STATUS_NOT_ACCEPTED (0x00010003L)
300 #define RNDIS_STATUS_CALL_ACTIVE (0x00010007L) 275 #define RNDIS_STATUS_CALL_ACTIVE (0x00010007L)
301 276
302 #define RNDIS_STATUS_ONLINE (0x40010003L) 277 #define RNDIS_STATUS_ONLINE (0x40010003L)
303 #define RNDIS_STATUS_RESET_START (0x40010004L) 278 #define RNDIS_STATUS_RESET_START (0x40010004L)
304 #define RNDIS_STATUS_RESET_END (0x40010005L) 279 #define RNDIS_STATUS_RESET_END (0x40010005L)
305 #define RNDIS_STATUS_RING_STATUS (0x40010006L) 280 #define RNDIS_STATUS_RING_STATUS (0x40010006L)
306 #define RNDIS_STATUS_CLOSED (0x40010007L) 281 #define RNDIS_STATUS_CLOSED (0x40010007L)
307 #define RNDIS_STATUS_WAN_LINE_UP (0x40010008L) 282 #define RNDIS_STATUS_WAN_LINE_UP (0x40010008L)
308 #define RNDIS_STATUS_WAN_LINE_DOWN (0x40010009L) 283 #define RNDIS_STATUS_WAN_LINE_DOWN (0x40010009L)
309 #define RNDIS_STATUS_WAN_FRAGMENT (0x4001000AL) 284 #define RNDIS_STATUS_WAN_FRAGMENT (0x4001000AL)
310 #define RNDIS_STATUS_HARDWARE_LINE_UP (0x4001000DL) 285 #define RNDIS_STATUS_HARDWARE_LINE_UP (0x4001000DL)
311 #define RNDIS_STATUS_HARDWARE_LINE_DOWN (0x4001000EL) 286 #define RNDIS_STATUS_HARDWARE_LINE_DOWN (0x4001000EL)
312 #define RNDIS_STATUS_INTERFACE_UP (0x4001000FL) 287 #define RNDIS_STATUS_INTERFACE_UP (0x4001000FL)
313 #define RNDIS_STATUS_INTERFACE_DOWN (0x40010010L) 288 #define RNDIS_STATUS_INTERFACE_DOWN (0x40010010L)
314 #define RNDIS_STATUS_MEDIA_BUSY (0x40010011L) 289 #define RNDIS_STATUS_MEDIA_BUSY (0x40010011L)
315 #define RNDIS_STATUS_WW_INDICATION RDIA_SPECIFIC_INDICATION 290 #define RNDIS_STATUS_WW_INDICATION RDIA_SPECIFIC_INDICATION
316 #define RNDIS_STATUS_LINK_SPEED_CHANGE (0x40010013L) 291 #define RNDIS_STATUS_LINK_SPEED_CHANGE (0x40010013L)
317 292
318 #define RNDIS_STATUS_NOT_RESETTABLE (0x80010001L) 293 #define RNDIS_STATUS_NOT_RESETTABLE (0x80010001L)
319 #define RNDIS_STATUS_SOFT_ERRORS (0x80010003L) 294 #define RNDIS_STATUS_SOFT_ERRORS (0x80010003L)
320 #define RNDIS_STATUS_HARD_ERRORS (0x80010004L) 295 #define RNDIS_STATUS_HARD_ERRORS (0x80010004L)
321 #define RNDIS_STATUS_BUFFER_OVERFLOW (STATUS_BUFFER_OVERFLOW) 296 #define RNDIS_STATUS_BUFFER_OVERFLOW (0x80000005L)
322 297
323 #define RNDIS_STATUS_RESOURCES (STATUS_INSUFFICIENT_RESOURCES) 298 #define RNDIS_STATUS_RESOURCES (0xC000009AL)
324 #define RNDIS_STATUS_CLOSING (0xC0010002L) 299 #define RNDIS_STATUS_CLOSING (0xC0010002L)
325 #define RNDIS_STATUS_BAD_VERSION (0xC0010004L) 300 #define RNDIS_STATUS_BAD_VERSION (0xC0010004L)
326 #define RNDIS_STATUS_BAD_CHARACTERISTICS (0xC0010005L) 301 #define RNDIS_STATUS_BAD_CHARACTERISTICS (0xC0010005L)
327 #define RNDIS_STATUS_ADAPTER_NOT_FOUND (0xC0010006L) 302 #define RNDIS_STATUS_ADAPTER_NOT_FOUND (0xC0010006L)
328 #define RNDIS_STATUS_OPEN_FAILED (0xC0010007L) 303 #define RNDIS_STATUS_OPEN_FAILED (0xC0010007L)
329 #define RNDIS_STATUS_DEVICE_FAILED (0xC0010008L) 304 #define RNDIS_STATUS_DEVICE_FAILED (0xC0010008L)
330 #define RNDIS_STATUS_MULTICAST_FULL (0xC0010009L) 305 #define RNDIS_STATUS_MULTICAST_FULL (0xC0010009L)
331 #define RNDIS_STATUS_MULTICAST_EXISTS (0xC001000AL) 306 #define RNDIS_STATUS_MULTICAST_EXISTS (0xC001000AL)
332 #define RNDIS_STATUS_MULTICAST_NOT_FOUND (0xC001000BL) 307 #define RNDIS_STATUS_MULTICAST_NOT_FOUND (0xC001000BL)
333 #define RNDIS_STATUS_REQUEST_ABORTED (0xC001000CL) 308 #define RNDIS_STATUS_REQUEST_ABORTED (0xC001000CL)
334 #define RNDIS_STATUS_RESET_IN_PROGRESS (0xC001000DL) 309 #define RNDIS_STATUS_RESET_IN_PROGRESS (0xC001000DL)
335 #define RNDIS_STATUS_CLOSING_INDICATING (0xC001000EL) 310 #define RNDIS_STATUS_CLOSING_INDICATING (0xC001000EL)
336 #define RNDIS_STATUS_INVALID_PACKET (0xC001000FL) 311 #define RNDIS_STATUS_INVALID_PACKET (0xC001000FL)
337 #define RNDIS_STATUS_OPEN_LIST_FULL (0xC0010010L) 312 #define RNDIS_STATUS_OPEN_LIST_FULL (0xC0010010L)
338 #define RNDIS_STATUS_ADAPTER_NOT_READY (0xC0010011L) 313 #define RNDIS_STATUS_ADAPTER_NOT_READY (0xC0010011L)
339 #define RNDIS_STATUS_ADAPTER_NOT_OPEN (0xC0010012L) 314 #define RNDIS_STATUS_ADAPTER_NOT_OPEN (0xC0010012L)
340 #define RNDIS_STATUS_NOT_INDICATING (0xC0010013L) 315 #define RNDIS_STATUS_NOT_INDICATING (0xC0010013L)
341 #define RNDIS_STATUS_INVALID_LENGTH (0xC0010014L) 316 #define RNDIS_STATUS_INVALID_LENGTH (0xC0010014L)
342 #define RNDIS_STATUS_BUFFER_TOO_SHORT (0xC0010016L) 317 #define RNDIS_STATUS_BUFFER_TOO_SHORT (0xC0010016L)
343 #define RNDIS_STATUS_INVALID_OID (0xC0010017L) 318 #define RNDIS_STATUS_INVALID_OID (0xC0010017L)
344 #define RNDIS_STATUS_ADAPTER_REMOVED (0xC0010018L) 319 #define RNDIS_STATUS_ADAPTER_REMOVED (0xC0010018L)
345 #define RNDIS_STATUS_UNSUPPORTED_MEDIA (0xC0010019L) 320 #define RNDIS_STATUS_UNSUPPORTED_MEDIA (0xC0010019L)
346 #define RNDIS_STATUS_GROUP_ADDRESS_IN_USE (0xC001001AL) 321 #define RNDIS_STATUS_GROUP_ADDRESS_IN_USE (0xC001001AL)
347 #define RNDIS_STATUS_FILE_NOT_FOUND (0xC001001BL) 322 #define RNDIS_STATUS_FILE_NOT_FOUND (0xC001001BL)
348 #define RNDIS_STATUS_ERROR_READING_FILE (0xC001001CL) 323 #define RNDIS_STATUS_ERROR_READING_FILE (0xC001001CL)
349 #define RNDIS_STATUS_ALREADY_MAPPED (0xC001001DL) 324 #define RNDIS_STATUS_ALREADY_MAPPED (0xC001001DL)
350 #define RNDIS_STATUS_RESOURCE_CONFLICT (0xC001001EL) 325 #define RNDIS_STATUS_RESOURCE_CONFLICT (0xC001001EL)
351 #define RNDIS_STATUS_NO_CABLE (0xC001001FL) 326 #define RNDIS_STATUS_NO_CABLE (0xC001001FL)
352 327
353 #define RNDIS_STATUS_INVALID_SAP (0xC0010020L) 328 #define RNDIS_STATUS_INVALID_SAP (0xC0010020L)
354 #define RNDIS_STATUS_SAP_IN_USE (0xC0010021L) 329 #define RNDIS_STATUS_SAP_IN_USE (0xC0010021L)
355 #define RNDIS_STATUS_INVALID_ADDRESS (0xC0010022L) 330 #define RNDIS_STATUS_INVALID_ADDRESS (0xC0010022L)
356 #define RNDIS_STATUS_VC_NOT_ACTIVATED (0xC0010023L) 331 #define RNDIS_STATUS_VC_NOT_ACTIVATED (0xC0010023L)
357 #define RNDIS_STATUS_DEST_OUT_OF_ORDER (0xC0010024L) 332 #define RNDIS_STATUS_DEST_OUT_OF_ORDER (0xC0010024L)
358 #define RNDIS_STATUS_VC_NOT_AVAILABLE (0xC0010025L) 333 #define RNDIS_STATUS_VC_NOT_AVAILABLE (0xC0010025L)
359 #define RNDIS_STATUS_CELLRATE_NOT_AVAILABLE (0xC0010026L) 334 #define RNDIS_STATUS_CELLRATE_NOT_AVAILABLE (0xC0010026L)
360 #define RNDIS_STATUS_INCOMPATABLE_QOS (0xC0010027L) 335 #define RNDIS_STATUS_INCOMPATABLE_QOS (0xC0010027L)
361 #define RNDIS_STATUS_AAL_PARAMS_UNSUPPORTED (0xC0010028L) 336 #define RNDIS_STATUS_AAL_PARAMS_UNSUPPORTED (0xC0010028L)
362 #define RNDIS_STATUS_NO_ROUTE_TO_DESTINATION (0xC0010029L) 337 #define RNDIS_STATUS_NO_ROUTE_TO_DESTINATION (0xC0010029L)
363 338
364 #define RNDIS_STATUS_TOKEN_RING_OPEN_ERROR (0xC0011000L) 339 #define RNDIS_STATUS_TOKEN_RING_OPEN_ERROR (0xC0011000L)
365 340
366 /* Object Identifiers used by NdisRequest Query/Set Information */ 341 /* Object Identifiers used by NdisRequest Query/Set Information */
367 /* General Objects */ 342 /* General Objects */
368 #define RNDIS_OID_GEN_SUPPORTED_LIST 0x00010101 343 #define RNDIS_OID_GEN_SUPPORTED_LIST 0x00010101
369 #define RNDIS_OID_GEN_HARDWARE_STATUS 0x00010102 344 #define RNDIS_OID_GEN_HARDWARE_STATUS 0x00010102
370 #define RNDIS_OID_GEN_MEDIA_SUPPORTED 0x00010103 345 #define RNDIS_OID_GEN_MEDIA_SUPPORTED 0x00010103
371 #define RNDIS_OID_GEN_MEDIA_IN_USE 0x00010104 346 #define RNDIS_OID_GEN_MEDIA_IN_USE 0x00010104
372 #define RNDIS_OID_GEN_MAXIMUM_LOOKAHEAD 0x00010105 347 #define RNDIS_OID_GEN_MAXIMUM_LOOKAHEAD 0x00010105
373 #define RNDIS_OID_GEN_LINK_SPEED 0x00010107 348 #define RNDIS_OID_GEN_LINK_SPEED 0x00010107
374 #define RNDIS_OID_GEN_TRANSMIT_BUFFER_SPACE 0x00010108 349 #define RNDIS_OID_GEN_TRANSMIT_BUFFER_SPACE 0x00010108
375 #define RNDIS_OID_GEN_RECEIVE_BUFFER_SPACE 0x00010109 350 #define RNDIS_OID_GEN_RECEIVE_BUFFER_SPACE 0x00010109
376 #define RNDIS_OID_GEN_TRANSMIT_BLOCK_SIZE 0x0001010A 351 #define RNDIS_OID_GEN_TRANSMIT_BLOCK_SIZE 0x0001010A
377 #define RNDIS_OID_GEN_RECEIVE_BLOCK_SIZE 0x0001010B 352 #define RNDIS_OID_GEN_RECEIVE_BLOCK_SIZE 0x0001010B
378 #define RNDIS_OID_GEN_VENDOR_ID 0x0001010C 353 #define RNDIS_OID_GEN_VENDOR_ID 0x0001010C
379 #define RNDIS_OID_GEN_VENDOR_DESCRIPTION 0x0001010D 354 #define RNDIS_OID_GEN_VENDOR_DESCRIPTION 0x0001010D
380 #define RNDIS_OID_GEN_CURRENT_PACKET_FILTER 0x0001010E 355 #define RNDIS_OID_GEN_CURRENT_PACKET_FILTER 0x0001010E
381 #define RNDIS_OID_GEN_CURRENT_LOOKAHEAD 0x0001010F 356 #define RNDIS_OID_GEN_CURRENT_LOOKAHEAD 0x0001010F
382 #define RNDIS_OID_GEN_DRIVER_VERSION 0x00010110 357 #define RNDIS_OID_GEN_DRIVER_VERSION 0x00010110
383 #define RNDIS_OID_GEN_MAXIMUM_TOTAL_SIZE 0x00010111 358 #define RNDIS_OID_GEN_MAXIMUM_TOTAL_SIZE 0x00010111
384 #define RNDIS_OID_GEN_PROTOCOL_OPTIONS 0x00010112 359 #define RNDIS_OID_GEN_PROTOCOL_OPTIONS 0x00010112
385 #define RNDIS_OID_GEN_MAC_OPTIONS 0x00010113 360 #define RNDIS_OID_GEN_MAC_OPTIONS 0x00010113
386 #define RNDIS_OID_GEN_MEDIA_CONNECT_STATUS 0x00010114 361 #define RNDIS_OID_GEN_MEDIA_CONNECT_STATUS 0x00010114
387 #define RNDIS_OID_GEN_MAXIMUM_SEND_PACKETS 0x00010115 362 #define RNDIS_OID_GEN_MAXIMUM_SEND_PACKETS 0x00010115
388 #define RNDIS_OID_GEN_VENDOR_DRIVER_VERSION 0x00010116 363 #define RNDIS_OID_GEN_VENDOR_DRIVER_VERSION 0x00010116
389 #define RNDIS_OID_GEN_NETWORK_LAYER_ADDRESSES 0x00010118 364 #define RNDIS_OID_GEN_NETWORK_LAYER_ADDRESSES 0x00010118
390 #define RNDIS_OID_GEN_TRANSPORT_HEADER_OFFSET 0x00010119 365 #define RNDIS_OID_GEN_TRANSPORT_HEADER_OFFSET 0x00010119
391 #define RNDIS_OID_GEN_MACHINE_NAME 0x0001021A 366 #define RNDIS_OID_GEN_MACHINE_NAME 0x0001021A
392 367
393 #define RNDIS_OID_GEN_XMIT_OK 0x00020101 368 #define RNDIS_OID_GEN_XMIT_OK 0x00020101
394 #define RNDIS_OID_GEN_RCV_OK 0x00020102 369 #define RNDIS_OID_GEN_RCV_OK 0x00020102
395 #define RNDIS_OID_GEN_XMIT_ERROR 0x00020103 370 #define RNDIS_OID_GEN_XMIT_ERROR 0x00020103
396 #define RNDIS_OID_GEN_RCV_ERROR 0x00020104 371 #define RNDIS_OID_GEN_RCV_ERROR 0x00020104
397 #define RNDIS_OID_GEN_RCV_NO_BUFFER 0x00020105 372 #define RNDIS_OID_GEN_RCV_NO_BUFFER 0x00020105
398 373
399 #define RNDIS_OID_GEN_DIRECTED_BYTES_XMIT 0x00020201 374 #define RNDIS_OID_GEN_DIRECTED_BYTES_XMIT 0x00020201
400 #define RNDIS_OID_GEN_DIRECTED_FRAMES_XMIT 0x00020202 375 #define RNDIS_OID_GEN_DIRECTED_FRAMES_XMIT 0x00020202
401 #define RNDIS_OID_GEN_MULTICAST_BYTES_XMIT 0x00020203 376 #define RNDIS_OID_GEN_MULTICAST_BYTES_XMIT 0x00020203
402 #define RNDIS_OID_GEN_MULTICAST_FRAMES_XMIT 0x00020204 377 #define RNDIS_OID_GEN_MULTICAST_FRAMES_XMIT 0x00020204
403 #define RNDIS_OID_GEN_BROADCAST_BYTES_XMIT 0x00020205 378 #define RNDIS_OID_GEN_BROADCAST_BYTES_XMIT 0x00020205
404 #define RNDIS_OID_GEN_BROADCAST_FRAMES_XMIT 0x00020206 379 #define RNDIS_OID_GEN_BROADCAST_FRAMES_XMIT 0x00020206
405 #define RNDIS_OID_GEN_DIRECTED_BYTES_RCV 0x00020207 380 #define RNDIS_OID_GEN_DIRECTED_BYTES_RCV 0x00020207
406 #define RNDIS_OID_GEN_DIRECTED_FRAMES_RCV 0x00020208 381 #define RNDIS_OID_GEN_DIRECTED_FRAMES_RCV 0x00020208
407 #define RNDIS_OID_GEN_MULTICAST_BYTES_RCV 0x00020209 382 #define RNDIS_OID_GEN_MULTICAST_BYTES_RCV 0x00020209
408 #define RNDIS_OID_GEN_MULTICAST_FRAMES_RCV 0x0002020A 383 #define RNDIS_OID_GEN_MULTICAST_FRAMES_RCV 0x0002020A
409 #define RNDIS_OID_GEN_BROADCAST_BYTES_RCV 0x0002020B 384 #define RNDIS_OID_GEN_BROADCAST_BYTES_RCV 0x0002020B
410 #define RNDIS_OID_GEN_BROADCAST_FRAMES_RCV 0x0002020C 385 #define RNDIS_OID_GEN_BROADCAST_FRAMES_RCV 0x0002020C
411 386
412 #define RNDIS_OID_GEN_RCV_CRC_ERROR 0x0002020D 387 #define RNDIS_OID_GEN_RCV_CRC_ERROR 0x0002020D
413 #define RNDIS_OID_GEN_TRANSMIT_QUEUE_LENGTH 0x0002020E 388 #define RNDIS_OID_GEN_TRANSMIT_QUEUE_LENGTH 0x0002020E
414 389
415 #define RNDIS_OID_GEN_GET_TIME_CAPS 0x0002020F 390 #define RNDIS_OID_GEN_GET_TIME_CAPS 0x0002020F
416 #define RNDIS_OID_GEN_GET_NETCARD_TIME 0x00020210 391 #define RNDIS_OID_GEN_GET_NETCARD_TIME 0x00020210
417 392
418 /* These are connection-oriented general OIDs. */ 393 /* These are connection-oriented general OIDs. */
419 /* These replace the above OIDs for connection-oriented media. */ 394 /* These replace the above OIDs for connection-oriented media. */
420 #define RNDIS_OID_GEN_CO_SUPPORTED_LIST 0x00010101 395 #define RNDIS_OID_GEN_CO_SUPPORTED_LIST 0x00010101
421 #define RNDIS_OID_GEN_CO_HARDWARE_STATUS 0x00010102 396 #define RNDIS_OID_GEN_CO_HARDWARE_STATUS 0x00010102
422 #define RNDIS_OID_GEN_CO_MEDIA_SUPPORTED 0x00010103 397 #define RNDIS_OID_GEN_CO_MEDIA_SUPPORTED 0x00010103
423 #define RNDIS_OID_GEN_CO_MEDIA_IN_USE 0x00010104 398 #define RNDIS_OID_GEN_CO_MEDIA_IN_USE 0x00010104
424 #define RNDIS_OID_GEN_CO_LINK_SPEED 0x00010105 399 #define RNDIS_OID_GEN_CO_LINK_SPEED 0x00010105
425 #define RNDIS_OID_GEN_CO_VENDOR_ID 0x00010106 400 #define RNDIS_OID_GEN_CO_VENDOR_ID 0x00010106
426 #define RNDIS_OID_GEN_CO_VENDOR_DESCRIPTION 0x00010107 401 #define RNDIS_OID_GEN_CO_VENDOR_DESCRIPTION 0x00010107
427 #define RNDIS_OID_GEN_CO_DRIVER_VERSION 0x00010108 402 #define RNDIS_OID_GEN_CO_DRIVER_VERSION 0x00010108
428 #define RNDIS_OID_GEN_CO_PROTOCOL_OPTIONS 0x00010109 403 #define RNDIS_OID_GEN_CO_PROTOCOL_OPTIONS 0x00010109
429 #define RNDIS_OID_GEN_CO_MAC_OPTIONS 0x0001010A 404 #define RNDIS_OID_GEN_CO_MAC_OPTIONS 0x0001010A
430 #define RNDIS_OID_GEN_CO_MEDIA_CONNECT_STATUS 0x0001010B 405 #define RNDIS_OID_GEN_CO_MEDIA_CONNECT_STATUS 0x0001010B
431 #define RNDIS_OID_GEN_CO_VENDOR_DRIVER_VERSION 0x0001010C 406 #define RNDIS_OID_GEN_CO_VENDOR_DRIVER_VERSION 0x0001010C
432 #define RNDIS_OID_GEN_CO_MINIMUM_LINK_SPEED 0x0001010D 407 #define RNDIS_OID_GEN_CO_MINIMUM_LINK_SPEED 0x0001010D
433 408
434 #define RNDIS_OID_GEN_CO_GET_TIME_CAPS 0x00010201 409 #define RNDIS_OID_GEN_CO_GET_TIME_CAPS 0x00010201
435 #define RNDIS_OID_GEN_CO_GET_NETCARD_TIME 0x00010202 410 #define RNDIS_OID_GEN_CO_GET_NETCARD_TIME 0x00010202
436 411
437 /* These are connection-oriented statistics OIDs. */ 412 /* These are connection-oriented statistics OIDs. */
438 #define RNDIS_OID_GEN_CO_XMIT_PDUS_OK 0x00020101 413 #define RNDIS_OID_GEN_CO_XMIT_PDUS_OK 0x00020101
439 #define RNDIS_OID_GEN_CO_RCV_PDUS_OK 0x00020102 414 #define RNDIS_OID_GEN_CO_RCV_PDUS_OK 0x00020102
440 #define RNDIS_OID_GEN_CO_XMIT_PDUS_ERROR 0x00020103 415 #define RNDIS_OID_GEN_CO_XMIT_PDUS_ERROR 0x00020103
441 #define RNDIS_OID_GEN_CO_RCV_PDUS_ERROR 0x00020104 416 #define RNDIS_OID_GEN_CO_RCV_PDUS_ERROR 0x00020104
442 #define RNDIS_OID_GEN_CO_RCV_PDUS_NO_BUFFER 0x00020105 417 #define RNDIS_OID_GEN_CO_RCV_PDUS_NO_BUFFER 0x00020105
443 418
444 419
445 #define RNDIS_OID_GEN_CO_RCV_CRC_ERROR 0x00020201 420 #define RNDIS_OID_GEN_CO_RCV_CRC_ERROR 0x00020201
446 #define RNDIS_OID_GEN_CO_TRANSMIT_QUEUE_LENGTH 0x00020202 421 #define RNDIS_OID_GEN_CO_TRANSMIT_QUEUE_LENGTH 0x00020202
447 #define RNDIS_OID_GEN_CO_BYTES_XMIT 0x00020203 422 #define RNDIS_OID_GEN_CO_BYTES_XMIT 0x00020203
448 #define RNDIS_OID_GEN_CO_BYTES_RCV 0x00020204 423 #define RNDIS_OID_GEN_CO_BYTES_RCV 0x00020204
449 #define RNDIS_OID_GEN_CO_BYTES_XMIT_OUTSTANDING 0x00020205 424 #define RNDIS_OID_GEN_CO_BYTES_XMIT_OUTSTANDING 0x00020205
450 #define RNDIS_OID_GEN_CO_NETCARD_LOAD 0x00020206 425 #define RNDIS_OID_GEN_CO_NETCARD_LOAD 0x00020206
451 426
452 /* These are objects for Connection-oriented media call-managers. */ 427 /* These are objects for Connection-oriented media call-managers. */
453 #define RNDIS_OID_CO_ADD_PVC 0xFF000001 428 #define RNDIS_OID_CO_ADD_PVC 0xFF000001
454 #define RNDIS_OID_CO_DELETE_PVC 0xFF000002 429 #define RNDIS_OID_CO_DELETE_PVC 0xFF000002
455 #define RNDIS_OID_CO_GET_CALL_INFORMATION 0xFF000003 430 #define RNDIS_OID_CO_GET_CALL_INFORMATION 0xFF000003
456 #define RNDIS_OID_CO_ADD_ADDRESS 0xFF000004 431 #define RNDIS_OID_CO_ADD_ADDRESS 0xFF000004
457 #define RNDIS_OID_CO_DELETE_ADDRESS 0xFF000005 432 #define RNDIS_OID_CO_DELETE_ADDRESS 0xFF000005
458 #define RNDIS_OID_CO_GET_ADDRESSES 0xFF000006 433 #define RNDIS_OID_CO_GET_ADDRESSES 0xFF000006
459 #define RNDIS_OID_CO_ADDRESS_CHANGE 0xFF000007 434 #define RNDIS_OID_CO_ADDRESS_CHANGE 0xFF000007
460 #define RNDIS_OID_CO_SIGNALING_ENABLED 0xFF000008 435 #define RNDIS_OID_CO_SIGNALING_ENABLED 0xFF000008
461 #define RNDIS_OID_CO_SIGNALING_DISABLED 0xFF000009 436 #define RNDIS_OID_CO_SIGNALING_DISABLED 0xFF000009
462 437
463 /* 802.3 Objects (Ethernet) */ 438 /* 802.3 Objects (Ethernet) */
464 #define RNDIS_OID_802_3_PERMANENT_ADDRESS 0x01010101 439 #define RNDIS_OID_802_3_PERMANENT_ADDRESS 0x01010101
465 #define RNDIS_OID_802_3_CURRENT_ADDRESS 0x01010102 440 #define RNDIS_OID_802_3_CURRENT_ADDRESS 0x01010102
466 #define RNDIS_OID_802_3_MULTICAST_LIST 0x01010103 441 #define RNDIS_OID_802_3_MULTICAST_LIST 0x01010103
467 #define RNDIS_OID_802_3_MAXIMUM_LIST_SIZE 0x01010104 442 #define RNDIS_OID_802_3_MAXIMUM_LIST_SIZE 0x01010104
468 #define RNDIS_OID_802_3_MAC_OPTIONS 0x01010105 443 #define RNDIS_OID_802_3_MAC_OPTIONS 0x01010105
469 444
470 #define NDIS_802_3_MAC_OPTION_PRIORITY 0x00000001 445 #define NDIS_802_3_MAC_OPTION_PRIORITY 0x00000001
471 446
472 #define RNDIS_OID_802_3_RCV_ERROR_ALIGNMENT 0x01020101 447 #define RNDIS_OID_802_3_RCV_ERROR_ALIGNMENT 0x01020101
473 #define RNDIS_OID_802_3_XMIT_ONE_COLLISION 0x01020102 448 #define RNDIS_OID_802_3_XMIT_ONE_COLLISION 0x01020102
474 #define RNDIS_OID_802_3_XMIT_MORE_COLLISIONS 0x01020103 449 #define RNDIS_OID_802_3_XMIT_MORE_COLLISIONS 0x01020103
475 450
476 #define RNDIS_OID_802_3_XMIT_DEFERRED 0x01020201 451 #define RNDIS_OID_802_3_XMIT_DEFERRED 0x01020201
477 #define RNDIS_OID_802_3_XMIT_MAX_COLLISIONS 0x01020202 452 #define RNDIS_OID_802_3_XMIT_MAX_COLLISIONS 0x01020202
478 #define RNDIS_OID_802_3_RCV_OVERRUN 0x01020203 453 #define RNDIS_OID_802_3_RCV_OVERRUN 0x01020203
479 #define RNDIS_OID_802_3_XMIT_UNDERRUN 0x01020204 454 #define RNDIS_OID_802_3_XMIT_UNDERRUN 0x01020204
480 #define RNDIS_OID_802_3_XMIT_HEARTBEAT_FAILURE 0x01020205 455 #define RNDIS_OID_802_3_XMIT_HEARTBEAT_FAILURE 0x01020205
481 #define RNDIS_OID_802_3_XMIT_TIMES_CRS_LOST 0x01020206 456 #define RNDIS_OID_802_3_XMIT_TIMES_CRS_LOST 0x01020206
482 #define RNDIS_OID_802_3_XMIT_LATE_COLLISIONS 0x01020207 457 #define RNDIS_OID_802_3_XMIT_LATE_COLLISIONS 0x01020207
483 458
484 #define REMOTE_CONDIS_MP_CREATE_VC_MSG 0x00008001 459 #define REMOTE_CONDIS_MP_CREATE_VC_MSG 0x00008001
485 #define REMOTE_CONDIS_MP_DELETE_VC_MSG 0x00008002 460 #define REMOTE_CONDIS_MP_DELETE_VC_MSG 0x00008002
486 #define REMOTE_CONDIS_MP_ACTIVATE_VC_MSG 0x00008005 461 #define REMOTE_CONDIS_MP_ACTIVATE_VC_MSG 0x00008005
487 #define REMOTE_CONDIS_MP_DEACTIVATE_VC_MSG 0x00008006 462 #define REMOTE_CONDIS_MP_DEACTIVATE_VC_MSG 0x00008006
488 #define REMOTE_CONDIS_INDICATE_STATUS_MSG 0x00008007 463 #define REMOTE_CONDIS_INDICATE_STATUS_MSG 0x00008007
489 464
490 #define REMOTE_CONDIS_MP_CREATE_VC_CMPLT 0x80008001 465 #define REMOTE_CONDIS_MP_CREATE_VC_CMPLT 0x80008001
491 #define REMOTE_CONDIS_MP_DELETE_VC_CMPLT 0x80008002 466 #define REMOTE_CONDIS_MP_DELETE_VC_CMPLT 0x80008002
492 #define REMOTE_CONDIS_MP_ACTIVATE_VC_CMPLT 0x80008005 467 #define REMOTE_CONDIS_MP_ACTIVATE_VC_CMPLT 0x80008005
493 #define REMOTE_CONDIS_MP_DEACTIVATE_VC_CMPLT 0x80008006 468 #define REMOTE_CONDIS_MP_DEACTIVATE_VC_CMPLT 0x80008006
494 469
495 /* 470 /*
496 * Reserved message type for private communication between lower-layer host 471 * Reserved message type for private communication between lower-layer host
497 * driver and remote device, if necessary. 472 * driver and remote device, if necessary.
498 */ 473 */
499 #define REMOTE_NDIS_BUS_MSG 0xff000001 474 #define REMOTE_NDIS_BUS_MSG 0xff000001
500 475
501 /* Remote NDIS medium types. */ 476 /* Remote NDIS medium types. */
502 #define RNDIS_MEDIUM_802_3 0x00000000 477 #define RNDIS_MEDIUM_802_3 0x00000000
503 #define RNDIS_MEDIUM_802_5 0x00000001 478 #define RNDIS_MEDIUM_802_5 0x00000001
504 #define RNDIS_MEDIUM_FDDI 0x00000002 479 #define RNDIS_MEDIUM_FDDI 0x00000002
505 #define RNDIS_MEDIUM_WAN 0x00000003 480 #define RNDIS_MEDIUM_WAN 0x00000003
506 #define RNDIS_MEDIUM_LOCAL_TALK 0x00000004 481 #define RNDIS_MEDIUM_LOCAL_TALK 0x00000004
507 #define RNDIS_MEDIUM_ARCNET_RAW 0x00000006 482 #define RNDIS_MEDIUM_ARCNET_RAW 0x00000006
508 #define RNDIS_MEDIUM_ARCNET_878_2 0x00000007 483 #define RNDIS_MEDIUM_ARCNET_878_2 0x00000007
509 #define RNDIS_MEDIUM_ATM 0x00000008 484 #define RNDIS_MEDIUM_ATM 0x00000008
510 #define RNDIS_MEDIUM_WIRELESS_WAN 0x00000009 485 #define RNDIS_MEDIUM_WIRELESS_WAN 0x00000009
511 #define RNDIS_MEDIUM_IRDA 0x0000000a 486 #define RNDIS_MEDIUM_IRDA 0x0000000a
512 #define RNDIS_MEDIUM_CO_WAN 0x0000000b 487 #define RNDIS_MEDIUM_CO_WAN 0x0000000b
513 /* Not a real medium, defined as an upper-bound */ 488 /* Not a real medium, defined as an upper-bound */
514 #define RNDIS_MEDIUM_MAX 0x0000000d 489 #define RNDIS_MEDIUM_MAX 0x0000000d
515 490
516 491
517 /* Remote NDIS medium connection states. */ 492 /* Remote NDIS medium connection states. */
518 #define RNDIS_MEDIA_STATE_CONNECTED 0x00000000 493 #define RNDIS_MEDIA_STATE_CONNECTED 0x00000000
519 #define RNDIS_MEDIA_STATE_DISCONNECTED 0x00000001 494 #define RNDIS_MEDIA_STATE_DISCONNECTED 0x00000001
520 495
521 /* From drivers/net/wireless/rndis_wlan.c */ 496 /* From drivers/net/wireless/rndis_wlan.c */
522 497
523 /* various RNDIS OID defs */ 498 /* various RNDIS OID defs */
524 #define OID_GEN_LINK_SPEED 0x00010107 499 #define OID_GEN_LINK_SPEED 0x00010107
525 500
526 #define OID_GEN_XMIT_OK 0x00020101 501 #define OID_GEN_XMIT_OK 0x00020101
527 #define OID_GEN_RCV_OK 0x00020102 502 #define OID_GEN_RCV_OK 0x00020102
528 #define OID_GEN_XMIT_ERROR 0x00020103 503 #define OID_GEN_XMIT_ERROR 0x00020103
529 #define OID_GEN_RCV_ERROR 0x00020104 504 #define OID_GEN_RCV_ERROR 0x00020104
530 #define OID_GEN_RCV_NO_BUFFER 0x00020105 505 #define OID_GEN_RCV_NO_BUFFER 0x00020105
531 506
532 #define OID_802_3_CURRENT_ADDRESS 0x01010102 507 #define OID_802_3_CURRENT_ADDRESS 0x01010102
533 #define OID_802_3_MULTICAST_LIST 0x01010103 508 #define OID_802_3_MULTICAST_LIST 0x01010103
534 #define OID_802_3_MAXIMUM_LIST_SIZE 0x01010104 509 #define OID_802_3_MAXIMUM_LIST_SIZE 0x01010104
535 510
536 #define OID_802_11_BSSID 0x0d010101 511 #define OID_802_11_BSSID 0x0d010101
537 #define OID_802_11_SSID 0x0d010102 512 #define OID_802_11_SSID 0x0d010102
538 #define OID_802_11_INFRASTRUCTURE_MODE 0x0d010108 513 #define OID_802_11_INFRASTRUCTURE_MODE 0x0d010108
539 #define OID_802_11_ADD_WEP 0x0d010113 514 #define OID_802_11_ADD_WEP 0x0d010113
540 #define OID_802_11_REMOVE_WEP 0x0d010114 515 #define OID_802_11_REMOVE_WEP 0x0d010114
541 #define OID_802_11_DISASSOCIATE 0x0d010115 516 #define OID_802_11_DISASSOCIATE 0x0d010115
542 #define OID_802_11_AUTHENTICATION_MODE 0x0d010118 517 #define OID_802_11_AUTHENTICATION_MODE 0x0d010118
543 #define OID_802_11_PRIVACY_FILTER 0x0d010119 518 #define OID_802_11_PRIVACY_FILTER 0x0d010119
544 #define OID_802_11_BSSID_LIST_SCAN 0x0d01011a 519 #define OID_802_11_BSSID_LIST_SCAN 0x0d01011a
545 #define OID_802_11_ENCRYPTION_STATUS 0x0d01011b 520 #define OID_802_11_ENCRYPTION_STATUS 0x0d01011b
546 #define OID_802_11_ADD_KEY 0x0d01011d 521 #define OID_802_11_ADD_KEY 0x0d01011d
547 #define OID_802_11_REMOVE_KEY 0x0d01011e 522 #define OID_802_11_REMOVE_KEY 0x0d01011e
548 #define OID_802_11_ASSOCIATION_INFORMATION 0x0d01011f 523 #define OID_802_11_ASSOCIATION_INFORMATION 0x0d01011f
549 #define OID_802_11_CAPABILITY 0x0d010122 524 #define OID_802_11_CAPABILITY 0x0d010122
550 #define OID_802_11_PMKID 0x0d010123 525 #define OID_802_11_PMKID 0x0d010123
551 #define OID_802_11_NETWORK_TYPES_SUPPORTED 0x0d010203 526 #define OID_802_11_NETWORK_TYPES_SUPPORTED 0x0d010203
552 #define OID_802_11_NETWORK_TYPE_IN_USE 0x0d010204 527 #define OID_802_11_NETWORK_TYPE_IN_USE 0x0d010204
553 #define OID_802_11_TX_POWER_LEVEL 0x0d010205 528 #define OID_802_11_TX_POWER_LEVEL 0x0d010205
554 #define OID_802_11_RSSI 0x0d010206 529 #define OID_802_11_RSSI 0x0d010206
555 #define OID_802_11_RSSI_TRIGGER 0x0d010207 530 #define OID_802_11_RSSI_TRIGGER 0x0d010207
556 #define OID_802_11_FRAGMENTATION_THRESHOLD 0x0d010209 531 #define OID_802_11_FRAGMENTATION_THRESHOLD 0x0d010209
557 #define OID_802_11_RTS_THRESHOLD 0x0d01020a 532 #define OID_802_11_RTS_THRESHOLD 0x0d01020a
558 #define OID_802_11_SUPPORTED_RATES 0x0d01020e 533 #define OID_802_11_SUPPORTED_RATES 0x0d01020e
559 #define OID_802_11_CONFIGURATION 0x0d010211 534 #define OID_802_11_CONFIGURATION 0x0d010211
560 #define OID_802_11_POWER_MODE 0x0d010216 535 #define OID_802_11_POWER_MODE 0x0d010216
561 #define OID_802_11_BSSID_LIST 0x0d010217 536 #define OID_802_11_BSSID_LIST 0x0d010217
562 537