xref: /titanic_54/usr/src/uts/common/sys/pattr.h (revision 8347601bcb0a439f6e50fc36b4039a73d08700e1)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*8347601bSyl150051  * Common Development and Distribution License (the "License").
6*8347601bSyl150051  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22*8347601bSyl150051  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate #ifndef _SYS_PATTR_H
277c478bd9Sstevel@tonic-gate #define	_SYS_PATTR_H
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
327c478bd9Sstevel@tonic-gate extern "C" {
337c478bd9Sstevel@tonic-gate #endif
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate /*
367c478bd9Sstevel@tonic-gate  * Attribute types and structures.
377c478bd9Sstevel@tonic-gate  */
387c478bd9Sstevel@tonic-gate #define	PATTR_DSTADDRSAP	0x1	/* destination physical address+SAP */
397c478bd9Sstevel@tonic-gate #define	PATTR_SRCADDRSAP	0x2	/* source physical address+SAP */
407c478bd9Sstevel@tonic-gate #define	PATTR_HCKSUM		0x3	/* hardware checksum attribute */
417c478bd9Sstevel@tonic-gate #define	PATTR_ZCOPY		0x4	/* zerocopy attribute */
427c478bd9Sstevel@tonic-gate 
437c478bd9Sstevel@tonic-gate /*
447c478bd9Sstevel@tonic-gate  * Structure shared by {source,destination} physical address+SAP attributes.
457c478bd9Sstevel@tonic-gate  */
467c478bd9Sstevel@tonic-gate typedef struct pattr_addr_s {
477c478bd9Sstevel@tonic-gate 	uint8_t	addr_is_group;	/* address is broadcast or multicast */
487c478bd9Sstevel@tonic-gate 	uint8_t	addr_len;	/* length of address */
497c478bd9Sstevel@tonic-gate 	uint8_t	addr[1];	/* address */
507c478bd9Sstevel@tonic-gate } pattr_addr_t;
517c478bd9Sstevel@tonic-gate 
527c478bd9Sstevel@tonic-gate /*
537c478bd9Sstevel@tonic-gate  * Structure used for Hardware Checksum attribute.
547c478bd9Sstevel@tonic-gate  */
557c478bd9Sstevel@tonic-gate 
567c478bd9Sstevel@tonic-gate typedef struct pattr_hcksum_s {
577c478bd9Sstevel@tonic-gate 	uint32_t	hcksum_start_offset;
587c478bd9Sstevel@tonic-gate 	uint32_t	hcksum_stuff_offset;
597c478bd9Sstevel@tonic-gate 	uint32_t	hcksum_end_offset;
607c478bd9Sstevel@tonic-gate 	union {
617c478bd9Sstevel@tonic-gate 		uint64_t value;
627c478bd9Sstevel@tonic-gate 		uint16_t inet_cksum; /* to store H/W computed cksum value */
637c478bd9Sstevel@tonic-gate 	} hcksum_cksum_val;
647c478bd9Sstevel@tonic-gate 	uint32_t	hcksum_flags;
657c478bd9Sstevel@tonic-gate } pattr_hcksum_t;
667c478bd9Sstevel@tonic-gate 
677c478bd9Sstevel@tonic-gate /*
687c478bd9Sstevel@tonic-gate  * Values for hcksum_flags
697c478bd9Sstevel@tonic-gate  */
707c478bd9Sstevel@tonic-gate #define	HCK_IPV4_HDRCKSUM	0x01	/* On Transmit: Compute IP header */
717c478bd9Sstevel@tonic-gate 					/* checksum in hardware. */
727c478bd9Sstevel@tonic-gate 					/* On Receive: IP header checksum */
737c478bd9Sstevel@tonic-gate 					/* was verified by h/w and is */
747c478bd9Sstevel@tonic-gate 					/* correct. */
757c478bd9Sstevel@tonic-gate #define	HCK_PARTIALCKSUM	0x02	/* On Transmit: Compute partial 1's */
767c478bd9Sstevel@tonic-gate 					/* complement checksum based on */
777c478bd9Sstevel@tonic-gate 					/* start, stuff and end offsets. */
787c478bd9Sstevel@tonic-gate 					/* On Receive : Partial checksum */
797c478bd9Sstevel@tonic-gate 					/* computed and attached. */
807c478bd9Sstevel@tonic-gate #define	HCK_FULLCKSUM		0x04	/* On Transmit: Compute full(in case */
817c478bd9Sstevel@tonic-gate 					/* of TCP/UDP, full is pseudo-header */
827c478bd9Sstevel@tonic-gate 					/* + header + payload) checksum for */
837c478bd9Sstevel@tonic-gate 					/* this packet. */
847c478bd9Sstevel@tonic-gate 					/* On Receive : Full checksum  */
857c478bd9Sstevel@tonic-gate 					/* computed in h/w and is attached */
867c478bd9Sstevel@tonic-gate #define	HCK_FULLCKSUM_OK	0x08	/* On Transmit: N/A */
877c478bd9Sstevel@tonic-gate 					/* On Receive: Full checksum status */
887c478bd9Sstevel@tonic-gate 					/* If set, implies full checksum */
897c478bd9Sstevel@tonic-gate 					/* computation was successful */
907c478bd9Sstevel@tonic-gate 					/* i.e. checksum was correct. */
917c478bd9Sstevel@tonic-gate 					/* If it is not set, IP will also */
927c478bd9Sstevel@tonic-gate 					/* check the attached h/w computed */
937c478bd9Sstevel@tonic-gate 					/* checksum value to determine if */
947c478bd9Sstevel@tonic-gate 					/* checksum was bad */
95*8347601bSyl150051 /*
96*8347601bSyl150051  * Extended hardware offloading flags that also use hcksum_flags
97*8347601bSyl150051  */
98*8347601bSyl150051 #define	HW_LSO			0x10	/* On Transmit: hardware does LSO */
99*8347601bSyl150051 					/* On Receive: N/A */
100*8347601bSyl150051 
1017c478bd9Sstevel@tonic-gate 
1027c478bd9Sstevel@tonic-gate /*
1037c478bd9Sstevel@tonic-gate  * Structure used for zerocopy attribute.
1047c478bd9Sstevel@tonic-gate  */
1057c478bd9Sstevel@tonic-gate typedef struct pattr_zcopy_s {
1067c478bd9Sstevel@tonic-gate 	uint_t zcopy_flags;
1077c478bd9Sstevel@tonic-gate } pattr_zcopy_t;
1087c478bd9Sstevel@tonic-gate 
1097c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1107c478bd9Sstevel@tonic-gate }
1117c478bd9Sstevel@tonic-gate #endif
1127c478bd9Sstevel@tonic-gate 
1137c478bd9Sstevel@tonic-gate #endif	/* _SYS_PATTR_H */
114