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. 24*c61a1653SRyan Zezeski * Copyright 2019 Joyent, Inc. 257c478bd9Sstevel@tonic-gate */ 267c478bd9Sstevel@tonic-gate 277c478bd9Sstevel@tonic-gate #ifndef _SYS_PATTR_H 287c478bd9Sstevel@tonic-gate #define _SYS_PATTR_H 297c478bd9Sstevel@tonic-gate 307c478bd9Sstevel@tonic-gate #ifdef __cplusplus 317c478bd9Sstevel@tonic-gate extern "C" { 327c478bd9Sstevel@tonic-gate #endif 337c478bd9Sstevel@tonic-gate 347c478bd9Sstevel@tonic-gate /* 357c478bd9Sstevel@tonic-gate * Attribute types and structures. 367c478bd9Sstevel@tonic-gate */ 377c478bd9Sstevel@tonic-gate #define PATTR_DSTADDRSAP 0x1 /* destination physical address+SAP */ 387c478bd9Sstevel@tonic-gate #define PATTR_SRCADDRSAP 0x2 /* source physical address+SAP */ 397c478bd9Sstevel@tonic-gate #define PATTR_HCKSUM 0x3 /* hardware checksum attribute */ 407c478bd9Sstevel@tonic-gate #define PATTR_ZCOPY 0x4 /* zerocopy attribute */ 417c478bd9Sstevel@tonic-gate 427c478bd9Sstevel@tonic-gate /* 437c478bd9Sstevel@tonic-gate * Structure shared by {source,destination} physical address+SAP attributes. 447c478bd9Sstevel@tonic-gate */ 457c478bd9Sstevel@tonic-gate typedef struct pattr_addr_s { 467c478bd9Sstevel@tonic-gate uint8_t addr_is_group; /* address is broadcast or multicast */ 477c478bd9Sstevel@tonic-gate uint8_t addr_len; /* length of address */ 487c478bd9Sstevel@tonic-gate uint8_t addr[1]; /* address */ 497c478bd9Sstevel@tonic-gate } pattr_addr_t; 507c478bd9Sstevel@tonic-gate 517c478bd9Sstevel@tonic-gate /* 527c478bd9Sstevel@tonic-gate * Structure used for Hardware Checksum attribute. 537c478bd9Sstevel@tonic-gate */ 547c478bd9Sstevel@tonic-gate 557c478bd9Sstevel@tonic-gate typedef struct pattr_hcksum_s { 567c478bd9Sstevel@tonic-gate uint32_t hcksum_start_offset; 577c478bd9Sstevel@tonic-gate uint32_t hcksum_stuff_offset; 587c478bd9Sstevel@tonic-gate uint32_t hcksum_end_offset; 597c478bd9Sstevel@tonic-gate union { 607c478bd9Sstevel@tonic-gate uint64_t value; 617c478bd9Sstevel@tonic-gate uint16_t inet_cksum; /* to store H/W computed cksum value */ 627c478bd9Sstevel@tonic-gate } hcksum_cksum_val; 637c478bd9Sstevel@tonic-gate uint32_t hcksum_flags; 647c478bd9Sstevel@tonic-gate } pattr_hcksum_t; 657c478bd9Sstevel@tonic-gate 667c478bd9Sstevel@tonic-gate /* 677c478bd9Sstevel@tonic-gate * Values for hcksum_flags 687c478bd9Sstevel@tonic-gate */ 697c478bd9Sstevel@tonic-gate #define HCK_IPV4_HDRCKSUM 0x01 /* On Transmit: Compute IP header */ 707c478bd9Sstevel@tonic-gate /* checksum in hardware. */ 710dc2366fSVenugopal Iyer 720dc2366fSVenugopal Iyer #define HCK_IPV4_HDRCKSUM_OK 0x01 /* On Receive: IP header checksum */ 737c478bd9Sstevel@tonic-gate /* was verified by h/w and is */ 747c478bd9Sstevel@tonic-gate /* correct. */ 750dc2366fSVenugopal Iyer 767c478bd9Sstevel@tonic-gate #define HCK_PARTIALCKSUM 0x02 /* On Transmit: Compute partial 1's */ 777c478bd9Sstevel@tonic-gate /* complement checksum based on */ 787c478bd9Sstevel@tonic-gate /* start, stuff and end offsets. */ 797c478bd9Sstevel@tonic-gate /* On Receive : Partial checksum */ 807c478bd9Sstevel@tonic-gate /* computed and attached. */ 810dc2366fSVenugopal Iyer 827c478bd9Sstevel@tonic-gate #define HCK_FULLCKSUM 0x04 /* On Transmit: Compute full(in case */ 837c478bd9Sstevel@tonic-gate /* of TCP/UDP, full is pseudo-header */ 847c478bd9Sstevel@tonic-gate /* + header + payload) checksum for */ 857c478bd9Sstevel@tonic-gate /* this packet. */ 867c478bd9Sstevel@tonic-gate /* On Receive : Full checksum */ 877c478bd9Sstevel@tonic-gate /* computed in h/w and is attached */ 880dc2366fSVenugopal Iyer 897c478bd9Sstevel@tonic-gate #define HCK_FULLCKSUM_OK 0x08 /* On Transmit: N/A */ 907c478bd9Sstevel@tonic-gate /* On Receive: Full checksum status */ 917c478bd9Sstevel@tonic-gate /* If set, implies full checksum */ 927c478bd9Sstevel@tonic-gate /* computation was successful */ 937c478bd9Sstevel@tonic-gate /* i.e. checksum was correct. */ 947c478bd9Sstevel@tonic-gate /* If it is not set, IP will also */ 957c478bd9Sstevel@tonic-gate /* check the attached h/w computed */ 967c478bd9Sstevel@tonic-gate /* checksum value to determine if */ 977c478bd9Sstevel@tonic-gate /* checksum was bad */ 98bd670b35SErik Nordmark 99bd670b35SErik Nordmark #define HCK_FLAGS (HCK_IPV4_HDRCKSUM | HCK_PARTIALCKSUM | \ 100bd670b35SErik Nordmark HCK_FULLCKSUM | HCK_FULLCKSUM_OK) 101*c61a1653SRyan Zezeski #define HCK_TX_FLAGS (HCK_IPV4_HDRCKSUM | HCK_PARTIALCKSUM | \ 102*c61a1653SRyan Zezeski HCK_FULLCKSUM) 1038347601bSyl150051 /* 1048347601bSyl150051 * Extended hardware offloading flags that also use hcksum_flags 1058347601bSyl150051 */ 1068347601bSyl150051 #define HW_LSO 0x10 /* On Transmit: hardware does LSO */ 1078347601bSyl150051 /* On Receive: N/A */ 1088347601bSyl150051 1091908fb0eSRoamer #define HW_LSO_FLAGS HW_LSO /* All LSO flags, currently only one */ 1107c478bd9Sstevel@tonic-gate 1117c478bd9Sstevel@tonic-gate /* 1127c478bd9Sstevel@tonic-gate * Structure used for zerocopy attribute. 1137c478bd9Sstevel@tonic-gate */ 1147c478bd9Sstevel@tonic-gate typedef struct pattr_zcopy_s { 1157c478bd9Sstevel@tonic-gate uint_t zcopy_flags; 1167c478bd9Sstevel@tonic-gate } pattr_zcopy_t; 1177c478bd9Sstevel@tonic-gate 1187c478bd9Sstevel@tonic-gate #ifdef __cplusplus 1197c478bd9Sstevel@tonic-gate } 1207c478bd9Sstevel@tonic-gate #endif 1217c478bd9Sstevel@tonic-gate 1227c478bd9Sstevel@tonic-gate #endif /* _SYS_PATTR_H */ 123