dec5836ae07541b93d2b71521e206b35fdfa4a17
[linux-flexiantxendom0.git] / drivers / net / hyperv / hyperv_net.h
1 /*
2  *
3  * Copyright (c) 2011, Microsoft Corporation.
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms and conditions of the GNU General Public License,
7  * version 2, as published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
12  * more details.
13  *
14  * You should have received a copy of the GNU General Public License along with
15  * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
16  * Place - Suite 330, Boston, MA 02111-1307 USA.
17  *
18  * Authors:
19  *   Haiyang Zhang <haiyangz@microsoft.com>
20  *   Hank Janssen  <hjanssen@microsoft.com>
21  *   K. Y. Srinivasan <kys@microsoft.com>
22  *
23  */
24
25 #ifndef _HYPERV_NET_H
26 #define _HYPERV_NET_H
27
28 #include <linux/list.h>
29 #include <linux/hyperv.h>
30
31 /* Fwd declaration */
32 struct hv_netvsc_packet;
33
34 /* Represent the xfer page packet which contains 1 or more netvsc packet */
35 struct xferpage_packet {
36         struct list_head list_ent;
37
38         /* # of netvsc packets this xfer packet contains */
39         u32 count;
40 };
41
42 /*
43  * Represent netvsc packet which contains 1 RNDIS and 1 ethernet frame
44  * within the RNDIS
45  */
46 struct hv_netvsc_packet {
47         /* Bookkeeping stuff */
48         struct list_head list_ent;
49
50         struct hv_device *device;
51         bool is_data_pkt;
52
53         /*
54          * Valid only for receives when we break a xfer page packet
55          * into multiple netvsc packets
56          */
57         struct xferpage_packet *xfer_page_pkt;
58
59         union {
60                 struct {
61                         u64 recv_completion_tid;
62                         void *recv_completion_ctx;
63                         void (*recv_completion)(void *context);
64                 } recv;
65                 struct {
66                         u64 send_completion_tid;
67                         void *send_completion_ctx;
68                         void (*send_completion)(void *context);
69                 } send;
70         } completion;
71
72         /* This points to the memory after page_buf */
73         void *extension;
74
75         u32 total_data_buflen;
76         /* Points to the send/receive buffer where the ethernet frame is */
77         void *data;
78         u32 page_buf_cnt;
79         struct hv_page_buffer page_buf[0];
80 };
81
82 struct netvsc_device_info {
83         unsigned char mac_adr[6];
84         bool link_state;        /* 0 - link up, 1 - link down */
85         int  ring_size;
86 };
87
88 enum rndis_device_state {
89         RNDIS_DEV_UNINITIALIZED = 0,
90         RNDIS_DEV_INITIALIZING,
91         RNDIS_DEV_INITIALIZED,
92         RNDIS_DEV_DATAINITIALIZED,
93 };
94
95 struct rndis_device {
96         struct netvsc_device *net_dev;
97
98         enum rndis_device_state state;
99         bool link_state;
100         atomic_t new_req_id;
101
102         spinlock_t request_lock;
103         struct list_head req_list;
104
105         unsigned char hw_mac_adr[ETH_ALEN];
106 };
107
108
109 /* Interface */
110 int netvsc_device_add(struct hv_device *device, void *additional_info);
111 int netvsc_device_remove(struct hv_device *device);
112 int netvsc_send(struct hv_device *device,
113                 struct hv_netvsc_packet *packet);
114 void netvsc_linkstatus_callback(struct hv_device *device_obj,
115                                 unsigned int status);
116 int netvsc_recv_callback(struct hv_device *device_obj,
117                         struct hv_netvsc_packet *packet);
118 int rndis_filter_open(struct hv_device *dev);
119 int rndis_filter_close(struct hv_device *dev);
120 int rndis_filter_device_add(struct hv_device *dev,
121                         void *additional_info);
122 void rndis_filter_device_remove(struct hv_device *dev);
123 int rndis_filter_receive(struct hv_device *dev,
124                         struct hv_netvsc_packet *pkt);
125
126
127
128 int rndis_filter_send(struct hv_device *dev,
129                         struct hv_netvsc_packet *pkt);
130
131 int rndis_filter_set_packet_filter(struct rndis_device *dev, u32 new_filter);
132
133
134 #define NVSP_INVALID_PROTOCOL_VERSION   ((u32)0xFFFFFFFF)
135
136 #define NVSP_PROTOCOL_VERSION_1         2
137 #define NVSP_PROTOCOL_VERSION_2         0x30002
138
139 enum {
140         NVSP_MSG_TYPE_NONE = 0,
141
142         /* Init Messages */
143         NVSP_MSG_TYPE_INIT                      = 1,
144         NVSP_MSG_TYPE_INIT_COMPLETE             = 2,
145
146         NVSP_VERSION_MSG_START                  = 100,
147
148         /* Version 1 Messages */
149         NVSP_MSG1_TYPE_SEND_NDIS_VER            = NVSP_VERSION_MSG_START,
150
151         NVSP_MSG1_TYPE_SEND_RECV_BUF,
152         NVSP_MSG1_TYPE_SEND_RECV_BUF_COMPLETE,
153         NVSP_MSG1_TYPE_REVOKE_RECV_BUF,
154
155         NVSP_MSG1_TYPE_SEND_SEND_BUF,
156         NVSP_MSG1_TYPE_SEND_SEND_BUF_COMPLETE,
157         NVSP_MSG1_TYPE_REVOKE_SEND_BUF,
158
159         NVSP_MSG1_TYPE_SEND_RNDIS_PKT,
160         NVSP_MSG1_TYPE_SEND_RNDIS_PKT_COMPLETE,
161
162         /* Version 2 messages */
163         NVSP_MSG2_TYPE_SEND_CHIMNEY_DELEGATED_BUF,
164         NVSP_MSG2_TYPE_SEND_CHIMNEY_DELEGATED_BUF_COMP,
165         NVSP_MSG2_TYPE_REVOKE_CHIMNEY_DELEGATED_BUF,
166
167         NVSP_MSG2_TYPE_RESUME_CHIMNEY_RX_INDICATION,
168
169         NVSP_MSG2_TYPE_TERMINATE_CHIMNEY,
170         NVSP_MSG2_TYPE_TERMINATE_CHIMNEY_COMP,
171
172         NVSP_MSG2_TYPE_INDICATE_CHIMNEY_EVENT,
173
174         NVSP_MSG2_TYPE_SEND_CHIMNEY_PKT,
175         NVSP_MSG2_TYPE_SEND_CHIMNEY_PKT_COMP,
176
177         NVSP_MSG2_TYPE_POST_CHIMNEY_RECV_REQ,
178         NVSP_MSG2_TYPE_POST_CHIMNEY_RECV_REQ_COMP,
179
180         NVSP_MSG2_TYPE_ALLOC_RXBUF,
181         NVSP_MSG2_TYPE_ALLOC_RXBUF_COMP,
182
183         NVSP_MSG2_TYPE_FREE_RXBUF,
184
185         NVSP_MSG2_TYPE_SEND_VMQ_RNDIS_PKT,
186         NVSP_MSG2_TYPE_SEND_VMQ_RNDIS_PKT_COMP,
187
188         NVSP_MSG2_TYPE_SEND_NDIS_CONFIG,
189
190         NVSP_MSG2_TYPE_ALLOC_CHIMNEY_HANDLE,
191         NVSP_MSG2_TYPE_ALLOC_CHIMNEY_HANDLE_COMP,
192 };
193
194 enum {
195         NVSP_STAT_NONE = 0,
196         NVSP_STAT_SUCCESS,
197         NVSP_STAT_FAIL,
198         NVSP_STAT_PROTOCOL_TOO_NEW,
199         NVSP_STAT_PROTOCOL_TOO_OLD,
200         NVSP_STAT_INVALID_RNDIS_PKT,
201         NVSP_STAT_BUSY,
202         NVSP_STAT_PROTOCOL_UNSUPPORTED,
203         NVSP_STAT_MAX,
204 };
205
206 struct nvsp_message_header {
207         u32 msg_type;
208 };
209
210 /* Init Messages */
211
212 /*
213  * This message is used by the VSC to initialize the channel after the channels
214  * has been opened. This message should never include anything other then
215  * versioning (i.e. this message will be the same for ever).
216  */
217 struct nvsp_message_init {
218         u32 min_protocol_ver;
219         u32 max_protocol_ver;
220 } __packed;
221
222 /*
223  * This message is used by the VSP to complete the initialization of the
224  * channel. This message should never include anything other then versioning
225  * (i.e. this message will be the same for ever).
226  */
227 struct nvsp_message_init_complete {
228         u32 negotiated_protocol_ver;
229         u32 max_mdl_chain_len;
230         u32 status;
231 } __packed;
232
233 union nvsp_message_init_uber {
234         struct nvsp_message_init init;
235         struct nvsp_message_init_complete init_complete;
236 } __packed;
237
238 /* Version 1 Messages */
239
240 /*
241  * This message is used by the VSC to send the NDIS version to the VSP. The VSP
242  * can use this information when handling OIDs sent by the VSC.
243  */
244 struct nvsp_1_message_send_ndis_version {
245         u32 ndis_major_ver;
246         u32 ndis_minor_ver;
247 } __packed;
248
249 /*
250  * This message is used by the VSC to send a receive buffer to the VSP. The VSP
251  * can then use the receive buffer to send data to the VSC.
252  */
253 struct nvsp_1_message_send_receive_buffer {
254         u32 gpadl_handle;
255         u16 id;
256 } __packed;
257
258 struct nvsp_1_receive_buffer_section {
259         u32 offset;
260         u32 sub_alloc_size;
261         u32 num_sub_allocs;
262         u32 end_offset;
263 } __packed;
264
265 /*
266  * This message is used by the VSP to acknowledge a receive buffer send by the
267  * VSC. This message must be sent by the VSP before the VSP uses the receive
268  * buffer.
269  */
270 struct nvsp_1_message_send_receive_buffer_complete {
271         u32 status;
272         u32 num_sections;
273
274         /*
275          * The receive buffer is split into two parts, a large suballocation
276          * section and a small suballocation section. These sections are then
277          * suballocated by a certain size.
278          */
279
280         /*
281          * For example, the following break up of the receive buffer has 6
282          * large suballocations and 10 small suballocations.
283          */
284
285         /*
286          * |            Large Section          |  |   Small Section   |
287          * ------------------------------------------------------------
288          * |     |     |     |     |     |     |  | | | | | | | | | | |
289          * |                                      |
290          *  LargeOffset                            SmallOffset
291          */
292
293         struct nvsp_1_receive_buffer_section sections[1];
294 } __packed;
295
296 /*
297  * This message is sent by the VSC to revoke the receive buffer.  After the VSP
298  * completes this transaction, the vsp should never use the receive buffer
299  * again.
300  */
301 struct nvsp_1_message_revoke_receive_buffer {
302         u16 id;
303 };
304
305 /*
306  * This message is used by the VSC to send a send buffer to the VSP. The VSC
307  * can then use the send buffer to send data to the VSP.
308  */
309 struct nvsp_1_message_send_send_buffer {
310         u32 gpadl_handle;
311         u16 id;
312 } __packed;
313
314 /*
315  * This message is used by the VSP to acknowledge a send buffer sent by the
316  * VSC. This message must be sent by the VSP before the VSP uses the sent
317  * buffer.
318  */
319 struct nvsp_1_message_send_send_buffer_complete {
320         u32 status;
321
322         /*
323          * The VSC gets to choose the size of the send buffer and the VSP gets
324          * to choose the sections size of the buffer.  This was done to enable
325          * dynamic reconfigurations when the cost of GPA-direct buffers
326          * decreases.
327          */
328         u32 section_size;
329 } __packed;
330
331 /*
332  * This message is sent by the VSC to revoke the send buffer.  After the VSP
333  * completes this transaction, the vsp should never use the send buffer again.
334  */
335 struct nvsp_1_message_revoke_send_buffer {
336         u16 id;
337 };
338
339 /*
340  * This message is used by both the VSP and the VSC to send a RNDIS message to
341  * the opposite channel endpoint.
342  */
343 struct nvsp_1_message_send_rndis_packet {
344         /*
345          * This field is specified by RNIDS. They assume there's two different
346          * channels of communication. However, the Network VSP only has one.
347          * Therefore, the channel travels with the RNDIS packet.
348          */
349         u32 channel_type;
350
351         /*
352          * This field is used to send part or all of the data through a send
353          * buffer. This values specifies an index into the send buffer. If the
354          * index is 0xFFFFFFFF, then the send buffer is not being used and all
355          * of the data was sent through other VMBus mechanisms.
356          */
357         u32 send_buf_section_index;
358         u32 send_buf_section_size;
359 } __packed;
360
361 /*
362  * This message is used by both the VSP and the VSC to complete a RNDIS message
363  * to the opposite channel endpoint. At this point, the initiator of this
364  * message cannot use any resources associated with the original RNDIS packet.
365  */
366 struct nvsp_1_message_send_rndis_packet_complete {
367         u32 status;
368 };
369
370 union nvsp_1_message_uber {
371         struct nvsp_1_message_send_ndis_version send_ndis_ver;
372
373         struct nvsp_1_message_send_receive_buffer send_recv_buf;
374         struct nvsp_1_message_send_receive_buffer_complete
375                                                 send_recv_buf_complete;
376         struct nvsp_1_message_revoke_receive_buffer revoke_recv_buf;
377
378         struct nvsp_1_message_send_send_buffer send_send_buf;
379         struct nvsp_1_message_send_send_buffer_complete send_send_buf_complete;
380         struct nvsp_1_message_revoke_send_buffer revoke_send_buf;
381
382         struct nvsp_1_message_send_rndis_packet send_rndis_pkt;
383         struct nvsp_1_message_send_rndis_packet_complete
384                                                 send_rndis_pkt_complete;
385 } __packed;
386
387
388 /*
389  * Network VSP protocol version 2 messages:
390  */
391 struct nvsp_2_vsc_capability {
392         union {
393                 u64 data;
394                 struct {
395                         u64 vmq:1;
396                         u64 chimney:1;
397                         u64 sriov:1;
398                         u64 ieee8021q:1;
399                         u64 correlation_id:1;
400                 };
401         };
402 } __packed;
403
404 struct nvsp_2_send_ndis_config {
405         u32 mtu;
406         u32 reserved;
407         struct nvsp_2_vsc_capability capability;
408 } __packed;
409
410 /* Allocate receive buffer */
411 struct nvsp_2_alloc_rxbuf {
412         /* Allocation ID to match the allocation request and response */
413         u32 alloc_id;
414
415         /* Length of the VM shared memory receive buffer that needs to
416          * be allocated
417          */
418         u32 len;
419 } __packed;
420
421 /* Allocate receive buffer complete */
422 struct nvsp_2_alloc_rxbuf_comp {
423         /* The NDIS_STATUS code for buffer allocation */
424         u32 status;
425
426         u32 alloc_id;
427
428         /* GPADL handle for the allocated receive buffer */
429         u32 gpadl_handle;
430
431         /* Receive buffer ID */
432         u64 recv_buf_id;
433 } __packed;
434
435 struct nvsp_2_free_rxbuf {
436         u64 recv_buf_id;
437 } __packed;
438
439 union nvsp_2_message_uber {
440         struct nvsp_2_send_ndis_config send_ndis_config;
441         struct nvsp_2_alloc_rxbuf alloc_rxbuf;
442         struct nvsp_2_alloc_rxbuf_comp alloc_rxbuf_comp;
443         struct nvsp_2_free_rxbuf free_rxbuf;
444 } __packed;
445
446 union nvsp_all_messages {
447         union nvsp_message_init_uber init_msg;
448         union nvsp_1_message_uber v1_msg;
449         union nvsp_2_message_uber v2_msg;
450 } __packed;
451
452 /* ALL Messages */
453 struct nvsp_message {
454         struct nvsp_message_header hdr;
455         union nvsp_all_messages msg;
456 } __packed;
457
458
459 #define NETVSC_MTU 65536
460
461 #define NETVSC_RECEIVE_BUFFER_SIZE              (1024*1024*2)   /* 2MB */
462
463 #define NETVSC_RECEIVE_BUFFER_ID                0xcafe
464
465 #define NETVSC_RECEIVE_SG_COUNT                 1
466
467 /* Preallocated receive packets */
468 #define NETVSC_RECEIVE_PACKETLIST_COUNT         256
469
470 #define NETVSC_PACKET_SIZE                      2048
471
472 /* Per netvsc channel-specific */
473 struct netvsc_device {
474         struct hv_device *dev;
475
476         u32 nvsp_version;
477
478         atomic_t num_outstanding_sends;
479         bool start_remove;
480         bool destroy;
481         /*
482          * List of free preallocated hv_netvsc_packet to represent receive
483          * packet
484          */
485         struct list_head recv_pkt_list;
486         spinlock_t recv_pkt_list_lock;
487
488         /* Receive buffer allocated by us but manages by NetVSP */
489         void *recv_buf;
490         u32 recv_buf_size;
491         u32 recv_buf_gpadl_handle;
492         u32 recv_section_cnt;
493         struct nvsp_1_receive_buffer_section *recv_section;
494
495         /* Used for NetVSP initialization protocol */
496         struct completion channel_init_wait;
497         struct nvsp_message channel_init_pkt;
498
499         struct nvsp_message revoke_packet;
500         /* unsigned char HwMacAddr[HW_MACADDR_LEN]; */
501
502         struct net_device *ndev;
503
504         /* Holds rndis device info */
505         void *extension;
506 };
507
508
509 /*  Status codes */
510
511
512 #ifndef STATUS_SUCCESS
513 #define STATUS_SUCCESS                          (0x00000000L)
514 #endif
515
516 #ifndef STATUS_UNSUCCESSFUL
517 #define STATUS_UNSUCCESSFUL                     (0xC0000001L)
518 #endif
519
520 #ifndef STATUS_PENDING
521 #define STATUS_PENDING                          (0x00000103L)
522 #endif
523
524 #ifndef STATUS_INSUFFICIENT_RESOURCES
525 #define STATUS_INSUFFICIENT_RESOURCES           (0xC000009AL)
526 #endif
527
528 #ifndef STATUS_BUFFER_OVERFLOW
529 #define STATUS_BUFFER_OVERFLOW                  (0x80000005L)
530 #endif
531
532 #ifndef STATUS_NOT_SUPPORTED
533 #define STATUS_NOT_SUPPORTED                    (0xC00000BBL)
534 #endif
535
536 #define RNDIS_STATUS_SUCCESS                    (STATUS_SUCCESS)
537 #define RNDIS_STATUS_PENDING                    (STATUS_PENDING)
538 #define RNDIS_STATUS_NOT_RECOGNIZED             (0x00010001L)
539 #define RNDIS_STATUS_NOT_COPIED                 (0x00010002L)
540 #define RNDIS_STATUS_NOT_ACCEPTED               (0x00010003L)
541 #define RNDIS_STATUS_CALL_ACTIVE                (0x00010007L)
542
543 #define RNDIS_STATUS_ONLINE                     (0x40010003L)
544 #define RNDIS_STATUS_RESET_START                (0x40010004L)
545 #define RNDIS_STATUS_RESET_END                  (0x40010005L)
546 #define RNDIS_STATUS_RING_STATUS                (0x40010006L)
547 #define RNDIS_STATUS_CLOSED                     (0x40010007L)
548 #define RNDIS_STATUS_WAN_LINE_UP                (0x40010008L)
549 #define RNDIS_STATUS_WAN_LINE_DOWN              (0x40010009L)
550 #define RNDIS_STATUS_WAN_FRAGMENT               (0x4001000AL)
551 #define RNDIS_STATUS_MEDIA_CONNECT              (0x4001000BL)
552 #define RNDIS_STATUS_MEDIA_DISCONNECT           (0x4001000CL)
553 #define RNDIS_STATUS_HARDWARE_LINE_UP           (0x4001000DL)
554 #define RNDIS_STATUS_HARDWARE_LINE_DOWN         (0x4001000EL)
555 #define RNDIS_STATUS_INTERFACE_UP               (0x4001000FL)
556 #define RNDIS_STATUS_INTERFACE_DOWN             (0x40010010L)
557 #define RNDIS_STATUS_MEDIA_BUSY                 (0x40010011L)
558 #define RNDIS_STATUS_MEDIA_SPECIFIC_INDICATION  (0x40010012L)
559 #define RNDIS_STATUS_WW_INDICATION              RDIA_SPECIFIC_INDICATION
560 #define RNDIS_STATUS_LINK_SPEED_CHANGE          (0x40010013L)
561
562 #define RNDIS_STATUS_NOT_RESETTABLE             (0x80010001L)
563 #define RNDIS_STATUS_SOFT_ERRORS                (0x80010003L)
564 #define RNDIS_STATUS_HARD_ERRORS                (0x80010004L)
565 #define RNDIS_STATUS_BUFFER_OVERFLOW            (STATUS_BUFFER_OVERFLOW)
566
567 #define RNDIS_STATUS_FAILURE                    (STATUS_UNSUCCESSFUL)
568 #define RNDIS_STATUS_RESOURCES                  (STATUS_INSUFFICIENT_RESOURCES)
569 #define RNDIS_STATUS_CLOSING                    (0xC0010002L)
570 #define RNDIS_STATUS_BAD_VERSION                (0xC0010004L)
571 #define RNDIS_STATUS_BAD_CHARACTERISTICS        (0xC0010005L)
572 #define RNDIS_STATUS_ADAPTER_NOT_FOUND          (0xC0010006L)
573 #define RNDIS_STATUS_OPEN_FAILED                (0xC0010007L)
574 #define RNDIS_STATUS_DEVICE_FAILED              (0xC0010008L)
575 #define RNDIS_STATUS_MULTICAST_FULL             (0xC0010009L)
576 #define RNDIS_STATUS_MULTICAST_EXISTS           (0xC001000AL)
577 #define RNDIS_STATUS_MULTICAST_NOT_FOUND        (0xC001000BL)
578 #define RNDIS_STATUS_REQUEST_ABORTED            (0xC001000CL)
579 #define RNDIS_STATUS_RESET_IN_PROGRESS          (0xC001000DL)
580 #define RNDIS_STATUS_CLOSING_INDICATING         (0xC001000EL)
581 #define RNDIS_STATUS_NOT_SUPPORTED              (STATUS_NOT_SUPPORTED)
582 #define RNDIS_STATUS_INVALID_PACKET             (0xC001000FL)
583 #define RNDIS_STATUS_OPEN_LIST_FULL             (0xC0010010L)
584 #define RNDIS_STATUS_ADAPTER_NOT_READY          (0xC0010011L)
585 #define RNDIS_STATUS_ADAPTER_NOT_OPEN           (0xC0010012L)
586 #define RNDIS_STATUS_NOT_INDICATING             (0xC0010013L)
587 #define RNDIS_STATUS_INVALID_LENGTH             (0xC0010014L)
588 #define RNDIS_STATUS_INVALID_DATA               (0xC0010015L)
589 #define RNDIS_STATUS_BUFFER_TOO_SHORT           (0xC0010016L)
590 #define RNDIS_STATUS_INVALID_OID                (0xC0010017L)
591 #define RNDIS_STATUS_ADAPTER_REMOVED            (0xC0010018L)
592 #define RNDIS_STATUS_UNSUPPORTED_MEDIA          (0xC0010019L)
593 #define RNDIS_STATUS_GROUP_ADDRESS_IN_USE       (0xC001001AL)
594 #define RNDIS_STATUS_FILE_NOT_FOUND             (0xC001001BL)
595 #define RNDIS_STATUS_ERROR_READING_FILE         (0xC001001CL)
596 #define RNDIS_STATUS_ALREADY_MAPPED             (0xC001001DL)
597 #define RNDIS_STATUS_RESOURCE_CONFLICT          (0xC001001EL)
598 #define RNDIS_STATUS_NO_CABLE                   (0xC001001FL)
599
600 #define RNDIS_STATUS_INVALID_SAP                (0xC0010020L)
601 #define RNDIS_STATUS_SAP_IN_USE                 (0xC0010021L)
602 #define RNDIS_STATUS_INVALID_ADDRESS            (0xC0010022L)
603 #define RNDIS_STATUS_VC_NOT_ACTIVATED           (0xC0010023L)
604 #define RNDIS_STATUS_DEST_OUT_OF_ORDER          (0xC0010024L)
605 #define RNDIS_STATUS_VC_NOT_AVAILABLE           (0xC0010025L)
606 #define RNDIS_STATUS_CELLRATE_NOT_AVAILABLE     (0xC0010026L)
607 #define RNDIS_STATUS_INCOMPATABLE_QOS           (0xC0010027L)
608 #define RNDIS_STATUS_AAL_PARAMS_UNSUPPORTED     (0xC0010028L)
609 #define RNDIS_STATUS_NO_ROUTE_TO_DESTINATION    (0xC0010029L)
610
611 #define RNDIS_STATUS_TOKEN_RING_OPEN_ERROR      (0xC0011000L)
612
613 /* Object Identifiers used by NdisRequest Query/Set Information */
614 /* General Objects */
615 #define RNDIS_OID_GEN_SUPPORTED_LIST            0x00010101
616 #define RNDIS_OID_GEN_HARDWARE_STATUS           0x00010102
617 #define RNDIS_OID_GEN_MEDIA_SUPPORTED           0x00010103
618 #define RNDIS_OID_GEN_MEDIA_IN_USE              0x00010104
619 #define RNDIS_OID_GEN_MAXIMUM_LOOKAHEAD         0x00010105
620 #define RNDIS_OID_GEN_MAXIMUM_FRAME_SIZE        0x00010106
621 #define RNDIS_OID_GEN_LINK_SPEED                0x00010107
622 #define RNDIS_OID_GEN_TRANSMIT_BUFFER_SPACE     0x00010108
623 #define RNDIS_OID_GEN_RECEIVE_BUFFER_SPACE      0x00010109
624 #define RNDIS_OID_GEN_TRANSMIT_BLOCK_SIZE       0x0001010A
625 #define RNDIS_OID_GEN_RECEIVE_BLOCK_SIZE        0x0001010B
626 #define RNDIS_OID_GEN_VENDOR_ID                 0x0001010C
627 #define RNDIS_OID_GEN_VENDOR_DESCRIPTION        0x0001010D
628 #define RNDIS_OID_GEN_CURRENT_PACKET_FILTER     0x0001010E
629 #define RNDIS_OID_GEN_CURRENT_LOOKAHEAD         0x0001010F
630 #define RNDIS_OID_GEN_DRIVER_VERSION            0x00010110
631 #define RNDIS_OID_GEN_MAXIMUM_TOTAL_SIZE        0x00010111
632 #define RNDIS_OID_GEN_PROTOCOL_OPTIONS          0x00010112
633 #define RNDIS_OID_GEN_MAC_OPTIONS               0x00010113
634 #define RNDIS_OID_GEN_MEDIA_CONNECT_STATUS      0x00010114
635 #define RNDIS_OID_GEN_MAXIMUM_SEND_PACKETS      0x00010115
636 #define RNDIS_OID_GEN_VENDOR_DRIVER_VERSION     0x00010116
637 #define RNDIS_OID_GEN_NETWORK_LAYER_ADDRESSES   0x00010118
638 #define RNDIS_OID_GEN_TRANSPORT_HEADER_OFFSET   0x00010119
639 #define RNDIS_OID_GEN_MACHINE_NAME              0x0001021A
640 #define RNDIS_OID_GEN_RNDIS_CONFIG_PARAMETER    0x0001021B
641
642 #define RNDIS_OID_GEN_XMIT_OK                   0x00020101
643 #define RNDIS_OID_GEN_RCV_OK                    0x00020102
644 #define RNDIS_OID_GEN_XMIT_ERROR                0x00020103
645 #define RNDIS_OID_GEN_RCV_ERROR                 0x00020104
646 #define RNDIS_OID_GEN_RCV_NO_BUFFER             0x00020105
647
648 #define RNDIS_OID_GEN_DIRECTED_BYTES_XMIT       0x00020201
649 #define RNDIS_OID_GEN_DIRECTED_FRAMES_XMIT      0x00020202
650 #define RNDIS_OID_GEN_MULTICAST_BYTES_XMIT      0x00020203
651 #define RNDIS_OID_GEN_MULTICAST_FRAMES_XMIT     0x00020204
652 #define RNDIS_OID_GEN_BROADCAST_BYTES_XMIT      0x00020205
653 #define RNDIS_OID_GEN_BROADCAST_FRAMES_XMIT     0x00020206
654 #define RNDIS_OID_GEN_DIRECTED_BYTES_RCV        0x00020207
655 #define RNDIS_OID_GEN_DIRECTED_FRAMES_RCV       0x00020208
656 #define RNDIS_OID_GEN_MULTICAST_BYTES_RCV       0x00020209
657 #define RNDIS_OID_GEN_MULTICAST_FRAMES_RCV      0x0002020A
658 #define RNDIS_OID_GEN_BROADCAST_BYTES_RCV       0x0002020B
659 #define RNDIS_OID_GEN_BROADCAST_FRAMES_RCV      0x0002020C
660
661 #define RNDIS_OID_GEN_RCV_CRC_ERROR             0x0002020D
662 #define RNDIS_OID_GEN_TRANSMIT_QUEUE_LENGTH     0x0002020E
663
664 #define RNDIS_OID_GEN_GET_TIME_CAPS             0x0002020F
665 #define RNDIS_OID_GEN_GET_NETCARD_TIME          0x00020210
666
667 /* These are connection-oriented general OIDs. */
668 /* These replace the above OIDs for connection-oriented media. */
669 #define RNDIS_OID_GEN_CO_SUPPORTED_LIST         0x00010101
670 #define RNDIS_OID_GEN_CO_HARDWARE_STATUS        0x00010102
671 #define RNDIS_OID_GEN_CO_MEDIA_SUPPORTED        0x00010103
672 #define RNDIS_OID_GEN_CO_MEDIA_IN_USE           0x00010104
673 #define RNDIS_OID_GEN_CO_LINK_SPEED             0x00010105
674 #define RNDIS_OID_GEN_CO_VENDOR_ID              0x00010106
675 #define RNDIS_OID_GEN_CO_VENDOR_DESCRIPTION     0x00010107
676 #define RNDIS_OID_GEN_CO_DRIVER_VERSION         0x00010108
677 #define RNDIS_OID_GEN_CO_PROTOCOL_OPTIONS       0x00010109
678 #define RNDIS_OID_GEN_CO_MAC_OPTIONS            0x0001010A
679 #define RNDIS_OID_GEN_CO_MEDIA_CONNECT_STATUS   0x0001010B
680 #define RNDIS_OID_GEN_CO_VENDOR_DRIVER_VERSION  0x0001010C
681 #define RNDIS_OID_GEN_CO_MINIMUM_LINK_SPEED     0x0001010D
682
683 #define RNDIS_OID_GEN_CO_GET_TIME_CAPS          0x00010201
684 #define RNDIS_OID_GEN_CO_GET_NETCARD_TIME       0x00010202
685
686 /* These are connection-oriented statistics OIDs. */
687 #define RNDIS_OID_GEN_CO_XMIT_PDUS_OK           0x00020101
688 #define RNDIS_OID_GEN_CO_RCV_PDUS_OK            0x00020102
689 #define RNDIS_OID_GEN_CO_XMIT_PDUS_ERROR        0x00020103
690 #define RNDIS_OID_GEN_CO_RCV_PDUS_ERROR         0x00020104
691 #define RNDIS_OID_GEN_CO_RCV_PDUS_NO_BUFFER     0x00020105
692
693
694 #define RNDIS_OID_GEN_CO_RCV_CRC_ERROR          0x00020201
695 #define RNDIS_OID_GEN_CO_TRANSMIT_QUEUE_LENGTH  0x00020202
696 #define RNDIS_OID_GEN_CO_BYTES_XMIT             0x00020203
697 #define RNDIS_OID_GEN_CO_BYTES_RCV              0x00020204
698 #define RNDIS_OID_GEN_CO_BYTES_XMIT_OUTSTANDING 0x00020205
699 #define RNDIS_OID_GEN_CO_NETCARD_LOAD           0x00020206
700
701 /* These are objects for Connection-oriented media call-managers. */
702 #define RNDIS_OID_CO_ADD_PVC                    0xFF000001
703 #define RNDIS_OID_CO_DELETE_PVC                 0xFF000002
704 #define RNDIS_OID_CO_GET_CALL_INFORMATION       0xFF000003
705 #define RNDIS_OID_CO_ADD_ADDRESS                0xFF000004
706 #define RNDIS_OID_CO_DELETE_ADDRESS             0xFF000005
707 #define RNDIS_OID_CO_GET_ADDRESSES              0xFF000006
708 #define RNDIS_OID_CO_ADDRESS_CHANGE             0xFF000007
709 #define RNDIS_OID_CO_SIGNALING_ENABLED          0xFF000008
710 #define RNDIS_OID_CO_SIGNALING_DISABLED         0xFF000009
711
712 /* 802.3 Objects (Ethernet) */
713 #define RNDIS_OID_802_3_PERMANENT_ADDRESS       0x01010101
714 #define RNDIS_OID_802_3_CURRENT_ADDRESS         0x01010102
715 #define RNDIS_OID_802_3_MULTICAST_LIST          0x01010103
716 #define RNDIS_OID_802_3_MAXIMUM_LIST_SIZE       0x01010104
717 #define RNDIS_OID_802_3_MAC_OPTIONS             0x01010105
718
719 #define NDIS_802_3_MAC_OPTION_PRIORITY          0x00000001
720
721 #define RNDIS_OID_802_3_RCV_ERROR_ALIGNMENT     0x01020101
722 #define RNDIS_OID_802_3_XMIT_ONE_COLLISION      0x01020102
723 #define RNDIS_OID_802_3_XMIT_MORE_COLLISIONS    0x01020103
724
725 #define RNDIS_OID_802_3_XMIT_DEFERRED           0x01020201
726 #define RNDIS_OID_802_3_XMIT_MAX_COLLISIONS     0x01020202
727 #define RNDIS_OID_802_3_RCV_OVERRUN             0x01020203
728 #define RNDIS_OID_802_3_XMIT_UNDERRUN           0x01020204
729 #define RNDIS_OID_802_3_XMIT_HEARTBEAT_FAILURE  0x01020205
730 #define RNDIS_OID_802_3_XMIT_TIMES_CRS_LOST     0x01020206
731 #define RNDIS_OID_802_3_XMIT_LATE_COLLISIONS    0x01020207
732
733 /* Remote NDIS message types */
734 #define REMOTE_NDIS_PACKET_MSG                  0x00000001
735 #define REMOTE_NDIS_INITIALIZE_MSG              0x00000002
736 #define REMOTE_NDIS_HALT_MSG                    0x00000003
737 #define REMOTE_NDIS_QUERY_MSG                   0x00000004
738 #define REMOTE_NDIS_SET_MSG                     0x00000005
739 #define REMOTE_NDIS_RESET_MSG                   0x00000006
740 #define REMOTE_NDIS_INDICATE_STATUS_MSG         0x00000007
741 #define REMOTE_NDIS_KEEPALIVE_MSG               0x00000008
742
743 #define REMOTE_CONDIS_MP_CREATE_VC_MSG          0x00008001
744 #define REMOTE_CONDIS_MP_DELETE_VC_MSG          0x00008002
745 #define REMOTE_CONDIS_MP_ACTIVATE_VC_MSG        0x00008005
746 #define REMOTE_CONDIS_MP_DEACTIVATE_VC_MSG      0x00008006
747 #define REMOTE_CONDIS_INDICATE_STATUS_MSG       0x00008007
748
749 /* Remote NDIS message completion types */
750 #define REMOTE_NDIS_INITIALIZE_CMPLT            0x80000002
751 #define REMOTE_NDIS_QUERY_CMPLT                 0x80000004
752 #define REMOTE_NDIS_SET_CMPLT                   0x80000005
753 #define REMOTE_NDIS_RESET_CMPLT                 0x80000006
754 #define REMOTE_NDIS_KEEPALIVE_CMPLT             0x80000008
755
756 #define REMOTE_CONDIS_MP_CREATE_VC_CMPLT        0x80008001
757 #define REMOTE_CONDIS_MP_DELETE_VC_CMPLT        0x80008002
758 #define REMOTE_CONDIS_MP_ACTIVATE_VC_CMPLT      0x80008005
759 #define REMOTE_CONDIS_MP_DEACTIVATE_VC_CMPLT    0x80008006
760
761 /*
762  * Reserved message type for private communication between lower-layer host
763  * driver and remote device, if necessary.
764  */
765 #define REMOTE_NDIS_BUS_MSG                     0xff000001
766
767 /*  Defines for DeviceFlags in struct rndis_initialize_complete */
768 #define RNDIS_DF_CONNECTIONLESS                 0x00000001
769 #define RNDIS_DF_CONNECTION_ORIENTED            0x00000002
770 #define RNDIS_DF_RAW_DATA                       0x00000004
771
772 /*  Remote NDIS medium types. */
773 #define RNDIS_MEDIUM_802_3                      0x00000000
774 #define RNDIS_MEDIUM_802_5                      0x00000001
775 #define RNDIS_MEDIUM_FDDI                               0x00000002
776 #define RNDIS_MEDIUM_WAN                                0x00000003
777 #define RNDIS_MEDIUM_LOCAL_TALK                 0x00000004
778 #define RNDIS_MEDIUM_ARCNET_RAW                 0x00000006
779 #define RNDIS_MEDIUM_ARCNET_878_2                       0x00000007
780 #define RNDIS_MEDIUM_ATM                                0x00000008
781 #define RNDIS_MEDIUM_WIRELESS_WAN                       0x00000009
782 #define RNDIS_MEDIUM_IRDA                               0x0000000a
783 #define RNDIS_MEDIUM_CO_WAN                     0x0000000b
784 /* Not a real medium, defined as an upper-bound */
785 #define RNDIS_MEDIUM_MAX                                0x0000000d
786
787
788 /* Remote NDIS medium connection states. */
789 #define RNDIS_MEDIA_STATE_CONNECTED             0x00000000
790 #define RNDIS_MEDIA_STATE_DISCONNECTED          0x00000001
791
792 /*  Remote NDIS version numbers */
793 #define RNDIS_MAJOR_VERSION                     0x00000001
794 #define RNDIS_MINOR_VERSION                     0x00000000
795
796
797 /* NdisInitialize message */
798 struct rndis_initialize_request {
799         u32 req_id;
800         u32 major_ver;
801         u32 minor_ver;
802         u32 max_xfer_size;
803 };
804
805 /* Response to NdisInitialize */
806 struct rndis_initialize_complete {
807         u32 req_id;
808         u32 status;
809         u32 major_ver;
810         u32 minor_ver;
811         u32 dev_flags;
812         u32 medium;
813         u32 max_pkt_per_msg;
814         u32 max_xfer_size;
815         u32 pkt_alignment_factor;
816         u32 af_list_offset;
817         u32 af_list_size;
818 };
819
820 /* Call manager devices only: Information about an address family */
821 /* supported by the device is appended to the response to NdisInitialize. */
822 struct rndis_co_address_family {
823         u32 address_family;
824         u32 major_ver;
825         u32 minor_ver;
826 };
827
828 /* NdisHalt message */
829 struct rndis_halt_request {
830         u32 req_id;
831 };
832
833 /* NdisQueryRequest message */
834 struct rndis_query_request {
835         u32 req_id;
836         u32 oid;
837         u32 info_buflen;
838         u32 info_buf_offset;
839         u32 dev_vc_handle;
840 };
841
842 /* Response to NdisQueryRequest */
843 struct rndis_query_complete {
844         u32 req_id;
845         u32 status;
846         u32 info_buflen;
847         u32 info_buf_offset;
848 };
849
850 /* NdisSetRequest message */
851 struct rndis_set_request {
852         u32 req_id;
853         u32 oid;
854         u32 info_buflen;
855         u32 info_buf_offset;
856         u32 dev_vc_handle;
857 };
858
859 /* Response to NdisSetRequest */
860 struct rndis_set_complete {
861         u32 req_id;
862         u32 status;
863 };
864
865 /* NdisReset message */
866 struct rndis_reset_request {
867         u32 reserved;
868 };
869
870 /* Response to NdisReset */
871 struct rndis_reset_complete {
872         u32 status;
873         u32 addressing_reset;
874 };
875
876 /* NdisMIndicateStatus message */
877 struct rndis_indicate_status {
878         u32 status;
879         u32 status_buflen;
880         u32 status_buf_offset;
881 };
882
883 /* Diagnostic information passed as the status buffer in */
884 /* struct rndis_indicate_status messages signifying error conditions. */
885 struct rndis_diagnostic_info {
886         u32 diag_status;
887         u32 error_offset;
888 };
889
890 /* NdisKeepAlive message */
891 struct rndis_keepalive_request {
892         u32 req_id;
893 };
894
895 /* Response to NdisKeepAlive */
896 struct rndis_keepalive_complete {
897         u32 req_id;
898         u32 status;
899 };
900
901 /*
902  * Data message. All Offset fields contain byte offsets from the beginning of
903  * struct rndis_packet. All Length fields are in bytes.  VcHandle is set
904  * to 0 for connectionless data, otherwise it contains the VC handle.
905  */
906 struct rndis_packet {
907         u32 data_offset;
908         u32 data_len;
909         u32 oob_data_offset;
910         u32 oob_data_len;
911         u32 num_oob_data_elements;
912         u32 per_pkt_info_offset;
913         u32 per_pkt_info_len;
914         u32 vc_handle;
915         u32 reserved;
916 };
917
918 /* Optional Out of Band data associated with a Data message. */
919 struct rndis_oobd {
920         u32 size;
921         u32 type;
922         u32 class_info_offset;
923 };
924
925 /* Packet extension field contents associated with a Data message. */
926 struct rndis_per_packet_info {
927         u32 size;
928         u32 type;
929         u32 per_pkt_info_offset;
930 };
931
932 /* Format of Information buffer passed in a SetRequest for the OID */
933 /* OID_GEN_RNDIS_CONFIG_PARAMETER. */
934 struct rndis_config_parameter_info {
935         u32 parameter_name_offset;
936         u32 parameter_name_length;
937         u32 parameter_type;
938         u32 parameter_value_offset;
939         u32 parameter_value_length;
940 };
941
942 /* Values for ParameterType in struct rndis_config_parameter_info */
943 #define RNDIS_CONFIG_PARAM_TYPE_INTEGER     0
944 #define RNDIS_CONFIG_PARAM_TYPE_STRING      2
945
946 /* CONDIS Miniport messages for connection oriented devices */
947 /* that do not implement a call manager. */
948
949 /* CoNdisMiniportCreateVc message */
950 struct rcondis_mp_create_vc {
951         u32 req_id;
952         u32 ndis_vc_handle;
953 };
954
955 /* Response to CoNdisMiniportCreateVc */
956 struct rcondis_mp_create_vc_complete {
957         u32 req_id;
958         u32 dev_vc_handle;
959         u32 status;
960 };
961
962 /* CoNdisMiniportDeleteVc message */
963 struct rcondis_mp_delete_vc {
964         u32 req_id;
965         u32 dev_vc_handle;
966 };
967
968 /* Response to CoNdisMiniportDeleteVc */
969 struct rcondis_mp_delete_vc_complete {
970         u32 req_id;
971         u32 status;
972 };
973
974 /* CoNdisMiniportQueryRequest message */
975 struct rcondis_mp_query_request {
976         u32 req_id;
977         u32 request_type;
978         u32 oid;
979         u32 dev_vc_handle;
980         u32 info_buflen;
981         u32 info_buf_offset;
982 };
983
984 /* CoNdisMiniportSetRequest message */
985 struct rcondis_mp_set_request {
986         u32 req_id;
987         u32 request_type;
988         u32 oid;
989         u32 dev_vc_handle;
990         u32 info_buflen;
991         u32 info_buf_offset;
992 };
993
994 /* CoNdisIndicateStatus message */
995 struct rcondis_indicate_status {
996         u32 ndis_vc_handle;
997         u32 status;
998         u32 status_buflen;
999         u32 status_buf_offset;
1000 };
1001
1002 /* CONDIS Call/VC parameters */
1003 struct rcondis_specific_parameters {
1004         u32 parameter_type;
1005         u32 parameter_length;
1006         u32 parameter_lffset;
1007 };
1008
1009 struct rcondis_media_parameters {
1010         u32 flags;
1011         u32 reserved1;
1012         u32 reserved2;
1013         struct rcondis_specific_parameters media_specific;
1014 };
1015
1016 struct rndis_flowspec {
1017         u32 token_rate;
1018         u32 token_bucket_size;
1019         u32 peak_bandwidth;
1020         u32 latency;
1021         u32 delay_variation;
1022         u32 service_type;
1023         u32 max_sdu_size;
1024         u32 minimum_policed_size;
1025 };
1026
1027 struct rcondis_call_manager_parameters {
1028         struct rndis_flowspec transmit;
1029         struct rndis_flowspec receive;
1030         struct rcondis_specific_parameters call_mgr_specific;
1031 };
1032
1033 /* CoNdisMiniportActivateVc message */
1034 struct rcondis_mp_activate_vc_request {
1035         u32 req_id;
1036         u32 flags;
1037         u32 dev_vc_handle;
1038         u32 media_params_offset;
1039         u32 media_params_length;
1040         u32 call_mgr_params_offset;
1041         u32 call_mgr_params_length;
1042 };
1043
1044 /* Response to CoNdisMiniportActivateVc */
1045 struct rcondis_mp_activate_vc_complete {
1046         u32 req_id;
1047         u32 status;
1048 };
1049
1050 /* CoNdisMiniportDeactivateVc message */
1051 struct rcondis_mp_deactivate_vc_request {
1052         u32 req_id;
1053         u32 flags;
1054         u32 dev_vc_handle;
1055 };
1056
1057 /* Response to CoNdisMiniportDeactivateVc */
1058 struct rcondis_mp_deactivate_vc_complete {
1059         u32 req_id;
1060         u32 status;
1061 };
1062
1063
1064 /* union with all of the RNDIS messages */
1065 union rndis_message_container {
1066         struct rndis_packet pkt;
1067         struct rndis_initialize_request init_req;
1068         struct rndis_halt_request halt_req;
1069         struct rndis_query_request query_req;
1070         struct rndis_set_request set_req;
1071         struct rndis_reset_request reset_req;
1072         struct rndis_keepalive_request keep_alive_req;
1073         struct rndis_indicate_status indicate_status;
1074         struct rndis_initialize_complete init_complete;
1075         struct rndis_query_complete query_complete;
1076         struct rndis_set_complete set_complete;
1077         struct rndis_reset_complete reset_complete;
1078         struct rndis_keepalive_complete keep_alive_complete;
1079         struct rcondis_mp_create_vc co_miniport_create_vc;
1080         struct rcondis_mp_delete_vc co_miniport_delete_vc;
1081         struct rcondis_indicate_status co_indicate_status;
1082         struct rcondis_mp_activate_vc_request co_miniport_activate_vc;
1083         struct rcondis_mp_deactivate_vc_request co_miniport_deactivate_vc;
1084         struct rcondis_mp_create_vc_complete co_miniport_create_vc_complete;
1085         struct rcondis_mp_delete_vc_complete co_miniport_delete_vc_complete;
1086         struct rcondis_mp_activate_vc_complete co_miniport_activate_vc_complete;
1087         struct rcondis_mp_deactivate_vc_complete
1088                 co_miniport_deactivate_vc_complete;
1089 };
1090
1091 /* Remote NDIS message format */
1092 struct rndis_message {
1093         u32 ndis_msg_type;
1094
1095         /* Total length of this message, from the beginning */
1096         /* of the sruct rndis_message, in bytes. */
1097         u32 msg_len;
1098
1099         /* Actual message */
1100         union rndis_message_container msg;
1101 };
1102
1103
1104 struct rndis_filter_packet {
1105         void *completion_ctx;
1106         void (*completion)(void *context);
1107         struct rndis_message msg;
1108 };
1109
1110 /* Handy macros */
1111
1112 /* get the size of an RNDIS message. Pass in the message type, */
1113 /* struct rndis_set_request, struct rndis_packet for example */
1114 #define RNDIS_MESSAGE_SIZE(msg)                         \
1115         (sizeof(msg) + (sizeof(struct rndis_message) -  \
1116          sizeof(union rndis_message_container)))
1117
1118 /* get pointer to info buffer with message pointer */
1119 #define MESSAGE_TO_INFO_BUFFER(msg)                             \
1120         (((unsigned char *)(msg)) + msg->info_buf_offset)
1121
1122 /* get pointer to status buffer with message pointer */
1123 #define MESSAGE_TO_STATUS_BUFFER(msg)                   \
1124         (((unsigned char *)(msg)) + msg->status_buf_offset)
1125
1126 /* get pointer to OOBD buffer with message pointer */
1127 #define MESSAGE_TO_OOBD_BUFFER(msg)                             \
1128         (((unsigned char *)(msg)) + msg->oob_data_offset)
1129
1130 /* get pointer to data buffer with message pointer */
1131 #define MESSAGE_TO_DATA_BUFFER(msg)                             \
1132         (((unsigned char *)(msg)) + msg->per_pkt_info_offset)
1133
1134 /* get pointer to contained message from NDIS_MESSAGE pointer */
1135 #define RNDIS_MESSAGE_PTR_TO_MESSAGE_PTR(rndis_msg)             \
1136         ((void *) &rndis_msg->msg)
1137
1138 /* get pointer to contained message from NDIS_MESSAGE pointer */
1139 #define RNDIS_MESSAGE_RAW_PTR_TO_MESSAGE_PTR(rndis_msg) \
1140         ((void *) rndis_msg)
1141
1142
1143 #define __struct_bcount(x)
1144
1145
1146
1147 #define RNDIS_HEADER_SIZE       (sizeof(struct rndis_message) - \
1148                                  sizeof(union rndis_message_container))
1149
1150 #define NDIS_PACKET_TYPE_DIRECTED       0x00000001
1151 #define NDIS_PACKET_TYPE_MULTICAST      0x00000002
1152 #define NDIS_PACKET_TYPE_ALL_MULTICAST  0x00000004
1153 #define NDIS_PACKET_TYPE_BROADCAST      0x00000008
1154 #define NDIS_PACKET_TYPE_SOURCE_ROUTING 0x00000010
1155 #define NDIS_PACKET_TYPE_PROMISCUOUS    0x00000020
1156 #define NDIS_PACKET_TYPE_SMT            0x00000040
1157 #define NDIS_PACKET_TYPE_ALL_LOCAL      0x00000080
1158 #define NDIS_PACKET_TYPE_GROUP          0x00000100
1159 #define NDIS_PACKET_TYPE_ALL_FUNCTIONAL 0x00000200
1160 #define NDIS_PACKET_TYPE_FUNCTIONAL     0x00000400
1161 #define NDIS_PACKET_TYPE_MAC_FRAME      0x00000800
1162
1163
1164
1165 #endif /* _HYPERV_NET_H */