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 58347601bSyl150051 * Common Development and Distribution License (the "License"). 68347601bSyl150051 * 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 /* 221908fb0eSRoamer * Copyright 2010 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 #ifdef __cplusplus 307c478bd9Sstevel@tonic-gate extern "C" { 317c478bd9Sstevel@tonic-gate #endif 327c478bd9Sstevel@tonic-gate 337c478bd9Sstevel@tonic-gate /* 347c478bd9Sstevel@tonic-gate * Attribute types and structures. 357c478bd9Sstevel@tonic-gate */ 367c478bd9Sstevel@tonic-gate #define PATTR_DSTADDRSAP 0x1 /* destination physical address+SAP */ 377c478bd9Sstevel@tonic-gate #define PATTR_SRCADDRSAP 0x2 /* source physical address+SAP */ 387c478bd9Sstevel@tonic-gate #define PATTR_HCKSUM 0x3 /* hardware checksum attribute */ 397c478bd9Sstevel@tonic-gate #define PATTR_ZCOPY 0x4 /* zerocopy attribute */ 407c478bd9Sstevel@tonic-gate 417c478bd9Sstevel@tonic-gate /* 427c478bd9Sstevel@tonic-gate * Structure shared by {source,destination} physical address+SAP attributes. 437c478bd9Sstevel@tonic-gate */ 447c478bd9Sstevel@tonic-gate typedef struct pattr_addr_s { 457c478bd9Sstevel@tonic-gate uint8_t addr_is_group; /* address is broadcast or multicast */ 467c478bd9Sstevel@tonic-gate uint8_t addr_len; /* length of address */ 477c478bd9Sstevel@tonic-gate uint8_t addr[1]; /* address */ 487c478bd9Sstevel@tonic-gate } pattr_addr_t; 497c478bd9Sstevel@tonic-gate 507c478bd9Sstevel@tonic-gate /* 517c478bd9Sstevel@tonic-gate * Structure used for Hardware Checksum attribute. 527c478bd9Sstevel@tonic-gate */ 537c478bd9Sstevel@tonic-gate 547c478bd9Sstevel@tonic-gate typedef struct pattr_hcksum_s { 557c478bd9Sstevel@tonic-gate uint32_t hcksum_start_offset; 567c478bd9Sstevel@tonic-gate uint32_t hcksum_stuff_offset; 577c478bd9Sstevel@tonic-gate uint32_t hcksum_end_offset; 587c478bd9Sstevel@tonic-gate union { 597c478bd9Sstevel@tonic-gate uint64_t value; 607c478bd9Sstevel@tonic-gate uint16_t inet_cksum; /* to store H/W computed cksum value */ 617c478bd9Sstevel@tonic-gate } hcksum_cksum_val; 627c478bd9Sstevel@tonic-gate uint32_t hcksum_flags; 637c478bd9Sstevel@tonic-gate } pattr_hcksum_t; 647c478bd9Sstevel@tonic-gate 657c478bd9Sstevel@tonic-gate /* 667c478bd9Sstevel@tonic-gate * Values for hcksum_flags 677c478bd9Sstevel@tonic-gate */ 687c478bd9Sstevel@tonic-gate #define HCK_IPV4_HDRCKSUM 0x01 /* On Transmit: Compute IP header */ 697c478bd9Sstevel@tonic-gate /* checksum in hardware. */ 70*0dc2366fSVenugopal Iyer 71*0dc2366fSVenugopal Iyer #define HCK_IPV4_HDRCKSUM_OK 0x01 /* On Receive: IP header checksum */ 727c478bd9Sstevel@tonic-gate /* was verified by h/w and is */ 737c478bd9Sstevel@tonic-gate /* correct. */ 74*0dc2366fSVenugopal Iyer 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. */ 80*0dc2366fSVenugopal Iyer 817c478bd9Sstevel@tonic-gate #define HCK_FULLCKSUM 0x04 /* On Transmit: Compute full(in case */ 827c478bd9Sstevel@tonic-gate /* of TCP/UDP, full is pseudo-header */ 837c478bd9Sstevel@tonic-gate /* + header + payload) checksum for */ 847c478bd9Sstevel@tonic-gate /* this packet. */ 857c478bd9Sstevel@tonic-gate /* On Receive : Full checksum */ 867c478bd9Sstevel@tonic-gate /* computed in h/w and is attached */ 87*0dc2366fSVenugopal Iyer 887c478bd9Sstevel@tonic-gate #define HCK_FULLCKSUM_OK 0x08 /* On Transmit: N/A */ 897c478bd9Sstevel@tonic-gate /* On Receive: Full checksum status */ 907c478bd9Sstevel@tonic-gate /* If set, implies full checksum */ 917c478bd9Sstevel@tonic-gate /* computation was successful */ 927c478bd9Sstevel@tonic-gate /* i.e. checksum was correct. */ 937c478bd9Sstevel@tonic-gate /* If it is not set, IP will also */ 947c478bd9Sstevel@tonic-gate /* check the attached h/w computed */ 957c478bd9Sstevel@tonic-gate /* checksum value to determine if */ 967c478bd9Sstevel@tonic-gate /* checksum was bad */ 97bd670b35SErik Nordmark 98bd670b35SErik Nordmark #define HCK_FLAGS (HCK_IPV4_HDRCKSUM | HCK_PARTIALCKSUM | \ 99bd670b35SErik Nordmark HCK_FULLCKSUM | HCK_FULLCKSUM_OK) 1008347601bSyl150051 /* 1018347601bSyl150051 * Extended hardware offloading flags that also use hcksum_flags 1028347601bSyl150051 */ 1038347601bSyl150051 #define HW_LSO 0x10 /* On Transmit: hardware does LSO */ 1048347601bSyl150051 /* On Receive: N/A */ 1058347601bSyl150051 1061908fb0eSRoamer #define HW_LSO_FLAGS HW_LSO /* All LSO flags, currently only one */ 1077c478bd9Sstevel@tonic-gate 1087c478bd9Sstevel@tonic-gate /* 1097c478bd9Sstevel@tonic-gate * Structure used for zerocopy attribute. 1107c478bd9Sstevel@tonic-gate */ 1117c478bd9Sstevel@tonic-gate typedef struct pattr_zcopy_s { 1127c478bd9Sstevel@tonic-gate uint_t zcopy_flags; 1137c478bd9Sstevel@tonic-gate } pattr_zcopy_t; 1147c478bd9Sstevel@tonic-gate 1157c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1167c478bd9Sstevel@tonic-gate } 1177c478bd9Sstevel@tonic-gate #endif 1187c478bd9Sstevel@tonic-gate 1197c478bd9Sstevel@tonic-gate #endif /* _SYS_PATTR_H */ 120