ndisreg.h revision 1.1.6.3 1 1.1.6.3 martin /* $NetBSD: ndisreg.h,v 1.1.6.3 2020/04/08 14:08:06 martin Exp $ */
2 1.1.6.2 christos /* $OpenBSD: ndis.h,v 1.2 2016/09/23 11:32:13 mikeb Exp $ */
3 1.1.6.2 christos
4 1.1.6.2 christos /*-
5 1.1.6.2 christos * Copyright (c) 2016-2017 Microsoft Corp.
6 1.1.6.2 christos * All rights reserved.
7 1.1.6.2 christos *
8 1.1.6.2 christos * Redistribution and use in source and binary forms, with or without
9 1.1.6.2 christos * modification, are permitted provided that the following conditions
10 1.1.6.2 christos * are met:
11 1.1.6.2 christos * 1. Redistributions of source code must retain the above copyright
12 1.1.6.2 christos * notice unmodified, this list of conditions, and the following
13 1.1.6.2 christos * disclaimer.
14 1.1.6.2 christos * 2. Redistributions in binary form must reproduce the above copyright
15 1.1.6.2 christos * notice, this list of conditions and the following disclaimer in the
16 1.1.6.2 christos * documentation and/or other materials provided with the distribution.
17 1.1.6.2 christos *
18 1.1.6.2 christos * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 1.1.6.2 christos * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 1.1.6.2 christos * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 1.1.6.2 christos * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 1.1.6.2 christos * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 1.1.6.2 christos * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 1.1.6.2 christos * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 1.1.6.2 christos * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 1.1.6.2 christos * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 1.1.6.2 christos * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 1.1.6.2 christos *
29 1.1.6.2 christos * $FreeBSD: head/sys/dev/hyperv/netvsc/ndis.h 324516 2017-10-11 05:15:49Z sephe $
30 1.1.6.2 christos */
31 1.1.6.2 christos
32 1.1.6.2 christos #ifndef _DEV_IC_NDIS_H_
33 1.1.6.2 christos #define _DEV_IC_NDIS_H_
34 1.1.6.2 christos
35 1.1.6.2 christos /*
36 1.1.6.2 christos * NDIS protocol version numbers
37 1.1.6.2 christos */
38 1.1.6.2 christos #define NDIS_VERSION_5_0 0x00050000
39 1.1.6.2 christos #define NDIS_VERSION_5_1 0x00050001
40 1.1.6.2 christos #define NDIS_VERSION_6_0 0x00060000
41 1.1.6.2 christos #define NDIS_VERSION_6_1 0x00060001
42 1.1.6.3 martin #define NDIS_VERSION_6_20 0x00060014
43 1.1.6.2 christos #define NDIS_VERSION_6_30 0x0006001e
44 1.1.6.2 christos
45 1.1.6.2 christos #define NDIS_MEDIA_STATE_CONNECTED 0
46 1.1.6.2 christos #define NDIS_MEDIA_STATE_DISCONNECTED 1
47 1.1.6.2 christos
48 1.1.6.2 christos #define NDIS_NETCHANGE_TYPE_POSSIBLE 1
49 1.1.6.2 christos #define NDIS_NETCHANGE_TYPE_DEFINITE 2
50 1.1.6.2 christos #define NDIS_NETCHANGE_TYPE_FROMMEDIA 3
51 1.1.6.2 christos
52 1.1.6.2 christos #define NDIS_OFFLOAD_SET_NOCHG 0
53 1.1.6.2 christos #define NDIS_OFFLOAD_SET_ON 1
54 1.1.6.2 christos #define NDIS_OFFLOAD_SET_OFF 2
55 1.1.6.2 christos
56 1.1.6.2 christos /* a.k.a GRE MAC */
57 1.1.6.2 christos #define NDIS_ENCAP_TYPE_NVGRE 0x00000001
58 1.1.6.2 christos
59 1.1.6.2 christos #define NDIS_HASH_FUNCTION_MASK 0x000000FF /* see hash function */
60 1.1.6.2 christos #define NDIS_HASH_TYPE_MASK 0x00FFFF00 /* see hash type */
61 1.1.6.2 christos
62 1.1.6.2 christos /* hash function */
63 1.1.6.2 christos #define NDIS_HASH_FUNCTION_TOEPLITZ 0x00000001
64 1.1.6.2 christos
65 1.1.6.2 christos /* hash type */
66 1.1.6.2 christos #define NDIS_HASH_IPV4 0x00000100
67 1.1.6.2 christos #define NDIS_HASH_TCP_IPV4 0x00000200
68 1.1.6.2 christos #define NDIS_HASH_IPV6 0x00000400
69 1.1.6.2 christos #define NDIS_HASH_IPV6_EX 0x00000800
70 1.1.6.2 christos #define NDIS_HASH_TCP_IPV6 0x00001000
71 1.1.6.2 christos #define NDIS_HASH_TCP_IPV6_EX 0x00002000
72 1.1.6.2 christos #define NDIS_HASH_UDP_IPV4_X 0x00004000 /* XXX non-standard */
73 1.1.6.2 christos
74 1.1.6.2 christos #define NDIS_HASH_ALL (NDIS_HASH_IPV4 | \
75 1.1.6.2 christos NDIS_HASH_TCP_IPV4 | \
76 1.1.6.2 christos NDIS_HASH_IPV6 | \
77 1.1.6.2 christos NDIS_HASH_IPV6_EX | \
78 1.1.6.2 christos NDIS_HASH_TCP_IPV6 | \
79 1.1.6.2 christos NDIS_HASH_TCP_IPV6_EX |\
80 1.1.6.2 christos NDIS_HASH_UDP_IPV4_X)
81 1.1.6.2 christos
82 1.1.6.2 christos #define NDIS_HASH_STD (NDIS_HASH_IPV4 | \
83 1.1.6.2 christos NDIS_HASH_TCP_IPV4 | \
84 1.1.6.2 christos NDIS_HASH_IPV6 | \
85 1.1.6.2 christos NDIS_HASH_IPV6_EX | \
86 1.1.6.2 christos NDIS_HASH_TCP_IPV6 | \
87 1.1.6.2 christos NDIS_HASH_TCP_IPV6_EX)
88 1.1.6.2 christos
89 1.1.6.2 christos /* Hash description for use with printf(9) %b identifier. */
90 1.1.6.2 christos #define NDIS_HASH_BITS \
91 1.1.6.2 christos "\20\1TOEPLITZ\11IP4\12TCP4\13IP6\14IP6EX\15TCP6\16TCP6EX\17UDP4_X"
92 1.1.6.2 christos
93 1.1.6.2 christos #define NDIS_HASH_KEYSIZE_TOEPLITZ 40
94 1.1.6.2 christos #define NDIS_HASH_INDCNT 128
95 1.1.6.2 christos
96 1.1.6.2 christos #define NDIS_OBJTYPE_DEFAULT 0x80
97 1.1.6.2 christos #define NDIS_OBJTYPE_RSS_CAPS 0x88
98 1.1.6.2 christos #define NDIS_OBJTYPE_RSS_PARAMS 0x89
99 1.1.6.2 christos #define NDIS_OBJTYPE_OFFLOAD 0xa7
100 1.1.6.2 christos
101 1.1.6.2 christos struct ndis_object_hdr {
102 1.1.6.2 christos uint8_t ndis_type; /* NDIS_OBJTYPE_ */
103 1.1.6.2 christos uint8_t ndis_rev; /* type specific */
104 1.1.6.2 christos uint16_t ndis_size; /* incl. this hdr */
105 1.1.6.2 christos };
106 1.1.6.2 christos
107 1.1.6.2 christos /*
108 1.1.6.2 christos * OID_TCP_OFFLOAD_PARAMETERS
109 1.1.6.2 christos * ndis_type: NDIS_OBJTYPE_DEFAULT
110 1.1.6.2 christos */
111 1.1.6.2 christos struct ndis_offload_params {
112 1.1.6.2 christos struct ndis_object_hdr ndis_hdr;
113 1.1.6.2 christos uint8_t ndis_ip4csum; /* NDIS_OFFLOAD_PARAM_ */
114 1.1.6.2 christos uint8_t ndis_tcp4csum; /* NDIS_OFFLOAD_PARAM_ */
115 1.1.6.2 christos uint8_t ndis_udp4csum; /* NDIS_OFFLOAD_PARAM_ */
116 1.1.6.2 christos uint8_t ndis_tcp6csum; /* NDIS_OFFLOAD_PARAM_ */
117 1.1.6.2 christos uint8_t ndis_udp6csum; /* NDIS_OFFLOAD_PARAM_ */
118 1.1.6.2 christos uint8_t ndis_lsov1; /* NDIS_OFFLOAD_PARAM_ */
119 1.1.6.2 christos uint8_t ndis_ipsecv1; /* NDIS_OFFLOAD_IPSECV1_ */
120 1.1.6.2 christos uint8_t ndis_lsov2_ip4; /* NDIS_OFFLOAD_LSOV2_ */
121 1.1.6.2 christos uint8_t ndis_lsov2_ip6; /* NDIS_OFFLOAD_LSOV2_ */
122 1.1.6.2 christos uint8_t ndis_tcp4conn; /* 0 */
123 1.1.6.2 christos uint8_t ndis_tcp6conn; /* 0 */
124 1.1.6.2 christos uint32_t ndis_flags; /* 0 */
125 1.1.6.2 christos /* NDIS >= 6.1 */
126 1.1.6.2 christos uint8_t ndis_ipsecv2; /* NDIS_OFFLOAD_IPSECV2_ */
127 1.1.6.2 christos uint8_t ndis_ipsecv2_ip4;/* NDIS_OFFLOAD_IPSECV2_ */
128 1.1.6.2 christos /* NDIS >= 6.30 */
129 1.1.6.2 christos uint8_t ndis_rsc_ip4; /* NDIS_OFFLOAD_RSC_ */
130 1.1.6.2 christos uint8_t ndis_rsc_ip6; /* NDIS_OFFLOAD_RSC_ */
131 1.1.6.2 christos uint8_t ndis_encap; /* NDIS_OFFLOAD_SET_ */
132 1.1.6.2 christos uint8_t ndis_encap_types;/* NDIS_ENCAP_TYPE_ */
133 1.1.6.2 christos };
134 1.1.6.2 christos
135 1.1.6.2 christos #define NDIS_OFFLOAD_PARAMS_SIZE sizeof(struct ndis_offload_params)
136 1.1.6.2 christos #define NDIS_OFFLOAD_PARAMS_SIZE_6_1 \
137 1.1.6.2 christos offsetof(struct ndis_offload_params, ndis_rsc_ip4)
138 1.1.6.2 christos
139 1.1.6.2 christos #define NDIS_OFFLOAD_PARAMS_REV_2 2 /* NDIS 6.1 */
140 1.1.6.2 christos #define NDIS_OFFLOAD_PARAMS_REV_3 3 /* NDIS 6.30 */
141 1.1.6.2 christos
142 1.1.6.2 christos #define NDIS_OFFLOAD_PARAM_NOCHG 0 /* common */
143 1.1.6.2 christos #define NDIS_OFFLOAD_PARAM_OFF 1
144 1.1.6.2 christos #define NDIS_OFFLOAD_PARAM_TX 2
145 1.1.6.2 christos #define NDIS_OFFLOAD_PARAM_RX 3
146 1.1.6.2 christos #define NDIS_OFFLOAD_PARAM_TXRX 4
147 1.1.6.2 christos
148 1.1.6.2 christos /* NDIS_OFFLOAD_PARAM_NOCHG */
149 1.1.6.2 christos #define NDIS_OFFLOAD_LSOV1_OFF 1
150 1.1.6.2 christos #define NDIS_OFFLOAD_LSOV1_ON 2
151 1.1.6.2 christos
152 1.1.6.2 christos /* NDIS_OFFLOAD_PARAM_NOCHG */
153 1.1.6.2 christos #define NDIS_OFFLOAD_IPSECV1_OFF 1
154 1.1.6.2 christos #define NDIS_OFFLOAD_IPSECV1_AH 2
155 1.1.6.2 christos #define NDIS_OFFLOAD_IPSECV1_ESP 3
156 1.1.6.2 christos #define NDIS_OFFLOAD_IPSECV1_AH_ESP 4
157 1.1.6.2 christos
158 1.1.6.2 christos /* NDIS_OFFLOAD_PARAM_NOCHG */
159 1.1.6.2 christos #define NDIS_OFFLOAD_LSOV2_OFF 1
160 1.1.6.2 christos #define NDIS_OFFLOAD_LSOV2_ON 2
161 1.1.6.2 christos
162 1.1.6.2 christos /* NDIS_OFFLOAD_PARAM_NOCHG */
163 1.1.6.2 christos #define NDIS_OFFLOAD_IPSECV2_OFF 1
164 1.1.6.2 christos #define NDIS_OFFLOAD_IPSECV2_AH 2
165 1.1.6.2 christos #define NDIS_OFFLOAD_IPSECV2_ESP 3
166 1.1.6.2 christos #define NDIS_OFFLOAD_IPSECV2_AH_ESP 4
167 1.1.6.2 christos
168 1.1.6.2 christos /* NDIS_OFFLOAD_PARAM_NOCHG */
169 1.1.6.2 christos #define NDIS_OFFLOAD_RSC_OFF 1
170 1.1.6.2 christos #define NDIS_OFFLOAD_RSC_ON 2
171 1.1.6.2 christos
172 1.1.6.2 christos /*
173 1.1.6.2 christos * OID_GEN_RECEIVE_SCALE_CAPABILITIES
174 1.1.6.2 christos * ndis_type: NDIS_OBJTYPE_RSS_CAPS
175 1.1.6.2 christos */
176 1.1.6.2 christos struct ndis_rss_caps {
177 1.1.6.2 christos struct ndis_object_hdr ndis_hdr;
178 1.1.6.2 christos uint32_t ndis_caps; /* NDIS_RSS_CAP_ */
179 1.1.6.2 christos uint32_t ndis_nmsi; /* # of MSIs */
180 1.1.6.2 christos uint32_t ndis_nrxr; /* # of RX rings */
181 1.1.6.2 christos /* NDIS >= 6.30 */
182 1.1.6.2 christos uint16_t ndis_nind; /* # of indtbl ent. */
183 1.1.6.2 christos uint16_t ndis_pad;
184 1.1.6.2 christos };
185 1.1.6.2 christos
186 1.1.6.2 christos #define NDIS_RSS_CAPS_SIZE \
187 1.1.6.2 christos offsetof(struct ndis_rss_caps, ndis_pad)
188 1.1.6.2 christos #define NDIS_RSS_CAPS_SIZE_6_0 \
189 1.1.6.2 christos offsetof(struct ndis_rss_caps, ndis_nind)
190 1.1.6.2 christos
191 1.1.6.2 christos #define NDIS_RSS_CAPS_REV_1 1 /* NDIS 6.{0,1,20} */
192 1.1.6.2 christos #define NDIS_RSS_CAPS_REV_2 2 /* NDIS 6.30 */
193 1.1.6.2 christos
194 1.1.6.2 christos #define NDIS_RSS_CAP_MSI 0x01000000
195 1.1.6.2 christos #define NDIS_RSS_CAP_CLASSIFY_ISR 0x02000000
196 1.1.6.2 christos #define NDIS_RSS_CAP_CLASSIFY_DPC 0x04000000
197 1.1.6.2 christos #define NDIS_RSS_CAP_MSIX 0x08000000
198 1.1.6.2 christos #define NDIS_RSS_CAP_IPV4 0x00000100
199 1.1.6.2 christos #define NDIS_RSS_CAP_IPV6 0x00000200
200 1.1.6.2 christos #define NDIS_RSS_CAP_IPV6_EX 0x00000400
201 1.1.6.2 christos #define NDIS_RSS_CAP_HASH_TOEPLITZ NDIS_HASH_FUNCTION_TOEPLITZ
202 1.1.6.2 christos #define NDIS_RSS_CAP_HASHFUNC_MASK NDIS_HASH_FUNCTION_MASK
203 1.1.6.2 christos
204 1.1.6.2 christos /*
205 1.1.6.2 christos * OID_GEN_RECEIVE_SCALE_PARAMETERS
206 1.1.6.2 christos * ndis_type: NDIS_OBJTYPE_RSS_PARAMS
207 1.1.6.2 christos */
208 1.1.6.2 christos struct ndis_rss_params {
209 1.1.6.2 christos struct ndis_object_hdr ndis_hdr;
210 1.1.6.2 christos uint16_t ndis_flags; /* NDIS_RSS_FLAG_ */
211 1.1.6.2 christos uint16_t ndis_bcpu; /* base cpu 0 */
212 1.1.6.2 christos uint32_t ndis_hash; /* NDIS_HASH_ */
213 1.1.6.2 christos uint16_t ndis_indsize; /* indirect table */
214 1.1.6.2 christos uint32_t ndis_indoffset;
215 1.1.6.2 christos uint16_t ndis_keysize; /* hash key */
216 1.1.6.2 christos uint32_t ndis_keyoffset;
217 1.1.6.2 christos /* NDIS >= 6.20 */
218 1.1.6.2 christos uint32_t ndis_cpumaskoffset;
219 1.1.6.2 christos uint32_t ndis_cpumaskcnt;
220 1.1.6.2 christos uint32_t ndis_cpumaskentsz;
221 1.1.6.2 christos };
222 1.1.6.2 christos
223 1.1.6.2 christos #define NDIS_RSS_PARAMS_SIZE sizeof(struct ndis_rss_params)
224 1.1.6.2 christos #define NDIS_RSS_PARAMS_SIZE_6_0 \
225 1.1.6.2 christos offsetof(struct ndis_rss_params, ndis_cpumaskoffset)
226 1.1.6.2 christos
227 1.1.6.2 christos #define NDIS_RSS_PARAMS_REV_1 1 /* NDIS 6.0 */
228 1.1.6.2 christos #define NDIS_RSS_PARAMS_REV_2 2 /* NDIS 6.20 */
229 1.1.6.2 christos
230 1.1.6.2 christos #define NDIS_RSS_FLAG_NONE 0x0000
231 1.1.6.2 christos #define NDIS_RSS_FLAG_BCPU_UNCHG 0x0001
232 1.1.6.2 christos #define NDIS_RSS_FLAG_HASH_UNCHG 0x0002
233 1.1.6.2 christos #define NDIS_RSS_FLAG_IND_UNCHG 0x0004
234 1.1.6.2 christos #define NDIS_RSS_FLAG_KEY_UNCHG 0x0008
235 1.1.6.2 christos #define NDIS_RSS_FLAG_DISABLE 0x0010
236 1.1.6.2 christos
237 1.1.6.2 christos /* non-standard convenient struct */
238 1.1.6.2 christos struct ndis_rssprm_toeplitz {
239 1.1.6.2 christos struct ndis_rss_params rss_params;
240 1.1.6.2 christos /* Toeplitz hash key */
241 1.1.6.2 christos uint8_t rss_key[NDIS_HASH_KEYSIZE_TOEPLITZ];
242 1.1.6.2 christos /* Indirect table */
243 1.1.6.2 christos uint32_t rss_ind[NDIS_HASH_INDCNT];
244 1.1.6.2 christos };
245 1.1.6.2 christos
246 1.1.6.2 christos #define NDIS_RSSPRM_TOEPLITZ_SIZE(nind) \
247 1.1.6.2 christos offsetof(struct ndis_rssprm_toeplitz, rss_ind[nind])
248 1.1.6.2 christos
249 1.1.6.2 christos /*
250 1.1.6.2 christos * OID_TCP_OFFLOAD_HARDWARE_CAPABILITIES
251 1.1.6.2 christos * ndis_type: NDIS_OBJTYPE_OFFLOAD
252 1.1.6.2 christos */
253 1.1.6.2 christos
254 1.1.6.2 christos #define NDIS_OFFLOAD_ENCAP_NONE 0x0000
255 1.1.6.2 christos #define NDIS_OFFLOAD_ENCAP_NULL 0x0001
256 1.1.6.2 christos #define NDIS_OFFLOAD_ENCAP_8023 0x0002
257 1.1.6.2 christos #define NDIS_OFFLOAD_ENCAP_8023PQ 0x0004
258 1.1.6.2 christos #define NDIS_OFFLOAD_ENCAP_8023PQ_OOB 0x0008
259 1.1.6.2 christos #define NDIS_OFFLOAD_ENCAP_RFC1483 0x0010
260 1.1.6.2 christos
261 1.1.6.2 christos struct ndis_csum_offload {
262 1.1.6.2 christos uint32_t ndis_ip4_txenc; /*NDIS_OFFLOAD_ENCAP_*/
263 1.1.6.2 christos uint32_t ndis_ip4_txcsum;
264 1.1.6.2 christos #define NDIS_TXCSUM_CAP_IP4OPT 0x001
265 1.1.6.2 christos #define NDIS_TXCSUM_CAP_TCP4OPT 0x004
266 1.1.6.2 christos #define NDIS_TXCSUM_CAP_TCP4 0x010
267 1.1.6.2 christos #define NDIS_TXCSUM_CAP_UDP4 0x040
268 1.1.6.2 christos #define NDIS_TXCSUM_CAP_IP4 0x100
269 1.1.6.2 christos uint32_t ndis_ip4_rxenc; /*NDIS_OFFLOAD_ENCAP_*/
270 1.1.6.2 christos uint32_t ndis_ip4_rxcsum;
271 1.1.6.2 christos #define NDIS_RXCSUM_CAP_IP4OPT 0x001
272 1.1.6.2 christos #define NDIS_RXCSUM_CAP_TCP4OPT 0x004
273 1.1.6.2 christos #define NDIS_RXCSUM_CAP_TCP4 0x010
274 1.1.6.2 christos #define NDIS_RXCSUM_CAP_UDP4 0x040
275 1.1.6.2 christos #define NDIS_RXCSUM_CAP_IP4 0x100
276 1.1.6.2 christos uint32_t ndis_ip6_txenc; /*NDIS_OFFLOAD_ENCAP_*/
277 1.1.6.2 christos uint32_t ndis_ip6_txcsum;
278 1.1.6.2 christos #define NDIS_TXCSUM_CAP_IP6EXT 0x001
279 1.1.6.2 christos #define NDIS_TXCSUM_CAP_TCP6OPT 0x004
280 1.1.6.2 christos #define NDIS_TXCSUM_CAP_TCP6 0x010
281 1.1.6.2 christos #define NDIS_TXCSUM_CAP_UDP6 0x040
282 1.1.6.2 christos uint32_t ndis_ip6_rxenc; /*NDIS_OFFLOAD_ENCAP_*/
283 1.1.6.2 christos uint32_t ndis_ip6_rxcsum;
284 1.1.6.2 christos #define NDIS_RXCSUM_CAP_IP6EXT 0x001
285 1.1.6.2 christos #define NDIS_RXCSUM_CAP_TCP6OPT 0x004
286 1.1.6.2 christos #define NDIS_RXCSUM_CAP_TCP6 0x010
287 1.1.6.2 christos #define NDIS_RXCSUM_CAP_UDP6 0x040
288 1.1.6.2 christos };
289 1.1.6.2 christos
290 1.1.6.2 christos struct ndis_lsov1_offload {
291 1.1.6.2 christos uint32_t ndis_encap; /*NDIS_OFFLOAD_ENCAP_*/
292 1.1.6.2 christos uint32_t ndis_maxsize;
293 1.1.6.2 christos uint32_t ndis_minsegs;
294 1.1.6.2 christos uint32_t ndis_opts;
295 1.1.6.2 christos };
296 1.1.6.2 christos
297 1.1.6.2 christos struct ndis_ipsecv1_offload {
298 1.1.6.2 christos uint32_t ndis_encap; /*NDIS_OFFLOAD_ENCAP_*/
299 1.1.6.2 christos uint32_t ndis_ah_esp;
300 1.1.6.2 christos uint32_t ndis_xport_tun;
301 1.1.6.2 christos uint32_t ndis_ip4_opts;
302 1.1.6.2 christos uint32_t ndis_flags;
303 1.1.6.2 christos uint32_t ndis_ip4_ah;
304 1.1.6.2 christos uint32_t ndis_ip4_esp;
305 1.1.6.2 christos };
306 1.1.6.2 christos
307 1.1.6.2 christos struct ndis_lsov2_offload {
308 1.1.6.2 christos uint32_t ndis_ip4_encap; /*NDIS_OFFLOAD_ENCAP_*/
309 1.1.6.2 christos uint32_t ndis_ip4_maxsz;
310 1.1.6.2 christos uint32_t ndis_ip4_minsg;
311 1.1.6.2 christos uint32_t ndis_ip6_encap; /*NDIS_OFFLOAD_ENCAP_*/
312 1.1.6.2 christos uint32_t ndis_ip6_maxsz;
313 1.1.6.2 christos uint32_t ndis_ip6_minsg;
314 1.1.6.2 christos uint32_t ndis_ip6_opts;
315 1.1.6.2 christos #define NDIS_LSOV2_CAP_IP6EXT 0x001
316 1.1.6.2 christos #define NDIS_LSOV2_CAP_TCP6OPT 0x004
317 1.1.6.2 christos };
318 1.1.6.2 christos
319 1.1.6.2 christos struct ndis_ipsecv2_offload {
320 1.1.6.2 christos uint32_t ndis_encap; /*NDIS_OFFLOAD_ENCAP_*/
321 1.1.6.2 christos uint16_t ndis_ip6;
322 1.1.6.2 christos uint16_t ndis_ip4opt;
323 1.1.6.2 christos uint16_t ndis_ip6ext;
324 1.1.6.2 christos uint16_t ndis_ah;
325 1.1.6.2 christos uint16_t ndis_esp;
326 1.1.6.2 christos uint16_t ndis_ah_esp;
327 1.1.6.2 christos uint16_t ndis_xport;
328 1.1.6.2 christos uint16_t ndis_tun;
329 1.1.6.2 christos uint16_t ndis_xport_tun;
330 1.1.6.2 christos uint16_t ndis_lso;
331 1.1.6.2 christos uint16_t ndis_extseq;
332 1.1.6.2 christos uint32_t ndis_udp_esp;
333 1.1.6.2 christos uint32_t ndis_auth;
334 1.1.6.2 christos uint32_t ndis_crypto;
335 1.1.6.2 christos uint32_t ndis_sa_caps;
336 1.1.6.2 christos };
337 1.1.6.2 christos
338 1.1.6.2 christos struct ndis_rsc_offload {
339 1.1.6.2 christos uint16_t ndis_ip4;
340 1.1.6.2 christos uint16_t ndis_ip6;
341 1.1.6.2 christos };
342 1.1.6.2 christos
343 1.1.6.2 christos struct ndis_encap_offload {
344 1.1.6.2 christos uint32_t ndis_flags;
345 1.1.6.2 christos uint32_t ndis_maxhdr;
346 1.1.6.2 christos };
347 1.1.6.2 christos
348 1.1.6.2 christos struct ndis_offload {
349 1.1.6.2 christos struct ndis_object_hdr ndis_hdr;
350 1.1.6.2 christos struct ndis_csum_offload ndis_csum;
351 1.1.6.2 christos struct ndis_lsov1_offload ndis_lsov1;
352 1.1.6.2 christos struct ndis_ipsecv1_offload ndis_ipsecv1;
353 1.1.6.2 christos struct ndis_lsov2_offload ndis_lsov2;
354 1.1.6.2 christos uint32_t ndis_flags;
355 1.1.6.2 christos /* NDIS >= 6.1 */
356 1.1.6.2 christos struct ndis_ipsecv2_offload ndis_ipsecv2;
357 1.1.6.2 christos /* NDIS >= 6.30 */
358 1.1.6.2 christos struct ndis_rsc_offload ndis_rsc;
359 1.1.6.2 christos struct ndis_encap_offload ndis_encap_gre;
360 1.1.6.2 christos };
361 1.1.6.2 christos
362 1.1.6.2 christos #define NDIS_OFFLOAD_SIZE sizeof(struct ndis_offload)
363 1.1.6.2 christos #define NDIS_OFFLOAD_SIZE_6_0 \
364 1.1.6.2 christos offsetof(struct ndis_offload, ndis_ipsecv2)
365 1.1.6.2 christos #define NDIS_OFFLOAD_SIZE_6_1 \
366 1.1.6.2 christos offsetof(struct ndis_offload, ndis_rsc)
367 1.1.6.2 christos
368 1.1.6.2 christos #define NDIS_OFFLOAD_REV_1 1 /* NDIS 6.0 */
369 1.1.6.2 christos #define NDIS_OFFLOAD_REV_2 2 /* NDIS 6.1 */
370 1.1.6.2 christos #define NDIS_OFFLOAD_REV_3 3 /* NDIS 6.30 */
371 1.1.6.2 christos
372 1.1.6.2 christos /*
373 1.1.6.2 christos * Per-packet-info
374 1.1.6.2 christos */
375 1.1.6.2 christos
376 1.1.6.2 christos /* VLAN */
377 1.1.6.2 christos #define NDIS_VLAN_INFO_SIZE sizeof(uint32_t)
378 1.1.6.2 christos #define NDIS_VLAN_INFO_PRI_MASK 0x0007
379 1.1.6.2 christos #define NDIS_VLAN_INFO_CFI_MASK 0x0008
380 1.1.6.2 christos #define NDIS_VLAN_INFO_ID_MASK 0xfff0
381 1.1.6.2 christos #define NDIS_VLAN_INFO_MAKE(id, pri, cfi) \
382 1.1.6.2 christos (((pri) & NDIS_VLAN_INFO_PRI_MASK) | \
383 1.1.6.2 christos (((cfi) & 0x1) << 3) | (((id) & 0xfff) << 4))
384 1.1.6.2 christos #define NDIS_VLAN_INFO_ID(inf) (((inf) & NDIS_VLAN_INFO_ID_MASK) >> 4)
385 1.1.6.2 christos #define NDIS_VLAN_INFO_CFI(inf) (((inf) & NDIS_VLAN_INFO_CFI_MASK) >> 3)
386 1.1.6.2 christos #define NDIS_VLAN_INFO_PRI(inf) ((inf) & NDIS_VLAN_INFO_PRI_MASK)
387 1.1.6.2 christos
388 1.1.6.2 christos /* Reception checksum */
389 1.1.6.2 christos #define NDIS_RXCSUM_INFO_SIZE sizeof(uint32_t)
390 1.1.6.2 christos #define NDIS_RXCSUM_INFO_TCPCS_FAILED 0x0001
391 1.1.6.2 christos #define NDIS_RXCSUM_INFO_UDPCS_FAILED 0x0002
392 1.1.6.2 christos #define NDIS_RXCSUM_INFO_IPCS_FAILED 0x0004
393 1.1.6.2 christos #define NDIS_RXCSUM_INFO_TCPCS_OK 0x0008
394 1.1.6.2 christos #define NDIS_RXCSUM_INFO_UDPCS_OK 0x0010
395 1.1.6.2 christos #define NDIS_RXCSUM_INFO_IPCS_OK 0x0020
396 1.1.6.2 christos #define NDIS_RXCSUM_INFO_LOOPBACK 0x0040
397 1.1.6.2 christos #define NDIS_RXCSUM_INFO_TCPCS_INVAL 0x0080
398 1.1.6.2 christos #define NDIS_RXCSUM_INFO_IPCS_INVAL 0x0100
399 1.1.6.2 christos
400 1.1.6.2 christos /* LSOv2 */
401 1.1.6.2 christos #define NDIS_LSO2_INFO_SIZE sizeof(uint32_t)
402 1.1.6.2 christos #define NDIS_LSO2_INFO_MSS_MASK 0x000fffff
403 1.1.6.2 christos #define NDIS_LSO2_INFO_THOFF_MASK 0x3ff00000
404 1.1.6.2 christos #define NDIS_LSO2_INFO_ISLSO2 0x40000000
405 1.1.6.2 christos #define NDIS_LSO2_INFO_ISIPV6 0x80000000
406 1.1.6.2 christos
407 1.1.6.2 christos #define NDIS_LSO2_INFO_MAKE(thoff, mss) \
408 1.1.6.2 christos ((((uint32_t)(mss)) & NDIS_LSO2_INFO_MSS_MASK) | \
409 1.1.6.2 christos ((((uint32_t)(thoff)) & 0x3ff) << 20) | \
410 1.1.6.2 christos NDIS_LSO2_INFO_ISLSO2)
411 1.1.6.2 christos
412 1.1.6.2 christos #define NDIS_LSO2_INFO_MAKEIPV4(thoff, mss) \
413 1.1.6.2 christos NDIS_LSO2_INFO_MAKE((thoff), (mss))
414 1.1.6.2 christos
415 1.1.6.2 christos #define NDIS_LSO2_INFO_MAKEIPV6(thoff, mss) \
416 1.1.6.2 christos (NDIS_LSO2_INFO_MAKE((thoff), (mss)) | NDIS_LSO2_INFO_ISIPV6)
417 1.1.6.2 christos
418 1.1.6.2 christos /* Transmission checksum */
419 1.1.6.2 christos #define NDIS_TXCSUM_INFO_SIZE sizeof(uint32_t)
420 1.1.6.2 christos #define NDIS_TXCSUM_INFO_IPV4 0x00000001
421 1.1.6.2 christos #define NDIS_TXCSUM_INFO_IPV6 0x00000002
422 1.1.6.2 christos #define NDIS_TXCSUM_INFO_TCPCS 0x00000004
423 1.1.6.2 christos #define NDIS_TXCSUM_INFO_UDPCS 0x00000008
424 1.1.6.2 christos #define NDIS_TXCSUM_INFO_IPCS 0x00000010
425 1.1.6.2 christos #define NDIS_TXCSUM_INFO_THOFF 0x03ff0000
426 1.1.6.2 christos
427 1.1.6.2 christos #define NDIS_TXCSUM_INFO_MKL4CS(thoff, flag) \
428 1.1.6.2 christos ((((uint32_t)(thoff)) << 16) | (flag))
429 1.1.6.2 christos
430 1.1.6.2 christos #define NDIS_TXCSUM_INFO_MKTCPCS(thoff) \
431 1.1.6.2 christos NDIS_TXCSUM_INFO_MKL4CS((thoff), NDIS_TXCSUM_INFO_TCPCS)
432 1.1.6.2 christos
433 1.1.6.2 christos #define NDIS_TXCSUM_INFO_MKUDPCS(thoff) \
434 1.1.6.2 christos NDIS_TXCSUM_INFO_MKL4CS((thoff), NDIS_TXCSUM_INFO_UDPCS)
435 1.1.6.2 christos
436 1.1.6.2 christos #endif /* !_DEV_IC_NDIS_H_ */
437