Chris Metcalf | e5a0693 | 2010-11-01 17:00:37 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2010 Tilera Corporation. All Rights Reserved. |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License |
| 6 | * as published by the Free Software Foundation, version 2. |
| 7 | * |
| 8 | * This program is distributed in the hope that it will be useful, but |
| 9 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or |
| 11 | * NON INFRINGEMENT. See the GNU General Public License for |
| 12 | * more details. |
| 13 | */ |
| 14 | |
| 15 | /** |
| 16 | * Error codes returned from NetIO routines. |
| 17 | */ |
| 18 | |
| 19 | #ifndef __NETIO_ERRORS_H__ |
| 20 | #define __NETIO_ERRORS_H__ |
| 21 | |
| 22 | /** |
| 23 | * @addtogroup error |
| 24 | * |
| 25 | * @brief The error codes returned by NetIO functions. |
| 26 | * |
| 27 | * NetIO functions return 0 (defined as ::NETIO_NO_ERROR) on success, and |
| 28 | * a negative value if an error occurs. |
| 29 | * |
| 30 | * In cases where a NetIO function failed due to a error reported by |
| 31 | * system libraries, the error code will be the negation of the |
| 32 | * system errno at the time of failure. The @ref netio_strerror() |
| 33 | * function will deliver error strings for both NetIO and system error |
| 34 | * codes. |
| 35 | * |
| 36 | * @{ |
| 37 | */ |
| 38 | |
| 39 | /** The set of all NetIO errors. */ |
| 40 | typedef enum |
| 41 | { |
| 42 | /** Operation successfully completed. */ |
| 43 | NETIO_NO_ERROR = 0, |
| 44 | |
| 45 | /** A packet was successfully retrieved from an input queue. */ |
| 46 | NETIO_PKT = 0, |
| 47 | |
| 48 | /** Largest NetIO error number. */ |
| 49 | NETIO_ERR_MAX = -701, |
| 50 | |
| 51 | /** The tile is not registered with the IPP. */ |
| 52 | NETIO_NOT_REGISTERED = -701, |
| 53 | |
| 54 | /** No packet was available to retrieve from the input queue. */ |
| 55 | NETIO_NOPKT = -702, |
| 56 | |
| 57 | /** The requested function is not implemented. */ |
| 58 | NETIO_NOT_IMPLEMENTED = -703, |
| 59 | |
| 60 | /** On a registration operation, the target queue already has the maximum |
| 61 | * number of tiles registered for it, and no more may be added. On a |
| 62 | * packet send operation, the output queue is full and nothing more can |
| 63 | * be queued until some of the queued packets are actually transmitted. */ |
| 64 | NETIO_QUEUE_FULL = -704, |
| 65 | |
| 66 | /** The calling process or thread is not bound to exactly one CPU. */ |
| 67 | NETIO_BAD_AFFINITY = -705, |
| 68 | |
| 69 | /** Cannot allocate memory on requested controllers. */ |
| 70 | NETIO_CANNOT_HOME = -706, |
| 71 | |
| 72 | /** On a registration operation, the IPP specified is not configured |
| 73 | * to support the options requested; for instance, the application |
| 74 | * wants a specific type of tagged headers which the configured IPP |
| 75 | * doesn't support. Or, the supplied configuration information is |
| 76 | * not self-consistent, or is out of range; for instance, specifying |
| 77 | * both NETIO_RECV and NETIO_NO_RECV, or asking for more than |
| 78 | * NETIO_MAX_SEND_BUFFERS to be preallocated. On a VLAN or bucket |
| 79 | * configure operation, the number of items, or the base item, was |
| 80 | * out of range. |
| 81 | */ |
| 82 | NETIO_BAD_CONFIG = -707, |
| 83 | |
| 84 | /** Too many tiles have registered to transmit packets. */ |
| 85 | NETIO_TOOMANY_XMIT = -708, |
| 86 | |
| 87 | /** Packet transmission was attempted on a queue which was registered |
| 88 | with transmit disabled. */ |
| 89 | NETIO_UNREG_XMIT = -709, |
| 90 | |
| 91 | /** This tile is already registered with the IPP. */ |
| 92 | NETIO_ALREADY_REGISTERED = -710, |
| 93 | |
| 94 | /** The Ethernet link is down. The application should try again later. */ |
| 95 | NETIO_LINK_DOWN = -711, |
| 96 | |
| 97 | /** An invalid memory buffer has been specified. This may be an unmapped |
| 98 | * virtual address, or one which does not meet alignment requirements. |
| 99 | * For netio_input_register(), this error may be returned when multiple |
| 100 | * processes specify different memory regions to be used for NetIO |
| 101 | * buffers. That can happen if these processes specify explicit memory |
| 102 | * regions with the ::NETIO_FIXED_BUFFER_VA flag, or if tmc_cmem_init() |
| 103 | * has not been called by a common ancestor of the processes. |
| 104 | */ |
| 105 | NETIO_FAULT = -712, |
| 106 | |
| 107 | /** Cannot combine user-managed shared memory and cache coherence. */ |
| 108 | NETIO_BAD_CACHE_CONFIG = -713, |
| 109 | |
| 110 | /** Smallest NetIO error number. */ |
| 111 | NETIO_ERR_MIN = -713, |
| 112 | |
| 113 | #ifndef __DOXYGEN__ |
| 114 | /** Used internally to mean that no response is needed; never returned to |
| 115 | * an application. */ |
| 116 | NETIO_NO_RESPONSE = 1 |
| 117 | #endif |
| 118 | } netio_error_t; |
| 119 | |
| 120 | /** @} */ |
| 121 | |
| 122 | #endif /* __NETIO_ERRORS_H__ */ |