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 2003 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #ifndef _SYS_IB_IB_TYPES_H 28 #define _SYS_IB_IB_TYPES_H 29 30 #pragma ident "%Z%%M% %I% %E% SMI" 31 32 /* 33 * ib_types.h 34 * 35 * Data definitions for all IBTA primitive data types. 36 */ 37 #include <sys/types.h> 38 39 #ifdef __cplusplus 40 extern "C" { 41 #endif 42 43 44 /* 45 * Addressing types 46 * See Chapter 4 of the IBTA Volume 1 IB specification for more details. 47 */ 48 #define IB_EUI64_COMPANYID_MASK 0x0000000000FFFFFF 49 #define IB_EUI64_COMPANYID_SHIFT 40 50 #define IB_EUI64_IDENTIFIER_MASK 0x000000FFFFFFFFFF 51 52 /* LID Ranges */ 53 #define IB_LID_UC_FIRST 0x0001 54 #define IB_LID_UC_LAST 0xBFFF 55 #define IB_LID_MC_FIRST 0xC000 56 #define IB_LID_MC_LAST 0xFFFE 57 #define IB_LID_PERMISSIVE 0xFFFF 58 59 /* Unicast GID & Multicast GID */ 60 typedef uint64_t ib_guid_t; /* EUI-64 GUID */ 61 typedef uint64_t ib_sn_prefix_t; /* Subnet Prefix */ 62 63 typedef struct ib_ucast_gid_s { 64 ib_sn_prefix_t ugid_prefix; /* GID prefix */ 65 ib_guid_t ugid_guid; /* Port GUID */ 66 } ib_ucast_gid_t; 67 68 typedef struct ib_mcast_gid_s { 69 uint32_t mcast_gid_prefix; /* flags, scope, and signature */ 70 uint8_t mcast_gid_bytes[12]; 71 } ib_mcast_gid_t; 72 73 typedef struct ib_gid_s { 74 union { 75 ib_ucast_gid_t ucast_gid; /* unicast gid */ 76 ib_mcast_gid_t mcast_gid; /* multicast gid */ 77 } gid; 78 } ib_gid_t; 79 80 #define gid_prefix gid.ucast_gid.ugid_prefix 81 #define gid_guid gid.ucast_gid.ugid_guid 82 83 #define mgid_prefix gid.mcast_gid.mcast_gid_prefix 84 #define mgid_bytes gid.mcast_gid.mcast_gid_bytes 85 86 #define IB_GID_DEFAULT_PREFIX 0xFE80000000000000 87 #define IB_GID_SUBNET_LOCAL_PREFIX IB_GID_DEFAULT_PREFIX 88 #define IB_GID_SITE_LOCAL_PREFIX 0xFEC0000000000000 89 #define IB_GID_SITE_LOCAL_SUBNET_MASK 0x000000000000FFFF 90 91 /* Multicast GID. */ 92 #define IB_MCGID_PREFIX 0xFF000000 93 #define IB_MCGID_TRANSIENT_FLAG 0x00100000 94 95 /* Multicast Address Scope. */ 96 #define IB_MC_SCOPE_SUBNET_LOCAL 0x02 97 #define IB_MC_SCOPE_SITE_LOCAL 0x05 98 #define IB_MC_SCOPE_ORG_LOCAL 0x08 99 #define IB_MC_SCOPE_GLOBAL 0x0E 100 101 /* Multicast Join State. */ 102 #define IB_MC_JSTATE_FULL 0x01 /* Full Member */ 103 #define IB_MC_JSTATE_NON 0x02 /* Non Member */ 104 #define IB_MC_JSTATE_SEND_ONLY_NON 0x04 /* Send Only Non Member */ 105 106 #define IB_MC_QPN 0xFFFFFF /* Multicast QPN */ 107 108 /* 109 * IP-on-IB Multicast GIDs 110 * 111 * IPV4 gid_prefix: 112 * IB_MCGID_IPV4_PREFIX 113 * IB_MCGID_SCOPE_MASK 114 * IB_MCGID_IP_PKEY_MASK 115 * IPV4 gid_guid: 116 * IB_MCGID_IPV4_LOW_GROUP_MASK 117 * 118 * IPV6 gid_prefix: 119 * IB_MCGID_IPV6_PREFIX 120 * IB_MCGID_SCOPE_MASK 121 * IB_MCGID_IP_PKEY_MASK 122 * IB_MCGID_IPV6_HI_GROUP_MASK 123 * IPV6 gid_guid: 124 * entire gid_guid holds low part of group ID 125 */ 126 #define IB_MCGID_IPV4_PREFIX 0xFF10401B 127 #define IB_MCGID_IPV6_PREFIX 0xFF10601B 128 #define IB_MCGID_SA_PREFIX 0xFF10A01B 129 130 typedef uint16_t ib_lid_t; /* Port Local ID (LID) */ 131 typedef uint8_t ib_path_bits_t; /* From 0 to 7 low order bits of LID */ 132 133 /* 134 * PKeys and QKeys 135 */ 136 #define IB_PKEY_DEFAULT_FULL 0xFFFF 137 #define IB_PKEY_DEFAULT_LIMITED 0x7FFF 138 #define IB_PKEY_INVALID_FULL 0x8000 139 #define IB_PKEY_INVALID_LIMITED 0x0000 140 #define IB_GSI_QKEY 0x80010000 141 #define IB_PRIVILEGED_QKEY_BIT 0x80000000 142 143 typedef uint16_t ib_pkey_t; /* P_Key */ 144 typedef uint32_t ib_qkey_t; /* Q_Key */ 145 typedef uint16_t ib_pkey_cntr_t; 146 typedef uint16_t ib_qkey_cntr_t; 147 148 /* 149 * General IBT types 150 */ 151 typedef uint64_t ib_smkey_t; /* subnet manager key */ 152 153 typedef uint16_t ib_ethertype_t; /* Ethertype */ 154 typedef uint32_t ib_qpn_t; /* 24 bit QP number */ 155 typedef uint32_t ib_eecn_t; /* 24 bit EEC number */ 156 157 #define IB_QPN_MASK 0xFFFFFF 158 159 typedef uint32_t ib_msglen_t; /* message length */ 160 161 typedef uint64_t ib_vaddr_t; /* registered memory Virtual Address */ 162 typedef uint64_t ib_memlen_t; /* registered memory length */ 163 164 typedef uint64_t ib_svc_id_t; /* CM Service ID */ 165 166 #define IB_SVC_NAME_LEN 64 /* Maximum length of Service Name, */ 167 /* which includes a terminating NULL */ 168 #define IB_SVC_DATA_LEN 64 /* Length of Service Data */ 169 170 /* MTU Size */ 171 typedef enum { 172 IB_MTU_NOT_SPECIFIED = 0, 173 IB_MTU_256 = 1, /* 256 bytes */ 174 IB_MTU_512 = 2, /* 512 bytes */ 175 IB_MTU_1K = 3, /* 1k bytes */ 176 IB_MTU_2K = 4, /* 2k bytes */ 177 IB_MTU_4K = 5 /* 4k bytes */ 178 } ib_mtu_t; 179 180 typedef uint8_t ib_time_t; /* 6 bits of timeout exponent */ 181 #define IB_TIME_EXP_MASK 0x3F /* time = 4.096us * 2 ^ exp */ 182 183 /* 184 * Infiniband Identifiers, based on Administration Group Number (AGN) codes 185 * there are different types of Service IDs which identifies the group. 186 * The first byte of the Service ID comprises of AGN field and following 187 * specifies the values for AGN field. 188 * 189 * 0x0 - IBTA assigned Ids (WellKnown) 190 * 0x1 - IETF (any category) 191 * 0x2 - Locally assigned Ids with limited cacheability 192 * 0x10 to 0x1f - External Organizations assigned Ids (Well Known) 193 * others - Reserved 194 */ 195 #define IB_SID_MASK 0x00FFFFFFFFFFFFFF 196 #define IB_SID_AGN_MASK 0xFF00000000000000 197 198 #define IB_SID_AGN_IBTA 0x0000000000000000 199 #define IB_SID_AGN_IETF 0x0100000000000000 200 #define IB_SID_AGN_LOCAL 0x0200000000000000 201 202 #ifdef __cplusplus 203 } 204 #endif 205 206 #endif /* _SYS_IB_IB_TYPES_H */ 207