xref: /titanic_41/usr/src/uts/common/sys/pattr.h (revision fd0939ef389f48c901faf4bf0b60b82d4bc58b64)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef _SYS_PATTR_H
27 #define	_SYS_PATTR_H
28 
29 #ifdef	__cplusplus
30 extern "C" {
31 #endif
32 
33 /*
34  * Attribute types and structures.
35  */
36 #define	PATTR_DSTADDRSAP	0x1	/* destination physical address+SAP */
37 #define	PATTR_SRCADDRSAP	0x2	/* source physical address+SAP */
38 #define	PATTR_HCKSUM		0x3	/* hardware checksum attribute */
39 #define	PATTR_ZCOPY		0x4	/* zerocopy attribute */
40 
41 /*
42  * Structure shared by {source,destination} physical address+SAP attributes.
43  */
44 typedef struct pattr_addr_s {
45 	uint8_t	addr_is_group;	/* address is broadcast or multicast */
46 	uint8_t	addr_len;	/* length of address */
47 	uint8_t	addr[1];	/* address */
48 } pattr_addr_t;
49 
50 /*
51  * Structure used for Hardware Checksum attribute.
52  */
53 
54 typedef struct pattr_hcksum_s {
55 	uint32_t	hcksum_start_offset;
56 	uint32_t	hcksum_stuff_offset;
57 	uint32_t	hcksum_end_offset;
58 	union {
59 		uint64_t value;
60 		uint16_t inet_cksum; /* to store H/W computed cksum value */
61 	} hcksum_cksum_val;
62 	uint32_t	hcksum_flags;
63 } pattr_hcksum_t;
64 
65 /*
66  * Values for hcksum_flags
67  */
68 #define	HCK_IPV4_HDRCKSUM	0x01	/* On Transmit: Compute IP header */
69 					/* checksum in hardware. */
70 					/* On Receive: IP header checksum */
71 					/* was verified by h/w and is */
72 					/* correct. */
73 #define	HCK_PARTIALCKSUM	0x02	/* On Transmit: Compute partial 1's */
74 					/* complement checksum based on */
75 					/* start, stuff and end offsets. */
76 					/* On Receive : Partial checksum */
77 					/* computed and attached. */
78 #define	HCK_FULLCKSUM		0x04	/* On Transmit: Compute full(in case */
79 					/* of TCP/UDP, full is pseudo-header */
80 					/* + header + payload) checksum for */
81 					/* this packet. */
82 					/* On Receive : Full checksum  */
83 					/* computed in h/w and is attached */
84 #define	HCK_FULLCKSUM_OK	0x08	/* On Transmit: N/A */
85 					/* On Receive: Full checksum status */
86 					/* If set, implies full checksum */
87 					/* computation was successful */
88 					/* i.e. checksum was correct. */
89 					/* If it is not set, IP will also */
90 					/* check the attached h/w computed */
91 					/* checksum value to determine if */
92 					/* checksum was bad */
93 
94 #define	HCK_FLAGS		(HCK_IPV4_HDRCKSUM | HCK_PARTIALCKSUM |	\
95 				HCK_FULLCKSUM | HCK_FULLCKSUM_OK)
96 /*
97  * Extended hardware offloading flags that also use hcksum_flags
98  */
99 #define	HW_LSO			0x10	/* On Transmit: hardware does LSO */
100 					/* On Receive: N/A */
101 
102 #define	HW_LSO_FLAGS		HW_LSO	/* All LSO flags, currently only one */
103 
104 /*
105  * Structure used for zerocopy attribute.
106  */
107 typedef struct pattr_zcopy_s {
108 	uint_t zcopy_flags;
109 } pattr_zcopy_t;
110 
111 #ifdef	__cplusplus
112 }
113 #endif
114 
115 #endif	/* _SYS_PATTR_H */
116