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