]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - sys/dev/hyperv/netvsc/hv_net_vsc.h
MFC 296379,296380,296381,296593,296594,296595
[FreeBSD/stable/10.git] / sys / dev / hyperv / netvsc / hv_net_vsc.h
1 /*-
2  * Copyright (c) 2009-2012 Microsoft Corp.
3  * Copyright (c) 2010-2012 Citrix Inc.
4  * Copyright (c) 2012 NetApp Inc.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice unmodified, this list of conditions, and the following
12  *    disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  *
28  * $FreeBSD$
29  */
30
31 /*
32  * HyperV vmbus (virtual machine bus) network VSC (virtual services client)
33  * header file
34  *
35  * (Updated from unencumbered NvspProtocol.h)
36  */
37
38 #ifndef __HV_NET_VSC_H__
39 #define __HV_NET_VSC_H__
40
41 #include <sys/param.h>
42 #include <sys/kernel.h>
43 #include <sys/lock.h>
44 #include <sys/malloc.h>
45 #include <sys/queue.h>
46 #include <sys/taskqueue.h>
47 #include <sys/sx.h>
48
49 #include <machine/bus.h>
50 #include <sys/bus.h>
51 #include <sys/bus_dma.h>
52
53 #include <netinet/in.h>
54 #include <netinet/tcp_lro.h>
55
56 #include <net/if.h>
57 #include <net/if_media.h>
58
59 #include <dev/hyperv/include/hyperv.h>
60
61 #define HN_USE_TXDESC_BUFRING
62
63 MALLOC_DECLARE(M_NETVSC);
64
65 #define NVSP_INVALID_PROTOCOL_VERSION           (0xFFFFFFFF)
66
67 #define NVSP_PROTOCOL_VERSION_1                 2
68 #define NVSP_PROTOCOL_VERSION_2                 0x30002
69 #define NVSP_PROTOCOL_VERSION_4                 0x40000
70 #define NVSP_PROTOCOL_VERSION_5                 0x50000
71 #define NVSP_MIN_PROTOCOL_VERSION               (NVSP_PROTOCOL_VERSION_1)
72 #define NVSP_MAX_PROTOCOL_VERSION               (NVSP_PROTOCOL_VERSION_2)
73
74 #define NVSP_PROTOCOL_VERSION_CURRENT           NVSP_PROTOCOL_VERSION_2
75
76 #define VERSION_4_OFFLOAD_SIZE                  22
77
78 #define NVSP_OPERATIONAL_STATUS_OK              (0x00000000)
79 #define NVSP_OPERATIONAL_STATUS_DEGRADED        (0x00000001)
80 #define NVSP_OPERATIONAL_STATUS_NONRECOVERABLE  (0x00000002)
81 #define NVSP_OPERATIONAL_STATUS_NO_CONTACT      (0x00000003)
82 #define NVSP_OPERATIONAL_STATUS_LOST_COMMUNICATION (0x00000004)
83
84 /*
85  * Maximun number of transfer pages (packets) the VSP will use on a receive
86  */
87 #define NVSP_MAX_PACKETS_PER_RECEIVE            375
88
89 /* vRSS stuff */
90 #define RNDIS_OBJECT_TYPE_RSS_CAPABILITIES      0x88
91 #define RNDIS_OBJECT_TYPE_RSS_PARAMETERS        0x89
92
93 #define RNDIS_RECEIVE_SCALE_CAPABILITIES_REVISION_2     2
94 #define RNDIS_RECEIVE_SCALE_PARAMETERS_REVISION_2       2
95
96 struct rndis_obj_header {
97         uint8_t type;
98         uint8_t rev;
99         uint16_t size;
100 } __packed;
101
102 /* rndis_recv_scale_cap/cap_flag */
103 #define RNDIS_RSS_CAPS_MESSAGE_SIGNALED_INTERRUPTS      0x01000000
104 #define RNDIS_RSS_CAPS_CLASSIFICATION_AT_ISR            0x02000000
105 #define RNDIS_RSS_CAPS_CLASSIFICATION_AT_DPC            0x04000000
106 #define RNDIS_RSS_CAPS_USING_MSI_X                      0x08000000
107 #define RNDIS_RSS_CAPS_RSS_AVAILABLE_ON_PORTS           0x10000000
108 #define RNDIS_RSS_CAPS_SUPPORTS_MSI_X                   0x20000000
109 #define RNDIS_RSS_CAPS_HASH_TYPE_TCP_IPV4               0x00000100
110 #define RNDIS_RSS_CAPS_HASH_TYPE_TCP_IPV6               0x00000200
111 #define RNDIS_RSS_CAPS_HASH_TYPE_TCP_IPV6_EX            0x00000400
112
113 /* RNDIS_RECEIVE_SCALE_CAPABILITIES */
114 struct rndis_recv_scale_cap {
115         struct rndis_obj_header hdr;
116         uint32_t cap_flag;
117         uint32_t num_int_msg;
118         uint32_t num_recv_que;
119         uint16_t num_indirect_tabent;
120 } __packed;
121
122 /* rndis_recv_scale_param flags */
123 #define RNDIS_RSS_PARAM_FLAG_BASE_CPU_UNCHANGED         0x0001
124 #define RNDIS_RSS_PARAM_FLAG_HASH_INFO_UNCHANGED        0x0002
125 #define RNDIS_RSS_PARAM_FLAG_ITABLE_UNCHANGED           0x0004
126 #define RNDIS_RSS_PARAM_FLAG_HASH_KEY_UNCHANGED         0x0008
127 #define RNDIS_RSS_PARAM_FLAG_DISABLE_RSS                0x0010
128
129 /* Hash info bits */
130 #define RNDIS_HASH_FUNC_TOEPLITZ                0x00000001
131 #define RNDIS_HASH_IPV4                         0x00000100
132 #define RNDIS_HASH_TCP_IPV4                     0x00000200
133 #define RNDIS_HASH_IPV6                         0x00000400
134 #define RNDIS_HASH_IPV6_EX                      0x00000800
135 #define RNDIS_HASH_TCP_IPV6                     0x00001000
136 #define RNDIS_HASH_TCP_IPV6_EX                  0x00002000
137
138 #define RNDIS_RSS_INDIRECTION_TABLE_MAX_SIZE_REVISION_2 (128 * 4)
139 #define RNDIS_RSS_HASH_SECRET_KEY_MAX_SIZE_REVISION_2   40
140
141 #define ITAB_NUM                                        128
142 #define HASH_KEYLEN RNDIS_RSS_HASH_SECRET_KEY_MAX_SIZE_REVISION_2
143
144 /* RNDIS_RECEIVE_SCALE_PARAMETERS */
145 typedef struct rndis_recv_scale_param_ {
146         struct rndis_obj_header hdr;
147
148         /* Qualifies the rest of the information */
149         uint16_t flag;
150
151         /* The base CPU number to do receive processing. not used */
152         uint16_t base_cpu_number;
153
154         /* This describes the hash function and type being enabled */
155         uint32_t hashinfo;
156
157         /* The size of indirection table array */
158         uint16_t indirect_tabsize;
159
160         /* The offset of the indirection table from the beginning of this
161          * structure
162          */
163         uint32_t indirect_taboffset;
164
165         /* The size of the hash secret key */
166         uint16_t hashkey_size;
167
168         /* The offset of the secret key from the beginning of this structure */
169         uint32_t hashkey_offset;
170
171         uint32_t processor_masks_offset;
172         uint32_t num_processor_masks;
173         uint32_t processor_masks_entry_size;
174 } rndis_recv_scale_param;
175
176 typedef enum nvsp_msg_type_ {
177         nvsp_msg_type_none                      = 0,
178
179         /*
180          * Init Messages
181          */
182         nvsp_msg_type_init                      = 1,
183         nvsp_msg_type_init_complete             = 2,
184
185         nvsp_version_msg_start                  = 100,
186
187         /*
188          * Version 1 Messages
189          */
190         nvsp_msg_1_type_send_ndis_vers          = nvsp_version_msg_start,
191
192         nvsp_msg_1_type_send_rx_buf,
193         nvsp_msg_1_type_send_rx_buf_complete,
194         nvsp_msg_1_type_revoke_rx_buf,
195
196         nvsp_msg_1_type_send_send_buf,
197         nvsp_msg_1_type_send_send_buf_complete,
198         nvsp_msg_1_type_revoke_send_buf,
199
200         nvsp_msg_1_type_send_rndis_pkt,
201         nvsp_msg_1_type_send_rndis_pkt_complete,
202     
203         /*
204          * Version 2 Messages
205          */
206         nvsp_msg_2_type_send_chimney_delegated_buf,
207         nvsp_msg_2_type_send_chimney_delegated_buf_complete,
208         nvsp_msg_2_type_revoke_chimney_delegated_buf,
209
210         nvsp_msg_2_type_resume_chimney_rx_indication,
211
212         nvsp_msg_2_type_terminate_chimney,
213         nvsp_msg_2_type_terminate_chimney_complete,
214
215         nvsp_msg_2_type_indicate_chimney_event,
216
217         nvsp_msg_2_type_send_chimney_packet,
218         nvsp_msg_2_type_send_chimney_packet_complete,
219
220         nvsp_msg_2_type_post_chimney_rx_request,
221         nvsp_msg_2_type_post_chimney_rx_request_complete,
222
223         nvsp_msg_2_type_alloc_rx_buf,
224         nvsp_msg_2_type_alloc_rx_buf_complete,
225
226         nvsp_msg_2_type_free_rx_buf,
227
228         nvsp_msg_2_send_vmq_rndis_pkt,
229         nvsp_msg_2_send_vmq_rndis_pkt_complete,
230
231         nvsp_msg_2_type_send_ndis_config,
232
233         nvsp_msg_2_type_alloc_chimney_handle,
234         nvsp_msg_2_type_alloc_chimney_handle_complete,
235
236         nvsp_msg2_max = nvsp_msg_2_type_alloc_chimney_handle_complete,
237
238         /*
239          * Version 4 Messages
240          */
241         nvsp_msg4_type_send_vf_association,
242         nvsp_msg4_type_switch_data_path,
243         nvsp_msg4_type_uplink_connect_state_deprecated,
244
245         nvsp_msg4_max = nvsp_msg4_type_uplink_connect_state_deprecated,
246
247         /*
248          * Version 5 Messages
249          */
250         nvsp_msg5_type_oid_query_ex,
251         nvsp_msg5_type_oid_query_ex_comp,
252         nvsp_msg5_type_subchannel,
253         nvsp_msg5_type_send_indirection_table,
254
255         nvsp_msg5_max = nvsp_msg5_type_send_indirection_table,
256 } nvsp_msg_type;
257
258 typedef enum nvsp_status_ {
259         nvsp_status_none = 0,
260         nvsp_status_success,
261         nvsp_status_failure,
262         /* Deprecated */
263         nvsp_status_prot_vers_range_too_new,
264         /* Deprecated */
265         nvsp_status_prot_vers_range_too_old,
266         nvsp_status_invalid_rndis_pkt,
267         nvsp_status_busy,
268         nvsp_status_max,
269 } nvsp_status;
270
271 typedef struct nvsp_msg_hdr_ {
272         uint32_t                                msg_type;
273 } __packed nvsp_msg_hdr;
274
275 /*
276  * Init Messages
277  */
278
279 /*
280  * This message is used by the VSC to initialize the channel
281  * after the channels has been opened. This message should 
282  * never include anything other then versioning (i.e. this
283  * message will be the same for ever).
284  *
285  * Forever is a long time.  The values have been redefined
286  * in Win7 to indicate major and minor protocol version
287  * number.
288  */
289 typedef struct nvsp_msg_init_ {
290         union {
291                 struct {
292                         uint16_t                minor_protocol_version;
293                         uint16_t                major_protocol_version;
294                 } s;
295                 /* Formerly min_protocol_version */
296                 uint32_t                        protocol_version;
297         } p1;
298         /* Formerly max_protocol_version */
299         uint32_t                                protocol_version_2;
300 } __packed nvsp_msg_init;
301
302 /*
303  * This message is used by the VSP to complete the initialization
304  * of the channel. This message should never include anything other 
305  * then versioning (i.e. this message will be the same forever).
306  */
307 typedef struct nvsp_msg_init_complete_ {
308         /* Deprecated */
309         uint32_t                                negotiated_prot_vers;
310         uint32_t                                max_mdl_chain_len;
311         uint32_t                                status;
312 } __packed nvsp_msg_init_complete;
313
314 typedef union nvsp_msg_init_uber_ {
315         nvsp_msg_init                           init;
316         nvsp_msg_init_complete                  init_compl;
317 } __packed nvsp_msg_init_uber;
318
319 /*
320  * Version 1 Messages
321  */
322
323 /*
324  * This message is used by the VSC to send the NDIS version
325  * to the VSP.  The VSP can use this information when handling
326  * OIDs sent by the VSC.
327  */
328 typedef struct nvsp_1_msg_send_ndis_version_ {
329         uint32_t                                ndis_major_vers;
330         /* Deprecated */
331         uint32_t                                ndis_minor_vers;
332 } __packed nvsp_1_msg_send_ndis_version;
333
334 /*
335  * This message is used by the VSC to send a receive buffer
336  * to the VSP. The VSP can then use the receive buffer to
337  * send data to the VSC.
338  */
339 typedef struct nvsp_1_msg_send_rx_buf_ {
340         uint32_t                                gpadl_handle;
341         uint16_t                                id;
342 } __packed nvsp_1_msg_send_rx_buf;
343
344 typedef struct nvsp_1_rx_buf_section_ {
345         uint32_t                                offset;
346         uint32_t                                sub_allocation_size;
347         uint32_t                                num_sub_allocations;
348         uint32_t                                end_offset;
349 } __packed nvsp_1_rx_buf_section;
350
351 /*
352  * This message is used by the VSP to acknowledge a receive 
353  * buffer send by the VSC.  This message must be sent by the 
354  * VSP before the VSP uses the receive buffer.
355  */
356 typedef struct nvsp_1_msg_send_rx_buf_complete_ {
357         uint32_t                                status;
358         uint32_t                                num_sections;
359
360         /*
361          * The receive buffer is split into two parts, a large
362          * suballocation section and a small suballocation
363          * section. These sections are then suballocated by a 
364          * certain size.
365          *
366          * For example, the following break up of the receive
367          * buffer has 6 large suballocations and 10 small
368          * suballocations.
369          *
370          * |            Large Section          |  |   Small Section   |
371          * ------------------------------------------------------------
372          * |     |     |     |     |     |     |  | | | | | | | | | | |
373          * |                                      |  
374          * LargeOffset                            SmallOffset
375          */
376         nvsp_1_rx_buf_section                   sections[1];
377
378 } __packed nvsp_1_msg_send_rx_buf_complete;
379
380 /*
381  * This message is sent by the VSC to revoke the receive buffer.
382  * After the VSP completes this transaction, the VSP should never
383  * use the receive buffer again.
384  */
385 typedef struct nvsp_1_msg_revoke_rx_buf_ {
386         uint16_t                                id;
387 } __packed nvsp_1_msg_revoke_rx_buf;
388
389 /*
390  * This message is used by the VSC to send a send buffer
391  * to the VSP. The VSC can then use the send buffer to
392  * send data to the VSP.
393  */
394 typedef struct nvsp_1_msg_send_send_buf_ {
395         uint32_t                                gpadl_handle;
396         uint16_t                                id;
397 } __packed nvsp_1_msg_send_send_buf;
398
399 /*
400  * This message is used by the VSP to acknowledge a send 
401  * buffer sent by the VSC. This message must be sent by the 
402  * VSP before the VSP uses the sent buffer.
403  */
404 typedef struct nvsp_1_msg_send_send_buf_complete_ {
405         uint32_t                                status;
406
407         /*
408          * The VSC gets to choose the size of the send buffer and
409          * the VSP gets to choose the sections size of the buffer.
410          * This was done to enable dynamic reconfigurations when
411          * the cost of GPA-direct buffers decreases.
412          */
413         uint32_t                                section_size;
414 } __packed nvsp_1_msg_send_send_buf_complete;
415
416 /*
417  * This message is sent by the VSC to revoke the send buffer.
418  * After the VSP completes this transaction, the vsp should never
419  * use the send buffer again.
420  */
421 typedef struct nvsp_1_msg_revoke_send_buf_ {
422         uint16_t                                id;
423 } __packed nvsp_1_msg_revoke_send_buf;
424
425 /*
426  * This message is used by both the VSP and the VSC to send
427  * an RNDIS message to the opposite channel endpoint.
428  */
429 typedef struct nvsp_1_msg_send_rndis_pkt_ {
430         /*
431          * This field is specified by RNIDS.  They assume there's
432          * two different channels of communication. However, 
433          * the Network VSP only has one.  Therefore, the channel
434          * travels with the RNDIS packet.
435          */
436         uint32_t                                chan_type;
437
438         /*
439          * This field is used to send part or all of the data
440          * through a send buffer. This values specifies an 
441          * index into the send buffer.  If the index is 
442          * 0xFFFFFFFF, then the send buffer is not being used
443          * and all of the data was sent through other VMBus
444          * mechanisms.
445          */
446         uint32_t                                send_buf_section_idx;
447         uint32_t                                send_buf_section_size;
448 } __packed nvsp_1_msg_send_rndis_pkt;
449
450 /*
451  * This message is used by both the VSP and the VSC to complete
452  * a RNDIS message to the opposite channel endpoint.  At this
453  * point, the initiator of this message cannot use any resources
454  * associated with the original RNDIS packet.
455  */
456 typedef struct nvsp_1_msg_send_rndis_pkt_complete_ {
457         uint32_t                                status;
458 } __packed nvsp_1_msg_send_rndis_pkt_complete;
459
460
461 /*
462  * Version 2 Messages
463  */
464
465 /*
466  * This message is used by the VSC to send the NDIS version
467  * to the VSP.  The VSP can use this information when handling
468  * OIDs sent by the VSC.
469  */
470 typedef struct nvsp_2_netvsc_capabilities_ {
471         union {
472                 uint64_t                        as_uint64;
473                 struct {
474                         uint64_t                vmq           : 1;
475                         uint64_t                chimney       : 1;
476                         uint64_t                sriov         : 1;
477                         uint64_t                ieee8021q     : 1;
478                         uint64_t                correlationid : 1;
479                         uint64_t                teaming       : 1;
480                 } u2;
481         } u1;
482 } __packed nvsp_2_netvsc_capabilities;
483
484 typedef struct nvsp_2_msg_send_ndis_config_ {
485         uint32_t                                mtu;
486         uint32_t                                reserved;
487         nvsp_2_netvsc_capabilities              capabilities;
488 } __packed nvsp_2_msg_send_ndis_config;
489
490 /*
491  * NvspMessage2TypeSendChimneyDelegatedBuffer
492  */
493 typedef struct nvsp_2_msg_send_chimney_buf_
494 {
495         /*
496          * On WIN7 beta, delegated_obj_max_size is defined as a uint32_t
497          * Since WIN7 RC, it was split into two uint16_t.  To have the same
498          * struct layout, delegated_obj_max_size shall be the first field.
499          */
500         uint16_t                                delegated_obj_max_size;
501
502         /*
503          * The revision # of chimney protocol used between NVSC and NVSP.
504          *
505          * This revision is NOT related to the chimney revision between
506          * NDIS protocol and miniport drivers.
507          */
508         uint16_t                                revision;
509
510         uint32_t                                gpadl_handle;
511 } __packed nvsp_2_msg_send_chimney_buf;
512
513
514 /* Unsupported chimney revision 0 (only present in WIN7 beta) */
515 #define NVSP_CHIMNEY_REVISION_0                 0
516
517 /* WIN7 Beta Chimney QFE */
518 #define NVSP_CHIMNEY_REVISION_1                 1
519
520 /* The chimney revision since WIN7 RC */
521 #define NVSP_CHIMNEY_REVISION_2                 2
522
523
524 /*
525  * NvspMessage2TypeSendChimneyDelegatedBufferComplete
526  */
527 typedef struct nvsp_2_msg_send_chimney_buf_complete_ {
528         uint32_t                                status;
529
530         /*
531          * Maximum number outstanding sends and pre-posted receives.
532          *
533          * NVSC should not post more than SendQuota/ReceiveQuota packets.
534          * Otherwise, it can block the non-chimney path for an indefinite
535          * amount of time.
536          * (since chimney sends/receives are affected by the remote peer).
537          *
538          * Note: NVSP enforces the quota restrictions on a per-VMBCHANNEL
539          * basis.  It doesn't enforce the restriction separately for chimney
540          * send/receive.  If NVSC doesn't voluntarily enforce "SendQuota",
541          * it may kill its own network connectivity.
542          */
543         uint32_t                                send_quota;
544         uint32_t                                rx_quota;
545 } __packed nvsp_2_msg_send_chimney_buf_complete;
546
547 /*
548  * NvspMessage2TypeRevokeChimneyDelegatedBuffer
549  */
550 typedef struct nvsp_2_msg_revoke_chimney_buf_ {
551         uint32_t                                gpadl_handle;
552 } __packed nvsp_2_msg_revoke_chimney_buf;
553
554
555 #define NVSP_CHIMNEY_OBJECT_TYPE_NEIGHBOR       0
556 #define NVSP_CHIMNEY_OBJECT_TYPE_PATH4          1
557 #define NVSP_CHIMNEY_OBJECT_TYPE_PATH6          2
558 #define NVSP_CHIMNEY_OBJECT_TYPE_TCP            3
559
560 /*
561  * NvspMessage2TypeAllocateChimneyHandle
562  */
563 typedef struct nvsp_2_msg_alloc_chimney_handle_ {
564         uint64_t                                vsc_context;
565         uint32_t                                object_type;
566 } __packed nvsp_2_msg_alloc_chimney_handle;
567
568 /*
569  * NvspMessage2TypeAllocateChimneyHandleComplete
570  */
571 typedef struct nvsp_2_msg_alloc_chimney_handle_complete_ {
572         uint32_t                                vsp_handle;
573 } __packed nvsp_2_msg_alloc_chimney_handle_complete;
574
575
576 /*
577  * NvspMessage2TypeResumeChimneyRXIndication
578  */
579 typedef struct nvsp_2_msg_resume_chimney_rx_indication {
580         /*
581          * Handle identifying the offloaded connection
582          */
583         uint32_t                                vsp_tcp_handle;
584 } __packed nvsp_2_msg_resume_chimney_rx_indication;
585
586
587 #define NVSP_2_MSG_TERMINATE_CHIMNEY_FLAGS_FIRST_STAGE      (0x01u)
588 #define NVSP_2_MSG_TERMINATE_CHIMNEY_FLAGS_RESERVED         (~(0x01u))
589
590 /*
591  * NvspMessage2TypeTerminateChimney
592  */
593 typedef struct nvsp_2_msg_terminate_chimney_ {
594         /*
595         * Handle identifying the offloaded object
596         */
597         uint32_t                                vsp_handle;
598
599         /*
600          * Terminate Offload Flags
601          *     Bit 0:
602          *         When set to 0, terminate the offload at the destination NIC
603          *     Bit 1-31:  Reserved, shall be zero
604          */
605         uint32_t                                flags;
606
607         union {
608                 /*
609                  * This field is valid only when bit 0 of flags is clear.
610                  * It specifies the index into the premapped delegated
611                  * object buffer.  The buffer was sent through the
612                  * NvspMessage2TypeSendChimneyDelegatedBuffer
613                  * message at initialization time.
614                  *
615                  * NVSP will write the delegated state into the delegated
616                  * buffer upon upload completion.
617                  */
618                 uint32_t                        index;
619
620                 /*
621                  * This field is valid only when bit 0 of flags is set.
622                  *
623                  * The seqence number of the most recently accepted RX
624                  * indication when VSC sets its TCP context into
625                  * "terminating" state.
626                  *
627                  * This allows NVSP to determines if there are any in-flight
628                  * RX indications for which the acceptance state is still
629                  * undefined.
630                  */
631                 uint64_t                        last_accepted_rx_seq_no;
632         } f0;
633 } __packed nvsp_2_msg_terminate_chimney;
634
635
636 #define NVSP_TERMINATE_CHIMNEY_COMPLETE_FLAG_DATA_CORRUPTED     0x0000001u
637
638 /*
639  * NvspMessage2TypeTerminateChimneyComplete
640  */
641 typedef struct nvsp_2_msg_terminate_chimney_complete_ {
642         uint64_t                                vsc_context;
643         uint32_t                                flags;
644 } __packed nvsp_2_msg_terminate_chimney_complete;
645
646 /*
647  * NvspMessage2TypeIndicateChimneyEvent
648  */
649 typedef struct nvsp_2_msg_indicate_chimney_event_ {
650         /*
651          * When VscTcpContext is 0, event_type is an NDIS_STATUS event code
652          * Otherwise, EventType is an TCP connection event (defined in
653          * NdisTcpOffloadEventHandler chimney DDK document).
654          */
655         uint32_t                                event_type;
656
657         /*
658          * When VscTcpContext is 0, EventType is an NDIS_STATUS event code
659          * Otherwise, EventType is an TCP connection event specific information
660          * (defined in NdisTcpOffloadEventHandler chimney DDK document).
661          */
662         uint32_t                                event_specific_info;
663
664         /*
665          * If not 0, the event is per-TCP connection event.  This field
666          * contains the VSC's TCP context.
667          * If 0, the event indication is global.
668          */
669         uint64_t                                vsc_tcp_context;
670 } __packed nvsp_2_msg_indicate_chimney_event;
671
672
673 #define NVSP_1_CHIMNEY_SEND_INVALID_OOB_INDEX       0xffffu
674 #define NVSP_1_CHIMNEY_SEND_INVALID_SECTION_INDEX   0xffffffff
675
676 /*
677  * NvspMessage2TypeSendChimneyPacket
678  */
679 typedef struct nvsp_2_msg_send_chimney_pkt_ {
680     /*
681      * Identify the TCP connection for which this chimney send is
682      */
683     uint32_t                                    vsp_tcp_handle;
684
685     /*
686      * This field is used to send part or all of the data
687      * through a send buffer. This values specifies an
688      * index into the send buffer. If the index is
689      * 0xFFFF, then the send buffer is not being used
690      * and all of the data was sent through other VMBus
691      * mechanisms.
692      */
693     uint16_t                                    send_buf_section_index;
694     uint16_t                                    send_buf_section_size;
695
696     /*
697      * OOB Data Index
698      * This an index to the OOB data buffer. If the index is 0xFFFFFFFF,
699      * then there is no OOB data.
700      *
701      * This field shall be always 0xFFFFFFFF for now. It is reserved for
702      * the future.
703      */
704     uint16_t                                    oob_data_index;
705
706     /*
707      * DisconnectFlags = 0
708      *      Normal chimney send. See MiniportTcpOffloadSend for details.
709      *
710      * DisconnectFlags = TCP_DISCONNECT_GRACEFUL_CLOSE (0x01)
711      *      Graceful disconnect. See MiniportTcpOffloadDisconnect for details.
712      *
713      * DisconnectFlags = TCP_DISCONNECT_ABORTIVE_CLOSE (0x02)
714      *      Abortive disconnect. See MiniportTcpOffloadDisconnect for details.
715      */
716     uint16_t                                    disconnect_flags;
717
718     uint32_t                                    seq_no;
719 } __packed nvsp_2_msg_send_chimney_pkt;
720
721 /*
722  * NvspMessage2TypeSendChimneyPacketComplete
723  */
724 typedef struct nvsp_2_msg_send_chimney_pkt_complete_ {
725     /*
726      * The NDIS_STATUS for the chimney send
727      */
728     uint32_t                                    status;
729
730     /*
731      * Number of bytes that have been sent to the peer (and ACKed by the peer).
732      */
733     uint32_t                                    bytes_transferred;
734 } __packed nvsp_2_msg_send_chimney_pkt_complete;
735
736
737 #define NVSP_1_CHIMNEY_RECV_FLAG_NO_PUSH        0x0001u
738 #define NVSP_1_CHIMNEY_RECV_INVALID_OOB_INDEX   0xffffu
739
740 /*
741  * NvspMessage2TypePostChimneyRecvRequest
742  */
743 typedef struct nvsp_2_msg_post_chimney_rx_request_ {
744         /*
745          * Identify the TCP connection which this chimney receive request
746          * is for.
747          */
748         uint32_t                                vsp_tcp_handle;
749
750         /*
751          * OOB Data Index
752          * This an index to the OOB data buffer. If the index is 0xFFFFFFFF,
753          * then there is no OOB data.
754          *
755          * This field shall be always 0xFFFFFFFF for now. It is reserved for
756          * the future.
757          */
758         uint32_t                                oob_data_index;
759
760         /*
761          * Bit 0
762          *      When it is set, this is a "no-push" receive.
763          *      When it is clear, this is a "push" receive.
764          *
765          * Bit 1-15:  Reserved and shall be zero
766          */
767         uint16_t                                flags;
768
769         /*
770          * For debugging and diagnoses purpose.
771          * The SeqNo is per TCP connection and starts from 0.
772          */
773         uint32_t                                seq_no;
774 } __packed nvsp_2_msg_post_chimney_rx_request;
775
776 /*
777  * NvspMessage2TypePostChimneyRecvRequestComplete
778  */
779 typedef struct nvsp_2_msg_post_chimney_rx_request_complete_ {
780         /*
781          * The NDIS_STATUS for the chimney send
782          */
783         uint32_t                                status;
784
785         /*
786          * Number of bytes that have been sent to the peer (and ACKed by
787          * the peer).
788          */
789         uint32_t                                bytes_xferred;
790 } __packed nvsp_2_msg_post_chimney_rx_request_complete;
791
792 /*
793  * NvspMessage2TypeAllocateReceiveBuffer
794  */
795 typedef struct nvsp_2_msg_alloc_rx_buf_ {
796         /*
797          * Allocation ID to match the allocation request and response
798          */
799         uint32_t                                allocation_id;
800
801         /*
802          * Length of the VM shared memory receive buffer that needs to
803          * be allocated
804          */
805         uint32_t                                length;
806 } __packed nvsp_2_msg_alloc_rx_buf;
807
808 /*
809  * NvspMessage2TypeAllocateReceiveBufferComplete
810  */
811 typedef struct nvsp_2_msg_alloc_rx_buf_complete_ {
812         /*
813          * The NDIS_STATUS code for buffer allocation
814          */
815         uint32_t                                status;
816
817         /*
818          * Allocation ID from NVSP_2_MESSAGE_ALLOCATE_RECEIVE_BUFFER
819          */
820         uint32_t                                allocation_id;
821
822         /*
823          * GPADL handle for the allocated receive buffer
824          */
825         uint32_t                                gpadl_handle;
826
827         /*
828          * Receive buffer ID that is further used in
829          * NvspMessage2SendVmqRndisPacket
830          */
831         uint64_t                                rx_buf_id;
832 } __packed nvsp_2_msg_alloc_rx_buf_complete;
833
834 /*
835  * NvspMessage2TypeFreeReceiveBuffer
836  */
837 typedef struct nvsp_2_msg_free_rx_buf_ {
838         /*
839          * Receive buffer ID previous returned in
840          * NvspMessage2TypeAllocateReceiveBufferComplete message
841          */
842         uint64_t                                rx_buf_id;
843 } __packed nvsp_2_msg_free_rx_buf;
844
845 /*
846  * This structure is used in defining the buffers in
847  * NVSP_2_MESSAGE_SEND_VMQ_RNDIS_PACKET structure
848  */
849 typedef struct nvsp_xfer_page_range_ {
850         /*
851          * Specifies the ID of the receive buffer that has the buffer. This
852          * ID can be the general receive buffer ID specified in
853          * NvspMessage1TypeSendReceiveBuffer or it can be the shared memory
854          * receive buffer ID allocated by the VSC and specified in
855          * NvspMessage2TypeAllocateReceiveBufferComplete message
856          */
857         uint64_t                                xfer_page_set_id;
858
859         /*
860          * Number of bytes
861          */
862         uint32_t                                byte_count;
863
864         /*
865          * Offset in bytes from the beginning of the buffer
866          */
867         uint32_t                                byte_offset;
868 } __packed nvsp_xfer_page_range;
869
870 /*
871  * NvspMessage2SendVmqRndisPacket
872  */
873 typedef struct nvsp_2_msg_send_vmq_rndis_pkt_ {
874         /*
875          * This field is specified by RNIDS. They assume there's
876          * two different channels of communication. However,
877          * the Network VSP only has one. Therefore, the channel
878          * travels with the RNDIS packet. It must be RMC_DATA
879          */
880         uint32_t                                channel_type;
881
882         /*
883          * Only the Range element corresponding to the RNDIS header of
884          * the first RNDIS message in the multiple RNDIS messages sent
885          * in one NVSP message.  Information about the data portions as well
886          * as the subsequent RNDIS messages in the same NVSP message are
887          * embedded in the RNDIS header itself
888          */
889         nvsp_xfer_page_range                    range;
890 } __packed nvsp_2_msg_send_vmq_rndis_pkt;
891
892 /*
893  * This message is used by the VSC to complete
894  * a RNDIS VMQ message to the VSP.  At this point,
895  * the initiator of this message can use any resources
896  * associated with the original RNDIS VMQ packet.
897  */
898 typedef struct nvsp_2_msg_send_vmq_rndis_pkt_complete_
899 {
900         uint32_t                                status;
901 } __packed nvsp_2_msg_send_vmq_rndis_pkt_complete;
902
903 /*
904  * Version 5 messages
905  */
906 enum nvsp_subchannel_operation {
907         NVSP_SUBCHANNEL_NONE = 0,
908         NVSP_SUBCHANNE_ALLOCATE,
909         NVSP_SUBCHANNE_MAX
910 };
911
912 typedef struct nvsp_5_subchannel_request_
913 {
914         uint32_t                                op;
915         uint32_t                                num_subchannels;
916 } __packed nvsp_5_subchannel_request;
917
918 typedef struct nvsp_5_subchannel_complete_
919 {
920         uint32_t                                status;
921         /* Actual number of subchannels allocated */
922         uint32_t                                num_subchannels;
923 } __packed nvsp_5_subchannel_complete;
924
925 typedef struct nvsp_5_send_indirect_table_
926 {
927         /* The number of entries in the send indirection table */
928         uint32_t                                count;
929         /*
930          * The offset of the send indireciton table from top of
931          * this struct. The send indirection table tells which channel
932          * to put the send traffic on. Each entry is a channel number.
933          */
934         uint32_t                                offset;
935 } __packed nvsp_5_send_indirect_table;
936
937 typedef union nvsp_1_msg_uber_ {
938         nvsp_1_msg_send_ndis_version            send_ndis_vers;
939
940         nvsp_1_msg_send_rx_buf                  send_rx_buf;
941         nvsp_1_msg_send_rx_buf_complete         send_rx_buf_complete;
942         nvsp_1_msg_revoke_rx_buf                revoke_rx_buf;
943
944         nvsp_1_msg_send_send_buf                send_send_buf;
945         nvsp_1_msg_send_send_buf_complete       send_send_buf_complete;
946         nvsp_1_msg_revoke_send_buf              revoke_send_buf;
947
948         nvsp_1_msg_send_rndis_pkt               send_rndis_pkt;
949         nvsp_1_msg_send_rndis_pkt_complete      send_rndis_pkt_complete;
950 } __packed nvsp_1_msg_uber;
951
952
953 typedef union nvsp_2_msg_uber_ {
954         nvsp_2_msg_send_ndis_config             send_ndis_config;
955
956         nvsp_2_msg_send_chimney_buf             send_chimney_buf;
957         nvsp_2_msg_send_chimney_buf_complete    send_chimney_buf_complete;
958         nvsp_2_msg_revoke_chimney_buf           revoke_chimney_buf;
959
960         nvsp_2_msg_resume_chimney_rx_indication resume_chimney_rx_indication;
961         nvsp_2_msg_terminate_chimney            terminate_chimney;
962         nvsp_2_msg_terminate_chimney_complete   terminate_chimney_complete;
963         nvsp_2_msg_indicate_chimney_event       indicate_chimney_event;
964
965         nvsp_2_msg_send_chimney_pkt             send_chimney_packet;
966         nvsp_2_msg_send_chimney_pkt_complete    send_chimney_packet_complete;
967         nvsp_2_msg_post_chimney_rx_request      post_chimney_rx_request;
968         nvsp_2_msg_post_chimney_rx_request_complete
969                                                post_chimney_rx_request_complete;
970
971         nvsp_2_msg_alloc_rx_buf                 alloc_rx_buffer;
972         nvsp_2_msg_alloc_rx_buf_complete        alloc_rx_buffer_complete;
973         nvsp_2_msg_free_rx_buf                  free_rx_buffer;
974
975         nvsp_2_msg_send_vmq_rndis_pkt           send_vmq_rndis_pkt;
976         nvsp_2_msg_send_vmq_rndis_pkt_complete  send_vmq_rndis_pkt_complete;
977         nvsp_2_msg_alloc_chimney_handle         alloc_chimney_handle;
978         nvsp_2_msg_alloc_chimney_handle_complete alloc_chimney_handle_complete;
979 } __packed nvsp_2_msg_uber;
980
981 typedef union nvsp_5_msg_uber_
982 {
983         nvsp_5_subchannel_request               subchannel_request;
984         nvsp_5_subchannel_complete              subchn_complete;
985         nvsp_5_send_indirect_table              send_table;
986 } __packed nvsp_5_msg_uber;
987
988 typedef union nvsp_all_msgs_ {
989         nvsp_msg_init_uber                      init_msgs;
990         nvsp_1_msg_uber                         vers_1_msgs;
991         nvsp_2_msg_uber                         vers_2_msgs;
992         nvsp_5_msg_uber                         vers_5_msgs;
993 } __packed nvsp_all_msgs;
994
995 /*
996  * ALL Messages
997  */
998 typedef struct nvsp_msg_ {
999         nvsp_msg_hdr                            hdr; 
1000         nvsp_all_msgs                           msgs;
1001 } __packed nvsp_msg;
1002
1003
1004 /*
1005  * The following arguably belongs in a separate header file
1006  */
1007
1008 /*
1009  * Defines
1010  */
1011
1012 #define NETVSC_SEND_BUFFER_SIZE                 (1024*1024*15)   /* 15M */
1013 #define NETVSC_SEND_BUFFER_ID                   0xface
1014
1015 #define NETVSC_RECEIVE_BUFFER_SIZE_LEGACY       (1024*1024*15) /* 15MB */
1016 #define NETVSC_RECEIVE_BUFFER_SIZE              (1024*1024*16) /* 16MB */
1017
1018 #define NETVSC_RECEIVE_BUFFER_ID                0xcafe
1019
1020 #define NETVSC_RECEIVE_SG_COUNT                 1
1021
1022 /* Preallocated receive packets */
1023 #define NETVSC_RECEIVE_PACKETLIST_COUNT         256
1024
1025 /*
1026  * Maximum MTU we permit to be configured for a netvsc interface.
1027  * When the code was developed, a max MTU of 12232 was tested and
1028  * proven to work.  9K is a reasonable maximum for an Ethernet.
1029  */
1030 #define NETVSC_MAX_CONFIGURABLE_MTU             (9 * 1024)
1031
1032 #define NETVSC_PACKET_SIZE                      PAGE_SIZE
1033 #define VRSS_SEND_TABLE_SIZE                    16
1034
1035 /*
1036  * Data types
1037  */
1038
1039 /*
1040  * Per netvsc channel-specific
1041  */
1042 typedef struct netvsc_dev_ {
1043         struct hv_device                        *dev;
1044
1045         /* Send buffer allocated by us but manages by NetVSP */
1046         void                                    *send_buf;
1047         uint32_t                                send_buf_size;
1048         uint32_t                                send_buf_gpadl_handle;
1049         uint32_t                                send_section_size;
1050         uint32_t                                send_section_count;
1051         unsigned long                           bitsmap_words;
1052         unsigned long                           *send_section_bitsmap;
1053
1054         /* Receive buffer allocated by us but managed by NetVSP */
1055         void                                    *rx_buf;
1056         uint32_t                                rx_buf_size;
1057         uint32_t                                rx_buf_gpadl_handle;
1058         uint32_t                                rx_section_count;
1059         nvsp_1_rx_buf_section                   *rx_sections;
1060
1061         /* Used for NetVSP initialization protocol */
1062         struct sema                             channel_init_sema;
1063         nvsp_msg                                channel_init_packet;
1064
1065         nvsp_msg                                revoke_packet;
1066         /*uint8_t                               hw_mac_addr[HW_MACADDR_LEN];*/
1067
1068         /* Holds rndis device info */
1069         void                                    *extension;
1070
1071         hv_bool_uint8_t                         destroy;
1072         /* Negotiated NVSP version */
1073         uint32_t                                nvsp_version;
1074
1075         uint32_t                                num_channel;
1076
1077         uint32_t                                vrss_send_table[VRSS_SEND_TABLE_SIZE];
1078 } netvsc_dev;
1079
1080 struct hv_vmbus_channel;
1081
1082 typedef void (*pfn_on_send_rx_completion)(struct hv_vmbus_channel *, void *);
1083
1084 #define NETVSC_DEVICE_RING_BUFFER_SIZE  (128 * PAGE_SIZE)
1085 #define NETVSC_PACKET_MAXPAGE           32 
1086
1087
1088 #define NETVSC_VLAN_PRIO_MASK           0xe000
1089 #define NETVSC_VLAN_PRIO_SHIFT          13
1090 #define NETVSC_VLAN_VID_MASK            0x0fff
1091
1092 #define TYPE_IPV4                       2
1093 #define TYPE_IPV6                       4
1094 #define TYPE_TCP                        2
1095 #define TYPE_UDP                        4
1096
1097 #define TRANSPORT_TYPE_NOT_IP           0
1098 #define TRANSPORT_TYPE_IPV4_TCP         ((TYPE_IPV4 << 16) | TYPE_TCP)
1099 #define TRANSPORT_TYPE_IPV4_UDP         ((TYPE_IPV4 << 16) | TYPE_UDP)
1100 #define TRANSPORT_TYPE_IPV6_TCP         ((TYPE_IPV6 << 16) | TYPE_TCP)
1101 #define TRANSPORT_TYPE_IPV6_UDP         ((TYPE_IPV6 << 16) | TYPE_UDP)
1102
1103 #ifdef __LP64__
1104 #define BITS_PER_LONG 64
1105 #else
1106 #define BITS_PER_LONG 32
1107 #endif
1108
1109 typedef struct netvsc_packet_ {
1110         struct hv_device           *device;
1111         hv_bool_uint8_t            is_data_pkt;      /* One byte */
1112         uint16_t                   vlan_tci;
1113         uint32_t status;
1114
1115         /* Completion */
1116         union {
1117                 struct {
1118                         uint64_t   rx_completion_tid;
1119                         void       *rx_completion_context;
1120                         /* This is no longer used */
1121                         pfn_on_send_rx_completion   on_rx_completion;
1122                 } rx;
1123                 struct {
1124                         uint64_t    send_completion_tid;
1125                         void        *send_completion_context;
1126                         /* Still used in netvsc and filter code */
1127                         pfn_on_send_rx_completion   on_send_completion;
1128                 } send;
1129         } compl;
1130         uint32_t        send_buf_section_idx;
1131         uint32_t        send_buf_section_size;
1132
1133         void            *rndis_mesg;
1134         uint32_t        tot_data_buf_len;
1135         void            *data;
1136         uint32_t        page_buf_count;
1137         hv_vmbus_page_buffer    page_buffers[NETVSC_PACKET_MAXPAGE];
1138 } netvsc_packet;
1139
1140 typedef struct {
1141         uint8_t         mac_addr[6];  /* Assumption unsigned long */
1142         hv_bool_uint8_t link_state;
1143 } netvsc_device_info;
1144
1145 #ifndef HN_USE_TXDESC_BUFRING
1146 struct hn_txdesc;
1147 SLIST_HEAD(hn_txdesc_list, hn_txdesc);
1148 #else
1149 struct buf_ring;
1150 #endif
1151
1152 struct hn_rx_ring {
1153         struct ifnet    *hn_ifp;
1154         int             hn_rx_idx;
1155
1156         /* Trust csum verification on host side */
1157         int             hn_trust_hcsum; /* HN_TRUST_HCSUM_ */
1158         struct lro_ctrl hn_lro;
1159
1160         u_long          hn_csum_ip;
1161         u_long          hn_csum_tcp;
1162         u_long          hn_csum_udp;
1163         u_long          hn_csum_trusted;
1164         u_long          hn_lro_tried;
1165         u_long          hn_small_pkts;
1166         u_long          hn_pkts;
1167
1168         /* Rarely used stuffs */
1169         struct sysctl_oid *hn_rx_sysctl_tree;
1170         int             hn_rx_flags;
1171 } __aligned(CACHE_LINE_SIZE);
1172
1173 #define HN_TRUST_HCSUM_IP       0x0001
1174 #define HN_TRUST_HCSUM_TCP      0x0002
1175 #define HN_TRUST_HCSUM_UDP      0x0004
1176
1177 #define HN_RX_FLAG_ATTACHED     0x1
1178
1179 struct hn_tx_ring {
1180 #ifndef HN_USE_TXDESC_BUFRING
1181         struct mtx      hn_txlist_spin;
1182         struct hn_txdesc_list hn_txlist;
1183 #else
1184         struct buf_ring *hn_txdesc_br;
1185 #endif
1186         int             hn_txdesc_cnt;
1187         int             hn_txdesc_avail;
1188         int             hn_has_txeof;
1189
1190         int             hn_sched_tx;
1191         void            (*hn_txeof)(struct hn_tx_ring *);
1192         struct taskqueue *hn_tx_taskq;
1193         struct task     hn_tx_task;
1194         struct task     hn_txeof_task;
1195
1196         struct buf_ring *hn_mbuf_br;
1197         int             hn_oactive;
1198         int             hn_tx_idx;
1199
1200         struct mtx      hn_tx_lock;
1201         struct hn_softc *hn_sc;
1202         struct hv_vmbus_channel *hn_chan;
1203
1204         int             hn_direct_tx_size;
1205         int             hn_tx_chimney_size;
1206         bus_dma_tag_t   hn_tx_data_dtag;
1207         uint64_t        hn_csum_assist;
1208
1209         u_long          hn_no_txdescs;
1210         u_long          hn_send_failed;
1211         u_long          hn_txdma_failed;
1212         u_long          hn_tx_collapsed;
1213         u_long          hn_tx_chimney;
1214         u_long          hn_pkts;
1215
1216         /* Rarely used stuffs */
1217         struct hn_txdesc *hn_txdesc;
1218         bus_dma_tag_t   hn_tx_rndis_dtag;
1219         struct sysctl_oid *hn_tx_sysctl_tree;
1220         int             hn_tx_flags;
1221 } __aligned(CACHE_LINE_SIZE);
1222
1223 #define HN_TX_FLAG_ATTACHED     0x1
1224
1225 /*
1226  * Device-specific softc structure
1227  */
1228 typedef struct hn_softc {
1229         struct ifnet    *hn_ifp;
1230         struct arpcom   arpcom;
1231         struct ifmedia  hn_media;
1232         device_t        hn_dev;
1233         uint8_t         hn_unit;
1234         int             hn_carrier;
1235         int             hn_if_flags;
1236         struct mtx      hn_lock;
1237         int             hn_initdone;
1238         /* See hv_netvsc_drv_freebsd.c for rules on how to use */
1239         int             temp_unusable;
1240         struct hv_device  *hn_dev_obj;
1241         netvsc_dev      *net_dev;
1242
1243         int             hn_rx_ring_cnt;
1244         int             hn_rx_ring_inuse;
1245         struct hn_rx_ring *hn_rx_ring;
1246
1247         int             hn_tx_ring_cnt;
1248         int             hn_tx_ring_inuse;
1249         struct hn_tx_ring *hn_tx_ring;
1250
1251         int             hn_cpu;
1252         int             hn_tx_chimney_max;
1253         struct taskqueue *hn_tx_taskq;
1254         struct sysctl_oid *hn_tx_sysctl_tree;
1255         struct sysctl_oid *hn_rx_sysctl_tree;
1256 } hn_softc_t;
1257
1258 /*
1259  * Externs
1260  */
1261 extern int hv_promisc_mode;
1262
1263 void netvsc_linkstatus_callback(struct hv_device *device_obj, uint32_t status);
1264 netvsc_dev *hv_nv_on_device_add(struct hv_device *device,
1265     void *additional_info);
1266 int hv_nv_on_device_remove(struct hv_device *device,
1267     boolean_t destroy_channel);
1268 int hv_nv_on_send(struct hv_vmbus_channel *chan, netvsc_packet *pkt);
1269 int hv_nv_get_next_send_section(netvsc_dev *net_dev);
1270
1271 #endif  /* __HV_NET_VSC_H__ */
1272