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