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