xref: /freebsd/sys/dev/hyperv/netvsc/ndis.h (revision f90f4b65322a1d76ae934c5aa9e2bfbc2d9f5477)
1 /*-
2  * Copyright (c) 2016 Microsoft Corp.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice unmodified, this list of conditions, and the following
10  *    disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25  *
26  * $FreeBSD$
27  */
28 
29 #ifndef _NET_NDIS_H_
30 #define _NET_NDIS_H_
31 
32 #define OID_TCP_OFFLOAD_PARAMETERS	0xFC01020C
33 
34 #define NDIS_OBJTYPE_DEFAULT		0x80
35 
36 /* common_set */
37 #define NDIS_OFFLOAD_SET_NOCHG		0
38 #define NDIS_OFFLOAD_SET_ON		1
39 #define NDIS_OFFLOAD_SET_OFF		2
40 
41 /* a.k.a GRE MAC */
42 #define NDIS_ENCAP_TYPE_NVGRE		0x00000001
43 
44 struct ndis_object_hdr {
45 	uint8_t			ndis_type;		/* NDIS_OBJTYPE_ */
46 	uint8_t			ndis_rev;		/* type specific */
47 	uint16_t		ndis_size;		/* incl. this hdr */
48 };
49 
50 /* OID_TCP_OFFLOAD_PARAMETERS */
51 struct ndis_offload_params {
52 	struct ndis_object_hdr	ndis_hdr;
53 	uint8_t			ndis_ip4csum;		/* param_set */
54 	uint8_t			ndis_tcp4csum;		/* param_set */
55 	uint8_t			ndis_udp4csum;		/* param_set */
56 	uint8_t			ndis_tcp6csum;		/* param_set */
57 	uint8_t			ndis_udp6csum;		/* param_set */
58 	uint8_t			ndis_lsov1;		/* lsov1_set */
59 	uint8_t			ndis_ipsecv1;		/* ipsecv1_set */
60 	uint8_t			ndis_lsov2_ip4;		/* lsov2_set */
61 	uint8_t			ndis_lsov2_ip6;		/* lsov2_set */
62 	uint8_t			ndis_tcp4conn;		/* PARAM_NOCHG */
63 	uint8_t			ndis_tcp6conn;		/* PARAM_NOCHG */
64 	uint32_t		ndis_flags;		/* 0 */
65 	/* NDIS >= 6.1 */
66 	uint8_t			ndis_ipsecv2;		/* ipsecv2_set */
67 	uint8_t			ndis_ipsecv2_ip4;	/* ipsecv2_set */
68 	/* NDIS >= 6.30 */
69 	uint8_t			ndis_rsc_ip4;		/* rsc_set */
70 	uint8_t			ndis_rsc_ip6;		/* rsc_set */
71 	uint8_t			ndis_encap;		/* common_set */
72 	uint8_t			ndis_encap_types;	/* NDIS_ENCAP_TYPE_ */
73 };
74 
75 #define NDIS_OFFLOAD_PARAMS_SIZE	sizeof(struct ndis_offload_params)
76 #define NDIS_OFFLOAD_PARAMS_SIZE_6_1	\
77 	__offsetof(struct ndis_offload_params, ndis_rsc_ip4)
78 
79 #define NDIS_OFFLOAD_PARAMS_REV_2	2	/* NDIS 6.1 */
80 #define NDIS_OFFLOAD_PARAMS_REV_3	3	/* NDIS 6.30 */
81 
82 /* param_set */
83 #define NDIS_OFFLOAD_PARAM_NOCHG	0	/* common to all sets */
84 #define NDIS_OFFLOAD_PARAM_OFF		1
85 #define NDIS_OFFLOAD_PARAM_TX		2
86 #define NDIS_OFFLOAD_PARAM_RX		3
87 #define NDIS_OFFLOAD_PARAM_TXRX		4
88 
89 /* lsov1_set */
90 /* NDIS_OFFLOAD_PARAM_NOCHG */
91 #define NDIS_OFFLOAD_LSOV1_OFF		1
92 #define NDIS_OFFLOAD_LSOV1_ON		2
93 
94 /* ipsecv1_set */
95 /* NDIS_OFFLOAD_PARAM_NOCHG */
96 #define NDIS_OFFLOAD_IPSECV1_OFF	1
97 #define NDIS_OFFLOAD_IPSECV1_AH		2
98 #define NDIS_OFFLOAD_IPSECV1_ESP	3
99 #define NDIS_OFFLOAD_IPSECV1_AH_ESP	4
100 
101 /* lsov2_set */
102 /* NDIS_OFFLOAD_PARAM_NOCHG */
103 #define NDIS_OFFLOAD_LSOV2_OFF		1
104 #define NDIS_OFFLOAD_LSOV2_ON		2
105 
106 /* ipsecv2_set */
107 /* NDIS_OFFLOAD_PARAM_NOCHG */
108 #define NDIS_OFFLOAD_IPSECV2_OFF	1
109 #define NDIS_OFFLOAD_IPSECV2_AH		2
110 #define NDIS_OFFLOAD_IPSECV2_ESP	3
111 #define NDIS_OFFLOAD_IPSECV2_AH_ESP	4
112 
113 /* rsc_set */
114 /* NDIS_OFFLOAD_PARAM_NOCHG */
115 #define NDIS_OFFLOAD_RSC_OFF		1
116 #define NDIS_OFFLOAD_RSC_ON		2
117 
118 #endif	/* !_NET_NDIS_H_ */
119