xref: /illumos-gate/usr/src/uts/common/sys/pattr.h (revision 9525b14bcdeb5b5f6f95ab27c2f48f18bd2ec829)
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 2006 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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #ifdef	__cplusplus
32 extern "C" {
33 #endif
34 
35 /*
36  * Attribute types and structures.
37  */
38 #define	PATTR_DSTADDRSAP	0x1	/* destination physical address+SAP */
39 #define	PATTR_SRCADDRSAP	0x2	/* source physical address+SAP */
40 #define	PATTR_HCKSUM		0x3	/* hardware checksum attribute */
41 #define	PATTR_ZCOPY		0x4	/* zerocopy attribute */
42 
43 /*
44  * Structure shared by {source,destination} physical address+SAP attributes.
45  */
46 typedef struct pattr_addr_s {
47 	uint8_t	addr_is_group;	/* address is broadcast or multicast */
48 	uint8_t	addr_len;	/* length of address */
49 	uint8_t	addr[1];	/* address */
50 } pattr_addr_t;
51 
52 /*
53  * Structure used for Hardware Checksum attribute.
54  */
55 
56 typedef struct pattr_hcksum_s {
57 	uint32_t	hcksum_start_offset;
58 	uint32_t	hcksum_stuff_offset;
59 	uint32_t	hcksum_end_offset;
60 	union {
61 		uint64_t value;
62 		uint16_t inet_cksum; /* to store H/W computed cksum value */
63 	} hcksum_cksum_val;
64 	uint32_t	hcksum_flags;
65 } pattr_hcksum_t;
66 
67 /*
68  * Values for hcksum_flags
69  */
70 #define	HCK_IPV4_HDRCKSUM	0x01	/* On Transmit: Compute IP header */
71 					/* checksum in hardware. */
72 					/* On Receive: IP header checksum */
73 					/* was verified by h/w and is */
74 					/* correct. */
75 #define	HCK_PARTIALCKSUM	0x02	/* On Transmit: Compute partial 1's */
76 					/* complement checksum based on */
77 					/* start, stuff and end offsets. */
78 					/* On Receive : Partial checksum */
79 					/* computed and attached. */
80 #define	HCK_FULLCKSUM		0x04	/* On Transmit: Compute full(in case */
81 					/* of TCP/UDP, full is pseudo-header */
82 					/* + header + payload) checksum for */
83 					/* this packet. */
84 					/* On Receive : Full checksum  */
85 					/* computed in h/w and is attached */
86 #define	HCK_FULLCKSUM_OK	0x08	/* On Transmit: N/A */
87 					/* On Receive: Full checksum status */
88 					/* If set, implies full checksum */
89 					/* computation was successful */
90 					/* i.e. checksum was correct. */
91 					/* If it is not set, IP will also */
92 					/* check the attached h/w computed */
93 					/* checksum value to determine if */
94 					/* checksum was bad */
95 /*
96  * Extended hardware offloading flags that also use hcksum_flags
97  */
98 #define	HW_LSO			0x10	/* On Transmit: hardware does LSO */
99 					/* On Receive: N/A */
100 
101 
102 /*
103  * Structure used for zerocopy attribute.
104  */
105 typedef struct pattr_zcopy_s {
106 	uint_t zcopy_flags;
107 } pattr_zcopy_t;
108 
109 #ifdef	__cplusplus
110 }
111 #endif
112 
113 #endif	/* _SYS_PATTR_H */
114