10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 53115Syl150051 * Common Development and Distribution License (the "License"). 63115Syl150051 * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 210Sstevel@tonic-gate /* 2211469SRoamer@Sun.COM * Copyright 2010 Sun Microsystems, Inc. All rights reserved. 230Sstevel@tonic-gate * Use is subject to license terms. 240Sstevel@tonic-gate */ 250Sstevel@tonic-gate 260Sstevel@tonic-gate #ifndef _SYS_PATTR_H 270Sstevel@tonic-gate #define _SYS_PATTR_H 280Sstevel@tonic-gate 290Sstevel@tonic-gate #ifdef __cplusplus 300Sstevel@tonic-gate extern "C" { 310Sstevel@tonic-gate #endif 320Sstevel@tonic-gate 330Sstevel@tonic-gate /* 340Sstevel@tonic-gate * Attribute types and structures. 350Sstevel@tonic-gate */ 360Sstevel@tonic-gate #define PATTR_DSTADDRSAP 0x1 /* destination physical address+SAP */ 370Sstevel@tonic-gate #define PATTR_SRCADDRSAP 0x2 /* source physical address+SAP */ 380Sstevel@tonic-gate #define PATTR_HCKSUM 0x3 /* hardware checksum attribute */ 390Sstevel@tonic-gate #define PATTR_ZCOPY 0x4 /* zerocopy attribute */ 400Sstevel@tonic-gate 410Sstevel@tonic-gate /* 420Sstevel@tonic-gate * Structure shared by {source,destination} physical address+SAP attributes. 430Sstevel@tonic-gate */ 440Sstevel@tonic-gate typedef struct pattr_addr_s { 450Sstevel@tonic-gate uint8_t addr_is_group; /* address is broadcast or multicast */ 460Sstevel@tonic-gate uint8_t addr_len; /* length of address */ 470Sstevel@tonic-gate uint8_t addr[1]; /* address */ 480Sstevel@tonic-gate } pattr_addr_t; 490Sstevel@tonic-gate 500Sstevel@tonic-gate /* 510Sstevel@tonic-gate * Structure used for Hardware Checksum attribute. 520Sstevel@tonic-gate */ 530Sstevel@tonic-gate 540Sstevel@tonic-gate typedef struct pattr_hcksum_s { 550Sstevel@tonic-gate uint32_t hcksum_start_offset; 560Sstevel@tonic-gate uint32_t hcksum_stuff_offset; 570Sstevel@tonic-gate uint32_t hcksum_end_offset; 580Sstevel@tonic-gate union { 590Sstevel@tonic-gate uint64_t value; 600Sstevel@tonic-gate uint16_t inet_cksum; /* to store H/W computed cksum value */ 610Sstevel@tonic-gate } hcksum_cksum_val; 620Sstevel@tonic-gate uint32_t hcksum_flags; 630Sstevel@tonic-gate } pattr_hcksum_t; 640Sstevel@tonic-gate 650Sstevel@tonic-gate /* 660Sstevel@tonic-gate * Values for hcksum_flags 670Sstevel@tonic-gate */ 680Sstevel@tonic-gate #define HCK_IPV4_HDRCKSUM 0x01 /* On Transmit: Compute IP header */ 690Sstevel@tonic-gate /* checksum in hardware. */ 70*11878SVenu.Iyer@Sun.COM 71*11878SVenu.Iyer@Sun.COM #define HCK_IPV4_HDRCKSUM_OK 0x01 /* On Receive: IP header checksum */ 720Sstevel@tonic-gate /* was verified by h/w and is */ 730Sstevel@tonic-gate /* correct. */ 74*11878SVenu.Iyer@Sun.COM 750Sstevel@tonic-gate #define HCK_PARTIALCKSUM 0x02 /* On Transmit: Compute partial 1's */ 760Sstevel@tonic-gate /* complement checksum based on */ 770Sstevel@tonic-gate /* start, stuff and end offsets. */ 780Sstevel@tonic-gate /* On Receive : Partial checksum */ 790Sstevel@tonic-gate /* computed and attached. */ 80*11878SVenu.Iyer@Sun.COM 810Sstevel@tonic-gate #define HCK_FULLCKSUM 0x04 /* On Transmit: Compute full(in case */ 820Sstevel@tonic-gate /* of TCP/UDP, full is pseudo-header */ 830Sstevel@tonic-gate /* + header + payload) checksum for */ 840Sstevel@tonic-gate /* this packet. */ 850Sstevel@tonic-gate /* On Receive : Full checksum */ 860Sstevel@tonic-gate /* computed in h/w and is attached */ 87*11878SVenu.Iyer@Sun.COM 880Sstevel@tonic-gate #define HCK_FULLCKSUM_OK 0x08 /* On Transmit: N/A */ 890Sstevel@tonic-gate /* On Receive: Full checksum status */ 900Sstevel@tonic-gate /* If set, implies full checksum */ 910Sstevel@tonic-gate /* computation was successful */ 920Sstevel@tonic-gate /* i.e. checksum was correct. */ 930Sstevel@tonic-gate /* If it is not set, IP will also */ 940Sstevel@tonic-gate /* check the attached h/w computed */ 950Sstevel@tonic-gate /* checksum value to determine if */ 960Sstevel@tonic-gate /* checksum was bad */ 9711042SErik.Nordmark@Sun.COM 9811042SErik.Nordmark@Sun.COM #define HCK_FLAGS (HCK_IPV4_HDRCKSUM | HCK_PARTIALCKSUM | \ 9911042SErik.Nordmark@Sun.COM HCK_FULLCKSUM | HCK_FULLCKSUM_OK) 1003115Syl150051 /* 1013115Syl150051 * Extended hardware offloading flags that also use hcksum_flags 1023115Syl150051 */ 1033115Syl150051 #define HW_LSO 0x10 /* On Transmit: hardware does LSO */ 1043115Syl150051 /* On Receive: N/A */ 1053115Syl150051 10611469SRoamer@Sun.COM #define HW_LSO_FLAGS HW_LSO /* All LSO flags, currently only one */ 1070Sstevel@tonic-gate 1080Sstevel@tonic-gate /* 1090Sstevel@tonic-gate * Structure used for zerocopy attribute. 1100Sstevel@tonic-gate */ 1110Sstevel@tonic-gate typedef struct pattr_zcopy_s { 1120Sstevel@tonic-gate uint_t zcopy_flags; 1130Sstevel@tonic-gate } pattr_zcopy_t; 1140Sstevel@tonic-gate 1150Sstevel@tonic-gate #ifdef __cplusplus 1160Sstevel@tonic-gate } 1170Sstevel@tonic-gate #endif 1180Sstevel@tonic-gate 1190Sstevel@tonic-gate #endif /* _SYS_PATTR_H */ 120