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 (c) 2002-2004, Network Appliance, Inc. All rights reserved. 24 */ 25 26 /* 27 * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 28 * Use is subject to license terms. 29 */ 30 31 #ifndef _DAT_ERROR_H_ 32 #define _DAT_ERROR_H_ 33 34 #pragma ident "%Z%%M% %I% %E% SMI" 35 36 /* 37 * 38 * HEADER: dat_error.h 39 * 40 * PURPOSE: DAT return codes 41 * 42 * Description: Header file for "uDAPL: User Direct Access Programming 43 * Library, Version: 1.2" 44 * 45 * Mapping rules: 46 * Error types are compound types, as mapped out below. 47 * 48 * 49 */ 50 51 #ifdef __cplusplus 52 extern "C" { 53 #endif 54 55 /* 56 * 57 * All return codes are actually a 3-way tuple: 58 * 59 * type: DAT_RETURN_CLASS DAT_RETURN_TYPE DAT_RETURN_SUBTYPE 60 * bits: 31-30 29-16 15-0 61 * 62 * +----------------------------------------------------------------------+ 63 * |3130 | 29282726252423222120191817 | 1615141312111009080706054003020100| 64 * |CLAS | DAT_TYPE_STATUS | SUBTYPE_STATUS | 65 * +----------------------------------------------------------------------+ 66 */ 67 68 /* 69 * Class Bits 70 */ 71 #define DAT_CLASS_ERROR 0x80000000 72 #define DAT_CLASS_WARNING 0x40000000 73 #define DAT_CLASS_SUCCESS 0x00000000 74 75 /* 76 * DAT Error bits 77 */ 78 #define DAT_TYPE_MASK 0x3fff0000 /* mask for DAT_TYPE_STATUS bits */ 79 #define DAT_SUBTYPE_MASK 0x0000FFFF /* mask for DAT_SUBTYPE_STATUS bits */ 80 81 /* 82 * Determining the success of an operation is best done with a macro; 83 * each of these returns a boolean value. 84 */ 85 #define DAT_IS_WARNING(status) ((DAT_UINT32)(status) & DAT_CLASS_WARNING) 86 87 #define DAT_GET_TYPE(status) ((DAT_UINT32)(status) & DAT_TYPE_MASK) 88 #define DAT_GET_SUBTYPE(status) ((DAT_UINT32)(status) & DAT_SUBTYPE_MASK) 89 90 /* 91 * DAT return types. The ERROR bit is enabled for these definitions 92 */ 93 typedef enum dat_return_type 94 { 95 /* The operation was successful. */ 96 DAT_SUCCESS = 0x000000, 97 98 /* 99 * The operation was aborted because IA was closed or EVD was 100 * destroyed. 101 */ 102 DAT_ABORT = 0x00010000, 103 104 /* The specified Connection Qualifier was in use. */ 105 DAT_CONN_QUAL_IN_USE = 0x00020000, 106 107 /* The operation failed due to resource limitations. */ 108 DAT_INSUFFICIENT_RESOURCES = 0x00030000, 109 110 /* 111 * Provider internal error. This error can be returned by any 112 * operation when the Provider have detected an internal error. 113 * This error does no mask any error causes by Consumer. 114 */ 115 DAT_INTERNAL_ERROR = 0x00040000, 116 117 /* One of the DAT handles was invalid. */ 118 DAT_INVALID_HANDLE = 0x00050000, 119 120 /* One of the parameters was invalid. */ 121 DAT_INVALID_PARAMETER = 0x00060000, 122 123 /* 124 * One of the parameters was invalid for this operation. There 125 * are Event Streams associated with the Event Dispatcher feeding 126 * it. 127 */ 128 DAT_INVALID_STATE = 0x00070000, 129 130 /* 131 * The size of the receiving buffer is too small for sending 132 * buffer data. The size of the local buffer is too small for 133 * the data of the remote buffer. 134 */ 135 DAT_LENGTH_ERROR = 0x00080000, 136 137 /* The requested Model was not supported by the Provider. */ 138 DAT_MODEL_NOT_SUPPORTED = 0x00090000, 139 140 /* 141 * The provider name or specified attributes are not found in 142 * the registry. 143 */ 144 145 DAT_PROVIDER_NOT_FOUND = 0x000A0000, 146 147 /* 148 * Protection violation for local or remote memory 149 * access. Protection Zone mismatch between an LMR of one of the 150 * local_iov segments and the local Endpoint. 151 */ 152 DAT_PRIVILEGES_VIOLATION = 0x000B0000, 153 154 /* 155 * Privileges violation for local or re-mote memory access. One 156 * of the LMRs used in local_iov was either invalid or did not 157 * have the local read privileges. 158 */ 159 DAT_PROTECTION_VIOLATION = 0x000C0000, 160 161 /* The operation timed out without a notification. */ 162 DAT_QUEUE_EMPTY = 0x000D0000, 163 164 /* The Event Dispatcher queue is full. */ 165 DAT_QUEUE_FULL = 0x000E0000, 166 167 /* The operation timed out. UDAPL ONLY */ 168 DAT_TIMEOUT_EXPIRED = 0x000F0000, 169 170 /* The provider name was already registered */ 171 DAT_PROVIDER_ALREADY_REGISTERED = 0x00100000, 172 173 /* The provider is "in-use" and cannot be closed at this time */ 174 DAT_PROVIDER_IN_USE = 0x00110000, 175 176 /* The requested remote address is not valid or not reachable */ 177 DAT_INVALID_ADDRESS = 0x00120000, 178 179 /* [Unix only] dat_evd_wait or dat_cno_wait has been interrupted. */ 180 DAT_INTERRUPTED_CALL = 0x00130000, 181 182 /* No Connection Qualifiers are available */ 183 DAT_CONN_QUAL_UNAVAILABLE = 0x00140000, 184 185 /* Provider does not support the operation yet. */ 186 DAT_NOT_IMPLEMENTED = 0x0FFF0000 187 188 } DAT_RETURN_TYPE; 189 190 typedef DAT_UINT32 DAT_RETURN; 191 192 /* Backwared compatibility with DAT 1.0 */ 193 #define DAT_NAME_NOT_FOUND DAT_PROVIDER_NOT_FOUND 194 195 /* 196 * DAT_RETURN_SUBTYPE listing 197 */ 198 199 typedef enum dat_return_subtype 200 { 201 /* First element is no subtype */ 202 DAT_NO_SUBTYPE, 203 /* ABORT sub types */ 204 /* call was interrupted by a signal, or otherwise */ 205 DAT_SUB_INTERRUPTED, 206 207 /* DAT_CONN_QUAL_IN_USE has no subtypes */ 208 209 /* INSUFFICIENT_RESOURCES subtypes */ 210 DAT_RESOURCE_MEMORY, 211 DAT_RESOURCE_DEVICE, 212 DAT_RESOURCE_TEP, /* transport endpoint, e.g. QP */ 213 DAT_RESOURCE_TEVD, /* transport EVD, e.g. CQ */ 214 DAT_RESOURCE_PROTECTION_DOMAIN, 215 DAT_RESOURCE_MEMORY_REGION, /* HCA memory for LMR or RMR */ 216 DAT_RESOURCE_ERROR_HANDLER, 217 DAT_RESOURCE_CREDITS, /* e.g outstanding RDMA Read credit as target */ 218 DAT_RESOURCE_SRQ, 219 220 /* DAT_INTERNAL_ERROR has no subtypes */ 221 222 /* INVALID_HANDLE subtypes */ 223 DAT_INVALID_HANDLE_IA, 224 DAT_INVALID_HANDLE_EP, 225 DAT_INVALID_HANDLE_LMR, 226 DAT_INVALID_HANDLE_RMR, 227 DAT_INVALID_HANDLE_PZ, 228 DAT_INVALID_HANDLE_PSP, 229 DAT_INVALID_HANDLE_RSP, 230 DAT_INVALID_HANDLE_CR, 231 DAT_INVALID_HANDLE_CNO, 232 DAT_INVALID_HANDLE_EVD_CR, 233 DAT_INVALID_HANDLE_EVD_REQUEST, 234 DAT_INVALID_HANDLE_EVD_RECV, 235 DAT_INVALID_HANDLE_EVD_CONN, 236 DAT_INVALID_HANDLE_EVD_ASYNC, 237 DAT_INVALID_HANDLE_SRQ, 238 DAT_INVALID_HANDLE1, 239 DAT_INVALID_HANDLE2, 240 DAT_INVALID_HANDLE3, 241 DAT_INVALID_HANDLE4, 242 DAT_INVALID_HANDLE5, 243 DAT_INVALID_HANDLE6, 244 DAT_INVALID_HANDLE7, 245 DAT_INVALID_HANDLE8, 246 DAT_INVALID_HANDLE9, 247 DAT_INVALID_HANDLE10, 248 249 /* DAT_INVALID_PARAMETER subtypes */ 250 DAT_INVALID_ARG1, 251 DAT_INVALID_ARG2, 252 DAT_INVALID_ARG3, 253 DAT_INVALID_ARG4, 254 DAT_INVALID_ARG5, 255 DAT_INVALID_ARG6, 256 DAT_INVALID_ARG7, 257 DAT_INVALID_ARG8, 258 DAT_INVALID_ARG9, 259 DAT_INVALID_ARG10, 260 261 /* DAT_INVALID_EP_STATE subtypes */ 262 DAT_INVALID_STATE_EP_UNCONNECTED, 263 DAT_INVALID_STATE_EP_ACTCONNPENDING, 264 DAT_INVALID_STATE_EP_PASSCONNPENDING, 265 DAT_INVALID_STATE_EP_TENTCONNPENDING, 266 DAT_INVALID_STATE_EP_CONNECTED, 267 DAT_INVALID_STATE_EP_DISCONNECTED, 268 DAT_INVALID_STATE_EP_RESERVED, 269 DAT_INVALID_STATE_EP_COMPLPENDING, 270 DAT_INVALID_STATE_EP_DISCPENDING, 271 DAT_INVALID_STATE_EP_PROVIDERCONTROL, 272 DAT_INVALID_STATE_EP_NOTREADY, 273 DAT_INVALID_STATE_EP_RECV_WATERMARK, 274 DAT_INVALID_STATE_EP_PZ, 275 DAT_INVALID_STATE_EP_EVD_REQUEST, 276 DAT_INVALID_STATE_EP_EVD_RECV, 277 DAT_INVALID_STATE_EP_EVD_CONNECT, 278 DAT_INVALID_STATE_EP_UNCONFIGURED, 279 DAT_INVALID_STATE_EP_UNCONFRESERVED, 280 DAT_INVALID_STATE_EP_UNCONFPASSIVE, 281 DAT_INVALID_STATE_EP_UNCONFTENTATIVE, 282 283 DAT_INVALID_STATE_CNO_IN_USE, 284 DAT_INVALID_STATE_CNO_DEAD, 285 286 /* 287 * EVD states. Enabled/Disabled, Waitable/Unwaitable, 288 * and Notify/Solicited/Threshold are 3 orthogonal 289 * bands of EVD state.The Threshold one is uDAPL specific. 290 */ 291 DAT_INVALID_STATE_EVD_OPEN, 292 /* 293 * EVD can be either in enabled or disabled but not both 294 * or neither at the same time 295 */ 296 DAT_INVALID_STATE_EVD_ENABLED, 297 DAT_INVALID_STATE_EVD_DISABLED, 298 /* 299 * EVD can be either in waitable or unwaitable but not 300 * both or neither at the same time 301 */ 302 DAT_INVALID_STATE_EVD_WAITABLE, 303 DAT_INVALID_STATE_EVD_UNWAITABLE, 304 /* Do not release an EVD if it is in use */ 305 DAT_INVALID_STATE_EVD_IN_USE, 306 307 /* 308 * EVD can be either in notify or solicited or threshold 309 * but not any pair, or all, or none at the same time. 310 * The threshold one is for uDAPL only 311 */ 312 DAT_INVALID_STATE_EVD_CONFIG_NOTIFY, 313 DAT_INVALID_STATE_EVD_CONFIG_SOLICITED, 314 DAT_INVALID_STATE_EVD_CONFIG_THRESHOLD, 315 DAT_INVALID_STATE_EVD_WAITER, 316 DAT_INVALID_STATE_EVD_ASYNC, /* Async EVD required */ 317 DAT_INVALID_STATE_IA_IN_USE, 318 DAT_INVALID_STATE_LMR_IN_USE, 319 DAT_INVALID_STATE_LMR_FREE, 320 DAT_INVALID_STATE_PZ_IN_USE, 321 DAT_INVALID_STATE_PZ_FREE, 322 323 /* DAT_INVALID_STATE_SRQ subtypes */ 324 DAT_INVALID_STATE_SRQ_OPERATIONAL, 325 DAT_INVALID_STATE_SRQ_ERROR, 326 DAT_INVALID_STATE_SRQ_IN_USE, 327 328 /* DAT_LENGTH_ERROR has no subtypes */ 329 /* DAT_MODEL_NOT_SUPPORTED has no subtypes */ 330 331 /* DAT_PRIVILEGES_VIOLATION subtypes */ 332 DAT_PRIVILEGES_READ, 333 DAT_PRIVILEGES_WRITE, 334 DAT_PRIVILEGES_RDMA_READ, 335 DAT_PRIVILEGES_RDMA_WRITE, 336 337 /* DAT_PROTECTION_VIOLATION subtypes */ 338 DAT_PROTECTION_READ, 339 DAT_PROTECTION_WRITE, 340 DAT_PROTECTION_RDMA_READ, 341 DAT_PROTECTION_RDMA_WRITE, 342 343 /* DAT_QUEUE_EMPTY has no subtypes */ 344 /* DAT_QUEUE_FULL has no subtypes */ 345 /* DAT_TIMEOUT_EXPIRED has no subtypes */ 346 /* DAT_PROVIDER_ALREADY_REGISTERED has no subtypes */ 347 /* DAT_PROVIDER_IN_USE has no subtypes */ 348 349 /* DAT_INVALID_ADDRESS subtypes */ 350 /* 351 * Unsupported addresses - those that are not Malformed, 352 * but are incorrect for use in DAT (regardless of local 353 * routing capabilities): IPv6 Multicast Addresses (ff/8) 354 * IPv4 Broadcast/Multicast Addresses 355 */ 356 DAT_INVALID_ADDRESS_UNSUPPORTED, 357 /* 358 * Unreachable addresses - A Provider may know that certain 359 * addresses are unreachable immediately. One examples would 360 * be an IPv6 addresses on an IPv4-only system. This may also 361 * be returned if it is known that there is no route to the 362 * host. A Provider is not obligated to check for this 363 * condition. 364 */ 365 DAT_INVALID_ADDRESS_UNREACHABLE, 366 /* 367 * Malformed addresses -- these cannot be valid in any context. 368 * Those listed in RFC1884 section 2.3 as "Reserved" or 369 * "Unassigned". 370 */ 371 DAT_INVALID_ADDRESS_MALFORMED, 372 373 /* DAT_INTERRUPTED_CALL has no subtypes */ 374 /* DAT_CONN_QUAL_UNAVAILABLE has no subtypes */ 375 376 /* DAT_PROVIDER_NOT_FOUND subtypes. Erratta to the 1.1 spec */ 377 DAT_NAME_NOT_REGISTERED, 378 DAT_MAJOR_NOT_FOUND, 379 DAT_MINOR_NOT_FOUND, 380 DAT_THREAD_SAFETY_NOT_FOUND 381 382 } DAT_RETURN_SUBTYPE; 383 384 #ifdef __cplusplus 385 } 386 #endif 387 388 #endif /* _DAT_ERROR_H_ */ 389