--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. \r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+/*\r
+ * Abstract:\r
+ * Declaration of the asynchronous processing module.\r
+ *\r
+ * Environment:\r
+ * All\r
+ */\r
+\r
+\r
+#ifndef _CL_ASYNC_PROC_H_\r
+#define _CL_ASYNC_PROC_H_\r
+\r
+\r
+#include <complib/cl_qlist.h>\r
+#include <complib/cl_qpool.h>\r
+#include <complib/cl_threadpool.h>\r
+#include <complib/cl_spinlock.h>\r
+\r
+\r
+/****h* Component Library/Asynchronous Processor\r
+* NAME\r
+* Asynchronous Processor\r
+*\r
+* DESCRIPTION\r
+* The asynchronous processor provides threads for executing queued callbacks.\r
+*\r
+* The threads in the asynchronous processor wait for callbacks to be queued.\r
+*\r
+* The asynchronous processor functions operate on a cl_async_proc_t structure\r
+* which should be treated as opaque and manipulated only through the provided\r
+* functions.\r
+*\r
+* SEE ALSO\r
+* Structures:\r
+* cl_async_proc_t, cl_async_proc_item_t\r
+*\r
+* Initialization:\r
+* cl_async_proc_construct, cl_async_proc_init, cl_async_proc_destroy\r
+*\r
+* Manipulation:\r
+* cl_async_proc_queue\r
+*********/\r
+\r
+\r
+/****s* Component Library: Asynchronous Processor/cl_async_proc_t\r
+* NAME\r
+* cl_async_proc_t\r
+*\r
+* DESCRIPTION\r
+* Asynchronous processor structure.\r
+*\r
+* The cl_async_proc_t structure should be treated as opaque, and should be\r
+* manipulated only through the provided functions.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _cl_async_proc\r
+{\r
+ cl_thread_pool_t thread_pool;\r
+ cl_qlist_t item_queue;\r
+ cl_spinlock_t lock;\r
+ cl_state_t state;\r
+\r
+} cl_async_proc_t;\r
+/*\r
+* FIELDS\r
+* item_pool\r
+* Pool of items storing the callback function and contexts to be invoked\r
+* by the asynchronous processor's threads.\r
+*\r
+* thread_pool\r
+* Thread pool that will invoke the callbacks.\r
+*\r
+* item_queue\r
+* Queue of items that the threads should process.\r
+*\r
+* lock\r
+* Lock used to synchronize access to the item pool and queue.\r
+*\r
+* SEE ALSO\r
+* Asynchronous Processor\r
+*********/\r
+\r
+\r
+/*\r
+ * Declare the structure so we can reference it in the following function\r
+ * prototype.\r
+ */\r
+typedef struct _cl_async_proc_item *__p_cl_async_proc_item_t;\r
+\r
+\r
+/****d* Component Library: Asynchronous Processor/cl_pfn_async_proc_cb_t\r
+* NAME\r
+* cl_pfn_async_proc_cb_t\r
+*\r
+* DESCRIPTION\r
+* The cl_pfn_async_proc_cb_t function type defines the prototype for\r
+* callbacks queued to and invoked by the asynchronous processor.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef void\r
+(CL_API *cl_pfn_async_proc_cb_t)(\r
+ IN struct _cl_async_proc_item *p_item );\r
+/*\r
+* PARAMETERS\r
+* p_item\r
+* Pointer to the cl_async_proc_item_t structure that was queued in\r
+* a call to cl_async_proc_queue.\r
+*\r
+* NOTES\r
+* This function type is provided as function prototype reference for the\r
+* function provided by users as a parameter to the cl_async_proc_queue\r
+* function.\r
+*\r
+* SEE ALSO\r
+* Asynchronous Processor, cl_async_proc_item_t\r
+*********/\r
+\r
+\r
+/****s* Component Library: Asynchronous Processor/cl_async_proc_item_t\r
+* NAME\r
+* cl_async_proc_item_t\r
+*\r
+* DESCRIPTION\r
+* Asynchronous processor item structure passed to the cl_async_proc_queue\r
+* function to queue a callback for execution.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _cl_async_proc_item\r
+{\r
+ cl_pool_item_t pool_item;\r
+ cl_pfn_async_proc_cb_t pfn_callback;\r
+\r
+} cl_async_proc_item_t;\r
+/*\r
+* FIELDS\r
+* pool_item\r
+* Pool item for queuing the item to be invoked by the asynchronous\r
+* processor's threads. This field is defined as a pool item to\r
+* allow items to be managed by a pool.\r
+*\r
+* pfn_callback\r
+* Pointer to a callback function to invoke when the item is dequeued.\r
+*\r
+* SEE ALSO\r
+* Asynchronous Processor, cl_async_proc_queue, cl_pfn_async_proc_cb_t\r
+*********/\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif\r
+\r
+\r
+/****f* Component Library: Asynchronous Processor/cl_async_proc_construct\r
+* NAME\r
+* cl_async_proc_construct\r
+*\r
+* DESCRIPTION\r
+* The cl_async_proc_construct function initializes the state of a\r
+* thread pool.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_async_proc_construct(\r
+ IN cl_async_proc_t* const p_async_proc );\r
+/*\r
+* PARAMETERS\r
+* p_async_proc\r
+* [in] Pointer to an asynchronous processor structure.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* Allows calling cl_async_proc_destroy without first calling\r
+* cl_async_proc_init.\r
+*\r
+* Calling cl_async_proc_construct is a prerequisite to calling any other\r
+* thread pool function except cl_async_proc_init.\r
+*\r
+* SEE ALSO\r
+* Asynchronous Processor, cl_async_proc_init, cl_async_proc_destroy\r
+*********/\r
+\r
+\r
+/****f* Component Library: Asynchronous Processor/cl_async_proc_init\r
+* NAME\r
+* cl_async_proc_init\r
+*\r
+* DESCRIPTION\r
+* The cl_async_proc_init function initialized an asynchronous processor\r
+* for use.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_status_t CL_API\r
+cl_async_proc_init(\r
+ IN cl_async_proc_t* const p_async_proc,\r
+ IN const uint32_t thread_count,\r
+ IN const char* const name );\r
+/*\r
+* PARAMETERS\r
+* p_async_proc\r
+* [in] Pointer to an asynchronous processor structure to initialize.\r
+*\r
+* thread_count\r
+* [in] Number of threads to be managed by the asynchronous processor.\r
+*\r
+* name\r
+* [in] Name to associate with the threads. The name may be up to 16\r
+* characters, including a terminating null character. All threads\r
+* created in the asynchronous processor have the same name.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if the asynchronous processor creation succeeded.\r
+*\r
+* CL_INSUFFICIENT_MEMORY if there was not enough memory to inititalize\r
+* the asynchronous processor.\r
+*\r
+* CL_ERROR if the threads could not be created.\r
+*\r
+* NOTES\r
+* cl_async_proc_init creates and starts the specified number of threads.\r
+* If thread_count is zero, the asynchronous processor creates as many\r
+* threads as there are processors in the system.\r
+*\r
+* SEE ALSO\r
+* Asynchronous Processor, cl_async_proc_construct, cl_async_proc_destroy,\r
+* cl_async_proc_queue\r
+*********/\r
+\r
+\r
+/****f* Component Library: Asynchronous Processor/cl_async_proc_destroy\r
+* NAME\r
+* cl_async_proc_destroy\r
+*\r
+* DESCRIPTION\r
+* The cl_async_proc_destroy function performs any necessary cleanup\r
+* for a thread pool.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_async_proc_destroy(\r
+ IN cl_async_proc_t* const p_async_proc );\r
+/*\r
+* PARAMETERS\r
+* p_async_proc\r
+* [in] Pointer to an asynchronous processor structure to destroy.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* This function blocks until all threads exit, and must therefore not\r
+* be called from any of the asynchronous processor's threads. Because of\r
+* its blocking nature, callers of cl_async_proc_destroy must ensure that\r
+* entering a wait state is valid from the calling thread context.\r
+*\r
+* This function should only be called after a call to\r
+* cl_async_proc_construct or cl_async_proc_init.\r
+*\r
+* SEE ALSO\r
+* Asynchronous Processor, cl_async_proc_construct, cl_async_proc_init\r
+*********/\r
+\r
+\r
+/****f* Component Library: Asynchronous Processor/cl_async_proc_queue\r
+* NAME\r
+* cl_async_proc_queue\r
+*\r
+* DESCRIPTION\r
+* The cl_async_proc_queue function queues a callback to an asynchronous\r
+* processor.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_async_proc_queue(\r
+ IN cl_async_proc_t* const p_async_proc,\r
+ IN cl_async_proc_item_t* const p_item );\r
+/*\r
+* PARAMETERS\r
+* p_async_proc\r
+* [in] Pointer to an asynchronous processor structure to initialize.\r
+*\r
+* p_item\r
+* [in] Pointer to an asynchronous processor item to queue for execution.\r
+* The callback and context fields of the item must be valid.\r
+*\r
+* RETURN VALUES\r
+* This function does not return a value.\r
+*\r
+* SEE ALSO\r
+* Asynchronous Processor, cl_async_proc_init, cl_pfn_async_proc_cb_t\r
+*********/\r
+\r
+\r
+#ifdef __cplusplus\r
+} /* extern "C" */\r
+#endif\r
+\r
+\r
+#endif /* !defined(_CL_ASYNC_PROC_H_) */\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. \r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+/*\r
+ * Abstract:\r
+ * Declaration of atomic manipulation functions.\r
+ *\r
+ * Environment:\r
+ * All\r
+ */\r
+\r
+\r
+#ifndef _CL_ATOMIC_H_\r
+#define _CL_ATOMIC_H_\r
+\r
+\r
+#include <complib/cl_atomic_osd.h>\r
+\r
+\r
+/****h* Component Library/Atomic Operations\r
+* NAME\r
+* Atomic Operations\r
+*\r
+* DESCRIPTION\r
+* The Atomic Operations functions allow callers to operate on\r
+* 32-bit signed integers in an atomic fashion.\r
+*********/\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif\r
+\r
+\r
+/****f* Component Library: Atomic Operations/cl_atomic_inc\r
+* NAME\r
+* cl_atomic_inc\r
+*\r
+* DESCRIPTION\r
+* The cl_atomic_inc function atomically increments a 32-bit signed\r
+* integer and returns the incremented value.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT int32_t CL_API\r
+cl_atomic_inc(\r
+ IN atomic32_t* const p_value );\r
+/*\r
+* PARAMETERS\r
+* p_value\r
+* [in] Pointer to a 32-bit integer to increment.\r
+*\r
+* RETURN VALUE\r
+* Returns the incremented value pointed to by p_value.\r
+*\r
+* NOTES\r
+* The provided value is incremented and its value returned in one atomic\r
+* operation.\r
+*\r
+* cl_atomic_inc maintains data consistency without requiring additional\r
+* synchronization mechanisms in multi-threaded environments.\r
+*\r
+* SEE ALSO\r
+* Atomic Operations, cl_atomic_dec, cl_atomic_add, cl_atomic_sub,\r
+* cl_atomic_xchg, cl_atomic_comp_xchg\r
+*********/\r
+\r
+\r
+/****f* Component Library: Atomic Operations/cl_atomic_dec\r
+* NAME\r
+* cl_atomic_dec\r
+*\r
+* DESCRIPTION\r
+* The cl_atomic_dec function atomically decrements a 32-bit signed\r
+* integer and returns the decremented value.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT int32_t CL_API\r
+cl_atomic_dec(\r
+ IN atomic32_t* const p_value );\r
+/*\r
+* PARAMETERS\r
+* p_value\r
+* [in] Pointer to a 32-bit integer to decrement.\r
+*\r
+* RETURN VALUE\r
+* Returns the decremented value pointed to by p_value.\r
+*\r
+* NOTES\r
+* The provided value is decremented and its value returned in one atomic\r
+* operation.\r
+*\r
+* cl_atomic_dec maintains data consistency without requiring additional\r
+* synchronization mechanisms in multi-threaded environments.\r
+*\r
+* SEE ALSO\r
+* Atomic Operations, cl_atomic_inc, cl_atomic_add, cl_atomic_sub,\r
+* cl_atomic_xchg, cl_atomic_comp_xchg\r
+*********/\r
+\r
+\r
+/****f* Component Library: Atomic Operations/cl_atomic_add\r
+* NAME\r
+* cl_atomic_add\r
+*\r
+* DESCRIPTION\r
+* The cl_atomic_add function atomically adds a value to a\r
+* 32-bit signed integer and returns the resulting value.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT int32_t CL_API\r
+cl_atomic_add(\r
+ IN atomic32_t* const p_value,\r
+ IN const int32_t increment );\r
+/*\r
+* PARAMETERS\r
+* p_value\r
+* [in] Pointer to a 32-bit integer that will be added to.\r
+*\r
+* increment\r
+* [in] Value by which to increment the integer pointed to by p_value.\r
+*\r
+* RETURN VALUE\r
+* Returns the value pointed to by p_value after the addition.\r
+*\r
+* NOTES\r
+* The provided increment is added to the value and the result returned in\r
+* one atomic operation.\r
+*\r
+* cl_atomic_add maintains data consistency without requiring additional\r
+* synchronization mechanisms in multi-threaded environments.\r
+*\r
+* SEE ALSO\r
+* Atomic Operations, cl_atomic_inc, cl_atomic_dec, cl_atomic_sub,\r
+* cl_atomic_xchg, cl_atomic_comp_xchg\r
+*********/\r
+\r
+\r
+/****f* Component Library: Atomic Operations/cl_atomic_sub\r
+* NAME\r
+* cl_atomic_sub\r
+*\r
+* DESCRIPTION\r
+* The cl_atomic_sub function atomically subtracts a value from a\r
+* 32-bit signed integer and returns the resulting value.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT int32_t CL_API\r
+cl_atomic_sub(\r
+ IN atomic32_t* const p_value,\r
+ IN const int32_t decrement );\r
+/*\r
+* PARAMETERS\r
+* p_value\r
+* [in] Pointer to a 32-bit integer that will be subtracted from.\r
+*\r
+* decrement\r
+* [in] Value by which to decrement the integer pointed to by p_value.\r
+*\r
+* RETURN VALUE\r
+* Returns the value pointed to by p_value after the subtraction.\r
+*\r
+* NOTES\r
+* The provided decrement is subtracted from the value and the result\r
+* returned in one atomic operation.\r
+*\r
+* cl_atomic_sub maintains data consistency without requiring additional\r
+* synchronization mechanisms in multi-threaded environments.\r
+*\r
+* SEE ALSO\r
+* Atomic Operations, cl_atomic_inc, cl_atomic_dec, cl_atomic_add,\r
+* cl_atomic_xchg, cl_atomic_comp_xchg\r
+*********/\r
+\r
+\r
+/****f* Component Library: Atomic Operations/cl_atomic_xchg\r
+* NAME\r
+* cl_atomic_xchg\r
+*\r
+* DESCRIPTION\r
+* The cl_atomic_xchg function atomically sets a value of a\r
+* 32-bit signed integer and returns the initial value.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT int32_t CL_API\r
+cl_atomic_xchg(\r
+ IN atomic32_t* const p_value,\r
+ IN const int32_t new_value );\r
+/*\r
+* PARAMETERS\r
+* p_value\r
+* [in] Pointer to a 32-bit integer to exchange with new_value.\r
+*\r
+* new_value\r
+* [in] Value to assign.\r
+*\r
+* RETURN VALUE\r
+* Returns the initial value pointed to by p_value.\r
+*\r
+* NOTES\r
+* The provided value is exchanged with new_value and its initial value\r
+* returned in one atomic operation.\r
+*\r
+* cl_atomic_xchg maintains data consistency without requiring additional\r
+* synchronization mechanisms in multi-threaded environments.\r
+*\r
+* SEE ALSO\r
+* Atomic Operations, cl_atomic_inc, cl_atomic_dec, cl_atomic_add,\r
+* cl_atomic_sub, cl_atomic_comp_xchg\r
+*********/\r
+\r
+\r
+/****f* Component Library: Atomic Operations/cl_atomic_comp_xchg\r
+* NAME\r
+* cl_atomic_comp_xchg\r
+*\r
+* DESCRIPTION\r
+* The cl_atomic_comp_xchg function atomically compares a 32-bit signed\r
+* integer to a desired value, sets that integer to the\r
+* specified value if equal, and returns the initial value.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT int32_t CL_API\r
+cl_atomic_comp_xchg(\r
+ IN atomic32_t* const p_value,\r
+ IN const int32_t compare,\r
+ IN const int32_t new_value );\r
+/*\r
+* PARAMETERS\r
+* p_value\r
+* [in] Pointer to a 32-bit integer to exchange with new_value.\r
+*\r
+* compare\r
+* [in] Value to compare to the value pointed to by p_value.\r
+*\r
+* new_value\r
+* [in] Value to assign if the value pointed to by p_value is equal to\r
+* the value specified by the compare parameter.\r
+*\r
+* RETURN VALUE\r
+* Returns the initial value of the variable pointed to by p_value.\r
+*\r
+* NOTES\r
+* The value pointed to by p_value is compared to the value specified by the\r
+* compare parameter. If the two values are equal, the p_value variable is\r
+* set to new_value. The initial value pointed to by p_value is returned.\r
+*\r
+* cl_atomic_comp_xchg maintains data consistency without requiring additional\r
+* synchronization mechanisms in multi-threaded environments.\r
+*\r
+* SEE ALSO\r
+* Atomic Operations, cl_atomic_inc, cl_atomic_dec, cl_atomic_add,\r
+* cl_atomic_sub, cl_atomic_xchg\r
+*********/\r
+\r
+\r
+#ifdef __cplusplus\r
+} /* extern "C" */\r
+#endif\r
+\r
+#endif /* _CL_ATOMIC_H_ */\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. \r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+/*\r
+ * Abstract:\r
+ * provides byteswapping utilities. Basic fuctions are obtained from platform\r
+ * specific implementations from ibyteswap_osd.h.\r
+ *\r
+ * Environment:\r
+ * All\r
+ */\r
+\r
+\r
+#ifndef _CL_BYTESWAP_H_\r
+#define _CL_BYTESWAP_H_\r
+\r
+\r
+#include <complib/cl_memory.h>\r
+#include <complib/cl_byteswap_osd.h>\r
+\r
+\r
+/****h* Component Library/Byte Swapping\r
+* NAME\r
+* Byte Swapping\r
+*\r
+* DESCRIPTION\r
+* The byte swapping functions and macros allow swapping bytes from network\r
+* byte order to host byte order.\r
+*\r
+* All data transmitted between systems should be in network byte order.\r
+* In order to utilize such data, it must be converted to host byte order\r
+* before use.\r
+*\r
+* SEE ALSO\r
+* Functions:\r
+* cl_ntoh16, cl_hton16, cl_ntoh32, cl_hton32, cl_ntoh64, cl_hton64,\r
+* cl_ntoh\r
+*\r
+* Macros:\r
+* CL_NTOH16, CL_HTON16, CL_NTOH32, CL_HTON32, CL_NTOH64, CL_HTON64\r
+*********/\r
+\r
+\r
+/*\r
+ * The ibyteswap_osd.h provides the following macros.\r
+ * __LITTLE_ENDIAN\r
+ * __BIG_ENDIAN\r
+ * __BYTE_ORDER\r
+ *\r
+ * If the platform provides byte swapping functions, ibyteswap_osd.h also\r
+ * provides the following macros.\r
+ * ntoh16, hton16\r
+ * ntoh32, hton32\r
+ * ntoh64, hton64\r
+ */\r
+\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif\r
+\r
+\r
+/****d* Component Library: Byte Swapping/CL_NTOH16\r
+* NAME\r
+* CL_NTOH16\r
+*\r
+* DESCRIPTION\r
+* The CL_NTOH16 macro converts a 16-bit value from network byte order to\r
+* host byte order. The CL_NTOH16 macro will cause constant values to be\r
+* swapped by the pre-processor. For variables, CL_NTOH16 is less efficient\r
+* than the cl_ntoh16 function.\r
+*\r
+* SYNOPSIS\r
+* CL_NTOH16( val );\r
+*\r
+* PARAMETERS\r
+* val\r
+* [in] 16-bit value to swap from network byte order to host byte order.\r
+*\r
+* RESULT\r
+* Value of val converted to host byte order.\r
+*\r
+* NOTES\r
+* This macro is analogous to CL_HTON16.\r
+*\r
+* SEE ALSO\r
+* Byte Swapping, CL_HTON16, CL_NTOH32, CL_NTOH64,\r
+* cl_ntoh16, cl_ntoh32, cl_ntoh64, cl_ntoh\r
+*********/\r
+/****d* Component Library: Byte Swapping/CL_HTON16\r
+* NAME\r
+* CL_HTON16\r
+*\r
+* DESCRIPTION\r
+* The CL_HTON16 macro converts a 16-bit value from host byte order to\r
+* network byte order. The CL_HTON16 macro will cause constant values to be\r
+* swapped by the pre-processor. For variables, CL_HTON16 is less efficient\r
+* than the cl_hton16 function.\r
+*\r
+* SYNOPSIS\r
+* CL_HTON16( val );\r
+*\r
+* PARAMETERS\r
+* val\r
+* [in] 16-bit value to swap from host byte order to network byte order.\r
+*\r
+* RESULT\r
+* Value of val converted to network byte order.\r
+*\r
+* NOTES\r
+* This macro is analogous to CL_NTOH16.\r
+*\r
+* SEE ALSO\r
+* Byte Swapping, CL_NTOH16, CL_HTON32, CL_HTON64,\r
+* cl_hton16, cl_hton32, cl_hton64, cl_ntoh\r
+*********/\r
+#if CPU_LE\r
+ #define CL_NTOH16( x ) (uint16_t)( \\r
+ (((uint16_t)(x) & 0x00FF) << 8) | \\r
+ (((uint16_t)(x) & 0xFF00) >> 8) )\r
+#else\r
+ #define CL_NTOH16( x ) (x)\r
+#endif\r
+#define CL_HTON16 CL_NTOH16\r
+\r
+\r
+/****f* Component Library: Byte Swapping/cl_ntoh16\r
+* NAME\r
+* cl_ntoh16\r
+*\r
+* DESCRIPTION\r
+* The cl_ntoh16 function converts a 16-bit value from network byte order to\r
+* host byte order.\r
+*\r
+* SYNOPSIS\r
+* uint16_t\r
+* cl_ntoh16(\r
+* IN const uint16_t val );\r
+*\r
+* PARAMETERS\r
+* val\r
+* [in] Value to swap from network byte order to host byte order.\r
+*\r
+* RETURN VALUE\r
+* Value of val converted to host byte order.\r
+*\r
+* NOTES\r
+* This function is analogous to cl_hton16.\r
+*\r
+* SEE ALSO\r
+* Byte Swapping, cl_hton16, cl_ntoh32, cl_ntoh64, cl_ntoh\r
+*********/\r
+/****f* Component Library: Byte Swapping/cl_hton16\r
+* NAME\r
+* cl_hton16\r
+*\r
+* DESCRIPTION\r
+* The cl_hton16 function converts a 16-bit value from host byte order to\r
+* network byte order.\r
+*\r
+* SYNOPSIS\r
+* uint16_t\r
+* cl_hton16(\r
+* IN const uint16_t val );\r
+*\r
+* PARAMETERS\r
+* val\r
+* [in] Value to swap from host byte order to network byte order .\r
+*\r
+* RETURN VALUE\r
+* Value of val converted to network byte order.\r
+*\r
+* NOTES\r
+* This function is analogous to cl_ntoh16.\r
+*\r
+* SEE ALSO\r
+* Byte Swapping, cl_ntoh16, cl_hton32, cl_hton64, cl_ntoh\r
+*********/\r
+#ifndef cl_ntoh16\r
+ #define cl_ntoh16 CL_NTOH16\r
+ #define cl_hton16 CL_HTON16\r
+#endif\r
+\r
+\r
+/****d* Component Library: Byte Swapping/CL_NTOH32\r
+* NAME\r
+* CL_NTOH32\r
+*\r
+* DESCRIPTION\r
+* The CL_NTOH32 macro converts a 32-bit value from network byte order to\r
+* host byte order. The CL_NTOH32 macro will cause constant values to be\r
+* swapped by the pre-processor. For variables, CL_NTOH32 is less efficient\r
+* than the cl_ntoh32 function.\r
+*\r
+* SYNOPSIS\r
+* CL_NTOH32( val );\r
+*\r
+* PARAMETERS\r
+* val\r
+* [in] 32-bit value to swap from network byte order to host byte order.\r
+*\r
+* RESULT\r
+* Value of val converted to host byte order.\r
+*\r
+* NOTES\r
+* This macro is analogous to CL_HTON32.\r
+*\r
+* SEE ALSO\r
+* Byte Swapping, CL_HTON32, CL_NTOH16, CL_NTOH64,\r
+* cl_ntoh16, cl_ntoh32, cl_ntoh64, cl_ntoh\r
+*********/\r
+/****d* Component Library: Byte Swapping/CL_HTON32\r
+* NAME\r
+* CL_HTON32\r
+*\r
+* DESCRIPTION\r
+* The CL_HTON32 macro converts a 32-bit value from host byte order to\r
+* network byte order. The CL_HTON32 macro will cause constant values to be\r
+* swapped by the pre-processor. For variables, CL_HTON32 is less efficient\r
+* than the cl_hton32 function.\r
+*\r
+* SYNOPSIS\r
+* CL_HTON32( val );\r
+*\r
+* PARAMETERS\r
+* val\r
+* [in] 32-bit value to swap from host byte order to network byte order.\r
+*\r
+* RESULT\r
+* Value of val converted to network byte order.\r
+*\r
+* NOTES\r
+* This macro is analogous to CL_NTOH32.\r
+*\r
+* SEE ALSO\r
+* Byte Swapping, CL_NTOH32, CL_HTON16, CL_HTON64,\r
+* cl_hton16, cl_hton32, cl_hton64, cl_ntoh\r
+*********/\r
+#if CPU_LE\r
+ #define CL_NTOH32( x ) (uint32_t)( \\r
+ (((uint32_t)(x) & 0x000000FF) << 24) | \\r
+ (((uint32_t)(x) & 0x0000FF00) << 8) | \\r
+ (((uint32_t)(x) & 0x00FF0000) >> 8) | \\r
+ (((uint32_t)(x) & 0xFF000000) >> 24) )\r
+#else\r
+ #define CL_NTOH32( x ) (x)\r
+#endif\r
+#define CL_HTON32 CL_NTOH32\r
+\r
+\r
+/****f* Component Library: Byte Swapping/cl_ntoh32\r
+* NAME\r
+* cl_ntoh32\r
+*\r
+* DESCRIPTION\r
+* The cl_ntoh32 function converts a 32-bit value from network byte order to\r
+* host byte order.\r
+*\r
+* SYNOPSIS\r
+* uint32_t\r
+* cl_ntoh32(\r
+* IN const uint32_t val );\r
+*\r
+* PARAMETERS\r
+* val\r
+* [in] Value to swap from network byte order to host byte order.\r
+*\r
+* RETURN VALUE\r
+* Value of val converted in host byte order.\r
+*\r
+* NOTES\r
+* This function is analogous to cl_hton32.\r
+*\r
+* SEE ALSO\r
+* Byte Swapping, cl_hton32, cl_ntoh16, cl_ntoh64, cl_ntoh\r
+*********/\r
+/****f* Component Library: Byte Swapping/cl_hton32\r
+* NAME\r
+* cl_hton32\r
+*\r
+* DESCRIPTION\r
+* The cl_hton32 function converts a 32-bit value from host byte order to\r
+* network byte order.\r
+*\r
+* SYNOPSIS\r
+* uint32_t\r
+* cl_hton32(\r
+* IN const uint32_t val );\r
+*\r
+* PARAMETERS\r
+* val\r
+* [in] Value to swap from host byte order to network byte order .\r
+*\r
+* RETURN VALUE\r
+* Value of val converted to network byte order.\r
+*\r
+* NOTES\r
+* This function is analogous to cl_ntoh32.\r
+*\r
+* SEE ALSO\r
+* Byte Swapping, cl_ntoh32, cl_hton16, cl_hton64, cl_ntoh\r
+*********/\r
+#ifndef cl_ntoh32\r
+ #define cl_ntoh32 CL_NTOH32\r
+ #define cl_hton32 CL_HTON32\r
+#endif\r
+\r
+\r
+/****d* Component Library: Byte Swapping/CL_NTOH64\r
+* NAME\r
+* CL_NTOH64\r
+*\r
+* DESCRIPTION\r
+* The CL_NTOH64 macro converts a 64-bit value from network byte order to\r
+* host byte order. The CL_NTOH64 macro will cause constant values to be\r
+* swapped by the pre-processor. For variables, CL_NTOH64 is less efficient\r
+* than the cl_ntoh64 function.\r
+*\r
+* SYNOPSIS\r
+* CL_NTOH64( val );\r
+*\r
+* PARAMETERS\r
+* val\r
+* [in] 64-bit value to swap from network byte order to host byte order.\r
+*\r
+* RESULT\r
+* Value of val converted to host byte order.\r
+*\r
+* NOTES\r
+* This macro is analogous to CL_HTON64.\r
+*\r
+* SEE ALSO\r
+* Byte Swapping, CL_HTON64, CL_NTOH16, CL_NTOH32,\r
+* cl_ntoh16, cl_ntoh32, cl_ntoh64, cl_ntoh\r
+*********/\r
+/****d* Component Library: Byte Swapping/CL_HTON64\r
+* NAME\r
+* CL_HTON64\r
+*\r
+* DESCRIPTION\r
+* The CL_HTON64 macro converts a 64-bit value from host byte order to\r
+* network byte order. The CL_HTON64 macro will cause constant values to be\r
+* swapped by the pre-processor. For variables, CL_HTON64 is less efficient\r
+* than the cl_hton64 function.\r
+*\r
+* SYNOPSIS\r
+* CL_HTON64( val );\r
+*\r
+* PARAMETERS\r
+* val\r
+* [in] 64-bit value to swap from host byte order to network byte order.\r
+*\r
+* RESULT\r
+* Value of val converted to network byte order.\r
+*\r
+* NOTES\r
+* This macro is analogous to CL_NTOH64.\r
+*\r
+* SEE ALSO\r
+* Byte Swapping, CL_NTOH64, CL_HTON16, CL_HTON32,\r
+* cl_hton16, cl_hton32, cl_hton64, cl_ntoh\r
+*********/\r
+#if CPU_LE\r
+ #define CL_NTOH64( x ) (uint64_t)( \\r
+ (((uint64_t)(x) & CL_CONST64(0x00000000000000FF)) << 56) | \\r
+ (((uint64_t)(x) & CL_CONST64(0x000000000000FF00)) << 40) | \\r
+ (((uint64_t)(x) & CL_CONST64(0x0000000000FF0000)) << 24) | \\r
+ (((uint64_t)(x) & CL_CONST64(0x00000000FF000000)) << 8 ) | \\r
+ (((uint64_t)(x) & CL_CONST64(0x000000FF00000000)) >> 8 ) | \\r
+ (((uint64_t)(x) & CL_CONST64(0x0000FF0000000000)) >> 24) | \\r
+ (((uint64_t)(x) & CL_CONST64(0x00FF000000000000)) >> 40) | \\r
+ (((uint64_t)(x) & CL_CONST64(0xFF00000000000000)) >> 56) )\r
+#else\r
+ #define CL_NTOH64( x ) (x)\r
+#endif\r
+#define CL_HTON64 CL_NTOH64\r
+\r
+\r
+/****f* Component Library: Byte Swapping/cl_ntoh64\r
+* NAME\r
+* cl_ntoh64\r
+*\r
+* DESCRIPTION\r
+* The cl_ntoh64 function converts a 64-bit value from network byte order to\r
+* host byte order.\r
+*\r
+* SYNOPSIS\r
+* uint64_t\r
+* cl_ntoh64(\r
+* IN const uint64_t val );\r
+*\r
+* PARAMETERS\r
+* val\r
+* [in] Value to swap from network byte order to host byte order.\r
+*\r
+* RETURN VALUE\r
+* Value of val converted in host byte order.\r
+*\r
+* NOTES\r
+* This function is analogous to cl_hton64.\r
+*\r
+* SEE ALSO\r
+* Byte Swapping, cl_hton64, cl_ntoh16, cl_ntoh32, cl_ntoh\r
+*********/\r
+/****f* Component Library: Byte Swapping/cl_hton64\r
+* NAME\r
+* cl_hton64\r
+*\r
+* DESCRIPTION\r
+* The cl_hton64 function converts a 64-bit value from host byte order to\r
+* network byte order.\r
+*\r
+* SYNOPSIS\r
+* uint64_t\r
+* cl_hton64(\r
+* IN const uint64_t val );\r
+*\r
+* PARAMETERS\r
+* val\r
+* [in] Value to swap from host byte order to network byte order .\r
+*\r
+* RETURN VALUE\r
+* Value of val converted to network byte order.\r
+*\r
+* NOTES\r
+* This function is analogous to cl_ntoh64.\r
+*\r
+* SEE ALSO\r
+* Byte Swapping, cl_ntoh64, cl_hton16, cl_hton32, cl_ntoh\r
+*********/\r
+#ifndef cl_ntoh64\r
+ #define cl_ntoh64 CL_NTOH64\r
+ #define cl_hton64 CL_HTON64\r
+#endif\r
+\r
+\r
+/****f* Component Library: Byte Swapping/cl_ntoh\r
+* NAME\r
+* cl_ntoh\r
+*\r
+* DESCRIPTION\r
+* The cl_ntoh function converts a value from network byte order to\r
+* host byte order.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE void CL_API\r
+cl_ntoh(\r
+ OUT char* const p_dest,\r
+ IN const char* const p_src,\r
+ IN const uint8_t size )\r
+{\r
+#if CPU_LE\r
+ uint8_t i;\r
+ char temp;\r
+\r
+ if( p_src == p_dest )\r
+ {\r
+ /* Swap in place if source and destination are the same. */\r
+ for( i = 0; i < size / 2; i++ )\r
+ {\r
+ temp = p_dest[i];\r
+ p_dest[i] = p_src[size - 1 - i];\r
+ p_dest[size - 1 - i] = temp;\r
+ }\r
+ }\r
+ else\r
+ {\r
+ for( i = 0; i < size; i++ )\r
+ p_dest[i] = p_src[size - 1 - i];\r
+ }\r
+#else\r
+ /*\r
+ * If the source and destination are not the same, copy the source to\r
+ * the destination.\r
+ */\r
+ if( p_src != p_dest )\r
+ cl_memcpy( p_dest, p_src, size );\r
+#endif\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_dest\r
+* [in] Pointer to a byte array to contain the converted value of p_src.\r
+*\r
+* p_src\r
+* [in] Pointer to a byte array to be converted from network byte\r
+* ordering.\r
+*\r
+* size\r
+* [in] Number of bytes to swap.p_dest\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* cl_ntoh can perform in place swapping if both p_src and p_dest point to\r
+* the same buffer.\r
+*\r
+* SEE ALSO\r
+* Byte Swapping, cl_ntoh16, cl_ntoh32, cl_ntoh64\r
+*********/\r
+\r
+\r
+#ifdef __cplusplus\r
+} /* extern "C" */\r
+#endif\r
+\r
+#endif /* _CL_BYTESWAP_H_ */\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. \r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+/*\r
+ * Abstract:\r
+ * Declaration of the composite pool.\r
+ * The composite pool managers a pool of composite objects. A composite object is an object\r
+ * that is made of multiple sub objects.\r
+ * The pool can grow to meet demand, limited only by system memory.\r
+ *\r
+ * Environment:\r
+ * All\r
+ */\r
+\r
+\r
+#ifndef _CL_COMP_POOL_H_\r
+#define _CL_COMP_POOL_H_\r
+\r
+\r
+#include <complib/cl_qcomppool.h>\r
+\r
+\r
+/****h* Component Library/Composite Pool\r
+* NAME\r
+* Composite Pool\r
+*\r
+* DESCRIPTION\r
+* The Composite Pool provides a self-contained and self-sustaining pool of\r
+* user defined composite objects.\r
+*\r
+* A composite object is an object that is composed of one or more\r
+* sub-objects, each of which needs to be treated separately for\r
+* initialization. Objects can be retrieved from the pool as long as there\r
+* is memory in the system.\r
+*\r
+* To aid in object oriented design, the composite pool provides the user\r
+* the ability to specify callbacks that are invoked for each object for\r
+* construction, initialization, and destruction. Constructor and destructor\r
+* callback functions may not fail.\r
+*\r
+* A composite pool does not return memory to the system as the user returns\r
+* objects to the pool. The only method of returning memory to the system is\r
+* to destroy the pool.\r
+*\r
+* The composite pool functions operates on a cl_cpool_t structure which\r
+* should be treated as opaque and should be manipulated only through the\r
+* provided functions.\r
+*\r
+* SEE ALSO\r
+* Structures:\r
+* cl_cpool_t\r
+*\r
+* Callbacks:\r
+* cl_pfn_cpool_init_t, cl_pfn_cpool_dtor_t\r
+*\r
+* Initialization/Destruction:\r
+* cl_cpool_construct, cl_cpool_init, cl_cpool_destroy\r
+*\r
+* Manipulation:\r
+* cl_cpool_get, cl_cpool_put, cl_cpool_grow\r
+*\r
+* Attributes:\r
+* cl_is_cpool_inited, cl_cpool_count\r
+*********/\r
+\r
+\r
+/****d* Component Library: Composite Pool/cl_pfn_cpool_init_t\r
+* NAME\r
+* cl_pfn_cpool_init_t\r
+*\r
+* DESCRIPTION\r
+* The cl_pfn_cpool_init_t function type defines the prototype for\r
+* functions used as initializers for objects being allocated by a\r
+* composite pool.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef cl_status_t\r
+(CL_API *cl_pfn_cpool_init_t)(\r
+ IN void** const p_comp_array,\r
+ IN const uint32_t num_components,\r
+ IN void* context );\r
+/*\r
+* PARAMETERS\r
+* p_object\r
+* [in] Pointer to an object to initialize.\r
+*\r
+* context\r
+* [in] Context provided in a call to cl_cpool_init.\r
+*\r
+* RETURN VALUES\r
+* Return CL_SUCCESS to indicates that initialization of the object\r
+* was successful and that initialization of further objects may continue.\r
+*\r
+* Other cl_status_t values will be returned by cl_cpool_init\r
+* and cl_cpool_grow.\r
+*\r
+* NOTES\r
+* This function type is provided as function prototype reference for\r
+* the function provided by the user as an optional parameter to the\r
+* cl_cpool_init function.\r
+*\r
+* The initializer is invoked once per allocated object, allowing the user\r
+* to chain components to form a composite object and perform any necessary\r
+* initialization. Returning a status other than CL_SUCCESS aborts a grow\r
+* operation, initiated either through cl_cpool_init or cl_cpool_grow, and\r
+* causes the initiating function to fail. Any non-CL_SUCCESS status will\r
+* be returned by the function that initiated the grow operation.\r
+*\r
+* All memory for the requested number of components is pre-allocated.\r
+*\r
+* When later performing a cl_cpool_get call, the return value is a pointer\r
+* to the first component.\r
+*\r
+* SEE ALSO\r
+* Composite Pool, cl_cpool_init, cl_cpool_grow\r
+*********/\r
+\r
+\r
+/****d* Component Library: Composite Pool/cl_pfn_cpool_dtor_t\r
+* NAME\r
+* cl_pfn_cpool_dtor_t\r
+*\r
+* DESCRIPTION\r
+* The cl_pfn_cpool_dtor_t function type defines the prototype for\r
+* functions used as destructor for objects being deallocated by a\r
+* composite pool.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef void\r
+(CL_API *cl_pfn_cpool_dtor_t)(\r
+ IN void* const p_object,\r
+ IN void* context );\r
+/*\r
+* PARAMETERS\r
+* p_object\r
+* [in] Pointer to an object to destruct.\r
+*\r
+* context\r
+* [in] Context provided in the call to cl_cpool_init.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* This function type is provided as function prototype reference for\r
+* the function provided by the user as an optional parameter to the\r
+* cl_cpool_init function.\r
+*\r
+* The destructor is invoked once per allocated object, allowing the user\r
+* to perform any necessary cleanup. Users should not attempt to deallocate\r
+* the memory for the composite object, as the composite pool manages\r
+* object allocation and deallocation.\r
+*\r
+* SEE ALSO\r
+* Composite Pool, cl_cpool_init\r
+*********/\r
+\r
+\r
+/****s* Component Library: Composite Pool/cl_cpool_t\r
+* NAME\r
+* cl_cpool_t\r
+*\r
+* DESCRIPTION\r
+* Composite pool structure.\r
+*\r
+* The cl_cpool_t structure should be treated as opaque and should be\r
+* manipulated only through the provided functions.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _cl_cpool\r
+{\r
+ cl_qcpool_t qcpool;\r
+ cl_pfn_cpool_init_t pfn_init;\r
+ cl_pfn_cpool_dtor_t pfn_dtor;\r
+ const void *context;\r
+\r
+} cl_cpool_t;\r
+/*\r
+* FIELDS\r
+* qcpool\r
+* Quick composite pool that manages all objects.\r
+*\r
+* pfn_init\r
+* Pointer to the user's initializer callback, used by the pool\r
+* to translate the quick composite pool's initializer callback to\r
+* a composite pool initializer callback.\r
+*\r
+* pfn_dtor\r
+* Pointer to the user's destructor callback, used by the pool\r
+* to translate the quick composite pool's destructor callback to\r
+* a composite pool destructor callback.\r
+*\r
+* context\r
+* User's provided context for callback functions, used by the pool\r
+* to when invoking callbacks.\r
+*\r
+* SEE ALSO\r
+* Composite Pool\r
+*********/\r
+\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif /* __cplusplus */\r
+\r
+\r
+/****f* Component Library: Composite Pool/cl_cpool_construct\r
+* NAME\r
+* cl_cpool_construct\r
+*\r
+* DESCRIPTION\r
+* The cl_cpool_construct function constructs a composite pool.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_cpool_construct(\r
+ IN cl_cpool_t* const p_pool );\r
+/*\r
+* PARAMETERS\r
+* p_pool\r
+* [in] Pointer to a cl_cpool_t structure whose state to initialize.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* Allows calling cl_pool_init, cl_cpool_destroy, cl_is_cpool_inited.\r
+*\r
+* Calling cl_cpool_construct is a prerequisite to calling any other\r
+* composite pool function except cl_cpool_init.\r
+*\r
+* SEE ALSO\r
+* Composite Pool, cl_cpool_init, cl_cpool_destroy, cl_is_cpool_inited\r
+*********/\r
+\r
+\r
+/****f* Component Library: Composite Pool/cl_is_cpool_inited\r
+* NAME\r
+* cl_is_cpool_inited\r
+*\r
+* DESCRIPTION\r
+* The cl_is_cpool_inited function returns whether a composite pool was\r
+* successfully initialized.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE boolean_t CL_API\r
+cl_is_cpool_inited(\r
+ IN const cl_cpool_t* const p_pool )\r
+{\r
+ /* CL_ASSERT that a non-null pointer is provided. */\r
+ CL_ASSERT( p_pool );\r
+ return( cl_is_qcpool_inited( &p_pool->qcpool ) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_pool\r
+* [in] Pointer to a cl_cpool_t structure whose initialization state\r
+* to check.\r
+*\r
+* RETURN VALUES\r
+* TRUE if the composite pool was initialized successfully.\r
+*\r
+* FALSE otherwise.\r
+*\r
+* NOTES\r
+* Allows checking the state of a composite pool to determine if invoking\r
+* member functions is appropriate.\r
+*\r
+* SEE ALSO\r
+* Composite Pool\r
+*********/\r
+\r
+\r
+/****f* Component Library: Composite Pool/cl_cpool_init\r
+* NAME\r
+* cl_cpool_init\r
+*\r
+* DESCRIPTION\r
+* The cl_cpool_init function initializes a composite pool for use.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_status_t CL_API\r
+cl_cpool_init(\r
+ IN cl_cpool_t* const p_pool,\r
+ IN const size_t min_size,\r
+ IN const size_t max_size,\r
+ IN const size_t grow_size,\r
+ IN size_t* const component_sizes,\r
+ IN const uint32_t num_components,\r
+ IN cl_pfn_cpool_init_t pfn_initializer OPTIONAL,\r
+ IN cl_pfn_cpool_dtor_t pfn_destructor OPTIONAL,\r
+ IN const void* const context );\r
+/*\r
+* PARAMETERS\r
+* p_pool\r
+* [in] Pointer to a cl_cpool_t structure to initialize.\r
+*\r
+* min_size\r
+* [in] Minimum number of objects that the pool should support. All\r
+* necessary allocations to allow storing the minimum number of items\r
+* are performed at initialization time, and all necessary callbacks\r
+* successfully invoked.\r
+*\r
+* max_size\r
+* [in] Maximum number of objects to which the pool is allowed to grow.\r
+* A value of zero specifies no maximum.\r
+*\r
+* grow_size\r
+* [in] Number of objects to allocate when incrementally growing the pool.\r
+* A value of zero disables automatic growth.\r
+*\r
+* component_sizes\r
+* [in] Pointer to the first entry in an array of sizes describing,\r
+* in order, the sizes of the components that make up a composite object.\r
+*\r
+* num_components\r
+* [in] Number of components that make up a composite object.\r
+*\r
+* pfn_initializer\r
+* [in] Initialization callback to invoke for every new object when\r
+* growing the pool. This parameter may be NULL only if the objects\r
+* stored in the composite pool consist of only one component.\r
+* See the cl_pfn_cpool_init function type declaration for details\r
+* about the callback function.\r
+*\r
+* pfn_destructor\r
+* [in] Destructor callback to invoke for every object before memory for\r
+* that object is freed. This parameter is optional and may be NULL.\r
+* See the cl_pfn_cpool_dtor function type declaration for details\r
+* about the callback function.\r
+*\r
+* context\r
+* [in] Value to pass to the callback functions to provide context.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if the composite pool was initialized successfully.\r
+*\r
+* CL_INSUFFICIENT_MEMORY if there was not enough memory to initialize the\r
+* composite pool.\r
+*\r
+* CL_INVALID_SETTING if a NULL constructor was provided for composite objects\r
+* consisting of more than one component. Also returns CL_INVALID_SETTING if\r
+* the maximum size is non-zero and less than the minimum size.\r
+*\r
+* Other cl_status_t value returned by optional initialization callback function\r
+* specified by the pfn_initializer parameter.\r
+*\r
+* NOTES\r
+* cl_cpool_init initializes, and if necessary, grows the pool to\r
+* the capacity desired.\r
+*\r
+* SEE ALSO\r
+* Composite Pool, cl_cpool_construct, cl_cpool_destroy,\r
+* cl_cpool_get, cl_cpool_put, cl_cpool_grow,\r
+* cl_cpool_count, cl_pfn_cpool_ctor_t, cl_pfn_cpool_init_t,\r
+* cl_pfn_cpool_dtor_t\r
+*********/\r
+\r
+\r
+/****f* Component Library: Composite Pool/cl_cpool_destroy\r
+* NAME\r
+* cl_cpool_destroy\r
+*\r
+* DESCRIPTION\r
+* The cl_cpool_destroy function destroys a composite pool.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE void CL_API\r
+cl_cpool_destroy(\r
+ IN cl_cpool_t* const p_pool )\r
+{\r
+ CL_ASSERT( p_pool );\r
+\r
+ cl_qcpool_destroy( &p_pool->qcpool );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_pool\r
+* [in] Pointer to a cl_cpool_t structure to destroy.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* All memory allocated for composite objects is freed. The destructor\r
+* callback, if any, will be invoked for every allocated object. Further\r
+* operations on the composite pool should not be attempted after\r
+* cl_cpool_destroy is invoked.\r
+*\r
+* This function should only be called after a call to cl_cpool_construct.\r
+*\r
+* In a debug build, cl_cpool_destroy asserts that all objects are in\r
+* the pool.\r
+*\r
+* SEE ALSO\r
+* Composite Pool, cl_cpool_construct, cl_cpool_init\r
+*********/\r
+\r
+\r
+/****f* Component Library: Composite Pool/cl_cpool_count\r
+* NAME\r
+* cl_cpool_count\r
+*\r
+* DESCRIPTION\r
+* The cl_cpool_count function returns the number of available objects\r
+* in a composite pool.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE size_t CL_API\r
+cl_cpool_count(\r
+ IN cl_cpool_t* const p_pool )\r
+{\r
+ CL_ASSERT( p_pool );\r
+ return( cl_qcpool_count( &p_pool->qcpool ) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_pool\r
+* [in] Pointer to a cl_cpool_t structure for which the number of\r
+* available objects is requested.\r
+*\r
+* RETURN VALUE\r
+* Returns the number of objects available in the specified\r
+* composite pool.\r
+*\r
+* SEE ALSO\r
+* Composite Pool\r
+*********/\r
+\r
+\r
+/****f* Component Library: Composite Pool/cl_cpool_get\r
+* NAME\r
+* cl_cpool_get\r
+*\r
+* DESCRIPTION\r
+* The cl_cpool_get function retrieves an object from a\r
+* composite pool.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE void* CL_API\r
+cl_cpool_get(\r
+ IN cl_cpool_t* const p_pool )\r
+{\r
+ cl_pool_obj_t *p_pool_obj;\r
+\r
+ CL_ASSERT( p_pool );\r
+\r
+ p_pool_obj = (cl_pool_obj_t*)cl_qcpool_get( &p_pool->qcpool );\r
+ if( !p_pool_obj )\r
+ return( NULL );\r
+\r
+ CL_ASSERT( p_pool_obj->list_obj.p_object );\r
+ return( (void*)p_pool_obj->list_obj.p_object );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_pool\r
+* [in] Pointer to a cl_cpool_t structure from which to retrieve\r
+* an object.\r
+*\r
+* RETURN VALUES\r
+* Returns a pointer to the first component of a composite object.\r
+*\r
+* Returns NULL if the pool is empty and can not be grown automatically.\r
+*\r
+* NOTES\r
+* cl_cpool_get returns the object at the head of the pool. If the pool is\r
+* empty, it is automatically grown to accommodate this request unless the\r
+* grow_size parameter passed to the cl_cpool_init function was zero.\r
+*\r
+* SEE ALSO\r
+* Composite Pool, cl_cpool_get_tail, cl_cpool_put, cl_cpool_grow,\r
+* cl_cpool_count\r
+*********/\r
+\r
+\r
+/****f* Component Library: Composite Pool/cl_cpool_put\r
+* NAME\r
+* cl_cpool_put\r
+*\r
+* DESCRIPTION\r
+* The cl_cpool_put function returns an object to a composite pool.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE void CL_API\r
+cl_cpool_put(\r
+ IN cl_cpool_t* const p_pool,\r
+ IN void* const p_object )\r
+{\r
+ cl_pool_obj_t *p_pool_obj;\r
+\r
+ CL_ASSERT( p_pool );\r
+ CL_ASSERT( p_object );\r
+\r
+ /* Calculate the offset to the list object representing this object. */\r
+ p_pool_obj = (cl_pool_obj_t*)\r
+ (((uint8_t*)p_object) - sizeof(cl_pool_obj_t));\r
+\r
+ /* good sanity check */\r
+ CL_ASSERT( p_pool_obj->list_obj.p_object == p_object );\r
+\r
+ cl_qcpool_put( &p_pool->qcpool, (cl_pool_item_t*)p_pool_obj );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_pool\r
+* [in] Pointer to a cl_cpool_t structure to which to return\r
+* an object.\r
+*\r
+* p_object\r
+* [in] Pointer to the first component of an object to return to the pool.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* cl_cpool_put places the returned object at the head of the pool.\r
+*\r
+* The object specified by the p_object parameter must have been\r
+* retrieved from the pool by a previous call to cl_cpool_get.\r
+*\r
+* SEE ALSO\r
+* Composite Pool, cl_cpool_put_tail, cl_cpool_get\r
+*********/\r
+\r
+\r
+/****f* Component Library: Composite Pool/cl_cpool_grow\r
+* NAME\r
+* cl_cpool_grow\r
+*\r
+* DESCRIPTION\r
+* The cl_cpool_grow function grows a composite pool by\r
+* the specified number of objects.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE cl_status_t CL_API\r
+cl_cpool_grow(\r
+ IN cl_cpool_t* const p_pool,\r
+ IN const size_t obj_count )\r
+{\r
+ CL_ASSERT( p_pool );\r
+ return( cl_qcpool_grow( &p_pool->qcpool, obj_count ) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_pool\r
+* [in] Pointer to a cl_cpool_t structure whose capacity to grow.\r
+*\r
+* obj_count\r
+* [in] Number of objects by which to grow the pool.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if the composite pool grew successfully.\r
+*\r
+* CL_INSUFFICIENT_MEMORY if there was not enough memory to grow the\r
+* composite pool.\r
+*\r
+* cl_status_t value returned by optional initialization callback function\r
+* specified by the pfn_initializer parameter passed to the\r
+* cl_cpool_init function.\r
+*\r
+* NOTES\r
+* It is not necessary to call cl_cpool_grow if the pool is\r
+* configured to grow automatically.\r
+*\r
+* SEE ALSO\r
+* Composite Pool\r
+*********/\r
+\r
+\r
+#ifdef __cplusplus\r
+} /* extern "C" */\r
+#endif /* __cplusplus */\r
+\r
+\r
+#endif /* _CL_COMP_POOL_H_ */\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. \r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+/*\r
+ * Abstract:\r
+ * Declaration of functions for reporting debug output.\r
+ *\r
+ * Environment:\r
+ * All\r
+ */\r
+\r
+\r
+#ifndef _CL_DEBUG_H_\r
+#define _CL_DEBUG_H_\r
+\r
+\r
+#include <complib/cl_debug_osd.h>\r
+\r
+\r
+/****h* Component Library/Debug Output\r
+* NAME\r
+* Debug Output\r
+*\r
+* DESCRIPTION\r
+* The debug output functions and macros send debug messages to the current\r
+* debug target.\r
+*********/\r
+\r
+\r
+/****f* Component Library: Debug Output/cl_break\r
+* NAME\r
+* cl_break\r
+*\r
+* DESCRIPTION\r
+* The cl_break function halts execution.\r
+*\r
+* SYNOPSIS\r
+* void\r
+* cl_break();\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* In a release build, cl_break has no effect.\r
+*********/\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif\r
+\r
+#ifndef cl_dbg_out\r
+#if defined( _DEBUG_ )\r
+/****f* Component Library: Debug Output/cl_dbg_out\r
+* NAME\r
+* cl_dbg_out\r
+*\r
+* DESCRIPTION\r
+* The cl_dbg_out function sends a debug message to the debug target in\r
+* debug builds only.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void\r
+cl_dbg_out(\r
+ IN const char* const debug_message,\r
+ IN ... );\r
+/*\r
+* PARAMETERS\r
+* debug_message\r
+* [in] ANSI string formatted identically as for a call to the standard C\r
+* function printf.\r
+*\r
+* ...\r
+* [in] Extra parameters for string formatting, as defined for the\r
+* standard C function printf.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* In a release build, cl_dbg_out has no effect.\r
+*\r
+* The formatting of the debug_message string is the same as for printf\r
+*\r
+* cl_dbg_out sends the debug message to the current debug target.\r
+*\r
+* SEE ALSO\r
+* Debug Output, cl_msg_out\r
+*********/\r
+#else\r
+CL_INLINE void\r
+cl_dbg_out(\r
+ IN const char* const debug_message,\r
+ IN ... )\r
+{\r
+ UNUSED_PARAM( debug_message );\r
+}\r
+#endif /* defined( _DEBUG_ ) */\r
+#endif /* !defined( cl_dbg_out ) */\r
+\r
+#ifndef cl_msg_out\r
+/****f* Component Library: Debug Output/cl_msg_out\r
+* NAME\r
+* cl_msg_out\r
+*\r
+* DESCRIPTION\r
+* The cl_msg_out function sends a debug message to the message log target.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void\r
+cl_msg_out(\r
+ IN const char* const message,\r
+ IN ... );\r
+/*\r
+* PARAMETERS\r
+* message\r
+* [in] ANSI string formatted identically as for a call to the standard C\r
+* function printf.\r
+*\r
+* ...\r
+* [in] Extra parameters for string formatting, as defined for the\r
+* standard C function printf.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* cl_msg_out is available in both debug and release builds.\r
+*\r
+* The formatting of the message string is the same as for printf\r
+*\r
+* cl_msg_out sends the message to the current message logging target.\r
+*\r
+* SEE ALSO\r
+* Debug Output, cl_dbg_out\r
+*********/\r
+#endif\r
+\r
+#ifdef __cplusplus\r
+} /* extern "C" */\r
+#endif\r
+\r
+\r
+/****d* Component Library: Debug Output/Debug Levels\r
+* NAME\r
+* Debug Levels\r
+*\r
+* DESCRIPTION\r
+* The debug output macros reserve the upper bit of the debug level to\r
+* convey an error.\r
+*\r
+* SYNOPSIS\r
+*/\r
+#define CL_DBG_DISABLE 0\r
+#define CL_DBG_ERROR 0x80000000\r
+#define CL_DBG_ALL 0xFFFFFFFF\r
+/*\r
+* VALUES\r
+* CL_DBG_DISABLE\r
+* Disable all debug output, including errors.\r
+*\r
+* CL_DBG_ERROR\r
+* Enable error debug output.\r
+*\r
+* CL_DBG_ALL\r
+* Enbale all debug output.\r
+*\r
+* NOTES\r
+* Users can define custom debug levels using the lower 31 bits of their\r
+* debug level to control non-error debug output. Error messages are\r
+* always displayed, regardless of the lower bit definition.\r
+*\r
+* When specifying the debug output desired for non-error messages\r
+* (the CHK_LVL parameter in the debug output macros), users must define\r
+* all bits whose output they are interested in.\r
+*\r
+* SEE ALSO\r
+* Debug Output, CL_PRINT, CL_ENTER, CL_EXIT, CL_TRACE, CL_TRACE_EXIT\r
+*********/\r
+\r
+\r
+#if defined(_DEBUG_)\r
+\r
+/****d* Component Library: Debug Output/CL_PRINT\r
+* NAME\r
+* CL_PRINT\r
+*\r
+* DESCRIPTION\r
+* The CL_PRINT macro sends a string to the current debug target if\r
+* the requested debug level matches the current debug level.\r
+*\r
+* SYNOPSIS\r
+* CL_PRINT( DBG_LVL, CHK_LVL, STRING );\r
+*\r
+* PARAMETERS\r
+* DBG_LVL\r
+* [in] Debug level for the string to output\r
+*\r
+* CHK_LVL\r
+* [in] Current debug level against which to check DBG_LVL\r
+*\r
+* STRING\r
+* [in] String to send to the current debug target. The string includes\r
+* parentheses in order to allow additional parameters.\r
+*\r
+* RETURN VALUE\r
+* This macro does not return a value.\r
+*\r
+* EXAMPLE\r
+* #define MY_FUNC_DBG_LVL 1\r
+*\r
+* uint32_t my_dbg_lvl = CL_DBG_ALL;\r
+*\r
+* void\r
+* my_func()\r
+* {\r
+* CL_PRINT( MY_FUNC_DBG_LVL, my_dbg_lvl, ("Hello %s!\n", "world") );\r
+* }\r
+*\r
+* RESULT\r
+* Hello world!\r
+*\r
+* NOTES\r
+* The requested string is printed only if all bits set in DBG_LVL are also\r
+* set in CHK_LVL unless the most significant bit is set (indicating an\r
+* error), in which case the lower bits are ignored. CHK_LVL may have\r
+* additional bits set.\r
+*\r
+* In multi-processor environments where the current processor can be\r
+* determined, the zero-based number of the processor on which the output\r
+* is generated is prepended to the output.\r
+*\r
+* SEE ALSO\r
+* Debug Output, Debug Levels, CL_ENTER, CL_EXIT, CL_TRACE, CL_TRACE_EXIT\r
+*********/\r
+#define CL_PRINT( DBG_LVL, CHK_LVL, STRING ) \\r
+ do{ \\r
+ if( DBG_LVL & CHK_LVL & CL_DBG_ERROR ) \\r
+ cl_dbg_out STRING; \\r
+ else if( (DBG_LVL & CHK_LVL) == DBG_LVL ) \\r
+ cl_dbg_out STRING; \\r
+ } while(CHK_LVL^CHK_LVL)\r
+\r
+\r
+/****d* Component Library: Debug Output/CL_ENTER\r
+* NAME\r
+* CL_ENTER\r
+*\r
+* DESCRIPTION\r
+* The CL_ENTER macro marks the entrance into a function by sending a\r
+* string to the current debug target if the requested debug level matches\r
+* the current debug level.\r
+*\r
+* SYNOPSIS\r
+* CL_ENTER( DBG_LVL, CHK_LVL );\r
+*\r
+* PARAMETERS\r
+* DBG_LVL\r
+* [in] Debug level for the string to output\r
+*\r
+* CHK_LVL\r
+* [in] Current debug level against which to check DBG_LVL\r
+*\r
+* RETURN VALUE\r
+* This macro does not return a value.\r
+*\r
+* EXAMPLE\r
+* #define __MODULE__ "my_module"\r
+* #define MY_FUNC_DBG_LVL 1\r
+*\r
+* uint32_t my_dbg_lvl = CL_DBG_ALL;\r
+*\r
+* void\r
+* my_func()\r
+* {\r
+* CL_ENTER( MY_FUNC_DBG_LVL, my_dbg_lvl );\r
+* CL_EXIT( MY_FUNC_DBG_LVL, my_dbg_lvl );\r
+* }\r
+*\r
+* RESULT\r
+* my_module:my_func() [\r
+* my_module:my_func() ]\r
+*\r
+* NOTES\r
+* The function entrance notification is printed only if all bits set\r
+* in DBG_LVL are also set in CHK_LVL. CHK_LVL may have additional bits set.\r
+*\r
+* If the __MODULE__ preprocessor keyword is defined, that keyword will be\r
+* prepended to the function name, separated with a colon.\r
+*\r
+* In multi-processor environments where the current processor can be\r
+* determined, the zero-based number of the processor on which the output\r
+* is generated is prepended to the output.\r
+*\r
+* SEE ALSO\r
+* Debug Output, Debug Levels, CL_PRINT, CL_EXIT, CL_TRACE, CL_TRACE_EXIT\r
+*********/\r
+#define CL_ENTER( DBG_LVL, CHK_LVL ) \\r
+ do{ \\r
+ CL_CHK_STK; \\r
+ CL_PRINT( DBG_LVL, CHK_LVL, _CL_DBG_ENTER ); \\r
+ } while(CHK_LVL^CHK_LVL)\r
+\r
+\r
+/****d* Component Library: Debug Output/CL_EXIT\r
+* NAME\r
+* CL_EXIT\r
+*\r
+* DESCRIPTION\r
+* The CL_EXIT macro marks the exit from a function by sending a string\r
+* to the current debug target if the requested debug level matches the\r
+* current debug level.\r
+*\r
+* SYNOPSIS\r
+* CL_EXIT( DBG_LVL, CHK_LVL );\r
+*\r
+* PARAMETERS\r
+* DBG_LVL\r
+* [in] Debug level for the string to output\r
+*\r
+* CHK_LVL\r
+* [in] Current debug level against which to check DBG_LVL\r
+*\r
+* RETURN VALUE\r
+* This macro does not return a value.\r
+*\r
+* EXAMPLE\r
+* #define __MODULE__ "my_module"\r
+* #define MY_FUNC_DBG_LVL 1\r
+*\r
+* uint32_t my_dbg_lvl = CL_DBG_ALL;\r
+*\r
+* void\r
+* my_func()\r
+* {\r
+* CL_ENTER( MY_FUNC_DBG_LVL, my_dbg_lvl );\r
+* CL_EXIT( MY_FUNC_DBG_LVL, my_dbg_lvl );\r
+* }\r
+*\r
+* RESULT\r
+* my_module:my_func() [\r
+* my_module:my_func() ]\r
+*\r
+* NOTES\r
+* The exit notification is printed only if all bits set in DBG_LVL are also\r
+* set in CHK_LVL. CHK_LVL may have additional bits set.\r
+*\r
+* The CL_EXIT macro must only be used after the CL_ENTRY macro as it\r
+* depends on that macro's implementation.\r
+*\r
+* If the __MODULE__ preprocessor keyword is defined, that keyword will be\r
+* prepended to the function name, separated with a colon.\r
+*\r
+* In multi-processor environments where the current processor can be\r
+* determined, the zero-based number of the processor on which the output\r
+* is generated is prepended to the output.\r
+*\r
+* SEE ALSO\r
+* Debug Output, Debug Levels, CL_PRINT, CL_ENTER, CL_TRACE, CL_TRACE_EXIT\r
+*********/\r
+#define CL_EXIT( DBG_LVL, CHK_LVL ) \\r
+ CL_PRINT( DBG_LVL, CHK_LVL, _CL_DBG_EXIT )\r
+\r
+\r
+/****d* Component Library: Debug Output/CL_TRACE\r
+* NAME\r
+* CL_TRACE\r
+*\r
+* DESCRIPTION\r
+* The CL_TRACE macro sends a string to the current debug target if\r
+* the requested debug level matches the current debug level. The\r
+* output is prepended with the function name and, depending on the\r
+* debug level requested, an indication of the severity of the message.\r
+*\r
+* SYNOPSIS\r
+* CL_TRACE( DBG_LVL, CHK_LVL, STRING );\r
+*\r
+* PARAMETERS\r
+* DBG_LVL\r
+* [in] Debug level for the string to output\r
+*\r
+* CHK_LVL\r
+* [in] Current debug level against which to check DBG_LVL\r
+*\r
+* STRING\r
+* [in] String to send to the current debug target. The string includes\r
+* parentheses in order to allow additional parameters.\r
+*\r
+* RETURN VALUE\r
+* This macro does not return a value.\r
+*\r
+* EXAMPLE\r
+* #define __MODULE__ "my_module"\r
+* #define MY_FUNC_DBG_LVL 1\r
+*\r
+* uint32_t my_dbg_lvl = CL_DBG_ALL;\r
+*\r
+* void\r
+* my_func()\r
+* {\r
+* CL_ENTER( MY_FUNC_DBG_LVL, my_dbg_lvl );\r
+* CL_TRACE( MY_FUNC_DBG_LVL, my_dbg_lvl, ("Hello %s!\n", "world") );\r
+* CL_EXIT( MY_FUNC_DBG_LVL, my_dbg_lvl );\r
+* }\r
+*\r
+* RESULT\r
+* my_module:my_func() [\r
+* my_module:my_func(): Hello world!\r
+* my_module:my_func() ]\r
+*\r
+* NOTES\r
+* The requested string is printed only if all bits set in DBG_LVL are also\r
+* set in CHK_LVL. CHK_LVL may have additional bits set.\r
+*\r
+* The CL_TRACE macro must only be used after the CL_ENTRY macro as it\r
+* depends on that macro's implementation.\r
+*\r
+* If the DBG_LVL has the upper bit set, the output will contain\r
+* an "!ERROR!" statement between the function name and STRING.\r
+*\r
+* If the __MODULE__ preprocessor keyword is defined, that keyword will be\r
+* prepended to the function name, separated with a colon.\r
+*\r
+* In multi-processor environments where the current processor can be\r
+* determined, the zero-based number of the processor on which the output\r
+* is generated is prepended to the output.\r
+*\r
+* SEE ALSO\r
+* Debug Output, Debug Levels, CL_PRINT, CL_ENTER, CL_EXIT, CL_TRACE_EXIT\r
+*********/\r
+#define CL_TRACE( DBG_LVL, CHK_LVL, STRING ) \\r
+do{ \\r
+switch( DBG_LVL & CL_DBG_ERROR ) \\r
+{ \\r
+ case CL_DBG_ERROR: \\r
+ CL_PRINT( DBG_LVL, CHK_LVL, _CL_DBG_ERROR ); \\r
+ break; \\r
+ default: \\r
+ CL_PRINT( DBG_LVL, CHK_LVL, _CL_DBG_INFO ); \\r
+ break; \\r
+} \\r
+CL_PRINT( DBG_LVL, CHK_LVL, STRING ); \\r
+} while(CHK_LVL^CHK_LVL)\r
+\r
+\r
+/****d* Component Library: Debug Output/CL_TRACE_EXIT\r
+* NAME\r
+* CL_TRACE_EXIT\r
+*\r
+* DESCRIPTION\r
+* The CL_TRACE_EXIT macro combines the functionality of the CL_TRACE and\r
+* CL_EXIT macros, in that order.\r
+*\r
+* SYNOPSIS\r
+* CL_TRACE_EXIT( DBG_LVL, CHK_LVL, STRING );\r
+*\r
+* PARAMETERS\r
+* DBG_LVL\r
+* [in] Debug level for the string to output\r
+*\r
+* CHK_LVL\r
+* [in] Current debug level against which to check DBG_LVL\r
+*\r
+* STRING\r
+* [in] String to send to the current debug target. The string includes\r
+* parentheses in order to allow additional parameters.\r
+*\r
+* RETURN VALUE\r
+* This macro does not return a value.\r
+*\r
+* EXAMPLE\r
+* #define __MODULE__ "my_module"\r
+* #define MY_FUNC_DBG_LVL 1\r
+*\r
+* uint32_t my_dbg_lvl = CL_DBG_ALL;\r
+*\r
+* void\r
+* my_func()\r
+* {\r
+* CL_ENTER( MY_FUNC_DBG_LVL, my_dbg_lvl );\r
+* CL_TRACE_EXIT( MY_FUNC_DBG_LVL, my_dbg_lvl, ("Hello %s!\n", "world") );\r
+* }\r
+*\r
+* RESULT\r
+* my_module:my_func() [\r
+* my_module:my_func(): Hello world!\r
+* my_module:my_func() ]\r
+*\r
+* NOTES\r
+* The requested string is printed only if all bits set in DBG_LVL are also\r
+* set in CHK_LVL. CHK_LVL may have additional bits set.\r
+*\r
+* The CL_TRACE_EXIT macro must only be used after the CL_ENTRY macro as it\r
+* depends on that macro's implementation.\r
+*\r
+* If the DBG_LVL has the upper bit set, the output will contain\r
+* an "!ERROR!" statement between the function name and STRING.\r
+*\r
+* If the __MODULE__ preprocessor keyword is defined, that keyword will be\r
+* prepended to the function name, separated with a colon.\r
+*\r
+* In multi-processor environments where the current processor can be\r
+* determined, the zero-based number of the processor on which the output\r
+* is generated is prepended to the output.\r
+*\r
+* SEE ALSO\r
+* Debug Output, Debug Levels, CL_PRINT, CL_ENTER, CL_EXIT, CL_TRACE\r
+*********/\r
+#define CL_TRACE_EXIT( DBG_LVL, CHK_LVL, STRING ) \\r
+ do{ \\r
+ CL_TRACE( DBG_LVL, CHK_LVL, STRING ); \\r
+ CL_EXIT( DBG_LVL, CHK_LVL ); \\r
+ } while(CHK_LVL^CHK_LVL)\r
+\r
+#else /* defined(_DEBUG_) */\r
+\r
+/* Define as NULL macros in a free build. */\r
+#define CL_PRINT( DBG_LVL, CHK_LVL, STRING )\r
+#define CL_ENTER( DBG_LVL, CHK_LVL )\r
+#define CL_EXIT( DBG_LVL, CHK_LVL )\r
+#define CL_TRACE( DBG_LVL, CHK_LVL, STRING )\r
+#define CL_TRACE_EXIT( DBG_LVL, CHK_LVL, STRING )\r
+\r
+#endif /* defined(_DEBUG_) */\r
+\r
+\r
+/****d* Component Library: Debug Output/64-bit Print Format\r
+* NAME\r
+* 64-bit Print Format\r
+*\r
+* DESCRIPTION\r
+* The 64-bit print keywords allow users to use 64-bit values in debug or\r
+* console output.\r
+*\r
+* Different platforms define 64-bit print formats differently. The 64-bit\r
+* print formats exposed by the component library are supported in all\r
+* platforms.\r
+*\r
+* VALUES\r
+* PRId64\r
+* Print a 64-bit integer in signed decimal format.\r
+* PRIx64\r
+* Print a 64-bit integer in hexadecimal format.\r
+* PRIo64\r
+* Print a 64-bit integer in octal format.\r
+* PRIu64\r
+* Print a 64-bit integer in unsigned decimal format.\r
+*\r
+* EXAMPLE\r
+* uint64 MyVal = 2;\r
+* // Print a 64-bit integer in hexadecimal format.\r
+* cl_dbg_out( "MyVal: 0x%" PRIx64 "\n", MyVal );\r
+*\r
+* NOTES\r
+* Standard print flags to specify padding and precision can still be used\r
+* following the '%' sign in the string preceding the 64-bit print keyword.\r
+*\r
+* The above keywords are strings and make use of compilers' string\r
+* concatenation ability.\r
+*********/\r
+\r
+\r
+#endif /* _CL_DEBUG_H_ */\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. \r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+/*\r
+ * Abstract:\r
+ * Declaration of event abstraction.\r
+ *\r
+ * Environment:\r
+ * All\r
+ */\r
+\r
+\r
+#ifndef _CL_EVENT_H_\r
+#define _CL_EVENT_H_\r
+\r
+\r
+/* Indicates that waiting on an event should never timeout */\r
+#define EVENT_NO_TIMEOUT 0xFFFFFFFF\r
+\r
+\r
+#include <complib/cl_event_osd.h>\r
+\r
+\r
+/****h* Component Library/Event\r
+* NAME\r
+* Event\r
+*\r
+* DESCRIPTION\r
+* The Event provides the ability to suspend and wakeup a thread.\r
+*\r
+* The event functions operates on a cl_event_t structure which should be\r
+* treated as opaque and should be manipulated only through the provided\r
+* functions.\r
+*\r
+* SEE ALSO\r
+* Structures:\r
+* cl_event_t\r
+*\r
+* Initialization/Destruction:\r
+* cl_event_construct, cl_event_init, cl_event_destroy\r
+*\r
+* Manipulation:\r
+* cl_event_signal, cl_event_reset, cl_event_wait_on\r
+*********/\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif\r
+\r
+\r
+/****f* Component Library: Event/cl_event_construct\r
+* NAME\r
+* cl_event_construct\r
+*\r
+* DESCRIPTION\r
+* The cl_event_construct function constructs an event.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_event_construct(\r
+ IN cl_event_t* const p_event );\r
+/*\r
+* PARAMETERS\r
+* p_event\r
+* [in] Pointer to an cl_event_t structure to construct.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* Allows calling cl_event_destroy without first calling cl_event_init.\r
+*\r
+* Calling cl_event_construct is a prerequisite to calling any other event\r
+* function except cl_event_init.\r
+*\r
+* SEE ALSO\r
+* Event, cl_event_init, cl_event_destroy\r
+*********/\r
+\r
+\r
+/****f* Component Library: Event/cl_event_init\r
+* NAME\r
+* cl_event_init\r
+*\r
+* DESCRIPTION\r
+* The cl_event_init function initializes an event for use.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_status_t CL_API\r
+cl_event_init(\r
+ IN cl_event_t* const p_event,\r
+ IN const boolean_t manual_reset );\r
+/*\r
+* PARAMETERS\r
+* p_event\r
+* [in] Pointer to an cl_event_t structure to initialize.\r
+*\r
+* manual_reset\r
+* [in] If FALSE, indicates that the event resets itself after releasing\r
+* a single waiter. If TRUE, the event remains in the signalled state\r
+* until explicitly reset by a call to cl_event_reset.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if event initialization succeeded.\r
+*\r
+* CL_ERROR otherwise.\r
+*\r
+* NOTES\r
+* Allows calling event manipulation functions, such as cl_event_signal,\r
+* cl_event_reset, and cl_event_wait_on.\r
+*\r
+* The event is initially in a reset state.\r
+*\r
+* SEE ALSO\r
+* Event, cl_event_construct, cl_event_destroy, cl_event_signal,\r
+* cl_event_reset, cl_event_wait_on\r
+*********/\r
+\r
+\r
+/****f* Component Library: Event/cl_event_destroy\r
+* NAME\r
+* cl_event_destroy\r
+*\r
+* DESCRIPTION\r
+* The cl_event_destroy function performs any necessary cleanup of an event.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_event_destroy(\r
+ IN cl_event_t* const p_event );\r
+\r
+/*\r
+* PARAMETERS\r
+* p_event\r
+* [in] Pointer to an cl_event_t structure to destroy.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* This function should only be called after a call to cl_event_construct\r
+* or cl_event_init.\r
+*\r
+* SEE ALSO\r
+* Event, cl_event_construct, cl_event_init\r
+*********/\r
+\r
+\r
+/****f* Component Library: Event/cl_event_signal\r
+* NAME\r
+* cl_event_signal\r
+*\r
+* DESCRIPTION\r
+* The cl_event_signal function sets an event to the signalled state and\r
+* releases one or more waiting threads.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_status_t CL_API\r
+cl_event_signal(\r
+ IN cl_event_t* const p_event );\r
+/*\r
+* PARAMETERS\r
+* p_event\r
+* [in] Pointer to an cl_event_t structure to set.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if the event was successfully signalled.\r
+*\r
+* CL_ERROR otherwise.\r
+*\r
+* NOTES\r
+* For auto-reset events, the event is reset automatically once a wait\r
+* operation is satisfied.\r
+*\r
+* Triggering the event multiple times does not guarantee that the same\r
+* number of wait operations are satisfied. This is because events are\r
+* either in a signalled on non-signalled state, and triggering an event\r
+* that is already in the signalled state has no effect.\r
+*\r
+* SEE ALSO\r
+* Event, cl_event_reset, cl_event_wait_on\r
+*********/\r
+\r
+\r
+/****f* Component Library: Event/cl_event_reset\r
+* NAME\r
+* cl_event_reset\r
+*\r
+* DESCRIPTION\r
+* The cl_event_reset function sets an event to the non-signalled state.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_status_t CL_API\r
+cl_event_reset(\r
+ IN cl_event_t* const p_event );\r
+/*\r
+* PARAMETERS\r
+* p_event\r
+* [in] Pointer to an cl_event_t structure to reset.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if the event was successfully reset.\r
+*\r
+* CL_ERROR otherwise.\r
+*\r
+* SEE ALSO\r
+* Event, cl_event_signal, cl_event_wait_on\r
+*********/\r
+\r
+\r
+/****f* Component Library: Event/cl_event_wait_on\r
+* NAME\r
+* cl_event_wait_on\r
+*\r
+* DESCRIPTION\r
+* The cl_event_wait_on function waits for the specified event to be\r
+* triggered for a minimum amount of time.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_status_t CL_API\r
+cl_event_wait_on(\r
+ IN cl_event_t* const p_event,\r
+ IN const uint32_t wait_us,\r
+ IN const boolean_t interruptible );\r
+/*\r
+* PARAMETERS\r
+* p_event\r
+* [in] Pointer to an cl_event_t structure on which to wait.\r
+*\r
+* wait_us\r
+* [in] Number of microseconds to wait.\r
+*\r
+* interruptible\r
+* [in] Indicates whether the wait operation can be interrupted\r
+* by external signals.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if the wait operation succeeded in response to the event\r
+* being set.\r
+*\r
+* CL_TIMEOUT if the specified time period elapses.\r
+*\r
+* CL_NOT_DONE if the wait was interrupted by an external signal.\r
+*\r
+* CL_ERROR if the wait operation failed.\r
+*\r
+* NOTES\r
+* If wait_us is set to EVENT_NO_TIMEOUT, the function will wait until the\r
+* event is triggered and never timeout.\r
+*\r
+* If the timeout value is zero, this function simply tests the state of\r
+* the event.\r
+*\r
+* If the event is already in the signalled state at the time of the call\r
+* to cl_event_wait_on, the call completes immediately with CL_SUCCESS.\r
+*\r
+* SEE ALSO\r
+* Event, cl_event_signal, cl_event_reset\r
+*********/\r
+\r
+\r
+#ifdef __cplusplus\r
+} /* extern "C" */\r
+#endif\r
+\r
+#endif /* _CL_EVENT_H_ */\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. \r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+/*\r
+ * Abstract:\r
+ * Declaration of flexi map, a binary tree where the caller always provides\r
+ * all necessary storage.\r
+ *\r
+ * Environment:\r
+ * All\r
+ */\r
+\r
+\r
+#ifndef _CL_FLEXIMAP_H_\r
+#define _CL_FLEXIMAP_H_\r
+\r
+\r
+#include <complib/cl_qmap.h>\r
+\r
+\r
+/****h* Component Library/Flexi Map\r
+* NAME\r
+* Flexi Map\r
+*\r
+* DESCRIPTION\r
+* Flexi map implements a binary tree that stores user provided cl_fmap_item_t\r
+* structures. Each item stored in a flexi map has a unique user defined key\r
+* (duplicates are not allowed). Flexi map provides the ability to\r
+* efficiently search for an item given a key. Flexi map allows user defined\r
+* keys of any size. Storage for keys and a comparisson function are provided\r
+* by users to allow flexi map to store items with arbitrary key values.\r
+*\r
+* Flexi map does not allocate any memory, and can therefore not fail\r
+* any operations due to insufficient memory. Flexi map can thus be useful\r
+* in minimizing the error paths in code.\r
+*\r
+* Flexi map is not thread safe, and users must provide serialization when\r
+* adding and removing items from the map.\r
+*\r
+* The flexi map functions operate on a cl_fmap_t structure which should\r
+* be treated as opaque and should be manipulated only through the provided\r
+* functions.\r
+*\r
+* SEE ALSO\r
+* Structures:\r
+* cl_fmap_t, cl_fmap_item_t\r
+*\r
+* Callbacks:\r
+* cl_pfn_fmap_apply_t\r
+*\r
+* Item Manipulation:\r
+* cl_fmap_key\r
+*\r
+* Initialization:\r
+* cl_fmap_init\r
+*\r
+* Iteration:\r
+* cl_fmap_end, cl_fmap_head, cl_fmap_tail, cl_fmap_next, cl_fmap_prev\r
+*\r
+* Manipulation:\r
+* cl_fmap_insert, cl_fmap_get, cl_fmap_remove_item, cl_fmap_remove,\r
+* cl_fmap_remove_all, cl_fmap_merge, cl_fmap_delta\r
+*\r
+* Search:\r
+* cl_fmap_apply_func\r
+*\r
+* Attributes:\r
+* cl_fmap_count, cl_is_fmap_empty,\r
+*********/\r
+\r
+\r
+/****s* Component Library: Flexi Map/cl_fmap_item_t\r
+* NAME\r
+* cl_fmap_item_t\r
+*\r
+* DESCRIPTION\r
+* The cl_fmap_item_t structure is used by maps to store objects.\r
+*\r
+* The cl_fmap_item_t structure should be treated as opaque and should\r
+* be manipulated only through the provided functions.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _cl_fmap_item\r
+{\r
+ /* Must be first to allow casting. */\r
+ cl_pool_item_t pool_item;\r
+ struct _cl_fmap_item *p_left;\r
+ struct _cl_fmap_item *p_right;\r
+ struct _cl_fmap_item *p_up;\r
+ cl_map_color_t color;\r
+ const void* __ptr64 p_key;\r
+#ifdef _DEBUG_\r
+ struct _cl_fmap *p_map;\r
+#endif\r
+\r
+} cl_fmap_item_t;\r
+/*\r
+* FIELDS\r
+* pool_item\r
+* Used to store the item in a doubly linked list, allowing more\r
+* efficient map traversal.\r
+*\r
+* p_left\r
+* Pointer to the map item that is a child to the left of the node.\r
+*\r
+* p_right\r
+* Pointer to the map item that is a child to the right of the node.\r
+*\r
+* p_up\r
+* Pointer to the map item that is the parent of the node.\r
+*\r
+* p_nil\r
+* Pointer to the map's NIL item, used as a terminator for leaves.\r
+* The NIL sentinel is in the cl_fmap_t structure.\r
+*\r
+* color\r
+* Indicates whether a node is red or black in the map.\r
+*\r
+* p_key\r
+* Pointer to the value that uniquely represents a node in a map. This\r
+* pointer is set by calling cl_fmap_insert and can be retrieved by\r
+* calling cl_fmap_key.\r
+*\r
+* NOTES\r
+* None of the fields of this structure should be manipulated by users, as\r
+* they are crititcal to the proper operation of the map in which they\r
+* are stored.\r
+*\r
+* To allow storing items in either a quick list, a quick pool, or a flexi\r
+* map, the map implementation guarantees that the map item can be safely\r
+* cast to a pool item used for storing an object in a quick pool, or cast to\r
+* a list item used for storing an object in a quick list. This removes the\r
+* need to embed a flexi map item, a list item, and a pool item in objects\r
+* that need to be stored in a quick list, a quick pool, and a flexi map.\r
+*\r
+* The flexi map item is defined to be identical in layout as a map item.\r
+*\r
+* SEE ALSO\r
+* Flexi Map, cl_fmap_insert, cl_fmap_key, cl_pool_item_t, cl_list_item_t\r
+*********/\r
+\r
+\r
+/****d* Component Library: Flexi Map/cl_pfn_fmap_cmp_t\r
+* NAME\r
+* cl_pfn_fmap_cmp_t\r
+*\r
+* DESCRIPTION\r
+* The cl_pfn_fmap_cmp_t function type defines the prototype for functions\r
+* used to compare item keys in a flexi map.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef intn_t\r
+(CL_API *cl_pfn_fmap_cmp_t)(\r
+ IN const void* const p_key1,\r
+ IN const void* const p_key2 );\r
+/*\r
+* PARAMETERS\r
+* p_key1\r
+* [in] Pointer to the first of two keys to compare.\r
+*\r
+* p_key2\r
+* [in] Pointer to the second of two keys to compare.\r
+*\r
+* RETURN VALUE\r
+* Returns 0 if the keys match.\r
+* Returns less than 0 if p_key1 is less than p_key2.\r
+* Returns greater than 0 if p_key1 is greater than p_key2.\r
+*\r
+* NOTES\r
+* This function type is provided as function prototype reference for the\r
+* function provided by users as a parameter to the cl_fmap_init function.\r
+*\r
+* SEE ALSO\r
+* Flexi Map, cl_fmap_init\r
+*********/\r
+\r
+\r
+/****s* Component Library: Flexi Map/cl_fmap_t\r
+* NAME\r
+* cl_fmap_t\r
+*\r
+* DESCRIPTION\r
+* Flexi map structure.\r
+*\r
+* The cl_fmap_t structure should be treated as opaque and should\r
+* be manipulated only through the provided functions.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _cl_fmap\r
+{\r
+ cl_fmap_item_t root;\r
+ cl_fmap_item_t nil;\r
+ cl_state_t state;\r
+ size_t count;\r
+ cl_pfn_fmap_cmp_t pfn_compare;\r
+\r
+} cl_fmap_t;\r
+/*\r
+* PARAMETERS\r
+* root\r
+* Map item that serves as root of the map. The root is set up to\r
+* always have itself as parent. The left pointer is set to point to\r
+* the item at the root.\r
+*\r
+* nil\r
+* Map item that serves as terminator for all leaves, as well as providing\r
+* the list item used as quick list for storing map items in a list for\r
+* faster traversal.\r
+*\r
+* state\r
+* State of the map, used to verify that operations are permitted.\r
+*\r
+* count\r
+* Number of items in the map.\r
+*\r
+* pfn_compare\r
+* Pointer to a compare function to invoke to compare the keys of\r
+* items in the map.\r
+*\r
+* SEE ALSO\r
+* Flexi Map, cl_pfn_fmap_cmp_t\r
+*********/\r
+\r
+\r
+/****d* Component Library: Flexi Map/cl_pfn_fmap_apply_t\r
+* NAME\r
+* cl_pfn_fmap_apply_t\r
+*\r
+* DESCRIPTION\r
+* The cl_pfn_fmap_apply_t function type defines the prototype for functions\r
+* used to iterate items in a flexi map.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef void\r
+(CL_API *cl_pfn_fmap_apply_t)(\r
+ IN cl_fmap_item_t* const p_map_item,\r
+ IN void* context );\r
+/*\r
+* PARAMETERS\r
+* p_map_item\r
+* [in] Pointer to a cl_fmap_item_t structure.\r
+*\r
+* context\r
+* [in] Value passed to the callback function.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* This function type is provided as function prototype reference for the\r
+* function provided by users as a parameter to the cl_fmap_apply_func\r
+* function.\r
+*\r
+* SEE ALSO\r
+* Flexi Map, cl_fmap_apply_func\r
+*********/\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
+\r
+/****f* Component Library: Flexi Map/cl_fmap_count\r
+* NAME\r
+* cl_fmap_count\r
+*\r
+* DESCRIPTION\r
+* The cl_fmap_count function returns the number of items stored\r
+* in a flexi map.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE size_t CL_API\r
+cl_fmap_count(\r
+ IN const cl_fmap_t* const p_map )\r
+{\r
+ CL_ASSERT( p_map );\r
+ CL_ASSERT( p_map->state == CL_INITIALIZED );\r
+ return( p_map->count );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_map\r
+* [in] Pointer to a cl_fmap_t structure whose item count to return.\r
+*\r
+* RETURN VALUE\r
+* Returns the number of items stored in the map.\r
+*\r
+* SEE ALSO\r
+* Flexi Map, cl_is_fmap_empty\r
+*********/\r
+\r
+\r
+/****f* Component Library: Flexi Map/cl_is_fmap_empty\r
+* NAME\r
+* cl_is_fmap_empty\r
+*\r
+* DESCRIPTION\r
+* The cl_is_fmap_empty function returns whether a flexi map is empty.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE boolean_t CL_API\r
+cl_is_fmap_empty(\r
+ IN const cl_fmap_t* const p_map )\r
+{\r
+ CL_ASSERT( p_map );\r
+ CL_ASSERT( p_map->state == CL_INITIALIZED );\r
+\r
+ return( p_map->count == 0 );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_map\r
+* [in] Pointer to a cl_fmap_t structure to test for emptiness.\r
+*\r
+* RETURN VALUES\r
+* TRUE if the flexi map is empty.\r
+*\r
+* FALSE otherwise.\r
+*\r
+* SEE ALSO\r
+* Flexi Map, cl_fmap_count, cl_fmap_remove_all\r
+*********/\r
+\r
+\r
+/****f* Component Library: Flexi Map/cl_fmap_key\r
+* NAME\r
+* cl_fmap_key\r
+*\r
+* DESCRIPTION\r
+* The cl_fmap_key function retrieves the key value of a map item.\r
+*\r
+* SYNOPSIS\r
+*/\r
+#pragma warning (push)\r
+#pragma warning (disable :4244)\r
+CL_INLINE const void* CL_API\r
+cl_fmap_key(\r
+ IN const cl_fmap_item_t* const p_item )\r
+{\r
+ CL_ASSERT( p_item );\r
+ return( p_item->p_key );\r
+}\r
+#pragma warning (pop )\r
+/*\r
+* PARAMETERS\r
+* p_item\r
+* [in] Pointer to a map item whose key value to return.\r
+*\r
+* RETURN VALUE\r
+* Returns the a pointer to the key value for the specified map item.\r
+* The key value should not be modified to insure proper flexi map operation.\r
+*\r
+* NOTES\r
+* The key value is set in a call to cl_fmap_insert.\r
+*\r
+* SEE ALSO\r
+* Flexi Map, cl_fmap_insert\r
+*********/\r
+\r
+\r
+/****f* Component Library: Flexi Map/cl_fmap_init\r
+* NAME\r
+* cl_fmap_init\r
+*\r
+* DESCRIPTION\r
+* The cl_fmap_init function initialized a flexi map for use.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_fmap_init(\r
+ IN cl_fmap_t* const p_map,\r
+ IN cl_pfn_fmap_cmp_t pfn_compare );\r
+/*\r
+* PARAMETERS\r
+* p_map\r
+* [in] Pointer to a cl_fmap_t structure to initialize.\r
+*\r
+* pfn_compare\r
+* [in] Pointer to the compare function used to compare keys.\r
+* See the cl_pfn_fmap_cmp_t function type declaration for details\r
+* about the callback function.\r
+*\r
+* RETURN VALUES\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* Allows calling flexi map manipulation functions.\r
+*\r
+* SEE ALSO\r
+* Flexi Map, cl_fmap_insert, cl_fmap_remove\r
+*********/\r
+\r
+\r
+/****f* Component Library: Flexi Map/cl_fmap_end\r
+* NAME\r
+* cl_fmap_end\r
+*\r
+* DESCRIPTION\r
+* The cl_fmap_end function returns the end of a flexi map.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE const cl_fmap_item_t* const CL_API\r
+cl_fmap_end(\r
+ IN const cl_fmap_t* const p_map )\r
+{\r
+ CL_ASSERT( p_map );\r
+ CL_ASSERT( p_map->state == CL_INITIALIZED );\r
+ /* Nil is the end of the map. */\r
+ return( &p_map->nil );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_map\r
+* [in] Pointer to a cl_fmap_t structure whose end to return.\r
+*\r
+* RETURN VALUE\r
+* Pointer to the end of the map.\r
+*\r
+* NOTES\r
+* cl_fmap_end is useful for determining the validity of map items returned\r
+* by cl_fmap_head, cl_fmap_tail, cl_fmap_next, or cl_fmap_prev. If the map\r
+* item pointer returned by any of these functions compares to the end, the\r
+* end of the map was encoutered.\r
+* When using cl_fmap_head or cl_fmap_tail, this condition indicates that\r
+* the map is empty.\r
+*\r
+* SEE ALSO\r
+* Flexi Map, cl_fmap_head, cl_fmap_tail, cl_fmap_next, cl_fmap_prev\r
+*********/\r
+\r
+\r
+/****f* Component Library: Flexi Map/cl_fmap_head\r
+* NAME\r
+* cl_fmap_head\r
+*\r
+* DESCRIPTION\r
+* The cl_fmap_head function returns the map item with the lowest key\r
+* value stored in a flexi map.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE cl_fmap_item_t* CL_API\r
+cl_fmap_head(\r
+ IN const cl_fmap_t* const p_map )\r
+{\r
+ CL_ASSERT( p_map );\r
+ CL_ASSERT( p_map->state == CL_INITIALIZED );\r
+ return( (cl_fmap_item_t*)p_map->nil.pool_item.list_item.p_next );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_map\r
+* [in] Pointer to a cl_fmap_t structure whose item with the lowest key\r
+* is returned.\r
+*\r
+* RETURN VALUES\r
+* Pointer to the map item with the lowest key in the flexi map.\r
+*\r
+* Pointer to the map end if the flexi map was empty.\r
+*\r
+* NOTES\r
+* cl_fmap_head does not remove the item from the map.\r
+*\r
+* SEE ALSO\r
+* Flexi Map, cl_fmap_tail, cl_fmap_next, cl_fmap_prev, cl_fmap_end,\r
+* cl_fmap_item_t\r
+*********/\r
+\r
+\r
+/****f* Component Library: Flexi Map/cl_fmap_tail\r
+* NAME\r
+* cl_fmap_tail\r
+*\r
+* DESCRIPTION\r
+* The cl_fmap_tail function returns the map item with the highest key\r
+* value stored in a flexi map.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE cl_fmap_item_t* CL_API\r
+cl_fmap_tail(\r
+ IN const cl_fmap_t* const p_map )\r
+{\r
+ CL_ASSERT( p_map );\r
+ CL_ASSERT( p_map->state == CL_INITIALIZED );\r
+ return( (cl_fmap_item_t*)p_map->nil.pool_item.list_item.p_prev );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_map\r
+* [in] Pointer to a cl_fmap_t structure whose item with the highest key\r
+* is returned.\r
+*\r
+* RETURN VALUES\r
+* Pointer to the map item with the highest key in the flexi map.\r
+*\r
+* Pointer to the map end if the flexi map was empty.\r
+*\r
+* NOTES\r
+* cl_fmap_end does not remove the item from the map.\r
+*\r
+* SEE ALSO\r
+* Flexi Map, cl_fmap_head, cl_fmap_next, cl_fmap_prev, cl_fmap_end,\r
+* cl_fmap_item_t\r
+*********/\r
+\r
+\r
+/****f* Component Library: Flexi Map/cl_fmap_next\r
+* NAME\r
+* cl_fmap_next\r
+*\r
+* DESCRIPTION\r
+* The cl_fmap_next function returns the map item with the next higher\r
+* key value than a specified map item.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE cl_fmap_item_t* CL_API\r
+cl_fmap_next(\r
+ IN const cl_fmap_item_t* const p_item )\r
+{\r
+ CL_ASSERT( p_item );\r
+ return( (cl_fmap_item_t*)p_item->pool_item.list_item.p_next );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_item\r
+* [in] Pointer to a map item whose successor to return.\r
+*\r
+* RETURN VALUES\r
+* Pointer to the map item with the next higher key value in a flexi map.\r
+*\r
+* Pointer to the map end if the specified item was the last item in\r
+* the flexi map.\r
+*\r
+* SEE ALSO\r
+* Flexi Map, cl_fmap_head, cl_fmap_tail, cl_fmap_prev, cl_fmap_end,\r
+* cl_fmap_item_t\r
+*********/\r
+\r
+\r
+/****f* Component Library: Flexi Map/cl_fmap_prev\r
+* NAME\r
+* cl_fmap_prev\r
+*\r
+* DESCRIPTION\r
+* The cl_fmap_prev function returns the map item with the next lower\r
+* key value than a precified map item.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE cl_fmap_item_t* CL_API\r
+cl_fmap_prev(\r
+ IN const cl_fmap_item_t* const p_item )\r
+{\r
+ CL_ASSERT( p_item );\r
+ return( (cl_fmap_item_t*)p_item->pool_item.list_item.p_prev );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_item\r
+* [in] Pointer to a map item whose predecessor to return.\r
+*\r
+* RETURN VALUES\r
+* Pointer to the map item with the next lower key value in a flexi map.\r
+*\r
+* Pointer to the map end if the specifid item was the first item in\r
+* the flexi map.\r
+*\r
+* SEE ALSO\r
+* Flexi Map, cl_fmap_head, cl_fmap_tail, cl_fmap_next, cl_fmap_end,\r
+* cl_fmap_item_t\r
+*********/\r
+\r
+\r
+/****f* Component Library: Flexi Map/cl_fmap_insert\r
+* NAME\r
+* cl_fmap_insert\r
+*\r
+* DESCRIPTION\r
+* The cl_fmap_insert function inserts a map item into a flexi map.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_fmap_item_t* CL_API\r
+cl_fmap_insert(\r
+ IN cl_fmap_t* const p_map,\r
+ IN const void* const p_key,\r
+ IN cl_fmap_item_t* const p_item );\r
+/*\r
+* PARAMETERS\r
+* p_map\r
+* [in] Pointer to a cl_fmap_t structure into which to add the item.\r
+*\r
+* p_key\r
+* [in] Pointer to the key value to assign to the item. Storage for\r
+* the key must be persistant, as only the pointer is stored. Users\r
+* are responsible for maintaining the validity of key pointers while\r
+* they are in use.\r
+*\r
+* p_item\r
+* [in] Pointer to a cl_fmap_item_t stucture to insert into the flexi map.\r
+*\r
+* RETURN VALUE\r
+* Pointer to the item in the map with the specified key. If insertion\r
+* was successful, this is the pointer to the item. If an item with the\r
+* specified key already exists in the map, the pointer to that item is\r
+* returned.\r
+*\r
+* NOTES\r
+* Insertion operations may cause the flexi map to rebalance.\r
+*\r
+* SEE ALSO\r
+* Flexi Map, cl_fmap_remove, cl_fmap_item_t\r
+*********/\r
+\r
+\r
+/****f* Component Library: Flexi Map/cl_fmap_get\r
+* NAME\r
+* cl_fmap_get\r
+*\r
+* DESCRIPTION\r
+* The cl_fmap_get function returns the map item associated with a key.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_fmap_item_t* CL_API\r
+cl_fmap_get(\r
+ IN const cl_fmap_t* const p_map,\r
+ IN const void* const p_key );\r
+/*\r
+* PARAMETERS\r
+* p_map\r
+* [in] Pointer to a cl_fmap_t structure from which to retrieve the\r
+* item with the specified key.\r
+*\r
+* p_key\r
+* [in] Pointer to a key value used to search for the desired map item.\r
+*\r
+* RETURN VALUES\r
+* Pointer to the map item with the desired key value.\r
+*\r
+* Pointer to the map end if there was no item with the desired key value\r
+* stored in the flexi map.\r
+*\r
+* NOTES\r
+* cl_fmap_get does not remove the item from the flexi map.\r
+*\r
+* SEE ALSO\r
+* Flexi Map, cl_fmap_remove\r
+*********/\r
+\r
+\r
+/****f* Component Library: Flexi Map/cl_fmap_remove_item\r
+* NAME\r
+* cl_fmap_remove_item\r
+*\r
+* DESCRIPTION\r
+* The cl_fmap_remove_item function removes the specified map item\r
+* from a flexi map.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_fmap_remove_item(\r
+ IN cl_fmap_t* const p_map,\r
+ IN cl_fmap_item_t* const p_item );\r
+/*\r
+* PARAMETERS\r
+* p_item\r
+* [in] Pointer to a map item to remove from its flexi map.\r
+*\r
+* RETURN VALUES\r
+* This function does not return a value.\r
+*\r
+* In a debug build, cl_fmap_remove_item asserts that the item being removed\r
+* is in the specified map.\r
+*\r
+* NOTES\r
+* Removes the map item pointed to by p_item from its flexi map.\r
+*\r
+* SEE ALSO\r
+* Flexi Map, cl_fmap_remove, cl_fmap_remove_all, cl_fmap_insert\r
+*********/\r
+\r
+\r
+/****f* Component Library: Flexi Map/cl_fmap_remove\r
+* NAME\r
+* cl_fmap_remove\r
+*\r
+* DESCRIPTION\r
+* The cl_fmap_remove function removes the map item with the specified key\r
+* from a flexi map.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_fmap_item_t* CL_API\r
+cl_fmap_remove(\r
+ IN cl_fmap_t* const p_map,\r
+ IN const void* const p_key );\r
+/*\r
+* PARAMETERS\r
+* p_map\r
+* [in] Pointer to a cl_fmap_t structure from which to remove the item\r
+* with the specified key.\r
+*\r
+* p_key\r
+* [in] Pointer to the key value used to search for the map item\r
+* to remove.\r
+*\r
+* RETURN VALUES\r
+* Pointer to the removed map item if it was found.\r
+*\r
+* Pointer to the map end if no item with the specified key exists in the\r
+* flexi map.\r
+*\r
+* SEE ALSO\r
+* Flexi Map, cl_fmap_remove_item, cl_fmap_remove_all, cl_fmap_insert\r
+*********/\r
+\r
+\r
+/****f* Component Library: Flexi Map/cl_fmap_remove_all\r
+* NAME\r
+* cl_fmap_remove_all\r
+*\r
+* DESCRIPTION\r
+* The cl_fmap_remove_all function removes all items in a flexi map,\r
+* leaving it empty.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE void CL_API\r
+cl_fmap_remove_all(\r
+ IN cl_fmap_t* const p_map )\r
+{\r
+ CL_ASSERT( p_map );\r
+ CL_ASSERT( p_map->state == CL_INITIALIZED );\r
+\r
+ p_map->root.p_left = &p_map->nil;\r
+ p_map->nil.pool_item.list_item.p_next = &p_map->nil.pool_item.list_item;\r
+ p_map->nil.pool_item.list_item.p_prev = &p_map->nil.pool_item.list_item;\r
+ p_map->count = 0;\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_map\r
+* [in] Pointer to a cl_fmap_t structure to empty.\r
+*\r
+* RETURN VALUES\r
+* This function does not return a value.\r
+*\r
+* SEE ALSO\r
+* Flexi Map, cl_fmap_remove, cl_fmap_remove_item\r
+*********/\r
+\r
+\r
+/****f* Component Library: Flexi Map/cl_fmap_merge\r
+* NAME\r
+* cl_fmap_merge\r
+*\r
+* DESCRIPTION\r
+* The cl_fmap_merge function moves all items from one map to another,\r
+* excluding duplicates.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_fmap_merge(\r
+ OUT cl_fmap_t* const p_dest_map,\r
+ IN OUT cl_fmap_t* const p_src_map );\r
+/*\r
+* PARAMETERS\r
+* p_dest_map\r
+* [out] Pointer to a cl_fmap_t structure to which items should be added.\r
+*\r
+* p_src_map\r
+* [in/out] Pointer to a cl_fmap_t structure whose items to add\r
+* to p_dest_map.\r
+*\r
+* RETURN VALUES\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* Items are evaluated based on their keys only.\r
+*\r
+* Upon return from cl_fmap_merge, the flexi map referenced by p_src_map\r
+* contains all duplicate items.\r
+*\r
+* SEE ALSO\r
+* Flexi Map, cl_fmap_delta\r
+*********/\r
+\r
+\r
+/****f* Component Library: Flexi Map/cl_fmap_delta\r
+* NAME\r
+* cl_fmap_delta\r
+*\r
+* DESCRIPTION\r
+* The cl_fmap_delta function computes the differences between two maps.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_fmap_delta(\r
+ IN OUT cl_fmap_t* const p_map1,\r
+ IN OUT cl_fmap_t* const p_map2,\r
+ OUT cl_fmap_t* const p_new,\r
+ OUT cl_fmap_t* const p_old );\r
+/*\r
+* PARAMETERS\r
+* p_map1\r
+* [in/out] Pointer to the first of two cl_fmap_t structures whose\r
+* differences to compute.\r
+*\r
+* p_map2\r
+* [in/out] Pointer to the second of two cl_fmap_t structures whose\r
+* differences to compute.\r
+*\r
+* p_new\r
+* [out] Pointer to an empty cl_fmap_t structure that contains the items\r
+* unique to p_map2 upon return from the function.\r
+*\r
+* p_old\r
+* [out] Pointer to an empty cl_fmap_t structure that contains the items\r
+* unique to p_map1 upon return from the function.\r
+*\r
+* RETURN VALUES\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* Items are evaluated based on their keys. Items that exist in both\r
+* p_map1 and p_map2 remain in their respective maps. Items that\r
+* exist only p_map1 are moved to p_old. Likewise, items that exist only\r
+* in p_map2 are moved to p_new. This function can be usefull in evaluating\r
+* changes between two maps.\r
+*\r
+* Both maps pointed to by p_new and p_old must be empty on input. This\r
+* requirement removes the possibility of failures.\r
+*\r
+* SEE ALSO\r
+* Flexi Map, cl_fmap_merge\r
+*********/\r
+\r
+\r
+/****f* Component Library: Flexi Map/cl_fmap_apply_func\r
+* NAME\r
+* cl_fmap_apply_func\r
+*\r
+* DESCRIPTION\r
+* The cl_fmap_apply_func function executes a specified function\r
+* for every item stored in a flexi map.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_fmap_apply_func(\r
+ IN const cl_fmap_t* const p_map,\r
+ IN cl_pfn_fmap_apply_t pfn_func,\r
+ IN const void* const context );\r
+/*\r
+* PARAMETERS\r
+* p_map\r
+* [in] Pointer to a cl_fmap_t structure.\r
+*\r
+* pfn_func\r
+* [in] Function invoked for every item in the flexi map.\r
+* See the cl_pfn_fmap_apply_t function type declaration for details\r
+* about the callback function.\r
+*\r
+* context\r
+* [in] Value to pass to the callback functions to provide context.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* The function provided must not perform any map operations, as these\r
+* would corrupt the flexi map.\r
+*\r
+* SEE ALSO\r
+* Flexi Map, cl_pfn_fmap_apply_t\r
+*********/\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+\r
+\r
+#endif /* _CL_FLEXIMAP_H_ */\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+/*\r
+ * Abstract:\r
+ * Declaration of IOCTL object\r
+ *\r
+ * Environment:\r
+ * All\r
+ */\r
+\r
+\r
+#ifndef _CL_IOCTL_H_\r
+#define _CL_IOCTL_H_\r
+\r
+\r
+#include <complib/cl_types.h>\r
+#include <complib/cl_ioctl_osd.h>\r
+\r
+\r
+/****h* Component Library/IOCTL Object\r
+* NAME\r
+* IOCTL Object\r
+*\r
+* DESCRIPTION\r
+* The IOCTL object provides functionality for handling IOCTL requests.\r
+*\r
+* The IOCTL object is only available in kernel mode and provides\r
+* functionality for accessing information about IO requests initiated\r
+* by a user-mode application. The IOCTL_CODE macro is used in both\r
+* user and kernel mode to initiate and dispatch IOCTL requests, respectively.\r
+*\r
+* In Linux, in order for the IOCTL object to be used, requests must be\r
+* initiated and handled using the Device Framework abstraction.\r
+*\r
+* SEE ALSO\r
+* Structures:\r
+* cl_ioctl_handle_t\r
+*\r
+* Callbacks:\r
+* cl_pfn_ioctl_handler_t\r
+*\r
+* Control Code Generation\r
+* IOCTL_CODE\r
+*\r
+* Kernel Mode Access\r
+* cl_ioctl_process\r
+* cl_ioctl_complete\r
+* cl_ioctl_type\r
+* cl_ioctl_cmd\r
+* cl_ioctl_ctl_code\r
+* cl_ioctl_in_buf\r
+* cl_ioctl_in_size\r
+* cl_ioctl_out_buf\r
+* cl_ioctl_out_size\r
+*\r
+* User Mode Access\r
+* cl_ioctl_request\r
+* cl_ioctl_result\r
+*********/\r
+\r
+\r
+/****d* Component Library: IOCTL Object/IOCTL_CODE\r
+* NAME\r
+* IOCTL_CODE\r
+*\r
+* DESCRIPTION\r
+* Macro for defining IO control command codes.\r
+*\r
+* SYNOPSIS\r
+* uint32_t IOCTL_CODE( uint16_t type, uint16_t cmd )\r
+*\r
+* PARAMETERS\r
+* type\r
+* [in] user-defined type representing the type of command. For Linux,\r
+* the type is truncated to 8-bits. For Windows, the type is a 16-bit\r
+* value, as described in "Specifying Device Types" in the DDK docs.\r
+*\r
+* cmd\r
+* [in] User-defined command. For Linux, the command field is truncated\r
+* to 8-bits. For Windows, the command can be 12-bits, with values\r
+* below 0x800 reserved by Microsoft for system defined commands.\r
+*\r
+* RETURN VALUE\r
+* A 32-bit control code. User-mode clients use the control code to initiate\r
+* requests. Kernel-mode clients use the control code to distinguish between\r
+* different requests.\r
+*\r
+* NOTE\r
+* In Windows, all IOCTL command codes defined with the IOCTL_CODE command\r
+* result in FILE_ANY_ACCESS and METHOD_BUFFERED being specified.\r
+*\r
+* SEE ALSO\r
+* IOCTL Object, cl_dev_ioctl, cl_ioctl_type, cl_ioctl_cmd\r
+*********/\r
+\r
+\r
+#ifdef CL_KERNEL\r
+\r
+/****d* Component Library: IOCTL Object/cl_ioctl_handle_t\r
+* NAME\r
+* cl_ioctl_handle_t\r
+*\r
+* DESCRIPTION\r
+* Opaque handle representing an IO request.\r
+*\r
+* NOTES\r
+* The cl_ioctl_handle_t type is only available in the kernel.\r
+* The cl_ioctl_handle_t type should be treated as opaque, as it\r
+* varies from environment to environment.\r
+*\r
+* SEE ALSO\r
+* IOCTL Object, cl_ioctl_type, cl_ioctl_cmd, cl_ioctl_in_buf,\r
+* cl_ioctl_in_size, cl_ioctl_out_buf, cl_ioctl_out_size,\r
+* cl_ioctl_set_status, cl_ioctl_set_ret_bytes\r
+*********/\r
+\r
+\r
+/****d* Component Library: IOCTL Object/cl_pfn_ioctl_handler_t\r
+* NAME\r
+* cl_pfn_ioctl_handler_t\r
+*\r
+* DESCRIPTION\r
+* The cl_pfn_ioctl_handler_t function type defines the prototype for\r
+* IOCTL handlers used when handling IOCTL requests initiated by\r
+* cl_ioctl_request.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef cl_status_t\r
+(CL_API *cl_pfn_ioctl_handler_t)(\r
+ IN cl_ioctl_handle_t h_ioctl,\r
+ IN void *context_1,\r
+ IN void *context_2 );\r
+/*\r
+* PARAMETERS\r
+* h_ioctl\r
+* [in] Handle to the IOCTL request.\r
+*\r
+* context_1\r
+* [in] First context parameters, as provided to cl_ioctl_process.\r
+*\r
+* context_2\r
+* [in] Second context parameters, as provided to cl_ioctl_process.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if the IOCTL was completed successfully.\r
+*\r
+* CL_PENDING if the IOCTL is being processed asynchronously.\r
+*\r
+* Other return values in case of errors.\r
+*\r
+* NOTES\r
+* It is acceptable to complete the IOCTL successfully to report an error\r
+* status in the output buffer.\r
+*\r
+* SEE ALSO\r
+* IOCTL Object, cl_ioctl_handle_t, cl_ioctl_process\r
+*********/\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif /* __cplusplus */\r
+\r
+\r
+/****f* Component Library: IOCTL Object/cl_ioctl_process\r
+* NAME\r
+* cl_ioctl_process\r
+*\r
+* DESCRIPTION\r
+* The cl_ioctl_process function unpacks information initiated by a call to\r
+* cl_ioctl_request function and invokes a user-supplied callback.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_status_t CL_API\r
+cl_ioctl_process(\r
+ IN void *p_ioctl,\r
+ IN cl_pfn_ioctl_handler_t pfn_ioctl_handler,\r
+ IN void *context_1,\r
+ IN void *context_2 );\r
+/*\r
+* PARAMETERS\r
+* p_ioctl\r
+* [in] Pointer to an OS specific IOCTL information. In Linux,\r
+* this parameter depends on whether the IOCTL is handled synchronously\r
+* or asynchronously. See the notes for further detail.\r
+* In Windows, this is a pointer to an IRP.\r
+*\r
+* pfn_ioctl_handler\r
+* [in] Pointer to the callback function to invoke for handling the IOCTL.\r
+* This callback is independent of the IOCTL command.\r
+*\r
+* context_1\r
+* [in] First of two context parameters to pass to the handler.\r
+*\r
+* context_2\r
+* [in] Second of two context parameters to pass to the handler.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if the IOCTL was processed successfully.\r
+*\r
+* Other values to indicate various failures.\r
+*\r
+* NOTES\r
+* Users must call cl_ioctl_complete from within the handler if completing\r
+* the IOCTL request synchronously. If the IOCTL request's control code is\r
+* invalid, the handler should return CL_INVALID_REQUEST.\r
+*\r
+* In Linux, the p_ioctl parameter is a copy of the argp parameter on input,\r
+* and on output points to the IOCTL request object passed to the IOCTL\r
+* handler if and only if the IOCTL handler returned CL_PENDING.\r
+* This allows the user to cancel the request by passing the same\r
+* handle to the cancel routine that was passed to the IOCTL handler.\r
+* If all IOCTLs are handled synchronously, it is acceptable to pass the argp\r
+* parameter of the IOCTL entry point instead of a copy.\r
+*\r
+* SEE ALSO\r
+* IOCTL Object, cl_ioctl_handle_t, cl_pfn_ioctl_handler_t, cl_ioctl_complete\r
+*********/\r
+\r
+\r
+/****f* Component Library: IOCTL Object/cl_ioctl_complete\r
+* NAME\r
+* cl_ioctl_complete\r
+*\r
+* DESCRIPTION\r
+* Fills in completion information for an IOCTL and releases the IOCTL request\r
+* for completion.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_ioctl_complete(\r
+ IN cl_ioctl_handle_t h_ioctl,\r
+ IN cl_status_t io_status,\r
+ IN size_t ret_bytes );\r
+/*\r
+* PARAMETERS\r
+* h_ioctl\r
+* Handle to the IOCTL being completed. This handle was provided to\r
+* the IOCTL handler.\r
+*\r
+* io_status\r
+* Status of the IOCTL request.\r
+*\r
+* ret_bytes\r
+* Number of bytes written to the output buffer.\r
+*\r
+* RETURN VALUES\r
+* This function does not return a value.\r
+*\r
+* SEE ALSO\r
+* IOCTL Object, cl_ioctl_handle_t, cl_ioctl_process\r
+*********/\r
+\r
+\r
+/****f* Component Library: IOCTL Object/cl_ioctl_type\r
+* NAME\r
+* cl_ioctl_type\r
+*\r
+* DESCRIPTION\r
+* Returns the type of an IOCTL.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT uint16_t CL_API\r
+cl_ioctl_type(\r
+ IN cl_ioctl_handle_t h_ioctl );\r
+/*\r
+* PARAMETERS\r
+* h_ioctl\r
+* [in] Handle to an IOCTL\r
+*\r
+* RETURN VALUE\r
+* Returns the type of the specified IOCTL request, as defined using\r
+* the IOCTL_CMD macro.\r
+*\r
+* NOTES\r
+* The cl_ioctl_type function is only available in the kernel.\r
+*\r
+* SEE ALSO\r
+* IOCTL Object, cl_ioctl_handle_t, cl_ioctl_cmd, cl_ioctl_ctl_code\r
+********/\r
+\r
+\r
+/****f* Component Library: IOCTL Object/cl_ioctl_cmd\r
+* NAME\r
+* cl_ioctl_cmd\r
+*\r
+* DESCRIPTION\r
+* Returns the command of an IOCTL\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT uint16_t CL_API\r
+cl_ioctl_cmd(\r
+ IN cl_ioctl_handle_t h_ioctl );\r
+/*\r
+* PARAMETERS\r
+* h_ioctl\r
+* [in] Handle to an IOCTL\r
+*\r
+* RETURN VALUE\r
+* Returns the command of the specified IOCTL request, as defined using\r
+* the IOCTL_CMD macro.\r
+*\r
+* NOTES\r
+* The cl_ioctl_cmd function is only available in the kernel.\r
+*\r
+* SEE ALSO\r
+* IOCTL Object, cl_ioctl_handle_t, cl_ioctl_type, cl_ioctl_ctl_code\r
+********/\r
+\r
+\r
+/****f* Component Library: IOCTL Object/cl_ioctl_ctl_code\r
+* NAME\r
+* cl_ioctl_ctl_code\r
+*\r
+* DESCRIPTION\r
+* Returns the 32-bit control code of an IOCTL\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT uint32_t CL_API\r
+cl_ioctl_ctl_code(\r
+ IN cl_ioctl_handle_t h_ioctl );\r
+/*\r
+* PARAMETERS\r
+* h_ioctl\r
+* [in] Handle to an IOCTL\r
+*\r
+* RETURN VALUE\r
+* Returns the 32-bit control code of the specified IOCTL request,\r
+* as defined using the IOCTL_CMD macro.\r
+*\r
+* NOTES\r
+* The cl_ioctl_ctl_code function is only available in the kernel.\r
+*\r
+* SEE ALSO\r
+* IOCTL Object, cl_ioctl_handle_t, cl_ioctl_type, cl_ioctl_cmd\r
+********/\r
+\r
+\r
+/****f* Component Library: IOCTL Object/cl_ioctl_in_buf\r
+* NAME\r
+* cl_ioctl_in_buf\r
+*\r
+* DESCRIPTION\r
+* Returns a pointer to the input buffer of an IOCTL.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void* CL_API\r
+cl_ioctl_in_buf(\r
+ IN cl_ioctl_handle_t h_ioctl );\r
+/*\r
+* PARAMETERS\r
+* h_ioctl\r
+* [in] Handle to an IOCTL\r
+*\r
+* RETURN VALUE\r
+* Returns the input buffer of the specified IOCTL request.\r
+*\r
+* NOTES\r
+* The cl_ioctl_in_buf function is only available in the kernel.\r
+*\r
+* In Windows, for IOCTL operations defined as METHOD_IN_DIRECT, the\r
+* returned pointer points to the MDL describing the input buffer.\r
+*\r
+* SEE ALSO\r
+* IOCTL Object, cl_ioctl_handle_t, cl_ioctl_in_size,\r
+* cl_ioctl_out_buf, cl_ioctl_out_size\r
+********/\r
+\r
+\r
+/****f* Component Library: IOCTL Object/cl_ioctl_in_size\r
+* NAME\r
+* cl_ioctl_in_size\r
+*\r
+* DESCRIPTION\r
+* Returns the size of the input buffer of an IOCTL.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT ULONG CL_API\r
+cl_ioctl_in_size(\r
+ IN cl_ioctl_handle_t h_ioctl );\r
+/*\r
+* PARAMETERS\r
+* h_ioctl\r
+* [in] Handle to an IOCTL\r
+*\r
+* RETURN VALUE\r
+* Returns the size, in bytes, of the input buffer of the specified\r
+* IOCTL request.\r
+*\r
+* NOTES\r
+* The cl_ioctl_in_size function is only available in the kernel.\r
+*\r
+* SEE ALSO\r
+* IOCTL Object, cl_ioctl_handle_t, cl_ioctl_in_buf,\r
+* cl_ioctl_out_buf, cl_ioctl_out_size\r
+********/\r
+\r
+\r
+/****f* Component Library: IOCTL Object/cl_ioctl_out_buf\r
+* NAME\r
+* cl_ioctl_out_buf\r
+*\r
+* DESCRIPTION\r
+* Returns a pointer to the output buffer of an IOCTL.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void* CL_API\r
+cl_ioctl_out_buf(\r
+ IN cl_ioctl_handle_t h_ioctl );\r
+/*\r
+* PARAMETERS\r
+* h_ioctl\r
+* [in] Handle to an IOCTL\r
+*\r
+* RETURN VALUE\r
+* Returns a pointer to the output buffer of the specified IOCTL request.\r
+*\r
+* NOTES\r
+* The cl_ioctl_out_buf function is only available in the kernel.\r
+*\r
+* In Windows, for IOCTL operations defined as METHOD_IN_DIRECT or\r
+* METHOD_OUT_DIRECT, the returned pointer points to the MDL describing\r
+* the input buffer.\r
+*\r
+* SEE ALSO\r
+* IOCTL Object, cl_ioctl_handle_t, cl_ioctl_out_size,\r
+* cl_ioctl_in_buf, cl_ioctl_in_size\r
+********/\r
+\r
+\r
+/****f* Component Library: IOCTL Object/cl_ioctl_out_size\r
+* NAME\r
+* cl_ioctl_out_size\r
+*\r
+* DESCRIPTION\r
+* Returns the size of the output buffer of an IOCTL.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT ULONG CL_API\r
+cl_ioctl_out_size(\r
+ IN cl_ioctl_handle_t h_ioctl );\r
+/*\r
+* PARAMETERS\r
+* h_ioctl\r
+* [in] Handle to an IOCTL\r
+*\r
+* RETURN VALUE\r
+* Returns the size, in bytes, of the input buffer of the specified\r
+* IOCTL request.\r
+*\r
+* NOTES\r
+* The cl_ioctl_out_size function is only available in the kernel.\r
+*\r
+* SEE ALSO\r
+* IOCTL Object, cl_ioctl_handle_t, cl_ioctl_out_buf,\r
+* cl_ioctl_in_buf, cl_ioctl_in_size\r
+********/\r
+\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif /* __cplusplus */\r
+\r
+\r
+#else /* CL_KERNEL */\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif /* __cplusplus */\r
+\r
+\r
+/****f* Component Library: IOCTL Object/cl_ioctl_request\r
+* NAME\r
+* cl_ioctl_request\r
+*\r
+* DESCRIPTION\r
+* The cl_ioctl_request is used by user-mode clients to initiate IOCTL\r
+* requests to a device.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_status_t CL_API\r
+cl_ioctl_request(\r
+ IN void *h_dev,\r
+ IN uint32_t ioctl_code,\r
+ IN void *p_in_buf,\r
+ IN size_t in_size,\r
+ OUT void *p_out_buf,\r
+ IN size_t out_size,\r
+ OUT size_t *p_ret_bytes OPTIONAL,\r
+ IN void *p_async_info OPTIONAL );\r
+/*\r
+* PARAMETERS\r
+* h_dev\r
+* [in] Handle to the device to which the IOCTL request is targetted.\r
+* In Linux, this is a file descriptor. In Windows, this is a file\r
+* handle.\r
+*\r
+* ioctl_code\r
+* [in] Control code for the IOCTL request.\r
+*\r
+* p_in_buf\r
+* [in] Pointer to the input buffer.\r
+*\r
+* in_size\r
+* [in] Size, in bytes, of the input buffer.\r
+*\r
+* p_out_buf\r
+* [out] Pointer to the output buffer.\r
+*\r
+* out_size\r
+* [in] Size, in bytes, of the output buffer.\r
+*\r
+* p_ret_bytes\r
+* [out] Number of bytes written to the output buffer. This parameter is\r
+* mutually exclusive of the p_async_info parameter.\r
+*\r
+* p_async_info\r
+* [in] For platforms that support asynchronous I/O, supplies a pointer\r
+* to that platform's async I/O structure, if any. For Windows, this\r
+* is a pointer to an OVERLAPPED structure. This parameter is mutually\r
+* exclusive of the p_ret_bytes parameter.\r
+*\r
+* SEE ALSO\r
+* IOCTL Object, cl_ioctl_result\r
+*********/\r
+\r
+\r
+/****f* Component Library: IOCTL Object/cl_ioctl_result\r
+* NAME\r
+* cl_ioctl_result\r
+*\r
+* DESCRIPTION\r
+* Checks the status of an asynchronous IOCTL request.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_status_t CL_API\r
+cl_ioctl_result(\r
+ IN void *h_dev,\r
+ IN void *p_async_info,\r
+ OUT size_t *p_ret_bytes,\r
+ IN boolean_t blocking );\r
+/*\r
+* PARAMETERS\r
+* h_dev\r
+* [in] Handle to the device to which the IOCTL request is targetted.\r
+* In Linux, this is a file descriptor. In Windows, this is a file\r
+* handle.\r
+*\r
+* p_async_info\r
+* [in] For platforms that support asynchronous I/O, supplies a pointer\r
+* to that platform's async I/O structure, if any. For Windows, this\r
+* is a pointer to an OVERLAPPED structure. This must be the same\r
+* as that provided in the cl_ioctl_request function.\r
+*\r
+* p_ret_bytes\r
+* [out] Number of bytes written to the output buffer.\r
+*\r
+* blocking\r
+* [in] If TRUE, indicates that the call should wait until the\r
+* specified IOCTL request is complete.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if the IOCTL request was successful. p_ret_bytes contains\r
+* the number bytes written to the output buffer.\r
+*\r
+* CL_PENDING if the IOCTL request is not yet complete.\r
+*\r
+* Other status values to indicate errors.\r
+*\r
+* SEE ALSO\r
+* IOCTL Object, cl_ioctl_request\r
+*********/\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif /* __cplusplus */\r
+\r
+\r
+#endif /* CL_KERNEL */\r
+\r
+#endif /* _CL_IOCTL_H_ */\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+/*\r
+ * Abstract:\r
+ * Declaration of interrupt level IRQ lock object.\r
+ * \r
+ * Environment:\r
+ * All\r
+ */\r
+\r
+\r
+#ifndef _CL_IRQLOCK_H_\r
+#define _CL_IRQLOCK_H_\r
+\r
+\r
+#include <complib/cl_irqlock_osd.h>\r
+\r
+\r
+/****h* Component Library/Irqlock\r
+* NAME\r
+* Irqlock\r
+*\r
+* DESCRIPTION\r
+* Irqlock provides synchronization at interrupt level between threads for \r
+* exclusive access to a resource.\r
+*\r
+* The irqlock functions manipulate a cl_irqlock_t structure which should \r
+* be treated as opaque and should be manipulated only through the provided \r
+* functions.\r
+*\r
+* SEE ALSO\r
+* Structures:\r
+* cl_irqlock_t\r
+*\r
+* Initialization:\r
+* cl_irqlock_construct, cl_irqlock_init, cl_irqlock_destroy\r
+*\r
+* Manipulation\r
+* cl_irqlock_acquire, cl_irqlock_release\r
+*********/\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif\r
+\r
+\r
+/****f* Component Library: Irqlock/cl_irqlock_construct\r
+* NAME\r
+* cl_irqlock_construct\r
+*\r
+* DESCRIPTION\r
+* The cl_irqlock_construct function initializes the state of a \r
+* IRQ lock.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_irqlock_construct( \r
+ IN cl_irqlock_t* const p_irqlock );\r
+/*\r
+* PARAMETERS\r
+* p_irqlock \r
+* [in] Pointer to a IRQ lock structure whose state to initialize.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* Allows calling cl_irqlock_destroy without first calling \r
+* cl_irqlock_init.\r
+*\r
+* Calling cl_irqlock_construct is a prerequisite to calling any other\r
+* IRQ lock function except cl_irqlock_init.\r
+*\r
+* SEE ALSO\r
+* Irqlock, cl_irqlock_init, cl_irqlock_destroy\r
+*********/\r
+\r
+\r
+/****f* Component Library: Irqlock/cl_irqlock_init\r
+* NAME\r
+* cl_irqlock_init\r
+*\r
+* DESCRIPTION\r
+* The cl_irqlock_init function initializes a IRQ lock for use.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_status_t CL_API\r
+cl_irqlock_init( \r
+ IN cl_irqlock_t* const p_irqlock,\r
+ IN cl_interrupt_t* const p_interrupt );\r
+/*\r
+* PARAMETERS\r
+* p_irqlock \r
+* [in] Pointer to a IRQ lock structure to initialize.\r
+*\r
+* p_interrupt\r
+* [in] Platform specific pointer conveying information about the\r
+* interrupt vector and level with which to synchronize.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if initialization succeeded.\r
+*\r
+* CL_ERROR if initialization failed. Callers should call \r
+* cl_irqlock_destroy to clean up any resources allocated during \r
+* initialization.\r
+*\r
+* NOTES\r
+* Initialize the IRQ lock structure. Allows calling cl_irqlock_aquire \r
+* and cl_irqlock_release.\r
+*\r
+* In Linux, the p_interrupt parameter is currently ignored.\r
+*\r
+* In Windows, the p_interrupt parameter is a pointer to a KINTERRUPT object,\r
+* the value of which is supplied by a call to IoConnectInterrupt.\r
+*\r
+* SEE ALSO\r
+* Irqlock, cl_irqlock_construct, cl_irqlock_destroy, \r
+* cl_irqlock_acquire, cl_irqlock_release\r
+*********/\r
+\r
+\r
+/****f* Component Library: Irqlock/cl_irqlock_destroy\r
+* NAME\r
+* cl_irqlock_destroy\r
+*\r
+* DESCRIPTION\r
+* The cl_irqlock_destroy function performs all necessary cleanup of a \r
+* IRQ lock.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_irqlock_destroy( \r
+ IN cl_irqlock_t* const p_irqlock );\r
+/*\r
+* PARAMETERS\r
+* p_irqlock \r
+* [in] Pointer to a IRQ lock structure to destroy.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* Performs any necessary cleanup of a IRQ lock. This function must only \r
+* be called if either cl_irqlock_construct or cl_irqlock_init has been \r
+* called.\r
+*\r
+* SEE ALSO\r
+* Irqlock, cl_irqlock_construct, cl_irqlock_init\r
+*********/\r
+\r
+\r
+/****f* Component Library: Irqlock/cl_irqlock_acquire\r
+* NAME\r
+* cl_irqlock_acquire\r
+*\r
+* DESCRIPTION\r
+* The cl_irqlock_acquire function acquires a IRQ lock.\r
+* This version of lock does not prevent an interrupt from \r
+* occuring on the processor on which the code is being\r
+* executed. To protect from an interrupt level resource\r
+* use the cl_irqlock_acquire_irq function.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_irqlock_acquire( \r
+ IN cl_irqlock_t* const p_irqlock );\r
+/*\r
+* PARAMETERS\r
+* p_irqlock \r
+* [in] Pointer to a IRQ lock structure to acquire.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* SEE ALSO\r
+* Irqlock, cl_irqlock_release\r
+*********/\r
+\r
+\r
+/****f* Component Library: Irqlock/cl_irqlock_release\r
+* NAME\r
+* cl_irqlock_release\r
+*\r
+* DESCRIPTION\r
+* The cl_irqlock_release function releases a IRQ lock object.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_irqlock_release(\r
+ IN cl_irqlock_t* const p_irqlock );\r
+/*\r
+* PARAMETERS\r
+* p_irqlock \r
+* [in] Pointer to a IRQ lock structure to release.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* Releases a IRQ lock after a call to cl_irqlock_acquire.\r
+*\r
+* SEE ALSO\r
+* Irqlock, cl_irqlock_acquire\r
+*********/\r
+\r
+\r
+#ifdef __cplusplus\r
+} /* extern "C" */\r
+#endif\r
+\r
+#endif /* _CL_IRQLOCK_H_ */\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. \r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+/*\r
+ * Abstract:\r
+ * Declaration of list.\r
+ *\r
+ * Environment:\r
+ * All\r
+ */\r
+\r
+\r
+#ifndef _CL_LIST_H_\r
+#define _CL_LIST_H_\r
+\r
+\r
+#include <complib/cl_qlist.h>\r
+#include <complib/cl_qpool.h>\r
+\r
+\r
+/****h* Component Library/List\r
+* NAME\r
+* List\r
+*\r
+* DESCRIPTION\r
+* List stores objects in a doubly linked list.\r
+*\r
+* Unlike quick list, users pass pointers to the object being stored, rather\r
+* than to a cl_list_item_t structure. Insertion operations on a list can\r
+* fail, and callers should trap for such failures.\r
+*\r
+* Use quick list in situations where insertion failures cannot be tolerated.\r
+*\r
+* List is not thread safe, and users must provide serialization.\r
+*\r
+* The list functions operates on a cl_list_t structure which should be\r
+* treated as opaque and should be manipulated only through the provided\r
+* functions.\r
+*\r
+* SEE ALSO\r
+* Types:\r
+* cl_list_iterator_t\r
+*\r
+* Structures:\r
+* cl_list_t\r
+*\r
+* Callbacks:\r
+* cl_pfn_list_apply_t, cl_pfn_list_find_t\r
+*\r
+* Initialization/Destruction:\r
+* cl_list_construct, cl_list_init, cl_list_destroy\r
+*\r
+* Iteration:\r
+* cl_list_next, cl_list_prev, cl_list_head, cl_list_tail,\r
+* cl_list_end\r
+*\r
+* Manipulation:\r
+* cl_list_insert_head, cl_list_insert_tail,\r
+* cl_list_insert_array_head, cl_list_insert_array_tail,\r
+* cl_list_insert_prev, cl_list_insert_next,\r
+* cl_list_remove_head, cl_list_remove_tail,\r
+* cl_list_remove_object, cl_list_remove_item, cl_list_remove_all\r
+*\r
+* Search:\r
+* cl_is_object_in_list, cl_list_find_from_head, cl_list_find_from_tail,\r
+* cl_list_apply_func\r
+*\r
+* Attributes:\r
+* cl_list_count, cl_is_list_empty, cl_is_list_inited\r
+*********/\r
+\r
+\r
+/****s* Component Library: List/cl_list_t\r
+* NAME\r
+* cl_list_t\r
+*\r
+* DESCRIPTION\r
+* List structure.\r
+*\r
+* The cl_list_t structure should be treated as opaque and should be\r
+* manipulated only through the provided functions.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _cl_list\r
+{\r
+ cl_qlist_t list;\r
+ cl_qpool_t list_item_pool;\r
+\r
+} cl_list_t;\r
+/*\r
+* FIELDS\r
+* list\r
+* Quick list of items stored in the list.\r
+*\r
+* list_item_pool\r
+* Quick pool of list objects for storing objects in the quick list.\r
+*\r
+* SEE ALSO\r
+* List\r
+*********/\r
+\r
+\r
+/****d* Component Library: List/cl_list_iterator_t\r
+* NAME\r
+* cl_list_iterator_t\r
+*\r
+* DESCRIPTION\r
+* Iterator type used to walk a list.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef const cl_list_item_t *cl_list_iterator_t;\r
+/*\r
+* NOTES\r
+* The iterator should be treated as opaque to prevent corrupting the list.\r
+*\r
+* SEE ALSO\r
+* List, cl_list_head, cl_list_tail, cl_list_next, cl_list_prev,\r
+* cl_list_obj\r
+*********/\r
+\r
+\r
+/****d* Component Library: List/cl_pfn_list_apply_t\r
+* NAME\r
+* cl_pfn_list_apply_t\r
+*\r
+* DESCRIPTION\r
+* The cl_pfn_list_apply_t function type defines the prototype for functions\r
+* used to iterate objects in a list.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef void\r
+(CL_API *cl_pfn_list_apply_t)(\r
+ IN void* const p_object,\r
+ IN void* context );\r
+/*\r
+* PARAMETERS\r
+* p_object\r
+* [in] Pointer to an object stored in a list.\r
+*\r
+* context\r
+* [in] Context provided in a call to cl_list_apply_func.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* This function type is provided as function prototype reference for the\r
+* function provided by users as a parameter to the cl_list_apply_func\r
+* function.\r
+*\r
+* SEE ALSO\r
+* List, cl_list_apply_func\r
+*********/\r
+\r
+\r
+/****d* Component Library: List/cl_pfn_list_find_t\r
+* NAME\r
+* cl_pfn_list_find_t\r
+*\r
+* DESCRIPTION\r
+* The cl_pfn_list_find_t function type defines the prototype for functions\r
+* used to find objects in a list.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef cl_status_t\r
+(CL_API *cl_pfn_list_find_t)(\r
+ IN const void* const p_object,\r
+ IN void* context );\r
+/*\r
+* PARAMETERS\r
+* p_object\r
+* [in] Pointer to an object stored in a list.\r
+*\r
+* context\r
+* [in] Context provided in a call to ListFindFromHead or ListFindFromTail.\r
+*\r
+* RETURN VALUES\r
+* Return CL_SUCCESS if the desired item was found. This stops list iteration.\r
+*\r
+* Return CL_NOT_FOUND to continue the list iteration.\r
+*\r
+* NOTES\r
+* This function type is provided as function prototype reference for the\r
+* function provided by users as a parameter to the cl_list_find_from_head\r
+* and cl_list_find_from_tail functions.\r
+*\r
+* SEE ALSO\r
+* List, cl_list_find_from_head, cl_list_find_from_tail\r
+*********/\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif\r
+\r
+\r
+/****f* Component Library: List/cl_list_construct\r
+* NAME\r
+* cl_list_construct\r
+*\r
+* DESCRIPTION\r
+* The cl_list_construct function constructs a list.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_list_construct(\r
+ IN cl_list_t* const p_list );\r
+/*\r
+* PARAMETERS\r
+* p_list\r
+* [in] Pointer to cl_list_t object whose state to initialize.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* Allows calling cl_list_init, cl_list_destroy and cl_is_list_inited.\r
+*\r
+* Calling cl_list_construct is a prerequisite to calling any other\r
+* list function except cl_list_init.\r
+*\r
+* SEE ALSO\r
+* List, cl_list_init, cl_list_destroy, cl_is_list_inited\r
+*********/\r
+\r
+\r
+/****f* Component Library: List/cl_is_list_inited\r
+* NAME\r
+* cl_is_list_inited\r
+*\r
+* DESCRIPTION\r
+* The cl_is_list_inited function returns whether a list was\r
+* initialized successfully.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE boolean_t CL_API\r
+cl_is_list_inited(\r
+ IN const cl_list_t* const p_list )\r
+{\r
+ /* CL_ASSERT that a non-null pointer is provided. */\r
+ CL_ASSERT( p_list );\r
+ /*\r
+ * The pool is the last thing initialized. If it is initialized, the\r
+ * list is initialized too.\r
+ */\r
+ return( cl_is_qpool_inited( &p_list->list_item_pool ) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_list\r
+* [in] Pointer to a cl_list_t structure whose initilization state\r
+* to check.\r
+*\r
+* RETURN VALUES\r
+* TRUE if the list was initialized successfully.\r
+*\r
+* FALSE otherwise.\r
+*\r
+* NOTES\r
+* Allows checking the state of a list to determine if invoking\r
+* member functions is appropriate.\r
+*\r
+* SEE ALSO\r
+* List\r
+*********/\r
+\r
+\r
+/****f* Component Library: List/cl_list_init\r
+* NAME\r
+* cl_list_init\r
+*\r
+* DESCRIPTION\r
+* The cl_list_init function initializes a list for use.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_status_t CL_API\r
+cl_list_init(\r
+ IN cl_list_t* const p_list,\r
+ IN const size_t min_items );\r
+/*\r
+* PARAMETERS\r
+* p_list\r
+* [in] Pointer to cl_list_t structure to initialize.\r
+*\r
+* min_items\r
+* [in] Minimum number of items that can be stored. All necessary\r
+* allocations to allow storing the minimum number of items is performed\r
+* at initialization time.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if the list was initialized successfully.\r
+*\r
+* CL_INSUFFICIENT_MEMORY if there was not enough memory for initialization.\r
+*\r
+* NOTES\r
+* The list will always be able to store at least as many items as specified\r
+* by the min_items parameter.\r
+*\r
+* SEE ALSO\r
+* List, cl_list_construct, cl_list_destroy, cl_list_insert_head,\r
+* cl_list_insert_tail, cl_list_remove_head, cl_list_remove_tail\r
+*********/\r
+\r
+\r
+/****f* Component Library: List/cl_list_destroy\r
+* NAME\r
+* cl_list_destroy\r
+*\r
+* DESCRIPTION\r
+* The cl_list_destroy function destroys a list.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_list_destroy(\r
+ IN cl_list_t* const p_list );\r
+/*\r
+* PARAMETERS\r
+* p_list\r
+* [in] Pointer to cl_list_t structure to destroy.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* cl_list_destroy does not affect any of the objects stored in the list,\r
+* but does release all memory allocated internally. Further operations\r
+* should not be attempted on the list after cl_list_destroy is invoked.\r
+*\r
+* This function should only be called after a call to cl_list_construct\r
+* or cl_list_init.\r
+*\r
+* In debug builds, cl_list_destroy asserts if the list is not empty.\r
+*\r
+* SEE ALSO\r
+* List, cl_list_construct, cl_list_init\r
+*********/\r
+\r
+\r
+/****f* Component Library: List/cl_is_list_empty\r
+* NAME\r
+* cl_is_list_empty\r
+*\r
+* DESCRIPTION\r
+* The cl_is_list_empty function returns whether a list is empty.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE boolean_t CL_API\r
+cl_is_list_empty(\r
+ IN const cl_list_t* const p_list )\r
+{\r
+ CL_ASSERT( p_list );\r
+ CL_ASSERT( cl_is_qpool_inited( &p_list->list_item_pool ) );\r
+ return( cl_is_qlist_empty( &p_list->list ) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_list\r
+* [in] Pointer to a cl_list_t structure.\r
+*\r
+* RETURN VALUES\r
+* TRUE if the specified list is empty.\r
+*\r
+* FALSE otherwise.\r
+*\r
+* SEE ALSO\r
+* List, cl_list_count, cl_list_remove_all\r
+*********/\r
+\r
+\r
+/****f* Component Library: List/cl_list_insert_head\r
+* NAME\r
+* cl_list_insert_head\r
+*\r
+* DESCRIPTION\r
+* The cl_list_insert_head function inserts an object at the head of a list.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE cl_status_t CL_API\r
+cl_list_insert_head(\r
+ IN cl_list_t* const p_list,\r
+ IN const void* const p_object )\r
+{\r
+ cl_pool_obj_t *p_pool_obj;\r
+\r
+ CL_ASSERT( p_list );\r
+ CL_ASSERT( cl_is_qpool_inited( &p_list->list_item_pool ) );\r
+\r
+ /* Get a list item to add to the list. */\r
+ p_pool_obj = (cl_pool_obj_t*)cl_qpool_get( &p_list->list_item_pool );\r
+ if( !p_pool_obj )\r
+ return( CL_INSUFFICIENT_MEMORY );\r
+\r
+ p_pool_obj->list_obj.p_object = p_object;\r
+ cl_qlist_insert_head( &p_list->list, &p_pool_obj->list_obj.list_item );\r
+ return( CL_SUCCESS );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_list\r
+* [in] Pointer to a cl_list_t structure into which to insert the object.\r
+*\r
+* p_object\r
+* [in] Pointer to an object to insert into the list.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if the insertion was successful.\r
+*\r
+* CL_INSUFFICIENT_MEMORY if there was not enough memory for the insertion.\r
+*\r
+* NOTES\r
+* Inserts the specified object at the head of the list. List insertion\r
+* operations are guaranteed to work for the minimum number of items as\r
+* specified in cl_list_init by the min_items parameter.\r
+*\r
+* SEE ALSO\r
+* List, cl_list_insert_tail, cl_list_insert_array_head,\r
+* cl_list_insert_array_tail, cl_list_insert_prev, cl_list_insert_next,\r
+* cl_list_remove_head\r
+*********/\r
+\r
+\r
+/****f* Component Library: List/cl_list_insert_tail\r
+* NAME\r
+* cl_list_insert_tail\r
+*\r
+* DESCRIPTION\r
+* The cl_list_insert_tail function inserts an object at the head of a list.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE cl_status_t CL_API\r
+cl_list_insert_tail(\r
+ IN cl_list_t* const p_list,\r
+ IN const void* const p_object )\r
+{\r
+ cl_pool_obj_t *p_pool_obj;\r
+\r
+ CL_ASSERT( p_list );\r
+ CL_ASSERT( cl_is_qpool_inited( &p_list->list_item_pool ) );\r
+\r
+ /* Get a list item to add to the list. */\r
+ p_pool_obj = (cl_pool_obj_t*)cl_qpool_get( &p_list->list_item_pool );\r
+ if( !p_pool_obj )\r
+ return( CL_INSUFFICIENT_MEMORY );\r
+\r
+ p_pool_obj->list_obj.p_object = p_object;\r
+ cl_qlist_insert_tail( &p_list->list, &p_pool_obj->list_obj.list_item );\r
+ return( CL_SUCCESS );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_list\r
+* [in] Pointer to a cl_list_t structure into which to insert the object.\r
+*\r
+* p_object\r
+* [in] Pointer to an object to insert into the list.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if the insertion was successful.\r
+*\r
+* CL_INSUFFICIENT_MEMORY if there was not enough memory for the insertion.\r
+*\r
+* NOTES\r
+* Inserts the specified object at the tail of the list. List insertion\r
+* operations are guaranteed to work for the minimum number of items as\r
+* specified in cl_list_init by the min_items parameter.\r
+*\r
+* SEE ALSO\r
+* List, cl_list_insert_head, cl_list_insert_array_head,\r
+* cl_list_insert_array_tail, cl_list_insert_prev, cl_list_insert_next,\r
+* cl_list_remove_tail\r
+*********/\r
+\r
+\r
+/****f* Component Library: List/cl_list_insert_array_head\r
+* NAME\r
+* cl_list_insert_array_head\r
+*\r
+* DESCRIPTION:\r
+* The cl_list_insert_array_head function inserts an array of objects\r
+* at the head of a list.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_status_t CL_API\r
+cl_list_insert_array_head(\r
+ IN cl_list_t* const p_list,\r
+ IN const void* const p_array,\r
+ IN uint32_t item_count,\r
+ IN const uint32_t item_size );\r
+/*\r
+* PARAMETERS\r
+* p_list\r
+* [in] Pointer to a cl_list_t structure into which to insert the objects.\r
+*\r
+* p_array\r
+* [in] Pointer to the first object in an array.\r
+*\r
+* item_count\r
+* [in] Number of objects in the array.\r
+*\r
+* item_size\r
+* [in] Size of the objects added to the list. This is the stride in the\r
+* array from one object to the next.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if the insertion was successful.\r
+*\r
+* CL_INSUFFICIENT_MEMORY if there was not enough memory for the insertion.\r
+*\r
+* NOTES\r
+* Inserts all objects in the array to the head of the list, preserving the\r
+* ordering of the objects. If not successful, no items are added.\r
+* List insertion operations are guaranteed to work for the minimum number\r
+* of items as specified in cl_list_init by the min_items parameter.\r
+*\r
+* SEE ALSO\r
+* List, cl_list_insert_array_tail, cl_list_insert_head, cl_list_insert_tail,\r
+* cl_list_insert_prev, cl_list_insert_next\r
+*********/\r
+\r
+\r
+/****f* Component Library: List/cl_list_insert_array_tail\r
+* NAME\r
+* cl_list_insert_array_tail\r
+*\r
+* DESCRIPTION\r
+* The cl_list_insert_array_tail function inserts an array of objects\r
+* at the tail of a list.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_status_t CL_API\r
+cl_list_insert_array_tail(\r
+ IN cl_list_t* const p_list,\r
+ IN const void* const p_array,\r
+ IN uint32_t item_count,\r
+ IN const uint32_t item_size);\r
+/*\r
+* PARAMETERS\r
+* p_list\r
+* [in] Pointer to a cl_list_t structure into which to insert the objects.\r
+*\r
+* p_array\r
+* [in] Pointer to the first object in an array.\r
+*\r
+* item_count\r
+* [in] Number of objects in the array.\r
+*\r
+* item_size\r
+* [in] Size of the objects added to the list. This is the stride in the\r
+* array from one object to the next.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if the insertion was successful.\r
+*\r
+* CL_INSUFFICIENT_MEMORY if there was not enough memory for the insertion.\r
+*\r
+* NOTES\r
+* Inserts all objects in the array to the tail of the list, preserving the\r
+* ordering of the objects. If not successful, no items are added.\r
+* List insertion operations are guaranteed to work for the minimum number\r
+* of items as specified in cl_list_init by the min_items parameter.\r
+*\r
+* SEE ALSO\r
+* List, cl_list_insert_array_head, cl_list_insert_head, cl_list_insert_tail,\r
+* cl_list_insert_prev, cl_list_insert_next\r
+*********/\r
+\r
+\r
+/****f* Component Library: List/cl_list_insert_next\r
+* NAME\r
+* cl_list_insert_next\r
+*\r
+* DESCRIPTION\r
+* The cl_list_insert_next function inserts an object in a list after\r
+* the object associated with a given iterator.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE cl_status_t CL_API\r
+cl_list_insert_next(\r
+ IN cl_list_t* const p_list,\r
+ IN const cl_list_iterator_t iterator,\r
+ IN const void* const p_object )\r
+{\r
+ cl_pool_obj_t *p_pool_obj;\r
+\r
+ CL_ASSERT( p_list );\r
+ CL_ASSERT( cl_is_qpool_inited( &p_list->list_item_pool ) );\r
+\r
+ /* Get a list item to add to the list. */\r
+ p_pool_obj = (cl_pool_obj_t*)cl_qpool_get( &p_list->list_item_pool );\r
+ if( !p_pool_obj )\r
+ return( CL_INSUFFICIENT_MEMORY );\r
+\r
+ p_pool_obj->list_obj.p_object = p_object;\r
+ cl_qlist_insert_next( &p_list->list, (cl_list_item_t*)iterator,\r
+ &p_pool_obj->list_obj.list_item );\r
+ return( CL_SUCCESS );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_list\r
+* [in] Pointer to a cl_list_t structure into which to insert the object.\r
+*\r
+* iterator\r
+* [in] cl_list_iterator_t returned by a previous call to cl_list_head,\r
+* cl_list_tail, cl_list_next, or cl_list_prev.\r
+*\r
+* p_object\r
+* [in] Pointer to an object to insert into the list.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if the insertion was successful.\r
+*\r
+* CL_INSUFFICIENT_MEMORY if there was not enough memory for the insertion.\r
+*\r
+* SEE ALSO\r
+* List, cl_list_insert_prev, cl_list_insert_head, cl_list_insert_tail,\r
+* cl_list_insert_array_head, cl_list_insert_array_tail\r
+*********/\r
+\r
+\r
+\r
+/****f* Component Library: List/cl_list_insert_prev\r
+* NAME\r
+* cl_list_insert_prev\r
+*\r
+* DESCRIPTION\r
+* The cl_list_insert_prev function inserts an object in a list before\r
+* the object associated with a given iterator.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE cl_status_t CL_API\r
+cl_list_insert_prev(\r
+ IN cl_list_t* const p_list,\r
+ IN const cl_list_iterator_t iterator,\r
+ IN const void* const p_object )\r
+{\r
+ cl_pool_obj_t *p_pool_obj;\r
+\r
+ CL_ASSERT( p_list );\r
+ CL_ASSERT( cl_is_qpool_inited( &p_list->list_item_pool ) );\r
+\r
+ /* Get a list item to add to the list. */\r
+ p_pool_obj = (cl_pool_obj_t*)cl_qpool_get( &p_list->list_item_pool );\r
+ if( !p_pool_obj )\r
+ return( CL_INSUFFICIENT_MEMORY );\r
+\r
+ p_pool_obj->list_obj.p_object = p_object;\r
+ cl_qlist_insert_prev( &p_list->list, (cl_list_item_t*)iterator,\r
+ &p_pool_obj->list_obj.list_item );\r
+ return( CL_SUCCESS );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_list\r
+* [in] Pointer to a cl_list_t structure into which to insert the object.\r
+*\r
+* iterator\r
+* [in] cl_list_iterator_t returned by a previous call to cl_list_head,\r
+* cl_list_tail, cl_list_next, or cl_list_prev.\r
+*\r
+* p_object\r
+* [in] Pointer to an object to insert into the list.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if the insertion was successful.\r
+*\r
+* CL_INSUFFICIENT_MEMORY if there was not enough memory for the insertion.\r
+*\r
+* SEE ALSO\r
+* List, cl_list_insert_next, cl_list_insert_head, cl_list_insert_tail,\r
+* cl_list_insert_array_head, cl_list_insert_array_tail\r
+*********/\r
+\r
+\r
+/****f* Component Library: List/cl_list_remove_head\r
+* NAME\r
+* cl_list_remove_head\r
+*\r
+* DESCRIPTION\r
+* The cl_list_remove_head function removes an object from the head of a list.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE void* CL_API\r
+cl_list_remove_head(\r
+ IN cl_list_t* const p_list )\r
+{\r
+ cl_pool_obj_t *p_pool_obj;\r
+\r
+ CL_ASSERT( p_list );\r
+ CL_ASSERT( cl_is_qpool_inited( &p_list->list_item_pool ) );\r
+\r
+ /* See if the list is empty. */\r
+ if( cl_is_qlist_empty( &p_list->list ) )\r
+ return( NULL );\r
+\r
+ /* Get the item at the head of the list. */\r
+ p_pool_obj = (cl_pool_obj_t*)cl_qlist_remove_head( &p_list->list );\r
+\r
+ /* Place the pool item back into the pool. */\r
+ cl_qpool_put( &p_list->list_item_pool, (cl_pool_item_t*)p_pool_obj );\r
+\r
+ return( (void*)p_pool_obj->list_obj.p_object );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_list\r
+* [in] Pointer to a cl_list_t structure from which to remove an object.\r
+*\r
+* RETURN VALUES\r
+* Returns the pointer to the object formerly at the head of the list.\r
+*\r
+* NULL if the list was empty.\r
+*\r
+* SEE ALSO\r
+* List, cl_list_remove_tail, cl_list_remove_all, cl_list_remove_object,\r
+* cl_list_remove_item, cl_list_insert_head\r
+*********/\r
+\r
+\r
+/****f* Component Library: List/cl_list_remove_tail\r
+* NAME\r
+* cl_list_remove_tail\r
+*\r
+* DESCRIPTION\r
+* The cl_list_remove_tail function removes an object from the tail of a list.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE void* CL_API\r
+cl_list_remove_tail(\r
+ IN cl_list_t* const p_list )\r
+{\r
+ cl_pool_obj_t *p_pool_obj;\r
+\r
+ CL_ASSERT( p_list );\r
+ CL_ASSERT( cl_is_qpool_inited( &p_list->list_item_pool ) );\r
+\r
+ /* See if the list is empty. */\r
+ if( cl_is_qlist_empty( &p_list->list ) )\r
+ return( NULL );\r
+\r
+ /* Get the item at the head of the list. */\r
+ p_pool_obj = (cl_pool_obj_t*)cl_qlist_remove_tail( &p_list->list );\r
+\r
+ /* Place the list item back into the pool. */\r
+ cl_qpool_put( &p_list->list_item_pool, (cl_pool_item_t*)p_pool_obj );\r
+\r
+ return( (void*)p_pool_obj->list_obj.p_object );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_list\r
+* [in] Pointer to a cl_list_t structure from which to remove an object.\r
+*\r
+* RETURN VALUES\r
+* Returns the pointer to the object formerly at the tail of the list.\r
+*\r
+* NULL if the list was empty.\r
+*\r
+* SEE ALSO\r
+* List, cl_list_remove_head, cl_list_remove_all, cl_list_remove_object,\r
+* cl_list_remove_item, cl_list_insert_head\r
+*********/\r
+\r
+\r
+/****f* Component Library: List/cl_list_remove_all\r
+* NAME\r
+* cl_list_remove_all\r
+*\r
+* DESCRIPTION\r
+* The cl_list_remove_all function removes all objects from a list,\r
+* leaving it empty.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE void CL_API\r
+cl_list_remove_all(\r
+ IN cl_list_t* const p_list )\r
+{\r
+ CL_ASSERT( p_list );\r
+ CL_ASSERT( cl_is_qpool_inited( &p_list->list_item_pool ) );\r
+\r
+ /* Return all the list items to the pool. */\r
+ cl_qpool_put_list( &p_list->list_item_pool, &p_list->list );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_list\r
+* [in] Pointer to a cl_list_t structure from which to remove all objects.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* SEE ALSO\r
+* List, cl_list_remove_head, cl_list_remove_tail, cl_list_remove_object,\r
+* cl_list_remove_item\r
+*********/\r
+\r
+\r
+/****f* Component Library: List/cl_list_remove_object\r
+* NAME\r
+* cl_list_remove_object\r
+*\r
+* DESCRIPTION\r
+* The cl_list_remove_object function removes a specific object from a list.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_status_t CL_API\r
+cl_list_remove_object(\r
+ IN cl_list_t* const p_list,\r
+ IN const void* const p_object );\r
+/*\r
+* PARAMETERS\r
+* p_list\r
+* [in] Pointer to a cl_list_t structure from which to remove the object.\r
+*\r
+* p_object\r
+* [in] Pointer to an object to remove from the list.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if the object was removed.\r
+*\r
+* CL_NOT_FOUND if the object was not found in the list.\r
+*\r
+* NOTES\r
+* Removes the first occurrence of an object from a list.\r
+*\r
+* SEE ALSO\r
+* List, cl_list_remove_item, cl_list_remove_head, cl_list_remove_tail,\r
+* cl_list_remove_all\r
+*********/\r
+\r
+\r
+/****f* Component Library: List/cl_list_remove_item\r
+* NAME\r
+* cl_list_remove_item\r
+*\r
+* DESCRIPTION\r
+* The cl_list_remove_item function removes an object from the head of a list.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE void CL_API\r
+cl_list_remove_item(\r
+ IN cl_list_t* const p_list,\r
+ IN const cl_list_iterator_t iterator )\r
+{\r
+ CL_ASSERT( p_list );\r
+ CL_ASSERT( cl_is_qpool_inited( &p_list->list_item_pool ) );\r
+\r
+ cl_qlist_remove_item( &p_list->list, (cl_list_item_t*)iterator );\r
+\r
+ /* Place the list item back into the pool. */\r
+ cl_qpool_put( &p_list->list_item_pool, (cl_pool_item_t*)iterator );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_list\r
+* [in] Pointer to a cl_list_t structure from which to remove the item.\r
+*\r
+* iterator\r
+* [in] cl_list_iterator_t returned by a previous call to cl_list_head,\r
+* cl_list_tail, cl_list_next, or cl_list_prev.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* SEE ALSO\r
+* List, cl_list_remove_object, cl_list_remove_head, cl_list_remove_tail,\r
+* cl_list_remove_all\r
+*********/\r
+\r
+\r
+/****f* Component Library: List/cl_is_object_in_list\r
+* NAME\r
+* cl_is_object_in_list\r
+*\r
+* DESCRIPTION\r
+* The cl_is_object_in_list function returns whether an object\r
+* is stored in a list.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT boolean_t CL_API\r
+cl_is_object_in_list(\r
+ IN const cl_list_t* const p_list,\r
+ IN const void* const p_object );\r
+/*\r
+* PARAMETERS\r
+* p_list\r
+* [in] Pointer to a cl_list_t structure in which to look for the object.\r
+*\r
+* p_object\r
+* [in] Pointer to an object stored in a list.\r
+*\r
+* RETURN VALUES\r
+* TRUE if p_object was found in the list.\r
+*\r
+* FALSE otherwise.\r
+*\r
+* SEE ALSO\r
+* List\r
+*********/\r
+\r
+\r
+/****f* Component Library: List/cl_list_end\r
+* NAME\r
+* cl_list_end\r
+*\r
+* DESCRIPTION\r
+* The cl_list_end function returns returns the list iterator for\r
+* the end of a list.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE const cl_list_iterator_t CL_API\r
+cl_list_end(\r
+ IN const cl_list_t* const p_list )\r
+{\r
+ CL_ASSERT( p_list );\r
+ CL_ASSERT( cl_is_qpool_inited( &p_list->list_item_pool ) );\r
+\r
+ return( cl_qlist_end( &p_list->list ) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_list\r
+* [in] Pointer to a cl_list_t structure for which the iterator for the\r
+* object at the head is to be returned.\r
+*\r
+* RETURN VALUE\r
+* cl_list_iterator_t for the end of the list.\r
+*\r
+* NOTES\r
+* Use cl_list_obj to retrieve the object associated with the\r
+* returned cl_list_iterator_t.\r
+*\r
+* SEE ALSO\r
+* List, cl_list_head, cl_list_tail, cl_list_next, cl_list_prev,\r
+* cl_list_obj\r
+*********/\r
+\r
+\r
+/****f* Component Library: List/cl_list_head\r
+* NAME\r
+* cl_list_head\r
+*\r
+* DESCRIPTION\r
+* The cl_list_head function returns returns a list iterator for\r
+* the head of a list.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE const cl_list_iterator_t CL_API\r
+cl_list_head(\r
+ IN const cl_list_t* const p_list )\r
+{\r
+ CL_ASSERT( p_list );\r
+ CL_ASSERT( cl_is_qpool_inited( &p_list->list_item_pool ) );\r
+\r
+ return( cl_qlist_head( &p_list->list ) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_list\r
+* [in] Pointer to a cl_list_t structure for which the iterator for the\r
+* object at the head is to be returned.\r
+*\r
+* RETURN VALUES\r
+* cl_list_iterator_t for the head of the list.\r
+*\r
+* cl_list_iterator_t for the end of the list if the list is empty.\r
+*\r
+* NOTES\r
+* Use cl_list_obj to retrieve the object associated with the\r
+* returned cl_list_iterator_t.\r
+*\r
+* SEE ALSO\r
+* List, cl_list_tail, cl_list_next, cl_list_prev, cl_list_end,\r
+* cl_list_obj\r
+*********/\r
+\r
+\r
+/****f* Component Library: List/cl_list_tail\r
+* NAME\r
+* cl_list_tail\r
+*\r
+* DESCRIPTION\r
+* The cl_list_tail function returns returns a list iterator for\r
+* the tail of a list.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE const cl_list_iterator_t CL_API\r
+cl_list_tail(\r
+ IN const cl_list_t* const p_list )\r
+{\r
+ CL_ASSERT( p_list );\r
+ CL_ASSERT( cl_is_qpool_inited( &p_list->list_item_pool ) );\r
+\r
+ return( cl_qlist_tail( &p_list->list ) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_list\r
+* [in] Pointer to a cl_list_t structure for which the iterator for the\r
+* object at the tail is to be returned.\r
+*\r
+* RETURN VALUES\r
+* cl_list_iterator_t for the tail of the list.\r
+*\r
+* cl_list_iterator_t for the end of the list if the list is empty.\r
+*\r
+* NOTES\r
+* Use cl_list_obj to retrieve the object associated with the\r
+*\r
+* returned cl_list_iterator_t.\r
+*\r
+* SEE ALSO\r
+* List, cl_list_head, cl_list_next, cl_list_prev, cl_list_end,\r
+* cl_list_obj\r
+*********/\r
+\r
+\r
+/****f* Component Library: List/cl_list_next\r
+* NAME\r
+* cl_list_next\r
+*\r
+* DESCRIPTION\r
+* The cl_list_next function returns a list iterator for the object stored\r
+* in a list after the object associated with a given list iterator.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE const cl_list_iterator_t CL_API\r
+cl_list_next(\r
+ IN const cl_list_iterator_t iterator )\r
+{\r
+ CL_ASSERT( iterator );\r
+\r
+ return( cl_qlist_next( iterator ) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_list\r
+* [in] Pointer to a cl_list_t structure for which the iterator for the\r
+* next object is to be returned.\r
+*\r
+* iterator\r
+* [in] cl_list_iterator_t returned by a previous call to cl_list_head,\r
+* cl_list_tail, cl_list_next, or cl_list_prev.\r
+*\r
+* RETURN VALUES\r
+* cl_list_iterator_t for the object following the object associated with\r
+* the list iterator specified by the iterator parameter.\r
+*\r
+* cl_list_iterator_t for the end of the list if the list is empty.\r
+*\r
+* NOTES\r
+* Use cl_list_obj to retrieve the object associated with the\r
+* returned cl_list_iterator_t.\r
+*\r
+* SEE ALSO\r
+* List, cl_list_prev, cl_list_head, cl_list_tail, cl_list_end,\r
+* cl_list_obj\r
+*********/\r
+\r
+\r
+/****f* Component Library: List/cl_list_prev\r
+* NAME\r
+* cl_list_prev\r
+*\r
+* DESCRIPTION\r
+* The cl_list_prev function returns a list iterator for the object stored\r
+* in a list before the object associated with a given list iterator.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE const cl_list_iterator_t CL_API\r
+cl_list_prev(\r
+ IN const cl_list_iterator_t iterator )\r
+{\r
+ CL_ASSERT( iterator );\r
+\r
+ return( cl_qlist_prev( iterator ) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_list\r
+* [in] Pointer to a cl_list_t structure for which the iterator for the\r
+* next object is to be returned.\r
+*\r
+* iterator\r
+* [in] cl_list_iterator_t returned by a previous call to cl_list_head,\r
+* cl_list_tail, cl_list_next, or cl_list_prev.\r
+*\r
+* RETURN VALUES\r
+* cl_list_iterator_t for the object preceding the object associated with\r
+* the list iterator specified by the iterator parameter.\r
+*\r
+* cl_list_iterator_t for the end of the list if the list is empty.\r
+*\r
+* NOTES\r
+* Use cl_list_obj to retrieve the object associated with the\r
+* returned cl_list_iterator_t.\r
+*\r
+* SEE ALSO\r
+* List, cl_list_next, cl_list_head, cl_list_tail, cl_list_end,\r
+* cl_list_obj\r
+*********/\r
+\r
+\r
+/****f* Component Library: List/cl_list_obj\r
+* NAME\r
+* cl_list_obj\r
+*\r
+* DESCRIPTION\r
+* The cl_list_obj function returns the object associated\r
+* with a list iterator.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE void* CL_API\r
+cl_list_obj(\r
+ IN const cl_list_iterator_t iterator )\r
+{\r
+ CL_ASSERT( iterator );\r
+\r
+ return( (void*)((cl_pool_obj_t*)iterator)->list_obj.p_object );\r
+}\r
+/*\r
+* PARAMETERS\r
+* iterator\r
+* [in] cl_list_iterator_t returned by a previous call to cl_list_head,\r
+* cl_list_tail, cl_list_next, or cl_list_prev whose object is requested.\r
+*\r
+* RETURN VALUE\r
+* Pointer to the object associated with the list iterator specified\r
+* by the iterator parameter.\r
+*\r
+* SEE ALSO\r
+* List, cl_list_head, cl_list_tail, cl_list_next, cl_list_prev\r
+*********/\r
+\r
+\r
+/****f* Component Library: List/cl_list_find_from_head\r
+* NAME\r
+* cl_list_find_from_head\r
+*\r
+* DESCRIPTION\r
+* The cl_list_find_from_head function uses a specified function\r
+* to search for an object starting from the head of a list.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT const cl_list_iterator_t CL_API\r
+cl_list_find_from_head(\r
+ IN const cl_list_t* const p_list,\r
+ IN cl_pfn_list_find_t pfn_func,\r
+ IN const void* const context );\r
+/*\r
+* PARAMETERS\r
+* p_list\r
+* [in] Pointer to a cl_list_t structure to search.\r
+*\r
+* pfn_func\r
+* [in] Function invoked to determine if a match was found.\r
+* See the cl_pfn_list_find_t function type declaration for details\r
+* about the callback function.\r
+*\r
+* context\r
+* [in] Value to pass to the callback functions to provide context.\r
+*\r
+* RETURN VALUES\r
+* Returns the iterator for the object if found.\r
+*\r
+* Returns the iterator for the list end otherwise.\r
+*\r
+* NOTES\r
+* cl_list_find_from_head does not remove the found object from\r
+* the list. The iterator for the object is returned when the function\r
+* provided by the pfn_func parameter returns CL_SUCCESS. The function\r
+* specified by the pfn_func parameter must not perform any list\r
+* operations as these would corrupt the list.\r
+*\r
+* SEE ALSO\r
+* List, cl_list_find_from_tail, cl_list_apply_func,\r
+* cl_pfn_list_find_t\r
+*********/\r
+\r
+\r
+/****f* Component Library: List/cl_list_find_from_tail\r
+* NAME\r
+* cl_list_find_from_tail\r
+*\r
+* DESCRIPTION\r
+* The cl_list_find_from_tail function uses a specified function\r
+* to search for an object starting from the tail of a list.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT const cl_list_iterator_t CL_API\r
+cl_list_find_from_tail(\r
+ IN const cl_list_t* const p_list,\r
+ IN cl_pfn_list_find_t pfn_func,\r
+ IN const void* const context );\r
+/*\r
+* PARAMETERS\r
+* p_list\r
+* [in] Pointer to a cl_list_t structure to search.\r
+*\r
+* pfn_func\r
+* [in] Function invoked to determine if a match was found.\r
+* See the cl_pfn_list_find_t function type declaration for details\r
+* about the callback function.\r
+*\r
+* context\r
+* [in] Value to pass to the callback functions to provide context.\r
+*\r
+* RETURN VALUES\r
+* Returns the iterator for the object if found.\r
+*\r
+* Returns the iterator for the list end otherwise.\r
+*\r
+* NOTES\r
+* cl_list_find_from_tail does not remove the found object from\r
+* the list. The iterator for the object is returned when the function\r
+* provided by the pfn_func parameter returns CL_SUCCESS. The function\r
+* specified by the pfn_func parameter must not perform any list\r
+* operations as these would corrupt the list.\r
+*\r
+* SEE ALSO\r
+* List, cl_list_find_from_head, cl_list_apply_func,\r
+* cl_pfn_list_find_t\r
+*********/\r
+\r
+\r
+/****f* Component Library: List/cl_list_apply_func\r
+* NAME\r
+* cl_list_apply_func\r
+*\r
+* DESCRIPTION\r
+* The cl_list_apply_func function executes a specified function for every\r
+* object stored in a list.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_list_apply_func(\r
+ IN const cl_list_t* const p_list,\r
+ IN cl_pfn_list_apply_t pfn_func,\r
+ IN const void* const context );\r
+/*\r
+* PARAMETERS\r
+* p_list\r
+* [in] Pointer to a cl_list_t structure to iterate.\r
+*\r
+* pfn_func\r
+* [in] Function invoked for every item in a list.\r
+* See the cl_pfn_list_apply_t function type declaration for details\r
+* about the callback function.\r
+*\r
+* context\r
+* [in] Value to pass to the callback functions to provide context.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* cl_list_apply_func invokes the specified callback function for every\r
+* object stored in the list, starting from the head. The function specified\r
+* by the pfn_func parameter must not perform any list operations as these\r
+* would corrupt the list.\r
+*\r
+* SEE ALSO\r
+* List, cl_list_find_from_head, cl_list_find_from_tail,\r
+* cl_pfn_list_apply_t\r
+*********/\r
+\r
+\r
+/****f* Component Library: List/cl_list_count\r
+* NAME\r
+* cl_list_count\r
+*\r
+* DESCRIPTION\r
+* The cl_list_count function returns the number of objects stored in a list.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE size_t CL_API\r
+cl_list_count(\r
+ IN const cl_list_t* const p_list )\r
+{\r
+ CL_ASSERT( p_list );\r
+ CL_ASSERT( cl_is_qpool_inited( &p_list->list_item_pool ) );\r
+\r
+ return( cl_qlist_count( &p_list->list ) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_list\r
+* [in] Pointer to a cl_list_t structure whose object to count.\r
+*\r
+* RETURN VALUES\r
+* Number of objects stored in the specified list.\r
+*\r
+* SEE ALSO\r
+* List\r
+*********/\r
+\r
+\r
+#ifdef __cplusplus\r
+} /* extern "C" */\r
+#endif\r
+\r
+#endif /* _CL_LIST_H_ */\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. \r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+/*\r
+ * Abstract:\r
+ * Declaration of logging mechanisms.\r
+ *\r
+ * Environment:\r
+ * All\r
+ */\r
+\r
+\r
+#ifndef _CL_LOG_H_\r
+#define _CL_LOG_H_\r
+\r
+\r
+#include <complib/cl_types.h>\r
+\r
+\r
+/****h* Component Library/Log Provider\r
+* NAME\r
+* Log Provider\r
+*\r
+* DESCRIPTION\r
+* The log provider allows users to log information in a system log instead of\r
+* the console or debugger target.\r
+**********/\r
+\r
+\r
+/****d* Component Library: Log Provider/cl_log_type_t\r
+* NAME\r
+* cl_log_type_t\r
+*\r
+* DESCRIPTION\r
+* The cl_log_type_t enumerated type is used to differentiate between\r
+* different types of log entries.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef enum _cl_log_type\r
+{\r
+ CL_LOG_INFO,\r
+ CL_LOG_WARN,\r
+ CL_LOG_ERROR\r
+\r
+} cl_log_type_t;\r
+/*\r
+* VALUES\r
+* CL_LOG_INFO\r
+* Indicates a log entry is purely informational.\r
+*\r
+* CL_LOG_WARN\r
+* Indicates a log entry is a warning but non-fatal.\r
+*\r
+* CL_LOG_ERROR\r
+* Indicates a log entry is a fatal error.\r
+*\r
+* SEE ALSO\r
+* Log Provider, cl_log_event\r
+*********/\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif\r
+\r
+\r
+/****f* Component Library: Log Provider/cl_log_event\r
+* NAME\r
+* cl_log_event\r
+*\r
+* DESCRIPTION\r
+* The cl_log_event function adds a new entry to the system log.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_log_event(\r
+ IN const char* const name,\r
+ IN const cl_log_type_t type,\r
+ IN const char* const message,\r
+ IN const void* const p_data OPTIONAL,\r
+ IN const uint32_t data_len );\r
+/*\r
+* PARAMETERS\r
+* name\r
+* [in] Pointer to an ANSI string containing the name of the source for\r
+* the log entry.\r
+*\r
+* type\r
+* [in] Defines the type of log entry to add to the system log.\r
+* See the definition of cl_log_type_t for acceptable values.\r
+*\r
+* message\r
+* [in] Pointer to an ANSI string containing the text for the log entry.\r
+* The message should not be terminated with a new line, as the log\r
+* provider appends a new line to all log entries.\r
+*\r
+* p_data\r
+* [in] Optional pointer to data providing context for the log entry.\r
+* At most 256 bytes of data can be successfully logged.\r
+*\r
+* data_len\r
+* [in] Length of the buffer pointed to by the p_data parameter. Ignored\r
+* if p_data is NULL.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* If the data length exceeds the maximum supported, the event is logged\r
+* without its accompanying data.\r
+*\r
+* SEE ALSO\r
+* Log Provider, cl_log_type_t\r
+*********/\r
+\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+\r
+\r
+#endif /* _CL_LOG_H_ */\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. \r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+/*\r
+ * Abstract:\r
+ * Declaration of map, a binary tree.\r
+ *\r
+ * Environment:\r
+ * All\r
+ */\r
+\r
+\r
+#ifndef _CL_MAP_H_\r
+#define _CL_MAP_H_\r
+\r
+\r
+#include <complib/cl_qmap.h>\r
+#include <complib/cl_qpool.h>\r
+\r
+\r
+/****h* Component Library/Map\r
+* NAME\r
+* Map\r
+*\r
+* DESCRIPTION\r
+* Map implements a binary tree that stores user objects. Each item stored\r
+* in a map has a unique 64-bit key (duplicates are not allowed). Map\r
+* provides the ability to efficiently search for an item given a key.\r
+*\r
+* Map may allocate memory when inserting objects, and can therefore fail\r
+* operations due to insufficient memory. Use quick map in situations where\r
+* such insertion failures cannot be tolerated.\r
+*\r
+* Map is not thread safe, and users must provide serialization when adding\r
+* and removing items from the map.\r
+*\r
+* The map functions operates on a cl_map_t structure which should be treated\r
+* as opaque and should be manipulated only through the provided functions.\r
+*\r
+* SEE ALSO\r
+* Types:\r
+* cl_map_iterator_t\r
+*\r
+* Structures:\r
+* cl_map_t, cl_map_item_t, cl_map_obj_t\r
+*\r
+* Item Manipulation:\r
+* cl_map_obj, cl_map_key\r
+*\r
+* Initialization:\r
+* cl_map_construct, cl_map_init, cl_map_destroy\r
+*\r
+* Iteration:\r
+* cl_map_end, cl_map_head, cl_map_tail, cl_map_next, cl_map_prev\r
+*\r
+* Manipulation\r
+* cl_map_insert, cl_map_get, cl_map_remove_item, cl_map_remove,\r
+* cl_map_remove_all, cl_map_merge, cl_map_delta\r
+*\r
+* Attributes:\r
+* cl_map_count, cl_is_map_empty, cl_is_map_inited\r
+*********/\r
+\r
+\r
+/****s* Component Library: Map/cl_map_t\r
+* NAME\r
+* cl_map_t\r
+*\r
+* DESCRIPTION\r
+* Quick map structure.\r
+*\r
+* The cl_map_t structure should be treated as opaque and should\r
+* be manipulated only through the provided functions.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _cl_map\r
+{\r
+ cl_qmap_t qmap;\r
+ cl_qpool_t pool;\r
+\r
+} cl_map_t;\r
+/*\r
+* FIELDS\r
+* qmap\r
+* Quick map object that maintains the map.\r
+*\r
+* pool\r
+* Pool of cl_map_obj_t structures used to store user objects\r
+* in the map.\r
+*\r
+* SEE ALSO\r
+* Map, cl_map_obj_t\r
+*********/\r
+\r
+\r
+/****d* Component Library: Map/cl_map_iterator_t\r
+* NAME\r
+* cl_map_iterator_t\r
+*\r
+* DESCRIPTION\r
+* Iterator type used to walk a map.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef const cl_map_item_t *cl_map_iterator_t;\r
+/*\r
+* NOTES\r
+* The iterator should be treated as opaque to prevent corrupting the map.\r
+*\r
+* SEE ALSO\r
+* Map, cl_map_head, cl_map_tail, cl_map_next, cl_map_prev, cl_map_key\r
+*********/\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
+\r
+/****f* Component Library: Map/cl_map_count\r
+* NAME\r
+* cl_map_count\r
+*\r
+* DESCRIPTION\r
+* The cl_map_count function returns the number of items stored\r
+* in a map.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE size_t CL_API\r
+cl_map_count(\r
+ IN const cl_map_t* const p_map )\r
+{\r
+ CL_ASSERT( p_map );\r
+ return( cl_qmap_count( &p_map->qmap ) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_map\r
+* [in] Pointer to a map whose item count to return.\r
+*\r
+* RETURN VALUE\r
+* Returns the number of items stored in the map.\r
+*\r
+* SEE ALSO\r
+* Map, cl_is_map_empty\r
+*********/\r
+\r
+\r
+/****f* Component Library: Map/cl_is_map_empty\r
+* NAME\r
+* cl_is_map_empty\r
+*\r
+* DESCRIPTION\r
+* The cl_is_map_empty function returns whether a map is empty.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE boolean_t CL_API\r
+cl_is_map_empty(\r
+ IN const cl_map_t* const p_map )\r
+{\r
+ CL_ASSERT( p_map );\r
+ return( cl_is_qmap_empty( &p_map->qmap ) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_map\r
+* [in] Pointer to a map to test for emptiness.\r
+*\r
+* RETURN VALUES\r
+* TRUE if the map is empty.\r
+*\r
+* FALSE otherwise.\r
+*\r
+* SEE ALSO\r
+* Map, cl_map_count, cl_map_remove_all\r
+*********/\r
+\r
+\r
+/****f* Component Library: Map/cl_map_key\r
+* NAME\r
+* cl_map_key\r
+*\r
+* DESCRIPTION\r
+* The cl_map_key function retrieves the key value of a map item.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE uint64_t CL_API\r
+cl_map_key(\r
+ IN const cl_map_iterator_t itor )\r
+{\r
+ return( cl_qmap_key( itor ) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* itor\r
+* [in] Iterator for the item whose key to return.\r
+*\r
+* RETURN VALUE\r
+* Returns the 64-bit key value for the specified iterator.\r
+*\r
+* NOTES\r
+* The iterator specified by the itor parameter must have been retrived by\r
+* a previous call to cl_map_head, cl_map_tail, cl_map_next, or cl_map_prev.\r
+*\r
+* The key value is set in a call to cl_map_insert.\r
+*\r
+* SEE ALSO\r
+* Map, cl_map_insert, cl_map_head, cl_map_tail, cl_map_next, cl_map_prev\r
+*********/\r
+\r
+\r
+/****f* Component Library: Map/cl_map_construct\r
+* NAME\r
+* cl_map_construct\r
+*\r
+* DESCRIPTION\r
+* The cl_map_construct function constructs a map.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_map_construct(\r
+ IN cl_map_t* const p_map );\r
+/*\r
+* PARAMETERS\r
+* p_map\r
+* [in] Pointer to a cl_map_t structure to construct.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* Allows calling cl_map_init, cl_map_destroy, and cl_is_map_inited.\r
+*\r
+* Calling cl_map_construct is a prerequisite to calling any other\r
+* map function except cl_map_init.\r
+*\r
+* SEE ALSO\r
+* Map, cl_map_init, cl_map_destroy, cl_is_map_inited\r
+*********/\r
+\r
+\r
+/****f* Component Library: Event/cl_is_map_inited\r
+* NAME\r
+* cl_is_map_inited\r
+*\r
+* DESCRIPTION\r
+* The cl_is_map_inited function returns whether a map was\r
+* successfully initialized.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE boolean_t CL_API\r
+cl_is_map_inited(\r
+ IN const cl_map_t* const p_map )\r
+{\r
+ /*\r
+ * The map's pool of map items is the last thing initialized.\r
+ * We can therefore use it to test for initialization.\r
+ */\r
+ return( cl_is_qpool_inited( &p_map->pool ) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_map\r
+* [in] Pointer to a cl_map_t structure whose initialization state\r
+* to check.\r
+*\r
+* RETURN VALUES\r
+* TRUE if the map was initialized successfully.\r
+*\r
+* FALSE otherwise.\r
+*\r
+* NOTES\r
+* Allows checking the state of a map to determine if invoking\r
+* member functions is appropriate.\r
+*\r
+* SEE ALSO\r
+* Map\r
+*********/\r
+\r
+\r
+/****f* Component Library: Map/cl_map_init\r
+* NAME\r
+* cl_map_init\r
+*\r
+* DESCRIPTION\r
+* The cl_map_init function initialized a map for use.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_status_t CL_API\r
+cl_map_init(\r
+ IN cl_map_t* const p_map,\r
+ IN const size_t min_items );\r
+/*\r
+* PARAMETERS\r
+* p_map\r
+* [in] Pointer to a cl_map_t structure to initialize.\r
+*\r
+* min_items\r
+* [in] Minimum number of items that can be stored. All necessary\r
+* allocations to allow storing the minimum number of items is performed\r
+* at initialization time.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if the map was initialized successfully.\r
+*\r
+* NOTES\r
+* Allows calling map manipulation functions.\r
+*\r
+* SEE ALSO\r
+* Map, cl_map_destroy, cl_map_insert, cl_map_remove\r
+*********/\r
+\r
+\r
+/****f* Component Library: Map/cl_map_destroy\r
+* NAME\r
+* cl_map_destroy\r
+*\r
+* DESCRIPTION\r
+* The cl_map_destroy function destroys a map.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_map_destroy(\r
+ IN cl_map_t* const p_map );\r
+/*\r
+* PARAMETERS\r
+* p_map\r
+* [in] Pointer to a map to destroy.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* Performs any necessary cleanup of the specified map. Further\r
+* operations should not be attempted on the map. cl_map_destroy does\r
+* not affect any of the objects stored in the map.\r
+* This function should only be called after a call to cl_map_construct.\r
+*\r
+* In debug builds, cl_map_destroy asserts that the map is empty.\r
+*\r
+* SEE ALSO\r
+* Map, cl_map_construct, cl_map_init\r
+*********/\r
+\r
+\r
+/****f* Component Library: Map/cl_map_end\r
+* NAME\r
+* cl_map_end\r
+*\r
+* DESCRIPTION\r
+* The cl_map_end function returns the iterator for the end of a map.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE const cl_map_iterator_t CL_API\r
+cl_map_end(\r
+ IN const cl_map_t* const p_map )\r
+{\r
+ CL_ASSERT( p_map );\r
+ return( cl_qmap_end( &p_map->qmap ) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_map\r
+* [in] Pointer to a cl_map_t structure whose end to return.\r
+*\r
+* RETURN VALUE\r
+* Iterator for the end of the map.\r
+*\r
+* NOTES\r
+* cl_map_end is useful for determining the validity of map items returned\r
+* by cl_map_head, cl_map_tail, cl_map_next, cl_map_prev. If the iterator\r
+* by any of these functions compares to the end, the end of the map was\r
+* encoutered.\r
+* When using cl_map_head or cl_map_tail, this condition indicates that\r
+* the map is empty.\r
+*\r
+* SEE ALSO\r
+* Map, cl_qmap_head, cl_qmap_tail, cl_qmap_next, cl_qmap_prev\r
+*********/\r
+\r
+\r
+/****f* Component Library: Map/cl_map_head\r
+* NAME\r
+* cl_map_head\r
+*\r
+* DESCRIPTION\r
+* The cl_map_head function returns the map item with the lowest key\r
+* value stored in a map.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE cl_map_iterator_t CL_API\r
+cl_map_head(\r
+ IN const cl_map_t* const p_map )\r
+{\r
+ CL_ASSERT( p_map );\r
+ return( cl_qmap_head( &p_map->qmap ) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_map\r
+* [in] Pointer to a map whose item with the lowest key is returned.\r
+*\r
+* RETURN VALUES\r
+* Iterator for the object with the lowest key in the map.\r
+*\r
+* Iterator for the map end if the map was empty.\r
+*\r
+* NOTES\r
+* cl_map_head does not remove the object from the map.\r
+*\r
+* SEE ALSO\r
+* Map, cl_map_tail, cl_map_next, cl_map_prev, cl_map_end\r
+*********/\r
+\r
+\r
+/****f* Component Library: Map/cl_map_tail\r
+* NAME\r
+* cl_map_tail\r
+*\r
+* DESCRIPTION\r
+* The cl_map_tail function returns the map item with the highest key\r
+* value stored in a map.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE cl_map_iterator_t CL_API\r
+cl_map_tail(\r
+ IN const cl_map_t* const p_map )\r
+{\r
+ CL_ASSERT( p_map );\r
+ return( cl_qmap_tail( &p_map->qmap ) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_map\r
+* [in] Pointer to a map whose item with the highest key\r
+* is returned.\r
+*\r
+* RETURN VALUES\r
+* Iterator for the object with the highest key in the map.\r
+*\r
+* Iterator for the map end if the map was empty.\r
+*\r
+* NOTES\r
+* cl_map_end does no remove the object from the map.\r
+*\r
+* SEE ALSO\r
+* Map, cl_map_head, cl_map_next, cl_map_prev, cl_map_end\r
+*********/\r
+\r
+\r
+/****f* Component Library: Map/cl_map_next\r
+* NAME\r
+* cl_map_next\r
+*\r
+* DESCRIPTION\r
+* The cl_map_next function returns the map item with the next higher\r
+* key value than a specified map item.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE cl_map_iterator_t CL_API\r
+cl_map_next(\r
+ IN const cl_map_iterator_t itor )\r
+{\r
+ CL_ASSERT( itor );\r
+ return( cl_qmap_next( itor ) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* itor\r
+* [in] Iterator for an object in a map whose successor to return.\r
+*\r
+* RETURN VALUES\r
+* Iterator for the object with the next higher key value in a map.\r
+*\r
+* Iterator for the map end if the specified object was the last item in\r
+* the map.\r
+*\r
+* NOTES\r
+* The iterator must have been retrieved by a previous call to cl_map_head,\r
+* cl_map_tail, cl_map_next, or cl_map_prev.\r
+*\r
+* SEE ALSO\r
+* Map, cl_map_head, cl_map_tail, cl_map_prev, cl_map_end\r
+*********/\r
+\r
+\r
+/****f* Component Library: Map/cl_map_prev\r
+* NAME\r
+* cl_map_prev\r
+*\r
+* DESCRIPTION\r
+* The cl_map_prev function returns the map item with the next lower\r
+* key value than a precified map item.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE cl_map_iterator_t CL_API\r
+cl_map_prev(\r
+ IN const cl_map_iterator_t itor )\r
+{\r
+ CL_ASSERT( itor );\r
+ return( cl_qmap_prev( itor ) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* itor\r
+* [in] Iterator for an object in a map whose predecessor to return.\r
+*\r
+* RETURN VALUES\r
+* Iterator for the object with the next lower key value in a map.\r
+*\r
+* Iterator for the map end if the specified object was the first item in\r
+* the map.\r
+*\r
+* NOTES\r
+* The iterator must have been retrieved by a previous call to cl_map_head,\r
+* cl_map_tail, cl_map_next, or cl_map_prev.\r
+*\r
+* SEE ALSO\r
+* Map, cl_map_head, cl_map_tail, cl_map_next, cl_map_end\r
+*********/\r
+\r
+\r
+/****f* Component Library: Map/cl_map_insert\r
+* NAME\r
+* cl_map_insert\r
+*\r
+* DESCRIPTION\r
+* The cl_map_insert function inserts a map item into a map.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void* CL_API\r
+cl_map_insert(\r
+ IN cl_map_t* const p_map,\r
+ IN const uint64_t key,\r
+ IN const void* const p_object );\r
+/*\r
+* PARAMETERS\r
+* p_map\r
+* [in] Pointer to a map into which to add the item.\r
+*\r
+* key\r
+* [in] Value to associate with the object.\r
+*\r
+* p_object\r
+* [in] Pointer to an object to insert into the map.\r
+*\r
+* RETURN VALUES\r
+* Pointer to the object in the map with the specified key after the call\r
+* completes.\r
+*\r
+* NULL if there was not enough memory to insert the desired item.\r
+*\r
+* NOTES\r
+* Insertion operations may cause the map to rebalance.\r
+*\r
+* If the map already contains an object already with the specified key,\r
+* that object will not be replaced and the pointer to that object is\r
+* returned.\r
+*\r
+* SEE ALSO\r
+* Map, cl_map_remove, cl_map_item_t\r
+*********/\r
+\r
+\r
+/****f* Component Library: Map/cl_map_get\r
+* NAME\r
+* cl_map_get\r
+*\r
+* DESCRIPTION\r
+* The cl_map_get function returns the object associated with a key.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void* CL_API\r
+cl_map_get(\r
+ IN const cl_map_t* const p_map,\r
+ IN const uint64_t key );\r
+/*\r
+* PARAMETERS\r
+* p_map\r
+* [in] Pointer to a map from which to retrieve the object with\r
+* the specified key.\r
+*\r
+* key\r
+* [in] Key value used to search for the desired object.\r
+*\r
+* RETURN VALUES\r
+* Pointer to the object with the desired key value.\r
+*\r
+* NULL if there was no item with the desired key value stored in\r
+* the map.\r
+*\r
+* NOTES\r
+* cl_map_get does not remove the item from the map.\r
+*\r
+* SEE ALSO\r
+* Map, cl_map_remove\r
+*********/\r
+\r
+\r
+/****f* Component Library: Map/cl_map_remove_item\r
+* NAME\r
+* cl_map_remove_item\r
+*\r
+* DESCRIPTION\r
+* The cl_map_remove_item function removes the specified map item\r
+* from a map.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_map_remove_item(\r
+ IN cl_map_t* const p_map,\r
+ IN const cl_map_iterator_t itor );\r
+/*\r
+* PARAMETERS\r
+* p_map\r
+* [in] Pointer to a map from which to remove the object associated with\r
+* the specified iterator.\r
+*\r
+* itor\r
+* [in] Iterator for an object to remove from its map.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* Removes the object associated with the specifid iterator from its map.\r
+*\r
+* The specified iterator is no longer valid after the call completes.\r
+*\r
+* The iterator must have been retrieved by a previous call to cl_map_head,\r
+* cl_map_tail, cl_map_next, or cl_map_prev.\r
+*\r
+* SEE ALSO\r
+* Map, cl_map_remove, cl_map_remove_all, cl_map_insert, cl_map_head,\r
+* cl_map_tail, cl_map_next, cl_map_prev\r
+*********/\r
+\r
+\r
+/****f* Component Library: Map/cl_map_remove\r
+* NAME\r
+* cl_map_remove\r
+*\r
+* DESCRIPTION\r
+* The cl_map_remove function removes the map item with the specified key\r
+* from a map.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void* CL_API\r
+cl_map_remove(\r
+ IN cl_map_t* const p_map,\r
+ IN const uint64_t key );\r
+/*\r
+* PARAMETERS\r
+* p_map\r
+* [in] Pointer to a cl_map_t structure from which to remove the item\r
+* with the specified key.\r
+*\r
+* key\r
+* [in] Key value used to search for the object to remove.\r
+*\r
+* RETURN VALUES\r
+* Pointer to the object associated with the specified key if\r
+* it was found and removed.\r
+*\r
+* NULL if no object with the specified key exists in the map.\r
+*\r
+* SEE ALSO\r
+* Map, cl_map_remove_item, cl_map_remove_all, cl_map_insert\r
+*********/\r
+\r
+\r
+/****f* Component Library: Map/cl_map_remove_all\r
+* NAME\r
+* cl_map_remove_all\r
+*\r
+* DESCRIPTION\r
+* The cl_map_remove_all function removes all objects from a map,\r
+* leaving it empty.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_map_remove_all(\r
+ IN cl_map_t* const p_map );\r
+/*\r
+* PARAMETERS\r
+* p_map\r
+* [in] Pointer to a map to empty.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* SEE ALSO\r
+* Map, cl_map_remove, cl_map_remove_item\r
+*********/\r
+\r
+\r
+/****f* Component Library: Map/cl_map_obj\r
+* NAME\r
+* cl_map_obj\r
+*\r
+* DESCRIPTION\r
+* The cl_map_obj function returns the object associated with an iterator.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE void* CL_API\r
+cl_map_obj(\r
+ IN const cl_map_iterator_t itor )\r
+{\r
+ return( cl_qmap_obj( PARENT_STRUCT( itor, cl_map_obj_t, item ) ) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* itor\r
+* [in] Iterator whose object to return.\r
+*\r
+* RETURN VALUES\r
+* Returns the value of the object pointer associated with the iterator.\r
+*\r
+* The iterator must have been retrieved by a previous call to cl_map_head,\r
+* cl_map_tail, cl_map_next, or cl_map_prev.\r
+*\r
+* SEE ALSO\r
+* Map, cl_map_head, cl_map_tail, cl_map_next, cl_map_prev\r
+*********/\r
+\r
+\r
+/****f* Component Library: Map/cl_map_merge\r
+* NAME\r
+* cl_map_merge\r
+*\r
+* DESCRIPTION\r
+* The cl_map_merge function moves all items from one map to another,\r
+* excluding duplicates.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_status_t CL_API\r
+cl_map_merge(\r
+ OUT cl_map_t* const p_dest_map,\r
+ IN OUT cl_map_t* const p_src_map );\r
+/*\r
+* PARAMETERS\r
+* p_dest_map\r
+* [out] Pointer to a cl_map_t structure to which items should be added.\r
+*\r
+* p_src_map\r
+* [in/out] Pointer to a cl_map_t structure whose items to add\r
+* to p_dest_map.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if the operation succeeded.\r
+*\r
+* CL_INSUFFICIENT_MEMORY if there was not enough memory for the operation\r
+* to succeed.\r
+*\r
+* NOTES\r
+* Items are evaluated based on their keys only.\r
+*\r
+* Upon return from cl_map_merge, the map referenced by p_src_map contains\r
+* all duplicate items.\r
+*\r
+* SEE ALSO\r
+* Map, cl_map_delta\r
+*********/\r
+\r
+\r
+/****f* Component Library: Map/cl_map_delta\r
+* NAME\r
+* cl_map_delta\r
+*\r
+* DESCRIPTION\r
+* The cl_map_delta function computes the differences between two maps.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_status_t CL_API\r
+cl_map_delta(\r
+ IN OUT cl_map_t* const p_map1,\r
+ IN OUT cl_map_t* const p_map2,\r
+ OUT cl_map_t* const p_new,\r
+ OUT cl_map_t* const p_old );\r
+/*\r
+* PARAMETERS\r
+* p_map1\r
+* [in/out] Pointer to the first of two cl_map_t structures whose\r
+* differences to compute.\r
+*\r
+* p_map2\r
+* [in/out] Pointer to the second of two cl_map_t structures whose\r
+* differences to compute.\r
+*\r
+* p_new\r
+* [out] Pointer to an empty cl_map_t structure that contains the items\r
+* unique to p_map2 upon return from the function.\r
+*\r
+* p_old\r
+* [out] Pointer to an empty cl_map_t structure that contains the items\r
+* unique to p_map1 upon return from the function.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if the operation succeeded.\r
+*\r
+* CL_INSUFFICIENT_MEMORY if there was not enough memory for the operation\r
+* to succeed.\r
+*\r
+* NOTES\r
+* Items are evaluated based on their keys. Items that exist in both\r
+* p_map1 and p_map2 remain in their respective maps. Items that\r
+* exist only p_map1 are moved to p_old. Likewise, items that exist only\r
+* in p_map2 are moved to p_new. This function can be usefull in evaluating\r
+* changes between two maps.\r
+*\r
+* Both maps pointed to by p_new and p_old must be empty on input.\r
+*\r
+* Upon failure, all input maps are restored to their original state.\r
+*\r
+* SEE ALSO\r
+* Map, cl_map_merge\r
+*********/\r
+\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+\r
+#endif /* _CL_MAP_H_ */\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. \r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+/*\r
+ * Abstract:\r
+ * Defines standard math related macros and functions.\r
+ *\r
+ * Environment:\r
+ * All\r
+ */\r
+\r
+\r
+#ifndef _CL_MATH_H_\r
+#define _CL_MATH_H_\r
+\r
+\r
+#include <complib/cl_types.h>\r
+\r
+\r
+/****d* Component Library: Math/MAX\r
+* NAME\r
+* MAX\r
+*\r
+* DESCRIPTION\r
+* The MAX macro returns the greater of two values.\r
+*\r
+* SYNOPSIS\r
+* MAX( x, y );\r
+*\r
+* PARAMETERS\r
+* x\r
+* [in] First of two values to compare.\r
+*\r
+* y\r
+* [in] Second of two values to compare.\r
+*\r
+* RETURN VALUE\r
+* Returns the greater of the x and y parameters.\r
+*\r
+* SEE ALSO\r
+* MIN, ROUNDUP\r
+*********/\r
+#ifndef MAX\r
+#define MAX(x,y) ((x) > (y) ? (x) : (y))\r
+#endif\r
+\r
+\r
+/****d* Component Library: Math/MIN\r
+* NAME\r
+* MIN\r
+*\r
+* DESCRIPTION\r
+* The MIN macro returns the greater of two values.\r
+*\r
+* SYNOPSIS\r
+* MIN( x, y );\r
+*\r
+* PARAMETERS\r
+* x\r
+* [in] First of two values to compare.\r
+*\r
+* y\r
+* [in] Second of two values to compare.\r
+*\r
+* RETURN VALUE\r
+* Returns the lesser of the x and y parameters.\r
+*\r
+* SEE ALSO\r
+* MAX, ROUNDUP\r
+*********/\r
+#ifndef MIN\r
+#define MIN(x,y) ((x) < (y) ? (x) : (y))\r
+#endif\r
+\r
+\r
+/****d* Component Library: Math/ROUNDUP\r
+* NAME\r
+* ROUNDUP\r
+*\r
+* DESCRIPTION\r
+* The ROUNDUP macro rounds a value up to a given multiple.\r
+*\r
+* SYNOPSIS\r
+* ROUNDUP( val, align );\r
+*\r
+* PARAMETERS\r
+* val\r
+* [in] Value that is to be rounded up. The type of the value is\r
+* indeterminate, but must be at most the size of a natural integer\r
+* for the platform.\r
+*\r
+* align\r
+* [in] Multiple to which the val parameter must be rounded up.\r
+*\r
+* RETURN VALUE\r
+* Returns a value that is the input value specified by val rounded up to\r
+* the nearest multiple of align.\r
+*\r
+* NOTES\r
+* The value provided must be of a type at most the size of a natural integer.\r
+*********/\r
+#ifndef ROUNDUP\r
+#define ROUNDUP(val, align) \\r
+ ((((val) / (align))*(align)) + (((val) % (align)) ? (align) : 0))\r
+#endif\r
+\r
+\r
+#endif /* _CL_MATH_H_ */\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. \r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+/*\r
+ * Abstract:\r
+ * Declaration of generic memory allocation calls.\r
+ *\r
+ * Environment:\r
+ * All\r
+ */\r
+\r
+\r
+#ifndef _CL_MEMORY_H_\r
+#define _CL_MEMORY_H_\r
+\r
+\r
+#include <complib/cl_types.h>\r
+#include <complib/cl_memory_osd.h>\r
+\r
+\r
+/****h* Public/Memory Management\r
+* NAME\r
+* Memory Management\r
+*\r
+* DESCRIPTION\r
+* The memory management functionality provides memory manipulation\r
+* functions as well as powerful debugging tools.\r
+*\r
+* The Allocation Tracking functionality provides a means for tracking memory\r
+* allocations in order to detect memory leaks.\r
+*\r
+* Memory allocation tracking stores the file name and line number where\r
+* allocations occur. Gathering this information does have an adverse impact\r
+* on performance, and memory tracking should therefore not be enabled in\r
+* release builds of software.\r
+*\r
+* Memory tracking is compiled into the debug version of the library,\r
+* and can be enabled for the release version as well. To Enable memory\r
+* tracking in a release build of the public layer, users should define\r
+* the MEM_TRACK_ON keyword for compilation.\r
+*********/\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif\r
+\r
+\r
+/****i* Component Library: Memory Management/__cl_mem_track\r
+* NAME\r
+* __cl_mem_track\r
+*\r
+* DESCRIPTION\r
+* The __cl_mem_track function enables or disables memory allocation tracking.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+__cl_mem_track(\r
+ IN const boolean_t start );\r
+/*\r
+* PARAMETERS\r
+* start\r
+* [in] Specifies whether to start or stop memory tracking.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* This function performs all necessary initialization for tracking\r
+* allocations. Users should never call this function, as it is called by\r
+* the component library framework.\r
+*\r
+* If the Start parameter is set to TRUE, the function starts tracking memory\r
+* usage if not already started. When set to FALSE, memory tracking is stoped\r
+* and all remaining allocations are displayed to the applicable debugger, if\r
+* any.\r
+*\r
+* Starting memory tracking when it is already started has no effect.\r
+* Likewise, stoping memory tracking when it is already stopped has no effect.\r
+*\r
+* SEE ALSO\r
+* Memory Management, cl_mem_display\r
+**********/\r
+\r
+\r
+/****f* Component Library: Memory Management/cl_mem_display\r
+* NAME\r
+* cl_mem_display\r
+*\r
+* DESCRIPTION\r
+* The cl_mem_display function displays all tracked memory allocations to\r
+* the applicable debugger.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_mem_display( void );\r
+/*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* Each tracked memory allocation is displayed along with the file name and\r
+* line number that allocated it.\r
+*\r
+* Output is sent to the platform's debugging target, which may be the\r
+* system log file.\r
+*\r
+* SEE ALSO\r
+* Memory Management\r
+**********/\r
+\r
+\r
+/****i* Component Library: Memory Management/__cl_malloc_trk\r
+* NAME\r
+* __cl_malloc_trk\r
+*\r
+* DESCRIPTION\r
+* The __cl_malloc_trk function allocates and tracks a block of memory.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void* CL_API\r
+__cl_malloc_trk(\r
+ IN const char* const p_file_name,\r
+ IN const int32_t line_num,\r
+ IN const size_t bytes,\r
+ IN const boolean_t pageable );\r
+/*\r
+* PARAMETERS\r
+* p_file_name\r
+* [in] Name of the source file initiating the allocation.\r
+*\r
+* line_num\r
+* [in] Line number in the specified file where the allocation is\r
+* initiated\r
+*\r
+* size\r
+* [in] Size of the requested allocation.\r
+*\r
+* pageable\r
+* [in] On operating systems that support pageable vs. non pageable\r
+* memory in the kernel, set to TRUE to allocate memory from paged pool.\r
+*\r
+* RETURN VALUES\r
+* Pointer to allocated memory if successful.\r
+*\r
+* NULL otherwise.\r
+*\r
+* NOTES\r
+* Allocated memory follows alignment rules specific to the different\r
+* environments.\r
+* This function is should not be called directly. The cl_malloc macro will\r
+* redirect users to this function when memory tracking is enabled.\r
+*\r
+* SEE ALSO\r
+* Memory Management, __cl_malloc_ntrk, __cl_zalloc_trk, __cl_free_trk\r
+**********/\r
+\r
+\r
+/****i* Component Library: Memory Management/__cl_zalloc_trk\r
+* NAME\r
+* __cl_zalloc_trk\r
+*\r
+* DESCRIPTION\r
+* The __cl_zalloc_trk function allocates and tracks a block of memory\r
+* initialized to zero.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void* CL_API\r
+__cl_zalloc_trk(\r
+ IN const char* const p_file_name,\r
+ IN const int32_t line_num,\r
+ IN const size_t bytes,\r
+ IN const boolean_t pageable );\r
+/*\r
+* PARAMETERS\r
+* p_file_name\r
+* [in] Name of the source file initiating the allocation.\r
+*\r
+* line_num\r
+* [in] Line number in the specified file where the allocation is\r
+* initiated\r
+*\r
+* size\r
+* [in] Size of the requested allocation.\r
+*\r
+* pageable\r
+* [in] On operating systems that support pageable vs. non pageable\r
+* memory in the kernel, set to TRUE to allocate memory from paged pool.\r
+*\r
+* RETURN VALUES\r
+* Pointer to allocated memory if successful.\r
+*\r
+* NULL otherwise.\r
+*\r
+* NOTES\r
+* Allocated memory follows alignment rules specific to the different\r
+* environments.\r
+* This function should not be called directly. The cl_zalloc macro will\r
+* redirect users to this function when memory tracking is enabled.\r
+*\r
+* SEE ALSO\r
+* Memory Management, __cl_zalloc_ntrk, __cl_malloc_trk, __cl_free_trk\r
+**********/\r
+\r
+\r
+/****i* Component Library: Memory Management/__cl_malloc_ntrk\r
+* NAME\r
+* __cl_malloc_ntrk\r
+*\r
+* DESCRIPTION\r
+* The __cl_malloc_ntrk function allocates a block of memory.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void* CL_API\r
+__cl_malloc_ntrk(\r
+ IN const size_t size,\r
+ IN const boolean_t pageable );\r
+/*\r
+* PARAMETERS\r
+* size\r
+* [in] Size of the requested allocation.\r
+*\r
+* pageable\r
+* [in] On operating systems that support pageable vs. non pageable\r
+* memory in the kernel, set to TRUE to allocate memory from paged pool.\r
+*\r
+* RETURN VALUES\r
+* Pointer to allocated memory if successful.\r
+*\r
+* NULL otherwise.\r
+*\r
+* NOTES\r
+* Allocated memory follows alignment rules specific to the different\r
+* environments.\r
+* This function is should not be called directly. The cl_malloc macro will\r
+* redirect users to this function when memory tracking is not enabled.\r
+*\r
+* SEE ALSO\r
+* Memory Management, __cl_malloc_trk, __cl_zalloc_ntrk, __cl_free_ntrk\r
+**********/\r
+\r
+\r
+/****i* Component Library: Memory Management/__cl_zalloc_ntrk\r
+* NAME\r
+* __cl_zalloc_ntrk\r
+*\r
+* DESCRIPTION\r
+* The __cl_zalloc_ntrk function allocates a block of memory\r
+* initialized to zero.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void* CL_API\r
+__cl_zalloc_ntrk(\r
+ IN const size_t bytes,\r
+ IN const boolean_t pageable );\r
+/*\r
+* PARAMETERS\r
+* size\r
+* [in] Size of the requested allocation.\r
+*\r
+* pageable\r
+* [in] On operating systems that support pageable vs. non pageable\r
+* memory in the kernel, set to TRUE to allocate memory from paged pool.\r
+*\r
+* RETURN VALUES\r
+* Pointer to allocated memory if successful.\r
+*\r
+* NULL otherwise.\r
+*\r
+* NOTES\r
+* Allocated memory follows alignment rules specific to the different\r
+* environments.\r
+* This function should not be called directly. The cl_zalloc macro will\r
+* redirect users to this function when memory tracking is not enabled.\r
+*\r
+* SEE ALSO\r
+* Memory Management, __cl_zalloc_trk, __cl_malloc_ntrk, __cl_free_ntrk\r
+**********/\r
+\r
+\r
+/****i* Component Library: Memory Management/__cl_free_trk\r
+* NAME\r
+* __cl_free_trk\r
+*\r
+* DESCRIPTION\r
+* The __cl_free_trk function deallocates a block of tracked memory.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+__cl_free_trk(\r
+ IN void* const p_memory );\r
+/*\r
+* PARAMETERS\r
+* p_memory\r
+* [in] Pointer to a memory block.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* The p_memory parameter is the pointer returned by a previous call to\r
+* __cl_malloc_trk, or __cl_zalloc_trk.\r
+*\r
+* __cl_free_trk has no effect if p_memory is NULL.\r
+*\r
+* This function should not be called directly. The cl_free macro will\r
+* redirect users to this function when memory tracking is enabled.\r
+*\r
+* SEE ALSO\r
+* Memory Management, __cl_free_ntrk, __cl_malloc_trk, __cl_zalloc_trk\r
+**********/\r
+\r
+\r
+/****i* Component Library: Memory Management/__cl_free_ntrk\r
+* NAME\r
+* __cl_free_ntrk\r
+*\r
+* DESCRIPTION\r
+* The __cl_free_ntrk function deallocates a block of memory.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+__cl_free_ntrk(\r
+ IN void* const p_memory );\r
+/*\r
+* PARAMETERS\r
+* p_memory\r
+* [in] Pointer to a memory block.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* The p_memory parameter is the pointer returned by a previous call to\r
+* __cl_malloc_ntrk, or __cl_zalloc_ntrk.\r
+*\r
+* __cl_free_ntrk has no effect if p_memory is NULL.\r
+*\r
+* This function should not be called directly. The cl_free macro will\r
+* redirect users to this function when memory tracking is not enabled.\r
+*\r
+* SEE ALSO\r
+* Memory Management, __cl_free_ntrk, __cl_malloc_trk, __cl_zalloc_trk\r
+**********/\r
+\r
+\r
+/****f* Component Library: Memory Management/cl_malloc\r
+* NAME\r
+* cl_malloc\r
+*\r
+* DESCRIPTION\r
+* The cl_malloc function allocates a block of memory.\r
+*\r
+* SYNOPSIS\r
+*/\r
+void*\r
+cl_malloc(\r
+ IN const size_t size );\r
+/*\r
+* PARAMETERS\r
+* size\r
+* [in] Size of the requested allocation.\r
+*\r
+* RETURN VALUES\r
+* Pointer to allocated memory if successful.\r
+*\r
+* NULL otherwise.\r
+*\r
+* NOTES\r
+* Allocated memory follows alignment rules specific to the different\r
+* environments.\r
+*\r
+* SEE ALSO\r
+* Memory Management, cl_free, cl_zalloc, cl_palloc, cl_pzalloc,\r
+* cl_memset, cl_memclr, cl_memcpy, cl_memcmp\r
+**********/\r
+\r
+\r
+/****f* Component Library: Memory Management/cl_zalloc\r
+* NAME\r
+* cl_zalloc\r
+*\r
+* DESCRIPTION\r
+* The cl_zalloc function allocates a block of memory initialized to zero.\r
+*\r
+* SYNOPSIS\r
+*/\r
+void*\r
+cl_zalloc(\r
+ IN const size_t size );\r
+/*\r
+* PARAMETERS\r
+* size\r
+* [in] Size of the requested allocation.\r
+*\r
+* RETURN VALUES\r
+* Pointer to allocated memory if successful.\r
+*\r
+* NULL otherwise.\r
+*\r
+* NOTES\r
+* Allocated memory follows alignment rules specific to the different\r
+* environments.\r
+*\r
+* SEE ALSO\r
+* Memory Management, cl_free, cl_malloc, cl_palloc, cl_pzalloc,\r
+* cl_memset, cl_memclr, cl_memcpy, cl_memcmp\r
+**********/\r
+\r
+\r
+/****f* Component Library: Memory Management/cl_palloc\r
+* NAME\r
+* cl_palloc\r
+*\r
+* DESCRIPTION\r
+* The cl_palloc function allocates a block of memory from paged pool if the\r
+* operating system supports it. If the operating system does not distinguish\r
+* between pool types, cl_palloc is identical to cl_malloc.\r
+*\r
+* SYNOPSIS\r
+*/\r
+void*\r
+cl_palloc(\r
+ IN const size_t size );\r
+/*\r
+* PARAMETERS\r
+* size\r
+* [in] Size of the requested allocation.\r
+*\r
+* RETURN VALUES\r
+* Pointer to allocated memory if successful.\r
+*\r
+* NULL otherwise.\r
+*\r
+* NOTES\r
+* Allocated memory follows alignment rules specific to the different\r
+* environments.\r
+*\r
+* SEE ALSO\r
+* Memory Management, cl_free, cl_malloc, cl_zalloc, cl_pzalloc,\r
+* cl_memset, cl_memclr, cl_memcpy, cl_memcmp\r
+**********/\r
+\r
+\r
+/****f* Component Library: Memory Management/cl_pzalloc\r
+* NAME\r
+* cl_pzalloc\r
+*\r
+* DESCRIPTION\r
+* The cl_pzalloc function allocates a block of memory from paged pool if the\r
+* operating system supports it and initializes it to zero. If the operating\r
+* system does not distinguish between pool types, cl_pzalloc is identical\r
+* to cl_zalloc.\r
+*\r
+* SYNOPSIS\r
+*/\r
+void*\r
+cl_pzalloc(\r
+ IN const size_t size );\r
+/*\r
+* PARAMETERS\r
+* size\r
+* [in] Size of the requested allocation.\r
+*\r
+* RETURN VALUES\r
+* Pointer to allocated memory if successful.\r
+*\r
+* NULL otherwise.\r
+*\r
+* NOTES\r
+* Allocated memory follows alignment rules specific to the different\r
+* environments.\r
+*\r
+* SEE ALSO\r
+* Memory Management, cl_free, cl_malloc, cl_zalloc, cl_palloc,\r
+* cl_memset, cl_memclr, cl_memcpy, cl_memcmp\r
+**********/\r
+\r
+\r
+/****f* Component Library: Memory Management/cl_free\r
+* NAME\r
+* cl_free\r
+*\r
+* DESCRIPTION\r
+* The cl_free function deallocates a block of memory.\r
+*\r
+* SYNOPSIS\r
+*/\r
+void\r
+cl_free(\r
+ IN void* const p_memory );\r
+/*\r
+* PARAMETERS\r
+* p_memory\r
+* [in] Pointer to a memory block.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* The p_memory parameter is the pointer returned by a previous call to\r
+* cl_malloc, or cl_zalloc.\r
+*\r
+* cl_free has no effect if p_memory is NULL.\r
+*\r
+* SEE ALSO\r
+* Memory Management, cl_alloc, cl_zalloc\r
+**********/\r
+\r
+\r
+/****f* Component Library: Memory Management/cl_memset\r
+* NAME\r
+* cl_memset\r
+*\r
+* DESCRIPTION\r
+* The cl_memset function sets every byte in a memory range to a given value.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_memset(\r
+ IN void* const p_memory,\r
+ IN const uint8_t fill,\r
+ IN const size_t count );\r
+/*\r
+* PARAMETERS\r
+* p_memory\r
+* [in] Pointer to a memory block.\r
+*\r
+* fill\r
+* [in] Byte value with which to fill the memory.\r
+*\r
+* count\r
+* [in] Number of bytes to set.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* SEE ALSO\r
+* Memory Management, cl_memclr, cl_memcpy, cl_memcmp\r
+**********/\r
+\r
+\r
+#ifndef _CL_MEMCLR_DEFINED_\r
+/****f* Component Library: Memory Management/cl_memclr\r
+* NAME\r
+* cl_memclr\r
+*\r
+* DESCRIPTION\r
+* The cl_memclr function sets every byte in a memory range to zero.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE void CL_API\r
+cl_memclr(\r
+ IN void* const p_memory,\r
+ IN const size_t count )\r
+{\r
+ cl_memset( p_memory, 0, count );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_memory\r
+* [in] Pointer to a memory block.\r
+*\r
+* count\r
+* [in] Number of bytes to set.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* SEE ALSO\r
+* Memory Management, cl_memset, cl_memcpy, cl_memcmp\r
+**********/\r
+#endif\r
+\r
+\r
+/****f* Component Library: Memory Management/cl_memcpy\r
+* NAME\r
+* cl_memcpy\r
+*\r
+* DESCRIPTION\r
+* The cl_memcpy function copies a given number of bytes from\r
+* one buffer to another.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void* CL_API\r
+cl_memcpy(\r
+ IN void* const p_dest,\r
+ IN const void* const p_src,\r
+ IN const size_t count );\r
+/*\r
+* PARAMETERS\r
+* p_dest\r
+* [in] Pointer to the buffer being copied to.\r
+*\r
+* p_src\r
+* [in] Pointer to the buffer being copied from.\r
+*\r
+* count\r
+* [in] Number of bytes to copy from the source buffer to the\r
+* destination buffer.\r
+*\r
+* RETURN VALUE\r
+* Returns a pointer to the destination buffer.\r
+*\r
+* SEE ALSO\r
+* Memory Management, cl_memset, cl_memclr, cl_memcmp\r
+**********/\r
+\r
+\r
+/****f* Component Library: Memory Management/cl_memcmp\r
+* NAME\r
+* cl_memcmp\r
+*\r
+* DESCRIPTION\r
+* The cl_memcmp function compares two memory buffers.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT int32_t CL_API\r
+cl_memcmp(\r
+ IN const void* const p_mem,\r
+ IN const void* const p_ref,\r
+ IN const size_t count );\r
+/*\r
+* PARAMETERS\r
+* p_mem\r
+* [in] Pointer to a memory block being compared.\r
+*\r
+* p_ref\r
+* [in] Pointer to the reference memory block to compare against.\r
+*\r
+* count\r
+* [in] Number of bytes to compare.\r
+*\r
+* RETURN VALUES\r
+* Returns less than zero if p_mem is less than p_ref.\r
+*\r
+* Returns greater than zero if p_mem is greater than p_ref.\r
+*\r
+* Returns zero if the two memory regions are the identical.\r
+*\r
+* SEE ALSO\r
+* Memory Management, cl_memset, cl_memclr, cl_memcpy\r
+**********/\r
+\r
+\r
+#ifdef CL_KERNEL\r
+\r
+/****f* Component Library: Memory Management/cl_get_pagesize\r
+* NAME\r
+* cl_get_pagesize\r
+*\r
+* DESCRIPTION\r
+* Returns the number of bytes in a OS defined page.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT uint32_t CL_API\r
+cl_get_pagesize( void );\r
+/*\r
+* PARAMETERS\r
+* NONE\r
+*\r
+* RETURN VALUES\r
+* Returns the number of bytes in a page as defined by the Operating\r
+* System.\r
+*\r
+* SEE ALSO\r
+* Memory Management\r
+**********/\r
+\r
+\r
+/****f* Component Library: Memory Management/cl_get_physaddr\r
+* NAME\r
+* cl_get_physaddr\r
+*\r
+* DESCRIPTION\r
+* Returns the Physical address for a kernel virtual address.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT uint64_t CL_API\r
+cl_get_physaddr(\r
+ IN void *vaddr );\r
+/*\r
+* PARAMETERS\r
+* p_addr\r
+* [in] Pointer to virtual to which the physical address is required.\r
+*\r
+* RETURN VALUES\r
+* Returns the physical address for a virtual address.\r
+*\r
+* NOTES\r
+* This call is only available in kernel mode.\r
+*\r
+* SEE ALSO\r
+* Memory Management\r
+**********/\r
+\r
+\r
+/****f* Component Library: Memory Management/cl_check_for_read\r
+* NAME\r
+* cl_check_for_read\r
+*\r
+* DESCRIPTION\r
+* Checks a user-mode virtual address for read access.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_status_t CL_API\r
+cl_check_for_read(\r
+ IN const void* const vaddr,\r
+ IN const size_t count );\r
+/*\r
+* PARAMETERS\r
+* vaddr\r
+* [in] Virtual address to check for read access.\r
+*\r
+* count\r
+* [in] Number of bytes of the buffer at the specified address\r
+* to validate.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if the virtual address is valid for a read of the specified\r
+* size.\r
+*\r
+* CL_INVALID_PERMISSION if the virtual address or the size is not valid.\r
+*\r
+* NOTES\r
+* This call is only available in the kernel. The buffer can only be accessed\r
+* in the context of the application thread (i.e. in the path of an IOCTL\r
+* request). Callers cannot be holding a spinlock when calling this function.\r
+*\r
+* SEE ALSO\r
+* Memory Management, cl_check_for_write, cl_copy_to_user, cl_copy_from_user\r
+*********/\r
+\r
+\r
+/****f* Component Library: Memory Management/cl_check_for_write\r
+* NAME\r
+* cl_check_for_write\r
+*\r
+* DESCRIPTION\r
+* Checks a user-mode virtual address for write access.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_status_t CL_API\r
+cl_check_for_write(\r
+ IN void* const vaddr,\r
+ IN const size_t count );\r
+/*\r
+* PARAMETERS\r
+* vaddr\r
+* [in] Virtual address to check for write access.\r
+*\r
+* count\r
+* [in] Number of bytes of the buffer at the specified\r
+* address to validate.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if the virtual address is valid for a write of the specified\r
+* size.\r
+*\r
+* CL_INVALID_PERMISSION if the virtual address or the size is not valid.\r
+*\r
+* NOTES\r
+* This call is only available in the kernel. The buffer can only be accessed\r
+* in the context of the application thread (i.e. in the path of an IOCTL\r
+* request). Callers cannot be holding a spinlock when calling this function.\r
+*\r
+* SEE ALSO\r
+* Memory Management, cl_check_for_read, cl_copy_to_user, cl_copy_from_user\r
+*********/\r
+\r
+\r
+/****f* Component Library: Memory Management/cl_copy_to_user\r
+* NAME\r
+* cl_copy_to_user\r
+*\r
+* DESCRIPTION\r
+* Copies data into a user-mode buffer, performing access checks.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_status_t CL_API\r
+cl_copy_to_user(\r
+ IN void* const p_dest,\r
+ IN const void* const p_src,\r
+ IN const size_t count );\r
+/*\r
+* PARAMETERS\r
+* p_dest\r
+* [in] User-mode virtual address to which to copy data.\r
+*\r
+* p_src\r
+* [in] Pointer to the buffer being copied from.\r
+*\r
+* count\r
+* [in] Number of bytes to copy from the source buffer to the\r
+* destination buffer.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if the user-mode buffer virtual address is valid as the\r
+* destination of the copy.\r
+*\r
+* CL_INVALID_PERMISSION if the virtual address or the count is not valid.\r
+*\r
+* NOTES\r
+* This call is only available in the kernel. The buffer can only be accessed\r
+* in the context of the application thread (i.e. in the path of an IOCTL\r
+* request). Callers cannot be holding a spinlock when calling this function.\r
+*\r
+* SEE ALSO\r
+* Memory Management, cl_check_for_read, cl_check_for_write, cl_copy_from_user\r
+*********/\r
+\r
+\r
+/****f* Component Library: Memory Management/cl_copy_from_user\r
+* NAME\r
+* cl_copy_from_user\r
+*\r
+* DESCRIPTION\r
+* Copies data from a user-mode buffer, performing access checks.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_status_t CL_API\r
+cl_copy_from_user(\r
+ IN void* const p_dest,\r
+ IN const void* const p_src,\r
+ IN const size_t count );\r
+/*\r
+* PARAMETERS\r
+* p_dest\r
+* [in] Pointer to the buffer being copied to.\r
+*\r
+* p_src\r
+* [in] User-mode virtual address from which to copy data.\r
+*\r
+* count\r
+* [in] Number of bytes to copy from the source buffer to the\r
+* destination buffer.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if the user-mode buffer virtual address is valid as the\r
+* source of the copy.\r
+*\r
+* CL_INVALID_PERMISSION if the virtual address or the count is not valid.\r
+*\r
+* NOTES\r
+* This call is only available in the kernel. The buffer can only be accessed\r
+* in the context of the application thread (i.e. in the path of an IOCTL\r
+* request). Callers cannot be holding a spinlock when calling this function.\r
+*\r
+* SEE ALSO\r
+* Memory Management, cl_check_for_read, cl_check_for_write, cl_copy_to_user\r
+*********/\r
+\r
+#endif /* CL_KERNEL */\r
+\r
+#if defined( CL_NO_TRACK_MEM ) && defined( CL_TRACK_MEM )\r
+ #error Conflict: Cannot define both CL_NO_TRACK_MEM and CL_TRACK_MEM.\r
+#endif\r
+\r
+/*\r
+ * Turn on memory allocation tracking in debug builds if not explicitly\r
+ * disabled or already turned on.\r
+ */\r
+#if defined( _DEBUG_ ) && \\r
+ !defined( CL_NO_TRACK_MEM ) && \\r
+ !defined( CL_TRACK_MEM )\r
+ #define CL_TRACK_MEM\r
+#endif\r
+\r
+\r
+/*\r
+ * Define allocation macro.\r
+ */\r
+#if defined( CL_TRACK_MEM )\r
+\r
+#define cl_malloc( a ) \\r
+ __cl_malloc_trk( __FILE__, __LINE__, a, FALSE )\r
+\r
+#define cl_zalloc( a ) \\r
+ __cl_zalloc_trk( __FILE__, __LINE__, a, FALSE )\r
+\r
+#define cl_palloc( a ) \\r
+ __cl_malloc_trk( __FILE__, __LINE__, a, TRUE )\r
+\r
+#define cl_pzalloc( a ) \\r
+ __cl_zalloc_trk( __FILE__, __LINE__, a, TRUE )\r
+\r
+#define cl_free( a ) \\r
+ __cl_free_trk( a )\r
+\r
+#else /* !defined( CL_TRACK_MEM ) */\r
+\r
+#define cl_malloc( a ) \\r
+ __cl_malloc_ntrk( a, FALSE )\r
+\r
+#define cl_zalloc( a ) \\r
+ __cl_zalloc_ntrk( a, FALSE )\r
+\r
+#define cl_palloc( a ) \\r
+ __cl_malloc_ntrk( a, TRUE )\r
+\r
+#define cl_pzalloc( a ) \\r
+ __cl_zalloc_ntrk( a, TRUE )\r
+\r
+#define cl_free( a ) \\r
+ __cl_free_ntrk( a )\r
+\r
+#endif /* defined( CL_TRACK_MEM ) */\r
+\r
+\r
+#ifdef __cplusplus\r
+} /* extern "C" */\r
+#endif\r
+\r
+#endif /* _CL_MEMORY_H_ */\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. \r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+/*\r
+ * Abstract:\r
+ * Declaration of mutex object.\r
+ *\r
+ * Environment:\r
+ * All\r
+ */\r
+\r
+\r
+#ifndef _CL_MUTEX_H_\r
+#define _CL_MUTEX_H_\r
+\r
+\r
+#include <complib/cl_mutex_osd.h>\r
+\r
+\r
+/****h* complib/Mutex\r
+* NAME\r
+* Mutex\r
+*\r
+* DESCRIPTION\r
+* Mutex provides synchronization between threads for exclusive access to\r
+* a resource.\r
+*\r
+* The Mutex functions manipulate a cl_mutex_t structure which should\r
+* be treated as opaque and should be manipulated only through the provided\r
+* functions.\r
+*\r
+* SEE ALSO\r
+* Structures:\r
+* cl_mutex_t\r
+*\r
+* Initialization:\r
+* cl_mutex_construct, cl_mutex_init, cl_mutex_destroy\r
+*\r
+* Manipulation\r
+* cl_mutex_acquire, cl_mutex_release\r
+*********/\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif\r
+\r
+\r
+/****f* Component Library: Mutex/cl_mutex_construct\r
+* NAME\r
+* cl_mutex_construct\r
+*\r
+* DESCRIPTION\r
+* The cl_mutex_construct function initializes the state of a\r
+* mutex.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_mutex_construct(\r
+ IN cl_mutex_t* const p_mutex );\r
+/*\r
+* PARAMETERS\r
+* p_mutex\r
+* [in] Pointer to a mutex structure whose state to initialize.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* Allows calling cl_semphore_destroy without first calling\r
+* cl_mutex_init.\r
+*\r
+* Calling cl_mutex_construct is a prerequisite to calling any other\r
+* mutex function except cl_mutex_init.\r
+*\r
+* SEE ALSO\r
+* Mutex, cl_semphore_init cl_mutex_destroy\r
+*********/\r
+\r
+\r
+/****f* Component Library: Mutex/cl_mutex_init\r
+* NAME\r
+* cl_mutex_init\r
+*\r
+* DESCRIPTION\r
+* The cl_mutex_init function initializes a mutex for use.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_status_t CL_API\r
+cl_mutex_init(\r
+ IN cl_mutex_t* const p_mutex );\r
+/*\r
+* PARAMETERS\r
+* p_mutex\r
+* [in] Pointer to a mutex structure to initialize.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if initialization succeeded.\r
+*\r
+* CL_ERROR if initialization failed. Callers should call\r
+* cl_mutex_destroy to clean up any resources allocated during\r
+* initialization.\r
+*\r
+* NOTES\r
+* Initializes the mutex structure. Allows calling cl_mutex_aquire\r
+* and cl_mutex_release. The cl_mutex is always created in the unlocked state.\r
+*\r
+* SEE ALSO\r
+* Mutex, cl_mutex_construct, cl_mutex_destroy,\r
+* cl_mutex_acquire, cl_mutex_release\r
+*********/\r
+\r
+\r
+/****f* Component Library: Mutex/cl_mutex_destroy\r
+* NAME\r
+* cl_mutex_destroy\r
+*\r
+* DESCRIPTION\r
+* The cl_mutex_destroy function performs all necessary cleanup of a\r
+* mutex.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_mutex_destroy(\r
+ IN cl_mutex_t* const p_mutex );\r
+/*\r
+* PARAMETERS\r
+* p_mutex\r
+* [in] Pointer to a mutex structure to destroy.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* Performs any necessary cleanup of a mutex. This function must only\r
+* be called if either cl_mutex_construct or cl_mutex_init has been\r
+* called.\r
+*\r
+* SEE ALSO\r
+* Mutex, cl_mutex_construct, cl_mutex_init\r
+*********/\r
+\r
+\r
+/****f* Component Library: Mutex/cl_mutex_acquire\r
+* NAME\r
+* cl_mutex_acquire\r
+*\r
+* DESCRIPTION\r
+* The cl_mutex_acquire function acquires a mutex.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_mutex_acquire(\r
+ IN cl_mutex_t* const p_mutex );\r
+/*\r
+* PARAMETERS\r
+* p_mutex\r
+* [in] Pointer to a mutex structure to acquire.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* SEE ALSO\r
+* Mutex, cl_mutex_release\r
+*********/\r
+\r
+\r
+/****f* Component Library: Mutex/cl_mutex_release\r
+* NAME\r
+* cl_mutex_release\r
+*\r
+* DESCRIPTION\r
+* The cl_mutex_release function releases a mutex object.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_mutex_release(\r
+ IN cl_mutex_t* const p_mutex );\r
+/*\r
+* PARAMETERS\r
+* p_mutex\r
+* [in] Pointer to a mutex structure to release.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* Releases a mutex after a call to cl_mutex_acquire.\r
+*\r
+* SEE ALSO\r
+* Mutex, cl_mutex_acquire\r
+*********/\r
+\r
+\r
+#ifdef __cplusplus\r
+} /* extern "C" */\r
+#endif\r
+\r
+#endif /* _CL_MUTEX_H_ */\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. \r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+/*\r
+ * Abstract:\r
+ * Declaration of basic objects and relationships.\r
+ *\r
+ * Environment:\r
+ * All\r
+ */\r
+\r
+\r
+#if !defined(__CL_OBJ_H__)\r
+#define __CL_OBJ_H__\r
+\r
+#include <complib/cl_async_proc.h>\r
+#include <complib/cl_atomic.h>\r
+#include <complib/cl_event.h>\r
+#include <complib/cl_qlist.h>\r
+#include <complib/cl_qpool.h>\r
+#include <complib/cl_spinlock.h>\r
+\r
+\r
+/****h* Component Library/Object\r
+* NAME\r
+* Object\r
+*\r
+* DESCRIPTION\r
+* Object describes a basic class that can be used to track accesses to an\r
+* object and provides automatic cleanup of an object that is dependent\r
+* on another object.\r
+*\r
+* Dependencies between objects are described using a relationship. A\r
+* child object is considered dependent on a parent object. Destruction of\r
+* a parent object automatically results in the destruction of any child\r
+* objects associated with the parent.\r
+*\r
+* The relationship between parent and child objects is many to many.\r
+* Parents can have multiple child objects, and a child can be dependent on\r
+* multiple parent objects. In the latter case, destruction of any parent\r
+* object results in the destruction of the child object.\r
+*\r
+* Other relationships between objects are described using references. An\r
+* object that takes a reference on a second object prevents the second object\r
+* from being deallocated as long as the reference is held.\r
+*\r
+* SEE ALSO\r
+* Types\r
+* cl_destroy_type_t\r
+*\r
+* Structures:\r
+* cl_obj_t, cl_obj_rel_t\r
+*\r
+* Callbacks:\r
+* cl_pfn_obj_call_t\r
+*\r
+* Initialization/Destruction:\r
+* cl_obj_mgr_create, cl_obj_mgr_destroy,\r
+* cl_obj_construct, cl_obj_init, cl_obj_destroy, cl_obj_deinit\r
+*\r
+* Object Relationships:\r
+* cl_obj_ref, cl_obj_deref,\r
+* cl_rel_alloc, cl_rel_free, cl_obj_insert_rel, cl_obj_remove_rel\r
+*\r
+* Object Manipulation:\r
+* cl_obj_reset\r
+*********/\r
+\r
+\r
+\r
+/* Forward declaration. */\r
+typedef struct _cl_obj *__p_cl_obj_t;\r
+\r
+\r
+\r
+/****s* Component Library: Object/cl_obj_mgr_t\r
+* NAME\r
+* cl_obj_mgr_t\r
+*\r
+* DESCRIPTION\r
+* The global object manager.\r
+*\r
+* The manager must be created before constructing any other objects, and all\r
+* objects must be destroyed before the object manager is destroyed.\r
+*\r
+* The manager is used to maintain the list of all objects currently active\r
+* in the system. It provides a pool of relationship items used to\r
+* describe parent-child, or dependent, relationships between two objects.\r
+* The manager contains an asynchronous processing thread that is used to\r
+* support asynchronous object destruction.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _cl_obj_mgr\r
+{\r
+ cl_qlist_t obj_list;\r
+ cl_spinlock_t lock;\r
+\r
+ cl_async_proc_t async_proc_mgr;\r
+\r
+ cl_qpool_t rel_pool;\r
+\r
+} cl_obj_mgr_t;\r
+/*\r
+* FIELDS\r
+* obj_list\r
+* List of all object's in the system. Object's are inserted into this\r
+* list when constructed and removed when freed.\r
+*\r
+* lock\r
+* A lock used by the object manager for synchronization to the obj_list.\r
+*\r
+* async_proc_mgr\r
+* An asynchronous processing manager used to process asynchronous\r
+* destruction requests. Users wishing to synchronize the execution of\r
+* specific routines with object destruction may queue work requests to\r
+* this processing manager.\r
+*\r
+* rel_pool\r
+* Pool of items used to describe dependent relationships. Users may\r
+* obtain relationship objects from this pool when forming relationships,\r
+* but are not required to do so.\r
+*\r
+* SEE ALSO\r
+* Object, cl_obj_mgr_create, cl_obj_mgr_destroy,\r
+* cl_obj_construct, cl_obj_deinit,\r
+* cl_qlist_t, cl_spinlock_t, cl_async_proc_t, cl_qpool_t\r
+*********/\r
+\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
+\r
+\r
+/****f* Component Library: Object/cl_obj_mgr_create\r
+* NAME\r
+* cl_obj_mgr_create\r
+*\r
+* DESCRIPTION\r
+* This routine creates an object manager used to track all objects by\r
+* the user. The object manager assists with debugging efforts by identifying\r
+* objects that are not destroyed properly.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_status_t CL_API\r
+cl_obj_mgr_create(void);\r
+/*\r
+* PARAMETERS\r
+* None.\r
+*\r
+* RETURN VALUE\r
+* CL_SUCCESS\r
+* The object manager was succesfully created.\r
+*\r
+* CL_INSUFFICIENT_MEMORY\r
+* The object manager could not be allocated.\r
+*\r
+* NOTES\r
+* This call must succeed before invoking any other object-related function.\r
+*\r
+* SEE ALSO\r
+* Object, cl_obj_mgr_destroy\r
+*********/\r
+\r
+\r
+\r
+/****f* Component Library: Object/cl_obj_mgr_destroy\r
+* NAME\r
+* cl_obj_mgr_destroy\r
+*\r
+* DESCRIPTION\r
+* This routine destroys the object manager created through cl_obj_mgr_create.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_obj_mgr_destroy(void);\r
+/*\r
+* PARAMETERS\r
+* None.\r
+*\r
+* RETURN VALUE\r
+* None.\r
+*\r
+* NOTES\r
+* When the object manager is destroyed, it will display information about all\r
+* objects that have not yet been destroyed.\r
+*\r
+* SEE ALSO\r
+* Object, cl_obj_mgr_create\r
+*********/\r
+\r
+\r
+/****d* Component Library: Object/cl_pfn_obj_call_t\r
+* NAME\r
+* cl_pfn_obj_call_t\r
+*\r
+* DESCRIPTION\r
+* The cl_pfn_obj_call_t function type defines the prototype for functions\r
+* used to return objects to the user.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef void\r
+(CL_API *cl_pfn_obj_call_t)(\r
+ IN struct _cl_obj *p_obj );\r
+/*\r
+* PARAMETERS\r
+* p_obj\r
+* [in] Pointer to a cl_obj_t. This is the object being returned to\r
+* the user.\r
+*\r
+* RETURN VALUES\r
+* None.\r
+*\r
+* NOTES\r
+* This function type is provided as a prototype for functions provided\r
+* by users as parameters to the cl_obj_init function.\r
+*\r
+* SEE ALSO\r
+* Object, cl_obj_init, cl_obj_t\r
+*********/\r
+\r
+\r
+/****d* Component Library: Object/cl_destroy_type_t\r
+* NAME\r
+* cl_destroy_type_t\r
+*\r
+* DESCRIPTION\r
+* Indicates the type of destruction to perform on an object.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef enum _cl_destroy_type\r
+{\r
+ CL_DESTROY_ASYNC,\r
+ CL_DESTROY_SYNC\r
+\r
+} cl_destroy_type_t;\r
+/*\r
+* VALUES\r
+* CL_DESTROY_ASYNC\r
+* Indicates that the object should be destroyed asynchronously. Objects\r
+* destroyed asynchronously complete initial destruction processing, then\r
+* return the calling thread. Once their reference count goes to zero,\r
+* they are queue onto an asynchronous thread to complete destruction\r
+* processing.\r
+*\r
+* CL_DESTROY_SYNC\r
+* Indicates that the object should be destroyed synchronously. Objects\r
+* destroyed synchronously wait (block) until their reference count goes\r
+* to zero. Once their reference count goes to zero, destruction\r
+* processing is completed by the calling thread.\r
+*\r
+* SEE ALSO\r
+* Object, cl_obj_init, cl_obj_destroy, cl_obj_deinit, cl_obj_t\r
+*********/\r
+\r
+\r
+\r
+/****s* Component Library: Object/cl_obj_t\r
+* NAME\r
+* cl_obj_t\r
+*\r
+* DESCRIPTION\r
+* Object structure.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _cl_obj\r
+{\r
+ cl_pool_item_t pool_item; /* Must be first. */\r
+ uint32_t type;\r
+ cl_state_t state;\r
+ cl_destroy_type_t destroy_type;\r
+\r
+ cl_async_proc_item_t async_item;\r
+ cl_event_t event;\r
+\r
+ cl_pfn_obj_call_t pfn_destroying;\r
+ cl_pfn_obj_call_t pfn_cleanup;\r
+ cl_pfn_obj_call_t pfn_free;\r
+\r
+ cl_spinlock_t lock;\r
+\r
+ cl_qlist_t parent_list;\r
+ cl_qlist_t child_list;\r
+\r
+ atomic32_t ref_cnt;\r
+\r
+} cl_obj_t;\r
+/*\r
+* FIELDS\r
+* pool_item\r
+* Used to track the object with the global object manager. We use\r
+* a pool item, rather than a list item, to let users store the object\r
+* in a pool.\r
+*\r
+* type\r
+* Stores a user-specified object type.\r
+*\r
+* state\r
+* Records the current state of the object, such as initialized,\r
+* destroying, etc.\r
+*\r
+* destroy_type\r
+* Specifies the type of destruction, synchronous or asynchronous, to\r
+* perform on this object.\r
+*\r
+* async_item\r
+* Asynchronous item used when destroying the object asynchronously.\r
+* This item is queued to an asynchronous thread to complete destruction\r
+* processing.\r
+*\r
+* event\r
+* Event used when destroying the object synchronously. A call to destroy\r
+* the object will wait on this event until the destruction has completed.\r
+*\r
+* pfn_destroying\r
+* User-specified callback invoked to notify a user that an object has\r
+* been marked for destruction. This callback is invoked directly from\r
+* the thread destroying the object and is used to notify a user that\r
+* a parent object has invoked a child object's destructor.\r
+*\r
+* pfn_cleanup\r
+* User-specified callback invoked as an object is undergoing destruction.\r
+* For object's destroyed asynchronously, this callback is invoked from\r
+* the context of the asynchronous destruction thread. Users may block\r
+* in the context of this thread; however, further destruction processing\r
+* will not continue until this callback returns.\r
+*\r
+* pfn_free\r
+* User-specified callback invoked to notify a user that an object has\r
+* been destroyed and is ready for deallocation. Users should either\r
+* call cl_obj_deinit or cl_obj_reset from within this callback.\r
+*\r
+* lock\r
+* A lock provided by the object.\r
+*\r
+* parent_list\r
+* A list of relationships to parent objects that an object is dependent\r
+* on.\r
+*\r
+* child_list\r
+* A list of all child objects that are dependent on this object.\r
+* Destroying this object will result in all related objects maintained\r
+* in the child list also being destroyed.\r
+*\r
+* ref_cnt\r
+* A count of the number of objects still referencing this object.\r
+*\r
+* SEE ALSO\r
+* Object, cl_obj_construct, cl_obj_init, cl_obj_destroy,\r
+* cl_obj_deinit, cl_pfn_obj_call_t, cl_destroy_type_t,\r
+* cl_pool_item_t, cl_state_t, cl_async_proc_item_t,\r
+* cl_event_t, cl_spinlock_t, cl_qlist_t, atomic32_t\r
+*********/\r
+\r
+\r
+\r
+/****f* Component Library: Object/cl_obj_construct\r
+* NAME\r
+* cl_obj_construct\r
+*\r
+* DESCRIPTION\r
+* This routine prepares an object for use. The object must be successfully\r
+* initialized before being used.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_obj_construct(\r
+ IN cl_obj_t * const p_obj,\r
+ IN const uint32_t obj_type );\r
+/*\r
+* PARAMETERS\r
+* p_obj\r
+* [in] A pointer to the object to construct.\r
+*\r
+* obj_type\r
+* [in] A user-specified type associated with the object. This type\r
+* is recorded by the object for debugging purposes and may be accessed\r
+* by the user.\r
+*\r
+* RETURN VALUE\r
+* None.\r
+*\r
+* NOTES\r
+* This call must succeed before invoking any other function on an object.\r
+*\r
+* SEE ALSO\r
+* Object, cl_obj_init, cl_obj_destroy, cl_obj_deinit.\r
+*********/\r
+\r
+\r
+/****f* Component Library: Object/cl_obj_init\r
+* NAME\r
+* cl_obj_init\r
+*\r
+* DESCRIPTION\r
+* This routine initializes an object for use. Upon the successful completion\r
+* of this call, the object is ready for use.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_status_t CL_API\r
+cl_obj_init(\r
+ IN cl_obj_t * const p_obj,\r
+ IN cl_destroy_type_t destroy_type,\r
+ IN const cl_pfn_obj_call_t pfn_destroying OPTIONAL,\r
+ IN const cl_pfn_obj_call_t pfn_cleanup OPTIONAL,\r
+ IN const cl_pfn_obj_call_t pfn_free );\r
+/*\r
+* PARAMETERS\r
+* p_obj\r
+* [in] A pointer to the object to initialize.\r
+*\r
+* destroy_type\r
+* [in] Specifies the destruction model used by this object.\r
+*\r
+* pfn_destroying\r
+* [in] User-specified callback invoked to notify a user that an object has\r
+* been marked for destruction. This callback is invoked directly from\r
+* the thread destroying the object and is used to notify a user that\r
+* a parent object has invoked a child object's destructor.\r
+*\r
+* pfn_cleanup\r
+* [in] User-specified callback invoked to an object is undergoing\r
+* destruction. For object's destroyed asynchronously, this callback\r
+* is invoked from the context of the asynchronous destruction thread.\r
+* Users may block in the context of this thread; however, further\r
+* destruction processing will not continue until this callback returns.\r
+*\r
+* pfn_free\r
+* [in] User-specified callback invoked to notify a user that an object has\r
+* been destroyed and is ready for deallocation. Users should either\r
+* call cl_obj_deinit or cl_obj_reset from within this callback.\r
+*\r
+* RETURN VALUE\r
+* CL_SUCCESS\r
+* The object was successfully initialized.\r
+*\r
+* CL_INSUFFICIENT_MEMORY\r
+* The object could not allocate the necessary memory resources to\r
+* complete initialization.\r
+*\r
+* NOTES\r
+* The three destruction callbacks are used to notify the user of the progress\r
+* of the destruction, permitting the user to perform an additional processing.\r
+* Pfn_destroying is used to notify the user that the object is being\r
+* destroyed. It is called after an object has removed itself from\r
+* relationships with its parents, but before it destroys any child objects\r
+* that it might have.\r
+*\r
+* Pfn_cleanup is invoked after all child objects have been destroyed, and\r
+* there are no more references on the object itself. For objects destroyed\r
+* asynchronously, pfn_cleanup is invoked from an asynchronous destruction\r
+* thread.\r
+*\r
+* Pfn_free is called to notify the user that the destruction of the object has\r
+* completed. All relationships have been removed, and all child objects have\r
+* been destroyed. Relationship items (cl_obj_rel_t) that were used to\r
+* identify parent objects are returned to the user through the p_parent_list\r
+* field of the cl_obj_t structure.\r
+*\r
+* SEE ALSO\r
+* Object, cl_obj_construct, cl_obj_destroy, cl_obj_deinit,\r
+* cl_obj_t, cl_destroy_type_t, cl_pfn_obj_call_t,\r
+*********/\r
+\r
+\r
+/****f* Component Library: Object/cl_obj_destroy\r
+* NAME\r
+* cl_obj_destroy\r
+*\r
+* DESCRIPTION\r
+* This routine destroys the specified object.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_obj_destroy(\r
+ IN cl_obj_t * p_obj );\r
+/*\r
+* PARAMETERS\r
+* p_obj\r
+* [in] A pointer to the object to destroy.\r
+*\r
+* RETURN VALUE\r
+* None.\r
+*\r
+* NOTES\r
+* This routine starts the destruction process for the specified object. For\r
+* additional information regarding destruction callbacks, see the following\r
+* fields in cl_obj_t and parameters in cl_obj_init: pfn_destroying,\r
+* pfn_cleanup, and pfn_free.\r
+*\r
+* In most cases, after calling this routine, users should call cl_obj_deinit\r
+* from within their pfn_free callback routine.\r
+*\r
+* SEE ALSO\r
+* Object, cl_obj_construct, cl_obj_init, cl_obj_deinit,\r
+* cl_obj_t, cl_destroy_type_t, cl_pfn_obj_call_t\r
+*********/\r
+\r
+\r
+\r
+/****f* Component Library: Object/cl_obj_deinit\r
+* NAME\r
+* cl_obj_deinit\r
+*\r
+* DESCRIPTION\r
+* Release all resources allocated by an object. This routine should\r
+* typically be called from a user's pfn_free routine.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_obj_deinit(\r
+ IN cl_obj_t * const p_obj );\r
+/*\r
+* PARAMETERS\r
+* p_obj\r
+* [in] A pointer to the object to free.\r
+*\r
+* RETURN VALUE\r
+* None.\r
+*\r
+* NOTES\r
+* This call must be invoked to release the object from the global object\r
+* manager.\r
+*\r
+* SEE ALSO\r
+* Object, cl_obj_construct, cl_obj_init, cl_obj_destroy, cl_obj_t\r
+*********/\r
+\r
+\r
+\r
+/****f* Component Library: Object/cl_obj_reset\r
+* NAME\r
+* cl_obj_reset\r
+*\r
+* DESCRIPTION\r
+* Reset an object's state. This is called after cl_obj_destroy has\r
+* been called on a object, but before cl_obj_deinit has been invoked.\r
+* After an object has been reset, it is ready for re-use.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_obj_reset(\r
+ IN cl_obj_t * const p_obj );\r
+/*\r
+* PARAMETERS\r
+* p_obj\r
+* [in] A pointer to the object to reset.\r
+*\r
+* RETURN VALUE\r
+* None.\r
+*\r
+* NOTES\r
+* This routine allows an object to be initialized once, then destroyed\r
+* and re-used multiple times. This permits the user to allocate and\r
+* maintain a pool of objects. The objects may be reset and returned to\r
+* the pool, rather than freed, after being destroyed. The objects would\r
+* not be freed until the pool itself was destroyed.\r
+*\r
+* SEE ALSO\r
+* Object, cl_obj_destroy, cl_obj_free, cl_obj_t\r
+*********/\r
+\r
+\r
+\r
+/****f* Component Library: Object/cl_obj_ref\r
+* NAME\r
+* cl_obj_ref\r
+*\r
+* DESCRIPTION\r
+* Increments the reference count on an object and returns the updated count.\r
+* This routine is thread safe, but does not result in locking the object.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT int32_t CL_API\r
+cl_obj_ref(\r
+ IN cl_obj_t * const p_obj );\r
+/*\r
+* PARAMETERS\r
+* p_obj\r
+* [in] A pointer to the object to reference.\r
+*\r
+* RETURN VALUE\r
+* The updated reference count.\r
+*\r
+* SEE ALSO\r
+* Object, cl_obj_t, cl_obj_deref\r
+*********/\r
+\r
+\r
+\r
+/****f* Component Library: Object/cl_obj_deref\r
+* NAME\r
+* cl_obj_deref\r
+*\r
+* DESCRIPTION\r
+* Decrements the reference count on an object and returns the updated count.\r
+* This routine is thread safe, but results in locking the object.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT int32_t CL_API\r
+cl_obj_deref(\r
+ IN cl_obj_t * const p_obj );\r
+/*\r
+* PARAMETERS\r
+* p_obj\r
+* [in] A pointer to the object to dereference.\r
+*\r
+* RETURN VALUE\r
+* The updated reference count.\r
+*\r
+* SEE ALSO\r
+* Object, cl_obj_t, cl_obj_ref\r
+*********/\r
+\r
+\r
+/****f* Component Library: Object/cl_obj_type\r
+* NAME\r
+* cl_obj_type\r
+*\r
+* DESCRIPTION\r
+* Returns the type of an object.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE uint32_t CL_API\r
+cl_obj_type(\r
+ IN cl_obj_t * const p_obj )\r
+{\r
+ return p_obj->type;\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_obj\r
+* [in] A pointer to the object whose type to return.\r
+*\r
+* RETURN VALUE\r
+* The type of the object, as specified in the call to cl_obj_init.\r
+*\r
+* SEE ALSO\r
+* Object, cl_obj_t, cl_obj_init\r
+*********/\r
+\r
+\r
+/****f* Component Library: Object/cl_obj_lock\r
+* NAME\r
+* cl_obj_lock\r
+*\r
+* DESCRIPTION\r
+* Acquires an object's lock.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE void CL_API\r
+cl_obj_lock(\r
+ IN cl_obj_t * const p_obj )\r
+{\r
+ CL_ASSERT( p_obj->state == CL_INITIALIZED ||\r
+ p_obj->state == CL_DESTROYING );\r
+ cl_spinlock_acquire( &p_obj->lock );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_obj\r
+* [in] A pointer to the object whose lock to acquire.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* SEE ALSO\r
+* Object, cl_obj_t, cl_obj_unlock\r
+*********/\r
+\r
+\r
+/****f* Component Library: Object/cl_obj_unlock\r
+* NAME\r
+* cl_obj_unlock\r
+*\r
+* DESCRIPTION\r
+* Releases an object's lock previously acquired by a call to cl_obj_lock.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE void CL_API\r
+cl_obj_unlock(\r
+ IN cl_obj_t * const p_obj )\r
+{\r
+ CL_ASSERT( p_obj->state == CL_INITIALIZED ||\r
+ p_obj->state == CL_DESTROYING );\r
+ cl_spinlock_release( &p_obj->lock );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_obj\r
+* [in] A pointer to the object whose lock to release.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* SEE ALSO\r
+* Object, cl_obj_t, cl_obj_lock\r
+*********/\r
+\r
+\r
+/****s* Component Library: Object/cl_obj_rel_t\r
+* NAME\r
+* cl_obj_rel_t\r
+*\r
+* DESCRIPTION\r
+* Identifies a dependent relationship between two objects.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _cl_obj_rel\r
+{\r
+ cl_pool_item_t pool_item; /* Must be first. */\r
+ struct _cl_obj *p_parent_obj;\r
+\r
+ cl_list_item_t list_item;\r
+ struct _cl_obj *p_child_obj;\r
+\r
+} cl_obj_rel_t;\r
+/*\r
+* FIELDS\r
+* pool_item\r
+* An item used to store the relationship in a free pool maintained\r
+* by the object manager. This field is also used by the parent object\r
+* to store the relationship in its child_list.\r
+*\r
+* p_parent_obj\r
+* A reference to the parent object for the relationship.\r
+*\r
+* list_item\r
+* This field is used by the child object to store the relationship in\r
+* its parent_list.\r
+*\r
+* p_child_obj\r
+* A reference to the child object for the relationship.\r
+*\r
+* NOTES\r
+* This structure is used to define all dependent relationships. Dependent\r
+* relationships are those where the destruction of a parent object result in\r
+* the destruction of child objects. For other types of relationships, simple\r
+* references between objects may be used.\r
+*\r
+* Relationship items are stored in lists maintained by both the parent\r
+* and child objects. References to both objects exist while the\r
+* relationship is maintained. Typically, relationships are defined by\r
+* the user by calling cl_obj_insert_rel, but are destroyed automatically\r
+* via an object's destruction process.\r
+*\r
+* SEE ALSO\r
+* Object, cl_rel_alloc, cl_rel_free, cl_obj_insert_rel, cl_obj_remove_rel,\r
+* cl_obj_destroy\r
+*********/\r
+\r
+\r
+\r
+/****f* Component Library: Object/cl_rel_alloc\r
+* NAME\r
+* cl_rel_alloc\r
+*\r
+* DESCRIPTION\r
+* Retrieves an object relationship item from the object manager.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_obj_rel_t* CL_API\r
+cl_rel_alloc(void);\r
+/*\r
+* PARAMETERS\r
+* None.\r
+*\r
+* RETURN VALUE\r
+* A reference to an allocated relationship object, or NULL if no relationship\r
+* object could be allocated.\r
+*\r
+* NOTES\r
+* This routine retrieves a cl_obj_rel_t structure from a pool maintained\r
+* by the object manager. The pool automatically grows as needed.\r
+*\r
+* Relationship items are used to describe a dependent relationship between\r
+* a parent and child object. In cases where a child has a fixed number of\r
+* relationships, the user may be able to allocate and manage the cl_obj_rel_t\r
+* structures more efficiently than obtaining the structures through this call.\r
+*\r
+* SEE ALSO\r
+* Object, cl_rel_free, cl_obj_insert_rel, cl_obj_remove_rel, cl_obj_destroy\r
+*********/\r
+\r
+\r
+\r
+/****f* Component Library: Object/cl_rel_free\r
+* NAME\r
+* cl_rel_free\r
+*\r
+* DESCRIPTION\r
+* Return a relationship object to the global object manager.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_rel_free(\r
+ IN cl_obj_rel_t * const p_rel );\r
+/*\r
+* PARAMETERS\r
+* p_rel\r
+* [in] A reference to the relationship item to free.\r
+*\r
+* RETURN VALUE\r
+* None.\r
+*\r
+* NOTES\r
+* Relationship items must not be freed until both the parent and child\r
+* object have removed their references to one another. Relationship items\r
+* may be freed after calling cl_obj_remove_rel or after the associated\r
+* child object's free callback has been invoked. In the latter case, the\r
+* invalid relationship items are referenced by the child object's parent_list.\r
+*\r
+* SEE ALSO\r
+* Object, cl_rel_alloc, cl_obj_insert_rel, cl_obj_remove_rel, cl_obj_destroy\r
+*********/\r
+\r
+\r
+\r
+/****f* Component Library: Object/cl_obj_insert_rel\r
+* NAME\r
+* cl_obj_insert_rel\r
+*\r
+* DESCRIPTION\r
+* Forms a relationship between two objects, with the existence of the child\r
+* object dependent on the parent.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_status_t CL_API\r
+cl_obj_insert_rel(\r
+ IN cl_obj_rel_t * const p_rel,\r
+ IN cl_obj_t * const p_parent_obj,\r
+ IN cl_obj_t * const p_child_obj );\r
+/*\r
+* PARAMETERS\r
+* p_rel\r
+* [in] A reference to an unused relationship item.\r
+*\r
+* p_parent_obj\r
+* [in] A reference to the parent object.\r
+*\r
+* p_child_obj\r
+* [in] A reference to the child object.\r
+*\r
+* RETURN VALUE\r
+* None.\r
+*\r
+* NOTES\r
+* This call inserts a relationship between the parent and child object.\r
+* The relationship allows for the automatic destruction of the child object\r
+* if the parent is destroyed.\r
+*\r
+* A given object can have multiple parent and child objects, but the\r
+* relationships must form into an object tree. That is, there cannot be any\r
+* cycles formed through the parent-child relationships. (For example, an\r
+* object cannot be both the parent and a child of a second object.)\r
+*\r
+* SEE ALSO\r
+* Object, cl_rel_alloc, cl_rel_free, cl_obj_remove_rel, cl_obj_destroy\r
+*********/\r
+\r
+\r
+\r
+/****f* Component Library: Object/cl_obj_insert_rel_parent_locked\r
+* NAME\r
+* cl_obj_insert_rel_parent_locked\r
+*\r
+* DESCRIPTION\r
+* Forms a relationship between two objects, with the existence of the child\r
+* object dependent on the parent. The parent's object lock is held.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_status_t CL_API\r
+cl_obj_insert_rel_parent_locked(\r
+ IN cl_obj_rel_t * const p_rel,\r
+ IN cl_obj_t * const p_parent_obj,\r
+ IN cl_obj_t * const p_child_obj );\r
+/*\r
+* PARAMETERS\r
+* p_rel\r
+* [in] A reference to an unused relationship item.\r
+*\r
+* p_parent_obj\r
+* [in] A reference to the parent object.\r
+*\r
+* p_child_obj\r
+* [in] A reference to the child object.\r
+*\r
+* RETURN VALUE\r
+* None.\r
+*\r
+* NOTES\r
+* This call inserts a relationship between the parent and child object.\r
+* The relationship allows for the automatic destruction of the child object\r
+* if the parent is destroyed.\r
+*\r
+* A given object can have multiple parent and child objects, but the\r
+* relationships must form into an object tree. That is, there cannot be any\r
+* cycles formed through the parent-child relationships. (For example, an\r
+* object cannot be both the parent and a child of a second object.)\r
+*\r
+* This call requires the caller to already hold the parent object's lock.\r
+*\r
+* SEE ALSO\r
+* Object, cl_rel_alloc, cl_rel_free, cl_obj_remove_rel, cl_obj_destroy\r
+*********/\r
+\r
+\r
+\r
+/****f* Component Library: Object/cl_obj_remove_rel\r
+* NAME\r
+* cl_obj_remove_rel\r
+*\r
+* DESCRIPTION\r
+* Manually removes a relationship between two objects.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_obj_remove_rel(\r
+ IN cl_obj_rel_t * const p_rel );\r
+/*\r
+* PARAMETERS\r
+* p_rel\r
+* [in] A reference to the relationship to remove.\r
+*\r
+* RETURN VALUE\r
+* None.\r
+*\r
+* NOTES\r
+* This routine permits a user to manually remove a dependent relationship\r
+* between two objects. When removing a relationship using this call, the\r
+* user must ensure that objects referenced by the relationship are not\r
+* destroyed, either directly or indirectly via a parent.\r
+*\r
+* SEE ALSO\r
+* Object, cl_rel_alloc, cl_rel_free, cl_obj_insert_rel, cl_obj_destroy\r
+*********/\r
+\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+\r
+\r
+#endif /* __CL_OBJ_H__ */\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. \r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+/*\r
+ * Abstract:\r
+ * This file contains the passive lock, which synchronizes passive threads.\r
+ * The passive lock allows multiple readers to access a resource\r
+ * simultaneously, exclusive from a single thread writting. It is similar\r
+ * in behavior to the passive lock, but works at passive only.\r
+ *\r
+ * Environment:\r
+ * All\r
+ */\r
+\r
+\r
+#ifndef _CL_PASSIVE_LOCK_H_\r
+#define _CL_PASSIVE_LOCK_H_\r
+\r
+\r
+#include <complib/cl_event.h>\r
+#include <complib/cl_atomic.h>\r
+\r
+\r
+/****h* Component Library/Passive Lock\r
+* NAME\r
+* Passive Lock\r
+*\r
+* DESCRIPTION\r
+* The Passive Lock provides synchronization between multiple threads that\r
+* are sharing the lock with a single thread holding the lock exclusively.\r
+*\r
+* Passive lock works exclusively between threads and cannot be used in\r
+* situations where the caller cannot be put into a waiting state.\r
+*\r
+* The passive lock functions operate a cl_plock_t structure which should\r
+* be treated as opaque and should be manipulated only through the provided\r
+* functions.\r
+*\r
+* SEE ALSO\r
+* Structures:\r
+* cl_plock_t\r
+*\r
+* Initialization:\r
+* cl_plock_construct, cl_plock_init, cl_plock_destroy\r
+*\r
+* Manipulation\r
+* cl_plock_acquire, cl_plock_excl_acquire, cl_plock_release\r
+*********/\r
+\r
+\r
+/****s* Component Library: Passive Lock/cl_plock_t\r
+* NAME\r
+* cl_plock_t\r
+*\r
+* DESCRIPTION\r
+* Passive Lock structure.\r
+*\r
+* The cl_plock_t structure should be treated as opaque and should\r
+* be manipulated only through the provided functions.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _cl_plock\r
+{\r
+ cl_event_t reader_event;\r
+ cl_event_t writer_event;\r
+ atomic32_t reader_count;\r
+\r
+} cl_plock_t;\r
+/*\r
+* FIELDS\r
+* reader_event\r
+* Event used to synchronize shared access to the lock.\r
+*\r
+* writer_event\r
+* Event used to synchronize exclusive access to the lock.\r
+*\r
+* reader_count\r
+* Number of threads holding the lock for shared access.\r
+*\r
+* SEE ALSO\r
+* Passive Lock\r
+*********/\r
+\r
+\r
+/****f* Component Library: Passive Lock/cl_plock_construct\r
+* NAME\r
+* cl_plock_construct\r
+*\r
+* DESCRIPTION\r
+* The cl_plock_construct function initializes the state of a\r
+* passive lock.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE void CL_API\r
+cl_plock_construct(\r
+ IN cl_plock_t* const p_lock )\r
+{\r
+ CL_ASSERT( p_lock );\r
+\r
+ p_lock->reader_count = 0;\r
+ cl_event_construct( &p_lock->reader_event );\r
+ cl_event_construct( &p_lock->writer_event );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_lock\r
+* [in] Pointer to a cl_plock_t structure whose state to initialize.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* Allows calling cl_plock_destroy without first calling cl_plock_init.\r
+*\r
+* Calling cl_plock_construct is a prerequisite to calling any other\r
+* passive lock function except cl_plock_init.\r
+*\r
+* SEE ALSO\r
+* Passive Lock, cl_plock_init, cl_plock_destroy\r
+*********/\r
+\r
+\r
+/****f* Component Library: Passive Lock/cl_plock_destroy\r
+* NAME\r
+* cl_plock_destroy\r
+*\r
+* DESCRIPTION\r
+* The cl_plock_destroy function performs any necessary cleanup\r
+* of a passive lock.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE void CL_API\r
+cl_plock_destroy(\r
+ IN cl_plock_t* const p_lock )\r
+{\r
+ CL_ASSERT( p_lock );\r
+ CL_ASSERT( p_lock->reader_count == 0 );\r
+\r
+ cl_event_destroy( &p_lock->writer_event );\r
+ cl_event_destroy( &p_lock->reader_event );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_lock\r
+* [in] Pointer to a cl_plock_t structure whose state to initialize.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* cl_plock_destroy performs any necessary cleanup of the specified\r
+* passive lock.\r
+*\r
+* This function must only be called if cl_plock_construct or\r
+* cl_plock_init has been called. The passive lock must not be held\r
+* when calling this function.\r
+*\r
+* SEE ALSO\r
+* Passive Lock, cl_plock_construct, cl_plock_init\r
+*********/\r
+\r
+\r
+/****f* Component Library: Passive Lock/cl_plock_init\r
+* NAME\r
+* cl_plock_init\r
+*\r
+* DESCRIPTION\r
+* The cl_plock_init function initializes a passive lock.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE cl_status_t CL_API\r
+cl_plock_init(\r
+ IN cl_plock_t* const p_lock )\r
+{\r
+ cl_status_t status;\r
+\r
+ CL_ASSERT( p_lock );\r
+\r
+ cl_plock_construct( p_lock );\r
+\r
+ status = cl_event_init( &p_lock->writer_event, FALSE );\r
+ if( status != CL_SUCCESS )\r
+ {\r
+ cl_plock_destroy( p_lock );\r
+ return( status );\r
+ }\r
+\r
+ status = cl_event_init( &p_lock->reader_event, FALSE );\r
+ if( status != CL_SUCCESS )\r
+ {\r
+ cl_plock_destroy( p_lock );\r
+ return( status );\r
+ }\r
+\r
+ /*\r
+ * Set the writer event to signalled so that the first\r
+ * wait operation succeeds.\r
+ */\r
+ status = cl_event_signal( &p_lock->writer_event );\r
+ if( status != CL_SUCCESS )\r
+ {\r
+ cl_plock_destroy( p_lock );\r
+ return( status );\r
+ }\r
+\r
+ /*\r
+ * Set the reader event to signalled so that the first\r
+ * wait operation succeeds.\r
+ */\r
+ status = cl_event_signal( &p_lock->reader_event );\r
+ if( status != CL_SUCCESS )\r
+ {\r
+ cl_plock_destroy( p_lock );\r
+ return( status );\r
+ }\r
+\r
+ return( CL_SUCCESS );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_lock\r
+* [in] Pointer to a cl_plock_t structure to initialize.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if the passive lock was initialized successfully.\r
+*\r
+* CL_ERROR otherwise.\r
+*\r
+* NOTES\r
+* Allows calling cl_plock_acquire, cl_plock_release,\r
+* cl_plock_excl_acquire, and cl_plock_excl_release.\r
+*\r
+* SEE ALSO\r
+* Passive Lock, cl_plock_construct, cl_plock_destroy,\r
+* cl_plock_excl_acquire, cl_plock_excl_release,\r
+* cl_plock_acquire, cl_plock_release\r
+*********/\r
+\r
+\r
+/****f* Component Library: Passive Lock/cl_plock_acquire\r
+* NAME\r
+* cl_plock_acquire\r
+*\r
+* DESCRIPTION\r
+* The cl_plock_acquire function acquires a passive lock for\r
+* shared access.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE void CL_API\r
+cl_plock_acquire(\r
+ IN cl_plock_t* const p_lock )\r
+{\r
+ cl_status_t status;\r
+\r
+ CL_ASSERT( p_lock );\r
+\r
+ status =\r
+ cl_event_wait_on( &p_lock->reader_event, EVENT_NO_TIMEOUT, FALSE );\r
+ CL_ASSERT( status == CL_SUCCESS );\r
+\r
+ /*\r
+ * Increment the reader count to block a thread trying for exclusive\r
+ * access.\r
+ */\r
+ cl_atomic_inc( &p_lock->reader_count );\r
+#ifdef DBG_PASSIVE_LOCKS\r
+ cl_dbg_out( "cl_plock_acquire: ReaderCount = %u\n",\r
+ p_lock->reader_count );\r
+#endif\r
+ /*\r
+ * Release the reader event to satisfy the wait of another reader\r
+ * or a writer.\r
+ */\r
+ cl_event_signal( &p_lock->reader_event );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_lock\r
+* [in] Pointer to a cl_plock_t structure to acquire.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* SEE ALSO\r
+* Passive Lock, cl_plock_release, cl_plock_excl_acquire\r
+*********/\r
+\r
+\r
+/****f* Component Library: Passive Lock/cl_plock_excl_acquire\r
+* NAME\r
+* cl_plock_excl_acquire\r
+*\r
+* DESCRIPTION\r
+* The cl_plock_excl_acquire function acquires exclusive access\r
+* to a passive lock.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE void CL_API\r
+cl_plock_excl_acquire(\r
+ IN cl_plock_t* const p_lock )\r
+{\r
+ cl_status_t status;\r
+\r
+ CL_ASSERT( p_lock );\r
+\r
+ /* Acquire the reader event. This will block new readers. */\r
+ status =\r
+ cl_event_wait_on( &p_lock->reader_event, EVENT_NO_TIMEOUT, FALSE );\r
+ CL_ASSERT( status == CL_SUCCESS );\r
+\r
+ /* Wait for the writer event until all readers have exited. */\r
+ while( p_lock->reader_count )\r
+ {\r
+#ifdef DBG_PASSIVE_LOCKS\r
+ cl_dbg_out( "cl_plock_excl_acquire: ReaderCount = %u\n",\r
+ p_lock->reader_count );\r
+#endif\r
+ status =\r
+ cl_event_wait_on( &p_lock->writer_event, EVENT_NO_TIMEOUT, FALSE );\r
+ CL_ASSERT( status == CL_SUCCESS );\r
+ }\r
+\r
+#ifdef DBG_PASSIVE_LOCKS\r
+ cl_dbg_out( "cl_plock_excl_acquire: Exit\n" );\r
+#endif\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_lock\r
+* [in] Pointer to a cl_plock_t structure to acquire exclusively.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* SEE ALSO\r
+* Passive Lock, cl_plock_release, cl_plock_acquire\r
+*********/\r
+\r
+\r
+/****f* Component Library: Passive Lock/cl_plock_release\r
+* NAME\r
+* cl_plock_release\r
+*\r
+* DESCRIPTION\r
+* The cl_plock_release function releases a passive lock from\r
+* shared or exclusive access.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE void CL_API\r
+cl_plock_release(\r
+ IN cl_plock_t* const p_lock )\r
+{\r
+ CL_ASSERT( p_lock );\r
+\r
+ if( p_lock->reader_count )\r
+ {\r
+\r
+ /*\r
+ * Decrement the count to allow a thread waiting for exclusive\r
+ * access to continue.\r
+ */\r
+ cl_atomic_dec( &p_lock->reader_count );\r
+\r
+ #ifdef DBG_PASSIVE_LOCKS\r
+ cl_dbg_out( "cl_plock_release: ReaderCount = %u\n",\r
+ p_lock->reader_count );\r
+ #endif\r
+\r
+ /* Release a writer, if any. */\r
+ cl_event_signal( &p_lock->writer_event );\r
+ }\r
+ else\r
+ {\r
+ /* Release threads waiting to acquire the lock. */\r
+ cl_event_signal( &p_lock->reader_event );\r
+ cl_event_signal( &p_lock->writer_event );\r
+\r
+ #ifdef DBG_PASSIVE_LOCKS\r
+ cl_dbg_out( "cl_plock_release: Exit\n" );\r
+ #endif\r
+ }\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_lock\r
+* [in] Pointer to a cl_plock_t structure to release.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* SEE ALSO\r
+* Passive Lock, cl_plock_acquire, cl_plock_excl_acquire\r
+*********/\r
+\r
+\r
+#endif /* _CL_PASSIVE_LOCK_H_ */\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. \r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+/*\r
+ * Abstract:\r
+ * Declaration of performance tracking.\r
+ *\r
+ * Environment:\r
+ * All\r
+ */\r
+\r
+\r
+#ifndef _CL_PERF_H_\r
+#define _CL_PERF_H_\r
+\r
+\r
+#include <complib/cl_types.h>\r
+#include <complib/cl_spinlock.h>\r
+#include <complib/cl_timer.h>\r
+\r
+\r
+/****h* Component Library/Performance Counters\r
+* NAME\r
+* Performance Counters\r
+*\r
+* DESCRIPTION\r
+* The performance counters allows timing operations to benchmark\r
+* software performance and help identify potential bottlenecks.\r
+*\r
+* All performance counters are NULL macros when disabled, preventing them\r
+* from adversly affecting performance in builds where the counters are not\r
+* used.\r
+*\r
+* Each counter records elapsed time in micro-seconds, minimum time elapsed,\r
+* and total number of samples.\r
+*\r
+* Each counter is independently protected by a spinlock, allowing use of\r
+* the counters in multi-processor environments.\r
+*\r
+* The impact of serializing access to performance counters is measured,\r
+* allowing measurements to be corrected as necessary.\r
+*\r
+* NOTES\r
+* Performance counters do impact performance, and should only be enabled\r
+* when gathering data. Counters can be enabled or disabled on a per-user\r
+* basis at compile time. To enable the counters, users should define\r
+* the PERF_TRACK_ON keyword before including the cl_perf.h file.\r
+* Undefining the PERF_TRACK_ON keyword disables the performance counters.\r
+* When disabled, all performance tracking calls resolve to no-ops.\r
+*\r
+* When using performance counters, it is the user's responsibility to\r
+* maintain the counter indexes. It is recomended that users define an\r
+* enumerated type to use for counter indexes. It improves readability\r
+* and simplifies maintenance by reducing the work necessary in managing\r
+* the counter indexes.\r
+*\r
+* SEE ALSO\r
+* Structures:\r
+* cl_perf_t\r
+*\r
+* Initialization:\r
+* cl_perf_construct, cl_perf_init, cl_perf_destroy\r
+*\r
+* Manipulation\r
+* cl_perf_reset, cl_perf_display, cl_perf_start, cl_perf_update,\r
+* cl_perf_log, cl_perf_stop\r
+*\r
+* Macros:\r
+* PERF_DECLARE, PERF_DECLARE_START\r
+*********/\r
+\r
+\r
+/*\r
+ * Number of times the counter calibration test is executed. This is used\r
+ * to determine the average time to use a performance counter.\r
+ */\r
+#define PERF_CALIBRATION_TESTS 100000\r
+\r
+\r
+/****i* Component Library: Performance Counters/cl_perf_data_t\r
+* NAME\r
+* cl_perf_data_t\r
+*\r
+* DESCRIPTION\r
+* The cl_perf_data_t structure is used to tracking information\r
+* for a single counter.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _cl_perf_data\r
+{\r
+ uint64_t count;\r
+ uint64_t total_time;\r
+ uint64_t min_time;\r
+ cl_spinlock_t lock;\r
+\r
+} cl_perf_data_t;\r
+/*\r
+* FIELDS\r
+* count\r
+* Number of samples in the counter.\r
+*\r
+* total_time\r
+* Total time for all samples, in microseconds.\r
+*\r
+* min_time\r
+* Minimum time for any sample in the counter, in microseconds.\r
+*\r
+* lock\r
+* Spinlock to serialize counter updates.\r
+*\r
+* SEE ALSO\r
+* Performance Counters\r
+*********/\r
+\r
+\r
+/****i* Component Library: Performance Counters/cl_perf_t\r
+* NAME\r
+* cl_perf_t\r
+*\r
+* DESCRIPTION\r
+* The cl_perf_t structure serves as a container for a group of performance\r
+* counters and related calibration data.\r
+*\r
+* This structure should be treated as opaque and be manipulated only through\r
+* the provided functions.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _cl_perf\r
+{\r
+ cl_perf_data_t *data_array;\r
+ uintn_t size;\r
+ uint64_t locked_calibration_time;\r
+ uint64_t normal_calibration_time;\r
+ cl_state_t state;\r
+\r
+} cl_perf_t;\r
+/*\r
+* FIELDS\r
+* data_array\r
+* Pointer to the array of performance counters.\r
+*\r
+* size\r
+* Number of counters in the counter array.\r
+*\r
+* locked_calibration_time\r
+* Time needed to update counters while holding a spinlock.\r
+*\r
+* normal_calibration_time\r
+* Time needed to update counters while not holding a spinlock.\r
+*\r
+* state\r
+* State of the performance counter provider.\r
+*\r
+* SEE ALSO\r
+* Performance Counters, cl_perf_data_t\r
+*********/\r
+\r
+\r
+/****f* Component Library: Performance Counters/cl_perf_construct\r
+* NAME\r
+* cl_perf_construct\r
+*\r
+* DESCRIPTION\r
+* The cl_perf_construct macro constructs a performance\r
+* tracking container.\r
+*\r
+* SYNOPSIS\r
+*/\r
+void\r
+cl_perf_construct(\r
+ IN cl_perf_t* const p_perf );\r
+/*\r
+* PARAMETERS\r
+* p_perf\r
+* [in] Pointer to a performance counter container to construct.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* cl_perf_construct allows calling cl_perf_destroy without first calling\r
+* cl_perf_init.\r
+*\r
+* Calling cl_perf_construct is a prerequisite to calling any other\r
+* perfromance counter function except cl_perf_init.\r
+*\r
+* This function is implemented as a macro and has no effect when\r
+* performance counters are disabled.\r
+*\r
+* SEE ALSO\r
+* Performance Counters, cl_perf_init, cl_perf_destroy\r
+*********/\r
+\r
+\r
+/****f* Component Library: Performance Counters/cl_perf_init\r
+* NAME\r
+* cl_perf_init\r
+*\r
+* DESCRIPTION\r
+* The cl_perf_init function initializes a performance counter container\r
+* for use.\r
+*\r
+* SYNOPSIS\r
+*/\r
+cl_status_t\r
+cl_perf_init(\r
+ IN cl_perf_t* const p_perf,\r
+ IN const uintn_t num_counters );\r
+/*\r
+* PARAMETERS\r
+* p_perf\r
+* [in] Pointer to a performance counter container to initalize.\r
+*\r
+* num_cntrs\r
+* [in] Number of counters to allocate in the container.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if initialization was successful.\r
+*\r
+* CL_INSUFFICIENT_MEMORY if there was not enough memory to initialize\r
+* the container.\r
+*\r
+* CL_ERROR if an error was encountered initializing the locks for the\r
+* performance counters.\r
+*\r
+* NOTES\r
+* This function allocates all memory required for the requested number of\r
+* counters and initializes all locks protecting those counters. After a\r
+* successful initialization, cl_perf_init calibrates the counters and\r
+* resets their value.\r
+*\r
+* This function is implemented as a macro and has no effect when\r
+* performance counters are disabled.\r
+*\r
+* SEE ALSO\r
+* Performance Counters, cl_perf_construct, cl_perf_destroy, cl_perf_display\r
+*********/\r
+\r
+\r
+/****f* Component Library: Performance Counters/cl_perf_destroy\r
+* NAME\r
+* cl_perf_destroy\r
+*\r
+* DESCRIPTION\r
+* The cl_perf_destroy function destroys a performance tracking container.\r
+*\r
+* SYNOPSIS\r
+*/\r
+void\r
+cl_perf_destroy(\r
+ IN cl_perf_t* const p_perf,\r
+ IN const boolean_t display );\r
+/*\r
+* PARAMETERS\r
+* p_perf\r
+* [in] Pointer to a performance counter container to destroy.\r
+*\r
+* display\r
+* [in] If TRUE, causes the performance counters to be displayed.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* cl_perf_destroy frees all resources allocated in a call to cl_perf_init.\r
+* If the display parameter is set to TRUE, displays all counter values\r
+* before deallocating resources.\r
+*\r
+* This function should only be called after a call to cl_perf_construct\r
+* or cl_perf_init.\r
+*\r
+* This function is implemented as a macro and has no effect when\r
+* performance counters are disabled.\r
+*\r
+* SEE ALSO\r
+* Performance Counters, cl_perf_construct, cl_perf_init\r
+*********/\r
+\r
+\r
+/****f* Component Library: Performance Counters/cl_perf_reset\r
+* NAME\r
+* cl_perf_reset\r
+*\r
+* DESCRIPTION\r
+* The cl_perf_reset function resets the counters contained in\r
+* a performance tracking container.\r
+*\r
+* SYNOPSIS\r
+*/\r
+void\r
+cl_perf_reset(\r
+ IN cl_perf_t* const p_perf );\r
+/*\r
+* PARAMETERS\r
+* p_perf\r
+* [in] Pointer to a performance counter container whose counters\r
+* to reset.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* This function is implemented as a macro and has no effect when\r
+* performance counters are disabled.\r
+*\r
+* SEE ALSO\r
+* Performance Counters\r
+*********/\r
+\r
+\r
+/****f* Component Library: Performance Counters/cl_perf_display\r
+* NAME\r
+* cl_perf_display\r
+*\r
+* DESCRIPTION\r
+* The cl_perf_display function displays the current performance\r
+* counter values.\r
+*\r
+* SYNOPSIS\r
+*/\r
+void\r
+cl_perf_display(\r
+ IN const cl_perf_t* const p_perf );\r
+/*\r
+* PARAMETERS\r
+* p_perf\r
+* [in] Pointer to a performance counter container whose counter\r
+* values to display.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* This function is implemented as a macro and has no effect when\r
+* performance counters are disabled.\r
+*\r
+* SEE ALSO\r
+* Performance Counters, cl_perf_init\r
+*********/\r
+\r
+\r
+/****d* Component Library: Performance Counters/PERF_DECLARE\r
+* NAME\r
+* PERF_DECLARE\r
+*\r
+* DESCRIPTION\r
+* The PERF_DECLARE macro declares a performance counter variable used\r
+* to store the starting time of a timing sequence.\r
+*\r
+* SYNOPSIS\r
+* PERF_DECLARE( index )\r
+*\r
+* PARAMETERS\r
+* index\r
+* [in] Index of the performance counter for which to use this\r
+* variable.\r
+*\r
+* NOTES\r
+* Variables should generally be declared on the stack to support\r
+* multi-threading. In cases where a counter needs to be used to\r
+* time operations accross multiple functions, care must be taken to\r
+* ensure that the start time stored in this variable is not overwritten\r
+* before the related performance counter has been updated.\r
+*\r
+* This macro has no effect when performance counters are disabled.\r
+*\r
+* SEE ALSO\r
+* Performance Counters, PERF_DECLARE_START, cl_perf_start, cl_perf_log,\r
+* cl_perf_stop\r
+*********/\r
+\r
+\r
+/****d* Component Library: Performance Counters/PERF_DECLARE_START\r
+* NAME\r
+* PERF_DECLARE_START\r
+*\r
+* DESCRIPTION\r
+* The PERF_DECLARE_START macro declares a performance counter variable\r
+* and sets it to the starting time of a timed sequence.\r
+*\r
+* SYNOPSIS\r
+* PERF_DECLARE_START( index )\r
+*\r
+* PARAMETERS\r
+* index\r
+* [in] Index of the performance counter for which to use this\r
+* variable.\r
+*\r
+* NOTES\r
+* Variables should generally be declared on the stack to support\r
+* multi-threading.\r
+*\r
+* This macro has no effect when performance counters are disabled.\r
+*\r
+* SEE ALSO\r
+* Performance Counters, PERF_DECLARE, cl_perf_start, cl_perf_log,\r
+* cl_perf_stop\r
+*********/\r
+\r
+\r
+/****d* Component Library: Performance Counters/cl_perf_start\r
+* NAME\r
+* cl_perf_start\r
+*\r
+* DESCRIPTION\r
+* The cl_perf_start macro sets the starting value of a timed sequence.\r
+*\r
+* SYNOPSIS\r
+*/\r
+void\r
+cl_perf_start(\r
+ IN const uintn_t index );\r
+/*\r
+* PARAMETERS\r
+* index\r
+* [in] Index of the performance counter to set.\r
+*\r
+* NOTES\r
+* This macro has no effect when performance counters are disabled.\r
+*\r
+* SEE ALSO\r
+* Performance Counters, PERF_DECLARE, PERF_DECLARE_START, cl_perf_log,\r
+* cl_perf_update, cl_perf_stop\r
+*********/\r
+\r
+\r
+/****d* Component Library: Performance Counters/cl_perf_clr\r
+* NAME\r
+* cl_perf_clr\r
+*\r
+* DESCRIPTION\r
+* The cl_perf_clr macro clears a counter variable.\r
+*\r
+* SYNOPSIS\r
+*/\r
+void\r
+cl_perf_inc(\r
+ IN const uintn_t index );\r
+/*\r
+* PARAMETERS\r
+* index\r
+* [in] Index of the performance counter to set.\r
+*\r
+* NOTES\r
+* This macro has no effect when performance counters are disabled.\r
+*\r
+* SEE ALSO\r
+* Performance Counters, PERF_DECLARE, PERF_DECLARE_START, cl_perf_log,\r
+* cl_perf_update, cl_perf_stop\r
+*********/\r
+\r
+\r
+/****d* Component Library: Performance Counters/cl_perf_inc\r
+* NAME\r
+* cl_perf_inc\r
+*\r
+* DESCRIPTION\r
+* The cl_perf_inc macro increments a counter variable by one.\r
+*\r
+* SYNOPSIS\r
+*/\r
+void\r
+cl_perf_inc(\r
+ IN const uintn_t index );\r
+/*\r
+* PARAMETERS\r
+* index\r
+* [in] Index of the performance counter to set.\r
+*\r
+* NOTES\r
+* This macro has no effect when performance counters are disabled.\r
+*\r
+* SEE ALSO\r
+* Performance Counters, PERF_DECLARE, PERF_DECLARE_START, cl_perf_log,\r
+* cl_perf_update, cl_perf_stop\r
+*********/\r
+\r
+\r
+/****d* Component Library: Performance Counters/cl_perf_update\r
+* NAME\r
+* cl_perf_update\r
+*\r
+* DESCRIPTION\r
+* The cl_perf_update macro adds a timing sample based on a provided start\r
+* time to a counter in a performance counter container.\r
+*\r
+* SYNOPSIS\r
+*/\r
+void\r
+cl_perf_update(\r
+ IN cl_perf_t* const p_perf,\r
+ IN const uintn_t index,\r
+ IN const uint64_t start_time );\r
+/*\r
+* PARAMETERS\r
+* p_perf\r
+* [in] Pointer to a performance counter container to whose counter\r
+* the sample should be added.\r
+*\r
+* index\r
+* [in] Number of the performance counter to update with a new sample.\r
+*\r
+* start_time\r
+* [in] Timestamp to use as the start time for the timing sample.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* This macro has no effect when performance counters are disabled.\r
+*\r
+* SEE ALSO\r
+* Performance Counters, PERF_DECLARE, PERF_DECLARE_START, cl_perf_start,\r
+* cl_perf_lob, cl_perf_stop\r
+*********/\r
+\r
+\r
+/****d* Component Library: Performance Counters/cl_perf_update_ctr\r
+* NAME\r
+* cl_perf_update_ctr\r
+*\r
+* DESCRIPTION\r
+* The cl_perf_update_ctr macro updates a counter in a performance\r
+* counter container.\r
+*\r
+* SYNOPSIS\r
+*/\r
+void\r
+cl_perf_update_ctr(\r
+ IN cl_perf_t* const p_perf,\r
+ IN const uintn_t index );\r
+/*\r
+* PARAMETERS\r
+* p_perf\r
+* [in] Pointer to a performance counter container to whose counter\r
+* the sample should be added.\r
+*\r
+* index\r
+* [in] Number of the performance counter to update with a new sample.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* This macro has no effect when performance counters are disabled.\r
+*\r
+* SEE ALSO\r
+* Performance Counters, PERF_DECLARE, PERF_DECLARE_START, cl_perf_start,\r
+* cl_perf_lob, cl_perf_stop\r
+*********/\r
+\r
+\r
+/****d* Component Library: Performance Counters/cl_perf_log\r
+* NAME\r
+* cl_perf_log\r
+*\r
+* DESCRIPTION\r
+* The cl_perf_log macro adds a given timing sample to a\r
+* counter in a performance counter container.\r
+*\r
+* SYNOPSIS\r
+*/\r
+void\r
+cl_perf_log(\r
+ IN cl_perf_t* const p_perf,\r
+ IN const uintn_t index,\r
+ IN const uint64_t pc_total_time );\r
+/*\r
+* PARAMETERS\r
+* p_perf\r
+* [in] Pointer to a performance counter container to whose counter\r
+* the sample should be added.\r
+*\r
+* index\r
+* [in] Number of the performance counter to update with a new sample.\r
+*\r
+* pc_total_time\r
+* [in] Total elapsed time for the sample being added.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* This macro has no effect when performance counters are disabled.\r
+*\r
+* SEE ALSO\r
+* Performance Counters, PERF_DECLARE, PERF_DECLARE_START, cl_perf_start,\r
+* cl_perf_update, cl_perf_stop\r
+*********/\r
+\r
+\r
+/****d* Component Library: Performance Counters/cl_perf_stop\r
+* NAME\r
+* cl_perf_stop\r
+*\r
+* DESCRIPTION\r
+* The cl_perf_log macro updates a counter in a performance counter\r
+* container with a new timing sample.\r
+*\r
+* SYNOPSIS\r
+*/\r
+void\r
+cl_perf_stop(\r
+ IN cl_perf_t* const p_perf,\r
+ IN const uintn_t index );\r
+/*\r
+* PARAMETERS\r
+* p_perf\r
+* [in] Pointer to a performance counter container to whose counter\r
+* a sample should be added.\r
+*\r
+* index\r
+* [in] Number of the performance counter to update with a new sample.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* The ending time stamp is taken and elapsed time calculated before updating\r
+* the specified counter.\r
+*\r
+* This macro has no effect when performance counters are disabled.\r
+*\r
+* SEE ALSO\r
+* Performance Counters, PERF_DECLARE, PERF_DECLARE_START, cl_perf_start,\r
+* cl_perf_log\r
+*********/\r
+\r
+\r
+/*\r
+ * PERF_TRACK_ON must be defined by the user before including this file to\r
+ * enable performance tracking. To disable tracking, users should undefine\r
+ * PERF_TRACK_ON.\r
+ */\r
+#if defined( PERF_TRACK_ON )\r
+/*\r
+ * Enable performance tracking.\r
+ */\r
+\r
+#define cl_perf_construct( p_perf ) \\r
+ __cl_perf_construct( p_perf )\r
+#define cl_perf_init( p_perf, num_counters ) \\r
+ __cl_perf_init( p_perf, num_counters )\r
+#define cl_perf_destroy( p_perf, display ) \\r
+ __cl_perf_destroy( p_perf, display )\r
+#define cl_perf_reset( p_perf ) \\r
+ __cl_perf_reset( p_perf )\r
+#define cl_perf_display( p_perf ) \\r
+ __cl_perf_display( p_perf )\r
+#define PERF_DECLARE( index ) \\r
+ uint64_t Pc##index\r
+#define PERF_DECLARE_START( index ) \\r
+ uint64 Pc##index = cl_get_time_stamp()\r
+#define cl_perf_start( index ) \\r
+ (Pc##index = cl_get_time_stamp())\r
+#define cl_perf_clr( index ) \\r
+ (Pc##index = 0)\r
+#define cl_perf_inc( index ) \\r
+ (Pc##index++)\r
+#define cl_perf_log( p_perf, index, pc_total_time ) \\r
+{\\r
+ /* Update the performance data. This requires synchronization. */ \\r
+ cl_spinlock_acquire( &((cl_perf_t*)p_perf)->data_array[index].lock ); \\r
+ \\r
+ ((cl_perf_t*)p_perf)->data_array[index].total_time += pc_total_time; \\r
+ ((cl_perf_t*)p_perf)->data_array[index].count++; \\r
+ if( pc_total_time < ((cl_perf_t*)p_perf)->data_array[index].min_time ) \\r
+ ((cl_perf_t*)p_perf)->data_array[index].min_time = pc_total_time; \\r
+ \\r
+ cl_spinlock_release( &((cl_perf_t*)p_perf)->data_array[index].lock ); \\r
+}\r
+#define cl_perf_update( p_perf, index, start_time ) \\r
+{\\r
+ /* Get the ending time stamp, and calculate the total time. */ \\r
+ uint64_t pc_total_time = cl_get_time_stamp() - start_time;\\r
+ /* Using stack variable for start time, stop and log */ \\r
+ cl_perf_log( p_perf, index, pc_total_time ); \\r
+}\r
+#define cl_perf_update_ctr( p_perf, index ) \\r
+ cl_perf_log( p_perf, index, Pc##index )\r
+#define cl_perf_stop( p_perf, index ) \\r
+{\\r
+ cl_perf_update( p_perf, index, Pc##index );\\r
+}\r
+\r
+#define cl_get_perf_values( p_perf, index, p_total, p_min, p_count ) \\r
+{\\r
+ *p_total = p_perf->data_array[index].total_time; \\r
+ *p_min = p_perf->data_array[index].min_time; \\r
+ *p_count = p_perf->data_array[index].count; \\r
+}\r
+\r
+#define cl_get_perf_calibration( p_perf, p_locked_time, p_normal_time ) \\r
+{\\r
+ *p_locked_time = p_perf->locked_calibration_time; \\r
+ *p_normal_time = p_perf->normal_calibration_time; \\r
+}\r
+\r
+#define cl_get_perf_string( p_perf, i ) \\r
+"CL Perf:\t%lu\t%"PRIu64"\t%"PRIu64"\t%"PRIu64"\n", \\r
+ i, p_perf->data_array[i].total_time, \\r
+ p_perf->data_array[i].min_time, p_perf->data_array[i].count\r
+\r
+#else /* PERF_TRACK_ON */\r
+/*\r
+ * Disable performance tracking.\r
+ */\r
+\r
+#define cl_perf_construct( p_perf )\r
+#define cl_perf_init( p_perf, num_cntrs ) CL_SUCCESS\r
+#define cl_perf_destroy( p_perf, display )\r
+#define cl_perf_reset( p_perf )\r
+#define cl_perf_display( p_perf )\r
+#define PERF_DECLARE( index )\r
+#define PERF_DECLARE_START( index )\r
+#define cl_perf_start( index )\r
+#define cl_perf_clr( index )\r
+#define cl_perf_inc( index )\r
+#define cl_perf_log( p_perf, index, pc_total_time )\r
+#define cl_perf_update( p_perf, index, start_time )\r
+#define cl_perf_update_ctr( p_perf, index )\r
+#define cl_perf_stop( p_perf, index )\r
+#define cl_get_perf_values( p_perf, index, p_total, p_min, p_count )\r
+#define cl_get_perf_calibration( p_perf, p_locked_time, p_normal_time )\r
+#endif /* PERF_TRACK_ON */\r
+\r
+\r
+/*\r
+ * Internal performance tracking functions. Users should never call these\r
+ * functions directly. Instead, use the macros defined above to resolve\r
+ * to these functions when PERF_TRACK_ON is defined, which allows disabling\r
+ * performance tracking.\r
+ */\r
+\r
+\r
+/*\r
+ * Initialize the state of the performance tracking structure.\r
+ */\r
+CL_EXPORT void CL_API\r
+__cl_perf_construct(\r
+ IN cl_perf_t* const p_perf );\r
+\r
+/*\r
+ * Size the performance tracking information and initialize all\r
+ * related structures.\r
+ */\r
+CL_EXPORT cl_status_t CL_API\r
+__cl_perf_init(\r
+ IN cl_perf_t* const p_perf,\r
+ IN const uintn_t num_counters );\r
+\r
+/*\r
+ * Destroy the performance tracking data.\r
+ */\r
+CL_EXPORT void CL_API\r
+__cl_perf_destroy(\r
+ IN cl_perf_t* const p_perf,\r
+ IN const boolean_t display );\r
+\r
+/*\r
+ * Reset the performance tracking data.\r
+ */\r
+CL_EXPORT void CL_API\r
+__cl_perf_reset(\r
+ IN cl_perf_t* const p_perf );\r
+\r
+/*\r
+ * Display the current performance tracking data.\r
+ */\r
+CL_EXPORT void CL_API\r
+__cl_perf_display(\r
+ IN const cl_perf_t* const p_perf );\r
+\r
+\r
+#endif /* _CL_PERF_H_ */\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. \r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+/*\r
+ * Abstract:\r
+ * Declaration of the pool.\r
+ * The pool manages a pool of objects.\r
+ * The pool can grow to meet demand, limited only by system memory.\r
+ *\r
+ * Environment:\r
+ * All\r
+ */\r
+\r
+\r
+#ifndef _CL_POOL_H_\r
+#define _CL_POOL_H_\r
+\r
+\r
+#include <complib/cl_qcomppool.h>\r
+\r
+\r
+/****h* Component Library/Pool\r
+* NAME\r
+* Pool\r
+*\r
+* DESCRIPTION\r
+* The pool provides a self-contained and self-sustaining pool\r
+* of user defined objects.\r
+*\r
+* To aid in object oriented design, the pool provides the user\r
+* the ability to specify callbacks that are invoked for each object for\r
+* construction, initialization, and destruction. Constructor and destructor\r
+* callback functions may not fail.\r
+*\r
+* A pool does not return memory to the system as the user returns\r
+* objects to the pool. The only method of returning memory to the system is\r
+* to destroy the pool.\r
+*\r
+* The Pool functions operate on a cl_pool_t structure which should be treated\r
+* as opaque and should be manipulated only through the provided functions.\r
+*\r
+* SEE ALSO\r
+* Structures:\r
+* cl_pool_t\r
+*\r
+* Callbacks:\r
+* cl_pfn_pool_init_t, cl_pfn_pool_dtor_t\r
+*\r
+* Initialization/Destruction:\r
+* cl_pool_construct, cl_pool_init, cl_pool_destroy\r
+*\r
+* Manipulation:\r
+* cl_pool_get, cl_pool_put, cl_pool_grow\r
+*\r
+* Attributes:\r
+* cl_is_pool_inited, cl_pool_count\r
+*********/\r
+\r
+\r
+/****d* Component Library: Pool/cl_pfn_pool_init_t\r
+* NAME\r
+* cl_pfn_pool_init_t\r
+*\r
+* DESCRIPTION\r
+* The cl_pfn_pool_init_t function type defines the prototype for\r
+* functions used as initializers for objects being allocated by a\r
+* pool.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef cl_status_t\r
+(CL_API *cl_pfn_pool_init_t)(\r
+ IN void* const p_object,\r
+ IN void* context );\r
+/*\r
+* PARAMETERS\r
+* p_object\r
+* [in] Pointer to an object to initialize.\r
+*\r
+* context\r
+* [in] Context provided in a call to cl_pool_init.\r
+*\r
+* RETURN VALUES\r
+* Return CL_SUCCESS to indicates that initialization of the object\r
+* was successful and initialization of further objects may continue.\r
+*\r
+* Other cl_status_t values will be returned by cl_pool_init\r
+* and cl_pool_grow.\r
+*\r
+* NOTES\r
+* This function type is provided as function prototype reference for\r
+* the function provided by the user as an optional parameter to the\r
+* cl_pool_init function.\r
+*\r
+* The initializer is invoked once per allocated object, allowing the user\r
+* to trap initialization failures. Returning a status other than CL_SUCCESS\r
+* aborts a grow operation, initiated either through cl_pool_init or\r
+* cl_pool_grow, and causes the initiating function to fail.\r
+* Any non-CL_SUCCESS status will be returned by the function that initiated\r
+* the grow operation.\r
+*\r
+* SEE ALSO\r
+* Pool, cl_pool_init, cl_pool_grow\r
+*********/\r
+\r
+\r
+/****d* Component Library: Pool/cl_pfn_pool_dtor_t\r
+* NAME\r
+* cl_pfn_pool_dtor_t\r
+*\r
+* DESCRIPTION\r
+* The cl_pfn_pool_dtor_t function type defines the prototype for\r
+* functions used as destructor for objects being deallocated by a\r
+* pool.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef void\r
+(CL_API *cl_pfn_pool_dtor_t)(\r
+ IN void* const p_object,\r
+ IN void* context );\r
+/*\r
+* PARAMETERS\r
+* p_object\r
+* [in] Pointer to an object to destruct.\r
+*\r
+* context\r
+* [in] Context provided in the call to cl_pool_init.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* This function type is provided as function prototype reference for\r
+* the function provided by the user as an optional parameter to the\r
+* cl_pool_init function.\r
+*\r
+* The destructor is invoked once per allocated object, allowing the user\r
+* to perform any necessary cleanup. Users should not attempt to deallocate\r
+* the memory for the object, as the pool manages object\r
+* allocation and deallocation.\r
+*\r
+* SEE ALSO\r
+* Pool, cl_pool_init\r
+*********/\r
+\r
+\r
+/****s* Component Library: Pool/cl_pool_t\r
+* NAME\r
+* cl_pool_t\r
+*\r
+* DESCRIPTION\r
+* pool structure.\r
+*\r
+* The cl_pool_t structure should be treated as opaque and should be\r
+* manipulated only through the provided functions.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _cl_pool\r
+{\r
+ cl_qcpool_t qcpool;\r
+ cl_pfn_pool_init_t pfn_init;\r
+ cl_pfn_pool_dtor_t pfn_dtor;\r
+ const void *context;\r
+\r
+} cl_pool_t;\r
+/*\r
+* FIELDS\r
+* qcpool\r
+* Quick composite pool that manages all objects.\r
+*\r
+* pfn_init\r
+* Pointer to the user's initializer callback, used by the pool\r
+* to translate the quick composite pool's initializer callback to\r
+* a pool initializer callback.\r
+*\r
+* pfn_dtor\r
+* Pointer to the user's destructor callback, used by the pool\r
+* to translate the quick composite pool's destructor callback to\r
+* a pool destructor callback.\r
+*\r
+* context\r
+* User's provided context for callback functions, used by the pool\r
+* to when invoking callbacks.\r
+*\r
+* SEE ALSO\r
+* Pool\r
+*********/\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif /* __cplusplus */\r
+\r
+\r
+/****f* Component Library: Pool/cl_pool_construct\r
+* NAME\r
+* cl_pool_construct\r
+*\r
+* DESCRIPTION\r
+* The cl_pool_construct function constructs a pool.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_pool_construct(\r
+ IN cl_pool_t* const p_pool );\r
+/*\r
+* PARAMETERS\r
+* p_pool\r
+* [in] Pointer to a cl_pool_t structure whose state to initialize.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* Allows calling cl_pool_init, cl_pool_destroy, and cl_is_pool_inited.\r
+*\r
+* Calling cl_pool_construct is a prerequisite to calling any other\r
+* pool function except cl_pool_init.\r
+*\r
+* SEE ALSO\r
+* Pool, cl_pool_init, cl_pool_destroy, cl_is_pool_inited\r
+*********/\r
+\r
+\r
+/****f* Component Library: Pool/cl_is_pool_inited\r
+* NAME\r
+* cl_is_pool_inited\r
+*\r
+* DESCRIPTION\r
+* The cl_is_pool_inited function returns whether a pool was successfully\r
+* initialized.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE uint32_t CL_API\r
+cl_is_pool_inited(\r
+ IN const cl_pool_t* const p_pool )\r
+{\r
+ /* CL_ASSERT that a non-null pointer is provided. */\r
+ CL_ASSERT( p_pool );\r
+ return( cl_is_qcpool_inited( &p_pool->qcpool ) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_pool\r
+* [in] Pointer to a cl_pool_t structure whose initialization state\r
+* to check.\r
+*\r
+* RETURN VALUES\r
+* TRUE if the pool was initialized successfully.\r
+*\r
+* FALSE otherwise.\r
+*\r
+* NOTES\r
+* Allows checking the state of a pool to determine if invoking member\r
+* functions is appropriate.\r
+*\r
+* SEE ALSO\r
+* Pool\r
+*********/\r
+\r
+\r
+/****f* Component Library: Pool/cl_pool_init\r
+* NAME\r
+* cl_pool_init\r
+*\r
+* DESCRIPTION\r
+* The cl_pool_init function initializes a pool for use.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_status_t CL_API\r
+cl_pool_init(\r
+ IN cl_pool_t* const p_pool,\r
+ IN const size_t min_count,\r
+ IN const size_t max_count,\r
+ IN const size_t grow_size,\r
+ IN const size_t object_size,\r
+ IN cl_pfn_pool_init_t pfn_initializer OPTIONAL,\r
+ IN cl_pfn_pool_dtor_t pfn_destructor OPTIONAL,\r
+ IN const void* const context );\r
+/*\r
+* PARAMETERS\r
+* p_pool\r
+* [in] Pointer to a cl_pool_t structure to initialize.\r
+*\r
+* min_count\r
+* [in] Minimum number of objects that the pool should support. All\r
+* necessary allocations to allow storing the minimum number of items\r
+* are performed at initialization time, and all necessary callbacks\r
+* invoked.\r
+*\r
+* max_count\r
+* [in] Maximum number of objects to which the pool is allowed to grow.\r
+* A value of zero specifies no maximum.\r
+*\r
+* grow_size\r
+* [in] Number of objects to allocate when incrementally growing the pool.\r
+* A value of zero disables automatic growth.\r
+*\r
+* object_size\r
+* [in] Size, in bytes, of each object.\r
+*\r
+* pfn_initializer\r
+* [in] Initialization callback to invoke for every new object when\r
+* growing the pool. This parameter is optional and may be NULL.\r
+* See the cl_pfn_pool_init_t function type declaration for details\r
+* about the callback function.\r
+*\r
+* pfn_destructor\r
+* [in] Destructor callback to invoke for every object before memory for\r
+* that object is freed. This parameter is optional and may be NULL.\r
+* See the cl_pfn_pool_dtor_t function type declaration for details\r
+* about the callback function.\r
+*\r
+* context\r
+* [in] Value to pass to the callback functions to provide context.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if the pool was initialized successfully.\r
+*\r
+* CL_INSUFFICIENT_MEMORY if there was not enough memory to initialize the\r
+* pool.\r
+*\r
+* CL_INVALID_SETTING if a the maximum size is non-zero and less than the\r
+* minimum size.\r
+*\r
+* Other cl_status_t value returned by optional initialization callback function\r
+* specified by the pfn_initializer parameter.\r
+*\r
+* NOTES\r
+* cl_pool_init initializes, and if necessary, grows the pool to\r
+* the capacity desired.\r
+*\r
+* SEE ALSO\r
+* Pool, cl_pool_construct, cl_pool_destroy,\r
+* cl_pool_get, cl_pool_put, cl_pool_grow,\r
+* cl_pool_count, cl_pfn_pool_init_t, cl_pfn_pool_dtor_t\r
+*********/\r
+\r
+\r
+/****f* Component Library: Pool/cl_pool_destroy\r
+* NAME\r
+* cl_pool_destroy\r
+*\r
+* DESCRIPTION\r
+* The cl_pool_destroy function destroys a pool.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE void CL_API\r
+cl_pool_destroy(\r
+ IN cl_pool_t* const p_pool )\r
+{\r
+ CL_ASSERT( p_pool );\r
+ cl_qcpool_destroy( &p_pool->qcpool );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_pool\r
+* [in] Pointer to a cl_pool_t structure to destroy.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* All memory allocated for objects is freed. The destructor callback,\r
+* if any, will be invoked for every allocated object. Further operations\r
+* on the pool should not be attempted after cl_pool_destroy\r
+* is invoked.\r
+*\r
+* This function should only be called after a call to\r
+* cl_pool_construct or cl_pool_init.\r
+*\r
+* In a debug build, cl_pool_destroy asserts that all objects are in\r
+* the pool.\r
+*\r
+* SEE ALSO\r
+* Pool, cl_pool_construct, cl_pool_init\r
+*********/\r
+\r
+\r
+/****f* Component Library: Pool/cl_pool_count\r
+* NAME\r
+* cl_pool_count\r
+*\r
+* DESCRIPTION\r
+* The cl_pool_count function returns the number of available objects\r
+* in a pool.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE size_t CL_API\r
+cl_pool_count(\r
+ IN cl_pool_t* const p_pool )\r
+{\r
+ CL_ASSERT( p_pool );\r
+ return( cl_qcpool_count( &p_pool->qcpool ) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_pool\r
+* [in] Pointer to a cl_pool_t structure for which the number of\r
+* available objects is requested.\r
+*\r
+* RETURN VALUE\r
+* Returns the number of objects available in the specified pool.\r
+*\r
+* SEE ALSO\r
+* Pool\r
+*********/\r
+\r
+\r
+/****f* Component Library: Pool/cl_pool_get\r
+* NAME\r
+* cl_pool_get\r
+*\r
+* DESCRIPTION\r
+* The cl_pool_get function retrieves an object from a pool.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE void* CL_API\r
+cl_pool_get(\r
+ IN cl_pool_t* const p_pool )\r
+{\r
+ cl_pool_obj_t *p_pool_obj;\r
+\r
+ CL_ASSERT( p_pool );\r
+\r
+ p_pool_obj = (cl_pool_obj_t*)cl_qcpool_get( &p_pool->qcpool );\r
+ if( !p_pool_obj )\r
+ return( NULL );\r
+\r
+ CL_ASSERT( p_pool_obj->list_obj.p_object );\r
+ return( (void*)p_pool_obj->list_obj.p_object );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_pool\r
+* [in] Pointer to a cl_pool_t structure from which to retrieve\r
+* an object.\r
+*\r
+* RETURN VALUES\r
+* Returns a pointer to an object.\r
+*\r
+* Returns NULL if the pool is empty and can not be grown automatically.\r
+*\r
+* NOTES\r
+* cl_pool_get returns the object at the head of the pool. If the pool is\r
+* empty, it is automatically grown to accommodate this request unless the\r
+* grow_size parameter passed to the cl_pool_init function was zero.\r
+*\r
+* SEE ALSO\r
+* Pool, cl_pool_get_tail, cl_pool_put, cl_pool_grow, cl_pool_count\r
+*********/\r
+\r
+\r
+/****f* Component Library: Pool/cl_pool_put\r
+* NAME\r
+* cl_pool_put\r
+*\r
+* DESCRIPTION\r
+* The cl_pool_put function returns an object to a pool.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE void CL_API\r
+cl_pool_put(\r
+ IN cl_pool_t* const p_pool,\r
+ IN void* const p_object )\r
+{\r
+ cl_pool_obj_t *p_pool_obj;\r
+\r
+ CL_ASSERT( p_pool );\r
+ CL_ASSERT( p_object );\r
+\r
+ /* Calculate the offset to the list object representing this object. */\r
+ p_pool_obj = (cl_pool_obj_t*)\r
+ (((uint8_t*)p_object) - sizeof(cl_pool_obj_t));\r
+\r
+ /* good sanity check */\r
+ CL_ASSERT( p_pool_obj->list_obj.p_object == p_object );\r
+\r
+ cl_qcpool_put( &p_pool->qcpool, (cl_pool_item_t*)p_pool_obj );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_pool\r
+* [in] Pointer to a cl_pool_t structure to which to return\r
+* an object.\r
+*\r
+* p_object\r
+* [in] Pointer to an object to return to the pool.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* cl_pool_put places the returned object at the head of the pool.\r
+*\r
+* The object specified by the p_object parameter must have been\r
+* retrieved from the pool by a previous call to cl_pool_get.\r
+*\r
+* SEE ALSO\r
+* Pool, cl_pool_put_tail, cl_pool_get\r
+*********/\r
+\r
+\r
+/****f* Component Library: Pool/cl_pool_grow\r
+* NAME\r
+* cl_pool_grow\r
+*\r
+* DESCRIPTION\r
+* The cl_pool_grow function grows a pool by\r
+* the specified number of objects.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE cl_status_t CL_API\r
+cl_pool_grow(\r
+ IN cl_pool_t* const p_pool,\r
+ IN const size_t obj_count )\r
+{\r
+ CL_ASSERT( p_pool );\r
+ return( cl_qcpool_grow( &p_pool->qcpool, obj_count ) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_pool\r
+* [in] Pointer to a cl_pool_t structure whose capacity to grow.\r
+*\r
+* obj_count\r
+* [in] Number of objects by which to grow the pool.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if the pool grew successfully.\r
+*\r
+* CL_INSUFFICIENT_MEMORY if there was not enough memory to grow the\r
+* pool.\r
+*\r
+* cl_status_t value returned by optional initialization callback function\r
+* specified by the pfn_initializer parameter passed to the\r
+* cl_pool_init function.\r
+*\r
+* NOTES\r
+* It is not necessary to call cl_pool_grow if the pool is\r
+* configured to grow automatically.\r
+*\r
+* SEE ALSO\r
+* Pool\r
+*********/\r
+\r
+\r
+#ifdef __cplusplus\r
+} /* extern "C" */\r
+#endif /* __cplusplus */\r
+\r
+\r
+#endif /* _CL_POOL_H_ */\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. \r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+/*\r
+ * Abstract:\r
+ * This file contains pointer vector definitions. Pointer Vector provides\r
+ * dynmically resizable array functionality.\r
+ *\r
+ * Environment:\r
+ * All\r
+ */\r
+\r
+\r
+#ifndef _CL_PTR_VECTOR_H_\r
+#define _CL_PTR_VECTOR_H_\r
+\r
+\r
+#include <complib/cl_types.h>\r
+\r
+\r
+/****h* Component Library/Pointer Vector\r
+* NAME\r
+* Pointer Vector\r
+*\r
+* DESCRIPTION\r
+* The Pointer Vector is a self-sizing array of pointers. Like a traditonal\r
+* array, a pointer vector allows efficient constant time access to elements\r
+* with a specified index. A pointer vector grows transparently as the\r
+* user adds elements to the array.\r
+*\r
+* The cl_pointer vector_t structure should be treated as opaque and should be\r
+* manipulated only through the provided functions.\r
+*\r
+* SEE ALSO\r
+* Structures:\r
+* cl_ptr_vector_t\r
+*\r
+* Callbacks:\r
+* cl_pfn_ptr_vec_apply_t, cl_pfn_ptr_vec_find_t\r
+*\r
+* Item Manipulation:\r
+* cl_ptr_vector_set_obj, cl_ptr_vector_obj\r
+*\r
+* Initialization:\r
+* cl_ptr_vector_construct, cl_ptr_vector_init, cl_ptr_vector_destroy\r
+*\r
+* Manipulation:\r
+* cl_ptr_vector_get_capacity, cl_ptr_vector_set_capacity,\r
+* cl_ptr_vector_get_size, cl_ptr_vector_set_size, cl_ptr_vector_set_min_size\r
+* cl_ptr_vector_get_ptr, cl_ptr_vector_get, cl_ptr_vector_at, cl_ptr_vector_set\r
+*\r
+* Search:\r
+* cl_ptr_vector_find_from_start, cl_ptr_vector_find_from_end\r
+* cl_ptr_vector_apply_func\r
+*********/\r
+\r
+\r
+/****d* Component Library: Pointer Vector/cl_pfn_ptr_vec_apply_t\r
+* NAME\r
+* cl_pfn_ptr_vec_apply_t\r
+*\r
+* DESCRIPTION\r
+* The cl_pfn_ptr_vec_apply_t function type defines the prototype for\r
+* functions used to iterate elements in a pointer vector.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef void\r
+(CL_API *cl_pfn_ptr_vec_apply_t)(\r
+ IN const size_t index,\r
+ IN void* const element,\r
+ IN void* context );\r
+/*\r
+* PARAMETERS\r
+* index\r
+* [in] Index of the element.\r
+*\r
+* p_element\r
+* [in] Pointer to an element at the specified index in the pointer vector.\r
+*\r
+* context\r
+* [in] Context provided in a call to cl_ptr_vector_apply_func.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* This function type is provided as function prototype reference for\r
+* the function passed by users as a parameter to the cl_ptr_vector_apply_func\r
+* function.\r
+*\r
+* SEE ALSO\r
+* Pointer Vector, cl_ptr_vector_apply_func\r
+*********/\r
+\r
+\r
+/****d* Component Library: Pointer Vector/cl_pfn_ptr_vec_find_t\r
+* NAME\r
+* cl_pfn_ptr_vec_find_t\r
+*\r
+* DESCRIPTION\r
+* The cl_pfn_ptr_vec_find_t function type defines the prototype for\r
+* functions used to find elements in a pointer vector.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef cl_status_t\r
+(CL_API *cl_pfn_ptr_vec_find_t)(\r
+ IN const size_t index,\r
+ IN const void* const element,\r
+ IN void* context );\r
+/*\r
+* PARAMETERS\r
+* index\r
+* [in] Index of the element.\r
+*\r
+* p_element\r
+* [in] Pointer to an element at the specified index in the\r
+* pointer vector.\r
+*\r
+* context\r
+* [in] Context provided in a call to cl_ptr_vector_find_from_start or\r
+* cl_ptr_vector_find_from_end.\r
+*\r
+* RETURN VALUES\r
+* Return CL_SUCCESS if the element was found. This stops pointer vector\r
+* iteration.\r
+*\r
+* CL_NOT_FOUND to continue the pointer vector iteration.\r
+*\r
+* NOTES\r
+* This function type is provided as function prototype reference for the\r
+* function provided by users as a parameter to the\r
+* cl_ptr_vector_find_from_start and cl_ptr_vector_find_from_end functions.\r
+*\r
+* SEE ALSO\r
+* Pointer Vector, cl_ptr_vector_find_from_start, cl_ptr_vector_find_from_end\r
+*********/\r
+\r
+\r
+/****s* Component Library: Pointer Vector/cl_ptr_vector_t\r
+* NAME\r
+* cl_ptr_vector_t\r
+*\r
+* DESCRIPTION\r
+* Pointer Vector structure.\r
+*\r
+* The cl_ptr_vector_t structure should be treated as opaque and should be\r
+* manipulated only through the provided functions.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _cl_ptr_vector\r
+{\r
+ size_t size;\r
+ size_t grow_size;\r
+ size_t capacity;\r
+ const void **p_ptr_array;\r
+ cl_state_t state;\r
+\r
+} cl_ptr_vector_t;\r
+/*\r
+* FIELDS\r
+* size\r
+* Number of elements successfully initialized in the pointer vector.\r
+*\r
+* grow_size\r
+* Number of elements to allocate when growing.\r
+*\r
+* capacity\r
+* total # of elements allocated.\r
+*\r
+* alloc_list\r
+* List of allocations.\r
+*\r
+* p_ptr_array\r
+* Internal array of pointers to elements.\r
+*\r
+* state\r
+* State of the pointer vector.\r
+*\r
+* SEE ALSO\r
+* Pointer Vector\r
+*********/\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif\r
+\r
+\r
+/****f* Component Library: Pointer Vector/cl_ptr_vector_construct\r
+* NAME\r
+* cl_ptr_vector_construct\r
+*\r
+* DESCRIPTION\r
+* The cl_ptr_vector_construct function constructs a pointer vector.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_ptr_vector_construct(\r
+ IN cl_ptr_vector_t* const p_vector );\r
+/*\r
+* PARAMETERS\r
+* p_vector\r
+* [in] Pointer to a cl_ptr_vector_t structure to construct.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* Allows calling cl_ptr_vector_destroy without first calling\r
+* cl_ptr_vector_init.\r
+*\r
+* Calling cl_ptr_vector_construct is a prerequisite to calling any other\r
+* pointer vector function except cl_ptr_vector_init.\r
+*\r
+* SEE ALSO\r
+* Pointer Vector, cl_ptr_vector_init, cl_ptr_vector_destroy\r
+*********/\r
+\r
+\r
+/****f* Component Library: Pointer Vector/cl_ptr_vector_init\r
+* NAME\r
+* cl_ptr_vector_init\r
+*\r
+* DESCRIPTION\r
+* The cl_ptr_vector_init function initializes a pointer vector for use.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_status_t CL_API\r
+cl_ptr_vector_init(\r
+ IN cl_ptr_vector_t* const p_vector,\r
+ IN const size_t min_cap,\r
+ IN const size_t grow_size );\r
+/*\r
+* PARAMETERS\r
+* p_vector\r
+* [in] Pointer to a cl_ptr_vector_t structure to inititalize.\r
+*\r
+* min_cap\r
+* [in] Initial number of elements the vector will support.\r
+* The vector is always initialized with a size of zero.\r
+*\r
+* grow_size\r
+* [in] Number of elements to allocate when incrementally growing\r
+* the pointer vector. A value of zero disables automatic growth.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if the pointer vector was initialized successfully.\r
+*\r
+* CL_INSUFFICIENT_MEMORY if the initialization failed.\r
+*\r
+* SEE ALSO\r
+* Pointer Vector, cl_ptr_vector_construct, cl_ptr_vector_destroy,\r
+* cl_ptr_vector_set, cl_ptr_vector_get, cl_ptr_vector_at\r
+*********/\r
+\r
+\r
+/****f* Component Library: Pointer Vector/cl_ptr_vector_destroy\r
+* NAME\r
+* cl_ptr_vector_destroy\r
+*\r
+* DESCRIPTION\r
+* The cl_ptr_vector_destroy function destroys a pointer vector.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_ptr_vector_destroy(\r
+ IN cl_ptr_vector_t* const p_vector );\r
+/*\r
+* PARAMETERS\r
+* p_vector\r
+* [in] Pointer to a cl_ptr_vector_t structure to destroy.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* cl_ptr_vector_destroy frees all memory allocated for the pointer vector.\r
+*\r
+* This function should only be called after a call to cl_ptr_vector_construct\r
+* or cl_ptr_vector_init.\r
+*\r
+* SEE ALSO\r
+* Pointer Vector, cl_ptr_vector_construct, cl_ptr_vector_init\r
+*********/\r
+\r
+\r
+/****f* Component Library: Pointer Vector/cl_ptr_vector_get_capacity\r
+* NAME\r
+* cl_ptr_vector_get_capacity\r
+*\r
+* DESCRIPTION\r
+* The cl_ptr_vector_get_capacity function returns the capacity of\r
+* a pointer vector.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE size_t CL_API\r
+cl_ptr_vector_get_capacity(\r
+ IN const cl_ptr_vector_t* const p_vector )\r
+{\r
+ CL_ASSERT( p_vector );\r
+ CL_ASSERT( p_vector->state == CL_INITIALIZED );\r
+\r
+ return( p_vector->capacity );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_vector\r
+* [in] Pointer to a cl_ptr_vector_t structure whose capacity to return.\r
+*\r
+* RETURN VALUE\r
+* Capacity, in elements, of the pointer vector.\r
+*\r
+* NOTES\r
+* The capacity is the number of elements that the pointer vector can store,\r
+* and can be greater than the number of elements stored. To get the number\r
+* of elements stored in the pointer vector, use cl_ptr_vector_get_size.\r
+*\r
+* SEE ALSO\r
+* Pointer Vector, cl_ptr_vector_set_capacity, cl_ptr_vector_get_size\r
+*********/\r
+\r
+\r
+/****f* Component Library: Pointer Vector/cl_ptr_vector_get_size\r
+* NAME\r
+* cl_ptr_vector_get_size\r
+*\r
+* DESCRIPTION\r
+* The cl_ptr_vector_get_size function returns the size of a pointer vector.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE size_t CL_API\r
+cl_ptr_vector_get_size(\r
+ IN const cl_ptr_vector_t* const p_vector )\r
+{\r
+ CL_ASSERT( p_vector );\r
+ CL_ASSERT( p_vector->state == CL_UNINITIALIZED ||\r
+ p_vector->state == CL_INITIALIZED );\r
+\r
+ return( p_vector->size );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_vector\r
+* [in] Pointer to a cl_ptr_vector_t structure whose size to return.\r
+*\r
+* RETURN VALUE\r
+* Size, in elements, of the pointer vector.\r
+*\r
+* SEE ALSO\r
+* Pointer Vector, cl_ptr_vector_set_size, cl_ptr_vector_get_capacity\r
+*********/\r
+\r
+\r
+/****f* Component Library: Pointer Vector/cl_ptr_vector_get\r
+* NAME\r
+* cl_ptr_vector_get\r
+*\r
+* DESCRIPTION\r
+* The cl_ptr_vector_get function returns the pointer stored in a\r
+* pointer vector at a specified index.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE void* CL_API\r
+cl_ptr_vector_get(\r
+ IN const cl_ptr_vector_t* const p_vector,\r
+ IN const size_t index )\r
+{\r
+ CL_ASSERT( p_vector );\r
+ CL_ASSERT( p_vector->state == CL_INITIALIZED );\r
+ CL_ASSERT( p_vector->size > index );\r
+\r
+ return( (void*)p_vector->p_ptr_array[index] );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_vector\r
+* [in] Pointer to a cl_ptr_vector_t structure from which to get an\r
+* element.\r
+*\r
+* index\r
+* [in] Index of the element.\r
+*\r
+* RETURN VALUE\r
+* Value of the pointer stored at the specified index.\r
+*\r
+* NOTES\r
+* cl_ptr_vector_get provides constant access times regardless of the index.\r
+*\r
+* cl_ptr_vector_get does not perform boundary checking. Callers are\r
+* responsible for providing an index that is within the range of the pointer\r
+* vector.\r
+*\r
+* SEE ALSO\r
+* Pointer Vector, cl_ptr_vector_at, cl_ptr_vector_set, cl_ptr_vector_get_size\r
+*********/\r
+\r
+\r
+/****f* Component Library: Pointer Vector/cl_ptr_vector_at\r
+* NAME\r
+* cl_ptr_vector_at\r
+*\r
+* DESCRIPTION\r
+* The cl_ptr_vector_at function copies an element stored in a pointer\r
+* vector at a specified index, performing boundary checks.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_status_t CL_API\r
+cl_ptr_vector_at(\r
+ IN const cl_ptr_vector_t* const p_vector,\r
+ IN const size_t index,\r
+ OUT void** const p_element );\r
+/*\r
+* PARAMETERS\r
+* p_vector\r
+* [in] Pointer to a cl_ptr_vector_t structure from which to get a copy of\r
+* an element.\r
+*\r
+* index\r
+* [in] Index of the element.\r
+*\r
+* p_element\r
+* [out] Pointer to storage for the pointer element. Contains a copy of\r
+* the desired pointer upon successful completion of the call.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if an element was found at the specified index.\r
+*\r
+* CL_INVALID_SETTING if the index was out of range.\r
+*\r
+* NOTES\r
+* cl_ptr_vector_at provides constant time access regardless of\r
+* the index, and performs boundary checking on the pointer vector.\r
+*\r
+* Upon success, the p_element parameter contains a copy of the\r
+* desired element.\r
+*\r
+* SEE ALSO\r
+* Pointer Vector, cl_ptr_vector_get\r
+*********/\r
+\r
+\r
+/****f* Component Library: Pointer Vector/cl_ptr_vector_set\r
+* NAME\r
+* cl_ptr_vector_set\r
+*\r
+* DESCRIPTION\r
+* The cl_ptr_vector_set function sets the element at the specified index.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_status_t CL_API\r
+cl_ptr_vector_set(\r
+ IN cl_ptr_vector_t* const p_vector,\r
+ IN const size_t index,\r
+ IN const void* const element );\r
+/*\r
+* PARAMETERS\r
+* p_vector\r
+* [in] Pointer to a cl_ptr_vector_t structure into which to store\r
+* an element.\r
+*\r
+* index\r
+* [in] Index of the element.\r
+*\r
+* element\r
+* [in] Pointer to store in the pointer vector.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if the element was successfully set.\r
+*\r
+* CL_INSUFFICIENT_MEMORY if the pointer vector could not be resized to\r
+* accommodate the new element.\r
+*\r
+* NOTES\r
+* cl_ptr_vector_set grows the pointer vector as needed to accommodate\r
+* the new element, unless the grow_size parameter passed into the\r
+* cl_ptr_vector_init function was zero.\r
+*\r
+* SEE ALSO\r
+* Pointer Vector, cl_ptr_vector_get\r
+*********/\r
+\r
+\r
+/****f* Component Library: Pointer Vector/cl_ptr_vector_insert\r
+* NAME\r
+* cl_ptr_vector_insert\r
+*\r
+* DESCRIPTION\r
+* The cl_ptr_vector_insert function inserts an element into a pointer vector.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE cl_status_t CL_API\r
+cl_ptr_vector_insert(\r
+ IN cl_ptr_vector_t* const p_vector,\r
+ IN const void* const element,\r
+ OUT size_t* const p_index OPTIONAL )\r
+{\r
+ cl_status_t status;\r
+\r
+ CL_ASSERT( p_vector );\r
+ CL_ASSERT( p_vector->state == CL_INITIALIZED );\r
+\r
+ status = cl_ptr_vector_set( p_vector, p_vector->size, element );\r
+ if( status == CL_SUCCESS && p_index )\r
+ *p_index = p_vector->size - 1;\r
+\r
+ return( status );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_vector\r
+* [in] Pointer to a cl_ptr_vector_t structure into which to store\r
+* an element.\r
+*\r
+* element\r
+* [in] Pointer to store in the pointer vector.\r
+*\r
+* p_index\r
+* [out] Pointer to the index of the element. Valid only if\r
+* insertion was successful.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if the element was successfully inserted.\r
+*\r
+* CL_INSUFFICIENT_MEMORY if the pointer vector could not be resized to\r
+* accommodate the new element.\r
+*\r
+* NOTES\r
+* cl_ptr_vector_insert places the new element at the end of\r
+* the pointer vector.\r
+*\r
+* cl_ptr_vector_insert grows the pointer vector as needed to accommodate\r
+* the new element, unless the grow_size parameter passed into the\r
+* cl_ptr_vector_init function was zero.\r
+*\r
+* SEE ALSO\r
+* Pointer Vector, cl_ptr_vector_remove, cl_ptr_vector_set\r
+*********/\r
+\r
+\r
+/****f* Component Library: Pointer Vector/cl_ptr_vector_remove\r
+* NAME\r
+* cl_ptr_vector_remove\r
+*\r
+* DESCRIPTION\r
+* The cl_ptr_vector_remove function removes and returns the pointer stored\r
+* in a pointer vector at a specified index. Items beyond the removed item\r
+* are shifted down and the size of the pointer vector is decremented.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void* CL_API\r
+cl_ptr_vector_remove(\r
+ IN cl_ptr_vector_t* const p_vector,\r
+ IN const size_t index );\r
+/*\r
+* PARAMETERS\r
+* p_vector\r
+* [in] Pointer to a cl_ptr_vector_t structure from which to get an\r
+* element.\r
+*\r
+* index\r
+* [in] Index of the element.\r
+*\r
+* RETURN VALUE\r
+* Value of the pointer stored at the specified index.\r
+*\r
+* NOTES\r
+* cl_ptr_vector_get does not perform boundary checking. Callers are\r
+* responsible for providing an index that is within the range of the pointer\r
+* vector.\r
+*\r
+* SEE ALSO\r
+* Pointer Vector, cl_ptr_vector_insert, cl_ptr_vector_get_size\r
+*********/\r
+\r
+\r
+/****f* Component Library: Pointer Vector/cl_ptr_vector_set_capacity\r
+* NAME\r
+* cl_ptr_vector_set_capacity\r
+*\r
+* DESCRIPTION\r
+* The cl_ptr_vector_set_capacity function reserves memory in a\r
+* pointer vector for a specified number of pointers.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_status_t CL_API\r
+cl_ptr_vector_set_capacity(\r
+ IN cl_ptr_vector_t* const p_vector,\r
+ IN const size_t new_capacity );\r
+/*\r
+* PARAMETERS\r
+* p_vector\r
+* [in] Pointer to a cl_ptr_vector_t structure whose capacity to set.\r
+*\r
+* new_capacity\r
+* [in] Total number of elements for which the pointer vector should\r
+* allocate memory.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if the capacity was successfully set.\r
+*\r
+* CL_INSUFFICIENT_MEMORY if there was not enough memory to satisfy the\r
+* operation. The pointer vector is left unchanged.\r
+*\r
+* NOTES\r
+* cl_ptr_vector_set_capacity increases the capacity of the pointer vector.\r
+* It does not change the size of the pointer vector. If the requested\r
+* capacity is less than the current capacity, the pointer vector is left\r
+* unchanged.\r
+*\r
+* SEE ALSO\r
+* Pointer Vector, cl_ptr_vector_get_capacity, cl_ptr_vector_set_size,\r
+* cl_ptr_vector_set_min_size\r
+*********/\r
+\r
+\r
+/****f* Component Library: Pointer Vector/cl_ptr_vector_set_size\r
+* NAME\r
+* cl_ptr_vector_set_size\r
+*\r
+* DESCRIPTION\r
+* The cl_ptr_vector_set_size function resizes a pointer vector, either\r
+* increasing or decreasing its size.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_status_t CL_API\r
+cl_ptr_vector_set_size(\r
+ IN cl_ptr_vector_t* const p_vector,\r
+ IN const size_t size );\r
+/*\r
+* PARAMETERS\r
+* p_vector\r
+* [in] Pointer to a cl_ptr_vector_t structure whose size to set.\r
+*\r
+* size\r
+* [in] Number of elements desired in the pointer vector.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if the size of the pointer vector was set successfully.\r
+*\r
+* CL_INSUFFICIENT_MEMORY if there was not enough memory to complete the\r
+* operation. The pointer vector is left unchanged.\r
+*\r
+* NOTES\r
+* cl_ptr_vector_set_size sets the pointer vector to the specified size.\r
+* If size is smaller than the current size of the pointer vector, the size\r
+* is reduced.\r
+*\r
+* This function can only fail if size is larger than the current capacity.\r
+*\r
+* SEE ALSO\r
+* Pointer Vector, cl_ptr_vector_get_size, cl_ptr_vector_set_min_size,\r
+* cl_ptr_vector_set_capacity\r
+*********/\r
+\r
+\r
+/****f* Component Library: Pointer Vector/cl_ptr_vector_set_min_size\r
+* NAME\r
+* cl_ptr_vector_set_min_size\r
+*\r
+* DESCRIPTION\r
+* The cl_ptr_vector_set_min_size function resizes a pointer vector to a\r
+* specified size if the pointer vector is smaller than the specified size.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_status_t CL_API\r
+cl_ptr_vector_set_min_size(\r
+ IN cl_ptr_vector_t* const p_vector,\r
+ IN const size_t min_size );\r
+/*\r
+* PARAMETERS\r
+* p_vector\r
+* [in] Pointer to a cl_ptr_vector_t structure whose minimum size to set.\r
+*\r
+* min_size\r
+* [in] Minimum number of elements that the pointer vector should contain.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if the pointer vector size is greater than or equal to min_size.\r
+* This could indicate that the pointer vector's capacity was increased to\r
+* min_size or that the pointer vector was already of sufficient size.\r
+*\r
+* CL_INSUFFICIENT_MEMORY if there was not enough memory to resize the\r
+* pointer vector. The pointer vector is left unchanged.\r
+*\r
+* NOTES\r
+* If min_size is smaller than the current size of the pointer vector,\r
+* the pointer vector is unchanged. The pointer vector is unchanged if the\r
+* size could not be changed due to insufficient memory being available to\r
+* perform the operation.\r
+*\r
+* SEE ALSO\r
+* Pointer Vector, cl_ptr_vector_get_size, cl_ptr_vector_set_size,\r
+* cl_ptr_vector_set_capacity\r
+*********/\r
+\r
+\r
+/****f* Component Library: Pointer Vector/cl_ptr_vector_apply_func\r
+* NAME\r
+* cl_ptr_vector_apply_func\r
+*\r
+* DESCRIPTION\r
+* The cl_ptr_vector_apply_func function invokes a specified function for\r
+* every element in a pointer vector.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_ptr_vector_apply_func(\r
+ IN const cl_ptr_vector_t* const p_vector,\r
+ IN cl_pfn_ptr_vec_apply_t pfn_callback,\r
+ IN const void* const context );\r
+/*\r
+* PARAMETERS\r
+* p_vector\r
+* [in] Pointer to a cl_ptr_vector_t structure whose elements to iterate.\r
+*\r
+* pfn_callback\r
+* [in] Function invoked for every element in the array.\r
+* See the cl_pfn_ptr_vec_apply_t function type declaration for details\r
+* about the callback function.\r
+*\r
+* context\r
+* [in] Value to pass to the callback function.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* cl_ptr_vector_apply_func invokes the specified function for every element\r
+* in the pointer vector, starting from the beginning of the pointer vector.\r
+*\r
+* SEE ALSO\r
+* Pointer Vector, cl_ptr_vector_find_from_start, cl_ptr_vector_find_from_end,\r
+* cl_pfn_ptr_vec_apply_t\r
+*********/\r
+\r
+\r
+/****f* Component Library: Pointer Vector/cl_ptr_vector_find_from_start\r
+* NAME\r
+* cl_ptr_vector_find_from_start\r
+*\r
+* DESCRIPTION\r
+* The cl_ptr_vector_find_from_start function uses a specified function to\r
+* search for elements in a pointer vector starting from the lowest index.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT size_t CL_API\r
+cl_ptr_vector_find_from_start(\r
+ IN const cl_ptr_vector_t* const p_vector,\r
+ IN cl_pfn_ptr_vec_find_t pfn_callback,\r
+ IN const void* const context );\r
+/*\r
+* PARAMETERS\r
+* p_vector\r
+* [in] Pointer to a cl_ptr_vector_t structure to inititalize.\r
+*\r
+* pfn_callback\r
+* [in] Function invoked to determine if a match was found.\r
+* See the cl_pfn_ptr_vec_find_t function type declaration for details\r
+* about the callback function.\r
+*\r
+* context\r
+* [in] Value to pass to the callback function.\r
+*\r
+* RETURN VALUES\r
+* Index of the element, if found.\r
+*\r
+* Size of the pointer vector if the element was not found.\r
+*\r
+* NOTES\r
+* cl_ptr_vector_find_from_start does not remove the found element from\r
+* the pointer vector. The index of the element is returned when the function\r
+* provided by the pfn_callback parameter returns CL_SUCCESS.\r
+*\r
+* SEE ALSO\r
+* Pointer Vector, cl_ptr_vector_find_from_end, cl_ptr_vector_apply_func,\r
+* cl_pfn_ptr_vec_find_t\r
+*********/\r
+\r
+\r
+/****f* Component Library: Pointer Vector/cl_ptr_vector_find_from_end\r
+* NAME\r
+* cl_ptr_vector_find_from_end\r
+*\r
+* DESCRIPTION\r
+* The cl_ptr_vector_find_from_end function uses a specified function to\r
+* search for elements in a pointer vector starting from the highest index.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT size_t CL_API\r
+cl_ptr_vector_find_from_end(\r
+ IN const cl_ptr_vector_t* const p_vector,\r
+ IN cl_pfn_ptr_vec_find_t pfn_callback,\r
+ IN const void* const context );\r
+/*\r
+* PARAMETERS\r
+* p_vector\r
+* [in] Pointer to a cl_ptr_vector_t structure to inititalize.\r
+*\r
+* pfn_callback\r
+* [in] Function invoked to determine if a match was found.\r
+* See the cl_pfn_ptr_vec_find_t function type declaration for details\r
+* about the callback function.\r
+*\r
+* context\r
+* [in] Value to pass to the callback function.\r
+*\r
+* RETURN VALUES\r
+* Index of the element, if found.\r
+*\r
+* Size of the pointer vector if the element was not found.\r
+*\r
+* NOTES\r
+* cl_ptr_vector_find_from_end does not remove the found element from\r
+* the pointer vector. The index of the element is returned when the function\r
+* provided by the pfn_callback parameter returns CL_SUCCESS.\r
+*\r
+* SEE ALSO\r
+* Pointer Vector, cl_ptr_vector_find_from_start, cl_ptr_vector_apply_func,\r
+* cl_pfn_ptr_vec_find_t\r
+*********/\r
+\r
+\r
+#ifdef __cplusplus\r
+} /* extern "C" */\r
+#endif\r
+\r
+\r
+#endif /* _CL_PTR_VECTOR_H_ */\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. \r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+/*\r
+ * Abstract:\r
+ * Declaration of the quick composite pool. The quick composite pool\r
+ * manages a pool of composite objects. A composite object is an object\r
+ * that is made of multiple sub objects.\r
+ * It can grow to meet demand, limited only by system memory.\r
+ *\r
+ * Environment:\r
+ * All\r
+ */\r
+\r
+\r
+#ifndef _CL_QUICK_COMPOSITE_POOL_H_\r
+#define _CL_QUICK_COMPOSITE_POOL_H_\r
+\r
+\r
+#include <complib/cl_types.h>\r
+#include <complib/cl_qlist.h>\r
+\r
+\r
+/****h* Component Library/Quick Composite Pool\r
+* NAME\r
+* Quick Composite Pool\r
+*\r
+* DESCRIPTION\r
+* The Quick Composite Pool provides a self-contained and self-sustaining\r
+* pool of user defined composite objects.\r
+*\r
+* A composite object is an object that is composed of one or more\r
+* sub-objects, each of which needs to be treated separately for\r
+* initialization. Objects can be retrieved from the pool as long as there\r
+* is memory in the system.\r
+*\r
+* To aid in object oriented design, the Quick Composite Pool provides users\r
+* the ability to specify callbacks that are invoked for each object for\r
+* construction, initialization, and destruction. Constructor and destructor\r
+* callback functions may not fail.\r
+*\r
+* A Quick Composite Pool does not return memory to the system as the user\r
+* returns objects to the pool. The only method of returning memory to the\r
+* system is to destroy the pool.\r
+*\r
+* The Quick Composite Pool operates on cl_pool_item_t structures that\r
+* describe composite objects. This provides for more efficient memory use.\r
+* If using a cl_pool_item_t is not desired, the Composite Pool provides\r
+* similar functionality but operates on opaque objects.\r
+*\r
+* The Quick Composit Pool functions operate on a cl_qcpool_t structure\r
+* which should be treated as opaque and should be manipulated only through\r
+* the provided functions.\r
+*\r
+* SEE ALSO\r
+* Structures:\r
+* cl_qcpool_t, cl_pool_item_t\r
+*\r
+* Callbacks:\r
+* cl_pfn_qcpool_init_t, cl_pfn_qcpool_dtor_t\r
+*\r
+* Initialization/Destruction:\r
+* cl_qcpool_construct, cl_qcpool_init, cl_qcpool_destroy\r
+*\r
+* Manipulation:\r
+* cl_qcpool_get, cl_qcpool_put, cl_qcpool_put_list, cl_qcpool_grow\r
+*\r
+* Attributes:\r
+* cl_is_qcpool_inited, cl_qcpool_count\r
+*********/\r
+\r
+\r
+/****s* Component Library: Quick Composite Pool/cl_pool_item_t\r
+* NAME\r
+* cl_pool_item_t\r
+*\r
+* DESCRIPTION\r
+* The cl_pool_item_t structure is used by pools to store objects.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _cl_pool_item\r
+{\r
+ cl_list_item_t list_item;\r
+#ifdef _DEBUG_\r
+ /* Pad to make the cl_pool_obj structure line up properly */\r
+ void *pad;\r
+ /* Pointer to the owner pool used for sanity checks. */\r
+ struct _cl_qcpool *p_pool;\r
+#endif\r
+\r
+} cl_pool_item_t;\r
+/*\r
+* FIELDS\r
+* list_item\r
+* Used internally by the pool. Users should not use this field.\r
+*\r
+* p_pool\r
+* Used internally by the pool in debug builds to check for consistency.\r
+*\r
+* NOTES\r
+* The pool item structure is defined in such a way as to safely allow\r
+* users to cast from a pool item to a list item for storing items\r
+* retrieved from a quick pool in a quick list.\r
+*\r
+* SEE ALSO\r
+* Quick Composite Pool, cl_list_item_t\r
+*********/\r
+\r
+\r
+/****i* Component Library: Quick List/cl_pool_obj_t\r
+* NAME\r
+* cl_pool_obj_t\r
+*\r
+* DESCRIPTION\r
+* The cl_pool_obj_t structure is used by pools to store objects.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _cl_pool_obj\r
+{\r
+ /* The pool item must be the first item to allow casting. */\r
+ cl_list_obj_t list_obj;\r
+#ifdef _DEBUG_\r
+ /* Pointer to the owner pool used for sanity checks. */\r
+ struct _cl_qcpool *p_pool;\r
+#endif\r
+\r
+} cl_pool_obj_t;\r
+/*\r
+* FIELDS\r
+* pool_item\r
+* Used internally by the pool. Users should not use this field.\r
+*\r
+* p_object\r
+* Pointer to the user's object being stored in the pool.\r
+*\r
+* NOTES\r
+* The pool object structure is used by non-quick pools to store object.\r
+*\r
+* SEE ALSO\r
+* cl_pool_item_t\r
+*********/\r
+\r
+\r
+/****d* Component Library: Quick Composite Pool/cl_pfn_qcpool_init_t\r
+* NAME\r
+* cl_pfn_qcpool_init_t\r
+*\r
+* DESCRIPTION\r
+* The cl_pfn_qcpool_init_t function type defines the prototype for\r
+* functions used as initializer for objects being allocated by a\r
+* quick composite pool.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef cl_status_t\r
+(CL_API *cl_pfn_qcpool_init_t)(\r
+ IN void** const p_comp_array,\r
+ IN const uint32_t num_components,\r
+ IN void* context,\r
+ OUT cl_pool_item_t** const pp_pool_item );\r
+/*\r
+* PARAMETERS\r
+* p_comp_array\r
+* [in] Pointer to the first entry in an array of pointers, each of\r
+* which points to a component that makes up a composite object.\r
+*\r
+* num_components\r
+* [in] Number of components that in the component array.\r
+*\r
+* context\r
+* [in] Context provided in a call to cl_qcpool_init.\r
+*\r
+* pp_pool_item\r
+* [out] Users should set this pointer to reference the cl_pool_item_t\r
+* structure that represents the composite object. This pointer must\r
+* not be NULL if the function returns CL_SUCCESS.\r
+*\r
+* RETURN VALUE\r
+* Return CL_SUCCESS to indicate that initialization of the object\r
+* was successful and that initialization of further objects may continue.\r
+*\r
+* Other cl_status_t values will be returned by cl_qcpool_init\r
+* and cl_qcpool_grow.\r
+*\r
+* NOTES\r
+* This function type is provided as function prototype reference for\r
+* the function provided by the user as a parameter to the\r
+* cl_qcpool_init function.\r
+*\r
+* The initializer is invoked once per allocated object, allowing the user\r
+* to chain components to form a composite object and perform any necessary\r
+* initialization. Returning a status other than CL_SUCCESS aborts a grow\r
+* operation, initiated either through cl_qcpool_init or cl_qcpool_grow,\r
+* and causes the initiating function to fail. Any non-CL_SUCCESS status\r
+* will be returned by the function that initiated the grow operation.\r
+*\r
+* All memory for the requested number of components is pre-allocated. Users\r
+* should include space in one of their components for the cl_pool_item_t\r
+* structure that will represent the composite object to avoid having to\r
+* allocate that structure in the initialization callback. Alternatively,\r
+* users may specify an additional component for the cl_pool_item_t structure.\r
+*\r
+* When later performing a cl_qcpool_get call, the return value is a pointer\r
+* to the cl_pool_item_t returned by this function in the pp_pool_item\r
+* parameter. Users must set pp_pool_item to a valid pointer to the\r
+* cl_pool_item_t representing the object if they return CL_SUCCESS.\r
+*\r
+* SEE ALSO\r
+* Quick Composite Pool, cl_qcpool_init\r
+*********/\r
+\r
+\r
+/****d* Component Library: Quick Composite Pool/cl_pfn_qcpool_dtor_t\r
+* NAME\r
+* cl_pfn_qcpool_dtor_t\r
+*\r
+* DESCRIPTION\r
+* The cl_pfn_qcpool_dtor_t function type defines the prototype for\r
+* functions used as destructor for objects being deallocated by a\r
+* quick composite pool.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef void\r
+(CL_API *cl_pfn_qcpool_dtor_t)(\r
+ IN const cl_pool_item_t* const p_pool_item,\r
+ IN void* context );\r
+/*\r
+* PARAMETERS\r
+* p_pool_item\r
+* [in] Pointer to a cl_pool_item_t structure representing an object.\r
+*\r
+* context\r
+* [in] Context provided in a call to cl_qcpool_init.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* This function type is provided as function prototype reference for\r
+* the function provided by the user as an optional parameter to the\r
+* cl_qcpool_init function.\r
+*\r
+* The destructor is invoked once per allocated object, allowing the user\r
+* to perform any necessary cleanup. Users should not attempt to deallocate\r
+* the memory for the composite object, as the quick composite pool manages\r
+* object allocation and deallocation.\r
+*\r
+* SEE ALSO\r
+* Quick Composite Pool, cl_qcpool_init\r
+*********/\r
+\r
+\r
+/****s* Component Library: Quick Composite Pool/cl_qcpool_t\r
+* NAME\r
+* cl_qcpool_t\r
+*\r
+* DESCRIPTION\r
+* Quick composite pool structure.\r
+*\r
+* The cl_qcpool_t structure should be treated as opaque and should be\r
+* manipulated only through the provided functions.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _cl_qcpool\r
+{\r
+ uint32_t num_components;\r
+ size_t *component_sizes;\r
+ void **p_components;\r
+ size_t num_objects;\r
+ size_t max_objects;\r
+ size_t grow_size;\r
+ cl_pfn_qcpool_init_t pfn_init;\r
+ cl_pfn_qcpool_dtor_t pfn_dtor;\r
+ const void *context;\r
+ cl_qlist_t free_list;\r
+ cl_qlist_t alloc_list;\r
+ cl_state_t state;\r
+\r
+} cl_qcpool_t;\r
+/*\r
+* FIELDS\r
+* num_components\r
+* Number of components per object.\r
+*\r
+* component_sizes\r
+* Array of sizes, one for each component.\r
+*\r
+* p_components\r
+* Array of pointers to components, used for the constructor callback.\r
+*\r
+* num_objects\r
+* Number of objects managed by the pool\r
+*\r
+* grow_size\r
+* Number of objects to add when automatically growing the pool.\r
+*\r
+* pfn_init\r
+* Pointer to the user's initializer callback to invoke when initializing\r
+* new objects.\r
+*\r
+* pfn_dtor\r
+* Pointer to the user's destructor callback to invoke before deallocating\r
+* memory allocated for objects.\r
+*\r
+* context\r
+* User's provided context for callback functions, used by the pool\r
+* when invoking callbacks.\r
+*\r
+* free_list\r
+* Quick list of objects available.\r
+*\r
+* alloc_list\r
+* Quick list used to store information about allocations.\r
+*\r
+* state\r
+* State of the pool.\r
+*\r
+* SEE ALSO\r
+* Quick Composite Pool\r
+*********/\r
+\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif /* __cplusplus */\r
+\r
+\r
+/****f* Component Library: Quick Composite Pool/cl_qcpool_construct\r
+* NAME\r
+* cl_qcpool_construct\r
+*\r
+* DESCRIPTION\r
+* The cl_qcpool_construct function constructs a quick composite pool.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_qcpool_construct(\r
+ IN cl_qcpool_t* const p_pool );\r
+/*\r
+* PARAMETERS\r
+* p_pool\r
+* [in] Pointer to a cl_qcpool_t structure whose state to initialize.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* Allows calling cl_qcpool_init, cl_qcpool_destroy, cl_is_qcpool_inited.\r
+*\r
+* Calling cl_qcpool_construct is a prerequisite to calling any other\r
+* quick composite pool function except cl_qcpool_init.\r
+*\r
+* SEE ALSO\r
+* Quick Composite Pool, cl_qcpool_init, cl_qcpool_destroy,\r
+* cl_is_qcpool_inited\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick Composite Pool/cl_is_qcpool_inited\r
+* NAME\r
+* cl_is_qcpool_inited\r
+*\r
+* DESCRIPTION\r
+* The cl_is_qcpool_inited function returns whether a quick composite pool was\r
+* successfully initialized.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE uint32_t CL_API\r
+cl_is_qcpool_inited(\r
+ IN const cl_qcpool_t* const p_pool )\r
+{\r
+ /* CL_ASSERT that a non-null pointer is provided. */\r
+ CL_ASSERT( p_pool );\r
+ /* CL_ASSERT that the pool is not in some invalid state. */\r
+ CL_ASSERT( cl_is_state_valid( p_pool->state ) );\r
+\r
+ return( p_pool->state == CL_INITIALIZED );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_pool\r
+* [in] Pointer to a cl_qcpool_t structure to check.\r
+*\r
+* RETURN VALUES\r
+* TRUE if the quick composite pool was initialized successfully.\r
+*\r
+* FALSE otherwise.\r
+*\r
+* NOTES\r
+* Allows checking the state of a quick composite pool to determine if\r
+* invoking member functions is appropriate.\r
+*\r
+* SEE ALSO\r
+* Quick Composite Pool\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick Composite Pool/cl_qcpool_init\r
+* NAME\r
+* cl_qcpool_init\r
+*\r
+* DESCRIPTION\r
+* The cl_qcpool_init function initializes a quick composite pool for use.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_status_t CL_API\r
+cl_qcpool_init(\r
+ IN cl_qcpool_t* const p_pool,\r
+ IN const size_t min_size,\r
+ IN const size_t max_size,\r
+ IN const size_t grow_size,\r
+ IN const size_t* const component_sizes,\r
+ IN const uint32_t num_components,\r
+ IN cl_pfn_qcpool_init_t pfn_initializer OPTIONAL,\r
+ IN cl_pfn_qcpool_dtor_t pfn_destructor OPTIONAL,\r
+ IN const void* const context );\r
+/*\r
+* PARAMETERS\r
+* p_pool\r
+* [in] Pointer to a cl_qcpool_t structure to initialize.\r
+*\r
+* min_size\r
+* [in] Minimum number of objects that the pool should support. All\r
+* necessary allocations to allow storing the minimum number of items\r
+* are performed at initialization time, and all necessary callbacks\r
+* successfully invoked.\r
+*\r
+* max_size\r
+* [in] Maximum number of objects to which the pool is allowed to grow.\r
+* A value of zero specifies no maximum.\r
+*\r
+* grow_size\r
+* [in] Number of objects to allocate when incrementally growing the pool.\r
+* A value of zero disables automatic growth.\r
+*\r
+* component_sizes\r
+* [in] Pointer to the first entry in an array of sizes describing,\r
+* in order, the sizes of the components that make up a composite object.\r
+*\r
+* num_components\r
+* [in] Number of components that make up a composite object.\r
+*\r
+* pfn_initializer\r
+* [in] Initializer callback to invoke for every new object when growing\r
+* the pool. This parameter may be NULL only if the objects stored in\r
+* the quick composite pool consist of only one component. If NULL, the\r
+* pool assumes the cl_pool_item_t structure describing objects is\r
+* located at the head of each object. See the cl_pfn_qcpool_init_t\r
+* function type declaration for details about the callback function.\r
+*\r
+* pfn_destructor\r
+* [in] Destructor callback to invoke for every object before memory for\r
+* that object is freed. This parameter is optional and may be NULL.\r
+* See the cl_pfn_qcpool_dtor_t function type declaration for details\r
+* about the callback function.\r
+*\r
+* context\r
+* [in] Value to pass to the callback functions to provide context.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if the quick composite pool was initialized successfully.\r
+*\r
+* CL_INSUFFICIENT_MEMORY if there was not enough memory to initialize the\r
+* quick composite pool.\r
+*\r
+* CL_INVALID_SETTING if a NULL constructor was provided for composite objects\r
+* consisting of more than one component. Also returns CL_INVALID_SETTING if\r
+* the maximum size is non-zero and less than the minimum size.\r
+*\r
+* Other cl_status_t value returned by optional initialization callback function\r
+* specified by the pfn_initializer parameter.\r
+*\r
+* If initialization fails, the pool is left in a destroyed state. Callers\r
+* may still safely call cl_qcpool_destroy.\r
+*\r
+* NOTES\r
+* cl_qcpool_init initializes, and if necessary, grows the pool to\r
+* the capacity desired.\r
+*\r
+* SEE ALSO\r
+* Quick Composite Pool, cl_qcpool_construct, cl_qcpool_destroy,\r
+* cl_qcpool_get, cl_qcpool_put, cl_qcpool_grow,\r
+* cl_qcpool_count, cl_pfn_qcpool_init_t, cl_pfn_qcpool_dtor_t\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick Composite Pool/cl_qcpool_destroy\r
+* NAME\r
+* cl_qcpool_destroy\r
+*\r
+* DESCRIPTION\r
+* The cl_qcpool_destroy function destroys a quick composite pool.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_qcpool_destroy(\r
+ IN cl_qcpool_t* const p_pool );\r
+/*\r
+* PARAMETERS\r
+* p_pool\r
+* [in] Pointer to a cl_qcpool_t structure to destroy.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* All memory allocated for composite objects is freed. The destructor\r
+* callback, if any, will be invoked for every allocated object. Further\r
+* operations on the composite pool should not be attempted after\r
+* cl_qcpool_destroy is invoked.\r
+*\r
+* This function should only be called after a call to\r
+* cl_qcpool_construct or cl_qcpool_init.\r
+*\r
+* In a debug build, cl_qcpool_destroy asserts that all objects are in\r
+* the pool.\r
+*\r
+* SEE ALSO\r
+* Quick Composite Pool, cl_qcpool_construct, cl_qcpool_init\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick Composite Pool/cl_qcpool_count\r
+* NAME\r
+* cl_qcpool_count\r
+*\r
+* DESCRIPTION\r
+* The cl_qcpool_count function returns the number of available objects\r
+* in a quick composite pool.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE size_t CL_API\r
+cl_qcpool_count(\r
+ IN cl_qcpool_t* const p_pool )\r
+{\r
+ CL_ASSERT( p_pool );\r
+ CL_ASSERT( p_pool->state == CL_INITIALIZED );\r
+\r
+ return( cl_qlist_count( &p_pool->free_list ) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_pool\r
+* [in] Pointer to a cl_qcpool_t structure for which the number of\r
+* available objects is requested.\r
+*\r
+* RETURN VALUE\r
+* Returns the number of objects available in the specified\r
+* quick composite pool.\r
+*\r
+* SEE ALSO\r
+* Quick Composite Pool\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick Composite Pool/cl_qcpool_get\r
+* NAME\r
+* cl_qcpool_get\r
+*\r
+* DESCRIPTION\r
+* The cl_qcpool_get function retrieves an object from a\r
+* quick composite pool.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_pool_item_t* CL_API\r
+cl_qcpool_get(\r
+ IN cl_qcpool_t* const p_pool );\r
+/*\r
+* PARAMETERS\r
+* p_pool\r
+* [in] Pointer to a cl_qcpool_t structure from which to retrieve\r
+* an object.\r
+*\r
+* RETURN VALUES\r
+* Returns a pointer to a cl_pool_item_t for a composite object.\r
+*\r
+* Returns NULL if the pool is empty and can not be grown automatically.\r
+*\r
+* NOTES\r
+* cl_qcpool_get returns the object at the head of the pool. If the pool is\r
+* empty, it is automatically grown to accommodate this request unless the\r
+* grow_size parameter passed to the cl_qcpool_init function was zero.\r
+*\r
+* SEE ALSO\r
+* Quick Composite Pool, cl_qcpool_get_tail, cl_qcpool_put,\r
+* cl_qcpool_grow, cl_qcpool_count\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick Composite Pool/cl_qcpool_put\r
+* NAME\r
+* cl_qcpool_put\r
+*\r
+* DESCRIPTION\r
+* The cl_qcpool_put function returns an object to a quick composite pool.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE void CL_API\r
+cl_qcpool_put(\r
+ IN cl_qcpool_t* const p_pool,\r
+ IN cl_pool_item_t* const p_pool_item )\r
+{\r
+ CL_ASSERT( p_pool );\r
+ CL_ASSERT( p_pool->state == CL_INITIALIZED );\r
+ CL_ASSERT( p_pool_item );\r
+ /* Make sure items being returned came from the specified pool. */\r
+ CL_ASSERT( p_pool_item->p_pool == p_pool );\r
+\r
+ /* return this lil' doggy to the pool */\r
+ cl_qlist_insert_head( &p_pool->free_list, &p_pool_item->list_item );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_pool\r
+* [in] Pointer to a cl_qcpool_t structure to which to return\r
+* an object.\r
+*\r
+* p_pool_item\r
+* [in] Pointer to a cl_pool_item_t structure for the object\r
+* being returned.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* cl_qcpool_put places the returned object at the head of the pool.\r
+*\r
+* The object specified by the p_pool_item parameter must have been\r
+* retrieved from the pool by a previous call to cl_qcpool_get.\r
+*\r
+* SEE ALSO\r
+* Quick Composite Pool, cl_qcpool_put_tail, cl_qcpool_get\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick Composite Pool/cl_qcpool_put_list\r
+* NAME\r
+* cl_qcpool_put_list\r
+*\r
+* DESCRIPTION\r
+* The cl_qcpool_put_list function returns a list of objects to the head of\r
+* a quick composite pool.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE void CL_API\r
+cl_qcpool_put_list(\r
+ IN cl_qcpool_t* const p_pool,\r
+ IN cl_qlist_t* const p_list )\r
+{\r
+#ifdef _DEBUG_\r
+ cl_list_item_t *p_item;\r
+#endif\r
+\r
+ CL_ASSERT( p_pool );\r
+ CL_ASSERT( p_pool->state == CL_INITIALIZED );\r
+ CL_ASSERT( p_list );\r
+\r
+#ifdef _DEBUG_\r
+ /* Chech that all items in the list came from this pool. */\r
+ p_item = cl_qlist_head( p_list );\r
+ while( p_item != cl_qlist_end( p_list ) )\r
+ {\r
+ CL_ASSERT( ((cl_pool_item_t*)p_item)->p_pool == p_pool );\r
+ p_item = cl_qlist_next( p_item );\r
+ }\r
+#endif\r
+\r
+ /* return these lil' doggies to the pool */\r
+ cl_qlist_insert_list_head( &p_pool->free_list, p_list );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_pool\r
+* [in] Pointer to a cl_qcpool_t structure to which to return\r
+* a list of objects.\r
+*\r
+* p_list\r
+* [in] Pointer to a cl_qlist_t structure for the list of objects\r
+* being returned.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* cl_qcpool_put_list places the returned objects at the head of the pool.\r
+*\r
+* The objects in the list specified by the p_list parameter must have been\r
+* retrieved from the pool by a previous call to cl_qcpool_get.\r
+*\r
+* SEE ALSO\r
+* Quick Composite Pool, cl_qcpool_put, cl_qcpool_put_tail, cl_qcpool_get\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick Composite Pool/cl_qcpool_grow\r
+* NAME\r
+* cl_qcpool_grow\r
+*\r
+* DESCRIPTION\r
+* The cl_qcpool_grow function grows a quick composite pool by\r
+* the specified number of objects.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_status_t CL_API\r
+cl_qcpool_grow(\r
+ IN cl_qcpool_t* const p_pool,\r
+ IN size_t obj_count );\r
+/*\r
+* PARAMETERS\r
+* p_pool\r
+* [in] Pointer to a cl_qcpool_t structure whose capacity to grow.\r
+*\r
+* obj_count\r
+* [in] Number of objects by which to grow the pool.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if the quick composite pool grew successfully.\r
+*\r
+* CL_INSUFFICIENT_MEMORY if there was not enough memory to grow the\r
+* quick composite pool.\r
+*\r
+* cl_status_t value returned by optional initialization callback function\r
+* specified by the pfn_initializer parameter passed to the\r
+* cl_qcpool_init function.\r
+*\r
+* NOTES\r
+* It is not necessary to call cl_qcpool_grow if the pool is\r
+* configured to grow automatically.\r
+*\r
+* SEE ALSO\r
+* Quick Composite Pool\r
+*********/\r
+\r
+\r
+#ifdef __cplusplus\r
+} /* extern "C" */\r
+#endif /* __cplusplus */\r
+\r
+\r
+#endif /* _CL_QUICK_COMPOSITE_POOL_H_ */\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. \r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+/*\r
+ * Abstract:\r
+ * Declaration of quick list.\r
+ *\r
+ * Environment:\r
+ * All\r
+ */\r
+\r
+\r
+#ifndef _CL_QUICK_LIST_H_\r
+#define _CL_QUICK_LIST_H_\r
+\r
+\r
+#include <complib/cl_types.h>\r
+\r
+\r
+/****h* Component Library/Quick List\r
+* NAME\r
+* Quick List\r
+*\r
+* DESCRIPTION\r
+* Quick list implements a doubly linked that stores user provided\r
+* cl_list_item_t structures.\r
+* Quick list does not allocate any memory, and can therefore not fail any\r
+* operations. Quick list can therefore be useful in minimizing the error\r
+* paths in code.\r
+*\r
+* Quick list is not thread safe, and users must provide serialization when\r
+* adding and removing items from the list. Note that it is possible to\r
+* walk a quick list while simultaneously adding to it.\r
+*\r
+* The Quick List functions operate on a cl_qlist_t structure which should be\r
+* treated as opaque and should be manipulated only through the provided\r
+* functions.\r
+*\r
+* SEE ALSO\r
+* Structures:\r
+* cl_qlist_t, cl_list_item_t, cl_list_obj_t\r
+*\r
+* Callbacks:\r
+* cl_pfn_qlist_apply_t, cl_pfn_qlist_find_t\r
+*\r
+* Item Manipulation:\r
+* cl_qlist_set_obj, cl_qlist_obj\r
+*\r
+* Initialization:\r
+* cl_qlist_init\r
+*\r
+* Iteration:\r
+* cl_qlist_next, cl_qlist_prev, cl_qlist_head, cl_qlist_tail,\r
+* cl_qlist_end\r
+*\r
+* Manipulation:\r
+* cl_qlist_insert_head, cl_qlist_insert_tail,\r
+* cl_qlist_insert_list_head, cl_qlist_insert_list_tail,\r
+* cl_qlist_insert_array_head, cl_qlist_insert_array_tail,\r
+* cl_qlist_insert_prev, cl_qlist_insert_next,\r
+* cl_qlist_remove_head, cl_qlist_remove_tail,\r
+* cl_qlist_remove_item, cl_qlist_remove_all\r
+*\r
+* Search:\r
+* cl_is_item_in_qlist, cl_qlist_find_next, cl_qlist_find_prev,\r
+* cl_qlist_find_from_head, cl_qlist_find_from_tail\r
+* cl_qlist_apply_func, cl_qlist_move_items\r
+*\r
+* Attributes:\r
+* cl_qlist_count, cl_is_qlist_empty\r
+*********/\r
+\r
+\r
+/****s* Component Library: Quick List/cl_list_item_t\r
+* NAME\r
+* cl_list_item_t\r
+*\r
+* DESCRIPTION\r
+* The cl_list_item_t structure is used by lists to store objects.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _cl_list_item\r
+{\r
+ struct _cl_list_item *p_next;\r
+ struct _cl_list_item *p_prev;\r
+#ifdef _DEBUG_\r
+ struct _cl_qlist *p_list;\r
+#endif\r
+\r
+} cl_list_item_t;\r
+/*\r
+* FIELDS\r
+* p_next\r
+* Used internally by the list. Users should not use this field.\r
+*\r
+* p_prev\r
+* Used internally by the list. Users should not use this field.\r
+*\r
+* SEE ALSO\r
+* Quick List\r
+*********/\r
+\r
+\r
+/****s* Component Library: Quick List/cl_list_obj_t\r
+* NAME\r
+* cl_list_obj_t\r
+*\r
+* DESCRIPTION\r
+* The cl_list_obj_t structure is used by lists to store objects.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _cl_list_obj\r
+{\r
+ cl_list_item_t list_item;\r
+ const void *p_object; /* User's context */\r
+\r
+} cl_list_obj_t;\r
+/*\r
+* FIELDS\r
+* list_item\r
+* Used internally by the list. Users should not use this field.\r
+*\r
+* p_object\r
+* User defined context. Users should not access this field directly.\r
+* Use cl_qlist_set_obj and cl_qlist_obj to set and retrieve the value\r
+* of this field.\r
+*\r
+* NOTES\r
+* Users can use the cl_qlist_set_obj and cl_qlist_obj functions to store\r
+* and retrieve context information in the list item.\r
+*\r
+* SEE ALSO\r
+* Quick List, cl_qlist_set_obj, cl_qlist_obj, cl_list_item_t\r
+*********/\r
+\r
+\r
+/****s* Component Library: Quick List/cl_qlist_t\r
+* NAME\r
+* cl_qlist_t\r
+*\r
+* DESCRIPTION\r
+* Quick list structure.\r
+*\r
+* The cl_qlist_t structure should be treated as opaque and should be\r
+* manipulated only through the provided functions.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _cl_qlist\r
+{\r
+ cl_list_item_t end;\r
+ size_t count;\r
+ cl_state_t state;\r
+\r
+} cl_qlist_t;\r
+/*\r
+* FIELDS\r
+* end\r
+* List item used to mark the end of the list.\r
+*\r
+* count\r
+* Number of items in the list.\r
+*\r
+* state\r
+* State of the quick list.\r
+*\r
+* SEE ALSO\r
+* Quick List\r
+*********/\r
+\r
+\r
+/****d* Component Library: Quick List/cl_pfn_qlist_apply_t\r
+* NAME\r
+* cl_pfn_qlist_apply_t\r
+*\r
+* DESCRIPTION\r
+* The cl_pfn_qlist_apply_t function type defines the prototype for functions\r
+* used to iterate items in a quick list.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef void\r
+(CL_API *cl_pfn_qlist_apply_t)(\r
+ IN cl_list_item_t* const p_list_item,\r
+ IN void* context );\r
+/*\r
+* PARAMETERS\r
+* p_list_item\r
+* [in] Pointer to a cl_list_item_t structure.\r
+*\r
+* context\r
+* [in] Value passed to the callback function.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* This function type is provided as function prototype reference for the\r
+* function provided by users as a parameter to the cl_qlist_apply_func\r
+* function.\r
+*\r
+* SEE ALSO\r
+* Quick List, cl_qlist_apply_func\r
+*********/\r
+\r
+\r
+/****d* Component Library: Quick List/cl_pfn_qlist_find_t\r
+* NAME\r
+* cl_pfn_qlist_find_t\r
+*\r
+* DESCRIPTION\r
+* The cl_pfn_qlist_find_t function type defines the prototype for functions\r
+* used to find items in a quick list.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef cl_status_t\r
+(CL_API *cl_pfn_qlist_find_t)(\r
+ IN const cl_list_item_t* const p_list_item,\r
+ IN void* context );\r
+/*\r
+* PARAMETERS\r
+* p_list_item\r
+* [in] Pointer to a cl_list_item_t.\r
+*\r
+* context\r
+* [in] Value passed to the callback function.\r
+*\r
+* RETURN VALUES\r
+* Return CL_SUCCESS if the desired item was found. This stops list iteration.\r
+*\r
+* Return CL_NOT_FOUND to continue list iteration.\r
+*\r
+* NOTES\r
+* This function type is provided as function prototype reference for the\r
+* function provided by users as a parameter to the cl_qlist_find_from_head,\r
+* cl_qlist_find_from_tail, cl_qlist_find_next, and cl_qlist_find_prev\r
+* functions.\r
+*\r
+* SEE ALSO\r
+* Quick List, cl_qlist_find_from_head, cl_qlist_find_from_tail,\r
+* cl_qlist_find_next, cl_qlist_find_prev\r
+*********/\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif\r
+\r
+\r
+/****i* Component Library: Quick List/__cl_primitive_insert\r
+* NAME\r
+* __cl_primitive_insert\r
+*\r
+* DESCRIPTION\r
+* Add a new item in front of the specified item. This is a low level\r
+* function for use internally by the queuing routines.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE void CL_API\r
+__cl_primitive_insert(\r
+ IN cl_list_item_t* const p_list_item,\r
+ IN cl_list_item_t* const p_new_item )\r
+{\r
+ /* CL_ASSERT that a non-null pointer is provided. */\r
+ CL_ASSERT( p_list_item );\r
+ /* CL_ASSERT that a non-null pointer is provided. */\r
+ CL_ASSERT( p_new_item );\r
+\r
+ p_new_item->p_next = p_list_item;\r
+ p_new_item->p_prev = p_list_item->p_prev;\r
+ p_list_item->p_prev = p_new_item;\r
+ p_new_item->p_prev->p_next = p_new_item;\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_list_item\r
+* [in] Pointer to cl_list_item_t to insert in front of\r
+*\r
+* p_new_item\r
+* [in] Pointer to cl_list_item_t to add\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*********/\r
+\r
+\r
+/****i* Component Library: Quick List/__cl_primitive_remove\r
+* NAME\r
+* __cl_primitive_remove\r
+*\r
+* DESCRIPTION\r
+* Remove an item from a list. This is a low level routine\r
+* for use internally by the queuing routines.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE void CL_API\r
+__cl_primitive_remove(\r
+ IN cl_list_item_t* const p_list_item )\r
+{\r
+ /* CL_ASSERT that a non-null pointer is provided. */\r
+ CL_ASSERT( p_list_item );\r
+ CL_ASSERT( p_list_item->p_next );\r
+ CL_ASSERT( p_list_item->p_prev );\r
+\r
+ /* set the back pointer */\r
+ p_list_item->p_next->p_prev= p_list_item->p_prev;\r
+ /* set the next pointer */\r
+ p_list_item->p_prev->p_next= p_list_item->p_next;\r
+\r
+ /* if we're debugging, spruce up the pointers to help find bugs */\r
+#if defined( _DEBUG_ )\r
+ if( p_list_item != p_list_item->p_next )\r
+ {\r
+ p_list_item->p_next = NULL;\r
+ p_list_item->p_prev = NULL;\r
+ }\r
+#endif /* defined( _DEBUG_ ) */\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_list_item\r
+* [in] Pointer to cl_list_item_t to remove\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*********/\r
+\r
+\r
+/*\r
+ * Declaration of quick list functions\r
+ */\r
+\r
+/****f* Component Library: Quick List/cl_qlist_set_obj\r
+* NAME\r
+* cl_qlist_set_obj\r
+*\r
+* DESCRIPTION\r
+* The cl_qlist_set_obj function sets the object stored in a list object.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE void CL_API\r
+cl_qlist_set_obj(\r
+ IN cl_list_obj_t* const p_list_obj,\r
+ IN const void* const p_object )\r
+{\r
+ /* CL_ASSERT that a non-null pointer is provided. */\r
+ CL_ASSERT( p_list_obj );\r
+ p_list_obj->p_object = p_object;\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_list_obj\r
+* [in] Pointer to a cl_list_obj_t structure.\r
+*\r
+* p_object\r
+* [in] User defined context.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* SEE ALSO\r
+* Quick List, cl_qlist_obj\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick List/cl_qlist_obj\r
+* NAME\r
+* cl_qlist_obj\r
+*\r
+* DESCRIPTION\r
+* The cl_qlist_set_obj function returns the object stored in a list object.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE void* CL_API\r
+cl_qlist_obj(\r
+ IN const cl_list_obj_t* const p_list_obj )\r
+{\r
+ /* CL_ASSERT that a non-null pointer is provided. */\r
+ CL_ASSERT( p_list_obj );\r
+\r
+ return( (void*)p_list_obj->p_object );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_list_obj\r
+* [in] Pointer to a cl_list_obj_t structure.\r
+*\r
+* RETURN VALUE\r
+* Returns the value of the object pointer stored in the list object.\r
+*\r
+* SEE ALSO\r
+* Quick List, cl_qlist_set_obj\r
+*********/\r
+\r
+\r
+CL_INLINE void CL_API\r
+__cl_qlist_reset(\r
+ IN cl_qlist_t* const p_list )\r
+{\r
+ /* Point the end item to itself. */\r
+ p_list->end.p_next = &p_list->end;\r
+ p_list->end.p_prev = &p_list->end;\r
+#if defined( _DEBUG_ )\r
+ p_list->end.p_list = p_list;\r
+#endif\r
+\r
+ /* Clear the count. */\r
+ p_list->count = 0;\r
+}\r
+\r
+\r
+/****f* Component Library: Quick List/cl_qlist_init\r
+* NAME\r
+* cl_qlist_init\r
+*\r
+* DESCRIPTION\r
+* The cl_qlist_init function initializes a quick list.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE void CL_API\r
+cl_qlist_init(\r
+ IN cl_qlist_t* const p_list )\r
+{\r
+ /* CL_ASSERT that a non-null pointer is provided. */\r
+ CL_ASSERT( p_list );\r
+\r
+ p_list->state = CL_INITIALIZED;\r
+\r
+ /* Reset the quick list data structure. */\r
+ __cl_qlist_reset( p_list );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_list\r
+* [in] Pointer to a cl_qlist_t structure to initialize.\r
+*\r
+* RETURN VALUES\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* Allows calling quick list manipulation functions.\r
+*\r
+* SEE ALSO\r
+* Quick List, cl_qlist_insert_head, cl_qlist_insert_tail,\r
+* cl_qlist_remove_head, cl_qlist_remove_tail\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick List/cl_qlist_count\r
+* NAME\r
+* cl_qlist_count\r
+*\r
+* DESCRIPTION\r
+* The cl_qlist_count function returns the number of list items stored\r
+* in a quick list.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE size_t CL_API\r
+cl_qlist_count(\r
+ IN const cl_qlist_t* const p_list )\r
+{\r
+ /* CL_ASSERT that a non-null pointer is provided. */\r
+ CL_ASSERT( p_list );\r
+ /* CL_ASSERT that the list was initialized. */\r
+ CL_ASSERT( p_list->state == CL_INITIALIZED );\r
+\r
+ return( p_list->count );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_list\r
+* [in] Pointer to a cl_qlist_t structure.\r
+*\r
+* RETURN VALUE\r
+* Number of items in the list. This function iterates though the quick\r
+* list to count the items.\r
+*\r
+* SEE ALSO\r
+* Quick List, cl_is_qlist_empty\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick List/cl_is_qlist_empty\r
+* NAME\r
+* cl_is_qlist_empty\r
+*\r
+* DESCRIPTION\r
+* The cl_is_qlist_empty function returns whether a quick list is empty.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE boolean_t CL_API\r
+cl_is_qlist_empty(\r
+ IN const cl_qlist_t* const p_list )\r
+{\r
+ /* CL_ASSERT that a non-null pointer is provided. */\r
+ CL_ASSERT( p_list );\r
+ /* CL_ASSERT that the list was initialized. */\r
+ CL_ASSERT( p_list->state == CL_INITIALIZED );\r
+\r
+ return( !cl_qlist_count( p_list ) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_list\r
+* [in] Pointer to a cl_qlist_t structure.\r
+*\r
+* RETURN VALUES\r
+* TRUE if the specified quick list is empty.\r
+*\r
+* FALSE otherwise.\r
+*\r
+* SEE ALSO\r
+* Quick List, cl_qlist_count, cl_qlist_remove_all\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick List/cl_qlist_next\r
+* NAME\r
+* cl_qlist_next\r
+*\r
+* DESCRIPTION\r
+* The cl_qlist_next function returns a pointer to the list item following\r
+* a given list item in a quick list.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE cl_list_item_t* CL_API\r
+cl_qlist_next(\r
+ IN const cl_list_item_t* const p_list_item )\r
+{\r
+ /* CL_ASSERT that a non-null pointer is provided. */\r
+ CL_ASSERT( p_list_item );\r
+\r
+ /* Return the next item. */\r
+ return( p_list_item->p_next );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_list_item\r
+* [in] Pointer to the cl_list_item_t whose successor to return.\r
+*\r
+* Returns:\r
+* Pointer to the list item following the list item specified by\r
+* the p_list_item parameter in the quick list.\r
+*\r
+* Pointer to the list end if p_list_item was at the tail of the list.\r
+*\r
+* SEE ALSO\r
+* Quick List, cl_qlist_head, cl_qlist_tail, cl_qlist_prev, cl_qlist_end,\r
+* cl_list_item_t\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick List/cl_qlist_prev\r
+* NAME\r
+* cl_qlist_prev\r
+*\r
+* DESCRIPTION\r
+* The cl_qlist_prev function returns a poirter to the list item preceding\r
+* a given list item in a quick list.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE cl_list_item_t* CL_API\r
+cl_qlist_prev(\r
+ IN const cl_list_item_t* const p_list_item )\r
+{\r
+ /* CL_ASSERT that a non-null pointer is provided. */\r
+ CL_ASSERT( p_list_item );\r
+\r
+ /* Return the previous item. */\r
+ return( p_list_item->p_prev );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_list_item\r
+* [in] Pointer to the cl_list_item_t whose predecessor to return.\r
+*\r
+* Returns:\r
+* Pointer to the list item preceding the list item specified by\r
+* the p_list_item parameter in the quick list.\r
+*\r
+* Pointer to the list end if p_list_item was at the tail of the list.\r
+*\r
+* SEE ALSO\r
+* Quick List, cl_qlist_head, cl_qlist_tail, cl_qlist_next, cl_qlist_end,\r
+* cl_list_item_t\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick List/cl_qlist_head\r
+* NAME\r
+* cl_qlist_head\r
+*\r
+* DESCRIPTION\r
+* The cl_qlist_head function returns the list item at\r
+* the head of a quick list.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE cl_list_item_t* CL_API\r
+cl_qlist_head(\r
+ IN const cl_qlist_t* const p_list )\r
+{\r
+ /* CL_ASSERT that a non-null pointer is provided. */\r
+ CL_ASSERT( p_list );\r
+ /* CL_ASSERT that the list was initialized. */\r
+ CL_ASSERT( p_list->state == CL_INITIALIZED );\r
+\r
+ return( cl_qlist_next( &p_list->end ) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_list\r
+* [in] Pointer to a cl_qlist_t structure.\r
+*\r
+* RETURN VALUES\r
+* Pointer to the list item at the head of the quick list.\r
+*\r
+* Pointer to the list end if the list was empty.\r
+*\r
+* NOTES\r
+* cl_qlist_head does not remove the item from the list.\r
+*\r
+* SEE ALSO\r
+* Quick List, cl_qlist_tail, cl_qlist_next, cl_qlist_prev, cl_qlist_end,\r
+* cl_list_item_t\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick List/cl_qlist_tail\r
+* NAME\r
+* cl_qlist_tail\r
+*\r
+* DESCRIPTION\r
+* The cl_qlist_tail function returns the list item at\r
+* the tail of a quick list.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE cl_list_item_t* CL_API\r
+cl_qlist_tail(\r
+ IN const cl_qlist_t* const p_list )\r
+{\r
+ /* CL_ASSERT that a non-null pointer is provided. */\r
+ CL_ASSERT( p_list );\r
+ /* CL_ASSERT that the list was initialized. */\r
+ CL_ASSERT( p_list->state == CL_INITIALIZED );\r
+\r
+ return( cl_qlist_prev( &p_list->end ) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_list\r
+* [in] Pointer to a cl_qlist_t structure.\r
+*\r
+* RETURN VALUES\r
+* Pointer to the list item at the tail of the quick list.\r
+*\r
+* Pointer to the list end if the list was empty.\r
+*\r
+* NOTES\r
+* cl_qlist_tail does not remove the item from the list.\r
+*\r
+* SEE ALSO\r
+* Quick List, cl_qlist_head, cl_qlist_next, cl_qlist_prev, cl_qlist_end,\r
+* cl_list_item_t\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick List/cl_qlist_end\r
+* NAME\r
+* cl_qlist_end\r
+*\r
+* DESCRIPTION\r
+* The cl_qlist_end function returns the end of a quick list.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE const cl_list_item_t* const CL_API\r
+cl_qlist_end(\r
+ IN const cl_qlist_t* const p_list )\r
+{\r
+ /* CL_ASSERT that a non-null pointer is provided. */\r
+ CL_ASSERT( p_list );\r
+ /* CL_ASSERT that the list was initialized. */\r
+ CL_ASSERT( p_list->state == CL_INITIALIZED );\r
+\r
+ return( &p_list->end );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_list\r
+* [in] Pointer to a cl_qlist_t structure.\r
+*\r
+* RETURN VALUE\r
+* Pointer to the end of the list.\r
+*\r
+* NOTES\r
+* cl_qlist_end is useful for determining the validity of list items returned\r
+* by cl_qlist_head, cl_qlist_tail, cl_qlist_next, cl_qlist_prev, as well as\r
+* the cl_qlist_find functions. If the list item pointer returned by any of\r
+* these functions compares to the end, the end of the list was encoutered.\r
+* When using cl_qlist_head or cl_qlist_tail, this condition indicates that\r
+* the list is empty.\r
+*\r
+* SEE ALSO\r
+* Quick List, cl_qlist_head, cl_qlist_tail, cl_qlist_next, cl_qlist_prev,\r
+* cl_list_item_t\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick List/cl_qlist_insert_head\r
+* NAME\r
+* cl_qlist_insert_head\r
+*\r
+* DESCRIPTION\r
+* The cl_qlist_insert_head function inserts a list item at the\r
+* head of a quick list.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE void CL_API\r
+cl_qlist_insert_head(\r
+ IN cl_qlist_t* const p_list,\r
+ IN cl_list_item_t* const p_list_item )\r
+{\r
+ /* CL_ASSERT that a non-null pointer is provided. */\r
+ CL_ASSERT( p_list );\r
+ /* CL_ASSERT that a non-null pointer is provided. */\r
+ CL_ASSERT( p_list_item );\r
+ /* CL_ASSERT that the list was initialized. */\r
+ CL_ASSERT( p_list->state == CL_INITIALIZED );\r
+\r
+ /*\r
+ * The list item must not already be part of the list. Note that this\r
+ * assertion may fail if an uninitialized list item happens to have its\r
+ * list pointer equal to the specified list. The chances of this\r
+ * happening are acceptable in light of the value of this check.\r
+ */\r
+ CL_ASSERT( p_list_item->p_list != p_list );\r
+\r
+#if defined( _DEBUG_ )\r
+ p_list_item->p_list = p_list;\r
+#endif\r
+\r
+ /* Insert before the head. */\r
+ __cl_primitive_insert( cl_qlist_head( p_list ), p_list_item );\r
+\r
+ p_list->count++;\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_list\r
+* [in] Pointer to a cl_qlist_t structure into which to insert the object.\r
+*\r
+* p_list_item\r
+* [in] Pointer to a cl_list_item_t structure to add.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* In debug builds, cl_qlist_insert_head asserts that the specified list item\r
+* is not already in the list.\r
+*\r
+* SEE ALSO\r
+* Quick List, cl_qlist_insert_tail, cl_qlist_insert_list_head,\r
+* cl_qlist_insert_list_tail, cl_qlist_insert_array_head,\r
+* cl_qlist_insert_array_tail, cl_qlist_insert_prev, cl_qlist_insert_next,\r
+* cl_qlist_remove_head, cl_list_item_t\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick List/cl_qlist_insert_tail\r
+* NAME\r
+* cl_qlist_insert_tail\r
+*\r
+* DESCRIPTION\r
+* The cl_qlist_insert_tail function inserts a list item at the tail\r
+* of a quick list.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE void CL_API\r
+cl_qlist_insert_tail(\r
+ IN cl_qlist_t* const p_list,\r
+ IN cl_list_item_t* const p_list_item )\r
+{\r
+ /* CL_ASSERT that a non-null pointer is provided. */\r
+ CL_ASSERT( p_list );\r
+ /* CL_ASSERT that a non-null pointer is provided. */\r
+ CL_ASSERT( p_list_item );\r
+ /* CL_ASSERT that the list was initialized. */\r
+ CL_ASSERT( p_list->state == CL_INITIALIZED );\r
+\r
+ /*\r
+ * The list item must not already be part of the list. Note that this\r
+ * assertion may fail if an uninitialized list item happens to have its\r
+ * list pointer equal to the specified list. The chances of this\r
+ * happening are acceptable in light of the value of this check.\r
+ */\r
+ CL_ASSERT( p_list_item->p_list != p_list );\r
+\r
+#if defined( _DEBUG_ )\r
+ p_list_item->p_list = p_list;\r
+#endif\r
+\r
+ /*\r
+ * Put the new element in front of the end which is the same\r
+ * as being at the tail\r
+ */\r
+ __cl_primitive_insert( &p_list->end, p_list_item );\r
+\r
+ p_list->count++;\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_list\r
+* [in] Pointer to a cl_qlist_t structure into which to insert the object.\r
+*\r
+* p_list_item\r
+* [in] Pointer to cl_list_item_t structure to add.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* In debug builds, cl_qlist_insert_tail asserts that the specified list item\r
+* is not already in the list.\r
+*\r
+* SEE ALSO\r
+* Quick List, cl_qlist_insert_head, cl_qlist_insert_list_head,\r
+* cl_qlist_insert_list_tail, cl_qlist_insert_array_head,\r
+* cl_qlist_insert_array_tail, cl_qlist_insert_prev, cl_qlist_insert_next,\r
+* cl_qlist_remove_tail, cl_list_item_t\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick List/cl_qlist_insert_list_head\r
+* NAME\r
+* cl_qlist_insert_list_head\r
+*\r
+* DESCRIPTION\r
+* The cl_qlist_insert_list_head function merges two quick lists by\r
+* inserting one at the head of the other.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_qlist_insert_list_head(\r
+ IN cl_qlist_t* const p_dest_list,\r
+ IN cl_qlist_t* const p_src_list );\r
+/*\r
+* PARAMETERS\r
+* p_dest_list\r
+* [in] Pointer to destination quicklist object.\r
+*\r
+* p_src_list\r
+* [in] Pointer to quicklist to add.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* Inserts all list items in the source list to the head of the\r
+* destination list. The ordering of the list items is preserved.\r
+*\r
+* The list pointed to by the p_src_list parameter is empty when\r
+* the call returns.\r
+*\r
+* SEE ALSO\r
+* Quick List, cl_qlist_insert_list_tail, cl_qlist_insert_head,\r
+* cl_qlist_insert_tail, cl_qlist_insert_array_head,\r
+* cl_qlist_insert_array_tail, cl_qlist_insert_prev, cl_qlist_insert_next,\r
+* cl_list_item_t\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick List/cl_qlist_insert_list_tail\r
+* NAME\r
+* cl_qlist_insert_list_tail\r
+*\r
+* DESCRIPTION\r
+* The cl_qlist_insert_list_tail function merges two quick lists by\r
+* inserting one at the tail of the other.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_qlist_insert_list_tail(\r
+ IN cl_qlist_t* const p_dest_list,\r
+ IN cl_qlist_t* const p_src_list );\r
+/*\r
+* PARAMETERS\r
+* p_dest_list\r
+* [in] Pointer to destination quicklist object\r
+*\r
+* p_src_list\r
+* [in] Pointer to quicklist to add\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* Inserts all list items in the source list to the tail of the\r
+* destination list. The ordering of the list items is preserved.\r
+*\r
+* The list pointed to by the p_src_list parameter is empty when\r
+* the call returns.\r
+*\r
+* SEE ALSO\r
+* Quick List, cl_qlist_insert_list_head, cl_qlist_insert_head,\r
+* cl_qlist_insert_tail, cl_qlist_insert_array_head,\r
+* cl_qlist_insert_array_tail, cl_qlist_insert_prev, cl_qlist_insert_next,\r
+* cl_list_item_t\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick List/cl_qlist_insert_array_head\r
+* NAME\r
+* cl_qlist_insert_array_head\r
+*\r
+* DESCRIPTION\r
+* The cl_qlist_insert_array_head function inserts an array of list items\r
+* at the head of a quick list.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_qlist_insert_array_head(\r
+ IN cl_qlist_t* const p_list,\r
+ IN cl_list_item_t* const p_array,\r
+ IN size_t item_count,\r
+ IN const size_t item_size );\r
+/*\r
+* PARAMETERS\r
+* p_list\r
+* [in] Pointer to a cl_qlist_t structure into which to insert\r
+* the objects.\r
+*\r
+* p_array\r
+* [in] Pointer to the first list item in an array of cl_list_item_t\r
+* structures.\r
+*\r
+* item_count\r
+* [in] Number of cl_list_item_t structures in the array.\r
+*\r
+* item_size\r
+* [in] Size of the items added to the list. This is the stride in the\r
+* array from one cl_list_item_t structure to the next.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* Inserts all the list items in the array specified by the p_array parameter\r
+* to the head of the quick list specified by the p_list parameter,\r
+* preserving ordering of the list items.\r
+*\r
+* The array pointer passed into the function points to the cl_list_item_t\r
+* in the first element of the caller's element array. There is no\r
+* restriction on where the element is stored in the parent structure.\r
+*\r
+* SEE ALSO\r
+* Quick List, cl_qlist_insert_array_tail, cl_qlist_insert_head,\r
+* cl_qlist_insert_tail, cl_qlist_insert_list_head, cl_qlist_insert_list_tail,\r
+* cl_qlist_insert_prev, cl_qlist_insert_next, cl_list_item_t\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick List/cl_qlist_insert_array_tail\r
+* NAME\r
+* cl_qlist_insert_array_tail\r
+*\r
+* DESCRIPTION\r
+* The cl_qlist_insert_array_tail function inserts an array of list items\r
+* at the tail of a quick list.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_qlist_insert_array_tail(\r
+ IN cl_qlist_t* const p_list,\r
+ IN cl_list_item_t* const p_array,\r
+ IN size_t item_count,\r
+ IN const size_t item_size);\r
+/*\r
+* PARAMETERS\r
+* p_list\r
+* [in] Pointer to a cl_qlist_t structure into which to insert\r
+* the objects.\r
+*\r
+* p_array\r
+* [in] Pointer to the first list item in an array of cl_list_item_t\r
+* structures.\r
+*\r
+* item_count\r
+* [in] Number of cl_list_item_t structures in the array.\r
+*\r
+* item_size\r
+* [in] Size of the items added to the list. This is the stride in the\r
+* array from one cl_list_item_t structure to the next.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* Inserts all the list items in the array specified by the p_array parameter\r
+* to the tail of the quick list specified by the p_list parameter,\r
+* preserving ordering of the list items.\r
+*\r
+* The array pointer passed into the function points to the cl_list_item_t\r
+* in the first element of the caller's element array. There is no\r
+* restriction on where the element is stored in the parent structure.\r
+*\r
+* SEE ALSO\r
+* Quick List, cl_qlist_insert_array_head, cl_qlist_insert_head,\r
+* cl_qlist_insert_tail, cl_qlist_insert_list_head, cl_qlist_insert_list_tail,\r
+* cl_qlist_insert_prev, cl_qlist_insert_next, cl_list_item_t\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick List/cl_qlist_insert_prev\r
+* NAME\r
+* cl_qlist_insert_prev\r
+*\r
+* DESCRIPTION\r
+* The cl_qlist_insert_prev function inserts a list item before a\r
+* specified list item in a quick list.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE void CL_API\r
+cl_qlist_insert_prev(\r
+ IN cl_qlist_t* const p_list,\r
+ IN cl_list_item_t* const p_list_item,\r
+ IN cl_list_item_t* const p_new_item )\r
+{\r
+ /* CL_ASSERT that a non-null pointer is provided. */\r
+ CL_ASSERT( p_list );\r
+ /* CL_ASSERT that a non-null pointer is provided. */\r
+ CL_ASSERT( p_list_item );\r
+ /* CL_ASSERT that a non-null pointer is provided. */\r
+ CL_ASSERT( p_new_item );\r
+ /* CL_ASSERT that the list was initialized. */\r
+ CL_ASSERT( p_list->state == CL_INITIALIZED );\r
+\r
+ /*\r
+ * The list item must not already be part of the list. Note that this\r
+ * assertion may fail if an uninitialized list item happens to have its\r
+ * list pointer equal to the specified list. The chances of this\r
+ * happening are acceptable in light of the value of this check.\r
+ */\r
+ CL_ASSERT( p_new_item->p_list != p_list );\r
+\r
+#if defined( _DEBUG_ )\r
+ p_new_item->p_list = p_list;\r
+#endif\r
+\r
+ __cl_primitive_insert( p_list_item, p_new_item );\r
+\r
+ p_list->count++;\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_list\r
+* [in] Pointer to a cl_qlist_t structure into which to add the new item.\r
+*\r
+* p_list_item\r
+* [in] Pointer to a cl_list_item_t structure.\r
+*\r
+* p_new_item\r
+* [in] Pointer to a cl_list_item_t structure to add to the quick list.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* Inserts the new list item before the list item specified by p_list_item.\r
+*\r
+* SEE ALSO\r
+* Quick List, cl_qlist_insert_next, cl_qlist_insert_head,\r
+* cl_qlist_insert_tail, cl_qlist_insert_list_head, cl_qlist_insert_list_tail,\r
+* cl_qlist_insert_array_head, cl_qlist_insert_array_tail, cl_list_item_t\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick List/cl_qlist_insert_next\r
+* NAME\r
+* cl_qlist_insert_next\r
+*\r
+* DESCRIPTION\r
+* The cl_qlist_insert_next function inserts a list item after a specified\r
+* list item in a quick list.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE void CL_API\r
+cl_qlist_insert_next(\r
+ IN cl_qlist_t* const p_list,\r
+ IN cl_list_item_t* const p_list_item,\r
+ IN cl_list_item_t* const p_new_item )\r
+{\r
+ /* CL_ASSERT that a non-null pointer is provided. */\r
+ CL_ASSERT( p_list );\r
+ /* CL_ASSERT that a non-null pointer is provided. */\r
+ CL_ASSERT( p_list_item );\r
+ /* CL_ASSERT that a non-null pointer is provided. */\r
+ CL_ASSERT( p_new_item );\r
+ /* CL_ASSERT that the list was initialized. */\r
+ CL_ASSERT( p_list->state == CL_INITIALIZED );\r
+\r
+ /*\r
+ * The list item must not already be part of the list. Note that this\r
+ * assertion may fail if an uninitialized list item happens to have its\r
+ * list pointer equal to the specified list. The chances of this\r
+ * happening are acceptable in light of the value of this check.\r
+ */\r
+ CL_ASSERT( p_new_item->p_list != p_list );\r
+\r
+#if defined( _DEBUG_ )\r
+ p_new_item->p_list = p_list;\r
+#endif\r
+\r
+ __cl_primitive_insert( cl_qlist_next( p_list_item ), p_new_item );\r
+\r
+ p_list->count++;\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_list\r
+* [in] Pointer to a cl_qlist_t structure into which to add the new item.\r
+*\r
+* p_list_item\r
+* [in] Pointer to a cl_list_item_t structure.\r
+*\r
+* p_new_item\r
+* [in] Pointer to a cl_list_item_t structure to add to the quick list.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* Inserts the new list item after the list item specified by p_list_item.\r
+* The list item specified by p_list_item must be in the quick list.\r
+*\r
+* SEE ALSO\r
+* Quick List, cl_qlist_insert_prev, cl_qlist_insert_head,\r
+* cl_qlist_insert_tail, cl_qlist_insert_list_head, cl_qlist_insert_list_tail,\r
+* cl_qlist_insert_array_head, cl_qlist_insert_array_tail, cl_list_item_t\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick List/cl_qlist_remove_head\r
+* NAME\r
+* cl_qlist_remove_head\r
+*\r
+* DESCRIPTION\r
+* The cl_qlist_remove_head function removes and returns the list item\r
+* at the head of a quick list.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE cl_list_item_t* CL_API\r
+cl_qlist_remove_head(\r
+ IN cl_qlist_t* const p_list )\r
+{\r
+ cl_list_item_t *p_item;\r
+\r
+ /* CL_ASSERT that a non-null pointer is provided. */\r
+ CL_ASSERT( p_list );\r
+ /* CL_ASSERT that the list was initialized. */\r
+ CL_ASSERT( p_list->state == CL_INITIALIZED );\r
+\r
+ p_item = cl_qlist_head( p_list );\r
+ /* CL_ASSERT that the list item is part of the list. */\r
+ CL_ASSERT( p_item->p_list == p_list );\r
+\r
+ if( p_item == cl_qlist_end( p_list ) )\r
+ return( p_item );\r
+\r
+#if defined( _DEBUG_ )\r
+ /* Clear the item's link to the list. */\r
+ p_item->p_list = NULL;\r
+#endif\r
+\r
+ __cl_primitive_remove( p_item );\r
+\r
+ p_list->count--;\r
+\r
+ return( p_item );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_list\r
+* [in] Pointer to a cl_qlist_t structure.\r
+*\r
+* RETURN VALUES\r
+* Returns a pointer to the list item formerly at the head of the quick list.\r
+*\r
+* Pointer to the list end if the list was empty.\r
+*\r
+* SEE ALSO\r
+* Quick List, cl_qlist_remove_tail, cl_qlist_remove_all, cl_qlist_remove_item,\r
+* cl_qlist_end, cl_qlist_head, cl_list_item_t\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick List/cl_qlist_remove_tail\r
+* NAME\r
+* cl_qlist_remove_tail\r
+*\r
+* DESCRIPTION\r
+* The cl_qlist_remove_tail function removes and returns the list item\r
+* at the tail of a quick list.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE cl_list_item_t* CL_API\r
+cl_qlist_remove_tail(\r
+ IN cl_qlist_t* const p_list )\r
+{\r
+ cl_list_item_t *p_item;\r
+\r
+ /* CL_ASSERT that a non-null pointer is provided. */\r
+ CL_ASSERT( p_list );\r
+ /* CL_ASSERT that the list was initialized. */\r
+ CL_ASSERT( p_list->state == CL_INITIALIZED );\r
+\r
+ p_item = cl_qlist_tail( p_list );\r
+ /* CL_ASSERT that the list item is part of the list. */\r
+ CL_ASSERT( p_item->p_list == p_list );\r
+\r
+ if( p_item == cl_qlist_end( p_list ) )\r
+ return( p_item );\r
+\r
+#if defined( _DEBUG_ )\r
+ /* Clear the item's link to the list. */\r
+ p_item->p_list = NULL;\r
+#endif\r
+\r
+ __cl_primitive_remove( p_item );\r
+\r
+ p_list->count--;\r
+\r
+ return( p_item );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_list\r
+* [in] Pointer to a cl_qlist_t structure.\r
+*\r
+* RETURN VALUES\r
+* Returns a pointer to the list item formerly at the tail of the quick list.\r
+*\r
+* Pointer to the list end if the list was empty.\r
+*\r
+* SEE ALSO\r
+* Quick List, cl_qlist_remove_head, cl_qlist_remove_all, cl_qlist_remove_item,\r
+* cl_qlist_end, cl_qlist_tail, cl_list_item_t\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick List/cl_qlist_remove_item\r
+* NAME\r
+* cl_qlist_remove_item\r
+*\r
+* DESCRIPTION\r
+* The cl_qlist_remove_item function removes a specific list item from a quick list.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE void CL_API\r
+cl_qlist_remove_item(\r
+ IN cl_qlist_t* const p_list,\r
+ IN cl_list_item_t* const p_list_item )\r
+{\r
+ /* CL_ASSERT that a non-null pointer is provided. */\r
+ CL_ASSERT( p_list );\r
+ /* CL_ASSERT that a non-null pointer is provided. */\r
+ CL_ASSERT( p_list_item );\r
+ /* CL_ASSERT that the list was initialized. */\r
+ CL_ASSERT( p_list->state == CL_INITIALIZED );\r
+ /* CL_ASSERT that the list item is part of the list. */\r
+ CL_ASSERT( p_list_item->p_list == p_list );\r
+\r
+ if( p_list_item == cl_qlist_end( p_list ) )\r
+ return;\r
+\r
+#if defined( _DEBUG_ )\r
+ /* Clear the item's link to the list. */\r
+ p_list_item->p_list = NULL;\r
+#endif\r
+\r
+ __cl_primitive_remove( p_list_item );\r
+\r
+ p_list->count--;\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_list\r
+* [in] Pointer to a cl_qlist_t structure from which to remove the item.\r
+*\r
+* p_list_item\r
+* [in] Pointer to a cl_list_item_t structure to remove.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* Removes the list item pointed to by the p_list_item parameter from\r
+* its list.\r
+*\r
+* SEE ALSO\r
+* Quick List, cl_qlist_remove_head, cl_qlist_remove_tail, cl_qlist_remove_all,\r
+* cl_list_item_t\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick List/cl_qlist_remove_all\r
+* NAME\r
+* cl_qlist_remove_all\r
+*\r
+* DESCRIPTION\r
+* The cl_qlist_remove_all function removes all items from a quick list.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE void CL_API\r
+cl_qlist_remove_all(\r
+ IN cl_qlist_t* const p_list )\r
+{\r
+#if defined( _DEBUG_ )\r
+ cl_list_item_t *p_list_item;\r
+\r
+ /* CL_ASSERT that a non-null pointer is provided. */\r
+ CL_ASSERT( p_list );\r
+ /* CL_ASSERT that the list was initialized. */\r
+ CL_ASSERT( p_list->state == CL_INITIALIZED );\r
+ p_list_item = cl_qlist_head( p_list );\r
+ while( p_list_item != cl_qlist_end( p_list ) )\r
+ {\r
+ p_list_item = cl_qlist_next( p_list_item );\r
+ cl_qlist_prev( p_list_item )->p_list = NULL;\r
+ }\r
+#endif\r
+\r
+ __cl_qlist_reset( p_list );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_list\r
+* [in] Pointer to a cl_qlist_t structure.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* SEE ALSO\r
+* Quick List, cl_qlist_remove_head, cl_qlist_remove_tail,\r
+* cl_qlist_remove_item, cl_list_item_t\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick List/cl_is_item_in_qlist\r
+* NAME\r
+* cl_is_item_in_qlist\r
+*\r
+* DESCRIPTION\r
+* The cl_is_item_in_qlist function checks for the presence of a\r
+* list item in a quick list.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT boolean_t CL_API\r
+cl_is_item_in_qlist(\r
+ IN const cl_qlist_t* const p_list,\r
+ IN const cl_list_item_t* const p_list_item );\r
+/*\r
+* PARAMETERS\r
+* p_list\r
+* [in] Pointer to a cl_qlist_t structure.\r
+*\r
+* p_list_item\r
+* [in] Pointer to the cl_list_item_t to find.\r
+*\r
+* RETURN VALUES\r
+* TRUE if the list item was found in the quick list.\r
+*\r
+* FALSE otherwise.\r
+*\r
+* SEE ALSO\r
+* Quick List, cl_qlist_remove_item, cl_list_item_t\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick List/cl_qlist_find_next\r
+* NAME\r
+* cl_qlist_find_next\r
+*\r
+* DESCRIPTION\r
+* The cl_qlist_find_next function invokes a specified function to\r
+* search for an item, starting from a given list item.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_list_item_t* CL_API\r
+cl_qlist_find_next(\r
+ IN const cl_qlist_t* const p_list,\r
+ IN const cl_list_item_t* const p_list_item,\r
+ IN cl_pfn_qlist_find_t pfn_func,\r
+ IN const void* const context );\r
+/*\r
+* PARAMETERS\r
+* p_list\r
+* [in] Pointer to a cl_qlist_t structure in which to search.\r
+*\r
+* p_list_item\r
+* [in] Pointer to a cl_list_item_t structure from which to start the search.\r
+*\r
+* pfn_func\r
+* [in] Function invoked to determine if a match was found.\r
+* See the cl_pfn_qlist_find_t function type declaration for details\r
+* about the callback function.\r
+*\r
+* context\r
+* [in] Value to pass to the callback functions to provide context if a\r
+* callback function is provided, or value compared to the quick list's\r
+* list items.\r
+*\r
+* Returns:\r
+* Pointer to the list item, if found.\r
+*\r
+* p_list_item if not found.\r
+*\r
+* NOTES\r
+* cl_qlist_find_next does not remove list items from the list.\r
+* The list item is returned when the function specified by the pfn_func\r
+* parameter returns CL_SUCCESS. The list item from which the search starts is\r
+* excluded from the search.\r
+*\r
+* The function provided by the pfn_func must not perform any list operations,\r
+* as these would corrupt the list.\r
+*\r
+* SEE ALSO\r
+* Quick List, cl_qlist_find_prev, cl_qlist_find_from_head,\r
+* cl_qlist_find_from_tail, cl_qlist_end, cl_qlist_apply_func,\r
+* cl_qlist_move_items, cl_list_item_t, cl_pfn_qlist_find_t\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick List/cl_qlist_find_prev\r
+* NAME\r
+* cl_qlist_find_prev\r
+*\r
+* DESCRIPTION\r
+* The cl_qlist_find_prev function invokes a specified function to\r
+* search backward for an item, starting from a given list item.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_list_item_t* CL_API\r
+cl_qlist_find_prev(\r
+ IN const cl_qlist_t* const p_list,\r
+ IN const cl_list_item_t* const p_list_item,\r
+ IN cl_pfn_qlist_find_t pfn_func,\r
+ IN const void* const context );\r
+/*\r
+* PARAMETERS\r
+* p_list\r
+* [in] Pointer to a cl_qlist_t structure in which to search.\r
+*\r
+* p_list_item\r
+* [in] Pointer to a cl_list_item_t structure from which to start the search.\r
+*\r
+* pfn_func\r
+* [in] Function invoked to determine if a match was found.\r
+* See the cl_pfn_qlist_find_t function type declaration for details\r
+* about the callback function.\r
+*\r
+* context\r
+* [in] Value to pass to the callback functions to provide context if a\r
+* callback function is provided, or value compared to the quick list's\r
+* list items.\r
+*\r
+* Returns:\r
+* Pointer to the list item, if found.\r
+*\r
+* p_list_item if not found.\r
+*\r
+* NOTES\r
+* cl_qlist_find_prev does not remove list items from the list.\r
+* The list item is returned when the function specified by the pfn_func\r
+* parameter returns CL_SUCCESS. The list item from which the search starts is\r
+* excluded from the search.\r
+*\r
+* The function provided by the pfn_func must not perform any list operations,\r
+* as these would corrupt the list.\r
+*\r
+* SEE ALSO\r
+* Quick List, cl_qlist_find_next, cl_qlist_find_from_head,\r
+* cl_qlist_find_from_tail, cl_qlist_end, cl_qlist_apply_func,\r
+* cl_qlist_move_items, cl_list_item_t, cl_pfn_qlist_find_t\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick List/cl_qlist_find_from_head\r
+* NAME\r
+* cl_qlist_find_from_head\r
+*\r
+* DESCRIPTION\r
+* The cl_qlist_find_from_head function invokes a specified function to\r
+* search for an item, starting at the head of a quick list.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE cl_list_item_t* CL_API\r
+cl_qlist_find_from_head(\r
+ IN const cl_qlist_t* const p_list,\r
+ IN cl_pfn_qlist_find_t pfn_func,\r
+ IN const void* const context )\r
+{\r
+ /* CL_ASSERT that a non-null pointer is provided. */\r
+ CL_ASSERT( p_list );\r
+ /* CL_ASSERT that the list was initialized. */\r
+ CL_ASSERT( p_list->state == CL_INITIALIZED );\r
+ /* CL_ASSERT that a find function is provided. */\r
+ CL_ASSERT( pfn_func );\r
+\r
+ return( cl_qlist_find_next( p_list, cl_qlist_end( p_list ), pfn_func,\r
+ context ) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_list\r
+* [in] Pointer to a cl_qlist_t structure.\r
+*\r
+* pfn_func\r
+* [in] Function invoked to determine if a match was found.\r
+* See the cl_pfn_qlist_find_t function type declaration for details\r
+* about the callback function.\r
+*\r
+* context\r
+* [in] Value to pass to the callback functions to provide context if a\r
+* callback function is provided, or value compared to the quick list's\r
+* list items.\r
+*\r
+* Returns:\r
+* Pointer to the list item, if found.\r
+*\r
+* Pointer to the list end otherwise\r
+*\r
+* NOTES\r
+* cl_qlist_find_from_head does not remove list items from the list.\r
+* The list item is returned when the function specified by the pfn_func\r
+* parameter returns CL_SUCCESS.\r
+*\r
+* The function provided by the pfn_func parameter must not perform any list\r
+* operations, as these would corrupt the list.\r
+*\r
+* SEE ALSO\r
+* Quick List, cl_qlist_find_from_tail, cl_qlist_find_next, cl_qlist_find_prev,\r
+* cl_qlist_end, cl_qlist_apply_func, cl_qlist_move_items, cl_list_item_t,\r
+* cl_pfn_qlist_find_t\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick List/cl_qlist_find_from_tail\r
+* NAME\r
+* cl_qlist_find_from_tail\r
+*\r
+* DESCRIPTION\r
+* The cl_qlist_find_from_tail function invokes a specified function to\r
+* search for an item, starting at the tail of a quick list.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE cl_list_item_t* CL_API\r
+cl_qlist_find_from_tail(\r
+ IN const cl_qlist_t* const p_list,\r
+ IN cl_pfn_qlist_find_t pfn_func,\r
+ IN const void* const context )\r
+{\r
+ /* CL_ASSERT that a non-null pointer is provided. */\r
+ CL_ASSERT( p_list );\r
+ /* CL_ASSERT that the list was initialized. */\r
+ CL_ASSERT( p_list->state == CL_INITIALIZED );\r
+ /* CL_ASSERT that a find function is provided. */\r
+ CL_ASSERT( pfn_func );\r
+\r
+ return( cl_qlist_find_prev( p_list, cl_qlist_end( p_list ), pfn_func,\r
+ context ) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_list\r
+* [in] Pointer to a cl_qlist_t structure.\r
+*\r
+* pfn_func\r
+* [in] Function invoked to determine if a match was found.\r
+* See the cl_pfn_qlist_find_t function type declaration for details\r
+* about the callback function.\r
+*\r
+* context\r
+* [in] Value to pass to the callback functions to provide context if a\r
+* callback function is provided, or value compared to the quick list's\r
+* list items.\r
+*\r
+* Returns:\r
+* Pointer to the list item, if found.\r
+*\r
+* Pointer to the list end otherwise\r
+*\r
+* NOTES\r
+* cl_qlist_find_from_tail does not remove list items from the list.\r
+* The list item is returned when the function specified by the pfn_func\r
+* parameter returns CL_SUCCESS.\r
+*\r
+* The function provided by the pfn_func parameter must not perform any list\r
+* operations, as these would corrupt the list.\r
+*\r
+* SEE ALSO\r
+* Quick List, cl_qlist_find_from_head, cl_qlist_find_next, cl_qlist_find_prev,\r
+* cl_qlist_apply_func, cl_qlist_end, cl_qlist_move_items, cl_list_item_t,\r
+* cl_pfn_qlist_find_t\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick List/cl_qlist_apply_func\r
+* NAME\r
+* cl_qlist_apply_func\r
+*\r
+* DESCRIPTION\r
+* The cl_qlist_apply_func function executes a specified function\r
+* for every list item stored in a quick list.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_qlist_apply_func(\r
+ IN const cl_qlist_t* const p_list,\r
+ IN cl_pfn_qlist_apply_t pfn_func,\r
+ IN const void* const context );\r
+/*\r
+* PARAMETERS\r
+* p_list\r
+* [in] Pointer to a cl_qlist_t structure.\r
+*\r
+* pfn_func\r
+* [in] Function invoked for every item in the quick list.\r
+* See the cl_pfn_qlist_apply_t function type declaration for details\r
+* about the callback function.\r
+*\r
+* context\r
+* [in] Value to pass to the callback functions to provide context.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* The function provided must not perform any list operations, as these\r
+* would corrupt the quick list.\r
+*\r
+* SEE ALSO\r
+* Quick List, cl_qlist_find_from_head, cl_qlist_find_from_tail,\r
+* cl_qlist_move_items, cl_pfn_qlist_apply_t\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick List/cl_qlist_move_items\r
+* NAME\r
+* cl_qlist_move_items\r
+*\r
+* DESCRIPTION\r
+* The cl_qlist_move_items function moves list items from one list to\r
+* another based on the return value of a user supplied function.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_qlist_move_items(\r
+ IN cl_qlist_t* const p_src_list,\r
+ IN cl_qlist_t* const p_dest_list,\r
+ IN cl_pfn_qlist_find_t pfn_func,\r
+ IN const void* const context );\r
+/*\r
+* PARAMETERS\r
+* p_src_list\r
+* [in] Pointer to a cl_qlist_t structure from which\r
+* list items are removed.\r
+*\r
+* p_dest_list\r
+* [in] Pointer to a cl_qlist_t structure to which the source\r
+* list items are added.\r
+*\r
+* pfn_func\r
+* [in] Function invoked to determine if a match was found.\r
+* See the cl_pfn_qlist_find_t function type declaration for details\r
+* about the callback function.\r
+*\r
+* context\r
+* [in] Value to pass to the callback functions to provide context.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* If the function specified by the pfn_func parameter returns CL_SUCCESS,\r
+* the related list item is removed from p_src_list and inserted at the tail\r
+* of the p_dest_list.\r
+*\r
+* The cl_qlist_move_items function continues iterating through p_src_list\r
+* from the last item moved, allowing multiple items to be located and moved\r
+* in a single list iteration.\r
+*\r
+* The function specified by pfn_func must not perform any list operations,\r
+* as these would corrupt the list.\r
+*\r
+* SEE ALSO\r
+* Quick List, cl_qlist_find_from_head, cl_qlist_find_from_tail,\r
+* cl_qlist_apply_func, cl_pfn_qlist_find_t\r
+*********/\r
+\r
+\r
+#ifdef __cplusplus\r
+} /* extern "C" */\r
+#endif\r
+\r
+#endif /* _CL_QUICK_LIST_H_ */\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.\r
+ * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. \r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+/*\r
+ * Abstract:\r
+ * Declaration of cl_qlock_pool_t.\r
+ * This object represents a threadsafe quick-pool of objects.\r
+ *\r
+ * Environment:\r
+ * All\r
+ */\r
+\r
+#ifndef _CL_QLOCKPOOL_H_\r
+#define _CL_QLOCKPOOL_H_\r
+\r
+\r
+#include <complib/cl_qpool.h>\r
+#include <complib/cl_spinlock.h>\r
+\r
+\r
+/****h* Component Library/Quick Locking Pool\r
+* NAME\r
+* Quick Locking Pool\r
+*\r
+* DESCRIPTION\r
+* The Quick Locking Pool represents a thread-safe quick pool.\r
+*\r
+* This object should be treated as opaque and should be\r
+* manipulated only through the provided functions.\r
+*\r
+* SEE ALSO\r
+* Structures:\r
+* cl_qlock_pool_t\r
+*\r
+* Initialization:\r
+* cl_qlock_pool_construct, cl_qlock_pool_init, cl_qlock_pool_destroy\r
+*\r
+* Manipulation\r
+* cl_qlock_pool_get, cl_qlock_pool_put\r
+*********/\r
+\r
+\r
+/****s* Component Library: Quick Locking Pool/cl_qlock_pool_t\r
+* NAME\r
+* cl_qlock_pool_t\r
+*\r
+* DESCRIPTION\r
+* Quick Locking Pool structure.\r
+*\r
+* This object should be treated as opaque and should\r
+* be manipulated only through the provided functions.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _cl_qlock_pool\r
+{\r
+ cl_spinlock_t lock;\r
+ cl_qpool_t pool;\r
+\r
+} cl_qlock_pool_t;\r
+/*\r
+* FIELDS\r
+* lock\r
+* Spinlock guarding the pool.\r
+*\r
+* pool\r
+* quick_pool of user objects.\r
+*\r
+* SEE ALSO\r
+* Quick Locking Pool\r
+*********/\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif\r
+\r
+\r
+/****f* Component Library: Quick Locking Pool/cl_qlock_pool_construct\r
+* NAME\r
+* cl_qlock_pool_construct\r
+*\r
+* DESCRIPTION\r
+* This function constructs a Quick Locking Pool.\r
+*\r
+* SYNOPSIS\r
+*/\r
+static inline void\r
+cl_qlock_pool_construct(\r
+ IN cl_qlock_pool_t* const p_pool )\r
+{\r
+ cl_qpool_construct( &p_pool->pool );\r
+ cl_spinlock_construct( &p_pool->lock );\r
+}\r
+\r
+/*\r
+* PARAMETERS\r
+* p_pool\r
+* [in] Pointer to a Quick Locking Pool to construct.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* Allows calling cl_qlock_pool_init, cl_qlock_pool_destroy\r
+*\r
+* Calling cl_qlock_pool_construct is a prerequisite to calling any other\r
+* method except cl_qlock_pool_init.\r
+*\r
+* SEE ALSO\r
+* Quick Locking Pool, cl_qlock_pool_init, cl_qlock_pool_destroy\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick Locking Pool/cl_qlock_pool_destroy\r
+* NAME\r
+* cl_qlock_pool_destroy\r
+*\r
+* DESCRIPTION\r
+* The cl_qlock_pool_destroy function destroys a node, releasing\r
+* all resources.\r
+*\r
+* SYNOPSIS\r
+*/\r
+static inline void\r
+cl_qlock_pool_destroy(\r
+ IN cl_qlock_pool_t* const p_pool )\r
+{\r
+ /*\r
+ If the pool has already been put into use, grab the lock\r
+ to sync with other threads before we blow everything away.\r
+ */\r
+ if( cl_is_qpool_inited( &p_pool->pool ) )\r
+ {\r
+ cl_spinlock_acquire( &p_pool->lock );\r
+ cl_qpool_destroy( &p_pool->pool );\r
+ cl_spinlock_release( &p_pool->lock );\r
+ }\r
+ else\r
+ cl_qpool_destroy( &p_pool->pool );\r
+\r
+ cl_spinlock_destroy( &p_pool->lock );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_pool\r
+* [in] Pointer to a Quick Locking Pool to destroy.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* Performs any necessary cleanup of the specified Quick Locking Pool.\r
+* Further operations should not be attempted on the destroyed object.\r
+* This function should only be called after a call to\r
+* cl_qlock_pool_construct or cl_qlock_pool_init.\r
+*\r
+* SEE ALSO\r
+* Quick Locking Pool, cl_qlock_pool_construct, cl_qlock_pool_init\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick Locking Pool/cl_qlock_pool_init\r
+* NAME\r
+* cl_qlock_pool_init\r
+*\r
+* DESCRIPTION\r
+* The cl_qlock_pool_init function initializes a Quick Locking Pool for use.\r
+*\r
+* SYNOPSIS\r
+*/\r
+static inline cl_status_t\r
+cl_qlock_pool_init(\r
+ IN cl_qlock_pool_t* const p_pool,\r
+ IN const size_t min_size,\r
+ IN const size_t max_size,\r
+ IN const size_t grow_size,\r
+ IN const size_t object_size,\r
+ IN cl_pfn_qpool_init_t pfn_initializer OPTIONAL,\r
+ IN cl_pfn_qpool_dtor_t pfn_destructor OPTIONAL,\r
+ IN const void* const context )\r
+{\r
+ cl_status_t status;\r
+\r
+ cl_qlock_pool_construct( p_pool );\r
+\r
+ status = cl_spinlock_init( &p_pool->lock );\r
+ if( status )\r
+ return( status );\r
+\r
+ status = cl_qpool_init( &p_pool->pool, min_size, max_size, grow_size,\r
+ object_size, pfn_initializer, pfn_destructor, context );\r
+\r
+ return( status );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_pool\r
+* [in] Pointer to an cl_qlock_pool_t object to initialize.\r
+*\r
+* min_size\r
+* [in] Minimum number of objects that the pool should support. All\r
+* necessary allocations to allow storing the minimum number of items\r
+* are performed at initialization time, and all necessary callbacks\r
+* successfully invoked.\r
+*\r
+* max_size\r
+* [in] Maximum number of objects to which the pool is allowed to grow.\r
+* A value of zero specifies no maximum.\r
+*\r
+* grow_size\r
+* [in] Number of objects to allocate when incrementally growing the pool.\r
+* A value of zero disables automatic growth.\r
+*\r
+* object_size\r
+* [in] Size, in bytes, of each object.\r
+*\r
+* pfn_initializer\r
+* [in] Initialization callback to invoke for every new object when\r
+* growing the pool. This parameter is optional and may be NULL. If NULL,\r
+* the pool assumes the cl_pool_item_t structure describing objects is\r
+* located at the head of each object. See the cl_pfn_qpool_init_t\r
+* function type declaration for details about the callback function.\r
+*\r
+* pfn_destructor\r
+* [in] Destructor callback to invoke for every object before memory for\r
+* that object is freed. This parameter is optional and may be NULL.\r
+* See the cl_pfn_qpool_dtor_t function type declaration for details\r
+* about the callback function.\r
+*\r
+* context\r
+* [in] Value to pass to the callback functions to provide context.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if the quick pool was initialized successfully.\r
+*\r
+* CL_INSUFFICIENT_MEMORY if there was not enough memory to initialize the\r
+* quick pool.\r
+*\r
+* CL_INVALID_SETTING if a the maximum size is non-zero and less than the\r
+* minimum size.\r
+*\r
+* Other cl_status_t value returned by optional initialization callback function\r
+* specified by the pfn_initializer parameter.\r
+*\r
+* NOTES\r
+* Allows calling other Quick Locking Pool methods.\r
+*\r
+* SEE ALSO\r
+* Quick Locking Pool, cl_qlock_pool_construct, cl_qlock_pool_destroy\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick Locking Pool/cl_qlock_pool_get\r
+* NAME\r
+* cl_qlock_pool_get\r
+*\r
+* DESCRIPTION\r
+* Gets an object wrapper and wire MAD from the pool.\r
+*\r
+* SYNOPSIS\r
+*/\r
+static inline cl_pool_item_t*\r
+cl_qlock_pool_get(\r
+ IN cl_qlock_pool_t* const p_pool )\r
+{\r
+ cl_pool_item_t* p_item;\r
+ cl_spinlock_acquire( &p_pool->lock );\r
+ p_item = cl_qpool_get( &p_pool->pool );\r
+ cl_spinlock_release( &p_pool->lock );\r
+ return( p_item );\r
+}\r
+\r
+/*\r
+* PARAMETERS\r
+* p_pool\r
+* [in] Pointer to an cl_qlock_pool_t object.\r
+*\r
+* RETURN VALUES\r
+* Returns a pointer to a cl_pool_item_t contained in the user object.\r
+*\r
+* NOTES\r
+* The object must eventually be returned to the pool with a call to\r
+* cl_qlock_pool_put.\r
+*\r
+* The cl_qlock_pool_construct or cl_qlock_pool_init must be called before\r
+* using this function.\r
+*\r
+* SEE ALSO\r
+* Quick Locking Pool, cl_qlock_pool_put\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick Locking Pool/cl_qlock_pool_put\r
+* NAME\r
+* cl_qlock_pool_put\r
+*\r
+* DESCRIPTION\r
+* Returns an object to the pool.\r
+*\r
+* SYNOPSIS\r
+*/\r
+static inline void\r
+cl_qlock_pool_put(\r
+ IN cl_qlock_pool_t* const p_pool,\r
+ IN cl_pool_item_t* const p_item )\r
+{\r
+ cl_spinlock_acquire( &p_pool->lock );\r
+ cl_qpool_put( &p_pool->pool, p_item );\r
+ cl_spinlock_release( &p_pool->lock );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_pool\r
+* [in] Pointer to an cl_qlock_pool_t object.\r
+*\r
+* p_item\r
+* [in] Pointer to the cl_pool_item_t in an object that was previously\r
+* retrieved from the pool.\r
+*\r
+* RETURN VALUES\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* The cl_qlock_pool_construct or cl_qlock_pool_init must be called before\r
+* using this function.\r
+*\r
+* SEE ALSO\r
+* Quick Locking Pool, cl_qlock_pool_get\r
+*********/\r
+\r
+\r
+#ifdef __cplusplus\r
+} /* extern "C" */\r
+#endif\r
+\r
+#endif /* _CL_QLOCKPOOL_H_ */\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. \r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+/*\r
+ * Abstract:\r
+ * Declaration of quick map, a binary tree where the caller always provides\r
+ * all necessary storage.\r
+ *\r
+ * Environment:\r
+ * All\r
+ */\r
+\r
+\r
+#ifndef _CL_QMAP_H_\r
+#define _CL_QMAP_H_\r
+\r
+\r
+#include <complib/cl_rbmap.h>\r
+#include <complib/cl_qpool.h>\r
+\r
+\r
+/****h* Component Library/Quick Map\r
+* NAME\r
+* Quick Map\r
+*\r
+* DESCRIPTION\r
+* Quick map implements a binary tree that stores user provided cl_map_item_t\r
+* structures. Each item stored in a quick map has a unique 64-bit key\r
+* (duplicates are not allowed). Quick map provides the ability to\r
+* efficiently search for an item given a key.\r
+*\r
+* Quick map does not allocate any memory, and can therefore not fail\r
+* any operations due to insufficient memory. Quick map can thus be useful\r
+* in minimizing the error paths in code.\r
+*\r
+* Quick map is not thread safe, and users must provide serialization when\r
+* adding and removing items from the map.\r
+*\r
+* The quick map functions operate on a cl_qmap_t structure which should be\r
+* treated as opaque and should be manipulated only through the provided\r
+* functions.\r
+*\r
+* SEE ALSO\r
+* Structures:\r
+* cl_qmap_t, cl_map_item_t, cl_map_obj_t\r
+*\r
+* Callbacks:\r
+* cl_pfn_qmap_apply_t\r
+*\r
+* Item Manipulation:\r
+* cl_qmap_set_obj, cl_qmap_obj, cl_qmap_key\r
+*\r
+* Initialization:\r
+* cl_qmap_init\r
+*\r
+* Iteration:\r
+* cl_qmap_end, cl_qmap_head, cl_qmap_tail, cl_qmap_next, cl_qmap_prev\r
+*\r
+* Manipulation:\r
+* cl_qmap_insert, cl_qmap_get, cl_qmap_remove_item, cl_qmap_remove,\r
+* cl_qmap_remove_all, cl_qmap_merge, cl_qmap_delta\r
+*\r
+* Search:\r
+* cl_qmap_apply_func\r
+*\r
+* Attributes:\r
+* cl_qmap_count, cl_is_qmap_empty,\r
+*********/\r
+\r
+\r
+/****s* Component Library: Quick Map/cl_map_item_t\r
+* NAME\r
+* cl_map_item_t\r
+*\r
+* DESCRIPTION\r
+* The cl_map_item_t structure is used by maps to store objects.\r
+*\r
+* The cl_map_item_t structure should be treated as opaque and should\r
+* be manipulated only through the provided functions.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _cl_map_item\r
+{\r
+ /* Must be first to allow casting. */\r
+ cl_pool_item_t pool_item;\r
+ struct _cl_map_item *p_left;\r
+ struct _cl_map_item *p_right;\r
+ struct _cl_map_item *p_up;\r
+ cl_map_color_t color;\r
+ uint64_t key;\r
+#ifdef _DEBUG_\r
+ struct _cl_qmap *p_map;\r
+#endif\r
+\r
+} cl_map_item_t;\r
+/*\r
+* FIELDS\r
+* pool_item\r
+* Used to store the item in a doubly linked list, allowing more\r
+* efficient map traversal.\r
+*\r
+* p_left\r
+* Pointer to the map item that is a child to the left of the node.\r
+*\r
+* p_right\r
+* Pointer to the map item that is a child to the right of the node.\r
+*\r
+* p_up\r
+* Pointer to the map item that is the parent of the node.\r
+*\r
+* p_nil\r
+* Pointer to the map's NIL item, used as a terminator for leaves.\r
+* The NIL sentinel is in the cl_qmap_t structure.\r
+*\r
+* color\r
+* Indicates whether a node is red or black in the map.\r
+*\r
+* key\r
+* Value that uniquely represents a node in a map. This value is set by\r
+* calling cl_qmap_insert and can be retrieved by calling cl_qmap_key.\r
+*\r
+* NOTES\r
+* None of the fields of this structure should be manipulated by users, as\r
+* they are crititcal to the proper operation of the map in which they\r
+* are stored.\r
+*\r
+* To allow storing items in either a quick list, a quick pool, or a quick\r
+* map, the map implementation guarantees that the map item can be safely\r
+* cast to a pool item used for storing an object in a quick pool, or cast to\r
+* a list item used for storing an object in a quick list. This removes the\r
+* need to embed a map item, a list item, and a pool item in objects that need\r
+* to be stored in a quick list, a quick pool, and a quick map.\r
+*\r
+* SEE ALSO\r
+* Quick Map, cl_qmap_insert, cl_qmap_key, cl_pool_item_t, cl_list_item_t\r
+*********/\r
+\r
+\r
+/****s* Component Library: Quick Map/cl_map_obj_t\r
+* NAME\r
+* cl_map_obj_t\r
+*\r
+* DESCRIPTION\r
+* The cl_map_obj_t structure is used to store objects in maps.\r
+*\r
+* The cl_map_obj_t structure should be treated as opaque and should\r
+* be manipulated only through the provided functions.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _cl_map_obj\r
+{\r
+ cl_map_item_t item;\r
+ const void *p_object;\r
+\r
+} cl_map_obj_t;\r
+/*\r
+* FIELDS\r
+* item\r
+* Map item used by internally by the map to store an object.\r
+*\r
+* p_object\r
+* User defined context. Users should not access this field directly.\r
+* Use cl_qmap_set_obj and cl_qmap_obj to set and retrieve the value\r
+* of this field.\r
+*\r
+* NOTES\r
+* None of the fields of this structure should be manipulated by users, as\r
+* they are crititcal to the proper operation of the map in which they\r
+* are stored.\r
+*\r
+* Use cl_qmap_set_obj and cl_qmap_obj to set and retrieve the object\r
+* stored in a map item, respectively.\r
+*\r
+* SEE ALSO\r
+* Quick Map, cl_qmap_set_obj, cl_qmap_obj, cl_map_item_t\r
+*********/\r
+\r
+\r
+/****s* Component Library: Quick Map/cl_qmap_t\r
+* NAME\r
+* cl_qmap_t\r
+*\r
+* DESCRIPTION\r
+* Quick map structure.\r
+*\r
+* The cl_qmap_t structure should be treated as opaque and should\r
+* be manipulated only through the provided functions.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _cl_qmap\r
+{\r
+ cl_map_item_t root;\r
+ cl_map_item_t nil;\r
+ cl_state_t state;\r
+ size_t count;\r
+\r
+} cl_qmap_t;\r
+/*\r
+* PARAMETERS\r
+* root\r
+* Map item that serves as root of the map. The root is set up to\r
+* always have itself as parent. The left pointer is set to point to\r
+* the item at the root.\r
+*\r
+* nil\r
+* Map item that serves as terminator for all leaves, as well as providing\r
+* the list item used as quick list for storing map items in a list for\r
+* faster traversal.\r
+*\r
+* state\r
+* State of the map, used to verify that operations are permitted.\r
+*\r
+* count\r
+* Number of items in the map.\r
+*\r
+* SEE ALSO\r
+* Quick Map\r
+*********/\r
+\r
+\r
+/****d* Component Library: Quick Map/cl_pfn_qmap_apply_t\r
+* NAME\r
+* cl_pfn_qmap_apply_t\r
+*\r
+* DESCRIPTION\r
+* The cl_pfn_qmap_apply_t function type defines the prototype for functions\r
+* used to iterate items in a quick map.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef void\r
+(CL_API *cl_pfn_qmap_apply_t)(\r
+ IN cl_map_item_t* const p_map_item,\r
+ IN void* context );\r
+/*\r
+* PARAMETERS\r
+* p_map_item\r
+* [in] Pointer to a cl_map_item_t structure.\r
+*\r
+* context\r
+* [in] Value passed to the callback function.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* This function type is provided as function prototype reference for the\r
+* function provided by users as a parameter to the cl_qmap_apply_func\r
+* function.\r
+*\r
+* SEE ALSO\r
+* Quick Map, cl_qmap_apply_func\r
+*********/\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
+\r
+/****f* Component Library: Quick Map/cl_qmap_count\r
+* NAME\r
+* cl_qmap_count\r
+*\r
+* DESCRIPTION\r
+* The cl_qmap_count function returns the number of items stored\r
+* in a quick map.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE size_t CL_API\r
+cl_qmap_count(\r
+ IN const cl_qmap_t* const p_map )\r
+{\r
+ CL_ASSERT( p_map );\r
+ CL_ASSERT( p_map->state == CL_INITIALIZED );\r
+ return( p_map->count );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_map\r
+* [in] Pointer to a cl_qmap_t structure whose item count to return.\r
+*\r
+* RETURN VALUE\r
+* Returns the number of items stored in the map.\r
+*\r
+* SEE ALSO\r
+* Quick Map, cl_is_qmap_empty\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick Map/cl_is_qmap_empty\r
+* NAME\r
+* cl_is_qmap_empty\r
+*\r
+* DESCRIPTION\r
+* The cl_is_qmap_empty function returns whether a quick map is empty.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE boolean_t CL_API\r
+cl_is_qmap_empty(\r
+ IN const cl_qmap_t* const p_map )\r
+{\r
+ CL_ASSERT( p_map );\r
+ CL_ASSERT( p_map->state == CL_INITIALIZED );\r
+\r
+ return( p_map->count == 0 );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_map\r
+* [in] Pointer to a cl_qmap_t structure to test for emptiness.\r
+*\r
+* RETURN VALUES\r
+* TRUE if the quick map is empty.\r
+*\r
+* FALSE otherwise.\r
+*\r
+* SEE ALSO\r
+* Quick Map, cl_qmap_count, cl_qmap_remove_all\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick Map/cl_qmap_set_obj\r
+* NAME\r
+* cl_qmap_set_obj\r
+*\r
+* DESCRIPTION\r
+* The cl_qmap_set_obj function sets the object stored in a map object.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE void CL_API\r
+cl_qmap_set_obj(\r
+ IN cl_map_obj_t* const p_map_obj,\r
+ IN const void* const p_object )\r
+{\r
+ CL_ASSERT( p_map_obj );\r
+ p_map_obj->p_object = p_object;\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_map_obj\r
+* [in] Pointer to a map object stucture whose object pointer\r
+* is to be set.\r
+*\r
+* p_object\r
+* [in] User defined context.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* SEE ALSO\r
+* Quick Map, cl_qmap_obj\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick Map/cl_qmap_obj\r
+* NAME\r
+* cl_qmap_obj\r
+*\r
+* DESCRIPTION\r
+* The cl_qmap_obj function returns the object stored in a map object.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE void* CL_API\r
+cl_qmap_obj(\r
+ IN const cl_map_obj_t* const p_map_obj )\r
+{\r
+ CL_ASSERT( p_map_obj );\r
+ return( (void*)p_map_obj->p_object );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_map_obj\r
+* [in] Pointer to a map object stucture whose object pointer to return.\r
+*\r
+* RETURN VALUE\r
+* Returns the value of the object pointer stored in the map object.\r
+*\r
+* SEE ALSO\r
+* Quick Map, cl_qmap_set_obj\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick Map/cl_qmap_key\r
+* NAME\r
+* cl_qmap_key\r
+*\r
+* DESCRIPTION\r
+* The cl_qmap_key function retrieves the key value of a map item.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE uint64_t CL_API\r
+cl_qmap_key(\r
+ IN const cl_map_item_t* const p_item )\r
+{\r
+ CL_ASSERT( p_item );\r
+ return( p_item->key );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_item\r
+* [in] Pointer to a map item whose key value to return.\r
+*\r
+* RETURN VALUE\r
+* Returns the 64-bit key value for the specified map item.\r
+*\r
+* NOTES\r
+* The key value is set in a call to cl_qmap_insert.\r
+*\r
+* SEE ALSO\r
+* Quick Map, cl_qmap_insert\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick Map/cl_qmap_init\r
+* NAME\r
+* cl_qmap_init\r
+*\r
+* DESCRIPTION\r
+* The cl_qmap_init function initialized a quick map for use.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_qmap_init(\r
+ IN cl_qmap_t* const p_map );\r
+/*\r
+* PARAMETERS\r
+* p_map\r
+* [in] Pointer to a cl_qmap_t structure to initialize.\r
+*\r
+* RETURN VALUES\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* Allows calling quick map manipulation functions.\r
+*\r
+* SEE ALSO\r
+* Quick Map, cl_qmap_insert, cl_qmap_remove\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick Map/cl_qmap_end\r
+* NAME\r
+* cl_qmap_end\r
+*\r
+* DESCRIPTION\r
+* The cl_qmap_end function returns the end of a quick map.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE const cl_map_item_t* const CL_API\r
+cl_qmap_end(\r
+ IN const cl_qmap_t* const p_map )\r
+{\r
+ CL_ASSERT( p_map );\r
+ CL_ASSERT( p_map->state == CL_INITIALIZED );\r
+ /* Nil is the end of the map. */\r
+ return( &p_map->nil );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_map\r
+* [in] Pointer to a cl_qmap_t structure whose end to return.\r
+*\r
+* RETURN VALUE\r
+* Pointer to the end of the map.\r
+*\r
+* NOTES\r
+* cl_qmap_end is useful for determining the validity of map items returned\r
+* by cl_qmap_head, cl_qmap_tail, cl_qmap_next, or cl_qmap_prev. If the map\r
+* item pointer returned by any of these functions compares to the end, the\r
+* end of the map was encoutered.\r
+* When using cl_qmap_head or cl_qmap_tail, this condition indicates that\r
+* the map is empty.\r
+*\r
+* SEE ALSO\r
+* Quick Map, cl_qmap_head, cl_qmap_tail, cl_qmap_next, cl_qmap_prev\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick Map/cl_qmap_head\r
+* NAME\r
+* cl_qmap_head\r
+*\r
+* DESCRIPTION\r
+* The cl_qmap_head function returns the map item with the lowest key\r
+* value stored in a quick map.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE cl_map_item_t* CL_API\r
+cl_qmap_head(\r
+ IN const cl_qmap_t* const p_map )\r
+{\r
+ CL_ASSERT( p_map );\r
+ CL_ASSERT( p_map->state == CL_INITIALIZED );\r
+ return( (cl_map_item_t*)p_map->nil.pool_item.list_item.p_next );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_map\r
+* [in] Pointer to a cl_qmap_t structure whose item with the lowest key\r
+* is returned.\r
+*\r
+* RETURN VALUES\r
+* Pointer to the map item with the lowest key in the quick map.\r
+*\r
+* Pointer to the map end if the quick map was empty.\r
+*\r
+* NOTES\r
+* cl_qmap_head does not remove the item from the map.\r
+*\r
+* SEE ALSO\r
+* Quick Map, cl_qmap_tail, cl_qmap_next, cl_qmap_prev, cl_qmap_end,\r
+* cl_qmap_item_t\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick Map/cl_qmap_tail\r
+* NAME\r
+* cl_qmap_tail\r
+*\r
+* DESCRIPTION\r
+* The cl_qmap_tail function returns the map item with the highest key\r
+* value stored in a quick map.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE cl_map_item_t* CL_API\r
+cl_qmap_tail(\r
+ IN const cl_qmap_t* const p_map )\r
+{\r
+ CL_ASSERT( p_map );\r
+ CL_ASSERT( p_map->state == CL_INITIALIZED );\r
+ return( (cl_map_item_t*)p_map->nil.pool_item.list_item.p_prev );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_map\r
+* [in] Pointer to a cl_qmap_t structure whose item with the highest key\r
+* is returned.\r
+*\r
+* RETURN VALUES\r
+* Pointer to the map item with the highest key in the quick map.\r
+*\r
+* Pointer to the map end if the quick map was empty.\r
+*\r
+* NOTES\r
+* cl_qmap_end does not remove the item from the map.\r
+*\r
+* SEE ALSO\r
+* Quick Map, cl_qmap_head, cl_qmap_next, cl_qmap_prev, cl_qmap_end,\r
+* cl_qmap_item_t\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick Map/cl_qmap_next\r
+* NAME\r
+* cl_qmap_next\r
+*\r
+* DESCRIPTION\r
+* The cl_qmap_next function returns the map item with the next higher\r
+* key value than a specified map item.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE cl_map_item_t* CL_API\r
+cl_qmap_next(\r
+ IN const cl_map_item_t* const p_item )\r
+{\r
+ CL_ASSERT( p_item );\r
+ return( (cl_map_item_t*)p_item->pool_item.list_item.p_next );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_item\r
+* [in] Pointer to a map item whose successor to return.\r
+*\r
+* RETURN VALUES\r
+* Pointer to the map item with the next higher key value in a quick map.\r
+*\r
+* Pointer to the map end if the specified item was the last item in\r
+* the quick map.\r
+*\r
+* SEE ALSO\r
+* Quick Map, cl_qmap_head, cl_qmap_tail, cl_qmap_prev, cl_qmap_end,\r
+* cl_map_item_t\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick Map/cl_qmap_prev\r
+* NAME\r
+* cl_qmap_prev\r
+*\r
+* DESCRIPTION\r
+* The cl_qmap_prev function returns the map item with the next lower\r
+* key value than a precified map item.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE cl_map_item_t* CL_API\r
+cl_qmap_prev(\r
+ IN const cl_map_item_t* const p_item )\r
+{\r
+ CL_ASSERT( p_item );\r
+ return( (cl_map_item_t*)p_item->pool_item.list_item.p_prev );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_item\r
+* [in] Pointer to a map item whose predecessor to return.\r
+*\r
+* RETURN VALUES\r
+* Pointer to the map item with the next lower key value in a quick map.\r
+*\r
+* Pointer to the map end if the specifid item was the first item in\r
+* the quick map.\r
+*\r
+* SEE ALSO\r
+* Quick Map, cl_qmap_head, cl_qmap_tail, cl_qmap_next, cl_qmap_end,\r
+* cl_map_item_t\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick Map/cl_qmap_insert\r
+* NAME\r
+* cl_qmap_insert\r
+*\r
+* DESCRIPTION\r
+* The cl_qmap_insert function inserts a map item into a quick map.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_map_item_t* CL_API\r
+cl_qmap_insert(\r
+ IN cl_qmap_t* const p_map,\r
+ IN const uint64_t key,\r
+ IN cl_map_item_t* const p_item );\r
+/*\r
+* PARAMETERS\r
+* p_map\r
+* [in] Pointer to a cl_qmap_t structure into which to add the item.\r
+*\r
+* key\r
+* [in] Value to assign to the item.\r
+*\r
+* p_item\r
+* [in] Pointer to a cl_map_item_t stucture to insert into the quick map.\r
+*\r
+* RETURN VALUE\r
+* Pointer to the item in the map with the specified key. If insertion\r
+* was successful, this is the pointer to the item. If an item with the\r
+* specified key already exists in the map, the pointer to that item is\r
+* returned.\r
+*\r
+* NOTES\r
+* Insertion operations may cause the quick map to rebalance.\r
+*\r
+* SEE ALSO\r
+* Quick Map, cl_qmap_remove, cl_map_item_t\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick Map/cl_qmap_get\r
+* NAME\r
+* cl_qmap_get\r
+*\r
+* DESCRIPTION\r
+* The cl_qmap_get function returns the map item associated with a key.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_map_item_t* CL_API\r
+cl_qmap_get(\r
+ IN const cl_qmap_t* const p_map,\r
+ IN const uint64_t key );\r
+/*\r
+* PARAMETERS\r
+* p_map\r
+* [in] Pointer to a cl_qmap_t structure from which to retrieve the\r
+* item with the specified key.\r
+*\r
+* key\r
+* [in] Key value used to search for the desired map item.\r
+*\r
+* RETURN VALUES\r
+* Pointer to the map item with the desired key value.\r
+*\r
+* Pointer to the map end if there was no item with the desired key value\r
+* stored in the quick map.\r
+*\r
+* NOTES\r
+* cl_qmap_get does not remove the item from the quick map.\r
+*\r
+* SEE ALSO\r
+* Quick Map, cl_qmap_remove\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick Map/cl_qmap_remove_item\r
+* NAME\r
+* cl_qmap_remove_item\r
+*\r
+* DESCRIPTION\r
+* The cl_qmap_remove_item function removes the specified map item\r
+* from a quick map.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_qmap_remove_item(\r
+ IN cl_qmap_t* const p_map,\r
+ IN cl_map_item_t* const p_item );\r
+/*\r
+* PARAMETERS\r
+* p_item\r
+* [in] Pointer to a map item to remove from its quick map.\r
+*\r
+* RETURN VALUES\r
+* This function does not return a value.\r
+*\r
+* In a debug build, cl_qmap_remove_item asserts that the item being removed\r
+* is in the specified map.\r
+*\r
+* NOTES\r
+* Removes the map item pointed to by p_item from its quick map.\r
+*\r
+* SEE ALSO\r
+* Quick Map, cl_qmap_remove, cl_qmap_remove_all, cl_qmap_insert\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick Map/cl_qmap_remove\r
+* NAME\r
+* cl_qmap_remove\r
+*\r
+* DESCRIPTION\r
+* The cl_qmap_remove function removes the map item with the specified key\r
+* from a quick map.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_map_item_t* CL_API\r
+cl_qmap_remove(\r
+ IN cl_qmap_t* const p_map,\r
+ IN const uint64_t key );\r
+/*\r
+* PARAMETERS\r
+* p_map\r
+* [in] Pointer to a cl_qmap_t structure from which to remove the item\r
+* with the specified key.\r
+*\r
+* key\r
+* [in] Key value used to search for the map item to remove.\r
+*\r
+* RETURN VALUES\r
+* Pointer to the removed map item if it was found.\r
+*\r
+* Pointer to the map end if no item with the specified key exists in the\r
+* quick map.\r
+*\r
+* SEE ALSO\r
+* Quick Map, cl_qmap_remove_item, cl_qmap_remove_all, cl_qmap_insert\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick Map/cl_qmap_remove_all\r
+* NAME\r
+* cl_qmap_remove_all\r
+*\r
+* DESCRIPTION\r
+* The cl_qmap_remove_all function removes all items in a quick map,\r
+* leaving it empty.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE void CL_API\r
+cl_qmap_remove_all(\r
+ IN cl_qmap_t* const p_map )\r
+{\r
+ CL_ASSERT( p_map );\r
+ CL_ASSERT( p_map->state == CL_INITIALIZED );\r
+\r
+ p_map->root.p_left = &p_map->nil;\r
+ p_map->nil.pool_item.list_item.p_next = &p_map->nil.pool_item.list_item;\r
+ p_map->nil.pool_item.list_item.p_prev = &p_map->nil.pool_item.list_item;\r
+ p_map->count = 0;\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_map\r
+* [in] Pointer to a cl_qmap_t structure to empty.\r
+*\r
+* RETURN VALUES\r
+* This function does not return a value.\r
+*\r
+* SEE ALSO\r
+* Quick Map, cl_qmap_remove, cl_qmap_remove_item\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick Map/cl_qmap_merge\r
+* NAME\r
+* cl_qmap_merge\r
+*\r
+* DESCRIPTION\r
+* The cl_qmap_merge function moves all items from one map to another,\r
+* excluding duplicates.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_qmap_merge(\r
+ OUT cl_qmap_t* const p_dest_map,\r
+ IN OUT cl_qmap_t* const p_src_map );\r
+/*\r
+* PARAMETERS\r
+* p_dest_map\r
+* [out] Pointer to a cl_qmap_t structure to which items should be added.\r
+*\r
+* p_src_map\r
+* [in/out] Pointer to a cl_qmap_t structure whose items to add\r
+* to p_dest_map.\r
+*\r
+* RETURN VALUES\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* Items are evaluated based on their keys only.\r
+*\r
+* Upon return from cl_qmap_merge, the quick map referenced by p_src_map\r
+* contains all duplicate items.\r
+*\r
+* SEE ALSO\r
+* Quick Map, cl_qmap_delta\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick Map/cl_qmap_delta\r
+* NAME\r
+* cl_qmap_delta\r
+*\r
+* DESCRIPTION\r
+* The cl_qmap_delta function computes the differences between two maps.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_qmap_delta(\r
+ IN OUT cl_qmap_t* const p_map1,\r
+ IN OUT cl_qmap_t* const p_map2,\r
+ OUT cl_qmap_t* const p_new,\r
+ OUT cl_qmap_t* const p_old );\r
+/*\r
+* PARAMETERS\r
+* p_map1\r
+* [in/out] Pointer to the first of two cl_qmap_t structures whose\r
+* differences to compute.\r
+*\r
+* p_map2\r
+* [in/out] Pointer to the second of two cl_qmap_t structures whose\r
+* differences to compute.\r
+*\r
+* p_new\r
+* [out] Pointer to an empty cl_qmap_t structure that contains the items\r
+* unique to p_map2 upon return from the function.\r
+*\r
+* p_old\r
+* [out] Pointer to an empty cl_qmap_t structure that contains the items\r
+* unique to p_map1 upon return from the function.\r
+*\r
+* RETURN VALUES\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* Items are evaluated based on their keys. Items that exist in both\r
+* p_map1 and p_map2 remain in their respective maps. Items that\r
+* exist only p_map1 are moved to p_old. Likewise, items that exist only\r
+* in p_map2 are moved to p_new. This function can be usefull in evaluating\r
+* changes between two maps.\r
+*\r
+* Both maps pointed to by p_new and p_old must be empty on input. This\r
+* requirement removes the possibility of failures.\r
+*\r
+* SEE ALSO\r
+* Quick Map, cl_qmap_merge\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick Map/cl_qmap_apply_func\r
+* NAME\r
+* cl_qmap_apply_func\r
+*\r
+* DESCRIPTION\r
+* The cl_qmap_apply_func function executes a specified function\r
+* for every item stored in a quick map.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_qmap_apply_func(\r
+ IN const cl_qmap_t* const p_map,\r
+ IN cl_pfn_qmap_apply_t pfn_func,\r
+ IN const void* const context );\r
+/*\r
+* PARAMETERS\r
+* p_map\r
+* [in] Pointer to a cl_qmap_t structure.\r
+*\r
+* pfn_func\r
+* [in] Function invoked for every item in the quick map.\r
+* See the cl_pfn_qmap_apply_t function type declaration for details\r
+* about the callback function.\r
+*\r
+* context\r
+* [in] Value to pass to the callback functions to provide context.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* The function provided must not perform any map operations, as these\r
+* would corrupt the quick map.\r
+*\r
+* SEE ALSO\r
+* Quick Map, cl_pfn_qmap_apply_t\r
+*********/\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+\r
+\r
+#endif /* _CL_QMAP_H_ */\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. \r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+/*\r
+ * Abstract:\r
+ * Declaration of the quick pool.\r
+ * The quick pool manages a pool of objects.\r
+ * The pool can grow to meet demand, limited only by system memory.\r
+ *\r
+ * Environment:\r
+ * All\r
+ */\r
+\r
+\r
+#ifndef _CL_QUICK_POOL_H_\r
+#define _CL_QUICK_POOL_H_\r
+\r
+\r
+#include <complib/cl_qcomppool.h>\r
+\r
+\r
+/****h* Component Library/Quick Pool\r
+* NAME\r
+* Quick Pool\r
+*\r
+* DESCRIPTION\r
+* The quick pool provides a self-contained and self-sustaining pool\r
+* of user defined objects.\r
+*\r
+* To aid in object oriented design, the quick pool provides the user\r
+* the ability to specify callbacks that are invoked for each object for\r
+* construction, initialization, and destruction. Constructor and destructor\r
+* callback functions may not fail.\r
+*\r
+* A quick pool does not return memory to the system as the user returns\r
+* objects to the pool. The only method of returning memory to the system is\r
+* to destroy the pool.\r
+*\r
+* The quick pool operates on cl_pool_item_t structures that describe\r
+* objects. This can provides for more efficient memory use and operation.\r
+* If using a cl_pool_item_t is not desired, the Pool provides similar\r
+* functionality but operates on opaque objects.\r
+*\r
+* The quick pool functions operates on a cl_qpool_t structure which should\r
+* be treated as opaque and should be manipulated only through the provided\r
+* functions.\r
+*\r
+* SEE ALSO\r
+* Structures:\r
+* cl_qpool_t, cl_pool_item_t\r
+*\r
+* Callbacks:\r
+* cl_pfn_qpool_init_t, cl_pfn_qpool_dtor_t\r
+*\r
+* Initialization/Destruction:\r
+* cl_qpool_construct, cl_qpool_init, cl_qpool_destroy\r
+*\r
+* Manipulation:\r
+* cl_qpool_get, cl_qpool_put, cl_qpool_put_list, cl_qpool_grow\r
+*\r
+* Attributes:\r
+* cl_is_qpool_inited, cl_qpool_count\r
+*********/\r
+\r
+\r
+/****d* Component Library: Quick Pool/cl_pfn_qpool_init_t\r
+* NAME\r
+* cl_pfn_qpool_init_t\r
+*\r
+* DESCRIPTION\r
+* The cl_pfn_qpool_init_t function type defines the prototype for\r
+* functions used as constructor for objects being allocated by a\r
+* quick pool.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef cl_status_t\r
+(CL_API *cl_pfn_qpool_init_t)(\r
+ IN void* const p_object,\r
+ IN void* context,\r
+ OUT cl_pool_item_t** const pp_pool_item );\r
+/*\r
+* PARAMETERS\r
+* p_object\r
+* [in] Pointer to an object to initialize.\r
+*\r
+* context\r
+* [in] Context provided in a call to cl_qpool_init.\r
+*\r
+* RETURN VALUES\r
+* Return CL_SUCCESS to indicate that initialization of the object\r
+* was successful and that initialization of further objects may continue.\r
+*\r
+* Other cl_status_t values will be returned by cl_qcpool_init\r
+* and cl_qcpool_grow.\r
+*\r
+* NOTES\r
+* This function type is provided as function prototype reference for\r
+* the function provided by the user as an optional parameter to the\r
+* cl_qpool_init function.\r
+*\r
+* The initializer is invoked once per allocated object, allowing the user\r
+* to perform any necessary initialization. Returning a status other than\r
+* CL_SUCCESS aborts a grow operation, initiated either through cl_qcpool_init\r
+* or cl_qcpool_grow, causing the initiating function to fail.\r
+* Any non-CL_SUCCESS status will be returned by the function that initiated\r
+* the grow operation.\r
+*\r
+* All memory for the object is pre-allocated. Users should include space in\r
+* their objects for the cl_pool_item_t structure that will represent the\r
+* object to avoid having to allocate that structure in the initialization\r
+* callback.\r
+*\r
+* When later performing a cl_qcpool_get call, the return value is a pointer\r
+* to the cl_pool_item_t returned by this function in the pp_pool_item\r
+* parameter. Users must set pp_pool_item to a valid pointer to the\r
+* cl_pool_item_t representing the object if they return CL_SUCCESS.\r
+*\r
+* SEE ALSO\r
+* Quick Pool, cl_qpool_init\r
+*********/\r
+\r
+\r
+/****d* Component Library: Quick Pool/cl_pfn_qpool_dtor_t\r
+* NAME\r
+* cl_pfn_qpool_dtor_t\r
+*\r
+* DESCRIPTION\r
+* The cl_pfn_qpool_dtor_t function type defines the prototype for\r
+* functions used as destructor for objects being deallocated by a\r
+* quick pool.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef void\r
+(CL_API *cl_pfn_qpool_dtor_t)(\r
+ IN const cl_pool_item_t* const p_pool_item,\r
+ IN void* context );\r
+/*\r
+* PARAMETERS\r
+* p_pool_item\r
+* [in] Pointer to a cl_pool_item_t structure representing an object.\r
+*\r
+* context\r
+* [in] Context provided in a call to cl_qpool_init.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* This function type is provided as function prototype reference for\r
+* the function provided by the user as an optional parameter to the\r
+* cl_qpool_init function.\r
+*\r
+* The destructor is invoked once per allocated object, allowing the user\r
+* to perform any necessary cleanup. Users should not attempt to deallocate\r
+* the memory for the object, as the quick pool manages object\r
+* allocation and deallocation.\r
+*\r
+* SEE ALSO\r
+* Quick Pool, cl_qpool_init\r
+*********/\r
+\r
+\r
+/****s* Component Library: Quick Pool/cl_qpool_t\r
+* NAME\r
+* cl_qpool_t\r
+*\r
+* DESCRIPTION\r
+* Quick pool structure.\r
+*\r
+* The cl_qpool_t structure should be treated as opaque and should be\r
+* manipulated only through the provided functions.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _cl_qpool\r
+{\r
+ cl_qcpool_t qcpool;\r
+ cl_pfn_qpool_init_t pfn_init;\r
+ cl_pfn_qpool_dtor_t pfn_dtor;\r
+ const void *context;\r
+\r
+} cl_qpool_t;\r
+/*\r
+* FIELDS\r
+* qcpool\r
+* Quick composite pool that manages all objects.\r
+*\r
+* pfn_init\r
+* Pointer to the user's initializer callback, used by the pool\r
+* to translate the quick composite pool's initializer callback to\r
+* a quick pool initializer callback.\r
+*\r
+* pfn_dtor\r
+* Pointer to the user's destructor callback, used by the pool\r
+* to translate the quick composite pool's destructor callback to\r
+* a quick pool destructor callback.\r
+*\r
+* context\r
+* User's provided context for callback functions, used by the pool\r
+* to when invoking callbacks.\r
+*\r
+* SEE ALSO\r
+* Quick Pool\r
+*********/\r
+\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif /* __cplusplus */\r
+\r
+\r
+/****f* Component Library: Quick Pool/cl_qpool_construct\r
+* NAME\r
+* cl_qpool_construct\r
+*\r
+* DESCRIPTION\r
+* The cl_qpool_construct function constructs a quick pool.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_qpool_construct(\r
+ IN cl_qpool_t* const p_pool );\r
+/*\r
+* PARAMETERS\r
+* p_pool\r
+* [in] Pointer to a cl_qpool_t structure whose state to initialize.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* Allows calling cl_qpool_init, cl_qpool_destroy, cl_is_qpool_inited.\r
+*\r
+* Calling cl_qpool_construct is a prerequisite to calling any other\r
+* quick pool function except cl_pool_init.\r
+*\r
+* SEE ALSO\r
+* Quick Pool, cl_qpool_init, cl_qpool_destroy, cl_is_qpool_inited.\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick Pool/cl_is_qpool_inited\r
+* NAME\r
+* cl_is_qpool_inited\r
+*\r
+* DESCRIPTION\r
+* The cl_is_qpool_inited function returns whether a quick pool was\r
+* successfully initialized.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE uint32_t CL_API\r
+cl_is_qpool_inited(\r
+ IN const cl_qpool_t* const p_pool )\r
+{\r
+ /* CL_ASSERT that a non-null pointer is provided. */\r
+ CL_ASSERT( p_pool );\r
+ return( cl_is_qcpool_inited( &p_pool->qcpool ) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_pool\r
+* [in] Pointer to a cl_qpool_t structure whose initialization state\r
+* to check.\r
+*\r
+* RETURN VALUES\r
+* TRUE if the quick pool was initialized successfully.\r
+*\r
+* FALSE otherwise.\r
+*\r
+* NOTES\r
+* Allows checking the state of a quick pool to determine if\r
+* invoking member functions is appropriate.\r
+*\r
+* SEE ALSO\r
+* Quick Pool\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick Pool/cl_qpool_init\r
+* NAME\r
+* cl_qpool_init\r
+*\r
+* DESCRIPTION\r
+* The cl_qpool_init function initializes a quick pool for use.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_status_t CL_API\r
+cl_qpool_init(\r
+ IN cl_qpool_t* const p_pool,\r
+ IN const size_t min_size,\r
+ IN const size_t max_size,\r
+ IN const size_t grow_size,\r
+ IN const size_t object_size,\r
+ IN cl_pfn_qpool_init_t pfn_initializer OPTIONAL,\r
+ IN cl_pfn_qpool_dtor_t pfn_destructor OPTIONAL,\r
+ IN const void* const context );\r
+/*\r
+* PARAMETERS\r
+* p_pool\r
+* [in] Pointer to a cl_qpool_t structure to initialize.\r
+*\r
+* min_size\r
+* [in] Minimum number of objects that the pool should support. All\r
+* necessary allocations to allow storing the minimum number of items\r
+* are performed at initialization time, and all necessary callbacks\r
+* successfully invoked.\r
+*\r
+* max_size\r
+* [in] Maximum number of objects to which the pool is allowed to grow.\r
+* A value of zero specifies no maximum.\r
+*\r
+* grow_size\r
+* [in] Number of objects to allocate when incrementally growing the pool.\r
+* A value of zero disables automatic growth.\r
+*\r
+* object_size\r
+* [in] Size, in bytes, of each object.\r
+*\r
+* pfn_initializer\r
+* [in] Initialization callback to invoke for every new object when\r
+* growing the pool. This parameter is optional and may be NULL. If NULL,\r
+* the pool assumes the cl_pool_item_t structure describing objects is\r
+* located at the head of each object. See the cl_pfn_qpool_init_t\r
+* function type declaration for details about the callback function.\r
+*\r
+* pfn_destructor\r
+* [in] Destructor callback to invoke for every object before memory for\r
+* that object is freed. This parameter is optional and may be NULL.\r
+* See the cl_pfn_qpool_dtor_t function type declaration for details\r
+* about the callback function.\r
+*\r
+* context\r
+* [in] Value to pass to the callback functions to provide context.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if the quick pool was initialized successfully.\r
+*\r
+* CL_INSUFFICIENT_MEMORY if there was not enough memory to initialize the\r
+* quick pool.\r
+*\r
+* CL_INVALID_SETTING if a the maximum size is non-zero and less than the\r
+* minimum size.\r
+*\r
+* Other cl_status_t value returned by optional initialization callback function\r
+* specified by the pfn_initializer parameter.\r
+*\r
+* NOTES\r
+* cl_qpool_init initializes, and if necessary, grows the pool to\r
+* the capacity desired.\r
+*\r
+* SEE ALSO\r
+* Quick Pool, cl_qpool_construct, cl_qpool_destroy,\r
+* cl_qpool_get, cl_qpool_put, cl_qpool_grow,\r
+* cl_qpool_count, cl_pfn_qpool_init_t, cl_pfn_qpool_init_t,\r
+* cl_pfn_qpool_dtor_t\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick Pool/cl_qpool_destroy\r
+* NAME\r
+* cl_qpool_destroy\r
+*\r
+* DESCRIPTION\r
+* The cl_qpool_destroy function destroys a quick pool.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE void CL_API\r
+cl_qpool_destroy(\r
+ IN cl_qpool_t* const p_pool )\r
+{\r
+ CL_ASSERT( p_pool );\r
+ cl_qcpool_destroy( &p_pool->qcpool );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_pool\r
+* [in] Pointer to a cl_qpool_t structure to destroy.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* All memory allocated for objects is freed. The destructor callback,\r
+* if any, will be invoked for every allocated object. Further operations\r
+* on the pool should not be attempted after cl_qpool_destroy\r
+* is invoked.\r
+*\r
+* This function should only be called after a call to\r
+* cl_qpool_construct or cl_qpool_init.\r
+*\r
+* In a debug build, cl_qpool_destroy asserts that all objects are in\r
+* the pool.\r
+*\r
+* SEE ALSO\r
+* Quick Pool, cl_qpool_construct, cl_qpool_init\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick Pool/cl_qpool_count\r
+* NAME\r
+* cl_qpool_count\r
+*\r
+* DESCRIPTION\r
+* The cl_qpool_count function returns the number of available objects\r
+* in a quick pool.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE size_t CL_API\r
+cl_qpool_count(\r
+ IN cl_qpool_t* const p_pool )\r
+{\r
+ CL_ASSERT( p_pool );\r
+ return( cl_qcpool_count( &p_pool->qcpool ) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_pool\r
+* [in] Pointer to a cl_qpool_t structure for which the number of\r
+* available objects is requested.\r
+*\r
+* RETURN VALUE\r
+* Returns the number of objects available in the specified quick pool.\r
+*\r
+* SEE ALSO\r
+* Quick Pool\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick Pool/cl_qpool_get\r
+* NAME\r
+* cl_qpool_get\r
+*\r
+* DESCRIPTION\r
+* The cl_qpool_get function retrieves an object from a\r
+* quick pool.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE cl_pool_item_t* CL_API\r
+cl_qpool_get(\r
+ IN cl_qpool_t* const p_pool )\r
+{\r
+ CL_ASSERT( p_pool );\r
+ return( cl_qcpool_get( &p_pool->qcpool ) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_pool\r
+* [in] Pointer to a cl_qpool_t structure from which to retrieve\r
+* an object.\r
+*\r
+* RETURN VALUES\r
+* Returns a pointer to a cl_pool_item_t for an object.\r
+*\r
+* Returns NULL if the pool is empty and can not be grown automatically.\r
+*\r
+* NOTES\r
+* cl_qpool_get returns the object at the head of the pool. If the pool is\r
+* empty, it is automatically grown to accommodate this request unless the\r
+* grow_size parameter passed to the cl_qpool_init function was zero.\r
+*\r
+* SEE ALSO\r
+* Quick Pool, cl_qpool_get_tail, cl_qpool_put, cl_qpool_grow, cl_qpool_count\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick Pool/cl_qpool_put\r
+* NAME\r
+* cl_qpool_put\r
+*\r
+* DESCRIPTION\r
+* The cl_qpool_put function returns an object to the head of a quick pool.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE void CL_API\r
+cl_qpool_put(\r
+ IN cl_qpool_t* const p_pool,\r
+ IN cl_pool_item_t* const p_pool_item )\r
+{\r
+ CL_ASSERT( p_pool );\r
+ cl_qcpool_put( &p_pool->qcpool, p_pool_item );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_pool\r
+* [in] Pointer to a cl_qpool_t structure to which to return\r
+* an object.\r
+*\r
+* p_pool_item\r
+* [in] Pointer to a cl_pool_item_t structure for the object\r
+* being returned.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* cl_qpool_put places the returned object at the head of the pool.\r
+*\r
+* The object specified by the p_pool_item parameter must have been\r
+* retrieved from the pool by a previous call to cl_qpool_get.\r
+*\r
+* SEE ALSO\r
+* Quick Pool, cl_qpool_put_tail, cl_qpool_get\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick Pool/cl_qpool_put_list\r
+* NAME\r
+* cl_qpool_put_list\r
+*\r
+* DESCRIPTION\r
+* The cl_qpool_put_list function returns a list of objects to the head\r
+* of a quick pool.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE void CL_API\r
+cl_qpool_put_list(\r
+ IN cl_qpool_t* const p_pool,\r
+ IN cl_qlist_t* const p_list )\r
+{\r
+ CL_ASSERT( p_pool );\r
+ cl_qcpool_put_list( &p_pool->qcpool, p_list );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_pool\r
+* [in] Pointer to a cl_qpool_t structure to which to return\r
+* a list of objects.\r
+*\r
+* p_list\r
+* [in] Pointer to a cl_qlist_t structure for the list of objects\r
+* being returned.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* cl_qpool_put_list places the returned objects at the head of the pool.\r
+*\r
+* The objects in the list specified by the p_list parameter must have been\r
+* retrieved from the pool by a previous call to cl_qpool_get.\r
+*\r
+* SEE ALSO\r
+* Quick Pool, cl_qpool_put, cl_qpool_put_tail, cl_qpool_get\r
+*********/\r
+\r
+\r
+/****f* Component Library: Quick Pool/cl_qpool_grow\r
+* NAME\r
+* cl_qpool_grow\r
+*\r
+* DESCRIPTION\r
+* The cl_qpool_grow function grows a quick pool by\r
+* the specified number of objects.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE cl_status_t CL_API\r
+cl_qpool_grow(\r
+ IN cl_qpool_t* const p_pool,\r
+ IN const size_t obj_count )\r
+{\r
+ CL_ASSERT( p_pool );\r
+ return( cl_qcpool_grow( &p_pool->qcpool, obj_count ) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_pool\r
+* [in] Pointer to a cl_qpool_t structure whose capacity to grow.\r
+*\r
+* obj_count\r
+* [in] Number of objects by which to grow the pool.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if the quick pool grew successfully.\r
+*\r
+* CL_INSUFFICIENT_MEMORY if there was not enough memory to grow the\r
+* quick pool.\r
+*\r
+* cl_status_t value returned by optional initialization callback function\r
+* specified by the pfn_initializer parameter passed to the\r
+* cl_qpool_init function.\r
+*\r
+* NOTES\r
+* It is not necessary to call cl_qpool_grow if the pool is\r
+* configured to grow automatically.\r
+*\r
+* SEE ALSO\r
+* Quick Pool\r
+*********/\r
+\r
+\r
+#ifdef __cplusplus\r
+} /* extern "C" */\r
+#endif /* __cplusplus */\r
+\r
+\r
+#endif /* _CL_QUICK_POOL_H_ */\r
--- /dev/null
+/*++\r
+Copyright © InfiniCon Systems, Inc. All rights reserved.\r
+\r
+THIS SOFTWARE IS PROVIDED BY INFINICON SYSTEMS, INC. ("INFINICON") TO EACH\r
+PERSON OR COMPANY ("RECIPIENT") ON AN "AS IS" BASIS. ANY EXPRESS OR IMPLIED\r
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\r
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.\r
+IN NO EVENT SHALL INFINICON BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\r
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\r
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;\r
+OR BUSINESS INTERRUPTION) HOWEVER CAUSED OR ON ANY THEORY OF LIABILITY,\r
+WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR\r
+OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\r
+OF THE POSSIBILITY OF SUCH DAMAGE.\r
+\r
+Any agreements between InfiniCon and the Recipient shall apply to Recipient's\r
+use of the Software.\r
+--*/\r
+\r
+\r
+/*\r
+ * Abstract:\r
+ * Declaration of primitive red/black map, a red/black tree where the caller\r
+ * always provides all necessary storage.\r
+ *\r
+ * This tree implementation exposes functions required for the client to\r
+ * manually walk the map, allowing clients to implement various methods\r
+ * of comparisson.\r
+ *\r
+ * Environment:\r
+ * All\r
+ *\r
+ * $Revision$\r
+ */\r
+\r
+\r
+#ifndef _CL_RBMAP_H_\r
+#define _CL_RBMAP_H_\r
+\r
+\r
+#include <complib/cl_types.h>\r
+\r
+\r
+/****h* Component Library/RB Map\r
+* NAME\r
+* RB Map\r
+*\r
+* DESCRIPTION\r
+* RB map implements a binary tree that stores user provided cl_rbmap_item_t\r
+* structures. Each item stored in a RB map has a unique key\r
+* (duplicates are not allowed). RB map provides the ability to\r
+* efficiently search for an item given a key.\r
+*\r
+* RB map does not allocate any memory, and can therefore not fail\r
+* any operations due to insufficient memory. RB map can thus be useful\r
+* in minimizing the error paths in code.\r
+*\r
+* RB map is not thread safe, and users must provide serialization when\r
+* adding and removing items from the map.\r
+*\r
+* The RB map functions operate on a cl_rbmap_t structure which should be\r
+* treated as opaque and should be manipulated only through the provided\r
+* functions.\r
+*\r
+* SEE ALSO\r
+* Structures:\r
+* cl_rbmap_t, cl_rbmap_item_t\r
+*\r
+* Initialization:\r
+* cl_rbmap_init\r
+*\r
+* Iteration:\r
+* cl_rbmap_root, cl_rbmap_end, cl_rbmap_left, cl_rbmap_right, cl_rbmap_up\r
+*\r
+* Manipulation:\r
+* cl_rbmap_insert, cl_rbmap_get, cl_rbmap_remove_item, cl_rbmap_remove,\r
+* cl_rbmap_reset, cl_rbmap_merge, cl_rbmap_delta\r
+*\r
+* Search:\r
+* cl_rbmap_apply_func\r
+*\r
+* Attributes:\r
+* cl_rbmap_count, cl_is_rbmap_empty,\r
+*********/\r
+\r
+\r
+/****i* Component Library: RB Map/cl_map_color_t\r
+* NAME\r
+* cl_map_color_t\r
+*\r
+* DESCRIPTION\r
+* The cl_map_color_t enumerated type is used to note the color of\r
+* nodes in a map.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef enum _cl_map_color\r
+{\r
+ CL_MAP_RED,\r
+ CL_MAP_BLACK\r
+\r
+} cl_map_color_t;\r
+/*\r
+* VALUES\r
+* CL_MAP_RED\r
+* The node in the map is red.\r
+*\r
+* CL_MAP_BLACK\r
+* The node in the map is black.\r
+*\r
+* SEE ALSO\r
+* RB Map, cl_rbmap_item_t\r
+*********/\r
+\r
+\r
+/****s* Component Library: RB Map/cl_rbmap_item_t\r
+* NAME\r
+* cl_rbmap_item_t\r
+*\r
+* DESCRIPTION\r
+* The cl_rbmap_item_t structure is used by maps to store objects.\r
+*\r
+* The cl_rbmap_item_t structure should be treated as opaque and should\r
+* be manipulated only through the provided functions.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _cl_rbmap_item\r
+{\r
+ struct _cl_rbmap_item *p_left;\r
+ struct _cl_rbmap_item *p_right;\r
+ struct _cl_rbmap_item *p_up;\r
+ cl_map_color_t color;\r
+#ifdef _DEBUG_\r
+ struct _cl_rbmap *p_map;\r
+#endif\r
+\r
+} cl_rbmap_item_t;\r
+/*\r
+* FIELDS\r
+* p_left\r
+* Pointer to the map item that is a child to the left of the node.\r
+*\r
+* p_right\r
+* Pointer to the map item that is a child to the right of the node.\r
+*\r
+* p_up\r
+* Pointer to the map item that is the parent of the node.\r
+*\r
+* color\r
+* Indicates whether a node is red or black in the map.\r
+*\r
+* NOTES\r
+* None of the fields of this structure should be manipulated by users, as\r
+* they are crititcal to the proper operation of the map in which they\r
+* are stored.\r
+*\r
+* To allow storing items in either a quick list, a quick pool, or a quick\r
+* map, the map implementation guarantees that the map item can be safely\r
+* cast to a pool item used for storing an object in a quick pool, or cast to\r
+* a list item used for storing an object in a quick list. This removes the\r
+* need to embed a map item, a list item, and a pool item in objects that need\r
+* to be stored in a quick list, a quick pool, and a RB map.\r
+*\r
+* SEE ALSO\r
+* RB Map, cl_rbmap_insert, cl_rbmap_key, cl_pool_item_t, cl_list_item_t\r
+*********/\r
+\r
+\r
+/****s* Component Library: RB Map/cl_rbmap_t\r
+* NAME\r
+* cl_rbmap_t\r
+*\r
+* DESCRIPTION\r
+* Quick map structure.\r
+*\r
+* The cl_rbmap_t structure should be treated as opaque and should\r
+* be manipulated only through the provided functions.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _cl_rbmap\r
+{\r
+ cl_rbmap_item_t root;\r
+ cl_rbmap_item_t nil;\r
+ cl_state_t state;\r
+ size_t count;\r
+\r
+} cl_rbmap_t;\r
+/*\r
+* PARAMETERS\r
+* root\r
+* Map item that serves as root of the map. The root is set up to\r
+* always have itself as parent. The left pointer is set to point to\r
+* the item at the root.\r
+*\r
+* nil\r
+* Map item that serves as terminator for all leaves, as well as providing\r
+* the list item used as quick list for storing map items in a list for\r
+* faster traversal.\r
+*\r
+* state\r
+* State of the map, used to verify that operations are permitted.\r
+*\r
+* count\r
+* Number of items in the map.\r
+*\r
+* SEE ALSO\r
+* RB Map\r
+*********/\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
+\r
+/****f* Component Library: RB Map/cl_rbmap_count\r
+* NAME\r
+* cl_rbmap_count\r
+*\r
+* DESCRIPTION\r
+* The cl_rbmap_count function returns the number of items stored\r
+* in a RB map.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE size_t CL_API\r
+cl_rbmap_count(\r
+ IN const cl_rbmap_t* const p_map )\r
+{\r
+ CL_ASSERT( p_map );\r
+ CL_ASSERT( p_map->state == CL_INITIALIZED );\r
+ return( p_map->count );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_map\r
+* [in] Pointer to a cl_rbmap_t structure whose item count to return.\r
+*\r
+* RETURN VALUE\r
+* Returns the number of items stored in the map.\r
+*\r
+* SEE ALSO\r
+* RB Map, cl_is_rbmap_empty\r
+*********/\r
+\r
+\r
+/****f* Component Library: RB Map/cl_is_rbmap_empty\r
+* NAME\r
+* cl_is_rbmap_empty\r
+*\r
+* DESCRIPTION\r
+* The cl_is_rbmap_empty function returns whether a RB map is empty.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE boolean_t CL_API\r
+cl_is_rbmap_empty(\r
+ IN const cl_rbmap_t* const p_map )\r
+{\r
+ CL_ASSERT( p_map );\r
+ CL_ASSERT( p_map->state == CL_INITIALIZED );\r
+\r
+ return( p_map->count == 0 );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_map\r
+* [in] Pointer to a cl_rbmap_t structure to test for emptiness.\r
+*\r
+* RETURN VALUES\r
+* TRUE if the RB map is empty.\r
+*\r
+* FALSE otherwise.\r
+*\r
+* SEE ALSO\r
+* RB Map, cl_rbmap_count, cl_rbmap_reset\r
+*********/\r
+\r
+\r
+/****f* Component Library: RB Map/cl_rbmap_reset\r
+* NAME\r
+* cl_rbmap_reset\r
+*\r
+* DESCRIPTION\r
+* The cl_rbmap_reset function removes all items in a RB map,\r
+* leaving it empty.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE void CL_API\r
+cl_rbmap_reset(\r
+ IN cl_rbmap_t* const p_map )\r
+{\r
+ CL_ASSERT( p_map );\r
+ CL_ASSERT( p_map->state == CL_INITIALIZED );\r
+\r
+ p_map->root.p_left = &p_map->nil;\r
+ p_map->count = 0;\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_map\r
+* [in] Pointer to a cl_rbmap_t structure to empty.\r
+*\r
+* RETURN VALUES\r
+* This function does not return a value.\r
+*\r
+* SEE ALSO\r
+* RB Map, cl_rbmap_remove, cl_rbmap_remove_item\r
+*********/\r
+\r
+\r
+/****f* Component Library: RB Map/cl_rbmap_init\r
+* NAME\r
+* cl_rbmap_init\r
+*\r
+* DESCRIPTION\r
+* The cl_rbmap_init function initialized a RB map for use.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE void CL_API\r
+cl_rbmap_init(\r
+ IN cl_rbmap_t* const p_map )\r
+{\r
+ CL_ASSERT( p_map );\r
+\r
+ /* special setup for the root node */\r
+ p_map->root.p_left = &p_map->nil;\r
+ p_map->root.p_right = &p_map->nil;\r
+ p_map->root.p_up = &p_map->root;\r
+ p_map->root.color = CL_MAP_BLACK;\r
+\r
+ /* Setup the node used as terminator for all leaves. */\r
+ p_map->nil.p_left = &p_map->nil;\r
+ p_map->nil.p_right = &p_map->nil;\r
+ p_map->nil.p_up = &p_map->nil;\r
+ p_map->nil.color = CL_MAP_BLACK;\r
+\r
+#ifdef _DEBUG_\r
+ p_map->root.p_map = p_map;\r
+ p_map->nil.p_map = p_map;\r
+#endif\r
+\r
+ p_map->state = CL_INITIALIZED;\r
+\r
+ p_map->count = 0;\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_map\r
+* [in] Pointer to a cl_rbmap_t structure to initialize.\r
+*\r
+* RETURN VALUES\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* Allows calling RB map manipulation functions.\r
+*\r
+* SEE ALSO\r
+* RB Map, cl_rbmap_insert, cl_rbmap_remove\r
+*********/\r
+\r
+\r
+/****f* Component Library: RB Map/cl_rbmap_root\r
+* NAME\r
+* cl_rbmap_root\r
+*\r
+* DESCRIPTION\r
+* The cl_rbmap_root function returns the root of a RB map.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE cl_rbmap_item_t* const CL_API\r
+cl_rbmap_root(\r
+ IN const cl_rbmap_t* const p_map )\r
+{\r
+ CL_ASSERT( p_map );\r
+ return( p_map->root.p_left );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_map\r
+* [in] Pointer to a cl_rbmap_t structure whose root to return.\r
+*\r
+* RETURN VALUE\r
+* Pointer to the end of the map.\r
+*\r
+* NOTES\r
+* cl_rbmap_end is useful for determining the validity of map items returned\r
+* by cl_rbmap_head, cl_rbmap_tail, cl_rbmap_next, or cl_rbmap_prev. If the map\r
+* item pointer returned by any of these functions compares to the end, the\r
+* end of the map was encoutered.\r
+* When using cl_rbmap_head or cl_rbmap_tail, this condition indicates that\r
+* the map is empty.\r
+*\r
+* SEE ALSO\r
+* RB Map, cl_rbmap_head, cl_rbmap_tail, cl_rbmap_next, cl_rbmap_prev,\r
+* cl_rbmap_end, cl_rbmap_left, cl_rbmap_right, cl_rbmap_up\r
+*********/\r
+\r
+\r
+/****f* Component Library: RB Map/cl_rbmap_end\r
+* NAME\r
+* cl_rbmap_end\r
+*\r
+* DESCRIPTION\r
+* The cl_rbmap_end function returns the end of a RB map.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE const cl_rbmap_item_t* const CL_API\r
+cl_rbmap_end(\r
+ IN const cl_rbmap_t* const p_map )\r
+{\r
+ CL_ASSERT( p_map );\r
+ CL_ASSERT( p_map->state == CL_INITIALIZED );\r
+ /* Nil is the end of the map. */\r
+ return( &p_map->nil );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_map\r
+* [in] Pointer to a cl_rbmap_t structure whose end to return.\r
+*\r
+* RETURN VALUE\r
+* Pointer to the end of the map.\r
+*\r
+* NOTES\r
+* cl_rbmap_end is useful for determining the validity of map items returned\r
+* by cl_rbmap_head, cl_rbmap_tail, cl_rbmap_next, or cl_rbmap_prev. If the map\r
+* item pointer returned by any of these functions compares to the end, the\r
+* end of the map was encoutered.\r
+* When using cl_rbmap_head or cl_rbmap_tail, this condition indicates that\r
+* the map is empty.\r
+*\r
+* SEE ALSO\r
+* RB Map, cl_rbmap_head, cl_rbmap_tail, cl_rbmap_next, cl_rbmap_prev\r
+* cl_rbmap_root, cl_rbmap_left, cl_rbmap_right, cl_rbmap_up\r
+*********/\r
+\r
+\r
+/****f* Component Library: RB Map/cl_rbmap_left\r
+* NAME\r
+* cl_rbmap_left\r
+*\r
+* DESCRIPTION\r
+* The cl_rbmap_left function returns the map item to the left\r
+* of the specified map item.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE cl_rbmap_item_t* CL_API\r
+cl_rbmap_left(\r
+ IN const cl_rbmap_item_t* const p_item )\r
+{\r
+ CL_ASSERT( p_item );\r
+ return( (cl_rbmap_item_t*)p_item->p_left );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_item\r
+* [in] Pointer to a map item whose predecessor to return.\r
+*\r
+* RETURN VALUES\r
+* Pointer to the map item to the left in a RB map.\r
+*\r
+* Pointer to the map end if no item is to the left.\r
+*\r
+* SEE ALSO\r
+* RB Map, cl_rbmap_head, cl_rbmap_tail, cl_rbmap_next, cl_rbmap_end,\r
+* cl_rbmap_item_t\r
+*********/\r
+\r
+\r
+/****f* Component Library: RB Map/cl_rbmap_right\r
+* NAME\r
+* cl_rbmap_right\r
+*\r
+* DESCRIPTION\r
+* The cl_rbmap_right function returns the map item to the right\r
+* of the specified map item.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE cl_rbmap_item_t* CL_API\r
+cl_rbmap_right(\r
+ IN const cl_rbmap_item_t* const p_item )\r
+{\r
+ CL_ASSERT( p_item );\r
+ return( (cl_rbmap_item_t*)p_item->p_right );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_item\r
+* [in] Pointer to a map item whose predecessor to return.\r
+*\r
+* RETURN VALUES\r
+* Pointer to the map item to the right in a RB map.\r
+*\r
+* Pointer to the map end if no item is to the right.\r
+*\r
+* SEE ALSO\r
+* RB Map, cl_rbmap_head, cl_rbmap_tail, cl_rbmap_next, cl_rbmap_end,\r
+* cl_rbmap_item_t\r
+*********/\r
+\r
+\r
+/****f* Component Library: RB Map/cl_rbmap_insert\r
+* NAME\r
+* cl_rbmap_insert\r
+*\r
+* DESCRIPTION\r
+* The cl_rbmap_insert function inserts a map item into a RB map.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_rbmap_insert(\r
+ IN cl_rbmap_t* const p_map,\r
+ IN cl_rbmap_item_t* const p_insert_at,\r
+ IN cl_rbmap_item_t* const p_item,\r
+ IN boolean_t left );\r
+/*\r
+* PARAMETERS\r
+* p_map\r
+* [in] Pointer to a cl_rbmap_t structure into which to add the item.\r
+*\r
+* p_insert_at\r
+* [in] Pointer to a cl_rbmap_item_t structure to serve as parent\r
+* to p_item.\r
+*\r
+* p_item\r
+* [in] Pointer to a cl_rbmap_item_t stucture to insert into the RB map.\r
+*\r
+* left\r
+* [in] Indicates that p_item should be inserted to the left of p_insert_at.\r
+*\r
+* RETURN VALUE\r
+* Pointer to the item in the map with the specified key. If insertion\r
+* was successful, this is the pointer to the item. If an item with the\r
+* specified key already exists in the map, the pointer to that item is\r
+* returned.\r
+*\r
+* NOTES\r
+* Insertion operations may cause the RB map to rebalance.\r
+*\r
+* SEE ALSO\r
+* RB Map, cl_rbmap_remove, cl_rbmap_item_t\r
+*********/\r
+\r
+\r
+/****f* Component Library: RB Map/cl_rbmap_remove_item\r
+* NAME\r
+* cl_rbmap_remove_item\r
+*\r
+* DESCRIPTION\r
+* The cl_rbmap_remove_item function removes the specified map item\r
+* from a RB map.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_rbmap_remove_item(\r
+ IN cl_rbmap_t* const p_map,\r
+ IN cl_rbmap_item_t* const p_item );\r
+/*\r
+* PARAMETERS\r
+* p_item\r
+* [in] Pointer to a map item to remove from its RB map.\r
+*\r
+* RETURN VALUES\r
+* This function does not return a value.\r
+*\r
+* In a debug build, cl_rbmap_remove_item asserts that the item being removed\r
+* is in the specified map.\r
+*\r
+* NOTES\r
+* Removes the map item pointed to by p_item from its RB map.\r
+*\r
+* SEE ALSO\r
+* RB Map, cl_rbmap_remove, cl_rbmap_reset, cl_rbmap_insert\r
+*********/\r
+\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+\r
+\r
+#endif /* _CL_RBMAP_H_ */\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. \r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+/*\r
+ * Abstract:\r
+ * Declaration of asynchronous request manager. The request manager does\r
+ * not return resources, only notifies the user when resources are available.\r
+ *\r
+ * Environment:\r
+ * All\r
+ */\r
+\r
+\r
+#ifndef _CL_REQ_MGR_H_\r
+#define _CL_REQ_MGR_H_\r
+\r
+\r
+#include <complib/cl_qpool.h>\r
+\r
+\r
+/****h* Component Library/Request Manager\r
+* NAME\r
+* Request Manager\r
+*\r
+* DESCRIPTION\r
+* The Request Manager manages synchronous as well as asynchronous\r
+* requests for objects.\r
+*\r
+* Request manager does not supply the objects, but merely returns whether\r
+* objects are available to satisfy requests. This allows users to use\r
+* various sources for objects.\r
+*\r
+* While the request manager manages synchronous and asynchronous requests\r
+* for objects, it does not itself operate asynchronously. Instead, the\r
+* cl_req_mgr_resume function returns information for resuming asynchronous\r
+* requests. If a call to cl_req_mgr_resume returns CL_SUCCESS, additional\r
+* requests may be able to resume. It is recommended that users flush\r
+* pending requests by calling cl_req_mgr_resume while CL_SUCCESS is returned.\r
+*\r
+* The request manager functions operates on a cl_req_mgr_t structure which\r
+* should be treated as opaque and should be manipulated only through the\r
+* provided functions.\r
+*\r
+* SEE ALSO\r
+* Types:\r
+* cl_req_type_t\r
+*\r
+* Structures:\r
+* cl_req_mgr_t\r
+*\r
+* Callbacks:\r
+* cl_pfn_req_cb_t, cl_pfn_reqmgr_get_count_t\r
+*\r
+* Initialization/Destruction:\r
+* cl_req_mgr_construct, cl_req_mgr_init, cl_req_mgr_destroy\r
+*\r
+* Manipulation:\r
+* cl_req_mgr_get, cl_req_mgr_resume\r
+*\r
+* Attributes:\r
+* cl_is_req_mgr_inited, cl_req_mgr_count\r
+*********/\r
+\r
+\r
+/****d* Component Library: Request Manager/cl_pfn_req_cb_t\r
+* NAME\r
+* cl_pfn_req_cb_t\r
+*\r
+* DESCRIPTION\r
+* The cl_pfn_req_cb_t function type defines the prototype for functions\r
+* used to store a function pointer to a user defined function.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef void\r
+(CL_API *cl_pfn_req_cb_t)( void );\r
+/*\r
+* PARAMETERS\r
+* This function does not take parameters.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* Function pointers specified by this parameter do not have to match the\r
+* defined syntax, as these callbacks are never invoked directly by the\r
+* request manager. When specifying a function with a different prototype,\r
+* cast the function pointer to this type.\r
+*\r
+* SEE ALSO\r
+* Request Manager, cl_req_mgr_get, cl_req_mgr_resume\r
+*********/\r
+\r
+\r
+/****d* Component Library: Request Manager/cl_req_type_t\r
+* NAME\r
+* cl_req_type_t\r
+*\r
+* DESCRIPTION\r
+* The cl_req_type_t enumerated type describes the type of request.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef enum _cl_req_type\r
+{\r
+ REQ_GET_SYNC,\r
+ REQ_GET_ASYNC,\r
+ REQ_GET_PARTIAL_OK\r
+\r
+} cl_req_type_t;\r
+/*\r
+* VALUES\r
+* REQ_GET_SYNC\r
+* Synchronous request.\r
+*\r
+* REQ_GET_ASYNC\r
+* Asynchronous requests for which all objects are required at once.\r
+*\r
+* REQ_GET_PARTIAL_OK\r
+* Asynchronous requests that may be broken into multiple smaller requests.\r
+*\r
+* SEE ALSO\r
+* Request Manager, cl_req_mgr_get\r
+*********/\r
+\r
+\r
+/****d* Component Library: Request Manager/cl_pfn_reqmgr_get_count_t\r
+* NAME\r
+* cl_pfn_reqmgr_get_count_t\r
+*\r
+* DESCRIPTION\r
+* The cl_pfn_reqmgr_get_count_t function type defines the prototype for\r
+* functions used to retrieve the number of available objects in a pool.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef size_t\r
+(CL_API *cl_pfn_reqmgr_get_count_t)(\r
+ IN void* context );\r
+/*\r
+* PARAMETERS\r
+* Context\r
+* [in] Context provided in a call to cl_req_mgr_init by\r
+* the get_context parameter.\r
+*\r
+* RETURN VALUE\r
+* Returns the number of objects available in an object pool for which\r
+* requests are managed by a request manager.\r
+*\r
+* NOTES\r
+* This function type is provided as function prototype reference for the\r
+* function passed into cl_req_mgr_init. This function is invoked by the\r
+* request manager when trying to fulfill requests for resources, either\r
+* through a call to cl_req_mgr_get or cl_req_mgr_resume.\r
+*\r
+* SEE ALSO\r
+* Request Manager, cl_req_mgr_init, cl_req_mgr_get, cl_req_mgr_resume\r
+*********/\r
+\r
+\r
+/****s* Component Library: Request Manager/cl_req_mgr_t\r
+* NAME\r
+* cl_req_mgr_t\r
+*\r
+* DESCRIPTION\r
+* Quick composite pool structure.\r
+*\r
+* The cl_req_mgr_t structure should be treated as opaque and should be\r
+* manipulated only through the provided functions.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _cl_req_mgr\r
+{\r
+ cl_pfn_reqmgr_get_count_t pfn_get_count;\r
+ const void *get_context;\r
+ cl_qlist_t request_queue;\r
+ cl_qpool_t request_pool;\r
+\r
+} cl_req_mgr_t;\r
+/*\r
+* FIELDS\r
+* pfn_get_count\r
+* Pointer to the count callback function.\r
+*\r
+* get_context\r
+* Context to pass as single parameter to count callback.\r
+*\r
+* request_queue\r
+* Pending requests for elements.\r
+*\r
+* request_pool\r
+* Pool of request structures for storing requests in the request queue.\r
+*\r
+* SEE ALSO\r
+* Request Manager\r
+*********/\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif\r
+\r
+\r
+/****f* Component Library: Request Manager/cl_req_mgr_construct\r
+* NAME\r
+* cl_req_mgr_construct\r
+*\r
+* DESCRIPTION\r
+* The cl_req_mgr_construct function constructs a request manager.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_req_mgr_construct(\r
+ IN cl_req_mgr_t* const p_req_mgr );\r
+/*\r
+* PARAMETERS\r
+* p_req_mgr\r
+* [in] Pointer to a cl_req_mgr_t structure to construct.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* cl_req_mgr_construct allows calling cl_req_mgr_destroy without first\r
+* calling cl_req_mgr_init.\r
+*\r
+* Calling cl_req_mgr_construct is a prerequisite to calling any other\r
+* request manager function except cl_req_mgr_init.\r
+*\r
+* SEE ALSO\r
+* Request Manager, cl_req_mgr_init, cl_req_mgr_destroy\r
+*********/\r
+\r
+\r
+/****f* Component Library: Request Manager/cl_req_mgr_init\r
+* NAME\r
+* cl_req_mgr_init\r
+*\r
+* DESCRIPTION\r
+* The cl_req_mgr_init function initializes a request manager for use.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_status_t CL_API\r
+cl_req_mgr_init(\r
+ IN cl_req_mgr_t* const p_req_mgr,\r
+ IN cl_pfn_reqmgr_get_count_t pfn_get_count,\r
+ IN const void* const get_context );\r
+/*\r
+* PARAMETERS\r
+* p_req_mgr\r
+* [in] Pointer to a cl_req_mgr_t structure to initialize.\r
+*\r
+* pfn_get_count\r
+* [in] Callback function invoked by the request manager to get the\r
+* number of objects available in a pool of objects for which the\r
+* request manager is managing requests.\r
+* See the cl_pfn_req_mgr_get_count_t function type declaration for\r
+* details about the callback function.\r
+*\r
+* get_context\r
+* [in] Context to pass into the function specified by the\r
+* pfn_get_count parameter.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if the request manager was successfully initialized.\r
+*\r
+* CL_INSUFFICIENT_MEMORY if there was not enough memory to initialize\r
+* the request manager.\r
+*\r
+* SEE ALSO\r
+* Request Manager, cl_req_mgr_construct, cl_req_mgr_destroy, cl_req_mgr_get,\r
+* cl_req_mgr_resume, cl_pfn_req_mgr_get_count_t\r
+*********/\r
+\r
+\r
+/****f* Component Library: Request Manager/cl_req_mgr_destroy\r
+* NAME\r
+* cl_req_mgr_destroy\r
+*\r
+* DESCRIPTION\r
+* The cl_req_mgr_destroy function destroys a request manager.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_req_mgr_destroy(\r
+ IN cl_req_mgr_t* const p_req_mgr );\r
+/*\r
+* PARAMETERS\r
+* p_req_mgr\r
+* [in] Pointer to a cl_req_mgr_t structure to destroy.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* cl_req_mgr_destroy frees all memory allocated by the request manager.\r
+* Further operations on the request manager should not be attempted.\r
+*\r
+* This function should only be called after a call to cl_req_mgr_construct\r
+* or cl_req_mgr_init.\r
+*\r
+* SEE ALSO\r
+* Request Manager, cl_req_mgr_construct, cl_req_mgr_init\r
+*********/\r
+\r
+\r
+/****f* Component Library: Request Manager/cl_req_mgr_get\r
+* NAME\r
+* cl_req_mgr_get\r
+*\r
+* DESCRIPTION\r
+* The cl_req_mgr_get function handles synchronous and asynchronous\r
+* requests for objects.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_status_t CL_API\r
+cl_req_mgr_get(\r
+ IN cl_req_mgr_t* const p_req_mgr,\r
+ IN OUT size_t* const p_count,\r
+ IN const cl_req_type_t req_type,\r
+ IN cl_pfn_req_cb_t pfn_callback,\r
+ IN const void* const context1,\r
+ IN const void* const context2 );\r
+/*\r
+* PARAMETERS\r
+* p_req_mgr\r
+* [in] Pointer to a cl_req_mgr_t structure from which to check\r
+* for resources.\r
+*\r
+* p_count\r
+* [in/out] On input, contains the number of objects requested.\r
+* On output, contains the number of objects available.\r
+*\r
+* req_type\r
+* [in] Enumerated type describing the type of request. Valid values are:\r
+* ReqGetSync\r
+* Synchronous request.\r
+* ReqGetAsync\r
+* Asynchronous requests for which all objects are required at\r
+* once.\r
+* ReqGetAsyncPartialOk\r
+* Asynchronous requests that may be broken into multiple smaller\r
+* requests.\r
+*\r
+* pfn_callback\r
+* [in] Pointer to a callback function for use by the caller. This\r
+* callback function is never invoked by the request manager.\r
+*\r
+* context1\r
+* [in] First of two contexts for a resource request.\r
+*\r
+* context2\r
+* [in] Second of two contexts for a resource request.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if all objects requested are available.\r
+*\r
+* CL_PENDING if the request could not be completed in its entirety.\r
+* The p_count parameter contains the number of objects immediately available.\r
+*\r
+* CL_INSUFFICIENT_RESOURCES if the request could not be completed due to\r
+* insufficient objects being available.\r
+*\r
+* CL_INSUFFICIENT_MEMORY if the request failed due to a lack of system memory.\r
+*\r
+* NOTES\r
+* Upon successful completion of this function, the p_count parameter contains\r
+* the number of objects available.\r
+*\r
+* Synchronous requests fail if there are any asynchronous requests pending,\r
+* or if there are not enough resources to immediately satisfy the request in\r
+* its entirety .\r
+*\r
+* Asynchronous requests fail if there is insufficient system memory to\r
+* queue them.\r
+*\r
+* Once an asynchronous request is queued, use cl_req_mgr_resume to retrieve\r
+* information for resuming queued requests.\r
+*\r
+* SEE ALSO\r
+* Request Manager, cl_req_mgr_resume\r
+*********/\r
+\r
+\r
+/****f* Component Library: Request Manager/cl_req_mgr_resume\r
+* NAME\r
+* cl_req_mgr_resume\r
+*\r
+* DESCRIPTION\r
+* The cl_req_mgr_resume function attempts to resume queued requests.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_status_t CL_API\r
+cl_req_mgr_resume(\r
+ IN cl_req_mgr_t* const p_req_mgr,\r
+ OUT size_t* const p_count,\r
+ OUT cl_pfn_req_cb_t* const ppfn_callback,\r
+ OUT const void** const p_context1,\r
+ OUT const void** const p_context2 );\r
+/*\r
+* PARAMETERS\r
+* p_req_mgr\r
+* [in] Pointer to a cl_req_mgr_t structure from which to resume requests.\r
+*\r
+* p_count\r
+* [out] Contains the number of objects available for a resuming request.\r
+*\r
+* ppfn_callback\r
+* [out] Contains the pfn_callback value for the resuming request, as\r
+* provided to the call to the cl_req_mgr_get function.\r
+*\r
+* p_context1\r
+* [out] Contains the context1 value for the resuming request, as provided\r
+* to the call to the cl_req_mgr_get function.\r
+*\r
+* p_context2\r
+* [out] Contains the context2 value for the resuming request, as provided\r
+* to the call to the cl_req_mgr_get function.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if a request was completed.\r
+*\r
+* CL_PENDING if a request was continued, but not completed.\r
+*\r
+* CL_INSUFFICIENT_RESOURCES if a request could not be continued due to\r
+* a lack of resources.\r
+*\r
+* CL_NOT_DONE if there were no pending requests.\r
+*\r
+* NOTES\r
+* cl_req_mgr_resume resumes at most one request. Further requests may be\r
+* able to be resumed if this call returns CL_SUCCESS.\r
+*\r
+* SEE ALSO\r
+* Request Manager, cl_req_mgr_get\r
+*********/\r
+\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+\r
+\r
+#endif /* _CL_REQ_MGR_H_ */\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. \r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+/*\r
+ * Abstract:\r
+ * Declaration of spin lock object.\r
+ *\r
+ * Environment:\r
+ * All\r
+ */\r
+\r
+\r
+#ifndef _CL_SPINLOCK_H_\r
+#define _CL_SPINLOCK_H_\r
+\r
+\r
+#include <complib/cl_spinlock_osd.h>\r
+\r
+\r
+/****h* Component Library/Spinlock\r
+* NAME\r
+* Spinlock\r
+*\r
+* DESCRIPTION\r
+* Spinlock provides synchronization between threads for exclusive access to\r
+* a resource.\r
+*\r
+* The spinlock functions manipulate a cl_spinlock_t structure which should\r
+* be treated as opaque and should be manipulated only through the provided\r
+* functions.\r
+*\r
+* SEE ALSO\r
+* Structures:\r
+* cl_spinlock_t\r
+*\r
+* Initialization:\r
+* cl_spinlock_construct, cl_spinlock_init, cl_spinlock_destroy\r
+*\r
+* Manipulation\r
+* cl_spinlock_acquire, cl_spinlock_release\r
+*********/\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif\r
+\r
+\r
+/****f* Component Library: Spinlock/cl_spinlock_construct\r
+* NAME\r
+* cl_spinlock_construct\r
+*\r
+* DESCRIPTION\r
+* The cl_spinlock_construct function initializes the state of a\r
+* spin lock.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_spinlock_construct(\r
+ IN cl_spinlock_t* const p_spinlock );\r
+/*\r
+* PARAMETERS\r
+* p_spinlock\r
+* [in] Pointer to a spin lock structure whose state to initialize.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* Allows calling cl_spinlock_destroy without first calling\r
+* cl_spinlock_init.\r
+*\r
+* Calling cl_spinlock_construct is a prerequisite to calling any other\r
+* spin lock function except cl_spinlock_init.\r
+*\r
+* SEE ALSO\r
+* Spinlock, cl_spinlock_init, cl_spinlock_destroy\r
+*********/\r
+\r
+\r
+/****f* Component Library: Spinlock/cl_spinlock_init\r
+* NAME\r
+* cl_spinlock_init\r
+*\r
+* DESCRIPTION\r
+* The cl_spinlock_init function initializes a spin lock for use.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_status_t CL_API\r
+cl_spinlock_init(\r
+ IN cl_spinlock_t* const p_spinlock );\r
+/*\r
+* PARAMETERS\r
+* p_spinlock\r
+* [in] Pointer to a spin lock structure to initialize.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if initialization succeeded.\r
+*\r
+* CL_ERROR if initialization failed. Callers should call\r
+* cl_spinlock_destroy to clean up any resources allocated during\r
+* initialization.\r
+*\r
+* NOTES\r
+* Initialize the spin lock structure. Allows calling cl_spinlock_aquire\r
+* and cl_spinlock_release.\r
+*\r
+* SEE ALSO\r
+* Spinlock, cl_spinlock_construct, cl_spinlock_destroy,\r
+* cl_spinlock_acquire, cl_spinlock_release\r
+*********/\r
+\r
+\r
+/****f* Component Library: Spinlock/cl_spinlock_destroy\r
+* NAME\r
+* cl_spinlock_destroy\r
+*\r
+* DESCRIPTION\r
+* The cl_spinlock_destroy function performs all necessary cleanup of a\r
+* spin lock.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_spinlock_destroy(\r
+ IN cl_spinlock_t* const p_spinlock );\r
+/*\r
+* PARAMETERS\r
+* p_spinlock\r
+* [in] Pointer to a spin lock structure to destroy.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* Performs any necessary cleanup of a spin lock. This function must only\r
+* be called if either cl_spinlock_construct or cl_spinlock_init has been\r
+* called.\r
+*\r
+* SEE ALSO\r
+* Spinlock, cl_spinlock_construct, cl_spinlock_init\r
+*********/\r
+\r
+\r
+/****f* Component Library: Spinlock/cl_spinlock_acquire\r
+* NAME\r
+* cl_spinlock_acquire\r
+*\r
+* DESCRIPTION\r
+* The cl_spinlock_acquire function acquires a spin lock.\r
+* This version of lock does not prevent an interrupt from\r
+* occuring on the processor on which the code is being\r
+* executed.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_spinlock_acquire(\r
+ IN cl_spinlock_t* const p_spinlock );\r
+/*\r
+* PARAMETERS\r
+* p_spinlock\r
+* [in] Pointer to a spin lock structure to acquire.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* SEE ALSO\r
+* Spinlock, cl_spinlock_release\r
+*********/\r
+\r
+\r
+/****f* Component Library: Spinlock/cl_spinlock_release\r
+* NAME\r
+* cl_spinlock_release\r
+*\r
+* DESCRIPTION\r
+* The cl_spinlock_release function releases a spin lock object.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_spinlock_release(\r
+ IN cl_spinlock_t* const p_spinlock );\r
+/*\r
+* PARAMETERS\r
+* p_spinlock\r
+* [in] Pointer to a spin lock structure to release.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* Releases a spin lock after a call to cl_spinlock_acquire.\r
+*\r
+* SEE ALSO\r
+* Spinlock, cl_spinlock_acquire\r
+*********/\r
+\r
+\r
+#ifdef __cplusplus\r
+} /* extern "C" */\r
+#endif\r
+\r
+#endif /* _CL_SPINLOCK_H_ */\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. \r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+/*\r
+ * Abstract:\r
+ * System Callback abstractions.\r
+ *\r
+ * Environment:\r
+ * All\r
+ */\r
+\r
+\r
+#ifndef _CL_SYS_CALLBACK_H_\r
+#define _CL_SYS_CALLBACK_H_\r
+\r
+\r
+#include <complib/cl_types.h>\r
+\r
+/****h* Component Library/System Callback\r
+* NAME\r
+* System Callback\r
+*\r
+* DESCRIPTION\r
+* The System Callback provider uses threads from a system thread-pool to\r
+* invoke specified callback functions.\r
+*\r
+* Callbacks can be queued in a low- or high-priority queue for processing.\r
+*\r
+* cl_thread_suspend and cl_thread_stall can be used to delay or stall the\r
+* callback thread.\r
+*\r
+* Environments that do not have a native system thread-pool emulate this\r
+* functionality to provide cross-environment support.\r
+*\r
+* The cl_sys_callback_item_t structure should be treated as opaque and be\r
+* manipulated only through the provided functions.\r
+*********/\r
+\r
+\r
+/****d* Component Library: System Callback/cl_pfn_sys_callback_t\r
+* NAME\r
+* cl_pfn_sys_callback_t\r
+*\r
+* DESCRIPTION\r
+* The cl_pfn_sys_callback_t function type defines the prototype for\r
+* functions invoked by the system callback provider.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef void\r
+(CL_API *cl_pfn_sys_callback_t)(\r
+ IN void* get_context,\r
+ IN void* queue_context );\r
+/*\r
+* PARAMETERS\r
+* get_context\r
+* [in] Value of the get_context parameter specified in a call\r
+* to cl_sys_callback_get.\r
+*\r
+* queue_context\r
+* [in] Value of the queue_context parameter specified in a call\r
+* to cl_sys_callback_queue.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* This function type is provided as function prototype reference for\r
+* the function provided by users as a parameter to the\r
+* cl_sys_callback_queue function.\r
+*\r
+* SEE ALSO\r
+* System Callback, cl_sys_callback_queue\r
+*********/\r
+\r
+\r
+/* Include platform specific system callback support. */\r
+#include <complib/cl_syscallback_osd.h>\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif\r
+\r
+\r
+/****i* Component Library: System Callback/cl_sys_callback_construct\r
+* NAME\r
+* cl_sys_callback_construct\r
+*\r
+* DESCRIPTION\r
+* The cl_sys_callback_construct function is called to initialize the state\r
+* of the system callback provider.\r
+*\r
+* SYNOPSIS\r
+*/\r
+void\r
+__cl_sys_callback_construct( void );\r
+/*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* This function is called internally when initializing the component\r
+* library for use. Users should never call this function directly.\r
+*\r
+* Calling cl_sys_callback_construct is a prerequisite to calling any other\r
+* system callback function.\r
+*\r
+* Allows calling cl_sys_callback_init, cl_sys_callback_destroy, and\r
+* cl_is_sys_callback_inited.\r
+*\r
+* SEE ALSO\r
+* System Callback, cl_sys_callback_init, cl_sys_callback_destroy,\r
+* cl_is_sys_callback_inited\r
+*********/\r
+\r
+\r
+/****f* Component Library: System Callback/cl_is_sys_callback_inited\r
+* NAME\r
+* cl_is_sys_callback_inited\r
+*\r
+* DESCRIPTION\r
+* The cl_is_sys_callback_inited function returns whether the system\r
+* callback provider was initialized successfully\r
+*\r
+* SYNOPSIS\r
+*/\r
+boolean_t\r
+__cl_is_sys_callback_inited( void );\r
+/*\r
+* RETURN VALUES\r
+* TRUE if the system callback provider was initialized successfully.\r
+*\r
+* FALSE otherwise.\r
+*\r
+* NOTES\r
+* Allows checking the state of the system callback provider to determine\r
+* if invoking member functions is appropriate.\r
+*\r
+* SEE ALSO\r
+* System Callback\r
+*********/\r
+\r
+\r
+/****i* Component Library: System Callback/cl_sys_callback_init\r
+* NAME\r
+* cl_sys_callback_init\r
+*\r
+* DESCRIPTION\r
+* The cl_sys_callback_init function is called to initialize the system\r
+* callback provider.\r
+*\r
+* SYNOPSIS\r
+*/\r
+cl_status_t\r
+__cl_sys_callback_init( void );\r
+/*\r
+* RETURN VALUES\r
+* CL_SUCCESS if the system callback provider was initialized successfully.\r
+*\r
+* CL_INSUFFICIENT_MEMORY if there was not enough memory to inititalize\r
+* the system callback provider.\r
+*\r
+* CL_ERROR if the system callback provider's threads could not be created.\r
+*\r
+* NOTES\r
+* This function is called internally when initializing the component\r
+* library for use. Users should never call this function directly.\r
+*\r
+* SEE ALSO\r
+* System Callback, cl_sys_callback_construct, cl_sys_callback_destroy\r
+*********/\r
+\r
+\r
+/****i* Component Library: System Callback/cl_sys_callback_destroy\r
+* NAME\r
+* cl_sys_callback_destroy\r
+*\r
+* DESCRIPTION\r
+* The cl_sys_callback_destroy function is called to destroy the system\r
+* callback provider.\r
+*\r
+* SYNOPSIS\r
+*/\r
+void\r
+__cl_sys_callback_destroy( void );\r
+/*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* This function is called internally when destroying the component\r
+* library after use. Users should never call this function directly.\r
+*\r
+* All threads and resources allocated by the system callback provider\r
+* are freed.\r
+*\r
+* This function should only be called after calling either\r
+* cl_sys_callback_construct or cl_sys_callback_construct.\r
+*\r
+* SEE ALSO\r
+* System Callback, cl_sys_callback_construct, cl_sys_callback_construct\r
+*********/\r
+\r
+\r
+/****f* Component Library: System Callback/cl_sys_callback_get\r
+* NAME\r
+* cl_sys_callback_get\r
+*\r
+* DESCRIPTION\r
+* The cl_sys_callback_get function retrieves a system callback item.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_sys_callback_item_t* CL_API\r
+cl_sys_callback_get(\r
+ IN const void* const get_context );\r
+/*\r
+* PARAMETERS\r
+* get_context\r
+* [in] Context value to pass into the callback function.\r
+*\r
+* RETURN VALUES\r
+* Returns a pointer to a system callback item if successful.\r
+*\r
+* Returns NULL if the call fails.\r
+*\r
+* NOTES\r
+* A system callback item must be released with a call to cl_sys_callback_put.\r
+*\r
+* Care must be taken to prevent a system callback item from being returned\r
+* to the pool while it is queued. Callers of cl_sys_callback_queue must not\r
+* return the system callback item to the pool until their callback has been\r
+* invoked.\r
+*\r
+* In Windows 2000 Kernel Mode, the get_context is a pointer to the device\r
+* object for which the system callback is being used.\r
+*\r
+* SEE ALSO\r
+* System Callback, SysCallbackPut, SysCallbackQueue\r
+*********/\r
+\r
+\r
+/****f* Component Library: System Callback/cl_sys_callback_put\r
+* NAME\r
+* cl_sys_callback_put\r
+*\r
+* DESCRIPTION\r
+* The cl_sys_callback_put function releases the specified\r
+* system callback item.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_sys_callback_put(\r
+ IN cl_sys_callback_item_t* const p_item );\r
+/*\r
+* PARAMETERS\r
+* p_item\r
+* [in] Pointer to a system callback item to release.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* The p_item parameter points to a system callback item returned by\r
+* a previous call to cl_sys_callback_get.\r
+*\r
+* The specified system callback item must not be queued when making\r
+* a call to this function. This function can, however, be called\r
+* from the callback function.\r
+*\r
+* SEE ALSO\r
+* System Callback, cl_sys_callback_get, cl_sys_callback_queue\r
+*********/\r
+\r
+\r
+/****f* Component Library: System Callback/cl_sys_callback_queue\r
+* NAME\r
+* cl_sys_callback_queue\r
+*\r
+* DESCRIPTION\r
+* The cl_sys_callback_queue function queues the specified system callback item\r
+* for execution.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_status_t CL_API\r
+cl_sys_callback_queue(\r
+ IN cl_sys_callback_item_t* const p_item,\r
+ IN cl_pfn_sys_callback_t pfn_callback,\r
+ IN const void* const queue_context,\r
+ IN const boolean_t high_priority );\r
+/*\r
+* PARAMETERS\r
+* p_item\r
+* [in] Pointer to a system callback item.\r
+*\r
+* pfn_callback\r
+* [in] Pointer to a function to be invoked by the system callback module.\r
+* See the cl_pfn_sys_callback_t function type definition for details\r
+* about the callback function.\r
+*\r
+* queue_context\r
+* [in] Value passed to the system callback function.\r
+*\r
+* high_priority\r
+* [in] Specifies whether the request should be queued in the high- or\r
+* low-priority queue.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if the system callback item was successfully queued.\r
+*\r
+* CL_ERROR otherwise.\r
+*\r
+* NOTES\r
+* A thread from the system thread pool will invoke the specified callback\r
+* function with the get_context value specified in the call to\r
+* cl_sys_callback_get and the specified context as parameters.\r
+*\r
+* The high priority queue is processed before the low priority queue. There\r
+* is no fairness algorithm implemented for removing items from the queues.\r
+*\r
+* Care should be taken to only queue a given system callback item once\r
+* at a time.\r
+*\r
+* SEE ALSO\r
+* System Callback, cl_sys_callback_get, cl_pfn_sys_callback_t\r
+*********/\r
+\r
+\r
+#ifdef __cplusplus\r
+} /* extern "C" */\r
+#endif\r
+\r
+\r
+#endif /* _CL_SYS_CALLBACK_H_ */\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. \r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+/*\r
+ * Abstract:\r
+ * Declaration of thread abstraction and thread related operations.\r
+ *\r
+ * Environment:\r
+ * All\r
+ */\r
+\r
+\r
+#ifndef _CL_THREAD_H_\r
+#define _CL_THREAD_H_\r
+\r
+\r
+#include <complib/cl_thread_osd.h>\r
+\r
+\r
+/****i* Component Library/Thread\r
+* NAME\r
+* Thread\r
+*\r
+* DESCRIPTION\r
+* The Thread provides a separate thread of execution.\r
+*\r
+* The cl_thread_t structure should be treated as opaque and should be\r
+* manipulated only through the provided functions.\r
+*********/\r
+\r
+\r
+/****d* Component Library: Thread/cl_pfn_thread_callback_t\r
+* NAME\r
+* cl_pfn_thread_callback_t\r
+*\r
+* DESCRIPTION\r
+* The cl_pfn_thread_callback_t function type defines the prototype\r
+* for functions invoked by thread objects\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef void\r
+(CL_API *cl_pfn_thread_callback_t)(\r
+ IN void* context );\r
+/*\r
+* PARAMETERS\r
+* context\r
+* [in] Value specified in a call to cl_thread_init or\r
+* cl_thread_pool_create.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* This function type is provided as function prototype reference for\r
+* the function provided by users as a parameter to the cl_thread_init\r
+* and cl_thread_pool_create functions.\r
+*\r
+* SEE ALSO\r
+* Thread Pool\r
+*********/\r
+\r
+\r
+/****i* Component Library: Thread/cl_thread_t\r
+* NAME\r
+* cl_thread_t\r
+*\r
+* DESCRIPTION\r
+* Thread structure.\r
+*\r
+* The cl_thread_t structure should be treated as opaque and should be\r
+* manipulated only through the provided functions.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _cl_thread\r
+{\r
+ cl_thread_osd_t osd;\r
+ cl_pfn_thread_callback_t pfn_callback;\r
+ const void *context;\r
+ char name[16];\r
+\r
+} cl_thread_t;\r
+/*\r
+* FIELDS\r
+* osd\r
+* Implementation specific structure for managing thread information.\r
+*\r
+* pfn_callback\r
+* Callback function for the thread to invoke.\r
+*\r
+* context\r
+* Context to pass to the thread callback function.\r
+*\r
+* name\r
+* Name to assign to the thread.\r
+*\r
+* SEE ALSO\r
+* Thread\r
+*********/\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif\r
+\r
+\r
+/****i* Component Library: Thread/cl_thread_construct\r
+* NAME\r
+* cl_thread_construct\r
+*\r
+* DESCRIPTION\r
+* The cl_thread_construct function initializes the state of a thread.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_thread_construct(\r
+ IN cl_thread_t* const p_thread );\r
+/*\r
+* PARAMETERS\r
+* p_thread\r
+* [in] Pointer to a cl_thread_t structure whose state to initialize.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* Allows calling cl_thread_destroy without first calling cl_thread_init.\r
+*\r
+* Calling cl_thread_construct is a prerequisite to calling any other\r
+* thread function except cl_thread_init.\r
+*\r
+* SEE ALSO\r
+* Thread, cl_thread_init, cl_thread_destroy\r
+*********/\r
+\r
+\r
+/****i* Component Library: Thread/cl_thread_init\r
+* NAME\r
+* cl_thread_init\r
+*\r
+* DESCRIPTION\r
+* The cl_thread_init function creates a new thread of execution.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_status_t CL_API\r
+cl_thread_init(\r
+ IN cl_thread_t* const p_thread,\r
+ IN cl_pfn_thread_callback_t pfn_callback,\r
+ IN const void* const context,\r
+ IN const char* const name );\r
+/*\r
+* PARAMETERS\r
+* p_thread\r
+* [in] Pointer to a cl_thread_t structure to initialize.\r
+*\r
+* pfn_callback\r
+* [in] Address of a function to be invoked by a thread.\r
+* See the cl_pfn_thread_callback_t function type definition for\r
+* details about the callback function.\r
+*\r
+* context\r
+* [in] Value to pass to the callback function.\r
+*\r
+* name\r
+* [in] Name to associate with the thread. The name may be up to 16\r
+* characters, including a terminating null character.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if thread creation succeeded.\r
+*\r
+* CL_ERROR if thread creation failed.\r
+*\r
+* NOTES\r
+* The thread created with cl_thread_init will invoke the callback\r
+* specified by the callback parameter with context as single parameter.\r
+*\r
+* The callback function is invoked once, and the thread exits when the\r
+* callback returns.\r
+*\r
+* It is invalid to call cl_thread_destroy from the callback function,\r
+* as doing so will result in a deadlock.\r
+*\r
+* SEE ALSO\r
+* Thread, cl_thread_construct, cl_thread_destroy, cl_thread_suspend,\r
+* cl_thread_stall, cl_pfn_thread_callback_t\r
+*********/\r
+\r
+\r
+/****i* Component Library: Thread/cl_thread_destroy\r
+* NAME\r
+* cl_thread_destroy\r
+*\r
+* DESCRIPTION\r
+* The cl_thread_destroy function performs any necessary cleanup to free\r
+* resources associated with the specified thread.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_thread_destroy(\r
+ IN cl_thread_t* const p_thread );\r
+/*\r
+* PARAMETERS\r
+* p_thread\r
+* [in] Pointer to a cl_thread_t structure to destroy.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* This function blocks until the thread exits and must not be called by the\r
+* thread itself. Callers must therefore ensure that such a blocking call is\r
+* possible from the context of the call.\r
+*\r
+* This function must only be called after a call to cl_thread_construct or\r
+* cl_thread_init.\r
+*\r
+* SEE ALSO\r
+* Thread, cl_thread_construct, cl_thread_init\r
+*********/\r
+\r
+\r
+/****f* Component Library: Thread/cl_thread_suspend\r
+* NAME\r
+* cl_thread_suspend\r
+*\r
+* DESCRIPTION\r
+* The cl_thread_suspend function suspends the calling thread for a minimum\r
+* of the specified number of milliseconds.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_thread_suspend(\r
+ IN const uint32_t pause_ms );\r
+/*\r
+* PARAMETERS\r
+* pause_ms\r
+* [in] Number of milliseconds to suspend the calling thread.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* This function should only be called if it is valid for the caller's thread\r
+* to enter a wait state. For stalling a thread that cannot enter a wait\r
+* state, callers should use cl_thread_stall.\r
+*\r
+* SEE ALSO\r
+* Thread, cl_thread_stall\r
+*********/\r
+\r
+\r
+/****f* Component Library: Thread/cl_thread_stall\r
+* NAME\r
+* cl_thread_stall\r
+*\r
+* DESCRIPTION\r
+* The cl_thread_stall function stalls the calling thread for a minimum of\r
+* the specified number of microseconds.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_thread_stall(\r
+ IN const uint32_t pause_us );\r
+/*\r
+* PARAMETERS\r
+* pause_us\r
+* [in] Number of microseconds to stall the calling thread.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* The cl_thread_stall function performs a busy wait for the specified\r
+* number of microseconds. Care should be taken when using this function as\r
+* it does not relinquish its quantum of operation. For longer wait\r
+* operations, users should call cl_thread_suspend if possible.\r
+*\r
+* SEE ALSO\r
+* Thread, cl_thread_suspend\r
+*********/\r
+\r
+\r
+/****f* Component Library: Thread/cl_proc_count\r
+* NAME\r
+* cl_proc_count\r
+*\r
+* DESCRIPTION\r
+* The cl_proc_count function returns the number of processors in the system.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT uint32_t CL_API\r
+cl_proc_count( void );\r
+/*\r
+* RETURN VALUE\r
+* Returns the number of processors in the system.\r
+*********/\r
+\r
+\r
+/****i* Component Library: Thread/cl_is_current_thread\r
+* NAME\r
+* cl_is_current_thread\r
+*\r
+* DESCRIPTION\r
+* The cl_is_current_thread function compares the calling thread to the\r
+* specified thread and returns whether they are the same.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT boolean_t CL_API\r
+cl_is_current_thread(\r
+ IN const cl_thread_t* const p_thread );\r
+/*\r
+* PARAMETERS\r
+* p_thread\r
+* [in] Pointer to a cl_thread_t structure to compare to the\r
+* caller's thead.\r
+*\r
+* RETURN VALUES\r
+* TRUE if the thread specified by the p_thread parameter is the\r
+* calling thread.\r
+*\r
+* FALSE otherwise.\r
+*\r
+* SEE ALSO\r
+* Thread, cl_threadinit_t\r
+*********/\r
+\r
+\r
+/****f* Component Library: Thread/cl_is_blockable\r
+* NAME\r
+* cl_is_blockable\r
+*\r
+* DESCRIPTION\r
+* The cl_is_blockable indicates if the current caller context is\r
+* blockable.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT boolean_t CL_API\r
+cl_is_blockable( void );\r
+/*\r
+* RETURN VALUE\r
+* TRUE if the caller's thread context can be blocked, i.e it is safe\r
+* to perform a sleep, or call a down operation on a semaphore.\r
+*\r
+* FALSE otherwise\r
+*\r
+* SEE ALSO\r
+* Thread\r
+*********/\r
+\r
+\r
+#ifdef __cplusplus\r
+} /* extern "C" */\r
+#endif\r
+\r
+\r
+#endif /* _CL_THREAD_H_ */\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. \r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+/*\r
+ * Abstract:\r
+ * Declaration of thread pool.\r
+ *\r
+ * Environment:\r
+ * All\r
+ */\r
+\r
+\r
+#ifndef _CL_THREAD_POOL_H_\r
+#define _CL_THREAD_POOL_H_\r
+\r
+\r
+#include <complib/cl_list.h>\r
+#include <complib/cl_thread.h>\r
+#include <complib/cl_event.h>\r
+\r
+\r
+/****h* Component Library/Thread Pool\r
+* NAME\r
+* Thread Pool\r
+*\r
+* DESCRIPTION\r
+* The Thread Pool manages a user specified number of threads.\r
+*\r
+* Each thread in the thread pool waits for a user initiated signal before\r
+* invoking a user specified callback function. All threads in the thread\r
+* pool invoke the same callback function.\r
+*\r
+* The thread pool functions operate on a cl_thread_pool_t structure which\r
+* should be treated as opaque, and should be manipulated only through the\r
+* provided functions.\r
+*\r
+* SEE ALSO\r
+* Structures:\r
+* cl_thread_pool_t\r
+*\r
+* Initialization:\r
+* cl_thread_pool_construct, cl_thread_pool_init, cl_thread_pool_destroy\r
+*\r
+* Manipulation\r
+* cl_thread_pool_signal\r
+*********/\r
+\r
+\r
+/****s* Component Library: Thread Pool/cl_thread_pool_t\r
+* NAME\r
+* cl_thread_pool_t\r
+*\r
+* DESCRIPTION\r
+* Thread pool structure.\r
+*\r
+* The cl_thread_pool_t structure should be treated as opaque, and should be\r
+* manipulated only through the provided functions.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _cl_thread_pool\r
+{\r
+ cl_pfn_thread_callback_t pfn_callback;\r
+ const void *context;\r
+ cl_list_t thread_list;\r
+ cl_event_t wakeup_event;\r
+ cl_event_t destroy_event;\r
+ boolean_t exit;\r
+ cl_state_t state;\r
+ atomic32_t running_count;\r
+\r
+} cl_thread_pool_t;\r
+/*\r
+* FIELDS\r
+* pfn_callback\r
+* Callback function for the thread to invoke.\r
+*\r
+* context\r
+* Context to pass to the thread callback function.\r
+*\r
+* thread_list\r
+* List of threads managed by the thread pool.\r
+*\r
+* event\r
+* Event used to signal threads to wake up and do work.\r
+*\r
+* destroy_event\r
+* Event used to signal threads to exit.\r
+*\r
+* exit\r
+* Flag used to indicates threads to exit.\r
+*\r
+* state\r
+* State of the thread pool.\r
+*\r
+* running_count\r
+* Number of threads running.\r
+*\r
+* SEE ALSO\r
+* Thread Pool\r
+*********/\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif\r
+\r
+\r
+/****f* Component Library: Thread Pool/cl_thread_pool_construct\r
+* NAME\r
+* cl_thread_pool_construct\r
+*\r
+* DESCRIPTION\r
+* The cl_thread_pool_construct function initializes the state of a\r
+* thread pool.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_thread_pool_construct(\r
+ IN cl_thread_pool_t* const p_thread_pool );\r
+/*\r
+* PARAMETERS\r
+* p_thread_pool\r
+* [in] Pointer to a thread pool structure.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* Allows calling cl_thread_pool_destroy without first calling\r
+* cl_thread_pool_init.\r
+*\r
+* Calling cl_thread_pool_construct is a prerequisite to calling any other\r
+* thread pool function except cl_thread_pool_init.\r
+*\r
+* SEE ALSO\r
+* Thread Pool, cl_thread_pool_init, cl_thread_pool_destroy\r
+*********/\r
+\r
+\r
+/****f* Component Library: Thread Pool/cl_thread_pool_init\r
+* NAME\r
+* cl_thread_pool_init\r
+*\r
+* DESCRIPTION\r
+* The cl_thread_pool_init function creates the threads to be\r
+* managed by a thread pool.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_status_t CL_API\r
+cl_thread_pool_init(\r
+ IN cl_thread_pool_t* const p_thread_pool,\r
+ IN uint32_t thread_count,\r
+ IN cl_pfn_thread_callback_t pfn_callback,\r
+ IN const void* const context,\r
+ IN const char* const name );\r
+/*\r
+* PARAMETERS\r
+* p_thread_pool\r
+* [in] Pointer to a thread pool structure to initialize.\r
+*\r
+* thread_count\r
+* [in] Number of threads to be managed by the thread pool.\r
+*\r
+* pfn_callback\r
+* [in] Address of a function to be invoked by a thread.\r
+* See the cl_pfn_thread_callback_t function type definition for\r
+* details about the callback function.\r
+*\r
+* context\r
+* [in] Value to pass to the callback function.\r
+*\r
+* name\r
+* [in] Name to associate with the threads. The name may be up to 16\r
+* characters, including a terminating null character. All threads\r
+* created in the pool have the same name.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if the thread pool creation succeeded.\r
+*\r
+* CL_INSUFFICIENT_MEMORY if there was not enough memory to inititalize\r
+* the thread pool.\r
+*\r
+* CL_ERROR if the threads could not be created.\r
+*\r
+* NOTES\r
+* cl_thread_pool_init creates and starts the specified number of threads.\r
+* If thread_count is zero, the thread pool creates as many threads as there\r
+* are processors in the system.\r
+*\r
+* SEE ALSO\r
+* Thread Pool, cl_thread_pool_construct, cl_thread_pool_destroy,\r
+* cl_thread_pool_signal, cl_pfn_thread_callback_t\r
+*********/\r
+\r
+\r
+/****f* Component Library: Thread Pool/cl_thread_pool_destroy\r
+* NAME\r
+* cl_thread_pool_destroy\r
+*\r
+* DESCRIPTION\r
+* The cl_thread_pool_destroy function performs any necessary cleanup\r
+* for a thread pool.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_thread_pool_destroy(\r
+ IN cl_thread_pool_t* const p_thread_pool );\r
+/*\r
+* PARAMETERS\r
+* p_thread_pool\r
+* [in] Pointer to a thread pool structure to destroy.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* This function blocks until all threads exit, and must therefore not\r
+* be called from any of the thread pool's threads. Because of its blocking\r
+* nature, callers of cl_thread_pool_destroy must ensure that entering a wait\r
+* state is valid from the calling thread context.\r
+*\r
+* This function should only be called after a call to\r
+* cl_thread_pool_construct or cl_thread_pool_init.\r
+*\r
+* SEE ALSO\r
+* Thread Pool, cl_thread_pool_construct, cl_thread_pool_init\r
+*********/\r
+\r
+\r
+/****f* Component Library: Thread Pool/cl_thread_pool_signal\r
+* NAME\r
+* cl_thread_pool_signal\r
+*\r
+* DESCRIPTION\r
+* The cl_thread_pool_signal function signals a single thread of\r
+* the thread pool to invoke the thread pool\92s callback function.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_status_t CL_API\r
+cl_thread_pool_signal(\r
+ IN cl_thread_pool_t* const p_thread_pool );\r
+/*\r
+* PARAMETERS\r
+* p_thread_pool\r
+* [in] Pointer to a thread pool structure to signal.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if the thread pool was successfully signalled.\r
+*\r
+* CL_ERROR otherwise.\r
+*\r
+* NOTES\r
+* Each call to this function wakes up at most one waiting thread in\r
+* the thread pool.\r
+*\r
+* If all threads are running, cl_thread_pool_signal has no effect.\r
+*\r
+* SEE ALSO\r
+* Thread Pool\r
+*********/\r
+\r
+\r
+#ifdef __cplusplus\r
+} /* extern "C" */\r
+#endif\r
+\r
+\r
+#endif /* _CL_THREAD_POOL_H_ */\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. \r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+/*\r
+ * Abstract:\r
+ * Declaration of timer abstraction.\r
+ *\r
+ * Environment:\r
+ * All\r
+ */\r
+\r
+\r
+#ifndef _CL_TIMER_H_\r
+#define _CL_TIMER_H_\r
+\r
+\r
+#include <complib/cl_types.h>\r
+\r
+\r
+/****h* Component Library/Timer\r
+* NAME\r
+* Timer\r
+*\r
+* DESCRIPTION\r
+* The Timer provides the ability to schedule a function to be invoked at\r
+* a given time in the future.\r
+*\r
+* The timer callback function must not perform any blocking operations.\r
+*\r
+* The timer functions operate on a cl_timer_t structure which should be\r
+* treated as opaque and should be manipulated only through the provided\r
+* functions.\r
+*\r
+* SEE ALSO\r
+* Structures:\r
+* cl_timer_t\r
+*\r
+* Callbacks:\r
+* cl_pfn_timer_callback_t\r
+*\r
+* Initialization:\r
+* cl_timer_construct, cl_timer_init, cl_timer_destroy\r
+*\r
+* Manipulation:\r
+* cl_timer_start, cl_timer_stop\r
+*********/\r
+\r
+\r
+/****d* Component Library: Timer/cl_pfn_timer_callback_t\r
+* NAME\r
+* cl_pfn_timer_callback_t\r
+*\r
+* DESCRIPTION\r
+* The cl_pfn_timer_callback_t function type defines the prototype for\r
+* functions used to notify users of a timer expiration.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef void\r
+(CL_API *cl_pfn_timer_callback_t)(\r
+ IN void* context );\r
+/*\r
+* PARAMETERS\r
+* context\r
+* [in] Value specified in a previous call to cl_timer_init.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* This function type is provided as function prototype reference for the\r
+* function provided by users as a parameter to the cl_timer_init function.\r
+*\r
+* SEE ALSO\r
+* Timer, cl_timer_init\r
+*********/\r
+\r
+\r
+/*\r
+ * This include file defines the timer structure, and depends on the timer\r
+ * callback definition.\r
+ */\r
+#include <complib/cl_timer_osd.h>\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif\r
+\r
+\r
+/****f* Component Library: Timer/cl_timer_construct\r
+* NAME\r
+* cl_timer_construct\r
+*\r
+* DESCRIPTION\r
+* The cl_timer_construct function initializes the state of a timer.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_timer_construct(\r
+ IN cl_timer_t* const p_timer );\r
+/*\r
+* PARAMETERS\r
+* p_timer\r
+* [in] Pointer to a cl_timer_t structure whose state to initialize.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* Allows calling cl_timer_destroy without first calling cl_timer_init.\r
+*\r
+* Calling cl_timer_construct is a prerequisite to calling any other\r
+* timer function except cl_timer_init.\r
+*\r
+* SEE ALSO\r
+* Timer, cl_timer_init, cl_timer_destroy\r
+*********/\r
+\r
+\r
+/****f* Component Library: Timer/cl_timer_init\r
+* NAME\r
+* cl_timer_init\r
+*\r
+* DESCRIPTION\r
+* The cl_timer_init function initializes a timer for use.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_status_t CL_API\r
+cl_timer_init(\r
+ IN cl_timer_t* const p_timer,\r
+ IN cl_pfn_timer_callback_t pfn_callback,\r
+ IN const void* const context );\r
+/*\r
+* PARAMETERS\r
+* p_timer\r
+* [in] Pointer to a cl_timer_t structure to initialize.\r
+*\r
+* pfn_callback\r
+* [in] Address of a callback function to be invoked when a timer expires.\r
+* See the cl_pfn_timer_callback_t function type definition for details\r
+* about the callback function.\r
+*\r
+* context\r
+* [in] Value to pass to the callback function.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if the timer was successfully initialized.\r
+*\r
+* CL_ERROR otherwise.\r
+*\r
+* NOTES\r
+* Allows calling cl_timer_start and cl_timer_stop.\r
+*\r
+* SEE ALSO\r
+* Timer, cl_timer_construct, cl_timer_destroy, cl_timer_start,\r
+* cl_timer_stop, cl_pfn_timer_callback_t\r
+*********/\r
+\r
+\r
+/****f* Component Library: Timer/cl_timer_destroy\r
+* NAME\r
+* cl_timer_destroy\r
+*\r
+* DESCRIPTION\r
+* The cl_timer_destroy function performs any necessary cleanup of a timer.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_timer_destroy(\r
+ IN cl_timer_t* const p_timer );\r
+/*\r
+* PARAMETERS\r
+* p_timer\r
+* [in] Pointer to a cl_timer_t structure to destroy.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* cl_timer_destroy cancels any pending callbacks.\r
+*\r
+* This function should only be called after a call to cl_timer_construct\r
+* or cl_timer_init.\r
+*\r
+* SEE ALSO\r
+* Timer, cl_timer_construct, cl_timer_init\r
+*********/\r
+\r
+\r
+/****f* Component Library: Timer/cl_timer_start\r
+* NAME\r
+* cl_timer_start\r
+*\r
+* DESCRIPTION\r
+* The cl_timer_start function sets a timer to expire after a given interval.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_status_t CL_API\r
+cl_timer_start(\r
+ IN cl_timer_t* const p_timer,\r
+ IN const uint32_t time_ms );\r
+/*\r
+* PARAMETERS\r
+* p_timer\r
+* [in] Pointer to a cl_timer_t structure to schedule.\r
+*\r
+* time_ms\r
+* [in] Time, in milliseconds, before the timer should expire.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if the timer was successfully scheduled.\r
+*\r
+* CL_ERROR otherwise.\r
+*\r
+* NOTES\r
+* cl_timer_start implicitly stops the timer before being scheduled.\r
+*\r
+* The interval specified by the time_ms parameter is a minimum interval.\r
+* The timer is guaranteed to expire no sooner than the desired interval, but\r
+* may take longer to expire.\r
+*\r
+* SEE ALSO\r
+* Timer, cl_timer_stop, cl_timer_trim\r
+*********/\r
+\r
+\r
+/****f* Component Library: Timer/cl_timer_stop\r
+* NAME\r
+* cl_timer_stop\r
+*\r
+* DESCRIPTION\r
+* The cl_timer_stop function stops a pending timer from expiring.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_timer_stop(\r
+ IN cl_timer_t* const p_timer );\r
+/*\r
+* PARAMETERS\r
+* p_timer\r
+* [in] Pointer to a cl_timer_t structure.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* SEE ALSO\r
+* Timer, cl_timer_start, cl_timer_trim\r
+*********/\r
+\r
+\r
+/****f* Component Library: Timer/cl_timer_trim\r
+* NAME\r
+* cl_timer_trim\r
+*\r
+* DESCRIPTION\r
+* The cl_timer_trim function pulls in the absolute expiration\r
+* time of a timer if the current expiration time exceeds the specified\r
+* interval.\r
+*\r
+* sets a timer to expire after a given\r
+* interval if that interval is less than the current timer expiration.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_status_t CL_API\r
+cl_timer_trim(\r
+ IN cl_timer_t* const p_timer,\r
+ IN const uint32_t time_ms );\r
+/*\r
+* PARAMETERS\r
+* p_timer\r
+* [in] Pointer to a cl_timer_t structure to schedule.\r
+*\r
+* time_ms\r
+* [in] Maximum time, in milliseconds, before the timer should expire.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if the timer was successfully scheduled.\r
+*\r
+* CL_ERROR otherwise.\r
+*\r
+* NOTES\r
+* cl_timer_trim has no effect if the time interval is greater than the\r
+* remaining time when the timer is set.\r
+*\r
+* If the new interval time is less than the remaining time, cl_timer_trim\r
+* implicitly stops the timer before reseting it.\r
+*\r
+* If the timer is reset, it is guaranteed to expire no sooner than the\r
+* new interval, but may take longer to expire.\r
+*\r
+* SEE ALSO\r
+* Timer, cl_timer_start, cl_timer_stop\r
+*********/\r
+\r
+\r
+/****f* Component Library: Time Stamp/cl_get_time_stamp\r
+* NAME\r
+* cl_get_time_stamp\r
+*\r
+* DESCRIPTION\r
+* The cl_get_time_stamp function returns the current time stamp in\r
+* microseconds since the system was booted.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT uint64_t CL_API\r
+cl_get_time_stamp( void );\r
+/*\r
+* RETURN VALUE\r
+* Time elapsed, in microseconds, since the system was booted.\r
+*\r
+* SEE ALSO\r
+* Timer, cl_get_time_stamp_usec, cl_get_time_stamp_sec\r
+*********/\r
+\r
+\r
+/****f* Component Library: Time Stamp/cl_get_time_stamp_usec\r
+* NAME\r
+* cl_get_time_stamp_usec\r
+*\r
+* DESCRIPTION\r
+* The cl_get_time_stamp_usec function returns the current time stamp in\r
+* microseconds since the system was booted.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE uint64_t CL_API\r
+cl_get_time_stamp_usec( void )\r
+{\r
+ return cl_get_time_stamp();\r
+}\r
+/*\r
+* RETURN VALUE\r
+* Time elapsed, in microseconds, since the system was booted.\r
+*\r
+* SEE ALSO\r
+* Timer, cl_get_time_stamp, cl_get_time_stamp_sec\r
+*********/\r
+\r
+\r
+/****f* Component Library: Time Stamp/cl_get_time_stamp_sec\r
+* NAME\r
+* cl_get_time_stamp_sec\r
+*\r
+* DESCRIPTION\r
+* The cl_get_time_stamp_sec function returns the current time stamp in\r
+* seconds since the system was booted.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT uint32_t CL_API\r
+cl_get_time_stamp_sec( void );\r
+/*\r
+* RETURN VALUE\r
+* Time elapsed, in seconds, since the system was booted.\r
+*\r
+* SEE ALSO\r
+* Timer, cl_get_time_stamp\r
+*********/\r
+\r
+\r
+/****f* Component Library: Time Stamp/cl_get_tick_count\r
+* NAME\r
+* cl_get_tick_count\r
+*\r
+* DESCRIPTION\r
+* The cl_get_tick_count function returns the raw high-resolution\r
+* performance counter value.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT uint64_t CL_API\r
+cl_get_tick_count( void );\r
+/*\r
+* RETURN VALUE\r
+* Value of the high-resolution performance counter.\r
+*\r
+* SEE ALSO\r
+* Timer, cl_get_time_stamp, cl_get_tick_freq\r
+*********/\r
+\r
+\r
+/****f* Component Library: Time Stamp/cl_get_tick_freq\r
+* NAME\r
+* cl_get_tick_freq\r
+*\r
+* DESCRIPTION\r
+* The cl_get_tick_freq function returns the frequency of the\r
+* high-resolution performance counter.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT uint64_t CL_API\r
+cl_get_tick_freq( void );\r
+/*\r
+* RETURN VALUE\r
+* The frequency of the high-resolution performance counter.\r
+*\r
+* SEE ALSO\r
+* Timer, cl_get_time_stamp, cl_get_tick_count\r
+*********/\r
+\r
+\r
+#ifdef __cplusplus\r
+} /* extern "C" */\r
+#endif\r
+\r
+#endif /* _CL_TIMER_H_ */\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. \r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+/*\r
+ * Abstract:\r
+ * Defines standard return codes, keywords, macros, and debug levels.\r
+ *\r
+ * Environment:\r
+ * All supported platforms\r
+ */\r
+\r
+\r
+#ifndef _CL_TYPES_H_\r
+#define _CL_TYPES_H_\r
+\r
+\r
+#include <complib/cl_types_osd.h>\r
+\r
+\r
+typedef uint16_t net16_t;\r
+typedef uint32_t net32_t;\r
+typedef uint64_t net64_t;\r
+\r
+\r
+\r
+/****d* Component Library: Pointer Manipulation/offsetof\r
+* NAME\r
+* offsetof\r
+*\r
+* DESCRIPTION\r
+* The offsetof macro returns the offset of a member within a structure.\r
+*\r
+* SYNOPSIS\r
+* uintn_t\r
+* offsetof(\r
+* IN TYPE,\r
+* IN MEMBER );\r
+*\r
+* PARAMETERS\r
+* TYPE\r
+* [in] Name of the structure containing the specified member.\r
+*\r
+* MEMBER\r
+* [in] Name of the member whose offset in the specified structure\r
+* is to be returned.\r
+*\r
+* RETURN VALUE\r
+* Number of bytes from the beginning of the structure to the\r
+* specified member.\r
+*\r
+* SEE ALSO\r
+* PARENT_STRUCT\r
+*********/\r
+#ifndef offsetof\r
+#define offsetof(TYPE, MEMBER) ((uintn_t) &((TYPE *)0)->MEMBER)\r
+#endif\r
+\r
+\r
+/****d* Component Library: Pointer Manipulation/PARENT_STRUCT\r
+* NAME\r
+* PARENT_STRUCT\r
+*\r
+* DESCRIPTION\r
+* The PARENT_STRUCT macro returns a pointer to a structure\r
+* given a name and pointer to one of its members.\r
+*\r
+* SYNOPSIS\r
+* PARENT_TYPE*\r
+* PARENT_STRUCT(\r
+* IN void* const p_member,\r
+* IN PARENT_TYPE,\r
+* IN MEMBER_NAME );\r
+*\r
+* PARAMETERS\r
+* p_member\r
+* [in] Pointer to the MEMBER_NAME member of a PARENT_TYPE structure.\r
+*\r
+* PARENT_TYPE\r
+* [in] Name of the structure containing the specified member.\r
+*\r
+* MEMBER_NAME\r
+* [in] Name of the member whose address is passed in the p_member\r
+* parameter.\r
+*\r
+* RETURN VALUE\r
+* Pointer to a structure of type PARENT_TYPE whose MEMBER_NAME member is\r
+* located at p_member.\r
+*\r
+* SEE ALSO\r
+* offsetof\r
+*********/\r
+#ifndef PARENT_STRUCT\r
+#define PARENT_STRUCT(p_member, PARENT_TYPE, MEMBER_NAME) \\r
+ ((PARENT_TYPE*)((uint8_t*)(p_member) - offsetof(PARENT_TYPE, MEMBER_NAME)))\r
+#endif\r
+\r
+/****d* Component Library/Parameter Keywords\r
+* NAME\r
+* Parameter Keywords\r
+*\r
+* DESCRIPTION\r
+* The Parameter Keywords can be used to clarify the usage of function\r
+* parameters to users.\r
+*\r
+* VALUES\r
+* IN\r
+* Designates that the parameter is used as input to a function.\r
+*\r
+* OUT\r
+* Designates that the parameter's value will be set by the function.\r
+*\r
+* OPTIONAL\r
+* Designates that the parameter is optional, and may be NULL.\r
+* The OPTIONAL keyword, if used, follows the parameter name.\r
+*\r
+* EXAMPLE\r
+* // Function declaration.\r
+* void*\r
+* my_func(\r
+* IN void* const p_param1,\r
+* OUT void** const p_handle OPTIONAL );\r
+*\r
+* NOTES\r
+* Multiple keywords can apply to a single parameter. The IN and OUT\r
+* keywords precede the parameter type. The OPTIONAL\r
+* keyword, if used, follows the parameter name.\r
+*********/\r
+#ifndef IN\r
+#define IN /* Function input parameter */\r
+#endif\r
+#ifndef OUT\r
+#define OUT /* Function output parameter */\r
+#endif\r
+#ifndef OPTIONAL\r
+#define OPTIONAL /* Optional function parameter - NULL if not used */\r
+#endif\r
+\r
+\r
+/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
+%% Function Returns And Completion Codes %%\r
+%% %%\r
+%% The text for any addition to this enumerated type must be added to the %%\r
+%% string array defined in <cl_statustext.c>. %%\r
+%% %%\r
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/\r
+\r
+\r
+/****d* Component Library/Data Types\r
+* NAME\r
+* Data Types\r
+*\r
+* DESCRIPTION\r
+* The component library provides and uses explicitly sized types.\r
+*\r
+* VALUES\r
+* char\r
+* 8-bit, defined by compiler.\r
+*\r
+* void\r
+* 0-bit, defined by compiler.\r
+*\r
+* int8_t\r
+* 8-bit signed integer.\r
+*\r
+* uint8_t\r
+* 8-bit unsigned integer.\r
+*\r
+* int16_t\r
+* 16-bit signed integer.\r
+*\r
+* uint16_t\r
+* 16-bit unsigned integer.\r
+*\r
+* net16_t\r
+* 16-bit network byte order value.\r
+*\r
+* int32_t\r
+* 32-bit signed integer.\r
+*\r
+* uint32_t\r
+* 32-bit unsigned integer.\r
+*\r
+* net32_t\r
+* 32-bit network byte order value.\r
+*\r
+* int64_t\r
+* 64-bit signed integer.\r
+*\r
+* uint64_t\r
+* 64-bit unsigned integer.\r
+*\r
+* net64_t\r
+* 64-bit network byte order value.\r
+*\r
+* intn_t\r
+* Signed natural sized integer. 32-bit on a 32-bit platform, 64-bit on\r
+* a 64-bit platform.\r
+*\r
+* uintn_t\r
+* Unsigned natural sized integer. 32-bit on a 32-bit platform, 64-bit on\r
+* a 64-bit platform.\r
+*\r
+* boolean_t\r
+* integral sized. Set to TRUE or FALSE and used in logical expressions.\r
+*\r
+* NOTES\r
+* Pointer types are not defined as these provide no value and can potentially\r
+* lead to naming confusion.\r
+*********/\r
+\r
+\r
+/****d* Component Library: Data Types/cl_status_t\r
+* NAME\r
+* cl_status_t\r
+*\r
+* DESCRIPTION\r
+* The cl_status_t return types are used by the component library to\r
+* provide detailed function return values.\r
+*\r
+* SYNOPSIS\r
+*/\r
+#ifdef CL_KERNEL\r
+\r
+typedef enum _cl_status\r
+{\r
+ CL_SUCCESS = STATUS_SUCCESS,\r
+ CL_ERROR = STATUS_DRIVER_INTERNAL_ERROR,\r
+ CL_INVALID_STATE = STATUS_INVALID_DEVICE_STATE,\r
+ CL_INVALID_OPERATION = STATUS_NOT_SUPPORTED,\r
+ CL_INVALID_SETTING = STATUS_INVALID_PARAMETER_MIX,\r
+ CL_INVALID_PARAMETER = STATUS_INVALID_PARAMETER,\r
+ CL_INSUFFICIENT_RESOURCES = STATUS_INSUFFICIENT_RESOURCES,\r
+ CL_INSUFFICIENT_MEMORY = STATUS_NO_MEMORY,\r
+ CL_INVALID_PERMISSION = STATUS_ACCESS_DENIED,\r
+ CL_COMPLETED = STATUS_EVENT_DONE,\r
+ CL_NOT_DONE = STATUS_ABANDONED,\r
+ CL_PENDING = STATUS_PENDING,\r
+ CL_TIMEOUT = STATUS_TIMEOUT,\r
+ CL_CANCELED = STATUS_CANCELLED,\r
+ CL_REJECT = STATUS_REQUEST_NOT_ACCEPTED,\r
+ CL_OVERRUN = STATUS_DATA_OVERRUN,\r
+ CL_NOT_FOUND = STATUS_NOT_FOUND,\r
+ CL_UNAVAILABLE = STATUS_DEVICE_NOT_READY,\r
+ CL_BUSY = STATUS_DEVICE_BUSY,\r
+ CL_DISCONNECT = STATUS_LOCAL_DISCONNECT,\r
+ CL_DUPLICATE = STATUS_DUPLICATE_NAME,\r
+ CL_INVALID_REQUEST = STATUS_INVALID_DEVICE_REQUEST,\r
+ CL_INVALID_HANDLE = STATUS_INVALID_HANDLE,\r
+ CL_CONNECTION_INVALID = STATUS_CONNECTION_INVALID\r
+\r
+} cl_status_t;\r
+\r
+#else\r
+\r
+typedef enum _cl_status\r
+{\r
+ CL_SUCCESS = 0,\r
+ CL_ERROR,\r
+ CL_INVALID_STATE,\r
+ CL_INVALID_OPERATION,\r
+ CL_INVALID_SETTING,\r
+ CL_INVALID_PARAMETER,\r
+ CL_INSUFFICIENT_RESOURCES,\r
+ CL_INSUFFICIENT_MEMORY,\r
+ CL_INVALID_PERMISSION,\r
+ CL_COMPLETED,\r
+ CL_NOT_DONE,\r
+ CL_PENDING,\r
+ CL_TIMEOUT,\r
+ CL_CANCELED,\r
+ CL_REJECT,\r
+ CL_OVERRUN,\r
+ CL_NOT_FOUND,\r
+ CL_UNAVAILABLE,\r
+ CL_BUSY,\r
+ CL_DISCONNECT,\r
+ CL_DUPLICATE,\r
+ CL_INVALID_REQUEST,\r
+\r
+ CL_STATUS_COUNT /* should be the last value */\r
+\r
+} cl_status_t;\r
+\r
+#endif\r
+\r
+/*\r
+* SEE ALSO\r
+* Data Types, CL_STATUS_MSG\r
+*********/\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif /* __cplusplus */\r
+\r
+\r
+#ifndef CL_KERNEL\r
+/* Status values above converted to text for easier printing. */\r
+CL_EXPORT const char* cl_status_text[CL_STATUS_COUNT];\r
+#endif\r
+\r
+#ifndef cl_panic\r
+/****f* Component Library: Error Trapping/cl_panic\r
+* NAME\r
+* cl_panic\r
+*\r
+* DESCRIPTION\r
+* Halts execution of the current process. Halts the system if called in\r
+* from the kernel.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_panic(\r
+ IN const char* const message,\r
+ IN ... );\r
+/*\r
+* PARAMETERS\r
+* message\r
+* [in] ANSI string formatted identically as for a call to the standard C\r
+* function printf describing the cause for the panic.\r
+*\r
+* ...\r
+* [in] Extra parameters for string formatting, as defined for the\r
+* standard C function printf.\r
+*\r
+* RETURN VALUE\r
+* This function does not return.\r
+*\r
+* NOTES\r
+* The formatting of the message string is the same as for printf\r
+*\r
+* cl_panic sends the message to the current message logging target.\r
+*********/\r
+#endif /* cl_panic */\r
+\r
+\r
+/****d* Component Library: Data Types/CL_STATUS_MSG\r
+* NAME\r
+* CL_STATUS_MSG\r
+*\r
+* DESCRIPTION\r
+* The CL_STATUS_MSG macro returns a textual representation of\r
+* an cl_status_t code.\r
+*\r
+* SYNOPSIS\r
+* const char*\r
+* CL_STATUS_MSG(\r
+* IN cl_status_t errcode );\r
+*\r
+* PARAMETERS\r
+* errcode\r
+* [in] cl_status_t code for which to return a text representation.\r
+*\r
+* RETURN VALUE\r
+* Pointer to a string containing a textual representation of the errcode\r
+* parameter.\r
+*\r
+* NOTES\r
+* This function performs boundary checking on the cl_status_t value,\r
+* masking off the upper 24-bits. If the value is out of bounds, the string\r
+* "invalid status code" is returned.\r
+*\r
+* SEE ALSO\r
+* cl_status_t\r
+*********/\r
+#ifndef CL_KERNEL\r
+#define CL_STATUS_MSG( errcode ) \\r
+ ((errcode < CL_STATUS_COUNT)?cl_status_text[errcode]:"invalid status code")\r
+#endif \r
+\r
+\r
+#if !defined( FALSE )\r
+#define FALSE 0\r
+#endif /* !defined( TRUE ) */\r
+\r
+\r
+#if !defined( TRUE )\r
+#define TRUE (!FALSE)\r
+#endif /* !defined( TRUE ) */\r
+\r
+\r
+/****d* Component Library: Unreferenced Parameters/UNUSED_PARAM\r
+* NAME\r
+* UNUSED_PARAM\r
+*\r
+* DESCRIPTION\r
+* The UNUSED_PARAM macro can be used to eliminates compiler warnings related\r
+* to intentionally unused formal parameters in function implementations.\r
+*\r
+* SYNOPSIS\r
+* UNUSED_PARAM( P )\r
+*\r
+* EXAMPLE\r
+* void my_func( int32_t value )\r
+* {\r
+* UNUSED_PARAM( value );\r
+* }\r
+*********/\r
+\r
+\r
+/****d* Component Library/Object States\r
+* NAME\r
+* Object States\r
+*\r
+* DESCRIPTION\r
+* The object states enumerated type defines the valid states of components.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef enum _cl_state\r
+{\r
+ CL_UNINITIALIZED = 1,\r
+ CL_INITIALIZED,\r
+ CL_DESTROYING,\r
+ CL_DESTROYED\r
+\r
+} cl_state_t;\r
+/*\r
+* VALUES\r
+* CL_UNINITIALIZED\r
+* Indicates that initialization was not invoked successfully.\r
+*\r
+* CL_INITIALIZED\r
+* Indicates initialization was successful.\r
+*\r
+* CL_DESTROYING\r
+* Indicates that the object is undergoing destruction.\r
+*\r
+* CL_DESTROYED\r
+* Indicates that the object's destructor has already been called. Most\r
+* objects set their final state to CL_DESTROYED before freeing the\r
+* memory associated with the object.\r
+*********/\r
+\r
+\r
+/****d* Component Library: Object States/cl_is_state_valid\r
+* NAME\r
+* cl_is_state_valid\r
+*\r
+* DESCRIPTION\r
+* The cl_is_state_valid function returns whether a state has a valid value.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE boolean_t CL_API\r
+cl_is_state_valid(\r
+ IN const cl_state_t state )\r
+{\r
+ return( (state == CL_UNINITIALIZED) || (state == CL_INITIALIZED) ||\r
+ (state == CL_DESTROYING) || (state == CL_DESTROYED) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* state\r
+* State whose value to validate.\r
+*\r
+* RETURN VALUES\r
+* TRUE if the specified state has a valid value.\r
+*\r
+* FALSE otherwise.\r
+*\r
+* NOTES\r
+* This function is used in debug builds to check for valid states. If an\r
+* uninitialized object is passed, the memory for the state may cause the\r
+* state to have an invalid value.\r
+*\r
+* SEE ALSO\r
+* Object States\r
+*********/\r
+\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif /* __cplusplus */\r
+\r
+\r
+#endif /* _DATA_TYPES_H_ */\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. \r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+/*\r
+ * Abstract:\r
+ * This file contains vector definitions. Vector provides dynmically\r
+ * resizable array functionality. Objects in a Vector are not relocated\r
+ * when the array is resized.\r
+ *\r
+ * Environment:\r
+ * All\r
+ */\r
+\r
+\r
+#ifndef _CL_VECTOR_H_\r
+#define _CL_VECTOR_H_\r
+\r
+\r
+#include <complib/cl_qlist.h>\r
+\r
+\r
+/****h* Component Library/Vector\r
+* NAME\r
+* Vector\r
+*\r
+* DESCRIPTION\r
+* The Vector is a self-sizing array. Like a traditonal array, a vector\r
+* allows efficient constant time access to elements with a specified index.\r
+* A vector grows transparently as the user adds elements to the array.\r
+*\r
+* As the vector grows in size, it does not relocate existing elements in\r
+* memory. This allows using pointers to elements stored in a Vector.\r
+*\r
+* Users can supply an initializer functions that allow a vector to ensure\r
+* that new items added to the vector are properly initialized. A vector\r
+* calls the initializer function on a per object basis when growing the\r
+* array. The initializer is optional.\r
+*\r
+* The initializer function can fail, and returns a cl_status_t. The vector\r
+* will call the destructor function, if provided, for an element that\r
+* failed initialization. If an initializer fails, a vector does not call\r
+* the initializer for objects in the remainder of the new memory allocation.\r
+*\r
+* The cl_vector_t structure should be treated as opaque and should be\r
+* manipulated only through the provided functions.\r
+*\r
+* SEE ALSO\r
+* Structures:\r
+* cl_vector_t\r
+*\r
+* Callbacks:\r
+* cl_pfn_vec_init_t, cl_pfn_vec_dtor_t, cl_pfn_vec_apply_t,\r
+* cl_pfn_vec_find_t\r
+*\r
+* Item Manipulation:\r
+* cl_vector_set_obj, cl_vector_obj\r
+*\r
+* Initialization:\r
+* cl_vector_construct, cl_vector_init, cl_vector_destroy\r
+*\r
+* Manipulation:\r
+* cl_vector_get_capacity, cl_vector_set_capacity,\r
+* cl_vector_get_size, cl_vector_set_size, cl_vector_set_min_size\r
+* cl_vector_get_ptr, cl_vector_get, cl_vector_at, cl_vector_set\r
+*\r
+* Search:\r
+* cl_vector_find_from_start, cl_vector_find_from_end\r
+* cl_vector_apply_func\r
+*********/\r
+\r
+\r
+/****d* Component Library: Vector/cl_pfn_vec_init_t\r
+* NAME\r
+* cl_pfn_vec_init_t\r
+*\r
+* DESCRIPTION\r
+* The cl_pfn_vec_init_t function type defines the prototype for functions\r
+* used as initializer for elements being allocated by a vector.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef cl_status_t\r
+(CL_API *cl_pfn_vec_init_t)(\r
+ IN void* const p_element,\r
+ IN void* context );\r
+/*\r
+* PARAMETERS\r
+* p_element\r
+* [in] Pointer to an element being added to a vector.\r
+*\r
+* context\r
+* [in] Context provided in a call to cl_vector_init.\r
+*\r
+* RETURN VALUES\r
+* Return CL_SUCCESS to indicate that the element was initialized successfully.\r
+*\r
+* Other cl_status_t values will be returned by the cl_vector_init,\r
+* cl_vector_set_size, and cl_vector_set_min_size functions.\r
+*\r
+* In situations where the vector's size needs to grows in order to satisfy\r
+* a call to cl_vector_set, a non-successful status returned by the\r
+* initializer callback causes the growth to stop.\r
+*\r
+* NOTES\r
+* This function type is provided as function prototype reference for\r
+* the initializer function provided by users as an optional parameter to\r
+* the cl_vector_init function.\r
+*\r
+* SEE ALSO\r
+* Vector, cl_vector_init\r
+*********/\r
+\r
+\r
+/****d* Component Library: Vector/cl_pfn_vec_dtor_t\r
+* NAME\r
+* cl_pfn_vec_dtor_t\r
+*\r
+* DESCRIPTION\r
+* The cl_pfn_vec_dtor_t function type defines the prototype for functions\r
+* used as destructor for elements being deallocated from a vector.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef void\r
+(CL_API *cl_pfn_vec_dtor_t)(\r
+ IN void* const p_element,\r
+ IN void* context );\r
+/*\r
+* PARAMETERS\r
+* p_element\r
+* [in] Pointer to an element being deallocated from a vector.\r
+*\r
+* context\r
+* [in] Context provided in a call to cl_vector_init.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* This function type is provided as function prototype reference for\r
+* the destructor function provided by users as an optional parameter to\r
+* the cl_vector_init function.\r
+*\r
+* SEE ALSO\r
+* Vector, cl_vector_init\r
+*********/\r
+\r
+\r
+/****d* Component Library: Vector/cl_pfn_vec_apply_t\r
+* NAME\r
+* cl_pfn_vec_apply_t\r
+*\r
+* DESCRIPTION\r
+* The cl_pfn_vec_apply_t function type defines the prototype for functions\r
+* used to iterate elements in a vector.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef void\r
+(CL_API *cl_pfn_vec_apply_t)(\r
+ IN const size_t index,\r
+ IN void* const p_element,\r
+ IN void* context );\r
+/*\r
+* PARAMETERS\r
+* index\r
+* [in] Index of the element.\r
+*\r
+* p_element\r
+* [in] Pointer to an element at the specified index in the vector.\r
+*\r
+* context\r
+* [in] Context provided in a call to cl_vector_apply_func.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* This function type is provided as function prototype reference for\r
+* the function passed by users as a parameter to the cl_vector_apply_func\r
+* function.\r
+*\r
+* SEE ALSO\r
+* Vector, cl_vector_apply_func\r
+*********/\r
+\r
+\r
+/****d* Component Library: Vector/cl_pfn_vec_find_t\r
+* NAME\r
+* cl_pfn_vec_find_t\r
+*\r
+* DESCRIPTION\r
+* The cl_pfn_vec_find_t function type defines the prototype for functions\r
+* used to find elements in a vector.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef cl_status_t\r
+(CL_API *cl_pfn_vec_find_t)(\r
+ IN const size_t index,\r
+ IN const void* const p_element,\r
+ IN void* context );\r
+/*\r
+* PARAMETERS\r
+* index\r
+* [in] Index of the element.\r
+*\r
+* p_element\r
+* [in] Pointer to an element at the specified index in the vector.\r
+*\r
+* context\r
+* [in] Context provided in a call to cl_vector_find_from_start or\r
+* cl_vector_find_from_end.\r
+*\r
+* RETURN VALUES\r
+* Return CL_SUCCESS if the element was found. This stops vector iteration.\r
+*\r
+* CL_NOT_FOUND to continue the vector iteration.\r
+*\r
+* NOTES\r
+* This function type is provided as function prototype reference for the\r
+* function provided by users as a parameter to the cl_vector_find_from_start\r
+* and cl_vector_find_from_end functions.\r
+*\r
+* SEE ALSO\r
+* Vector, cl_vector_find_from_start, cl_vector_find_from_end\r
+*********/\r
+\r
+\r
+/****i* Component Library: Vector/cl_pfn_vec_copy_t\r
+* NAME\r
+* cl_pfn_vec_copy_t\r
+*\r
+* DESCRIPTION\r
+* The cl_pfn_vec_copy_t function type defines the prototype for functions\r
+* used to copy elements in a vector.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef void\r
+(CL_API *cl_pfn_vec_copy_t)(\r
+ IN void* const p_dest,\r
+ IN const void* const p_src,\r
+ IN const size_t size );\r
+/*\r
+* PARAMETERS\r
+* p_dest\r
+* [in] Pointer to the destination buffer into which to copy p_src.\r
+*\r
+* p_src\r
+* [in] Pointer to the destination buffer from which to copy.\r
+*\r
+* size\r
+* [in] Number of bytes to copy.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* SEE ALSO\r
+* Vector\r
+*********/\r
+\r
+\r
+/****s* Component Library: Vector/cl_vector_t\r
+* NAME\r
+* cl_vector_t\r
+*\r
+* DESCRIPTION\r
+* Vector structure.\r
+*\r
+* The cl_vector_t structure should be treated as opaque and should be\r
+* manipulated only through the provided functions.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _cl_vector\r
+{\r
+ size_t size;\r
+ size_t grow_size;\r
+ size_t capacity;\r
+ size_t element_size;\r
+ cl_pfn_vec_init_t pfn_init;\r
+ cl_pfn_vec_dtor_t pfn_dtor;\r
+ cl_pfn_vec_copy_t pfn_copy;\r
+ const void *context;\r
+ cl_qlist_t alloc_list;\r
+ void **p_ptr_array;\r
+ cl_state_t state;\r
+\r
+} cl_vector_t;\r
+/*\r
+* FIELDS\r
+* size\r
+* Number of elements successfully initialized in the vector.\r
+*\r
+* grow_size\r
+* Number of elements to allocate when growing.\r
+*\r
+* capacity\r
+* total # of elements allocated.\r
+*\r
+* element_size\r
+* Size of each element.\r
+*\r
+* pfn_init\r
+* User supplied element initializer.\r
+*\r
+* pfn_dtor\r
+* User supplied element destructor.\r
+*\r
+* pfn_copy\r
+* Copy operator.\r
+*\r
+* context\r
+* User context for callbacks.\r
+*\r
+* alloc_list\r
+* List of allocations.\r
+*\r
+* p_ptr_array\r
+* Internal array of pointers to elements.\r
+*\r
+* state\r
+* State of the vector.\r
+*\r
+* SEE ALSO\r
+* Vector\r
+*********/\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif\r
+\r
+\r
+/****f* Component Library: Vector/cl_vector_construct\r
+* NAME\r
+* cl_vector_construct\r
+*\r
+* DESCRIPTION\r
+* The cl_vector_construct function constructs a vector.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_vector_construct(\r
+ IN cl_vector_t* const p_vector );\r
+/*\r
+* PARAMETERS\r
+* p_vector\r
+* [in] Pointer to a cl_vector_t structure to construct.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* Allows calling cl_vector_destroy without first calling cl_vector_init.\r
+*\r
+* Calling cl_vector_construct is a prerequisite to calling any other\r
+* vector function except cl_vector_init.\r
+*\r
+* SEE ALSO\r
+* Vector, cl_vector_init, cl_vector_destroy\r
+*********/\r
+\r
+\r
+/****f* Component Library: Vector/cl_vector_init\r
+* NAME\r
+* cl_vector_init\r
+*\r
+* DESCRIPTION\r
+* The cl_vector_init function initializes a vector for use.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_status_t CL_API\r
+cl_vector_init(\r
+ IN cl_vector_t* const p_vector,\r
+ IN const size_t min_size,\r
+ IN const size_t grow_size,\r
+ IN const size_t element_size,\r
+ IN cl_pfn_vec_init_t pfn_init OPTIONAL,\r
+ IN cl_pfn_vec_dtor_t pfn_dtor OPTIONAL,\r
+ IN const void* const context );\r
+/*\r
+* PARAMETERS\r
+* p_vector\r
+* [in] Pointer to a cl_vector_t structure to inititalize.\r
+*\r
+* initial_size\r
+* [in] Initial number of elements.\r
+*\r
+* grow_size\r
+* [in] Number of elements to allocate when incrementally growing\r
+* the vector. A value of zero disables automatic growth.\r
+*\r
+* element_size\r
+* [in] Size of each element.\r
+*\r
+* pfn_init\r
+* [in] Initializer callback to invoke for every new element.\r
+* See the cl_pfn_vec_init_t function type declaration for details about\r
+* the callback function.\r
+*\r
+* pfn_dtor\r
+* [in] Destructor callback to invoke for elements being deallocated.\r
+* See the cl_pfn_vec_dtor_t function type declaration for details about\r
+* the callback function.\r
+*\r
+* context\r
+* [in] Value to pass to the callback functions to provide context.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if the vector was initialized successfully.\r
+*\r
+* CL_INSUFFICIENT_MEMORY if the initialization failed.\r
+*\r
+* cl_status_t value returned by optional initializer function specified by\r
+* the pfn_init parameter.\r
+*\r
+* NOTES\r
+* The constructor and initializer functions, if any, are invoked for every\r
+* new element in the array.\r
+*\r
+* SEE ALSO\r
+* Vector, cl_vector_construct, cl_vector_destroy, cl_vector_set,\r
+* cl_vector_get, cl_vector_get_ptr, cl_vector_at\r
+*********/\r
+\r
+\r
+/****f* Component Library: Vector/cl_vector_destroy\r
+* NAME\r
+* cl_vector_destroy\r
+*\r
+* DESCRIPTION\r
+* The cl_vector_destroy function destroys a vector.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_vector_destroy(\r
+ IN cl_vector_t* const p_vector );\r
+/*\r
+* PARAMETERS\r
+* p_vector\r
+* [in] Pointer to a cl_vector_t structure to destroy.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* cl_vector_destroy frees all memory allocated for the vector. The vector\r
+* is left initialized to a zero capacity and size.\r
+*\r
+* This function should only be called after a call to cl_vector_construct\r
+* or cl_vector_init.\r
+*\r
+* SEE ALSO\r
+* Vector, cl_vector_construct, cl_vector_init\r
+*********/\r
+\r
+\r
+/****f* Component Library: Vector/cl_vector_get_capacity\r
+* NAME\r
+* cl_vector_get_capacity\r
+*\r
+* DESCRIPTION\r
+* The cl_vector_get_capacity function returns the capacity of a vector.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE size_t CL_API\r
+cl_vector_get_capacity(\r
+ IN const cl_vector_t* const p_vector )\r
+{\r
+ CL_ASSERT( p_vector );\r
+ CL_ASSERT( p_vector->state == CL_INITIALIZED );\r
+\r
+ return( p_vector->capacity );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_vector\r
+* [in] Pointer to a cl_vector_t structure whose capacity to return.\r
+*\r
+* RETURN VALUE\r
+* Capacity, in elements, of the vector.\r
+*\r
+* NOTES\r
+* The capacity is the number of elements that the vector can store, and\r
+* can be greater than the number of elements stored. To get the number of\r
+* elements stored in the vector, use cl_vector_get_size.\r
+*\r
+* SEE ALSO\r
+* Vector, cl_vector_set_capacity, cl_vector_get_size\r
+*********/\r
+\r
+\r
+/****f* Component Library: Vector/cl_vector_get_size\r
+* NAME\r
+* cl_vector_get_size\r
+*\r
+* DESCRIPTION\r
+* The cl_vector_get_size function returns the size of a vector.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE size_t CL_API\r
+cl_vector_get_size(\r
+ IN const cl_vector_t* const p_vector )\r
+{\r
+ CL_ASSERT( p_vector );\r
+ CL_ASSERT( p_vector->state == CL_INITIALIZED );\r
+\r
+ return( p_vector->size );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_vector\r
+* [in] Pointer to a cl_vector_t structure whose size to return.\r
+*\r
+* RETURN VALUE\r
+* Size, in elements, of the vector.\r
+*\r
+* SEE ALSO\r
+* Vector, cl_vector_set_size, cl_vector_get_capacity\r
+*********/\r
+\r
+\r
+/****f* Component Library: Vector/cl_vector_get_ptr\r
+* NAME\r
+* cl_vector_get_ptr\r
+*\r
+* DESCRIPTION\r
+* The cl_vector_get_ptr function returns a pointer to an element\r
+* stored in a vector at a specified index.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE void* CL_API\r
+cl_vector_get_ptr(\r
+ IN const cl_vector_t* const p_vector,\r
+ IN const size_t index )\r
+{\r
+ CL_ASSERT( p_vector );\r
+ CL_ASSERT( p_vector->state == CL_INITIALIZED );\r
+\r
+ return( p_vector->p_ptr_array[index] );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_vector\r
+* [in] Pointer to a cl_vector_t structure from which to get a\r
+* pointer to an element.\r
+*\r
+* index\r
+* [in] Index of the element.\r
+*\r
+* RETURN VALUE\r
+* Pointer to the element stored at specified index.\r
+*\r
+* NOTES\r
+* cl_vector_get_ptr provides constant access times regardless of the index.\r
+*\r
+* cl_vector_get_ptr does not perform boundary checking. Callers are\r
+* responsible for providing an index that is within the range of the vector.\r
+*\r
+* SEE ALSO\r
+* Vector, cl_vector_get, cl_vector_at, cl_vector_set, cl_vector_get_size\r
+*********/\r
+\r
+\r
+/****f* Component Library: Vector/cl_vector_get\r
+* NAME\r
+* cl_vector_get\r
+*\r
+* DESCRIPTION\r
+* The cl_vector_get function copies an element stored in a vector at a\r
+* specified index.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE void CL_API\r
+cl_vector_get(\r
+ IN const cl_vector_t* const p_vector,\r
+ IN const size_t index,\r
+ OUT void* const p_element )\r
+{\r
+ void *p_src;\r
+\r
+ CL_ASSERT( p_vector );\r
+ CL_ASSERT( p_vector->state == CL_INITIALIZED );\r
+ CL_ASSERT( p_element );\r
+\r
+ /* Get a pointer to the element. */\r
+ p_src = cl_vector_get_ptr( p_vector, index );\r
+ p_vector->pfn_copy( p_element, p_src, p_vector->element_size );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_vector\r
+* [in] Pointer to a cl_vector_t structure from which to get a copy of\r
+* an element.\r
+*\r
+* index\r
+* [in] Index of the element.\r
+*\r
+* p_element\r
+* [out] Pointer to storage for the element. Contains a copy of the\r
+* desired element upon successful completion of the call.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* cl_vector_get provides constant time access regardless of the index.\r
+*\r
+* cl_vector_get does not perform boundary checking on the vector, and\r
+* callers are responsible for providing an index that is within the range\r
+* of the vector. To access elements after performing boundary checks,\r
+* use cl_vector_at.\r
+*\r
+* The p_element parameter contains a copy of the desired element upon\r
+* return from this function.\r
+*\r
+* SEE ALSO\r
+* Vector, cl_vector_get_ptr, cl_vector_at\r
+*********/\r
+\r
+\r
+/****f* Component Library: Vector/cl_vector_at\r
+* NAME\r
+* cl_vector_at\r
+*\r
+* DESCRIPTION\r
+* The cl_vector_at function copies an element stored in a vector at a\r
+* specified index, performing boundary checks.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_status_t CL_API\r
+cl_vector_at(\r
+ IN const cl_vector_t* const p_vector,\r
+ IN const size_t index,\r
+ OUT void* const p_element );\r
+/*\r
+* PARAMETERS\r
+* p_vector\r
+* [in] Pointer to a cl_vector_t structure from which to get a copy of\r
+* an element.\r
+*\r
+* index\r
+* [in] Index of the element.\r
+*\r
+* p_element\r
+* [out] Pointer to storage for the element. Contains a copy of the\r
+* desired element upon successful completion of the call.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if an element was found at the specified index.\r
+*\r
+* CL_INVALID_SETTING if the index was out of range.\r
+*\r
+* NOTES\r
+* cl_vector_at provides constant time access regardless of the index, and\r
+* performs boundary checking on the vector.\r
+*\r
+* Upon success, the p_element parameter contains a copy of the desired element.\r
+*\r
+* SEE ALSO\r
+* Vector, cl_vector_get, cl_vector_get_ptr\r
+*********/\r
+\r
+\r
+/****f* Component Library: Vector/cl_vector_set\r
+* NAME\r
+* cl_vector_set\r
+*\r
+* DESCRIPTION\r
+* The cl_vector_set function sets the element at the specified index.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_status_t CL_API\r
+cl_vector_set(\r
+ IN cl_vector_t* const p_vector,\r
+ IN const size_t index,\r
+ IN void* const p_element );\r
+/*\r
+* PARAMETERS\r
+* p_vector\r
+* [in] Pointer to a cl_vector_t structure into which to store\r
+* an element.\r
+*\r
+* index\r
+* [in] Index of the element.\r
+*\r
+* p_element\r
+* [in] Pointer to an element to store in the vector.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if the element was successfully set.\r
+*\r
+* CL_INSUFFICIENT_MEMORY if the vector could not be resized to accommodate\r
+* the new element.\r
+*\r
+* NOTES\r
+* cl_vector_set grows the vector as needed to accommodate the new element,\r
+* unless the grow_size parameter passed into the cl_vector_init function\r
+* was zero.\r
+*\r
+* SEE ALSO\r
+* Vector, cl_vector_get\r
+*********/\r
+\r
+\r
+/****f* Component Library: Vector/cl_vector_set_capacity\r
+* NAME\r
+* cl_vector_set_capacity\r
+*\r
+* DESCRIPTION\r
+* The cl_vector_set_capacity function reserves memory in a vector for a\r
+* specified number of elements.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_status_t CL_API\r
+cl_vector_set_capacity(\r
+ IN cl_vector_t* const p_vector,\r
+ IN const size_t new_capacity );\r
+/*\r
+* PARAMETERS\r
+* p_vector\r
+* [in] Pointer to a cl_vector_t structure whose capacity to set.\r
+*\r
+* new_capacity\r
+* [in] Total number of elements for which the vector should\r
+* allocate memory.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if the capacity was successfully set.\r
+*\r
+* CL_INSUFFICIENT_MEMORY if there was not enough memory to satisfy the\r
+* operation. The vector is left unchanged.\r
+*\r
+* NOTES\r
+* cl_vector_set_capacity increases the capacity of the vector. It does\r
+* not change the size of the vector. If the requested capacity is less\r
+* than the current capacity, the vector is left unchanged.\r
+*\r
+* SEE ALSO\r
+* Vector, cl_vector_get_capacity, cl_vector_set_size,\r
+* cl_vector_set_min_size\r
+*********/\r
+\r
+\r
+/****f* Component Library: Vector/cl_vector_set_size\r
+* NAME\r
+* cl_vector_set_size\r
+*\r
+* DESCRIPTION\r
+* The cl_vector_set_size function resizes a vector, either increasing or\r
+* decreasing its size.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_status_t CL_API\r
+cl_vector_set_size(\r
+ IN cl_vector_t* const p_vector,\r
+ IN const size_t size );\r
+/*\r
+* PARAMETERS\r
+* p_vector\r
+* [in] Pointer to a cl_vector_t structure whose size to set.\r
+*\r
+* size\r
+* [in] Number of elements desired in the vector.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if the size of the vector was set successfully.\r
+*\r
+* CL_INSUFFICIENT_MEMORY if there was not enough memory to complete the\r
+* operation. The vector is left unchanged.\r
+*\r
+* NOTES\r
+* cl_vector_set_size sets the vector to the specified size. If size is\r
+* smaller than the current size of the vector, the size is reduced.\r
+* The destructor function, if any, will be invoked for all elements that\r
+* are above size. Likewise, the constructor and initializer, if any, will\r
+* be invoked for all new elements.\r
+*\r
+* This function can only fail if size is larger than the current capacity.\r
+*\r
+* SEE ALSO\r
+* Vector, cl_vector_get_size, cl_vector_set_min_size,\r
+* cl_vector_set_capacity\r
+*********/\r
+\r
+\r
+/****f* Component Library: Vector/cl_vector_set_min_size\r
+* NAME\r
+* cl_vector_set_min_size\r
+*\r
+* DESCRIPTION\r
+* The cl_vector_set_min_size function resizes a vector to a specified size\r
+* if the vector is smaller than the specified size.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_status_t CL_API\r
+cl_vector_set_min_size(\r
+ IN cl_vector_t* const p_vector,\r
+ IN const size_t min_size );\r
+/*\r
+* PARAMETERS\r
+* p_vector\r
+* [in] Pointer to a cl_vector_t structure whose minimum size to set.\r
+*\r
+* min_size\r
+* [in] Minimum number of elements that the vector should contain.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if the vector size is greater than or equal to min_size. This\r
+* could indicate that the vector's capacity was increased to min_size or\r
+* that the vector was already of sufficient size.\r
+*\r
+* CL_INSUFFICIENT_MEMORY if there was not enough memory to resize the vector.\r
+* The vector is left unchanged.\r
+*\r
+* NOTES\r
+* If min_size is smaller than the current size of the vector, the vector is\r
+* unchanged. The vector is unchanged if the size could not be changed due\r
+* to insufficient memory being available to perform the operation.\r
+*\r
+* SEE ALSO\r
+* Vector, cl_vector_get_size, cl_vector_set_size, cl_vector_set_capacity\r
+*********/\r
+\r
+\r
+/****f* Component Library: Vector/cl_vector_apply_func\r
+* NAME\r
+* cl_vector_apply_func\r
+*\r
+* DESCRIPTION\r
+* The cl_vector_apply_func function invokes a specified function for every\r
+* element in a vector.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_vector_apply_func(\r
+ IN const cl_vector_t* const p_vector,\r
+ IN cl_pfn_vec_apply_t pfn_callback,\r
+ IN const void* const context );\r
+/*\r
+* PARAMETERS\r
+* p_vector\r
+* [in] Pointer to a cl_vector_t structure whose elements to iterate.\r
+*\r
+* pfn_callback\r
+* [in] Function invoked for every element in the array.\r
+* See the cl_pfn_vec_apply_t function type declaration for details\r
+* about the callback function.\r
+*\r
+* context\r
+* [in] Value to pass to the callback function.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* cl_vector_apply_func invokes the specified function for every element\r
+* in the vector, starting from the beginning of the vector.\r
+*\r
+* SEE ALSO\r
+* Vector, cl_vector_find_from_start, cl_vector_find_from_end,\r
+* cl_pfn_vec_apply_t\r
+*********/\r
+\r
+\r
+/****f* Component Library: Vector/cl_vector_find_from_start\r
+* NAME\r
+* cl_vector_find_from_start\r
+*\r
+* DESCRIPTION\r
+* The cl_vector_find_from_start function uses a specified function to\r
+* search for elements in a vector starting from the lowest index.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT size_t CL_API\r
+cl_vector_find_from_start(\r
+ IN const cl_vector_t* const p_vector,\r
+ IN cl_pfn_vec_find_t pfn_callback,\r
+ IN const void* const context );\r
+/*\r
+* PARAMETERS\r
+* p_vector\r
+* [in] Pointer to a cl_vector_t structure to inititalize.\r
+*\r
+* pfn_callback\r
+* [in] Function invoked to determine if a match was found.\r
+* See the cl_pfn_vec_find_t function type declaration for details\r
+* about the callback function.\r
+*\r
+* context\r
+* [in] Value to pass to the callback function.\r
+*\r
+* RETURN VALUES\r
+* Index of the element, if found.\r
+*\r
+* Size of the vector if the element was not found.\r
+*\r
+* NOTES\r
+* cl_vector_find_from_start does not remove the found element from\r
+* the vector. The index of the element is returned when the function\r
+* provided by the pfn_callback parameter returns CL_SUCCESS.\r
+*\r
+* SEE ALSO\r
+* Vector, cl_vector_find_from_end, cl_vector_apply_func, cl_pfn_vec_find_t\r
+*********/\r
+\r
+\r
+/****f* Component Library: Vector/cl_vector_find_from_end\r
+* NAME\r
+* cl_vector_find_from_end\r
+*\r
+* DESCRIPTION\r
+* The cl_vector_find_from_end function uses a specified function to search\r
+* for elements in a vector starting from the highest index.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT size_t CL_API\r
+cl_vector_find_from_end(\r
+ IN const cl_vector_t* const p_vector,\r
+ IN cl_pfn_vec_find_t pfn_callback,\r
+ IN const void* const context );\r
+/*\r
+* PARAMETERS\r
+* p_vector\r
+* [in] Pointer to a cl_vector_t structure to inititalize.\r
+*\r
+* pfn_callback\r
+* [in] Function invoked to determine if a match was found.\r
+* See the cl_pfn_vec_find_t function type declaration for details\r
+* about the callback function.\r
+*\r
+* context\r
+* [in] Value to pass to the callback function.\r
+*\r
+* RETURN VALUES\r
+* Index of the element, if found.\r
+*\r
+* Size of the vector if the element was not found.\r
+*\r
+* NOTES\r
+* cl_vector_find_from_end does not remove the found element from\r
+* the vector. The index of the element is returned when the function\r
+* provided by the pfn_callback parameter returns CL_SUCCESS.\r
+*\r
+* SEE ALSO\r
+* Vector, cl_vector_find_from_start, cl_vector_apply_func,\r
+* cl_pfn_vec_find_t\r
+*********/\r
+\r
+\r
+#ifdef __cplusplus\r
+} /* extern "C" */\r
+#endif\r
+\r
+\r
+#endif /* _CL_VECTOR_H_ */\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. \r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+/*\r
+ * Abstract:\r
+ * Declaration of wait object.\r
+ * \r
+ * Environment:\r
+ * All\r
+ */\r
+\r
+\r
+#ifndef _CL_WAITOBJ_H_\r
+#define _CL_WAITOBJ_H_\r
+\r
+\r
+#include <complib/cl_waitobj_osd.h>\r
+\r
+\r
+/****h* Component Library/Wait Object\r
+* NAME\r
+* Wait Object\r
+*\r
+* DESCRIPTION\r
+* The Wait Object provides the capability for a user mode process to\r
+* create and manipulate a wait object that can also be manipulated from\r
+* kernel mode.\r
+*\r
+* SEE ALSO\r
+* Structures:\r
+* cl_waitobj_handle_t\r
+*\r
+* User Mode Initialization/Destruction:\r
+* cl_waitobj_create\r
+* cl_waitobj_destroy\r
+*\r
+* Kernel Mode Access:\r
+* cl_waitobj_ref\r
+* cl_waitobj_deref\r
+*\r
+* Manipulation:\r
+* cl_waitobj_signal\r
+* cl_waitobj_reset\r
+* cl_waitobj_wait_on\r
+******/\r
+\r
+\r
+/****d* Component Library: Wait Object/cl_waitobj_handle_t\r
+* NAME\r
+* cl_waitobj_handle_t\r
+*\r
+* DESCRIPTION\r
+* Defines the handle for an OS wait object.\r
+*\r
+* NOTES\r
+* The wait object handle should be treated as opaque and is defined\r
+* differently depending on the target environment.\r
+*\r
+* SEE ALSO\r
+* Wait Object, cl_waitobj_create, cl_waitobj_destroy,\r
+* cl_waitobj_ref, cl_waitobj_deref, cl_waitobj_signal,\r
+* cl_waitobj_reset, cl_waitobj_wait_on\r
+******/\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif /* __cplusplus */\r
+\r
+\r
+#if defined(CL_KERNEL)\r
+\r
+/****f* Component Library: Wait Object/cl_waitobj_ref\r
+* NAME\r
+* cl_waitobj_ref\r
+* \r
+* DESCRIPTION\r
+* The cl_waitobj_ref function validates a user mode wait object handle \r
+* and returns a kernel mode wait object handle. A reference is taken\r
+* on the object to prevent its destruction even if the user mode \r
+* application destroys it.\r
+* \r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_waitobj_handle_t CL_API\r
+cl_waitobj_ref(\r
+ IN void *h_user_wait_obj );\r
+/* \r
+* PARAMETERS\r
+* h_user_wait_obj\r
+* [in] A wait object handle passed from user mode. \r
+*\r
+* RETURN VALUES\r
+* Returns a kernel wait object handle upon success. The returned handle \r
+* should only be used as parameters to kernel mode calls.\r
+*\r
+* Returns NULL in case of failure.\r
+*\r
+* NOTES\r
+* This function is only available in kernel mode.\r
+*\r
+* SEE ALSO\r
+* Wait Object, cl_waitobj_handle_t, cl_waitobj_deref,\r
+* cl_waitobj_signal, cl_waitobj_reset, cl_waitobj_wait_on\r
+******/\r
+\r
+\r
+/****f* Component Library: Wait Object/cl_waitobj_deref\r
+* NAME\r
+* cl_waitobj_deref\r
+* \r
+* DESCRIPTION\r
+* The cl_waitobj_deref function release a reference on a kernel mode \r
+* wait object handle and allows the wait object to be destroyed.\r
+* \r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void CL_API\r
+cl_waitobj_deref(\r
+ IN cl_waitobj_handle_t h_kernel_wait_obj );\r
+/* \r
+* PARAMETERS\r
+* h_kernel_wait_obj\r
+* [in] A wait object handle returned by a previous call to cl_waitobj_ref. \r
+*\r
+* RETURN VALUES\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* This function is only available in kernel mode.\r
+*\r
+* SEE ALSO\r
+* Wait Object, cl_waitobj_handle_t, cl_waitobj_ref, \r
+* cl_waitobj_signal, cl_waitobj_reset, cl_waitobj_wait_on\r
+******/\r
+\r
+#else /* CL_KERNEL */\r
+\r
+/****f* Component Library: Wait Object/cl_waitobj_create\r
+* NAME\r
+* cl_waitobj_create\r
+* \r
+* DESCRIPTION\r
+* The cl_waitobj_create function creates a wait object.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_status_t CL_API\r
+cl_waitobj_create(\r
+ IN const boolean_t manual_reset, \r
+ OUT cl_waitobj_handle_t* const ph_wait_obj );\r
+/* \r
+* PARAMETERS\r
+* manual_reset\r
+* [in] If FALSE, indicates that the event resets itself after releasing \r
+* a single waiter. If TRUE, the event remains in the signalled state \r
+* until explicitly reset by a call to cl_event_reset.\r
+*\r
+* ph_wait_obj\r
+* [out] Pointer to a wait object handle set upon successful creation.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if the wait object was created successfully.\r
+*\r
+* CL_ERROR if the wait object creation failed.\r
+*\r
+* NOTES\r
+* This function is only available in user mode.\r
+*\r
+* SEE ALSO\r
+* Wait Object, cl_waitobj_handle_t, cl_waitobj_destroy, \r
+* cl_waitobj_signal, cl_waitobj_reset, cl_waitobj_wait_on\r
+******/\r
+\r
+\r
+/****f* Component Library: Wait Object/cl_waitobj_destroy\r
+* NAME\r
+* cl_waitobj_destroy\r
+*\r
+* DESCRIPTION\r
+* The cl_waitobj_destroy function destroys a wait object.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_status_t CL_API\r
+cl_waitobj_destroy(\r
+ IN cl_waitobj_handle_t h_wait_obj );\r
+/* \r
+* PARAMETERS\r
+* h_wait_obj\r
+* [in] A handle to the wait object to destroy, obtained by a pervious\r
+* call to cl_waitobj_create.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if the wait object handle is destroyed.\r
+*\r
+* CL_INVALID_PARAMETER if the wait object handle is invalid.\r
+*\r
+* NOTES\r
+* This function is only available in user mode.\r
+*\r
+* SEE ALSO\r
+* Wait Object, cl_waitobj_handle_t, cl_waitobj_create, \r
+* cl_waitobj_signal, cl_waitobj_reset, cl_waitobj_wait_on\r
+*********/\r
+\r
+#endif /* CL_KERNEL */\r
+\r
+/****f* Component Library: Wait Object/cl_waitobj_signal\r
+* NAME\r
+* cl_waitobj_signal\r
+* \r
+* DESCRIPTION\r
+* The cl_waitobj_signal function sets a wait object to the signalled \r
+* state and releases one or more waiting threads.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_status_t CL_API\r
+cl_waitobj_signal(\r
+ IN cl_waitobj_handle_t h_wait_obj );\r
+/* \r
+* PARAMETERS\r
+* h_wait_obj\r
+* [in] A handle to the wait object that needs to be signaled.\r
+* \r
+* RETURN VALUES\r
+* CL_SUCCESS if the event was successfully signalled.\r
+*\r
+* CL_ERROR otherwise.\r
+*\r
+* NOTES\r
+* For auto-reset wait objects, the wait object is reset automatically once \r
+* a wait operation is satisfied. \r
+*\r
+* Triggering the wait object multiple times does not guarantee that the same \r
+* number of wait operations are satisfied. This is because wait objects are \r
+* either in a signalled on non-signalled state, and triggering a wait object \r
+* that is already in the signalled state has no effect.\r
+*\r
+* In kernel mode, a pointer to a cl_event_t can safely be used instead of\r
+* a wait object handle.\r
+*\r
+* SEE ALSO\r
+* Wait Object, cl_waitobj_create, cl_waitobj_destroy,\r
+* cl_waitobj_ref, cl_waitobj_deref,\r
+* cl_waitobj_reset, cl_waitobj_wait_on\r
+*********/\r
+\r
+\r
+/****f* Component Library: Wait Object/cl_waitobj_reset\r
+* NAME\r
+* cl_waitobj_reset\r
+*\r
+* DESCRIPTION\r
+* The cl_waitobj_reset function sets an wait object to the non-signalled state.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_status_t CL_API\r
+cl_waitobj_reset(\r
+ IN cl_waitobj_handle_t h_wait_obj );\r
+/*\r
+* PARAMETERS\r
+* h_wait_obj\r
+* [in] A handle to the wait object that needs to reset.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if the wait object was successfully reset.\r
+*\r
+* CL_ERROR otherwise.\r
+*\r
+* NOTES\r
+* In kernel mode, a pointer to a cl_event_t can safely be used instead of\r
+* a wait object handle.\r
+*\r
+* SEE ALSO\r
+* Wait Object, cl_waitobj_create, cl_waitobj_destroy,\r
+* cl_waitobj_ref, cl_waitobj_deref,\r
+* cl_waitobj_signal, cl_waitobj_wait_on\r
+*********/\r
+\r
+\r
+/****f* Component Library: Wait Object/cl_waitobj_wait_on\r
+* NAME\r
+* cl_waitobj_wait_on\r
+*\r
+* DESCRIPTION\r
+* The cl_waitobj_wait_on function waits for the specified wait object to be \r
+* triggered for a minimum amount of time.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT cl_status_t CL_API\r
+cl_waitobj_wait_on(\r
+ IN cl_waitobj_handle_t h_wait_obj,\r
+ IN const uint32_t wait_us,\r
+ IN const boolean_t interruptible );\r
+/*\r
+* PARAMETERS\r
+* h_wait_obj\r
+* [in] A handle to the wait object on which to wait.\r
+*\r
+* wait_us \r
+* [in] Number of microseconds to wait.\r
+*\r
+* interruptible\r
+* [in] Indicates whether the wait operation can be interrupted\r
+* by external signals.\r
+*\r
+* RETURN VALUES\r
+* CL_SUCCESS if the wait operation succeeded in response to the wait object \r
+* being set.\r
+*\r
+* CL_TIMEOUT if the specified time period elapses.\r
+*\r
+* CL_NOT_DONE if the wait was interrupted by an external signal.\r
+*\r
+* CL_ERROR if the wait operation failed.\r
+*\r
+* NOTES\r
+* If wait_us is set to EVENT_NO_TIMEOUT, the function will wait until the \r
+* wait object is triggered and never timeout.\r
+*\r
+* If the timeout value is zero, this function simply tests the state of \r
+* the wait object.\r
+*\r
+* If the wait object is already in the signalled state at the time of the call\r
+* to cl_waitobj_wait_on, the call completes immediately with CL_SUCCESS.\r
+*\r
+* In kernel mode, a pointer to a cl_event_t can safely be used instead of\r
+* a wait object handle.\r
+*\r
+* SEE ALSO\r
+* Wait Object, cl_waitobj_create, cl_waitobj_destroy,\r
+* cl_waitobj_ref, cl_waitobj_deref, \r
+* cl_waitobj_signal, cl_waitobj_reset\r
+*********/\r
+\r
+\r
+#ifdef __cplusplus\r
+} /* extern "C" */\r
+#endif /* __cplusplus */\r
+\r
+\r
+#endif /* _CL_WAITOBJ_H_ */\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. \r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+/*\r
+ * Abstract:\r
+ * One stop shopping for component library headers.\r
+ *\r
+ * Environment:\r
+ * All\r
+ */\r
+\r
+\r
+#ifndef _CL_LIB_H_\r
+#define _CL_LIB_H_\r
+\r
+\r
+/****h* Component Library/Component Library \r
+* NAME\r
+* component library \r
+*\r
+* DESCRIPTION\r
+* The component library is a collection of components that can be used to\r
+* create complex projects quickly and reliably.\r
+*\r
+* The component library simplifies development by eliminating the need to\r
+* re-implement existing functionality. This contributes to shorter\r
+* development cycles as well as smaller code bases, helping reduce the\r
+* number of bugs by leveraging tried and tested code.\r
+*\r
+* The component library also provides the same interface in multiple\r
+* environments, such as kernel mode and user mode, allowing code to be used\r
+* in both, again reducing code duplication and development life cycles.\r
+*\r
+* Components of the library all follow the same usage model, as follows:\r
+* - The constructor for all components should be called before any other\r
+* function for that component. It is acceptable to call the initializer\r
+* without first calling the constructor.\r
+*\r
+* - The initializer for all components must be called successfully\r
+* before any function manipulating that component is called.\r
+*\r
+* - The destructor for all components must be called if the initializer\r
+* was called.\r
+*\r
+* In a debug build, the components assert that the proper sequence is\r
+* followed.\r
+*********/\r
+\r
+\r
+#include <complib/cl_types.h>\r
+#include <complib/cl_debug.h>\r
+#include <complib/cl_memory.h>\r
+#include <complib/cl_atomic.h>\r
+#include <complib/cl_byteswap.h>\r
+#include <complib/cl_math.h>\r
+#include <complib/cl_passivelock.h>\r
+#include <complib/cl_spinlock.h>\r
+#include <complib/cl_timer.h>\r
+#include <complib/cl_event.h>\r
+#include <complib/cl_waitobj.h>\r
+#include <complib/cl_qlist.h>\r
+#include <complib/cl_list.h>\r
+#include <complib/cl_qcomppool.h>\r
+#include <complib/cl_qpool.h>\r
+#include <complib/cl_comppool.h>\r
+#include <complib/cl_pool.h>\r
+#include <complib/cl_reqmgr.h>\r
+#include <complib/cl_vector.h>\r
+#include <complib/cl_syscallback.h>\r
+#include <complib/cl_thread.h>\r
+#include <complib/cl_threadpool.h>\r
+#include <complib/cl_perf.h>\r
+#include <complib/cl_log.h>\r
+#include <complib/cl_qmap.h>\r
+#include <complib/cl_map.h>\r
+#include <complib/cl_fleximap.h>\r
+#include <complib/cl_async_proc.h>\r
+#include <complib/cl_ptr_vector.h>\r
+#include <complib/cl_qlockpool.h>\r
+#include <complib/cl_mutex.h>\r
+#include <complib/cl_obj.h>\r
+#include <complib/cl_ioctl.h>\r
+\r
+\r
+#endif /* _CL_LIB_H_ */\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. \r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+#if !defined(__IB_AL_H__)\r
+#define __IB_AL_H__\r
+\r
+#include <iba/ib_types.h>\r
+#include <complib/cl_waitobj.h>\r
+#include <complib/cl_qlist.h>\r
+\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif /* __cplusplus */\r
+\r
+/****h* IB Access Layer API/Access Layer\r
+* NAME\r
+* InfiniBand Access Layer\r
+* COPYRIGHT\r
+* Copyright (c) 2003 Intel Corporation - All Rights Reserved.\r
+* DESCRIPTION\r
+* The access layer provides transport level access to an InfiniBand fabric.\r
+* It supplies a foundation upon which a channel driver may be built. The\r
+* access layer exposes the capabilities of the InfiniBand architecture and\r
+* adds support for higher-level functionality required by most users of an\r
+* InfiniBand fabric. Users define the protocols and policies used by the\r
+* access layer, and the access layer implements them under the direction\r
+* of a user.\r
+****/\r
+\r
+\r
+typedef struct _ib_al* __ptr64 ib_al_handle_t;\r
+typedef struct _al_pnp* __ptr64 ib_pnp_handle_t;\r
+typedef struct _al_reg_svc* __ptr64 ib_reg_svc_handle_t;\r
+typedef struct _al_mad_send* __ptr64 ib_mad_send_handle_t;\r
+typedef struct _al_mad_svc* __ptr64 ib_mad_svc_handle_t;\r
+typedef struct _al_query* __ptr64 ib_query_handle_t;\r
+typedef struct _al_sub* __ptr64 ib_sub_handle_t;\r
+typedef struct _al_listen* __ptr64 ib_listen_handle_t;\r
+typedef struct _al_ioc* __ptr64 ib_ioc_handle_t;\r
+typedef struct _al_svc_entry* __ptr64 ib_svc_handle_t;\r
+typedef struct _al_pool_key* __ptr64 ib_pool_key_t;\r
+typedef struct _al_pool* __ptr64 ib_pool_handle_t;\r
+typedef struct _mlnx_fmr_pool_element* __ptr64 mlnx_fmr_pool_el_t;\r
+\r
+typedef struct _ib_cm_handle\r
+{\r
+ ib_al_handle_t h_al;\r
+ ib_qp_handle_t h_qp;\r
+ net32_t cid;\r
+\r
+} ib_cm_handle_t;\r
+\r
+\r
+/****s* Access Layer/ib_shmid_t\r
+* NAME\r
+* ib_shmid_t\r
+*\r
+* DESCRIPTION\r
+* Shared Memory Identifier, used to uniquely identify a shared memory region.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef uint8_t ib_shmid_t[64];\r
+/*\r
+* SEE ALSO\r
+* ib_reg_shmid\r
+*********/\r
+\r
+\r
+/****d* Access Layer/ATS\r
+* NAME\r
+* DAPL Address Translation Service\r
+*\r
+* DESCRIPTION\r
+* ATS service ID, service name, and IPv4 offset for DAPL-compliant\r
+* ATS service records.\r
+*/\r
+#define ATS_SERVICE_ID CL_NTOH64( 0x10000CE100415453 )\r
+#define ATS_NAME "DAPL Address Translation Service"\r
+#define ATS_IPV4_OFFSET 12\r
+/**********/\r
+\r
+\r
+/****s* Access Layer/ib_mad_element_t\r
+* NAME\r
+* ib_mad_element_t\r
+*\r
+* DESCRIPTION\r
+* Information used to submit a work request to a management datagram (MAD)\r
+* queue pair.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_mad_element\r
+{\r
+ struct _ib_mad_element* __ptr64 p_next;\r
+ const void* __ptr64 context1;\r
+ const void* __ptr64 context2;\r
+\r
+ /* Request/completion data. */\r
+ ib_mad_t* __ptr64 p_mad_buf;\r
+ uint32_t size;\r
+ uint32_t immediate_data;\r
+ ib_net32_t remote_qp;\r
+\r
+ /* Send request information. */\r
+ ib_av_handle_t h_av;\r
+ ib_send_opt_t send_opt;\r
+ ib_net32_t remote_qkey;\r
+ boolean_t resp_expected;\r
+ uint32_t timeout_ms;\r
+ uint32_t retry_cnt;\r
+ uint8_t rmpp_version;\r
+\r
+ /* Completion information. */\r
+ ib_wc_status_t status;\r
+ boolean_t grh_valid;\r
+ ib_grh_t* __ptr64 p_grh;\r
+\r
+ /* Completed receive data or send request information if h_av is NULL. */\r
+ uint32_t recv_opt;\r
+ ib_net16_t remote_lid;\r
+ uint8_t remote_sl;\r
+ uint16_t pkey_index;\r
+ uint8_t path_bits;\r
+\r
+ /* Transaction completion data. */\r
+ void* __ptr64 send_context1;\r
+ void* __ptr64 send_context2;\r
+\r
+} ib_mad_element_t;\r
+/*\r
+* FIELDS\r
+* p_next\r
+* A pointer used to chain MAD elements together. This value is\r
+* set to NULL to mark the end of the chain.\r
+*\r
+* context1\r
+* User-defined context information associated with the datagram.\r
+*\r
+* context2\r
+* User-defined context information associated with the datagram.\r
+*\r
+* p_buffer\r
+* The local data buffer contain the MAD.\r
+*\r
+* size\r
+* The size of the MAD referenced by p_buffer.\r
+*\r
+* immediate_data\r
+* 32-bit field sent or received as part of a datagram message.\r
+* This field is valid for send operations if the send_opt\r
+* IB_SEND_OPT_IMMEDIATE flag has been set. This field is valid\r
+* on received datagram completions if the recv_opt\r
+* IB_RECV_OPT_IMMEDIATE flag is set.\r
+*\r
+* remote_qp\r
+* Identifies the destination queue pair of a datagram send operation or\r
+* the source queue pair of a received datagram.\r
+*\r
+* h_av\r
+* An address vector that specifies the path information used to route\r
+* the outbound datagram to the destination queue pair. This handle may\r
+* be NULL when sending a directed route SMP or if the access layer\r
+* should create the address vector for the user.\r
+*\r
+* send_opt\r
+* Optional send control parameters. The following options are valid:\r
+* IB_SEND_OPT_IMMEDIATE and IB_SEND_OPT_SOLICITED. IB_SEND_OPT_FENCE\r
+* is only valid on MAD QPs.\r
+*\r
+* remote_qkey\r
+* The qkey for the destination queue pair.\r
+*\r
+* resp_expected\r
+* This field is used to indicate that the submitted operation expects\r
+* a response. When set, the access layer will retry this send operation\r
+* until the corresponding response is successfully received, or the\r
+* request times out. Send operations for which a response is expected\r
+* will always be completed by the access layer before the corresponding\r
+* received response.\r
+*\r
+* timeout_ms\r
+* Specifies the number of milliseconds to wait for a response to\r
+* a request until retrying or timing out the request. This field is\r
+* ignored if resp_expected is set to FALSE.\r
+*\r
+* retry_cnt\r
+* Specifies the number of times that the request will be retried\r
+* before failing the request. This field is ignored if resp_expected\r
+* is set to FALSE.\r
+*\r
+* rmpp_version\r
+* Indicates the version of the RMPP protocol to use when sending this\r
+* MAD. For MADs posted to MAD services of type IB_MAD_SVC_DEFAULT,\r
+* setting this field to 0 disables RMPP on user-defined management\r
+* classes or invokes the default RMPP version for well-defined management\r
+* classes, if appropriate. For MADs posted to MAD services of type\r
+* IB_MAD_SVC_RMPP, setting this field to 0 disables RMPP on the sent\r
+* MAD. Note that if the RMPP header exists, but the RMPP protocol is\r
+* not activated for this MAD, the user must ensure that the RMPP header\r
+* has been zeroed. This field is intended to help support backwards\r
+* compatibility.\r
+*\r
+* status\r
+* The result of the MAD work request.\r
+*\r
+* grh_valid\r
+* A flag indicating whether the p_grh reference is valid.\r
+*\r
+* p_grh\r
+* A reference to the global route header information.\r
+*\r
+* recv_opt\r
+* Indicates optional fields valid as part of a work request that\r
+* completed on an unreliable datagram queue pair.\r
+*\r
+* remote_lid\r
+* The source LID of the received datagram.\r
+*\r
+* remote_sl\r
+* The service level used by the source of the received datagram.\r
+*\r
+* pkey_index\r
+* This is valid only for IB_QPT_QP1 and IB_QPT_QP1_ALIAS QP types.\r
+* For received datagrams, this field contains the pkey index for\r
+* the source queue pair. For send operations, this field contains\r
+* the pkey index to use when posting the send work request. \r
+*\r
+* path_bits\r
+* The portion of the remote_lid that may be changed to vary the path\r
+* through the subnet to the remote port.\r
+*\r
+* send_context1\r
+* If this datagram was received as a response to a sent datagram, this\r
+* field contains the context1 value of the send operation. If this is\r
+* an unsolicited receive, this field will be 0.\r
+*\r
+* send_context2\r
+* If this datagram was received as a response to a sent datagram, this\r
+* field contains the context2 value of the send operation. If this is\r
+* an unsolicited receive, this field will be 0.\r
+*\r
+* remote_qp\r
+* Identifies the source queue pair of a received datagram.\r
+*\r
+* NOTES\r
+* The format of data sent over the fabric is expected to be in the form\r
+* of a MAD. MADs are expected to match the format defined by the\r
+* Infiniband specification and must be in network-byte order when posted\r
+* to a MAD service.\r
+*\r
+* This structure is received to notify a user that a datagram has been\r
+* received for a registered management class. Information of the source\r
+* of the data is provided, along with the data buffer.\r
+*\r
+* The MAD element structure is defined such that a received MAD element\r
+* may be re-used as a sent response. In such cases, the h_av field may be\r
+* NULL. The address vector will be created and destroyed by the access\r
+* layer.\r
+*\r
+* SEE ALSO\r
+* ib_get_mad, ib_put_mad, ib_send_mad, ib_local_ds_t, ib_send_opt_t,\r
+* ib_pfn_mad_recv_cb_t, ib_get_mad_buf\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_get_mad_buf\r
+* NAME\r
+* ib_get_mad_buf\r
+*\r
+* DESCRIPTION\r
+* Returns a pointer to the MAD buffer associated with a MAD element.\r
+*\r
+* SYNOPSIS\r
+*/\r
+#pragma warning(push)\r
+#pragma warning(disable: 4244 ) \r
+AL_INLINE void* AL_API\r
+ib_get_mad_buf(\r
+ IN const ib_mad_element_t* const p_mad_element )\r
+{\r
+ CL_ASSERT( p_mad_element );\r
+ return( p_mad_element->p_mad_buf );\r
+}\r
+#pragma warning (pop)\r
+/*\r
+* PARAMETERS\r
+* p_mad_element\r
+* [in] A pointer to a MAD element.\r
+*\r
+* NOTES\r
+* Returns a pointer to the MAD buffer associated with a MAD element.\r
+*\r
+* SEE ALSO\r
+* ib_mad_element_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_pfn_comp_cb_t\r
+* NAME\r
+* ib_pfn_comp_cb_t\r
+*\r
+* DESCRIPTION\r
+* Completion callback provided by a client.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef void\r
+(AL_API * __ptr64 ib_pfn_comp_cb_t)(\r
+ IN const ib_cq_handle_t h_cq,\r
+ IN void *cq_context );\r
+/*\r
+* PARAMETERS\r
+* h_cq\r
+* [in] Handle for the completion queue on which the completion occurred.\r
+*\r
+* cq_context\r
+* [in] User-specified context for the completion queue on which the\r
+* completion occurred.\r
+*\r
+* NOTES\r
+* This function is invoked upon completion of a work request on a queue pair\r
+* associated with the completion queue. The context associated with the\r
+* completion queue on which the completion occurred is return to the client\r
+* through the callback.\r
+*\r
+* In the kernel, this callback is usually invoked using a tasklet, dependent\r
+* on the implementation of the underlying verbs provider driver.\r
+*****/\r
+\r
+\r
+/****d* Access Layer/ib_al_flags_t\r
+* NAME\r
+* ib_al_flags_t\r
+*\r
+* DESCRIPTION\r
+* Access layer flags used to direct the operation of various calls.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef uint32_t ib_al_flags_t;\r
+#define IB_FLAGS_SYNC 0x00000001\r
+/*\r
+* VALUES\r
+* IB_FLAGS_SYNC\r
+* Indicates that the given operation should be performed synchronously.\r
+* The call will block until it completes. Callbacks will still be\r
+* invoked.\r
+*\r
+* SEE ALSO\r
+* ib_cm_req_t, ib_cm_rep_t, ib_cm_dreq_t, ib_cm_lap_t,\r
+* ib_reg_svc_req_t, ib_mcast_req_t, ib_query_req_t, ib_sub_req_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_pfn_destroy_cb_t\r
+* NAME\r
+* ib_pfn_destroy_cb_t\r
+*\r
+* DESCRIPTION\r
+* Asynchronous callback invoked after a resource has been successfully\r
+* destroyed.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef void\r
+(AL_API * __ptr64 ib_pfn_destroy_cb_t)(\r
+ IN void *context );\r
+/*\r
+* PARAMETERS\r
+* context\r
+* [in] User-specified context associated with the resource being\r
+* destroyed. The context for the resource is usually set during the\r
+* object's creation.\r
+*\r
+* NOTES\r
+* This callback notifies a client that a resource has been successfully\r
+* destroyed. It is used to indicate that all pending callbacks associated\r
+* with the resource have completed, and no additional events will be\r
+* generated for that resource.\r
+*\r
+* This callback is invoked within a system thread context in the kernel.\r
+*\r
+* If the user specifies ib_sync_destroy as the asynchronous callback, then\r
+* the object being destroyed will be destroyed synchronously. This may \r
+* result in the calling thread blocking while outstanding callbacks complete.\r
+*\r
+* SEE ALSO\r
+* ib_sync_destroy\r
+*****/\r
+\r
+\r
+\r
+/****f* Access Layer/ib_sync_destroy\r
+* NAME\r
+* ib_sync_destroy\r
+*\r
+* DESCRIPTION\r
+* Access layer routine used to indicate synchronous destruction of an\r
+* object.\r
+*\r
+* SYNOPSIS\r
+*/\r
+static const ib_pfn_destroy_cb_t ib_sync_destroy = (ib_pfn_destroy_cb_t)-1i64;\r
+/*\r
+* PARAMETERS\r
+* Not Applicable.\r
+*\r
+* NOTES\r
+* Users specify ib_sync_destroy as the ib_pfn_destroy_cb_t callback in order\r
+* to force synchronous object destruction. This may result in the calling\r
+* thread blocking while outstanding callbacks complete.\r
+*\r
+* SEE ALSO\r
+* ib_pfn_destroy_cb_t\r
+*****/\r
+\r
+\r
+/****s* Access Layer/ib_async_event_rec_t\r
+* NAME\r
+* ib_async_event_rec_t\r
+*\r
+* DESCRIPTION\r
+* Information returned when an asynchronous event occurs on an allocated\r
+* resource.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_async_event_rec\r
+{\r
+ ib_async_event_t code;\r
+ uint64_t vendor_specific;\r
+\r
+ void* __ptr64 context;\r
+ union _handle_t\r
+ {\r
+ ib_ca_handle_t h_ca;\r
+ ib_cq_handle_t h_cq;\r
+ ib_qp_handle_t h_qp;\r
+ ib_srq_handle_t h_srq;\r
+\r
+ } handle;\r
+\r
+} ib_async_event_rec_t;\r
+/*\r
+* FIELDS\r
+* code\r
+* A code that identifies the type of event being reported.\r
+*\r
+* vendor_specific\r
+* A field containing optional vendor specific information.\r
+*\r
+* context\r
+* User-defined context information associated with the resource on\r
+* which the error occurred.\r
+*\r
+* handle\r
+* A handle to the resource for which this event record was generated.\r
+* This handle will match the handle returned during the creation of\r
+* resource. It is provided in case an event occurs before a client's\r
+* call to create a resource can return.\r
+*\r
+* SEE ALSO\r
+* ib_async_event_t, ib_pfn_event_cb_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_pfn_event_cb_t\r
+* NAME\r
+* ib_pfn_event_cb_t\r
+*\r
+* DESCRIPTION\r
+* A user-specified callback that is invoked after an asynchronous event\r
+* has occurred on an allocated resource.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef void\r
+(AL_API * __ptr64 ib_pfn_event_cb_t)(\r
+ IN ib_async_event_rec_t *p_event_rec );\r
+/*\r
+* PARAMETERS\r
+* p_event_rec\r
+* [in] Information returned to the user, indicating the type of\r
+* event and the associated user context.\r
+*\r
+* NOTES\r
+* This callback is invoked within a system thread context in the kernel.\r
+*\r
+* SEE ALSO\r
+* ib_async_event_rec_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_open_ca\r
+* NAME\r
+* ib_open_ca\r
+*\r
+* DESCRIPTION\r
+* Opens a channel adapter for additional access. A channel adapter must\r
+* be opened before consuming resources on that adapter.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_open_ca(\r
+ IN const ib_al_handle_t h_al,\r
+ IN const ib_net64_t ca_guid,\r
+ IN const ib_pfn_event_cb_t pfn_ca_event_cb OPTIONAL,\r
+ IN const void* const ca_context,\r
+ OUT ib_ca_handle_t* const ph_ca );\r
+/*\r
+* PARAMETERS\r
+* h_al\r
+* [in] The handle to an open instance of AL.\r
+*\r
+* ca_guid\r
+* [in] The GUID of the channel adapter to open.\r
+*\r
+* pfn_ca_event_cb\r
+* [in] A user-specified callback that is invoked after an\r
+* asynchronous event has occurred on the channel adapter.\r
+*\r
+* ca_context\r
+* [in] A client-specified context to associate with this opened instance\r
+* of the channel adapter. This context is returned to the user when\r
+* invoking asynchronous callbacks referencing this channel adapter.\r
+*\r
+* ph_ca\r
+* [out] Upon successful completion of this call, this references a\r
+* handle to the opened channel adapter.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The operation was successful.\r
+*\r
+* IB_INVALID_AL_HANDLE\r
+* The access layer handle was invalid.\r
+*\r
+* IB_INVALID_GUID\r
+* No channel adapter in the system was found for the specified ca_guid.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the CA handle was not provided.\r
+*\r
+* IB_INSUFFICIENT_MEMORY\r
+* There was insufficient memory to open the channel adapter.\r
+*\r
+* NOTES\r
+* When successful, this routine returns a handle to an open instance of a CA.\r
+*\r
+* SEE ALSO\r
+* ib_query_ca, ib_modify_ca, ib_close_ca, ib_pfn_event_cb_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_query_ca\r
+* NAME\r
+* ib_query_ca\r
+*\r
+* DESCRIPTION\r
+* Queries the attributes of an opened channel adapter.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_query_ca(\r
+ IN const ib_ca_handle_t h_ca,\r
+ OUT ib_ca_attr_t* const p_ca_attr OPTIONAL,\r
+ IN OUT uint32_t* const p_size );\r
+/*\r
+* PARAMETERS\r
+* h_ca\r
+* [in] The handle to an open channel adapter.\r
+*\r
+* p_ca_attr\r
+* [out] A reference to a buffer where the channel adapter attributes,\r
+* including port attribute information will be copied. If this parameter\r
+* is NULL, then the required buffer size needed to return all of the CA\r
+* attribute information is returned through the p_size parameter. The\r
+* ib_ca_attr_t structure for the specified channel adapter is stored\r
+* at the top of the buffer.\r
+*\r
+* p_size\r
+* [in/out] On input, this references the size of the data buffer\r
+* referenced by the p_ca_attr parameter.\r
+*\r
+* On output, the number of bytes used or needed to copy all CA\r
+* attribute information.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The attributes were returned successfully.\r
+*\r
+* IB_INVALID_CA_HANDLE\r
+* The channel adapter handle was invalid.\r
+*\r
+* IB_INSUFFICIENT_MEMORY\r
+* The size of the p_ca_attr buffer, specified through p_size, is\r
+* insufficient to store all of the CA attribute information.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the size was not provided.\r
+*\r
+* NOTES\r
+* This routine returns information about the specified channel adapter,\r
+* including port attributes. The amount of information returned through\r
+* this call is variable sized. Users may obtain the size of the data\r
+* buffer required to obtain the CA attributes by calling this function\r
+* with p_ca_attr set to NULL. The access layer will then return the\r
+* necessary size in the variable referenced by the p_size parameter.\r
+*\r
+* SEE ALSO\r
+* ib_open_ca, ib_query_ca_by_guid, ib_modify_ca, ib_close_ca, ib_ca_attr_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_query_ca_by_guid\r
+* NAME\r
+* ib_query_ca_by_guid\r
+*\r
+* DESCRIPTION\r
+* Queries the attributes of an opened channel adapter.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_query_ca_by_guid(\r
+ IN const ib_al_handle_t h_al,\r
+ IN const ib_net64_t ca_guid,\r
+ OUT ib_ca_attr_t* const p_ca_attr OPTIONAL,\r
+ IN OUT uint32_t* const p_size );\r
+/*\r
+* PARAMETERS\r
+* h_al\r
+* [in] The handle to an open instance of AL.\r
+*\r
+* ca_guid\r
+* [in] The GUID of the channel adapter to query.\r
+*\r
+* p_ca_attr\r
+* [out] A reference to a buffer where the channel adapter attributes,\r
+* including port attribute information will be copied. If this parameter\r
+* is NULL, then the required buffer size needed to return all of the CA\r
+* attribute information is returned through the p_size parameter. The\r
+* ib_ca_attr_t structure for the specified channel adapter is stored\r
+* at the top of the buffer.\r
+*\r
+* p_size\r
+* [in/out] On input, this references the size of the data buffer\r
+* referenced by the p_ca_attr parameter.\r
+*\r
+* On output, the number of bytes used or needed to copy all CA\r
+* attribute information.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The attributes were returned successfully.\r
+*\r
+* IB_INVALID_AL_HANDLE\r
+* The access layer handle was invalid.\r
+*\r
+* IB_INVALID_GUID\r
+* No channel adapter in the system was found for the specified ca_guid.\r
+*\r
+* IB_INSUFFICIENT_MEMORY\r
+* The size of the p_ca_attr buffer, specified through p_size, is\r
+* insufficient to store all of the CA attribute information.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the size was not provided.\r
+*\r
+* NOTES\r
+* This routine returns information about the specified channel adapter,\r
+* including port attributes. The amount of information returned through\r
+* this call is variable sized. Users may obtain the size of the data\r
+* buffer required to obtain the CA attributes by calling this function\r
+* with p_ca_attr set to NULL. The access layer will then return the\r
+* necessary size in the variable referenced by the p_size parameter.\r
+*\r
+* SEE ALSO\r
+* ib_open_ca, ib_query_ca, ib_modify_ca, ib_close_ca, ib_ca_attr_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_modify_ca\r
+* NAME\r
+* ib_modify_ca\r
+*\r
+* DESCRIPTION\r
+* Modifies the attributes and violation counters associated with a port.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_modify_ca(\r
+ IN const ib_ca_handle_t h_ca,\r
+ IN const uint8_t port_num,\r
+ IN const ib_ca_mod_t ca_mod,\r
+ IN const ib_port_attr_mod_t* const p_port_attr_mod );\r
+/*\r
+* PARAMETERS\r
+* h_ca\r
+* [in] A handle to an opened channel adapter.\r
+*\r
+* port_num\r
+* [in] An index to the port that is being modified. The port_num matches\r
+* the index of the port as returned through the ib_query_ca call.\r
+*\r
+* ca_mod\r
+* [in] A mask of the attributes and counters to modify.\r
+*\r
+* p_port_attr_mod\r
+* [in] A list of the specific port attribute information to modify. For\r
+* the access layer to modify an attribute, its corresponding bit must be\r
+* set in the ca_mod parameter.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The attributes were successfully modified.\r
+*\r
+* IB_INVALID_CA_HANDLE\r
+* The channel adapter handle was invalid.\r
+*\r
+* IB_INVALID_PORT\r
+* The port number supplied was invalid for the given channel adapter.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* The supplied ca_mod mask is invalid or a reference to the port\r
+* attribute information was not provided.\r
+*\r
+* IB_UNSUPPORTED\r
+* The optional qkey and pkey violation counters are not supported by\r
+* this channel adapter, but an attempt was made to modify them.\r
+*\r
+* NOTES\r
+* This call sets the attributes for a port in its associated PORT_INFO\r
+* structure. It will also reset pkey and qkey violation counters.\r
+*\r
+* SEE ALSO\r
+* ib_open_ca, ib_query_ca, ib_close_ca, ib_ca_mod_t, ib_port_attr_mod_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_close_ca\r
+* NAME\r
+* ib_close_ca\r
+*\r
+* DESCRIPTION\r
+* Closes an opened channel adapter. Once closed, no further access to this\r
+* channel adapter is possible.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_close_ca(\r
+ IN const ib_ca_handle_t h_ca,\r
+ IN const ib_pfn_destroy_cb_t pfn_destroy_cb OPTIONAL );\r
+/*\r
+* PARAMETERS\r
+* h_ca\r
+* [in] A handle to an opened channel adapter.\r
+*\r
+* pfn_destroy_cb\r
+* [in] A user-specified callback that is invoked after the channel\r
+* adapter has been successfully destroyed.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The close request was registered.\r
+*\r
+* IB_INVALID_CA_HANDLE\r
+* The channel adapter handle was invalid.\r
+*\r
+* NOTES\r
+* This call closes the opened channel adapter and frees all associated\r
+* resources, such as queue pairs, protection domains, and completion\r
+* queues. Since callbacks may be outstanding against the channel adapter\r
+* or one of its resources at the time the close operation is invoked, this\r
+* call operates asynchronously. The user will be notified through a callback\r
+* once the close operation completes, indicating that no additional callbacks\r
+* will be invoked for the specified channel adapter or a related resource.\r
+*\r
+* SEE ALSO\r
+* ib_open_ca\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_alloc_pd\r
+* NAME\r
+* ib_alloc_pd\r
+*\r
+* DESCRIPTION\r
+* Allocates a protection domain on the specified channel adapter.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_alloc_pd(\r
+ IN const ib_ca_handle_t h_ca,\r
+ IN const ib_pd_type_t pd_type,\r
+ IN const void* const pd_context,\r
+ OUT ib_pd_handle_t* const ph_pd );\r
+/*\r
+* PARAMETERS\r
+* h_ca\r
+* [in] A handle to an opened channel adapter.\r
+*\r
+* pd_type\r
+* [in] Indicates the type of protection domain being created.\r
+*\r
+* pd_context\r
+* [in] A client-specified context to associate with this allocated\r
+* protection domain. This context is returned to the user when\r
+* invoking asynchronous callbacks referencing this protection domain.\r
+*\r
+* ph_pd\r
+* [out] Upon successful completion of this call, this references a\r
+* handle to the allocated protection domain.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The operation was successful.\r
+*\r
+* IB_INVALID_CA_HANDLE\r
+* The channel adapter handle was invalid.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* The supplied pd_type value is invalid or a reference to the protection\r
+* domain handle was not provided.\r
+*\r
+* IB_INSUFFICIENT_MEMORY\r
+* There was insufficient memory to allocate the protection domain.\r
+*\r
+* IB_INSUFFICIENT_RESOURCES\r
+* There were insufficient resources currently available on the channel\r
+* adapter to create the protection domain.\r
+*\r
+* NOTES\r
+* When successful, this routine returns a handle to a newly allocated\r
+* protection domain.\r
+*\r
+* SEE ALSO\r
+* ib_dealloc_pd, ib_pd_type_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_dealloc_pd\r
+* NAME\r
+* ib_dealloc_pd\r
+*\r
+* DESCRIPTION\r
+* Deallocates a protection domain.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_dealloc_pd(\r
+ IN const ib_pd_handle_t h_pd,\r
+ IN const ib_pfn_destroy_cb_t pfn_destroy_cb OPTIONAL );\r
+/*\r
+* PARAMETERS\r
+* h_pd\r
+* [in] A handle to an allocated protection domain.\r
+*\r
+* pfn_destroy_cb\r
+* [in] A user-specified callback that is invoked after the protection\r
+* domain has been successfully destroyed.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The operation was successful.\r
+*\r
+* IB_INVALID_PD_HANDLE\r
+* The protection domain handle was invalid.\r
+*\r
+* NOTES\r
+* This call deallocates a protection domain and releases all associated\r
+* resources, including queue pairs and registered memory regions. Since\r
+* callbacks may be outstanding against one of protection domain's related\r
+* resources at the time the deallocation call is invoked, this call operates\r
+* asynchronously. The user will be notified through a callback once the\r
+* deallocation call completes, indicating that no additional callbacks\r
+* will be invoked for a related resource.\r
+*\r
+* SEE ALSO\r
+* ib_alloc_pd\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_create_av\r
+* NAME\r
+* ib_create_av\r
+*\r
+* DESCRIPTION\r
+* Creates an address vector.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_create_av(\r
+ IN const ib_pd_handle_t h_pd,\r
+ IN const ib_av_attr_t* const p_av_attr,\r
+ OUT ib_av_handle_t* const ph_av );\r
+/*\r
+* PARAMETERS\r
+* h_pd\r
+* [in] A handle to an allocated protection domain that the address\r
+* vector will be associated with.\r
+*\r
+* p_av_attr\r
+* [in] Attributes for the newly created address vector.\r
+*\r
+* ph_av\r
+* [out] Upon successful completion of this call, this references a\r
+* handle to the newly created address vector.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The operation was successful.\r
+*\r
+* IB_INVALID_PD_HANDLE\r
+* The protection domain handle was invalid.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the address vector attributes or handle was not\r
+* provided.\r
+*\r
+* IB_INSUFFICIENT_MEMORY\r
+* There was insufficient memory to create the address vector.\r
+*\r
+* IB_INVALID_PORT\r
+* The port number supplied, through the address vector attributes,\r
+* was invalid for the given channel adapter.\r
+*\r
+* IB_INSUFFICIENT_RESOURCES\r
+* There were insufficient resources currently available on the channel\r
+* adapter to create the address vector.\r
+*\r
+* NOTES\r
+* This routine creates an address vector. Clients specify the attributes\r
+* of the address vector through the p_av_attr parameter.\r
+*\r
+* SEE ALSO\r
+* ib_query_av, ib_modify_av, ib_destroy_av\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_query_av\r
+* NAME\r
+* ib_query_av\r
+*\r
+* DESCRIPTION\r
+* Returns the attributes of an address vector.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_query_av(\r
+ IN const ib_av_handle_t h_av,\r
+ OUT ib_av_attr_t* const p_av_attr,\r
+ OUT ib_pd_handle_t* const ph_pd );\r
+/*\r
+* PARAMETERS\r
+* h_av\r
+* [in] A handle to an existing address vector.\r
+*\r
+* p_av_attr\r
+* [out] Upon successful completion, the structure referenced by this\r
+* parameter contains the attributes of the specified address vector.\r
+*\r
+* ph_pd\r
+* [out] Upon successful completion, this references a handle to the\r
+* protection domain associated with the address vector.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The attributes were returned successfully.\r
+*\r
+* IB_INVALID_AV_HANDLE\r
+* The address vector handle was invalid.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the address vector attributes structure or protection\r
+* domain handle was not provided.\r
+*\r
+* SEE ALSO\r
+* ib_create_av, ib_modify_av, ib_destroy_av, ib_av_attr_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_modify_av\r
+* NAME\r
+* ib_modify_av\r
+*\r
+* DESCRIPTION\r
+* Modifies the attributes of an existing address vector.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_modify_av(\r
+ IN const ib_av_handle_t h_av,\r
+ IN const ib_av_attr_t* const p_av_attr );\r
+/*\r
+* PARAMETERS\r
+* h_av\r
+* [in] A handle to an existing address vector.\r
+*\r
+* p_av_attr\r
+* [in] The new attributes to use when modifying the address vector.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The address vector was successfully modified.\r
+*\r
+* IB_INVALID_AV_HANDLE\r
+* The address vector handle was invalid.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the address vector attributes structure was not\r
+* provided.\r
+*\r
+* IB_INVALID_PORT\r
+* The port number supplied, through the address vector attributes,\r
+* was invalid for the given channel adapter.\r
+*\r
+* NOTES\r
+* This routine modifies the attributes of an existing address vector.\r
+* The new attributes are specified through the p_av_attr parameter.\r
+*\r
+* SEE ALSO\r
+* ib_create_av, ib_destroy_av\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_destroy_av\r
+* NAME\r
+* ib_destroy_av\r
+*\r
+* DESCRIPTION\r
+* Destroys an existing address vector.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_destroy_av(\r
+ IN const ib_av_handle_t h_av );\r
+/*\r
+* PARAMETERS\r
+* h_av\r
+* [in] A handle to an existing address vector.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The address vector was successfully destroyed.\r
+*\r
+* IB_INVALID_AV_HANDLE\r
+* The address vector handle was invalid.\r
+*\r
+* NOTES\r
+* This routine destroys an existing address vector.\r
+*\r
+* SEE ALSO\r
+* ib_create_av\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_create_srq\r
+* NAME\r
+* ib_create_srq\r
+*\r
+* DESCRIPTION\r
+* Creates a shared receive queue and returns its handle to the user.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_create_srq(\r
+ IN const ib_pd_handle_t h_pd,\r
+ IN const ib_srq_attr_t* const p_srq_attr,\r
+ IN const void* const srq_context,\r
+ IN const ib_pfn_event_cb_t pfn_srq_event_cb OPTIONAL,\r
+ OUT ib_srq_handle_t* const ph_srq );\r
+/*\r
+* PARAMETERS\r
+* h_pd\r
+* [in] This is a handle to a protection domain associated with the shared queue\r
+* pair.\r
+*\r
+* p_srq_attr\r
+* [in] Attributes necessary to allocate and initialize a shared receive queue.\r
+*\r
+* srq_context\r
+* [in] A user-specified context information associated with the shared\r
+* receive queue.\r
+*\r
+* pfn_qp_event_cb\r
+* [in] User-specified error callback routine invoked after an\r
+* asynchronous event has occurred on the shared receive queue.\r
+*\r
+* ph_srq\r
+* [out] Upon successful completion of this call, this references a\r
+* handle to the newly created shared receive queue.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The receive queue was successfully created.\r
+*\r
+* IB_INVALID_PD_HANDLE\r
+* The protection domain to associate with the shared receive queue was invalid.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the shared receive queue attributes or handle was not provided.\r
+*\r
+* IB_INSUFFICIENT_MEMORY\r
+* There was insufficient memory to create the shared receive queue.\r
+*\r
+* IB_INSUFFICIENT_RESOURCES\r
+* There were insufficient resources currently available on the channel\r
+* adapter to create the shared receive queue.\r
+*\r
+* IB_INVALID_SETTING\r
+* The specified shared receive queue creation attributes are invalid.\r
+*\r
+* IB_INVALID_MAX_WRS\r
+* The requested maximum send or receive work request depth could not be\r
+* supported.\r
+*\r
+* IB_INVALID_MAX_SGE\r
+* The requested maximum number of scatter-gather entries for the send or\r
+* receive queue could not be supported.\r
+*\r
+* NOTES\r
+* This routine allocates a shared receive queue with the specified attributes. If\r
+* the shared receive queue cannot be allocated, an error is returned. When creating\r
+* the shared receive queue, users associate a context with the shared receive queue. This\r
+* context is returned to the user through the asynchronous event callback\r
+* if an event occurs.\r
+*\r
+* This routine is used to create receive queues, which work with QPs of type:\r
+*\r
+* IB_QPT_RELIABLE_CONN\r
+* IB_QPT_UNRELIABLE_CONN\r
+* IB_QPT_UNRELIABLE_DGRM\r
+*\r
+* SEE ALSO\r
+* ib_query_srq, ib_modify_srq, ib_destroy_srq, ib_srq_attr_t,\r
+* ib_srq_attr_mask_t, ib_pfn_event_cb_t, ib_qp_attr_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_query_srq\r
+* NAME\r
+* ib_query_srq\r
+*\r
+* DESCRIPTION\r
+* Query the current attributes of the shared receive queue.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_query_srq(\r
+ IN const ib_srq_handle_t h_srq,\r
+ OUT ib_srq_attr_t* const p_srq_attr );\r
+/*\r
+* PARAMETERS\r
+* h_srq\r
+* [in] A handle to an existing shared receive queue.\r
+*\r
+* p_srq_attr\r
+* [out] Upon successful completion of this call, the structure\r
+* referenced by this parameter contains the attributes of the specified\r
+* quere pair.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The shared receive queue attributes were returned successfully.\r
+*\r
+* IB_INVALID_SRQ_HANDLE\r
+* The shared receive queue handle was invalid.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the shared receive queue attributes structure was not provided.\r
+*\r
+* NOTES\r
+* This routine returns information about the specified shared receive queue.\r
+*\r
+* SEE ALSO\r
+* ib_query_srq, ib_modify_srq, ib_destroy_srq, ib_srq_attr_t,\r
+* ib_srq_attr_mask_t, ib_pfn_event_cb_t, ib_qp_attr_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_modify_srq\r
+* NAME\r
+* ib_modify_srq\r
+*\r
+* DESCRIPTION\r
+* Modifies the attributes of an existing shared receive queue.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_modify_srq(\r
+ IN const ib_srq_handle_t h_srq,\r
+ IN const ib_srq_attr_t* const p_srq_attr,\r
+ IN const ib_srq_attr_mask_t srq_attr_mask );\r
+/*\r
+* PARAMETERS\r
+* h_srq\r
+* [in] A handle to an existing shared receive queue.\r
+*\r
+* p_srq_attr\r
+* [in] Attributes necessary to allocate and initialize a shared receive queue.\r
+*\r
+* srq_attr_mask\r
+* [in] Flags, indicating which fields in the previous structure are valid.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The shared receive queue was successfully modified.\r
+*\r
+* IB_INVALID_SRQ_HANDLE\r
+* The shared receive queue handle was invalid.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the shared receive queue attributes was not provided.\r
+*\r
+* IB_INVALID_SETTING\r
+* The specified shared receive queue attributes were invalid.\r
+*\r
+* IB_UNSUPPORTED\r
+* The required action is not supported yet.\r
+*\r
+* IB_INSUFFICIENT_RESOURCES\r
+* There were insufficient resources currently available on the channel\r
+* adapter to register the modify the shared receive queue.\r
+*\r
+* NOTES\r
+* This routine modifies the attributes of an existing shared receive queue and\r
+* transitions it to a new state. The new state and attributes are\r
+* specified through the p_qp_mod parameter. Upon successful completion,\r
+* the shared receive queue is in the requested state.\r
+*\r
+* SEE ALSO\r
+* ib_query_srq, ib_modify_srq, ib_destroy_srq, ib_srq_attr_t,\r
+* ib_srq_attr_mask_t, ib_pfn_event_cb_t, ib_qp_attr_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_destroy_srq\r
+* NAME\r
+* ib_destroy_srq\r
+*\r
+* DESCRIPTION\r
+* Release a shared receive queue. Once destroyed, no further access to this\r
+* shared receive queue is possible.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_destroy_srq(\r
+ IN const ib_srq_handle_t h_srq,\r
+ IN const ib_pfn_destroy_cb_t pfn_destroy_cb OPTIONAL );\r
+/*\r
+* PARAMETERS\r
+* h_srq\r
+* [in] A handle to an existing shared shared receive queue.\r
+*\r
+* pfn_destroy_cb\r
+* [in] A user-specified callback that is invoked after the shared receive queue\r
+* has been successfully destroyed.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The destroy request was registered.\r
+*\r
+* IB_INVALID_SRQ_HANDLE\r
+* The shared receive queue handle was invalid.\r
+*\r
+* IB_RESOURCE_BUSY\r
+* There are QPs, bound to the shared receive queue\r
+*\r
+* NOTES\r
+* This call destroys an existing shared receive queue. Since callbacks may be\r
+* outstanding against the shared receive queue at the time the destroy operation is\r
+* invoked, then this call operates asynchronously. The user will be notified\r
+* through a callback once the destroy operation completes, indicating that\r
+* no additional callbacks will be invoked for the specified shared receive queue.\r
+*\r
+* SEE ALSO\r
+* ib_query_srq, ib_modify_srq, ib_destroy_srq, ib_srq_attr_t,\r
+* ib_srq_attr_mask_t, ib_pfn_event_cb_t, ib_qp_attr_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_post_srq_recv\r
+* NAME\r
+* ib_post_srq_recv\r
+*\r
+* DESCRIPTION\r
+* This routine posts a work request to the shared receive queue of a shared receive queue.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_post_srq_recv(\r
+ IN const ib_srq_handle_t h_srq,\r
+ IN ib_recv_wr_t* const p_recv_wr,\r
+ OUT ib_recv_wr_t **pp_recv_failure OPTIONAL );\r
+/*\r
+* PARAMETERS\r
+* h_srq\r
+* [in] The shared receive queue to which this work request is being submitted.\r
+*\r
+* p_recv_wr\r
+* [in] A reference to the head of the work request list.\r
+*\r
+* pp_recv_failure\r
+* [out] If the post receive operation failed, this references the work\r
+* request in the p_recv_wr list where the first failure occurred.\r
+* This parameter may be NULL if only a single work request is being\r
+* posted to the QP.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* All work requests were successfully posted.\r
+*\r
+* IB_INVALID_QP_HANDLE\r
+* The shared receive queue handle was invalid.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the receive work request list was not provided.\r
+*\r
+* IB_INSUFFICIENT_RESOURCES\r
+* The number of posted work requests exceed the current depth available\r
+* on the receive queue.\r
+*\r
+* IB_INVALID_WR_TYPE\r
+* The work request type was invalid.\r
+*\r
+* IB_INVALID_QP_STATE\r
+* The current shared receive queue state does not allow posting receives.\r
+*\r
+* NOTES\r
+* This routine posts a work request to the shared receive queue.\r
+* The type of work to perform is defined by the p_recv_wr parameter. This\r
+* call is used to post data buffers to receive incoming message sends.\r
+*\r
+* SEE ALSO\r
+* ib_recv_wr_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_create_qp\r
+* NAME\r
+* ib_create_qp\r
+*\r
+* DESCRIPTION\r
+* Creates a queue pair and returns its handle to the user.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_create_qp(\r
+ IN const ib_pd_handle_t h_pd,\r
+ IN const ib_qp_create_t* const p_qp_create,\r
+ IN const void* const qp_context,\r
+ IN const ib_pfn_event_cb_t pfn_qp_event_cb OPTIONAL,\r
+ OUT ib_qp_handle_t* const ph_qp );\r
+/*\r
+* PARAMETERS\r
+* h_pd\r
+* [in] This is a handle to a protection domain associated with the queue\r
+* pair.\r
+*\r
+* p_qp_create\r
+* [in] Attributes necessary to allocate and initialize the queue pair.\r
+*\r
+* qp_context\r
+* [in] A user-specified context information associated with the\r
+* queue pair.\r
+*\r
+* pfn_qp_event_cb\r
+* [in] User-specified error callback routine invoked after an\r
+* asynchronous event has occurred on the queue pair.\r
+*\r
+* ph_qp\r
+* [out] Upon successful completion of this call, this references a\r
+* handle to the newly created queue pair.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The queue pair was successfully created.\r
+*\r
+* IB_INVALID_PD_HANDLE\r
+* The protection domain to associate with the queue pair was invalid.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the queue pair attributes or handle was not provided.\r
+*\r
+* IB_INSUFFICIENT_MEMORY\r
+* There was insufficient memory to create the queue pair.\r
+*\r
+* IB_INSUFFICIENT_RESOURCES\r
+* There were insufficient resources currently available on the channel\r
+* adapter to create the queue pair.\r
+*\r
+* IB_INVALID_CQ_HANDLE\r
+* The send or receive completion queue to associate with the queue pair\r
+* was invalid.\r
+*\r
+* IB_INVALID_SRQ_HANDLE\r
+* The shared receive queue to be associated with the queue pair\r
+* was invalid.\r
+*\r
+* IB_INVALID_SETTING\r
+* The specified queue pair creation attributes are invalid.\r
+*\r
+* IB_UNSUPPORTED\r
+* The specified queue pair type was not supported by the channel adapter.\r
+*\r
+* IB_INVALID_MAX_WRS\r
+* The requested maximum send or receive work request depth could not be\r
+* supported.\r
+*\r
+* IB_INVALID_MAX_SGE\r
+* The requested maximum number of scatter-gather entries for the send or\r
+* receive queue could not be supported.\r
+*\r
+* NOTES\r
+* 1. This routine allocates a queue pair with the specified attributes. If\r
+* the queue pair cannot be allocated, an error is returned. When creating\r
+* the queue pair, users associate a context with the queue pair. This\r
+* context is returned to the user through the asynchronous event callback\r
+* if an event occurs.\r
+*\r
+* 2. For QPs that are associated with an SRQ, the Consumer should take\r
+* the QP through the Error State before invoking a Destroy QP or a Modify\r
+* QP to the Reset State. The Consumer may invoke the Destroy QP without\r
+* first performing a Modify QP to the Error State and waiting for the Affiliated \r
+* Asynchronous Last WQE Reached Event. However, if the Consumer\r
+* does not wait for the Affiliated Asynchronous Last WQE Reached Event,\r
+* then WQE and Data Segment leakage may occur.\r
+*\r
+* 3. This routine is used to create queue pairs of type:\r
+* IB_QPT_RELIABLE_CONN\r
+* IB_QPT_UNRELIABLE_CONN\r
+* IB_QPT_UNRELIABLE_DGRM\r
+* IB_QPT_MAD\r
+*\r
+* 4. Callers of ib_create_qp should call ib_init_dgrm_svc if the queue pair\r
+* is of type IB_QPT_UNRELIABLE_DGRM or IB_QPT_MAD before sending or\r
+* receiving data. IB_QPT_RELIABLE_CONN, IB_QPT_UNRELIABLE_CONN type\r
+* queue pairs should be used by the connection establishment process\r
+* before data may be sent or received on the QP.\r
+*\r
+* This call does not return the QP attributes as MAD QPs do not support\r
+* such an operation. This is a minor specification deviation.\r
+*\r
+* SEE ALSO\r
+* ib_query_qp, ib_modify_qp, ib_destroy_qp, ib_cm_req, ib_cm_rep, ib_cm_rtu\r
+* ib_init_dgrm_svc, ib_qp_create_t, ib_pfn_event_cb_t, ib_qp_attr_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_get_spl_qp\r
+* NAME\r
+* ib_get_spl_qp\r
+*\r
+* DESCRIPTION\r
+* Create a special QP or QP alias. This call provides access to queue\r
+* pairs 0 and 1, and the raw queue pair types.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_get_spl_qp(\r
+ IN const ib_pd_handle_t h_pd,\r
+ IN const ib_net64_t port_guid,\r
+ IN const ib_qp_create_t* const p_qp_create,\r
+ IN const void* const qp_context,\r
+ IN const ib_pfn_event_cb_t pfn_qp_event_cb OPTIONAL,\r
+ OUT ib_pool_key_t* const p_pool_key OPTIONAL,\r
+ OUT ib_qp_handle_t* const ph_qp );\r
+/*\r
+* PARAMETERS\r
+* h_pd\r
+* [in] This is a handle to a protection domain associated with the queue\r
+* pair. This must be a protection domain alias for aliased QP types.\r
+*\r
+* port_guid\r
+* [in] The port GUID that the special QP will be associated with.\r
+*\r
+* p_qp_create\r
+* [in] Attributes necessary to allocate and initialize the queue pair.\r
+*\r
+* qp_context\r
+* [in] A user-specified context information associated with the\r
+* queue pair.\r
+*\r
+* pfn_qp_ervent_cb\r
+* [in] User-specified error callback routine invoked after an\r
+* asynchronous event has occurred on the queue pair.\r
+*\r
+* p_pool_key\r
+* [in] A key to a pool of MAD elements that are used to send MADs.\r
+* This key is only valid for aliased QP types.\r
+*\r
+* ph_qp\r
+* [out] Upon successful completion of this call, this references a\r
+* handle to the newly created queue pair.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The queue pair was successfully created.\r
+*\r
+* IB_INVALID_PD_HANDLE\r
+* The protection domain to associate with the queue pair was invalid.\r
+*\r
+* IB_INVALID_PORT\r
+* The port number supplied was invalid for the given channel adapter.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the queue pair attributes or handle was not provided.\r
+*\r
+* IB_INVALID_PERMISSION\r
+* The calling process does not have sufficient privilege to create the\r
+* requested queue pair type.\r
+*\r
+* IB_INSUFFICIENT_MEMORY\r
+* There was insufficient memory to create the queue pair.\r
+*\r
+* IB_INSUFFICIENT_RESOURCES\r
+* There were insufficient resources currently available on the channel\r
+* adapter to create the queue pair.\r
+*\r
+* IB_INVALID_CQ_HANDLE\r
+* The send or receive completion queue to associate with the queue pair\r
+* was invalid.\r
+*\r
+* IB_INVALID_SETTING\r
+* The specified queue pair type was invalid.\r
+*\r
+* IB_UNSUPPORTED\r
+* The specified queue pair type was not supported by the channel adapter.\r
+*\r
+* IB_INVALID_MAX_WRS\r
+* The requested maximum send or receive work request depth could not be\r
+* supported.\r
+*\r
+* IB_INVALID_MAX_SGE\r
+* The requested maximum number of scatter-gather entries for the send or\r
+* receive queue could not be supported.\r
+*\r
+* NOTES\r
+* This routine allocates a queue pair with the specified attributes. If\r
+* the queue pair cannot be allocated, an error is returned. When creating\r
+* the queue pair, users associate a context with the queue pair. This\r
+* context is returned to the user through the asynchronous event callback\r
+* if an event occurs.\r
+*\r
+* This routine is used to create queue pairs of type:\r
+*\r
+* IB_QPT_QP0\r
+* IB_QPT_QP1\r
+* IB_QPT_RAW_IPV6\r
+* IB_QPT_RAW_ETHER\r
+* IB_QPT_QP0_ALIAS\r
+* IB_QPT_QP1_ALIAS\r
+*\r
+* Callers of ib_get_spl_qp should call ib_init_dgrm_svc if the queue pair is\r
+* of type IB_QPT_QP0, IB_QPT_QP1, IB_QPT_RAW_IPV6, IB_QPT_RAW_ETHER before\r
+* sending or receiving data. MADs may be sent on aliased QPs on the\r
+* successful return of this routine.\r
+*\r
+* SEE ALSO\r
+* ib_query_qp, ib_modify_qp, ib_destroy_qp, ib_get_mad\r
+* ib_init_dgrm_svc, ib_qp_create_t, ib_pfn_event_cb_t, ib_qp_attr_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_query_qp\r
+* NAME\r
+* ib_query_qp\r
+*\r
+* DESCRIPTION\r
+* Query the current attributes of the queue pair.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_query_qp(\r
+ IN const ib_qp_handle_t h_qp,\r
+ OUT ib_qp_attr_t* const p_qp_attr );\r
+/*\r
+* PARAMETERS\r
+* h_qp\r
+* [in] A handle to an existing queue pair.\r
+*\r
+* p_qp_attr\r
+* [out] Upon successful completion of this call, the structure\r
+* referenced by this parameter contains the attributes of the specified\r
+* quere pair.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The queue pair attributes were returned successfully.\r
+*\r
+* IB_INVALID_QP_HANDLE\r
+* The queue pair handle was invalid.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the queue pair attributes structure was not provided.\r
+*\r
+* NOTES\r
+* This routine returns information about the specified queue pair.\r
+*\r
+* SEE ALSO\r
+* ib_create_qp, ib_modify_qp, ib_qp_attr_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_modify_qp\r
+* NAME\r
+* ib_modify_qp\r
+*\r
+* DESCRIPTION\r
+* Modifies the attributes of an existing queue pair.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_modify_qp(\r
+ IN const ib_qp_handle_t h_qp,\r
+ IN const ib_qp_mod_t* const p_qp_mod );\r
+/*\r
+* PARAMETERS\r
+* h_qp\r
+* [in] A handle to an existing queue pair.\r
+*\r
+* p_qp_mod\r
+* [in] The new attributes to use when modifying the queue pair.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The queue pair was successfully modified.\r
+*\r
+* IB_INVALID_QP_HANDLE\r
+* The queue pair handle was invalid.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the queue pair attributes was not provided.\r
+*\r
+* IB_INVALID_SETTING\r
+* The specified queue pair attributes were invalid.\r
+*\r
+* IB_INSUFFICIENT_RESOURCES\r
+* There were insufficient resources currently available on the channel\r
+* adapter to register the modify the queue pair.\r
+*\r
+* IB_UNSUPPORTED\r
+* The requested modification was not supported.\r
+*\r
+* IB_INVALID_QP_STATE\r
+* The queue pair was in an invalid state for the requested operation.\r
+*\r
+* IB_INVALID_PKEY\r
+* The specified pkey was not valid.\r
+*\r
+* IB_INVALID_APM_STATE\r
+* The specified automatic path migration state was not valid.\r
+*\r
+* NOTES\r
+* This routine modifies the attributes of an existing queue pair and\r
+* transitions it to a new state. The new state and attributes are\r
+* specified through the p_qp_mod parameter. Upon successful completion,\r
+* the queue pair is in the requested state.\r
+*\r
+* SEE ALSO\r
+* ib_create_qp, ib_destroy_qp, ib_qp_mod_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_destroy_qp\r
+* NAME\r
+* ib_destroy_qp\r
+*\r
+* DESCRIPTION\r
+* Release a queue pair. Once destroyed, no further access to this\r
+* queue pair is possible.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_destroy_qp(\r
+ IN const ib_qp_handle_t h_qp,\r
+ IN const ib_pfn_destroy_cb_t pfn_destroy_cb OPTIONAL );\r
+/*\r
+* PARAMETERS\r
+* h_qp\r
+* [in] A handle to an existing queue pair.\r
+*\r
+* pfn_destroy_cb\r
+* [in] A user-specified callback that is invoked after the queue pair\r
+* has been successfully destroyed.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The destroy request was registered.\r
+*\r
+* IB_INVALID_QP_HANDLE\r
+* The queue pair handle was invalid.\r
+*\r
+* NOTES\r
+* This call destroys an existing queue pair. Since callbacks may be\r
+* outstanding against the queue pair at the time the destroy operation is\r
+* invoked, the this call operates asynchronously. The user will be notified\r
+* through a callback once the destroy operation completes, indicating that\r
+* no additional callbacks will be invoked for the specified queue pair.\r
+*\r
+* SEE ALSO\r
+* ib_create_qp\r
+*****/\r
+\r
+\r
+/****s* Access Layer/ib_cq_create_t\r
+* NAME\r
+* ib_cq_create_t\r
+*\r
+* DESCRIPTION\r
+* Attributes used to initialize a completion queue at creation time.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_cq_create\r
+{\r
+ uint32_t size;\r
+ ib_pfn_comp_cb_t pfn_comp_cb;\r
+ cl_waitobj_handle_t h_wait_obj;\r
+\r
+} ib_cq_create_t;\r
+/*\r
+* FIELDS\r
+* size\r
+* Specifies the maximum number of work completions that may be on the\r
+* completion queue. If the creation call is successful, the actual\r
+* size of the completion queue will be returned. The actual size of\r
+* the CQ will be greater than or equal to the requested size.\r
+*\r
+* pfn_comp_cb\r
+* A callback that is invoked whenever a signaled completion occurs on\r
+* the completion queue. This field is mutually exclusive with the\r
+* p_event field.\r
+*\r
+* h_wait_obj\r
+* A wait object that is triggered whenever a signaled completion occurs\r
+* on the completion queue. This field is mutually exclusive with the\r
+* pfn_comp_cb field and is only valid for user-mode clients. The wait\r
+* object must be ready for use when the call to ib_create_cq is invoked.\r
+*\r
+* NOTES\r
+* Clients must specify either an event or a callback when creating a\r
+* completion queue. When a signaled completion occurs on the completion\r
+* queue, the client will be notified through the callback or by\r
+* signaling the specified event.\r
+*\r
+* SEE ALSO\r
+* ib_create_cq, ib_pfn_comp_cb_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_create_cq\r
+* NAME\r
+* ib_create_cq\r
+*\r
+* DESCRIPTION\r
+* Creates a completion queue and returns its handle to the user.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_create_cq(\r
+ IN const ib_ca_handle_t h_ca,\r
+ IN OUT ib_cq_create_t* const p_cq_create,\r
+ IN const void* const cq_context,\r
+ IN const ib_pfn_event_cb_t pfn_cq_event_cb OPTIONAL,\r
+ OUT ib_cq_handle_t* const ph_cq );\r
+/*\r
+* PARAMETERS\r
+* h_ca\r
+* [in] A handle to an open channel adapter.\r
+*\r
+* p_cq_create\r
+* [in] Attributes necessary to allocate and initialize the\r
+* completion queue.\r
+*\r
+* cq_context\r
+* [in] A user-specified context associated with the completion queue.\r
+*\r
+* pfn_cq_event_cb\r
+* [in] User-specified error callback routine invoked after an\r
+* asynchronous event has occurred on the completion queue.\r
+*\r
+* ph_cq\r
+* [out] Upon successful completion of this call, this references a\r
+* handle to the newly created completion queue.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The completion queue was successfully created.\r
+*\r
+* IB_INVALID_CA_HANDLE\r
+* The channel adapter handle was invalid.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the completion queue attributes or handle was not\r
+* provided.\r
+*\r
+* IB_INVALID_SETTING\r
+* The specified attributes that should be used to create the completion\r
+* queue are invalid. Both completion callback and wait object\r
+* information were supplied or are missing.\r
+*\r
+* IB_INSUFFICIENT_MEMORY\r
+* There was insufficient memory to create the completion queue.\r
+*\r
+* IB_INSUFFICIENT_RESOURCES\r
+* There were insufficient resources currently available on the channel\r
+* adapter to create the completion queue.\r
+*\r
+* IB_INVALID_CQ_SIZE\r
+* The requested size of the completion queue was larger than the\r
+* maximum supported by the associated channel adapter.\r
+*\r
+* NOTES\r
+* This routine allocates a completion queue on the specified channel\r
+* adapter. If the completion queue cannot be allocated, an error is\r
+* returned. When creating the completion queue, users associate a context\r
+* with the completion queue. This context is returned to the user through\r
+* the completion and asynchronous event callbacks.\r
+*\r
+* SEE ALSO\r
+* ib_query_cq, ib_modify_cq, ib_destroy_cq, ib_cq_create_t, ib_pfn_event_cb_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_modify_cq\r
+* NAME\r
+* ib_modify_cq\r
+*\r
+* DESCRIPTION\r
+* Modifies the attributes associated with a completion queue, allowing the\r
+* completion queue to be resized.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_modify_cq(\r
+ IN const ib_cq_handle_t h_cq,\r
+ IN OUT uint32_t* const p_size );\r
+/*\r
+* PARAMETERS\r
+* h_cq\r
+* [in] A handle to an existing completion queue.\r
+*\r
+* p_size\r
+* [in/out] Specifies the new size of the completion queue. If the\r
+* modify call is successful, the actual size of the completion queue\r
+* will be returned. The actual size of the CQ will be greater than or\r
+* equal to the requested size.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The completion queue was successfully modified.\r
+*\r
+* IB_INVALID_CQ_HANDLE\r
+* The completion queue handle was invalid.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the completion queue size was not provided.\r
+*\r
+* IB_INVALID_CQ_SIZE\r
+* The requested size of the completion queue was larger than the\r
+* maximum supported by the associated channel adapter.\r
+*\r
+* IB_OVERFLOW\r
+* The specified size of the completion queue is smaller than the number\r
+* of work completions currently on the completion queue.\r
+*\r
+* IB_INSUFFICIENT_MEMORY\r
+* There was insufficient memory to modify the completion queue.\r
+*\r
+* NOTES\r
+* This routine allows a client to modify the size of a completion queue.\r
+* If the new size is larger than what the associated channel adapter can\r
+* support, an error is returned. If the completion queue has valid\r
+* completion entries on it and the requested size is smaller than the\r
+* number of entries, an overflow error is returned and the modify\r
+* operation is aborted.\r
+*\r
+* SEE ALSO\r
+* ib_create_cq\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_query_cq\r
+* NAME\r
+* ib_query_cq\r
+*\r
+* DESCRIPTION\r
+* Returns information about the specified completion queue.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_query_cq(\r
+ IN const ib_cq_handle_t h_cq,\r
+ OUT uint32_t* const p_size );\r
+/*\r
+* PARAMETERS\r
+* h_cq\r
+* [in] A handle to an existing completion queue.\r
+*\r
+* p_size\r
+* [out] Upon successful completion of this call, contains the actual\r
+* size of the completion queue.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The completion queue was successfully queried.\r
+*\r
+* IB_INVALID_CQ_HANDLE\r
+* The completion queue handle was invalid.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the completion queue size was not provided.\r
+*\r
+* SEE ALSO\r
+* ib_create_cq\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_destroy_cq\r
+* NAME\r
+* ib_destroy_cq\r
+*\r
+* DESCRIPTION\r
+* Destroys a completion queue. Once destroyed, no further access to the\r
+* completion queue is possible.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_destroy_cq(\r
+ IN const ib_cq_handle_t h_cq,\r
+ IN const ib_pfn_destroy_cb_t pfn_destroy_cb OPTIONAL );\r
+/*\r
+* PARAMETERS\r
+* h_qp\r
+* [in] A handle to an existing completion queue.\r
+*\r
+* pfn_destroy_cb\r
+* [in] A user-provided callback that is invoked after the\r
+* completion queue has been successfully destroyed.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The destroy request was registered.\r
+*\r
+* IB_INVALID_CQ_HANDLE\r
+* The completion queue handle was invalid.\r
+*\r
+* NOTES\r
+* This call destroys an existing completion queue. Since callbacks may be\r
+* outstanding against the completion queue at the time the destroy operation\r
+* is invoked, the this call operates asynchronously. The user will be\r
+* notified through a callback once the destroy operation completes,\r
+* indicating that no additional callbacks will be invoked for the specified\r
+* completion queue.\r
+*\r
+* If there are still queue pairs associated with the completion queue when\r
+* this function is invoked, the destroy operation will fail with status\r
+* IB_RESOURCE_BUSY.\r
+*\r
+* SEE ALSO\r
+* ib_create_cq, ib_pfn_destroy_cb_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_reg_mem\r
+* NAME\r
+* ib_reg_mem\r
+*\r
+* DESCRIPTION\r
+* Registers a virtual memory region with a channel adapter.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_reg_mem(\r
+ IN const ib_pd_handle_t h_pd,\r
+ IN const ib_mr_create_t* const p_mr_create,\r
+ OUT net32_t* const p_lkey,\r
+ OUT net32_t* const p_rkey,\r
+ OUT ib_mr_handle_t* const ph_mr );\r
+/*\r
+* PARAMETERS\r
+* h_pd\r
+* [in] A handle to an existing protection domain that the memory\r
+* should be registered with.\r
+*\r
+* p_mr_create\r
+* [in] Information describing the memory region to register.\r
+*\r
+* p_lkey\r
+* [out] The local access key associated with this registered memory\r
+* region.\r
+*\r
+* p_rkey\r
+* [out] A key that may be used by a remote end-point when performing\r
+* RDMA or atomic operations to this registered memory region.\r
+*\r
+* ph_mr\r
+* [out] Upon successful completion of this call, this references a\r
+* handle to the registered memory region. This handle is used when\r
+* performing data transfers and to deregister the memory.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The memory region was successfully registered.\r
+*\r
+* IB_INVALID_PD_HANDLE\r
+* The protection domain to associate with the memory region was invalid.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the memory region information, lkey, rkey, or handle\r
+* was not provided.\r
+*\r
+* IB_INSUFFICIENT_MEMORY\r
+* There was insufficient memory to register the memory region.\r
+*\r
+* IB_INSUFFICIENT_RESOURCES\r
+* There were insufficient resources currently available on the channel\r
+* adapter to register the memory region.\r
+*\r
+* IB_UNSUPPORTED\r
+* The requested access rights are not supported by the channel adapter.\r
+*\r
+* IB_INVALID_PERMISSION\r
+* The requested access rights are invalid.\r
+*\r
+* NOTES\r
+* This routine registers a virtual memory region with a channel adapter.\r
+* Memory must be registered before being used in a data transfer operation.\r
+*\r
+* SEE ALSO\r
+* ib_dereg_mr, ib_reg_phys, ib_reg_shared, ib_mr_create_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_reg_phys\r
+* NAME\r
+* ib_reg_phys\r
+*\r
+* DESCRIPTION\r
+* Registers a physical memory region with a channel adapter.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_reg_phys(\r
+ IN const ib_pd_handle_t h_pd,\r
+ IN const ib_phys_create_t* const p_phys_create,\r
+ IN OUT uint64_t* const p_vaddr,\r
+ OUT net32_t* const p_lkey,\r
+ OUT net32_t* const p_rkey,\r
+ OUT ib_mr_handle_t* const ph_mr );\r
+/*\r
+* PARAMETERS\r
+* h_pd\r
+* [in] A handle to an existing protection domain that the memory\r
+* should be registered with.\r
+*\r
+* p_phys_create\r
+* [in] Information describing the memory region to register.\r
+*\r
+* p_vaddr\r
+* [in/out] On input, references the requested virtual address for the\r
+* start of the physical region. On output, references the actual\r
+* virtual address assigned to the registered region.\r
+*\r
+* p_lkey\r
+* [out] The local access key associated with this registered memory\r
+* region.\r
+*\r
+* p_rkey\r
+* [out] A key that may be used by a remote end-point when performing\r
+* RDMA or atomic operations to this registered memory region.\r
+*\r
+* ph_mr\r
+* [out] Upon successful completion of this call, this references a\r
+* handle to the registered memory region. This handle is used when\r
+* performing data transfers and to deregister the memory.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The physical memory region was successfully registered.\r
+*\r
+* IB_INVALID_PD_HANDLE\r
+* The protection domain to associate with the physical memory region\r
+* was invalid.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the physical memory region information, virtual address,\r
+* lkey, rkey, or handle was not provided.\r
+*\r
+* IB_INSUFFICIENT_MEMORY\r
+* There was insufficient memory to register the physical memory region.\r
+*\r
+* IB_INSUFFICIENT_RESOURCES\r
+* There were insufficient resources currently available on the channel\r
+* adapter to register the physical memory region.\r
+*\r
+* IB_UNSUPPORTED\r
+* The requested access rights are not supported by the channel adapter.\r
+*\r
+* IB_INVALID_PERMISSION\r
+* The requested access rights are invalid.\r
+*\r
+* NOTES\r
+* This routine registers an array of physical pages as a single virtually\r
+* contiguous region with a channel adapter. Memory must be registered\r
+* before being used in a data transfer operation.\r
+*\r
+* SEE ALSO\r
+* ib_dereg_mr, ib_reg_mem, ib_reg_shared, ib_phys_create_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_query_mr\r
+* NAME\r
+* ib_query_mr\r
+*\r
+* DESCRIPTION\r
+* Query the current attributes of a memory region.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_query_mr(\r
+ IN const ib_mr_handle_t h_mr,\r
+ OUT ib_mr_attr_t* const p_mr_attr );\r
+/*\r
+* PARAMETERS\r
+* h_mr\r
+* [in] A handle to a registered memory region.\r
+*\r
+* p_mr_attr\r
+* [out] A reference to a structure where the registered memory attributes\r
+* will be copied.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The memory region attributes were returned successfully.\r
+*\r
+* IB_INVALID_MR_HANDLE\r
+* The memory region handle was invalid.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the memory region attributes was not provided.\r
+*\r
+* NOTES\r
+* This routine returns information about the specified registered memory\r
+* region.\r
+*\r
+* SEE ALSO\r
+* ib_dereg_mr, ib_reg_mem, ib_reg_shared, ib_mr_attr_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_rereg_mem\r
+* NAME\r
+* ib_rereg_mem\r
+*\r
+* DESCRIPTION\r
+* Modifies the attributes of an existing memory region.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_rereg_mem(\r
+ IN const ib_mr_handle_t h_mr,\r
+ IN const ib_mr_mod_t mr_mod_mask,\r
+ IN const ib_mr_create_t* const p_mr_create OPTIONAL,\r
+ OUT net32_t* const p_lkey,\r
+ OUT net32_t* const p_rkey,\r
+ IN const ib_pd_handle_t h_pd OPTIONAL );\r
+/*\r
+* PARAMETERS\r
+* h_mr\r
+* [in] A handle to the registered memory region being modified.\r
+*\r
+* mr_mod_mask\r
+* [in] A mask used to specify which attributes of the memory region are\r
+* being modified.\r
+*\r
+* p_mr_create\r
+* [in] This references information needed to perform the modification on\r
+* the registered memory region. This parameter may be NULL if only the\r
+* protection domain will be modified.\r
+*\r
+* p_lkey\r
+* [out] The local access key associated with this registered memory\r
+* region.\r
+*\r
+* p_rkey\r
+* [out] A key that may be used by a remote end-point when performing RDMA\r
+* or atomic operations to this registered memory region.\r
+*\r
+* h_pd\r
+* [in] An optionally provided parameter used to modify the protection\r
+* domain of a registered region.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The memory region attributes were modified successfully.\r
+*\r
+* IB_INVALID_MR_HANDLE\r
+* The memory region handle was invalid.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the lkey or rkey was not provided or the specified\r
+* modify mask is invalid.\r
+*\r
+* IB_INVALID_SETTING\r
+* The specified memory region attributes are invalid.\r
+*\r
+* IB_INVALID_PD_HANDLE\r
+* The protection domain handle was invalid.\r
+*\r
+* IB_INSUFFICIENT_RESOURCES\r
+* There were insufficient resources currently available on the channel\r
+* adapter to modify the memory region.\r
+*\r
+* IB_UNSUPPORTED\r
+* The requested access rights are not supported by the channel adapter.\r
+*\r
+* IB_INVALID_PERMISSION\r
+* The requested access rights are invalid.\r
+*\r
+* IB_RESOURCE_BUSY\r
+* The memory region has windows bound to it.\r
+*\r
+* NOTES\r
+* This routine modifies the attributes of the specified memory region.\r
+* The memory being modified may have been registered using either virtual\r
+* or physical registration. Conceptually, this routine is equivalent to\r
+* to calling ib_dereg_mr, followed by ib_reg_mem, but may be higher\r
+* performing.\r
+*\r
+* SEE ALSO\r
+* ib_reg_mem, ib_reg_phys, ib_dereg_mr, ib_mr_mod_t, ib_mr_create_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_rereg_phys\r
+* NAME\r
+* ib_rereg_phys\r
+*\r
+* DESCRIPTION\r
+* Modifies the attributes of an existing memory region.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_rereg_phys(\r
+ IN const ib_mr_handle_t h_mr,\r
+ IN const ib_mr_mod_t mr_mod_mask,\r
+ IN const ib_phys_create_t* const p_phys_create OPTIONAL,\r
+ IN OUT uint64_t* const p_vaddr,\r
+ OUT net32_t* const p_lkey,\r
+ OUT net32_t* const p_rkey,\r
+ IN const ib_pd_handle_t h_pd OPTIONAL );\r
+/*\r
+* PARAMETERS\r
+* h_mr\r
+* [in] A handle to the registered memory region being modified.\r
+*\r
+* mr_mod_mask\r
+* [in] A mask used to specify which attributes of the memory region are\r
+* being modified.\r
+*\r
+* p_phys_create\r
+* [in] This references information needed to perform the modification on\r
+* the registered memory region. This parameter may be NULL if\r
+* only the protection domain will be modified.\r
+*\r
+* p_vaddr\r
+* [in/out] On input, this specifies the requested virtual address for the\r
+* start of the physical region. On output, this references the actual\r
+* virtual address assigned to the registered region.\r
+*\r
+* p_lkey\r
+* [out] The local access key associated with this registered memory\r
+* region.\r
+*\r
+* p_rkey\r
+* [out] A key that may be used by a remote end-point when performing RDMA\r
+* or atomic operations to this registered memory region.\r
+*\r
+* h_pd\r
+* [in] An optionally provided parameter used to modify the protection\r
+* domain of a registered region.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The memory region attributes were modified successfully.\r
+*\r
+* IB_INVALID_MR_HANDLE\r
+* The memory region handle was invalid.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the virtual address, lkey, rkey was not provided or\r
+* the specified modify mask is invalid.\r
+*\r
+* IB_INVALID_SETTING\r
+* The specified memory region attributes are invalid.\r
+*\r
+* IB_INVALID_PD_HANDLE\r
+* The protection domain handle was invalid.\r
+*\r
+* IB_INSUFFICIENT_RESOURCES\r
+* There were insufficient resources currently available on the channel\r
+* adapter to modify the memory region.\r
+*\r
+* IB_UNSUPPORTED\r
+* The requested access rights are not supported by the channel adapter.\r
+*\r
+* IB_INVALID_PERMISSION\r
+* The requested access rights are invalid.\r
+*\r
+* IB_RESOURCE_BUSY\r
+* The memory region has windows bound to it.\r
+*\r
+* NOTES\r
+* This routine modifies the attributes of the specified memory region.\r
+* The memory being modified may have been registered using either virtual\r
+* or physical registration. Conceptually, this routine is equivalent to\r
+* to calling ib_dereg_mr, followed by ib_reg_phys, but may be higher\r
+* performing.\r
+*\r
+* SEE ALSO\r
+* ib_reg_mem, ib_reg_phys, ib_dereg_mr, ib_mr_mod_t, ib_mr_create_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_reg_shared\r
+* NAME\r
+* ib_reg_shared\r
+*\r
+* DESCRIPTION\r
+* Registers a memory region that has the same physical pages as an\r
+* existing registered memory region.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_reg_shared(\r
+ IN const ib_mr_handle_t h_mr,\r
+ IN const ib_pd_handle_t h_pd,\r
+ IN const ib_access_t access_ctrl,\r
+ IN OUT uint64_t* const p_vaddr,\r
+ OUT net32_t* const p_lkey,\r
+ OUT net32_t* const p_rkey,\r
+ OUT ib_mr_handle_t* const ph_mr );\r
+/*\r
+* PARAMETERS\r
+* h_mr\r
+* [in] A handle to an existing registered memory region that this\r
+* registration should share physical pages with.\r
+*\r
+* h_pd\r
+* [in] Handle to the PD on which memory is being registered\r
+*\r
+* access_ctrl\r
+* [in] Access rights of the registered region.\r
+*\r
+* p_vaddr\r
+* [in/out] On input, this specifies the requested virtual address for the\r
+* start of the physical region. On output, this references the actual\r
+* virtual address assigned to the registered region. This is always a\r
+* 64-bit quantity to support registering more than 4GB of memory on\r
+* 32-bit systems with PAE.\r
+*\r
+* p_lkey\r
+* [out] The local access key associated with this registered memory\r
+* region.\r
+*\r
+* p_rkey\r
+* [out] A key that may be used by a remote end-point when performing RDMA\r
+* or atomic operations to this registered memory region.\r
+*\r
+* ph_mr\r
+* [out] Upon successful completion of this call, this references a handle\r
+* to the registered memory region. This handle is used when performing\r
+* data transfers and to deregister the memory.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The shared memory region was successfully registered.\r
+*\r
+* IB_INVALID_MR_HANDLE\r
+* The memory region handle was invalid.\r
+*\r
+* IB_INVALID_PD_HANDLE\r
+* The protection domain handle was invalid.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the virtual address, lkey, rkey, or handle was not\r
+* provided.\r
+*\r
+* IB_INSUFFICIENT_MEMORY\r
+* There was insufficient memory to register the shared memory region.\r
+*\r
+* IB_INSUFFICIENT_RESOURCES\r
+* There were insufficient resources currently available on the channel\r
+* adapter to register the shared memory region.\r
+*\r
+* IB_UNSUPPORTED\r
+* The requested access rights are not supported by the channel adapter.\r
+*\r
+* IB_INVALID_PERMISSION\r
+* The requested access rights are invalid.\r
+*\r
+* NOTES\r
+* This routine registers a memory region that shares the same set of\r
+* physical pages associated with an existing registered memory region.\r
+*\r
+* SEE ALSO\r
+* ib_dereg_mr, ib_reg_mem, ib_reg_phys, ib_reg_shared, ib_mr_create_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_reg_shmid\r
+* NAME\r
+* ib_reg_shmid\r
+*\r
+* DESCRIPTION\r
+* Registers a memory region to be shared across multiple processes.\r
+* The memory is referenced by a shared memory identifier.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_reg_shmid(\r
+ IN const ib_pd_handle_t h_pd,\r
+ IN const ib_shmid_t shmid,\r
+ IN const ib_mr_create_t* const p_mr_create,\r
+ OUT uint64_t* const p_vaddr,\r
+ OUT net32_t* const p_lkey,\r
+ OUT net32_t* const p_rkey,\r
+ OUT ib_mr_handle_t* const ph_mr );\r
+/*\r
+* PARAMETERS\r
+* h_pd\r
+* [in] A handle to an existing protection domain that the memory\r
+* should be registered with.\r
+*\r
+* shmid\r
+* [in] An identifier for the shared memory region.\r
+*\r
+* p_mr_create\r
+* [in] Information describing the attributes of the memory region to\r
+* register.\r
+*\r
+* p_vaddr,\r
+* [out] The HCA assigned, HCA relative virtual address for the\r
+* memory region.\r
+*\r
+* p_lkey\r
+* [out] The local access key associated with this registered memory\r
+* region.\r
+*\r
+* p_rkey\r
+* [out] A key that may be used by a remote end-point when performing RDMA\r
+* or atomic operations to this registered memory region.\r
+*\r
+* ph_mr\r
+* [out] Upon successful completion of this call, this references a handle\r
+* to the registered memory region. This handle is used when performing\r
+* data transfers and to deregister the memory.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The shared memory region was successfully registered.\r
+*\r
+* IB_INVALID_PD_HANDLE\r
+* The protection domain handle was invalid.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the memory region information, lkey, rkey, or handle\r
+* was not provided.\r
+*\r
+* IB_INVALID_SETTING\r
+* The length and page mapping for the memory region do not match those\r
+* of the region identified by the provided SHMID.\r
+*\r
+* IB_INSUFFICIENT_MEMORY\r
+* There was insufficient memory to register the shared memory region.\r
+*\r
+* IB_INSUFFICIENT_RESOURCES\r
+* There were insufficient resources currently available on the channel\r
+* adapter to register the shared memory region.\r
+*\r
+* IB_UNSUPPORTED\r
+* The requested access rights are not supported by the channel adapter.\r
+*\r
+* IB_INVALID_PERMISSION\r
+* The requested access rights are invalid.\r
+*\r
+* NOTES\r
+* This routine registers a memory region that is shared between processes.\r
+* The region being registered is identified through a shared memory\r
+* identifier. The registered region shares hardware resources as much\r
+* as possible.\r
+*\r
+* SEE ALSO\r
+* ib_dereg_mr, ib_reg_mem, ib_reg_shared, ib_mr_create_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_dereg_mr\r
+* NAME\r
+* ib_dereg_mr\r
+*\r
+* DESCRIPTION\r
+* Deregisters a registered memory region.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_dereg_mr(\r
+ IN const ib_mr_handle_t h_mr );\r
+/*\r
+* PARAMETERS\r
+* h_mr\r
+* [in] A handle to a registered memory region that will be unregistered.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The memory region was successfully deregistered.\r
+*\r
+* IB_INVALID_MR_HANDLE\r
+* The memory region handle was invalid.\r
+*\r
+* IB_RESOURCE_BUSY\r
+* The memory region has memory windows bound to it.\r
+*\r
+* NOTES\r
+* This routine deregisters a memory region with a channel adapter. The\r
+* region may be deregistered only if there are no memory windows or\r
+* existing shared memory regions currently bound to the region. Work\r
+* requests referencing this region when it is deregistered will fail\r
+* with a WRS_LOCAL_PROTECTION_ERR error.\r
+*\r
+* SEE ALSO\r
+* ib_reg_mem, ib_reg_phys, ib_reg_shared\r
+*****/\r
+\r
+\r
+#ifdef CL_KERNEL\r
+\r
+/****f* Access Layer/mlnx_create_fmr\r
+* NAME\r
+* mlnx_create_fmr\r
+*\r
+* DESCRIPTION\r
+* Creates a Mellanox fast memory region.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+mlnx_create_fmr(\r
+ IN const ib_pd_handle_t h_pd,\r
+ IN const mlnx_fmr_create_t* const p_fmr_create,\r
+ OUT mlnx_fmr_handle_t* const ph_fmr );\r
+/*\r
+* PARAMETERS\r
+* h_pd\r
+* [in] An optionally provided parameter used to modify the protection\r
+* domain of a registered region.\r
+* p_fmr_create\r
+* [in] This references information needed to perform the modification on\r
+* the registered memory region. This parameter may be NULL if only the\r
+* protection domain will be modified.\r
+* ph_fmr\r
+* [out] A handle to the registered memory region being modified.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The memory region attributes were modified successfully.\r
+*\r
+* IB_INVALID_MR_HANDLE\r
+* The memory region handle was invalid.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the lkey or rkey was not provided or the specified\r
+* modify mask is invalid.\r
+*\r
+* IB_INVALID_SETTING\r
+* The specified memory region attributes are invalid.\r
+*\r
+* IB_INVALID_PD_HANDLE\r
+* The protection domain handle was invalid.\r
+*\r
+* IB_INSUFFICIENT_RESOURCES\r
+* There were insufficient resources currently available on the channel\r
+* adapter to modify the memory region.\r
+*\r
+* IB_UNSUPPORTED\r
+* The requested access rights are not supported by the channel adapter.\r
+*\r
+* IB_INVALID_PERMISSION\r
+* The requested access rights are invalid.\r
+*\r
+* IB_RESOURCE_BUSY\r
+* The memory region has windows bound to it.\r
+*\r
+* NOTES\r
+* This is a Mellanox specific extension to verbs.\r
+*\r
+* SEE ALSO\r
+* mlnx_destroy_fmr, mlnx_fmr_create_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/mlnx_map_fmr\r
+* NAME\r
+* mlnx_map_fmr\r
+*\r
+* DESCRIPTION\r
+* //TODO\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+mlnx_map_phys_fmr(\r
+ IN const mlnx_fmr_handle_t h_fmr,\r
+ IN const uint64_t* const paddr_list,\r
+ IN const int list_len,\r
+ IN OUT uint64_t* const p_vaddr,\r
+ OUT net32_t* const p_lkey,\r
+ OUT net32_t* const p_rkey );\r
+/*\r
+* PARAMETERS\r
+* h_fmr\r
+* [in] Handle to the fast memory region that these pages map to \r
+* page_list\r
+* [in] array of phys address\r
+* list_len\r
+* [in] number of pages in the list\r
+* p_vaddr\r
+* [in/out] On input, references the requested virtual address for the\r
+* start of the FMR. On output, references the actual\r
+* virtual address assigned to the FMR.\r
+* p_lkey\r
+* [out] The local access key associated with this registered memory\r
+* region.\r
+* p_rkey\r
+* [out] A key that may be used by a remote end-point when performing\r
+* RDMA or atomic operations to this registered memory region.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The memory region attributes were modified successfully.\r
+*\r
+* IB_INVALID_MR_HANDLE\r
+* The memory region handle was invalid.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the lkey or rkey was not provided or the specified\r
+* modify mask is invalid.\r
+*\r
+* IB_INVALID_SETTING\r
+* The specified memory region attributes are invalid.\r
+*\r
+* IB_INVALID_PD_HANDLE\r
+* The protection domain handle was invalid.\r
+*\r
+* IB_INSUFFICIENT_RESOURCES\r
+* There were insufficient resources currently available on the channel\r
+* adapter to modify the memory region.\r
+*\r
+* IB_UNSUPPORTED\r
+* The requested access rights are not supported by the channel adapter.\r
+*\r
+* IB_INVALID_PERMISSION\r
+* The requested access rights are invalid.\r
+*\r
+* IB_RESOURCE_BUSY\r
+* The memory region has windows bound to it.\r
+*\r
+* NOTES\r
+* This is a Mellanox specific extension to verbs.\r
+*\r
+* SEE ALSO\r
+* mlnx_destroy_fmr, mlnx_fmr_create_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/mlnx_unmap_fmr\r
+* NAME\r
+* mlnx_unmap_fmr\r
+*\r
+* DESCRIPTION\r
+* //TODO\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+mlnx_unmap_fmr(\r
+ IN const mlnx_fmr_handle_t h_fmr );\r
+/*\r
+* PARAMETERS\r
+* h_fmr\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The memory region attributes were modified successfully.\r
+*\r
+* IB_INVALID_MR_HANDLE\r
+* The memory region handle was invalid.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the lkey or rkey was not provided or the specified\r
+* modify mask is invalid.\r
+*\r
+* IB_INVALID_SETTING\r
+* The specified memory region attributes are invalid.\r
+*\r
+* IB_INVALID_PD_HANDLE\r
+* The protection domain handle was invalid.\r
+*\r
+* IB_INSUFFICIENT_RESOURCES\r
+* There were insufficient resources currently available on the channel\r
+* adapter to modify the memory region.\r
+*\r
+* IB_UNSUPPORTED\r
+* The requested access rights are not supported by the channel adapter.\r
+*\r
+* IB_INVALID_PERMISSION\r
+* The requested access rights are invalid.\r
+*\r
+* IB_RESOURCE_BUSY\r
+* The memory region has windows bound to it.\r
+*\r
+* NOTES\r
+* This is a Mellanox specific extension to verbs.\r
+*\r
+* SEE ALSO\r
+* mlnx_destroy_fmr, mlnx_fmr_create_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/mlnx_destroy_fmr\r
+* NAME\r
+* mlnx_destroy_fmr\r
+*\r
+* DESCRIPTION\r
+* Destroys an existing Mellanox fast memory region.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+mlnx_destroy_fmr(\r
+ IN const mlnx_fmr_handle_t h_fmr );\r
+/*\r
+* PARAMETERS\r
+* h_fmr\r
+* [in] A handle to the registered memory region being modified.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The memory region attributes were modified successfully.\r
+*\r
+* IB_INVALID_MR_HANDLE\r
+* The memory region handle was invalid.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the lkey or rkey was not provided or the specified\r
+* modify mask is invalid.\r
+*\r
+* IB_INVALID_SETTING\r
+* The specified memory region attributes are invalid.\r
+*\r
+* IB_INVALID_PD_HANDLE\r
+* The protection domain handle was invalid.\r
+*\r
+* IB_INSUFFICIENT_RESOURCES\r
+* There were insufficient resources currently available on the channel\r
+* adapter to modify the memory region.\r
+*\r
+* IB_UNSUPPORTED\r
+* The requested access rights are not supported by the channel adapter.\r
+*\r
+* IB_INVALID_PERMISSION\r
+* The requested access rights are invalid.\r
+*\r
+* IB_RESOURCE_BUSY\r
+* The memory region has windows bound to it.\r
+*\r
+* NOTES\r
+* This is a Mellanox specific extension to verbs.\r
+*\r
+* SEE ALSO\r
+* mlnx_destroy_fmr, mlnx_fmr_create_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_create_fmr_pool\r
+* NAME\r
+* ib_create_fmr_pool\r
+*\r
+* DESCRIPTION\r
+* Creates a pool of FMR elements for use \r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+mlnx_create_fmr_pool(\r
+ IN const ib_pd_handle_t h_pd,\r
+ IN const mlnx_fmr_pool_create_t *p_fmr_pool_attr,\r
+ OUT mlnx_fmr_pool_handle_t* const ph_pool );\r
+/*\r
+* PARAMETERS\r
+TODO\r
+*\r
+* RETURN VALUES\r
+TODO\r
+*\r
+* NOTES\r
+TODO\r
+*\r
+* SEE ALSO\r
+TOD\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_destroy_fmr_pool\r
+* NAME\r
+* ib_destroy_fmr_pool\r
+*\r
+* DESCRIPTION\r
+* Destroys a MAD pool and all associated resources.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+mlnx_destroy_fmr_pool(\r
+ IN const mlnx_fmr_pool_handle_t h_pool );\r
+/*\r
+* PARAMETERS\r
+TODO\r
+*\r
+* RETURN VALUES\r
+TODO\r
+*\r
+* NOTES\r
+TODO\r
+*\r
+* SEE ALSO\r
+TODO\r
+*****/\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+/****f* Access Layer/ib_fmr_pool_map_phys\r
+* NAME\r
+* ib_destroy_fmr_pool\r
+*\r
+* DESCRIPTION\r
+* Destroys a MAD pool and all associated resources.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+mlnx_map_phys_fmr_pool(\r
+ IN const mlnx_fmr_pool_handle_t h_pool ,\r
+ IN const uint64_t* const paddr_list,\r
+ IN const int list_len,\r
+ IN OUT uint64_t* const p_vaddr,\r
+ OUT net32_t* const p_lkey,\r
+ OUT net32_t* const p_rkey,\r
+ OUT mlnx_fmr_pool_el_t *pp_fmr_el);\r
+/*\r
+* PARAMETERS\r
+TODO\r
+*\r
+* RETURN VALUES\r
+TODO\r
+*\r
+* NOTES\r
+TODO\r
+*\r
+* SEE ALSO\r
+TODO\r
+*****/\r
+\r
+\r
+\r
+\r
+\r
+/****f* Access Layer/ib_destroy_fmr_pool\r
+* NAME\r
+* ib_destroy_fmr_pool\r
+*\r
+* DESCRIPTION\r
+* Destroys a MAD pool and all associated resources.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+mlnx_unmap_fmr_pool(\r
+ IN mlnx_fmr_pool_el_t p_fmr_el );\r
+/*\r
+* PARAMETERS\r
+TODO\r
+*\r
+* RETURN VALUES\r
+TODO\r
+*\r
+* NOTES\r
+TODO\r
+*\r
+* SEE ALSO\r
+TODO\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_flush_fmr_pool\r
+* NAME\r
+* ib_flush_fmr_pool\r
+*\r
+* DESCRIPTION\r
+* Destroys a MAD pool and all associated resources.\r
+*\r
+* SYNOPSIS\r
+*/\r
+ib_api_status_t\r
+mlnx_flush_fmr_pool(mlnx_fmr_pool_handle_t h_pool);\r
+/*\r
+* PARAMETERS\r
+TODO\r
+*\r
+* RETURN VALUES\r
+TODO\r
+*\r
+* NOTES\r
+TODO\r
+*\r
+* SEE ALSO\r
+TODO\r
+*****/\r
+#endif /* CL_KERNEL */\r
+\r
+/****f* Access Layer/ib_create_mw\r
+* NAME\r
+* ib_create_mw\r
+*\r
+* DESCRIPTION\r
+* Creates a memory window associated with the specified protection domain.\r
+* Newly created windows are not bound to any specific memory region.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_create_mw(\r
+ IN const ib_pd_handle_t h_pd,\r
+ OUT net32_t* const p_rkey,\r
+ OUT ib_mw_handle_t* const ph_mw );\r
+/*\r
+* PARAMETERS\r
+* h_pd\r
+* [in] A handle to an existing protection domain that the memory window\r
+* should be created within.\r
+*\r
+* p_rkey\r
+* [out] The current rkey associated with the memory window. This key is\r
+* used to bind the window to a registered memory region.\r
+*\r
+* ph_mw\r
+* [out] Upon successful completion of this call, this references a handle\r
+* to the memory window. This handle is used to bind and destroy\r
+* the window.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The memory window was successfully created.\r
+*\r
+* IB_INVALID_PD_HANDLE\r
+* The protection domain handle was invalid.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the memory window rkey or handle was not provided.\r
+*\r
+* IB_INSUFFICIENT_MEMORY\r
+* There was insufficient memory to create the memory window.\r
+*\r
+* IB_INSUFFICIENT_RESOURCES\r
+* There were insufficient resources currently available on the channel\r
+* adapter to create the memory window.\r
+*\r
+* NOTES\r
+* This routine creates an unbound memory window associated with a specified\r
+* protection domain. The memory window cannot be used for data transfer\r
+* operations until being bound to a registered memory region.\r
+*\r
+* SEE ALSO\r
+* ib_destroy_mw, ib_query_mw, ib_bind_mw\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_query_mw\r
+* NAME\r
+* ib_query_mw\r
+*\r
+* DESCRIPTION\r
+* Query the current attributes of a memory window.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_query_mw(\r
+ IN const ib_mw_handle_t h_mw,\r
+ OUT ib_pd_handle_t* const ph_pd,\r
+ OUT net32_t* const p_rkey );\r
+/*\r
+* PARAMETERS\r
+* h_mw\r
+* [in] A handle to an existing memory window.\r
+*\r
+* ph_pd\r
+* [out] Upon successful completion of this call, this will reference\r
+* the protection domain associated with this memory window.\r
+*\r
+* p_rkey\r
+* [out] Upon successful completion of this call, this will reference\r
+* the current rkey associated with this memory window.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The memory window attributes were returned successfully.\r
+*\r
+* IB_INVALID_MW_HANDLE\r
+* The memory window handle was invalid.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the protection domain handle or rkey was not provided.\r
+*\r
+* NOTES\r
+* This routine returns information about the specified memory window.\r
+*\r
+* SEE ALSO\r
+* ib_create_mw\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_bind_mw\r
+* NAME\r
+* ib_bind_mw\r
+*\r
+* DESCRIPTION\r
+* Binds a memory window to a registered memory region.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_bind_mw(\r
+ IN const ib_mw_handle_t h_mw,\r
+ IN const ib_qp_handle_t h_qp,\r
+ IN ib_bind_wr_t* const p_mw_bind,\r
+ OUT net32_t* const p_rkey );\r
+/*\r
+* PARAMETERS\r
+* h_mw\r
+* [in] A handle to an existing memory window.\r
+*\r
+* h_qp\r
+* [in] A handle to a queue pair that the bind request will be posted to.\r
+*\r
+* p_mw_bind\r
+* [in] Describes the memory window bind request.\r
+*\r
+* p_rkey\r
+* [out] The new rkey for the memory window that may be used by a remote\r
+* end-point when performing RDMA or atomic operations to this memory\r
+* region.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The memory window bind operation was successfully posted.\r
+*\r
+* IB_INVALID_MW_HANDLE\r
+* The memory window handle was invalid.\r
+*\r
+* IB_INVALID_QP_HANDLE\r
+* The queue pair handle was invalid.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the memory window bind work request or rkey was not\r
+* provided.\r
+*\r
+* IB_INVALID_SERVICE_TYPE\r
+* The queue pair configuration does not support this type of service.\r
+*\r
+* IB_INVALID_MR_HANDLE\r
+* The memory region handle was invalid.\r
+*\r
+* IB_INVALID_RKEY\r
+* The rkey is invalid for the memory region being bound.\r
+*\r
+* IB_UNSUPPORTED\r
+* The requested access rights are not supported by the channel adapter.\r
+*\r
+* IB_INVALID_PERMISSION\r
+* The requested access rights are invalid.\r
+*\r
+* IB_INSUFFICIENT_RESOURCES\r
+* There were insufficient resources currently available on the channel\r
+* adapter to bind the memory window.\r
+*\r
+* NOTES\r
+* This routine posts a request to bind a memory window to a registered\r
+* memory region. The bind operation occurs on the specified queue pair,\r
+* but the bound region is usable across all queue pairs within the same\r
+* protection domain.\r
+*\r
+* SEE ALSO\r
+* ib_create_mw, ib_bind_wr_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_destroy_mw\r
+* NAME\r
+* ib_destroy_mw\r
+*\r
+* DESCRIPTION\r
+* Destroys a memory window.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_destroy_mw(\r
+ IN const ib_mw_handle_t h_mw );\r
+/*\r
+* PARAMETERS\r
+* h_mw\r
+* [in] A handle to an existing memory window.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The memory window was successfully destroyed.\r
+*\r
+* IB_INVALID_MW_HANDLE\r
+* The memory window handle was invalid.\r
+*\r
+* NOTES\r
+* This routine deallocates a window entry created via a ib_create_mw.\r
+* Once this operation is complete, future accesses to the window will fail.\r
+*\r
+* SEE ALSO\r
+* ib_create_mw\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_post_send\r
+* NAME\r
+* ib_post_send\r
+*\r
+* DESCRIPTION\r
+* This routine posts a work request to the send queue of a queue pair.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_post_send(\r
+ IN const ib_qp_handle_t h_qp,\r
+ IN ib_send_wr_t* const p_send_wr,\r
+ OUT ib_send_wr_t **pp_send_failure OPTIONAL );\r
+/*\r
+* PARAMETERS\r
+* h_qp\r
+* [in] The queue pair to which this work request is being submitted.\r
+*\r
+* p_send_wr\r
+* [in] A reference to the head of the work request list.\r
+*\r
+* pp_send_failure\r
+* [out] If the post send operation failed, this references the work\r
+* request in the p_send_wr list where the first failure occurred.\r
+* This parameter may be NULL if only a single work request is being\r
+* posted to the QP.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* All work requests were successfully posted.\r
+*\r
+* IB_INVALID_QP_HANDLE\r
+* The queue pair handle was invalid.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the send work request list was not provided.\r
+*\r
+* IB_INSUFFICIENT_RESOURCES\r
+* The number of posted work requests exceed the current depth available\r
+* on the send queue.\r
+*\r
+* IB_INVALID_WR_TYPE\r
+* The work request type was invalid.\r
+*\r
+* IB_INVALID_QP_STATE\r
+* The current queue pair state does not allow posting sends.\r
+*\r
+* IB_INVALID_MAX_SGE\r
+* The number of work request scatter gather elements exceed the queue\r
+* pair configuration.\r
+*\r
+* IB_UNSUPPORTED\r
+* The requested operation is not supported by the channel adapter.\r
+*\r
+* NOTES\r
+* This routine posts a work request to the send queue of a queue pair.\r
+* The type of work to perform is defined by the p_send_wr parameter.\r
+*\r
+* SEE ALSO\r
+* ib_send_wr_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_post_recv\r
+* NAME\r
+* ib_post_recv\r
+*\r
+* DESCRIPTION\r
+* This routine posts a work request to the receive queue of a queue pair.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_post_recv(\r
+ IN const ib_qp_handle_t h_qp,\r
+ IN ib_recv_wr_t* const p_recv_wr,\r
+ OUT ib_recv_wr_t **pp_recv_failure OPTIONAL );\r
+/*\r
+* PARAMETERS\r
+* h_qp\r
+* [in] The queue pair to which this work request is being submitted.\r
+*\r
+* p_recv_wr\r
+* [in] A reference to the head of the work request list.\r
+*\r
+* pp_recv_failure\r
+* [out] If the post receive operation failed, this references the work\r
+* request in the p_recv_wr list where the first failure occurred.\r
+* This parameter may be NULL if only a single work request is being\r
+* posted to the QP.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* All work requests were successfully posted.\r
+*\r
+* IB_INVALID_QP_HANDLE\r
+* The queue pair handle was invalid.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the receive work request list was not provided.\r
+*\r
+* IB_INSUFFICIENT_RESOURCES\r
+* The number of posted work requests exceed the current depth available\r
+* on the receive queue.\r
+*\r
+* IB_INVALID_WR_TYPE\r
+* The work request type was invalid.\r
+*\r
+* IB_INVALID_QP_STATE\r
+* The current queue pair state does not allow posting receives.\r
+*\r
+* NOTES\r
+* This routine posts a work request to the receive queue of a queue pair.\r
+* The type of work to perform is defined by the p_recv_wr parameter. This\r
+* call is used to post data buffers to receive incoming message sends.\r
+*\r
+* SEE ALSO\r
+* ib_recv_wr_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_send_mad\r
+* NAME\r
+* ib_send_mad\r
+*\r
+* DESCRIPTION\r
+* This routine posts a work request to the send queue of a queue pair.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_send_mad(\r
+ IN const ib_mad_svc_handle_t h_mad_svc,\r
+ IN ib_mad_element_t* const p_mad_element_list,\r
+ OUT ib_mad_element_t **pp_mad_failure OPTIONAL );\r
+/*\r
+* PARAMETERS\r
+* h_mad_svc\r
+* [in] The MAD service to which this work request is being submitted.\r
+*\r
+* p_mad_element_list\r
+* [in] A list of MAD elements that will be posted to the send queue.\r
+*\r
+* pp_mad_failure\r
+* [out] If the send MAD operation failed, this references the MAD\r
+* element in the p_mad_element_list where the first failure occurred.\r
+* This parameter is optional if p_mad_element_list contains a single\r
+* MAD.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The MAD element list was successfully posted.\r
+*\r
+* IB_INVALID_HANDLE\r
+* The MAD service handle was invalid.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the MAD element list was not provided.\r
+*\r
+* IB_INSUFFICIENT_RESOURCES\r
+* There were insufficient resources currently available to complete\r
+* the request.\r
+*\r
+* IB_INVALID_SETTING\r
+* The MAD element RMPP version is not supported by the access layer.\r
+*\r
+* IB_INSUFFICIENT_MEMORY\r
+* There was insufficient memory to complete the request.\r
+*\r
+* NOTES\r
+* This routine posts a work request to send a MAD on a MAD service. All\r
+* MAD elements successfully posted by this call are under the control of\r
+* the access layer and should not be accessed until the send operation\r
+* completes.\r
+*\r
+* In order to guarantee that MADs sent by separate clients do not use the\r
+* same transaction ID, the access layer reserves the upper 32-bits of the\r
+* TID on all unsolicited MADs. MADs sent with the response bit set will\r
+* not have their transaction ID's modified. Unsolicited MADs will have the\r
+* upper 32-bits of their TID set to an access layer generated client ID.\r
+*\r
+* SEE ALSO\r
+* ib_mad_element_t, ib_cancel_mad\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_cancel_mad\r
+* NAME\r
+* ib_cancel_mad\r
+*\r
+* DESCRIPTION\r
+* This routine cancels a pending send transaction to a MAD service.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_cancel_mad(\r
+ IN const ib_mad_svc_handle_t h_mad_svc,\r
+ IN ib_mad_element_t* const p_mad_element );\r
+/*\r
+* PARAMETERS\r
+* h_mad_svc\r
+* [in] The MAD service to which the send operation was directed.\r
+*\r
+* p_mad_element\r
+* [in] A handle to a sent MAD element.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The requested MAD transaction was located and canceled.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the MAD element list was not provided.\r
+*\r
+* IB_NOT_FOUND\r
+* The requested transaction was not located or had already completed.\r
+*\r
+* NOTES\r
+* This routine cancels a pending send transaction to a MAD service. If\r
+* the request is successfully located and has not yet completed, it will\r
+* be completed with its status set to IB_CANCELED. The canceled operation\r
+* will be returned to the user through the normal MAD completion callback.\r
+* If the send transaction has already completed, this call will return\r
+* IB_NOT_FOUND.\r
+*\r
+* SEE ALSO\r
+* ib_send_mad\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_peek_cq\r
+* NAME\r
+* ib_peek_cq\r
+*\r
+* DESCRIPTION\r
+* Returns the number of entries currently on the completion queue.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_peek_cq(\r
+ IN const ib_cq_handle_t h_cq,\r
+ OUT uint32_t* const p_n_cqes );\r
+/*\r
+* PARAMETERS\r
+* h_cq\r
+* [in] Handle to the completion queue to peek.\r
+*\r
+* p_n_cqes\r
+* [out] Upon successful completion of this call, contains the number\r
+* of completion queue entries currently on the completion queue.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The peek operation completed successfully.\r
+*\r
+* IB_INVALID_CQ_HANDLE\r
+* The completion queue handle was invalid.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the completion queue entry count was not provided.\r
+*\r
+* IB_UNSUPPORTED\r
+* This operation is not supported by the channel adapter.\r
+*\r
+* NOTES\r
+* The value returned is a snapshot of the number of compleiton queue\r
+* entries curently on the completion queue. Support for this operation\r
+* is optional by a channel adapter vendor.\r
+*\r
+* SEE ALSO\r
+* ib_create_cq, ib_poll_cq, ib_rearm_cq, ib_rearm_n_cq\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_poll_cq\r
+* NAME\r
+* ib_poll_cq\r
+*\r
+* DESCRIPTION\r
+* Checks a completion queue for completed work requests.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_poll_cq(\r
+ IN const ib_cq_handle_t h_cq,\r
+ IN OUT ib_wc_t** const pp_free_wclist,\r
+ OUT ib_wc_t** const pp_done_wclist );\r
+/*\r
+* PARAMETERS\r
+* h_cq\r
+* [in] A handle to a completion queue to check for completions on.\r
+*\r
+* pp_free_wclist\r
+* [in/out] On input, a list of work completion structures provided by\r
+* the client. These are used to report completed work requests through\r
+* the pp_done_wclist.\r
+*\r
+* On output, this contains the list of work completions structures for\r
+* which no work completion was found.\r
+*\r
+* pp_done_wclist\r
+* [out] A list of work completions retrieved from the completion queue.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The poll operation completed successfully. If the work completion\r
+* structures referenced by the pp_free_wclist list is empty there are\r
+* potentially more completions available to retrieve.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the free or done work completion list was not provided.\r
+*\r
+* IB_INVALID_CQ_HANDLE\r
+* The completion queue handle was invalid.\r
+*\r
+* IB_NOT_FOUND\r
+* No completed work requests were removed from the completion queue.\r
+*\r
+* NOTES\r
+* This routine retrieves completed work requests from the specified\r
+* completion queue. This call will retrieve all completed requests,\r
+* up to to the number of work completion structures referenced by the\r
+* pp_free_wclist. Completed requests will be returned through the\r
+* pp_done_wclist parameter.\r
+*\r
+* SEE ALSO\r
+* ib_create_cq, ib_post_send, ib_post_recv, ib_bind_mw, ib_wc_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_rearm_cq\r
+* NAME\r
+* ib_rearm_cq\r
+*\r
+* DESCRIPTION\r
+* This indicates that the completion queue should notify the client when\r
+* the next completion is added.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_rearm_cq(\r
+ IN const ib_cq_handle_t h_cq,\r
+ IN const boolean_t solicited );\r
+/*\r
+* PARAMETERS\r
+* h_cq\r
+* [in] Handle to the completion queue to rearm.\r
+*\r
+* solicited\r
+* [in] A flag indicating whether the request is to generate a\r
+* notification on the next entry, if set to FALSE, or on the next\r
+* solicited entry being added to the completion queue, if set to TRUE.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The completion queue rearm request was registered successfully.\r
+*\r
+* IB_INVALID_CQ_HANDLE\r
+* The completion queue handle was invalid.\r
+*\r
+* NOTES\r
+* This routine instructs the channel interface to invoke the completion\r
+* handler when the next completion queue entry is added to this CQ.\r
+*\r
+* SEE ALSO\r
+* ib_create_cq, ib_peek_cq, ib_poll_cq, ib_rearm_n_cq\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_rearm_n_cq\r
+* NAME\r
+* ib_rearm_n_cq\r
+*\r
+* DESCRIPTION\r
+* This indicates that the completion queue should notify the client when\r
+* the next N completions have been added to this CQ.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_rearm_n_cq(\r
+ IN const ib_cq_handle_t h_cq,\r
+ IN const uint32_t n_cqes );\r
+/*\r
+* PARAMETERS\r
+* h_cq\r
+* [in] Handle to the completion queue to rearm.\r
+*\r
+* n_cqes\r
+* [in] The number of completion queue entries to be added to the\r
+* completion queue before notifying the client. This value must\r
+* greater than or equal to one and less than or equal to the size\r
+* of the completion queue.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The completion queue rearm request was registered successfully.\r
+*\r
+* IB_INVALID_CQ_HANDLE\r
+* The completion queue handle was invalid.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* The requested number of completion queue entries was invalid.\r
+*\r
+* IB_UNSUPPORTED\r
+* This operation is not supported by the channel adapter.\r
+*\r
+* NOTES\r
+* This routine instructs the channel interface to invoke the completion\r
+* handler when the next N completions have been added to this CQ regardless\r
+* of the completion type (solicited or unsolicited). Any CQ entries that\r
+* existed before the rearm is enabled will not result in a call to the\r
+* handler. Support for this operation is optional by a channel adapter\r
+* vendor.\r
+*\r
+* SEE ALSO\r
+* ib_create_cq, ib_peek_cq, ib_poll_cq, ib_rearm_cq\r
+*****/\r
+\r
+\r
+/****s* Access Layer/ib_mcast_rec_t\r
+* NAME\r
+* ib_mcast_rec_t\r
+*\r
+* DESCRIPTION\r
+* Information returned as a result of joining a multicast group.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_mcast_rec\r
+{\r
+ const void* __ptr64 mcast_context;\r
+ ib_api_status_t status;\r
+ ib_net16_t error_status;\r
+\r
+ ib_mcast_handle_t h_mcast;\r
+ ib_member_rec_t* __ptr64 p_member_rec;\r
+\r
+} ib_mcast_rec_t;\r
+/*\r
+* FIELDS\r
+* mcast_context\r
+* User-defined context information associated with the multicast join\r
+* request.\r
+*\r
+* status\r
+* Indicates the success of the multicast group join operation.\r
+*\r
+* error_status\r
+* Provide additional error information that was provided by the SA.\r
+* This field is only valid if status is set to IB_REMOTE_ERROR.\r
+*\r
+* h_mcast\r
+* Upon successful completion of a multicast join, this references a\r
+* handle to the multicast group. This handle is used to leave the\r
+* multicast group.\r
+*\r
+* p_member_rec\r
+* References a member record that provides information about the\r
+* multicast group.\r
+*\r
+* NOTES\r
+* This structure is returned to a client through a callback to notify them\r
+* of the result of a multicast join operation.\r
+*\r
+* SEE ALSO\r
+* ib_join_mcast, ib_pfn_mcast_cb_t, ib_leave_mcast\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_pfn_mcast_cb_t\r
+* NAME\r
+* ib_pfn_mcast_cb_t\r
+*\r
+* DESCRIPTION\r
+* User-defined callback invoked on completion of a multicast join request.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef void\r
+(AL_API * __ptr64 ib_pfn_mcast_cb_t)(\r
+ IN ib_mcast_rec_t *p_mcast_rec );\r
+/*\r
+* PARAMETERS\r
+* p_mcast_rec\r
+* [in] References the result of the join operation.\r
+*\r
+* NOTES\r
+* The callback is used to notify a client of the result of a multicast\r
+* join request.\r
+*\r
+* This callback is invoked within a system thread context in the kernel.\r
+*\r
+* SEE ALSO\r
+* ib_join_mcast, ib_mcast_rec_t\r
+*****/\r
+\r
+\r
+/****s* Access Layer/ib_mcast_req_t\r
+* NAME\r
+* ib_mcast_req_t\r
+*\r
+* DESCRIPTION\r
+* Information used to join a multicast group.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_mcast_req\r
+{\r
+ boolean_t create;\r
+ ib_member_rec_t member_rec;\r
+\r
+ const void* __ptr64 mcast_context;\r
+ ib_pfn_mcast_cb_t pfn_mcast_cb;\r
+\r
+ uint32_t timeout_ms;\r
+ uint32_t retry_cnt;\r
+ ib_al_flags_t flags;\r
+\r
+ ib_net64_t port_guid;\r
+ uint16_t pkey_index;\r
+\r
+} ib_mcast_req_t;\r
+/*\r
+* FIELDS\r
+* create\r
+* Indicates that the multicast group should be created if it does not\r
+* already exist.\r
+*\r
+* member_rec\r
+* Specifies the membership information of the multicast group to join\r
+* or create. The mgid and join state (scope_state) fields of the\r
+* member record must be set. In addition, if create is set to TRUE,\r
+* the following fields must also be set: qkey, tclass, service level\r
+* and flow label (sl_flow_hop), and pkey. All other fields are ignored\r
+* by the access layer.\r
+*\r
+* mcast_context\r
+* User-defined context information associated with the join request.\r
+* This context is returned to the user through the function specified\r
+* by the pfn_mcast_cb field.\r
+*\r
+* pfn_mcast_cb\r
+* A user-defined callback that is invoked upon completion of the\r
+* join request.\r
+*\r
+* timeout_ms\r
+* Specifies the number of milliseconds to wait for a response for\r
+* the join request until retrying or timing out the request.\r
+*\r
+* retry_cnt\r
+* Specifies the number of times that the join request will be retried\r
+* before failing the request.\r
+*\r
+* flags\r
+* Used to describe the mode of operation. Set to IB_FLAGS_SYNC to\r
+* process the called routine synchronously.\r
+*\r
+* port_guid\r
+* Indicates the port that will join the multicast group. The QP\r
+* specified as part of the ib_join_mast call will bind to this port.\r
+*\r
+* pkey_index\r
+* Specifies the pkey associated with this queue pair.\r
+*\r
+* NOTES\r
+* This structure is used when joining an existing multicast group or\r
+* creating a new multicast group.\r
+*\r
+* SEE ALSO\r
+* ib_join_mcast, ib_pfn_mcast_cb_t, ib_gid_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_join_mcast\r
+* NAME\r
+* ib_join_mcast\r
+*\r
+* DESCRIPTION\r
+* Attaches a queue pair to a multicast group.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_join_mcast(\r
+ IN const ib_qp_handle_t h_qp,\r
+ IN const ib_mcast_req_t* const p_mcast_req );\r
+/*\r
+* PARAMETERS\r
+* h_qp\r
+* [in] A handle to an unreliable datagram queue pair that will join the\r
+* multicast group.\r
+*\r
+* p_mcast_req\r
+* [in] Specifies the multicast group to join.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The join multicast group request has been initiated.\r
+*\r
+* IB_INVALID_QP_HANDLE\r
+* The queue pair handle was invalid.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the multicast group request information was not\r
+* provided.\r
+*\r
+* IB_INVALID_SERVICE_TYPE\r
+* The queue pair configuration does not support this type of service.\r
+*\r
+* IB_INSUFFICIENT_MEMORY\r
+* There was insufficient memory to join the multicast group.\r
+*\r
+* IB_INVALID_GUID\r
+* No port was found for the port_guid specified in the request.\r
+*\r
+* IB_INSUFFICIENT_RESOURCES\r
+* There were insufficient resources currently available on the channel\r
+* adapter to perform the operation.\r
+*\r
+* IB_INVALID_PKEY\r
+* The pkey specified in the multicast join request does not match the\r
+* pkey of the queue pair.\r
+*\r
+* IB_INVALID_PORT\r
+* The port GUID specified in the multicast join request does not match\r
+* the port of the queue pair.\r
+*\r
+* IB_ERROR\r
+* An error occurred while performing the multicast group join operation.\r
+*\r
+* IB_INSUFFICIENT_RESOURCES\r
+* There were insufficient resources currently available to complete\r
+* the request.\r
+*\r
+* IB_INSUFFICIENT_MEMORY\r
+* There was insufficient memory to complete the request.\r
+*\r
+* NOTES\r
+* This routine results in the specified queue pair joining a multicast\r
+* group. If the multicast group does not already exist, it will be created\r
+* at the user's option. Information about the multicast group is returned\r
+* to the user through a callback specified through the p_mcast_req\r
+* parameter.\r
+*\r
+* If the specified queue pair is already a member of a multicast group when\r
+* this call is invoked, an error will occur if there are conflicting\r
+* membership requirements. The QP is restricted to being bound to a single\r
+* port_guid and using a single pkey.\r
+*\r
+* SEE ALSO\r
+* ib_leave_mcast, ib_mcast_req_t, ib_create_qp, ib_init_dgrm_svc\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_leave_mcast\r
+* NAME\r
+* ib_leave_mcast\r
+*\r
+* DESCRIPTION\r
+* Removes a queue pair from a multicast group.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_leave_mcast(\r
+ IN const ib_mcast_handle_t h_mcast,\r
+ IN const ib_pfn_destroy_cb_t pfn_destroy_cb OPTIONAL );\r
+/*\r
+* PARAMETERS\r
+* h_mcast\r
+* [in] A handle to a joined multicast group.\r
+*\r
+* pfn_destroy_cb\r
+* [in] An optional user-specified callback that is invoked after the\r
+* leave request has completed.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The leave multicast group request has been initiated.\r
+*\r
+* IB_INVALID_MCAST_HANDLE\r
+* The multicast group handle was invalid.\r
+*\r
+* IB_ERROR\r
+* An error occurred while performing the multicast group leave operation.\r
+*\r
+* IB_INSUFFICIENT_RESOURCES\r
+* There were insufficient resources currently available on the channel\r
+* adapter to perform the operation.\r
+*\r
+* NOTES\r
+* This routine detaches a queue pair from a multicast group and removes\r
+* it as a member of the group with the subnet administrator.\r
+*\r
+* SEE ALSO\r
+* ib_join_mcast, ib_pfn_destroy_cb_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_local_mad\r
+* NAME\r
+* ib_local_mad\r
+*\r
+* DESCRIPTION\r
+* Request that a locally received MAD be processed by the channel adapter\r
+* on which it was received.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_local_mad(\r
+ IN const ib_ca_handle_t h_ca,\r
+ IN const uint8_t port_num,\r
+ IN const void* const p_mad_in,\r
+ OUT void* p_mad_out );\r
+/*\r
+* PARAMETERS\r
+* h_ca\r
+* [in] A handle to the channel adapter that should process the MAD.\r
+* This must be the same adapter that the MAD was received on.\r
+*\r
+* port_num\r
+* [in] The port number to which this request is directed.\r
+*\r
+* p_mad_in\r
+* [in] Pointer to a management datagram (MAD) structure containing\r
+* the command to be processed.\r
+*\r
+* p_mad_out\r
+* [out] References a MAD that should contain the response to the\r
+* received input MAD specified through the p_mad_in parameter.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The local MAD was processed successfully.\r
+*\r
+* IB_INVALID_CA_HANDLE\r
+* The channel adapter handle was invalid.\r
+*\r
+* IB_INVALID_PORT\r
+* The port number was invalid.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the MAD input or MAD output buffer was not provided.\r
+*\r
+* NOTES\r
+* This call is provided to support SMA and GSA implementations above the\r
+* verbs interface on ports that the access layer has disabled. This routine\r
+* is used to perform local operations by the channel adapter. On successful\r
+* return, the provide output MAD should be used when sending a response.\r
+*\r
+* SEE ALSO\r
+* ib_query_ca, ib_ca_attr_t\r
+*****/\r
+\r
+\r
+/****s* Access Layer/ib_req_pdata_t\r
+* NAME\r
+* ib_req_pdata_t\r
+*\r
+* DESCRIPTION\r
+* User data sent as part of a request for communication.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ib_req_pdata\r
+{\r
+ uint8_t data[IB_REQ_PDATA_SIZE];\r
+\r
+} ib_req_pdata_t;\r
+/*\r
+* SEE ALSO\r
+* ib_cm_data_sizes_t\r
+*****/\r
+\r
+\r
+/****s* Access Layer/ib_rep_pdata_t\r
+* NAME\r
+* ib_rep_pdata_t\r
+*\r
+* DESCRIPTION\r
+* User data sent as part of a reply to a request for communication.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ib_rep_pdata\r
+{\r
+ uint8_t data[IB_REP_PDATA_SIZE];\r
+\r
+} ib_rep_pdata_t;\r
+/*\r
+* SEE ALSO\r
+* ib_cm_data_sizes_t\r
+*****/\r
+\r
+\r
+/****s* Access Layer/ib_rtu_pdata_t\r
+* NAME\r
+* ib_rtu_pdata_t\r
+*\r
+* DESCRIPTION\r
+* User data sent as part of a ready to use message.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ib_rtu_pdata\r
+{\r
+ uint8_t data[IB_RTU_PDATA_SIZE];\r
+\r
+} ib_rtu_pdata_t;\r
+/*\r
+* SEE ALSO\r
+* ib_cm_data_sizes_t\r
+*****/\r
+\r
+\r
+/****s* Access Layer/ib_rej_pdata_t\r
+* NAME\r
+* ib_rej_pdata_t\r
+*\r
+* DESCRIPTION\r
+* User data sent as part of a connection reject message.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ib_rej_pdata\r
+{\r
+ uint8_t data[IB_REJ_PDATA_SIZE];\r
+\r
+} ib_rej_pdata_t;\r
+/*\r
+* SEE ALSO\r
+* ib_cm_data_sizes_t\r
+*****/\r
+\r
+\r
+/****s* Access Layer/ib_mra_pdata_t\r
+* NAME\r
+* ib_mra_pdata_t\r
+*\r
+* DESCRIPTION\r
+* User data sent as part of a message receipt acknowledgement.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ib_mra_pdata\r
+{\r
+ uint8_t data[IB_MRA_PDATA_SIZE];\r
+\r
+} ib_mra_pdata_t;\r
+/*\r
+* SEE ALSO\r
+* ib_cm_data_sizes_t\r
+*****/\r
+\r
+\r
+/****s* Access Layer/ib_lap_pdata_t\r
+* NAME\r
+* ib_lap_pdata_t\r
+*\r
+* DESCRIPTION\r
+* User data sent as part of a load alternate path message.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ib_lap_pdata\r
+{\r
+ uint8_t data[IB_LAP_PDATA_SIZE];\r
+\r
+} ib_lap_pdata_t;\r
+/*\r
+* SEE ALSO\r
+* ib_cm_data_sizes_t\r
+*****/\r
+\r
+\r
+/****s* Access Layer/ib_apr_pdata_t\r
+* NAME\r
+* ib_apr_pdata_t\r
+*\r
+* DESCRIPTION\r
+* User data sent as part of an alternate path response.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ib_apr_pdata\r
+{\r
+ uint8_t data[IB_APR_PDATA_SIZE];\r
+\r
+} ib_apr_pdata_t;\r
+/*\r
+* SEE ALSO\r
+* ib_cm_data_sizes_t\r
+*****/\r
+\r
+\r
+/****s* Access Layer/ib_dreq_pdata_t\r
+* NAME\r
+* ib_dreq_pdata_t\r
+*\r
+* DESCRIPTION\r
+* User data sent as part of a disconnection request.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ib_dreq_pdata\r
+{\r
+ uint8_t data[IB_DREQ_PDATA_SIZE];\r
+\r
+} ib_dreq_pdata_t;\r
+/*\r
+* SEE ALSO\r
+* ib_cm_data_sizes_t\r
+*****/\r
+\r
+\r
+/****s* Access Layer/ib_drep_pdata_t\r
+* NAME\r
+* ib_drep_pdata_t\r
+*\r
+* DESCRIPTION\r
+* User data sent as part of a reply to a disconnection request.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ib_drep_pdata\r
+{\r
+ uint8_t data[IB_DREP_PDATA_SIZE];\r
+\r
+} ib_drep_pdata_t;\r
+/*\r
+* SEE ALSO\r
+* ib_cm_data_sizes_t\r
+*****/\r
+\r
+\r
+/****s* Access Layer/ib_sidr_req_pdata_t\r
+* NAME\r
+* ib_sidr_req_pdata_t\r
+*\r
+* DESCRIPTION\r
+* User data sent as part of a service ID resolution request.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ib_sidr_req_pdata\r
+{\r
+ uint8_t data[IB_SIDR_REQ_PDATA_SIZE];\r
+\r
+} ib_sidr_req_pdata_t;\r
+/*\r
+* SEE ALSO\r
+* ib_cm_data_sizes_t\r
+*****/\r
+\r
+\r
+/****s* Access Layer/ib_sidr_rep_pdata_t\r
+* NAME\r
+* ib_sidr_rep_pdata_t\r
+*\r
+* DESCRIPTION\r
+* User data sent as part of a service ID resolution reply.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ib_sidr_rep_pdata\r
+{\r
+ uint8_t data[IB_SIDR_REP_PDATA_SIZE];\r
+\r
+} ib_sidr_rep_pdata_t;\r
+/*\r
+* SEE ALSO\r
+* ib_cm_data_sizes_t\r
+*****/\r
+\r
+\r
+/****s* Access Layer/ib_ari_t\r
+* NAME\r
+* ib_ari_t\r
+*\r
+* DESCRIPTION\r
+* Infiniband-defined additional rejection information.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_ari\r
+{\r
+ uint8_t data[IB_ARI_SIZE];\r
+\r
+} ib_ari_t;\r
+/*\r
+* SEE ALSO\r
+* ib_cm_data_sizes_t\r
+*****/\r
+\r
+\r
+/****s* Access Layer/ib_apr_info_t\r
+* NAME\r
+* ib_apr_info_t\r
+*\r
+* DESCRIPTION\r
+* Infiniband-defined additional rejection information.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_apr_info\r
+{\r
+ uint8_t data[IB_APR_INFO_SIZE];\r
+\r
+} ib_apr_info_t;\r
+/*\r
+* SEE ALSO\r
+* ib_cm_data_sizes_t\r
+*****/\r
+\r
+\r
+/****s* Access Layer/ib_cm_req_rec_t\r
+* NAME\r
+* ib_cm_req_rec_t\r
+*\r
+* DESCRIPTION\r
+* Connection request information returned to the user through their\r
+* connection request callback.\r
+*\r
+* SYNOPSIS\r
+*/\r
+#pragma warning(disable:4324)\r
+typedef struct _ib_cm_req_rec\r
+{\r
+ const void* __ptr64 context;\r
+ ib_cm_handle_t h_cm_req;\r
+ ib_listen_handle_t h_cm_listen;\r
+\r
+ const uint8_t* __ptr64 p_req_pdata;\r
+\r
+ ib_qp_type_t qp_type;\r
+\r
+ /* valid for rc, uc & rd qp_type only */\r
+ uint8_t resp_res;\r
+ boolean_t flow_ctrl;\r
+ uint8_t rnr_retry_cnt;\r
+ ib_path_rec_t primary_path;\r
+ ib_path_rec_t alt_path;\r
+\r
+ /* valid for ud qp_type only */\r
+ ib_net16_t pkey;\r
+ const void* __ptr64 sidr_context;\r
+\r
+} ib_cm_req_rec_t;\r
+#pragma warning(default:4324)\r
+/*\r
+* FIELDS\r
+* context\r
+* For peer-to-peer connections, this is the queue pair context associated\r
+* with a connection request. For listens, this is the listen context\r
+* specified through the ib_cm_listen routine.\r
+*\r
+* h_cm_req\r
+* The handle to the communication manager request. This handle is used\r
+* to reply to the or reject the connection.\r
+*\r
+* h_cm_listen\r
+* For connection request callbacks initiated in response to an\r
+* ib_cm_listen call, this is a handle to the listen request. This\r
+* handle is provided to the user to avoid a race condition between\r
+* the return of the ib_cm_listen routine and the notification of a\r
+* connection request.\r
+*\r
+* p_req_pdata\r
+* A reference to user-defined private data sent as part of the connection\r
+* request.\r
+*\r
+* qp_type\r
+* Indicates the CM service type.\r
+*\r
+* resp_res\r
+* The maximum number of RDMA read/atomic operations from the recipient\r
+* that the requestor supports on the connection. The init_depth\r
+* specified in the call to ib_cm_rep must be less than or equal to\r
+* this value.\r
+*\r
+* flow_ctrl\r
+* Indicates if the remote CA implements hardware end-to-end flow control.\r
+*\r
+* rnr_retry_cnt\r
+* Requested number of RNR NAK retries to perform before generating a\r
+* local error.\r
+*\r
+* primary_path\r
+* The path record to use for the primary connection.\r
+*\r
+* alt_path\r
+* The path record to use for the alternate connection.\r
+*\r
+* pkey\r
+* The pkey used in the user's request.\r
+*\r
+* sidr_context\r
+* The sidr_context used in ib_cm_listen.\r
+*\r
+* SEE ALSO\r
+* ib_cm_req, ib_cm_listen, ib_pfn_cm_req_cb_t,\r
+* ib_access_t, ib_path_rec_t, ib_req_pdata_t, ib_qp_type_t\r
+*****/\r
+\r
+\r
+/****s* Access Layer/ib_cm_rep_rec_t\r
+* NAME\r
+* ib_cm_rep_rec_t\r
+*\r
+* DESCRIPTION\r
+* Connection request reply information returned to the user through their\r
+* connection reply callback.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_cm_rep_rec\r
+{\r
+ const uint8_t* __ptr64 p_rep_pdata;\r
+\r
+ ib_qp_type_t qp_type;\r
+\r
+ ib_cm_handle_t h_cm_rep;\r
+ /* valid for rc, uc & rd qp_type only */\r
+ const void* __ptr64 qp_context;\r
+ uint8_t resp_res;\r
+ boolean_t flow_ctrl;\r
+ ib_apr_status_t apr_status;\r
+\r
+ /* valid for ud qp_type only */\r
+ const void* __ptr64 sidr_context;\r
+ ib_sidr_status_t status;\r
+ ib_net32_t remote_qp;\r
+ ib_net32_t remote_qkey;\r
+ ib_class_port_info_t class_info;\r
+\r
+} ib_cm_rep_rec_t;\r
+/*\r
+* FIELDS\r
+* p_rep_pdata\r
+* A reference to user-defined private data sent as part of the connection\r
+* request reply.\r
+*\r
+* qp_type\r
+* Indicates the CM service type.\r
+*\r
+* h_cm_rep\r
+* The handle to the communication manager reply. This handle is used\r
+* to issue a ready to use message or to reject the connection.\r
+*\r
+* h_qp\r
+* The handle to the queue pair associated with a connection request.\r
+*\r
+* qp_context\r
+* The queue pair context associated with a connection request.\r
+*\r
+* resp_res\r
+* The maximum number of RDMA read/atomic operations from the recipient\r
+* that the requestor supports on the connection. This may be less than\r
+* the init_depth specified in the call to ib_cm_req. The local queue\r
+* pair will be configured with this value unless the connection is\r
+* rejected.\r
+*\r
+* flow_ctrl\r
+* Indicates if the remote CA implements hardware end-to-end flow control.\r
+*\r
+* apr_status\r
+* Indicates whether the alternate path information was accepted.\r
+*\r
+* h_al\r
+* The AL handle on which the SIDR request was issued.\r
+*\r
+* sidr_context\r
+* The sidr_context used in ib_cm_req.\r
+*\r
+* status\r
+* Status of the request made previously using ib_cm_req.\r
+*\r
+* remote_qp\r
+* Identifies the destination queue pair number.\r
+*\r
+* remote_qkey\r
+* Identifies the destination qkey.\r
+*\r
+* class_info\r
+* Identifies the class_port_info returned if status was not successful.\r
+* This field has no value if status is successful.\r
+*\r
+* SEE ALSO\r
+* ib_cm_req, ib_cm_rep, ib_pfn_cm_rep_cb_t, ib_cm_status_t, ib_rep_pdata_t\r
+* ib_qp_type_t, ib_sidr_status_t\r
+*****/\r
+\r
+\r
+/****s* Access Layer/ib_cm_rtu_rec_t\r
+* NAME\r
+* ib_cm_rtu_rec_t\r
+*\r
+* DESCRIPTION\r
+* Connection ready to use message information returned to the user through\r
+* their ready to use callback.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_cm_rtu_rec\r
+{\r
+ const uint8_t* __ptr64 p_rtu_pdata;\r
+\r
+ ib_qp_handle_t h_qp;\r
+ const void* __ptr64 qp_context;\r
+\r
+} ib_cm_rtu_rec_t;\r
+/*\r
+* FIELDS\r
+* p_rtu_pdata\r
+* A reference to user-defined private data sent as part of the ready\r
+* to use message.\r
+*\r
+* h_qp\r
+* The queue pair handle associated with the connection request.\r
+*\r
+* qp_context\r
+* The queue pair context associated with the connection request.\r
+*\r
+* SEE ALSO\r
+* ib_cm_rtu, ib_pfn_cm_rtu_cb_t, ib_cm_status_t, ib_rtu_pdata_t,\r
+* ib_qp_type_t\r
+*****/\r
+\r
+\r
+/****s* Access Layer/ib_cm_rej_rec_t\r
+* NAME\r
+* ib_cm_rej_rec_t\r
+*\r
+* DESCRIPTION\r
+* Connection rejection information returned to the user through their\r
+* rejection callback.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_cm_rej_rec\r
+{\r
+ ib_rej_status_t rej_status;\r
+ const uint8_t* __ptr64 p_ari;\r
+ uint8_t ari_length;\r
+\r
+ const uint8_t* __ptr64 p_rej_pdata;\r
+\r
+ ib_qp_handle_t h_qp;\r
+ const void* __ptr64 qp_context;\r
+\r
+} ib_cm_rej_rec_t;\r
+/*\r
+* FIELDS\r
+* rej_status\r
+* The reason for the connection rejection.\r
+*\r
+* p_ari\r
+* Additional rejection information. The data referenced by this field\r
+* is dependent on the rej_status and is defined by the Infiniband\r
+* specification.\r
+*\r
+* ari_length\r
+* Length of valid data provided in the p_ari buffer.\r
+*\r
+* p_rej_pdata\r
+* A reference to user-defined private data sent as part of the connection\r
+* request reply.\r
+*\r
+* h_qp\r
+* The queue pair handle associated with a connection request.\r
+*\r
+* qp_context\r
+* The queue pair context associated with a connection request.\r
+*\r
+* SEE ALSO\r
+* ib_cm_rej, ib_pfn_cm_rej_cb_t, ib_rej_status_t, ib_ari_t, ib_rej_pdata_t,\r
+* ib_qp_type_t\r
+*****/\r
+\r
+\r
+/****s* Access Layer/ib_cm_mra_rec_t\r
+* NAME\r
+* ib_cm_mra_rec_t\r
+*\r
+* DESCRIPTION\r
+* Message received acknowledgement information returned to the user through\r
+* a callback.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_cm_mra_rec\r
+{\r
+ const uint8_t* __ptr64 p_mra_pdata;\r
+\r
+ ib_qp_handle_t h_qp;\r
+ const void* __ptr64 qp_context;\r
+\r
+} ib_cm_mra_rec_t;\r
+/*\r
+* FIELDS\r
+* p_mra_pdata\r
+* A reference to user-defined private data sent as part of the MRA.\r
+*\r
+* h_qp\r
+* The queue pair handle associated with a connection request.\r
+*\r
+* qp_context\r
+* The queue pair context associated with a connection request.\r
+*\r
+* SEE ALSO\r
+* ib_cm_req, ib_cm_mra, ib_pfn_cm_mra_cb_t, ib_mra_pdata_t, ib_qp_type_t\r
+*****/\r
+\r
+\r
+/****s* Access Layer/ib_cm_lap_rec_t\r
+* NAME\r
+* ib_cm_lap_rec_t\r
+*\r
+* DESCRIPTION\r
+* Load alternate path request information returned to the user through\r
+* a callback.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_cm_lap_rec\r
+{\r
+ ib_cm_handle_t h_cm_lap;\r
+ ib_path_rec_t alt_path;\r
+\r
+ const uint8_t* __ptr64 p_lap_pdata;\r
+\r
+ const void* __ptr64 qp_context;\r
+\r
+} ib_cm_lap_rec_t;\r
+/*\r
+* FIELDS\r
+* p_lap_pdata\r
+* A reference to user-defined private data sent as part of the load\r
+* alternate path request.\r
+*\r
+* qp_context\r
+* The queue pair context associated with a connection request.\r
+*\r
+* h_cm_lap\r
+* A handle to the load alternate path request. This handle is used\r
+* to reply to the load request.\r
+*\r
+* alt_path\r
+* Requested alternate path. Users must accept or reject the path by\r
+* calling ib_cm_apr.\r
+*\r
+* SEE ALSO\r
+* ib_cm_lap, ib_pfn_cm_lap_cb_t, ib_lap_pdata_t, ib_qp_type_t\r
+*****/\r
+\r
+\r
+/****s* Access Layer/ib_cm_apr_rec_t\r
+* NAME\r
+* ib_cm_apr_rec_t\r
+*\r
+* DESCRIPTION\r
+* Load alternate path response information returned to the user through\r
+* a callback.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_cm_apr_rec\r
+{\r
+ ib_api_status_t cm_status;\r
+ ib_apr_status_t apr_status;\r
+\r
+ const uint8_t* __ptr64 p_info;\r
+ uint8_t info_length;\r
+\r
+ const uint8_t* __ptr64 p_apr_pdata;\r
+\r
+ ib_qp_handle_t h_qp;\r
+ const void* __ptr64 qp_context;\r
+\r
+} ib_cm_apr_rec_t;\r
+/*\r
+* FIELDS\r
+* cm_status\r
+* The status of the alternate path response. IB_SUCCESS indicates that\r
+* the alternate path was loaded successfully. IB_TIMEOUT indicates that\r
+* a reply was not received within the specified timeout and retry count.\r
+* Other error values indicates that the alternate path was not loaded.\r
+* if the apr_status is IB_AP_SUCCESS, the QP failed to load the path.\r
+* Other apr_status values indicate that the request was rejected for some\r
+* reason.\r
+*\r
+* apr_status\r
+* The alternate path response status. This indicates additional failure\r
+* information to a load alternate path request and is defined by the\r
+* InfiniBand specification.\r
+*\r
+* info_length\r
+* Length of valid data in the APR additional information buffer.\r
+*\r
+* p_info\r
+* APR additional information.\r
+*\r
+* p_apr_pdata\r
+* A reference to user-defined private data sent as part of the alternate\r
+* path response.\r
+*\r
+* h_qp\r
+* The queue pair handle associated with the alternate path response.\r
+*\r
+* qp_context\r
+* The queue pair context associated with the alternate path response.\r
+*\r
+* SEE ALSO\r
+* ib_cm_lap, ib_pfn_cm_apr_cb_t, ib_apr_status_t, ib_apr_info_t\r
+* ib_apr_pdata_t, ib_qp_type_t\r
+*****/\r
+\r
+\r
+/****s* Access Layer/ib_cm_dreq_rec_t\r
+* NAME\r
+* ib_cm_dreq_rec_t\r
+*\r
+* DESCRIPTION\r
+* Disconnection request information returned to the user through their\r
+* disconnection callback.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_cm_dreq_rec\r
+{\r
+ ib_cm_handle_t h_cm_dreq;\r
+\r
+ const uint8_t* __ptr64 p_dreq_pdata;\r
+\r
+ const void* __ptr64 qp_context;\r
+\r
+} ib_cm_dreq_rec_t;\r
+/*\r
+* FIELDS\r
+* h_cm_dreq\r
+* A handle to the disconnection request. This handle is used to reply\r
+* to the disconnection request.\r
+*\r
+* p_dreq_pdata\r
+* A reference to user-defined private data sent as part of the\r
+* disconnect request.\r
+*\r
+* qp_context\r
+* The queue pair context associated with the disconnect request.\r
+*\r
+* SEE ALSO\r
+* ib_cm_dreq, ib_pfn_cm_dreq_cb_t, ib_dreq_pdata_t, ib_qp_type_t\r
+*****/\r
+\r
+\r
+/****s* Access Layer/ib_cm_drep_rec_t\r
+* NAME\r
+* ib_cm_drep_rec_t\r
+*\r
+* DESCRIPTION\r
+* Disconnection reply information returned to the user through their\r
+* disconnect reply callback.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_cm_drep_rec\r
+{\r
+ ib_api_status_t cm_status;\r
+\r
+ const uint8_t* __ptr64 p_drep_pdata;\r
+\r
+ ib_qp_handle_t h_qp;\r
+ const void* __ptr64 qp_context;\r
+\r
+} ib_cm_drep_rec_t;\r
+/*\r
+* FIELDS\r
+* cm_status\r
+* The status of the disconnect request. Valid values are IB_SUCCESS\r
+* and IB_TIMEOUT. IB_TIMEOUT indicates that a reply was not received\r
+* within the specified timeout and retry count.\r
+*\r
+* p_drep_pdata\r
+* A reference to user-defined private data sent as part of the\r
+* disconnect reply.\r
+*\r
+* h_qp\r
+* The queue pair handle associated with the disconnect reply.\r
+*\r
+* qp_context\r
+* The queue pair context associated with the disconnect reply.\r
+*\r
+* SEE ALSO\r
+* ib_cm_drep, ib_pfn_cm_drep_cb_t, ib_drep_pdata_t, ib_qp_type_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_pfn_cm_req_cb_t\r
+* NAME\r
+* ib_pfn_cm_req_cb_t\r
+*\r
+* DESCRIPTION\r
+* A user-specified callback that is invoked after receiving a connection\r
+* request message.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef void\r
+(AL_API * __ptr64 ib_pfn_cm_req_cb_t)(\r
+ IN ib_cm_req_rec_t *p_cm_req_rec );\r
+/*\r
+* PARAMETERS\r
+* p_cm_req_rec\r
+* [in] Connection request information returned to the user, indicating\r
+* the parameters for the connection.\r
+*\r
+* NOTES\r
+* This callback is invoked to notify the user of a connection request. This\r
+* routine is invoked for peer to peer connection request calls to ib_cm_req\r
+* and for calls to ib_cm_listen. Users must call ib_cm_rep to accept the\r
+* connection or ib_cm_rej to reject the connection from the callback.\r
+*\r
+* Users may also call ib_cm_mra to acknowledge the connection request and\r
+* prevent the remote side from timing out the connection request. The\r
+* ib_cm_mra routine should be invoked if the user requires substantial\r
+* processing time to process the connection request.\r
+*\r
+* In the kernel, this callback is typically invoked from within a tasklet,\r
+* depending on the implementation of the verbs provider driver.\r
+*\r
+* SEE ALSO\r
+* ib_cm_req, ib_cm_listen, ib_cm_rep, ib_cm_mra, ib_cm_rej, ib_cm_req_rec_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_pfn_cm_rep_cb_t\r
+* NAME\r
+* ib_pfn_cm_rep_cb_t\r
+*\r
+* DESCRIPTION\r
+* A user-specified callback that is invoked after receiving a connection\r
+* request reply message.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef void\r
+(AL_API * __ptr64 ib_pfn_cm_rep_cb_t)(\r
+ IN ib_cm_rep_rec_t *p_cm_rep_rec );\r
+/*\r
+* PARAMETERS\r
+* p_cm_rep_rec\r
+* [in] Connection request reply information returned to the user,\r
+* indicating the remote connection data.\r
+*\r
+* NOTES\r
+* This callback is invoked to notify the user of a connection request reply.\r
+* This routine is invoked after calling ib_cm_req. Users must call\r
+* ib_cm_rtu to accept the connection or ib_cm_rej to reject the connection\r
+* from the callback.\r
+*\r
+* Users may also call ib_cm_mra to acknowledge the connection request reply\r
+* and prevent the remote side from timing out the connection request. The\r
+* ib_cm_mra routine should be invoked if the user requires substantial\r
+* processing time to process the connection request reply.\r
+*\r
+* If a reply is not received within the specified timeout period,\r
+* this callback will be invoked with the status set to IB_CM_TIMEOUT. Users\r
+* may call ib_cm_rej to notify the remote side that the connection request\r
+* is being rejected due to a timeout.\r
+*\r
+* In the kernel, this callback is typically invoked from within a tasklet,\r
+* depending on the implementation of the verbs provider driver.\r
+*\r
+* SEE ALSO\r
+* ib_cm_req, ib_cm_listen, ib_cm_rep, ib_cm_rej, ib_cm_mra, ib_cm_rej,\r
+* ib_cm_rep_rec_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_pfn_cm_rtu_cb_t\r
+* NAME\r
+* ib_pfn_cm_rtu_cb_t\r
+*\r
+* DESCRIPTION\r
+* A user-specified callback that is invoked after receiving a connection\r
+* ready to use message.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef void\r
+(AL_API * __ptr64 ib_pfn_cm_rtu_cb_t)(\r
+ IN ib_cm_rtu_rec_t *p_cm_rtu_rec );\r
+/*\r
+* PARAMETERS\r
+* p_cm_rtu_rec\r
+* [in] Connection ready to use information returned to the user.\r
+*\r
+* NOTES\r
+* This callback is invoked to notify the user that a connection is ready\r
+* to use. This routine is invoked after calling ib_cm_rep. If a ready to\r
+* use message is not received within the specified timeout period, this\r
+* callback will be invoked with the status set to IB_CM_TIMEOUT.\r
+*\r
+* This callback will be invoked before a user is notified of any completions\r
+* that has occurred on the associated queue pair.\r
+*\r
+* In the kernel, this callback is typically invoked from within a tasklet,\r
+* depending on the implementation of the verbs provider driver.\r
+*\r
+* SEE ALSO\r
+* ib_cm_rep, ib_cm_rtu_rec_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_pfn_cm_rej_cb_t\r
+* NAME\r
+* ib_pfn_cm_rej_cb_t\r
+*\r
+* DESCRIPTION\r
+* A user-specified callback that is invoked after receiving a connection\r
+* rejection message.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef void\r
+(AL_API * __ptr64 ib_pfn_cm_rej_cb_t)(\r
+ IN ib_cm_rej_rec_t *p_cm_rej_rec );\r
+/*\r
+* PARAMETERS\r
+* p_cm_rej_rec\r
+* [in] Connection rejection information returned to the user.\r
+*\r
+* NOTES\r
+* This callback is invoked to notify the user that a connection has been\r
+* rejected. This routine may be invoked after calling ib_cm_req or\r
+* ib_cm_rep.\r
+*\r
+* In the kernel, this callback is typically invoked from within a tasklet,\r
+* depending on the implementation of the verbs provider driver.\r
+*\r
+* SEE ALSO\r
+* ib_cm_req, ib_cm_rep, ib_cm_rtu, ib_cm_rej, ib_cm_rej_rec_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_pfn_cm_mra_cb_t\r
+* NAME\r
+* ib_pfn_cm_mra_cb_t\r
+*\r
+* DESCRIPTION\r
+* A user-specified callback that is invoked after receiving a message\r
+* received acknowledgement.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef void\r
+(AL_API * __ptr64 ib_pfn_cm_mra_cb_t)(\r
+ IN ib_cm_mra_rec_t *p_cm_mra_rec );\r
+\r
+/*\r
+* PARAMETERS\r
+* p_cm_mra_rec\r
+* [in] Message received acknowledgement information received from the\r
+* remote side.\r
+*\r
+* NOTES\r
+* This callback is invoked to notify the user that their request was\r
+* successfully received, but additional processing is required. This\r
+* callback may be invoked after calling ib_cm_req or ib_cm_rep\r
+*\r
+* In the kernel, this callback is typically invoked from within a tasklet,\r
+* depending on the implementation of the verbs provider driver.\r
+*\r
+* SEE ALSO\r
+* ib_cm_req, ib_cm_rep, ib_cm_mra_rec_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_pfn_cm_lap_cb_t\r
+* NAME\r
+* ib_pfn_cm_lap_cb_t\r
+*\r
+* DESCRIPTION\r
+* A user-specified callback that is invoked after receiving a load\r
+* alternate path message.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef void\r
+(AL_API * __ptr64 ib_pfn_cm_lap_cb_t)(\r
+ IN ib_cm_lap_rec_t *p_cm_lap_rec );\r
+/*\r
+* PARAMETERS\r
+* p_cm_lap_rec\r
+* [in] Load alternate path information sent by the remote side.\r
+*\r
+* NOTES\r
+* This callback is invoked to notify the user of a load alternate path\r
+* request. Users must call ib_cm_apr to respond to the load alternate\r
+* path request from within this callback. The ib_cm_apr call is used\r
+* to accept or reject the load alternate path request.\r
+*\r
+* In the kernel, this callback is typically invoked from within a\r
+* tasklet, depending on the implementation of the verbs provider driver.\r
+*\r
+* SEE ALSO\r
+* ib_cm_lap, ib_cm_apr, ib_cm_lap_rec_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_pfn_cm_apr_cb_t\r
+* NAME\r
+* ib_pfn_cm_apr_cb_t\r
+*\r
+* DESCRIPTION\r
+* A user-specified callback that is invoked after receiving a load\r
+* alternate path response message.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef void\r
+(AL_API * __ptr64 ib_pfn_cm_apr_cb_t)(\r
+ IN ib_cm_apr_rec_t *p_cm_apr_rec );\r
+/*\r
+* PARAMETERS\r
+* p_cm_apr_rec\r
+* [in] Load alternate path response information sent by the remote side.\r
+*\r
+* NOTES\r
+* This callback is invoked to notify the user of a load alternate path\r
+* response. If a response is not received within the specified timeout\r
+* period, this callback will be invoked with the status set to IB_CM_TIMEOUT.\r
+*\r
+* In the kernel, this callback is typically invoked from within a tasklet,\r
+* depending on the implementation of the verbs provider driver.\r
+*\r
+* SEE ALSO\r
+* ib_cm_lap, ib_cm_apr, ib_cm_apr_rec_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_pfn_cm_dreq_cb_t\r
+* NAME\r
+* ib_pfn_cm_dreq_cb_t\r
+*\r
+* DESCRIPTION\r
+* A user-specified callback that is invoked after receiving a disconnect\r
+* request message.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef void\r
+(AL_API * __ptr64 ib_pfn_cm_dreq_cb_t)(\r
+ IN ib_cm_dreq_rec_t *p_cm_dreq_rec );\r
+/*\r
+* PARAMETERS\r
+* p_cm_dreq_rec\r
+* [in] Disconnect request information returned to the user.\r
+*\r
+* NOTES\r
+* This callback is invoked to notify the user of a disconnect request.\r
+* Users must call ib_cm_drep to respond to the disconnect request. After\r
+* this callback returns, the queue pair associated with the connection is\r
+* transitioned to the time-wait state and is no longer usable for sending\r
+* and receiving data.\r
+*\r
+* In the kernel, this callback is typically invoked from within a tasklet,\r
+* depending on the implementation of the verbs provider driver.\r
+*\r
+* SEE ALSO\r
+* ib_cm_req, ib_cm_listen, ib_cm_drep, ib_cm_dreq_rec_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_pfn_cm_drep_cb_t\r
+* NAME\r
+* ib_pfn_cm_drep_cb_t\r
+*\r
+* DESCRIPTION\r
+* A user-specified callback that is invoked after receiving a disconnect\r
+* reply message.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef void\r
+(AL_API * __ptr64 ib_pfn_cm_drep_cb_t)(\r
+ IN ib_cm_drep_rec_t *p_cm_drep_rec );\r
+/*\r
+* PARAMETERS\r
+* p_cm_drep_rec\r
+* [in] Disconnect reply information returned to the user.\r
+*\r
+* NOTES\r
+* This callback is invoked to notify the user of a disconnect reply. If\r
+* no reply was received within the specified timeout period, this callback\r
+* will be invoked with the status set to IB_CM_TIMEOUT.\r
+*\r
+* In the kernel, this callback is typically invoked from within a\r
+* tasklet, depending on the implementation of the verbs provider driver.\r
+*\r
+* SEE ALSO\r
+* ib_cm_dreq, ib_cm_drep, ib_cm_drep_rec_t\r
+*****/\r
+\r
+\r
+/****d* Access Layer/ib_listen_info_t\r
+* NAME\r
+* ib_listen_info_t\r
+*\r
+* DESCRIPTION\r
+* Constants used to specify directed listen requests.\r
+*\r
+* SYNOPSIS\r
+*/\r
+#define IB_ALL_CAS 0\r
+#define IB_ALL_PORTS 0\r
+#define IB_ALL_LIDS 0\r
+#define IB_ALL_PKEYS 0\r
+/*\r
+* SEE ALSO\r
+* ib_cm_listen, ib_cm_listen_t\r
+*****/\r
+\r
+\r
+/****s* Access Layer/ib_cm_listen_t\r
+* NAME\r
+* ib_cm_listen_t\r
+*\r
+* DESCRIPTION\r
+* Request to listen for incoming connection attempts.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_cm_listen\r
+{\r
+ ib_net64_t svc_id;\r
+\r
+ ib_net64_t ca_guid;\r
+ ib_net64_t port_guid;\r
+ ib_net16_t lid;\r
+ ib_net16_t pkey;\r
+\r
+ uint8_t* __ptr64 p_compare_buffer;\r
+ uint8_t compare_offset;\r
+ uint8_t compare_length;\r
+\r
+ ib_pfn_cm_req_cb_t pfn_cm_req_cb;\r
+\r
+ ib_qp_type_t qp_type;\r
+\r
+ /* valid for ud qp_type only */\r
+ const void* __ptr64 sidr_context;\r
+\r
+} ib_cm_listen_t;\r
+/*\r
+* FIELDS\r
+* svc_id\r
+* The identifier of the service to register for incoming connection\r
+* requests.\r
+*\r
+* ca_guid\r
+* Directs the communication manager to register the listen only\r
+* with the specified channel adapter. This should be set to IB_ALL_CAS\r
+* if the listen is not directed to a particular channel adapter.\r
+*\r
+* port_guid\r
+* Directs the communication manager to register the listen only\r
+* with the specified port. This should be set to IB_ALL_PORTS\r
+* if the listen is not directed to a particular port.\r
+*\r
+* lid\r
+* Directs the communication manager to register the listen only\r
+* with the specified LID. This should be set to IB_ALL_LIDS\r
+* if the listen is not directed to a particular LID.\r
+*\r
+* pkey\r
+* Directs the communication manager to register the listen only with\r
+* the specified pkey value. This should be set to IB_ALL_PKEYS\r
+* iv the listen is not directed to a particular partition.\r
+*\r
+* p_compare_buffer\r
+* An optionally provided buffer that will be used to match incoming\r
+* connection requests with a registered service. Use of this buffer\r
+* permits multiple services to listen on the same service ID as long as\r
+* they provide different compare buffers. Incoming requests will\r
+* be matched against the compare buffer.\r
+*\r
+* compare_offset\r
+* An offset into the user-defined data area of a connection request\r
+* which contains the start of the data that will be compared against.\r
+* The offset must be the same for all requests using the same service ID.\r
+*\r
+* compare_length\r
+* Specifies the size of the compare buffer in bytes. The length must\r
+* be the same for all requests using the same service ID.\r
+*\r
+* pfn_cm_req_cb\r
+* References a user-provided callback that will be invoked whenever a\r
+* connection request is received.\r
+*\r
+* qp_type\r
+* Indicates the CM service type.\r
+*\r
+* pfn_cm_mra_cb\r
+* References a user-provided callback that will be invoked when\r
+* a message received acknowledgement is received.\r
+*\r
+* pfn_cm_rej_cb\r
+* References a user-provided callback that will be invoked if the\r
+* connection is rejected by the remote end-point.\r
+*\r
+* sidr_context\r
+* sidr specific context for listens. This context is passed back in\r
+* the ib_pfn_cm_req_cb_t callback.\r
+*\r
+* NOTES\r
+* Users fill out this structure when listening on a service ID with the\r
+* local communication manager. The communication manager will use the given\r
+* service ID and compare buffer to route connection requests to the\r
+* appropriate client. Users may direct listens requests on a particular\r
+* channel adapter, port, or LID.\r
+*\r
+* Message received acknowledgement (MRA) callbacks will not be invoked\r
+* until a connection request has been replied to.\r
+*\r
+* SEE ALSO\r
+* ib_listen_info_t, ib_pfn_cm_req_cb_t, ib_pfn_cm_mra_cb_t,\r
+* ib_qp_type_t\r
+*****/\r
+\r
+\r
+/****s* Access Layer/ib_cm_req_t\r
+* NAME\r
+* ib_cm_req_t\r
+*\r
+* DESCRIPTION\r
+* Connection request information used to establish a new connection.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_cm_req\r
+{\r
+ ib_net64_t svc_id;\r
+\r
+ ib_al_flags_t flags;\r
+ uint8_t max_cm_retries;\r
+\r
+ ib_path_rec_t* __ptr64 p_primary_path;\r
+\r
+ ib_pfn_cm_rep_cb_t pfn_cm_rep_cb;\r
+\r
+ const uint8_t* __ptr64 p_req_pdata;\r
+ uint8_t req_length;\r
+\r
+ ib_qp_type_t qp_type;\r
+\r
+ /* valid for rc, uc & rd qp_type only */\r
+ ib_qp_handle_t h_qp;\r
+\r
+ uint8_t* __ptr64 p_compare_buffer;\r
+ uint8_t compare_offset;\r
+ uint8_t compare_length;\r
+\r
+ uint8_t resp_res;\r
+ uint8_t init_depth;\r
+ uint8_t remote_resp_timeout;\r
+ boolean_t flow_ctrl;\r
+ uint8_t local_resp_timeout;\r
+ uint8_t rnr_nak_timeout;\r
+ uint8_t rnr_retry_cnt;\r
+ uint8_t retry_cnt;\r
+\r
+ ib_path_rec_t* __ptr64 p_alt_path OPTIONAL;\r
+\r
+ ib_pfn_cm_req_cb_t pfn_cm_req_cb;\r
+ ib_pfn_cm_mra_cb_t pfn_cm_mra_cb;\r
+ ib_pfn_cm_rej_cb_t pfn_cm_rej_cb;\r
+\r
+ /* valid for ud qp_type only */\r
+ ib_al_handle_t h_al;\r
+ const void* __ptr64 sidr_context;\r
+ uint32_t timeout_ms;\r
+ ib_net16_t pkey;\r
+\r
+} ib_cm_req_t;\r
+/*\r
+* FIELDS\r
+* svc_id\r
+* The ID of the remote service to which the connection request is\r
+* being made.\r
+*\r
+* flags\r
+* Used to describe the mode of operation. Set to IB_FLAGS_SYNC to\r
+* process the called routine synchronously.\r
+*\r
+* max_cm_retries\r
+* The maximum number of times that either CM should resend a connection\r
+* establishment message.\r
+*\r
+* p_primary_path\r
+* Path information over which to establish the primary connection.\r
+*\r
+* pfn_cm_rep_cb\r
+* References a user-provided callback that will be invoked when\r
+* a reply to the connection request is received.\r
+*\r
+* p_req_pdata\r
+* Optional user-defined private data sent as part of the connection\r
+* request.\r
+*\r
+* req_length\r
+* Defines the size of the user-defined private data.\r
+*\r
+* qp_type\r
+* Indicates the CM service type.\r
+*\r
+* h_qp\r
+* A handle to the queue pair to use in the connection.\r
+*\r
+* p_compare_buffer\r
+* An optionally provided buffer that will be used to match incoming\r
+* connection requests with a registered service. Use of this buffer\r
+* permits multiple services to connect using the same service ID as\r
+* long as they provide different compare buffers. Incoming requests\r
+* will be matched against the compare buffer. Valid for peer-to-peer\r
+* connection requests only.\r
+*\r
+* compare_offset\r
+* An offset into the user-defined data area of a connection request\r
+* which contains the start of the data that will be compared against.\r
+* The offset must be the same for all requests using the same service ID.\r
+* Valid for peer-to-peer connection requests only.\r
+*\r
+* compare_length\r
+* Specifies the size of the compare buffer in bytes. The length must\r
+* be the same for all requests using the same service ID. Valid for\r
+* peer-to-peer connection requests only.\r
+*\r
+* resp_res\r
+* The maximum number of outstanding RDMA read/atomic operations the\r
+* requestor supports from the remote QP.\r
+*\r
+* init_depth\r
+* The maximum number of outstanding RDMA read/atomic operations the\r
+* requestor will have outstanding to the remote QP.\r
+*\r
+* remote_resp_timeout\r
+* The time within which the remote CM should transmit a response to\r
+* the sender. This value is expressed as\r
+* 4.096 * (2 ^ local_resp_timeout) microseconds.\r
+*\r
+* flow_ctrl\r
+* Indicates whether the local CA supports end-to-end flow control.\r
+*\r
+* local_resp_timeout\r
+* The time that the remote CM should wait to receive a response from\r
+* the local CM. This value is expressed as\r
+* 4.096 * (2 ^ local_resp_timeout) microseconds.\r
+*\r
+* rnr_nak_timeout\r
+* The time to wait before retrying a packet after receiving a RNR NAK.\r
+* This value is defined in section 9.7.5.2.8 of the IB Spec, table 45.\r
+*\r
+* rnr_retry_cnt\r
+* The number of times that the local QP should retry a send operation\r
+* after receiving an RNR NACK before reporting an error.\r
+*\r
+* retry_cnt\r
+* The number of times that a QP should retry a send operation before\r
+* reporting an error.\r
+*\r
+* p_alt_path\r
+* Optional path information that will be used as the alternate\r
+* connection path in the case of failure.\r
+*\r
+* pfn_cm_req_cb\r
+* References a user-provided callback that will be invoked when\r
+* a request for a connection is received. This is required for peer-to\r
+* peer connection requests, and must be NULL for client/server\r
+* connection requests.\r
+*\r
+* pfn_cm_mra_cb\r
+* References a user-provided callback that will be invoked when\r
+* a message received acknowledgement is received.\r
+*\r
+* pfn_cm_rej_cb\r
+* References a user-provided callback that will be invoked if the\r
+* connection is rejected by the remote end-point.\r
+*\r
+* sidr_context\r
+* The user-defined sidr context information that will be passed back in a\r
+* ib_cm_req callback.\r
+*\r
+* timeout_ms\r
+* Timeout value in milli-seconds for the REQ to expire. The CM will add\r
+* twice packet lifetime to this value to determine the actual timeout\r
+* value used.\r
+*\r
+* pkey\r
+* pkey to be used as part of the request. This field is only valid for\r
+* IB_MCLASS_CM_VER_2 clients.\r
+*\r
+* SEE ALSO\r
+* ib_cm_req, ib_pfn_cm_req_cb_t, ib_pfn_cm_rep_cb_t, ib_pfn_cm_mra_cb_t,\r
+* ib_pfn_cm_rej_cb_t, ib_path_rec_t, ib_req_pdata_t, ib_qp_type_t\r
+*****/\r
+\r
+\r
+/****d* Access Layer/ib_cm_failover_t\r
+* NAME\r
+* ib_cm_failover_t\r
+*\r
+* DESCRIPTION\r
+* Fail over acceptance status returned as part of a connection reply.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef uint8_t ib_cm_failover_t;\r
+#define IB_FAILOVER_ACCEPT_SUCCESS 0\r
+#define IB_FAILOVER_ACCEPT_UNSUPPORTED 1\r
+#define IB_FAILOVER_ACCEPT_ERROR 2\r
+/*\r
+* NOTES\r
+* These values and their use are defined the Infiniband specification.\r
+*\r
+* SEE ALSO\r
+* ib_cm_rep, ib_cm_rep_t\r
+*****/\r
+\r
+\r
+/****s* Access Layer/ib_cm_rep_t\r
+* NAME\r
+* ib_cm_rep_t\r
+*\r
+* DESCRIPTION\r
+* Connection reply information used when establishing a connection.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_cm_rep\r
+{\r
+ ib_al_flags_t flags;\r
+\r
+ const uint8_t* __ptr64 p_rep_pdata;\r
+ uint8_t rep_length;\r
+\r
+ ib_qp_handle_t h_qp;\r
+ ib_qp_type_t qp_type;\r
+\r
+ /* valid for rc, uc & rd qp_type only */\r
+ ib_access_t access_ctrl;\r
+ uint32_t sq_depth;\r
+ uint32_t rq_depth;\r
+\r
+ uint8_t init_depth;\r
+ uint8_t target_ack_delay;\r
+ ib_cm_failover_t failover_accepted;\r
+ boolean_t flow_ctrl;\r
+ uint8_t rnr_nak_timeout;\r
+ uint8_t rnr_retry_cnt;\r
+\r
+ ib_pfn_cm_rej_cb_t pfn_cm_rej_cb;\r
+ ib_pfn_cm_mra_cb_t pfn_cm_mra_cb;\r
+ ib_pfn_cm_rtu_cb_t pfn_cm_rtu_cb;\r
+ ib_pfn_cm_lap_cb_t pfn_cm_lap_cb;\r
+ ib_pfn_cm_dreq_cb_t pfn_cm_dreq_cb;\r
+\r
+ ib_recv_wr_t* __ptr64 p_recv_wr;\r
+ ib_recv_wr_t* __ptr64 *__ptr64 pp_recv_failure;\r
+\r
+ /*valid for ud qp_type only */\r
+ ib_sidr_status_t status;\r
+ ib_class_port_info_t class_info;\r
+\r
+} ib_cm_rep_t;\r
+/*\r
+* FIELDS\r
+* flags\r
+* Used to describe the mode of operation. Set to IB_FLAGS_SYNC to\r
+* process the called routine synchronously.\r
+*\r
+* p_rep_pdata\r
+* Optional user-defined private data sent as part of the connection\r
+* reply.\r
+*\r
+* rep_length\r
+* Defines the size of the user-defined private data.\r
+*\r
+* qp_type\r
+* Indicates the CM service type.\r
+*\r
+* h_qp\r
+* A handle to the queue pair to use in the connection. For SIDR, h_qp\r
+* is valid only if sidr status is IB_SIDR_SUCCESS.\r
+*\r
+* access_ctrl\r
+* Indicates the type of access permitted on the local QP.\r
+*\r
+* sq_depth\r
+* The maximum number of outstanding send operations that the local\r
+* QP needs to support.\r
+*\r
+* rq_depth\r
+* The maximum number of outstanding receive operations that the local\r
+* QP needs to support.\r
+*\r
+* init_depth\r
+* The maximum number of outstanding RDMA read/atomic operations the\r
+* sender of the reply will have outstanding to the remote QP.\r
+*\r
+* target_ack_delay\r
+* The time that the remote QP should wait to receive an ACK from the\r
+* local QP.\r
+*\r
+* failover_accepted\r
+* Status indicating if the fail over path was accepted by the sender\r
+* of the reply.\r
+*\r
+* flow_ctrl\r
+* Indicates whether the local CA supports end-to-end flow control.\r
+*\r
+* rnr_nak_timeout\r
+* The time to wait before retrying a packet after receiving a RNR NAK.\r
+*\r
+* rnr_retry_cnt\r
+* The number of times that the local QP should retry a send operation\r
+* after receiving an RNR NACK before reporting an error.\r
+*\r
+* pfn_cm_rtu_cb\r
+* References a user-defined callback that will be invoked when\r
+* a connection is ready to use for send operations.\r
+*\r
+* pfn_cm_lap_cb\r
+* References a user-defined callback that will be invoked when\r
+* a load alternate path request is received for the connecting\r
+* queue pair or end-to-end context.\r
+*\r
+* pfn_cm_dreq_cb\r
+* References a user-defined callback that will be invoked when\r
+* a disconnect request is received is for the connecting\r
+* queue pair or end-to-end context.\r
+*\r
+* p_recv_wr\r
+* A reference to the head of the work request list to be initially\r
+* posted to the receive queue. Providing this list closes a potential\r
+* race condition between sending a CM REP message and posting receives.\r
+* Use of this field is optional.\r
+*\r
+* pp_recv_failure\r
+* If the post receive operation failed, this references the work\r
+* request in the p_recv_wr list where the first failure occurred.\r
+* This field is required only if p_recv_wr is used.\r
+*\r
+* status\r
+* sidr status value returned back to a previously received REQ.\r
+*\r
+* class_info\r
+* The contents of this field are valid only if status is IB_SIDR_REDIRECT.\r
+*\r
+* SEE ALSO\r
+* ib_cm_rep, ib_access_t, ib_cm_failover_t, ib_rep_pdata_t\r
+* ib_pfn_cm_rtu_cb_t, ib_pfn_cm_lap_cb_t, ib_pfn_cm_dreq_cb_t,\r
+* ib_qp_type_t\r
+*****/\r
+\r
+\r
+/****s* Access Layer/ib_cm_rtu_t\r
+* NAME\r
+* ib_cm_rtu_t\r
+*\r
+* DESCRIPTION\r
+* Connection ready to use information used when establishing a connection.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_cm_rtu\r
+{\r
+ ib_access_t access_ctrl;\r
+ uint32_t sq_depth;\r
+ uint32_t rq_depth;\r
+\r
+ const uint8_t* __ptr64 p_rtu_pdata;\r
+ uint8_t rtu_length;\r
+\r
+ ib_pfn_cm_apr_cb_t pfn_cm_apr_cb;\r
+ ib_pfn_cm_dreq_cb_t pfn_cm_dreq_cb;\r
+\r
+} ib_cm_rtu_t;\r
+/*\r
+* FIELDS\r
+* access_ctrl\r
+* Indicates the type of access permitted on the local QP.\r
+*\r
+* sq_depth\r
+* The maximum number of outstanding send operations that the local\r
+* QP needs to support. This field should be set to zero if the CA\r
+* does not support changing the work request depth after the QP is\r
+* created.\r
+*\r
+* rq_depth\r
+* The maximum number of outstanding receive operations that the local\r
+* QP needs to support. This field should be set to zero if the CA\r
+* does not support changing the work request depth after the QP is\r
+* created.\r
+*\r
+* p_rtu_pdata\r
+* Optional user-defined private data sent as part of the connection\r
+* ready to use message.\r
+*\r
+* rtu_length\r
+* Defines the size of the user-defined private data.\r
+*\r
+* pfn_cm_apr_cb\r
+* References a user-defined callback that will be invoked when an\r
+* alternate path response is received for the connecting queue pair\r
+* or end-to-end context.\r
+*\r
+* pfn_cm_dreq_cb\r
+* References a user-defined callback that will be invoked when a\r
+* disconnect request is received is for the connecting queue pair\r
+* or end-to-end context.\r
+*\r
+* SEE ALSO\r
+* ib_cm_rtu, ib_access_t, ib_rtu_pdata_t\r
+*****/\r
+\r
+\r
+/****s* Access Layer/ib_cm_rej_t\r
+* NAME\r
+* ib_cm_rej_t\r
+*\r
+* DESCRIPTION\r
+* Information used to reject a connection request.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_cm_rej\r
+{\r
+ ib_rej_status_t rej_status;\r
+\r
+ ib_ari_t* __ptr64 p_ari;\r
+ uint8_t ari_length;\r
+ const uint8_t* __ptr64 p_rej_pdata;\r
+ uint8_t rej_length;\r
+\r
+} ib_cm_rej_t;\r
+/*\r
+* FIELDS\r
+* rej_status\r
+* The reason for the connection rejection.\r
+*\r
+* p_ari\r
+* Additional rejection information. The data referenced by this field\r
+* is dependent on the rej_status and is defined by the Infiniband\r
+* specification.\r
+*\r
+* ari_length\r
+* Length of valid data provided in the p_ari buffer.\r
+*\r
+* p_rej_pdata\r
+* A reference to user-defined private data sent as part of the\r
+* reject message.\r
+*\r
+* rej_length\r
+* Defines the size of the user-defined private data.\r
+*\r
+* SEE ALSO\r
+* ib_cm_rej, ib_pfn_cm_rej_cb_t, ib_rej_status_t, ib_ari_t, ib_rej_pdata_t\r
+*****/\r
+\r
+\r
+/****s* Access Layer/ib_cm_mra_t\r
+* NAME\r
+* ib_cm_mra_t\r
+*\r
+* DESCRIPTION\r
+* Connection message received acknowledgement information used to\r
+* indicate that a connection request, reply, or load alternate path\r
+* has been received.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_cm_mra\r
+{\r
+ uint8_t svc_timeout;\r
+\r
+ const uint8_t* __ptr64 p_mra_pdata;\r
+ uint8_t mra_length;\r
+\r
+} ib_cm_mra_t;\r
+/*\r
+* FIELDS\r
+* svc_timeout\r
+* Indicates the amount of time that the local service requires to\r
+* complete processing of the previously received message.\r
+*\r
+* p_mra_pdata\r
+* Optional user-defined private data sent as part of the message\r
+* received acknowledgement.\r
+*\r
+* mra_length\r
+* Defines the size of the user-defined private data.\r
+*\r
+* SEE ALSO\r
+* ib_cm_mra, ib_pfn_cm_req_cb_t, ib_pfn_cm_rep_cb_t, ib_pfn_cm_lap_cb_t,\r
+* ib_mra_pdata_t\r
+*****/\r
+\r
+\r
+/****s* Access Layer/ib_cm_lap_t\r
+* NAME\r
+* ib_cm_lap_t\r
+*\r
+* DESCRIPTION\r
+* Load alternate path information used to configure a queue pair with an\r
+* alternate path.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_cm_lap\r
+{\r
+ ib_al_flags_t flags;\r
+\r
+ const uint8_t* __ptr64 p_lap_pdata;\r
+ uint8_t lap_length;\r
+\r
+ ib_qp_type_t qp_type;\r
+\r
+ /* valid for rc, uc & rd qp_type only */\r
+ ib_qp_handle_t h_qp;\r
+\r
+ uint8_t remote_resp_timeout;\r
+ ib_path_rec_t* __ptr64 p_alt_path;\r
+ ib_pfn_cm_apr_cb_t pfn_cm_apr_cb;\r
+\r
+} ib_cm_lap_t;\r
+/*\r
+* FIELDS\r
+* flags\r
+* Used to describe the mode of operation. Set to IB_FLAGS_SYNC to\r
+* process the called routine synchronously.\r
+*\r
+* p_lap_pdata\r
+* Optional user-defined private data sent as part of the load alternate\r
+* path message.\r
+*\r
+* lap_length\r
+* Defines the size of the user-defined private data.\r
+*\r
+* qp_type\r
+* Indicates the CM service type.\r
+*\r
+* h_qp\r
+* A handle to the queue pair that should receive the alternate path.\r
+*\r
+* remote_resp_timeout\r
+* The time within which the remote CM should transmit a response to\r
+* the sender. This value is expressed as\r
+* 4.096 * (2 ^ local_resp_timeout) microseconds.\r
+*\r
+* p_alt_path\r
+* The path record to use for the alternate connection.\r
+*\r
+* pfn_cm_apr_cb\r
+* References a user-defined callback that will be invoked when the\r
+* response to the load request is received.\r
+*\r
+* SEE ALSO\r
+* ib_cm_lap, ib_pfn_cm_lap_cb_t, ib_pfn_cm_apr_cb_t, ib_path_rec_t,\r
+* ib_pfn_lap_pdata_t, ib_qp_type_t\r
+*****/\r
+\r
+\r
+/****s* Access Layer/ib_cm_apr_t\r
+* NAME\r
+* ib_cm_apr_t\r
+*\r
+* DESCRIPTION\r
+* Load alternate path information used to configure a queue pair with an\r
+* alternate path.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_cm_apr\r
+{\r
+ const uint8_t* __ptr64 p_apr_pdata;\r
+ uint8_t apr_length;\r
+\r
+ ib_qp_type_t qp_type;\r
+\r
+ /* valid for rc, uc & rd qp_type only */\r
+ ib_qp_handle_t h_qp;\r
+\r
+ ib_apr_status_t apr_status;\r
+ uint8_t info_length;\r
+ const ib_apr_info_t* __ptr64 p_info;\r
+\r
+} ib_cm_apr_t;\r
+/*\r
+* FIELDS\r
+* p_apr_pdata\r
+* Optional user-defined private data sent as part of the alternate\r
+* path response message.\r
+*\r
+* apr_length\r
+* Defines the size of the user-defined private data.\r
+*\r
+* qp_type\r
+* Indicates the CM service type.\r
+*\r
+* h_qp\r
+* A handle to the queue pair that should receive the alternate path.\r
+*\r
+* apr_status\r
+* The alternate path response status. This indicates additional failure\r
+* information to a load alternate path request and is defined by the\r
+* Infiniband specification.\r
+*\r
+* info_length\r
+* Length of valid data in the APR additional information buffer.\r
+*\r
+* p_info\r
+* APR additional information.\r
+*\r
+* SEE ALSO\r
+* ib_cm_apr, ib_pfn_cm_apr_cb_t, ib_lap_pdata_t, ib_qp_type_t\r
+*****/\r
+\r
+\r
+/****s* Access Layer/ib_cm_dreq_t\r
+* NAME\r
+* ib_cm_dreq_t\r
+*\r
+* DESCRIPTION\r
+* Disconnection request information used to tear down a connection.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_cm_dreq\r
+{\r
+ ib_al_flags_t flags;\r
+\r
+ uint8_t* __ptr64 p_dreq_pdata;\r
+ uint8_t dreq_length;\r
+\r
+ ib_qp_type_t qp_type;\r
+\r
+ /* valid for rc, uc & rd qp_type only */\r
+ ib_qp_handle_t h_qp;\r
+ ib_pfn_cm_drep_cb_t pfn_cm_drep_cb;\r
+\r
+} ib_cm_dreq_t;\r
+/*\r
+* FIELDS\r
+* flags\r
+* Used to describe the mode of operation. Set to IB_FLAGS_SYNC to\r
+* process the called routine synchronously.\r
+*\r
+* p_dreq_pdata\r
+* A reference to user-defined private data sent as part of the\r
+* disconnection request.\r
+*\r
+* dreq_length\r
+* Defines the size of the user-defined private data.\r
+*\r
+* qp_type\r
+* Indicates the CM service type.\r
+*\r
+* h_qp\r
+* A handle to the queue pair to disconnect.\r
+*\r
+* pfn_cm_drep_cb\r
+* References a user-defined callback that will be invoked when\r
+* the reply to the disconnect is received.\r
+*\r
+* NOTES\r
+* Users submit this structure to disconnect a queue pair or end-to-end\r
+* context. A single disconnect call disconnects either a queue pair or\r
+* an end-to-end context, but not both.\r
+*\r
+* SEE ALSO\r
+* ib_cm_dreq, ib_cm_drep, ib_dreq_pdata_t, ib_al_flags_t,\r
+* ib_qp_type_t\r
+*****/\r
+\r
+\r
+/****s* Access Layer/ib_cm_drep_t\r
+* NAME\r
+* ib_cm_drep_t\r
+*\r
+* DESCRIPTION\r
+* Disconnection reply information used when tearing down a connection.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_cm_drep\r
+{\r
+ uint8_t* __ptr64 p_drep_pdata;\r
+ uint8_t drep_length;\r
+\r
+} ib_cm_drep_t;\r
+/*\r
+* FIELDS\r
+* p_drep_pdata\r
+* A reference to user-defined private data sent as part of the\r
+* disconnection reply.\r
+*\r
+* drep_length\r
+* Defines the size of the user-defined private data.\r
+*\r
+* SEE ALSO\r
+* ib_cm_drep, ib_drep_pdata_t\r
+*****/\r
+\r
+\r
+/****s* Access Layer/ib_listen_err_rec_t\r
+* NAME\r
+* ib_listen_err_rec_t\r
+*\r
+* DESCRIPTION\r
+* Information returned to the user when an error occurs on a listen request.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_listen_err_rec\r
+{\r
+ void* __ptr64 listen_context;\r
+ ib_api_status_t reason;\r
+ ib_listen_handle_t h_cm_listen;\r
+\r
+} ib_listen_err_rec_t;\r
+/*\r
+* FIELDS\r
+* listen_context\r
+* User-defined context information associated with the listen request\r
+* through the ib_cm_listen call.\r
+*\r
+* reason\r
+* A status that identifies the reason for error being reported.\r
+*\r
+* h_cm_listen\r
+* The handle for the listen request. This handle will match the handle\r
+* returned by ib_cm_listen call. It is provided in case an error event\r
+* occurs before a client's call to ib_cm_listen can return.\r
+*\r
+* SEE ALSO\r
+* ib_pfn_listen_err_cb_t, ib_api_status_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_pfn_listen_err_cb_t\r
+* NAME\r
+* ib_pfn_listen_err_cb_t\r
+*\r
+* DESCRIPTION\r
+* A user-specified callback that is invoked after an error has occurred on\r
+* a listen request.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef void\r
+(AL_API * __ptr64 ib_pfn_listen_err_cb_t)(\r
+ IN ib_listen_err_rec_t *p_listen_err_rec );\r
+/*\r
+* PARAMETERS\r
+* p_listen_err_rec\r
+* [in] Error information returned to the user, indicating the reason\r
+* for the error and associated context information.\r
+*\r
+* NOTES\r
+* This callback is invoked within a system thread context in the kernel.\r
+*\r
+* SEE ALSO\r
+* p_listen_err_rec\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_cm_listen\r
+* NAME\r
+* ib_cm_listen\r
+*\r
+* DESCRIPTION\r
+* Issues a request to the local communication manager to listen for\r
+* incoming connection requests.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_cm_listen(\r
+ IN const ib_al_handle_t h_al,\r
+ IN const ib_cm_listen_t* const p_cm_listen,\r
+ IN const ib_pfn_listen_err_cb_t pfn_listen_err_cb,\r
+ IN const void* const listen_context,\r
+ OUT ib_listen_handle_t* const ph_cm_listen );\r
+/*\r
+* PARAMETERS\r
+* h_al\r
+* [in] A handle to an opened instance of the access layer.\r
+*\r
+* p_cm_listen\r
+* [in] Information used to direct the listen request to match incoming\r
+* connection requests.\r
+*\r
+* pfn_listen_err_cb\r
+* [in] User-specified error callback routine to invoke if an error\r
+* occurs while listening.\r
+*\r
+* listen_context\r
+* User-specified context information that is returned as a part of all\r
+* connection requests through the pfn_cm_req_cb routine. The context is\r
+* also returned through the error and destroy callbacks.\r
+*\r
+* ph_cm_listen\r
+* [out] Upon successful completion of this call, this references a handle\r
+* to the listen request. This handle may be used to cancel the listen\r
+* operation.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The listen request was successfully registered with the connection\r
+* manager.\r
+*\r
+* IB_INVALID_AL_HANDLE\r
+* The access layer handle was invalid.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the listen request information, error callback function,\r
+* or listen handle was not provided.\r
+*\r
+* IB_INVALID_SETTING\r
+* The class version specified in the listen request is not supported by\r
+* connection manager or the listen request is not unique.\r
+*\r
+* IB_INSUFFICIENT_MEMORY\r
+* There was insufficient memory to register the listen request.\r
+*\r
+* IB_INVALID_GUID\r
+* A channel adapter or port GUID is not wildcarded and no channel adapter\r
+* or port in the system was found for the specified GUID.\r
+*\r
+* IB_INVALID_LID\r
+* The lid is not wildcarded and is not within the lid range for the port\r
+* specified in the listen request information.\r
+*\r
+* IB_INVALID_PKEY\r
+* The pkey is not wildcarded and is not a valid pkey for the port\r
+* specified in the listen request information.\r
+*\r
+* NOTES\r
+* This routine directs the access layer to route connection requests\r
+* matching the specified connection parameters to the client. Clients\r
+* listen for connections matching a particular service ID, and may optionally\r
+* direct their listen request towards a specific channel adapter, port, or\r
+* LID.\r
+*\r
+* If local configuration changes occur that invalidate a listen request, the\r
+* specified error callback will be invoked. Invalidated listen requests\r
+* should be canceled by the user. An example of a configuration change that\r
+* invalidates listen requests is a LID change for directed listens. The\r
+* listen error callback will be invoked within the context of a system\r
+* thread.\r
+*\r
+* SEE ALSO\r
+* ib_cm_listen_t, ib_pfn_listen_err_cb_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_cm_cancel\r
+* NAME\r
+* ib_cm_cancel\r
+*\r
+* DESCRIPTION\r
+* Routine used to cancel listening for connection requests.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_cm_cancel(\r
+ IN const ib_listen_handle_t h_cm_listen,\r
+ IN const ib_pfn_destroy_cb_t pfn_destroy_cb OPTIONAL );\r
+/*\r
+* PARAMETERS\r
+* h_cm_listen\r
+* [in] A handle to an existing listen request.\r
+*\r
+* pfn_destroy_cb\r
+* [in] A user-specified callback that is invoked after the listen\r
+* request has been successfully canceled.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The cancel listen operation was initiated.\r
+*\r
+* IB_INVALID_HANDLE\r
+* The connection manager handle was invalid.\r
+*\r
+* NOTES\r
+* This routine cancels a listen request. To avoid a race condition\r
+* canceling a request at the same time a connection callback is in\r
+* progress, the cancel operation operates asynchronously. For\r
+* additional details see ib_pfn_destroy_cb_t.\r
+*\r
+* SEE ALSO\r
+* ib_cm_listen, ib_pfn_destroy_cb_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_cm_req\r
+* NAME\r
+* ib_cm_req\r
+*\r
+* DESCRIPTION\r
+* Issues a connection request to a specified end-point.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_cm_req(\r
+ IN const ib_cm_req_t* const p_cm_req );\r
+/*\r
+* PARAMETERS\r
+* p_cm_req\r
+* [in] Information describing the type of connection and the remote\r
+* endpoint for the connection.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The connection request was initiated.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the connect request information was not provided.\r
+*\r
+* IB_INVALID_SETTING\r
+* The connect request information contains one or more of the following\r
+* errors:\r
+* - The class version, queue pair type, or path is not supported by\r
+* connection manager.\r
+* - The private data length exceeds the value allowed by the specified\r
+* connection class version.\r
+* - The primary path is not on the same channel adapter as the queue\r
+* pair.\r
+* - The primary and alternate paths are on different channel adapters.\r
+* - The primary and alternate paths specify different MTUs.\r
+* - A primary or alternate path record packet lifetime is out of range.\r
+* - A primary or alternate path record pkey is out of range.\r
+*\r
+* IB_INVALID_QP_HANDLE\r
+* The queue pair handle specified in the connect request was invalid.\r
+*\r
+* IB_INVALID_AL_HANDLE\r
+* The access layer handle was invalid.\r
+*\r
+* IB_INVALID_STATE\r
+* The queue pair or end-to-end context is already connected.\r
+*\r
+* IB_INVALID_QP_STATE\r
+* The queue pair was in an invalid state to perform the operation.\r
+*\r
+* IB_INSUFFICIENT_MEMORY\r
+* There was insufficient memory to initiate the connect request.\r
+*\r
+* NOTES\r
+* This routine issues a connection request through the communication\r
+* manager to a specified end-point. The p_cm_req parameter contains\r
+* details needed to form the connection. The connection request will\r
+* match with a remote ib_cm_listen or ib_cm_req connection request.\r
+*\r
+* SEE ALSO\r
+* ib_cm_req_t, ib_cm_listen, ib_pfn_cm_req_cb_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_cm_rep\r
+* NAME\r
+* ib_cm_rep\r
+*\r
+* DESCRIPTION\r
+* Sends a reply to a connection request, indicating that the connection\r
+* has been accepted.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_cm_rep(\r
+ IN const ib_cm_handle_t h_cm_req,\r
+ IN const ib_cm_rep_t* const p_cm_rep );\r
+/*\r
+* PARAMETERS\r
+* h_cm_req\r
+* [in] A handle to the connection request being replied to. This handle\r
+* is provided by the access layer through the ib_pfn_cm_req_cb_t\r
+* callback.\r
+*\r
+* p_cm_rep\r
+* [in] Contains reply information to return to the initiator of the\r
+* connection request.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The connection reply was initiated.\r
+*\r
+* IB_INVALID_HANDLE\r
+* The connection manager request handle was invalid.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the reply information was not provided.\r
+*\r
+* IB_INVALID_STATE\r
+* The current connection state does not allow sending this message.\r
+*\r
+* IB_INVALID_SETTING\r
+* The connect reply information contains one or more of the following\r
+* errors:\r
+* - The class version, queue pair type, or path is not supported by\r
+* connection manager.\r
+* - The private data length exceeds the value allowed by the connection\r
+* class version.\r
+* - The primary path is not on the same channel adapter as the queue\r
+* pair.\r
+* - The primary and alternate paths are on different channel adapters.\r
+* - The primary and alternate paths specify different MTUs.\r
+* - A primary or alternate path record packet lifetime is out of range.\r
+* - A primary or alternate path record pkey is out of range.\r
+* - The specified private data length is invalid.\r
+*\r
+* IB_INVALID_QP_HANDLE\r
+* The queue pair handle specified in the reply was invalid.\r
+*\r
+* IB_INVALID_QP_STATE\r
+* The queue pair was in an invalid state to perform the operation.\r
+*\r
+* IB_INSUFFICIENT_MEMORY\r
+* There was insufficient memory to send the connect reply.\r
+*\r
+* NOTES\r
+* This routine results in the access layer replying to a connection\r
+* request from a remote node. This call results in sending a response\r
+* to the requesting node that the request has been accepted.\r
+*\r
+* SEE ALSO\r
+* ib_cm_rep_t, ib_pfn_cm_req_cb_t, ib_pfn_cm_rep_cb_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_cm_rtu\r
+* NAME\r
+* ib_cm_rtu\r
+*\r
+* DESCRIPTION\r
+* Sends a ready to use message for a connection request, indicating that\r
+* the connection has been accepted and is ready for use.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_cm_rtu(\r
+ IN const ib_cm_handle_t h_cm_rep,\r
+ IN const ib_cm_rtu_t* const p_cm_rtu );\r
+/*\r
+* PARAMETERS\r
+* h_cm_rep\r
+* [in] A handle to the connection reply being responded to. This handle\r
+* is provided by the access layer through the ib_pfn_cm_rep_cb_t\r
+* callback.\r
+*\r
+* p_cm_rtu\r
+* [in] Contains ready to use information to return to the sender of the\r
+* connection reply.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The connection ready to use was initiated.\r
+*\r
+* IB_INVALID_HANDLE\r
+* The connection manager reply handle was invalid.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the ready to use information was not provided.\r
+*\r
+* IB_INVALID_STATE\r
+* The current connection state does not allow sending this message.\r
+*\r
+* IB_INVALID_SETTING\r
+* The specified queue pair attributes were invalid or the private data\r
+* length exceeds the value allowed by the specified connection class\r
+* version.\r
+*\r
+* IB_UNSUPPORTED\r
+* The specified queue pair access control was not supported.\r
+*\r
+* IB_INSUFFICIENT_MEMORY\r
+* There was insufficient memory to send the ready to use response.\r
+*\r
+* NOTES\r
+* This routine results in the access layer marking a connection as ready\r
+* to use and notifying the remote end-point.\r
+*\r
+* SEE ALSO\r
+* ib_cm_rep_t, ib_pfn_cm_rep_cb_t, ib_cm_rtu_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_cm_rej\r
+* NAME\r
+* ib_cm_rej\r
+*\r
+* DESCRIPTION\r
+* Rejects a connection request from a remote end-point.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_cm_rej(\r
+ IN const ib_cm_handle_t h_cm,\r
+ IN const ib_cm_rej_t* const p_cm_rej );\r
+/*\r
+* PARAMETERS\r
+* h_cm\r
+* [in] A handle to the connection request or reply being rejected.\r
+* This is the h_cm_req or h_cm_rep handle provided through the\r
+* ib_pfn_cm_req_cb_t or ib_pfn_cm_rep_cb_t callback, respectively.\r
+*\r
+* p_cm_rej\r
+* [in] Contains the connection rejection information to return to the\r
+* connecting end-point.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The connection reject was initiated.\r
+*\r
+* IB_INVALID_HANDLE\r
+* The connection manager handle was invalid.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the reject information was not provided.\r
+*\r
+* NOTES\r
+* This routine results in the access layer rejecting a connection\r
+* and notifying the remote end-point.\r
+*\r
+* SEE ALSO\r
+* ib_pfn_cm_req_cb_t, ib_pfn_cm_rep_cb_t, ib_cm_rej_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_cm_mra\r
+* NAME\r
+* ib_cm_mra\r
+*\r
+* DESCRIPTION\r
+* Notifies the remote end-point of a connection or load alternate path\r
+* request that the request message has been received, but additional\r
+* processing is required.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_cm_mra(\r
+ IN const ib_cm_handle_t h_cm,\r
+ IN const ib_cm_mra_t* const p_cm_mra );\r
+/*\r
+* PARAMETERS\r
+* h_cm\r
+* [in] A handle to the connection request, connection reply, or load\r
+* alternate path request that should receive the message received\r
+* acknowledgement message. This is the h_cm_req, h_cm_rep, or\r
+* h_cm_lap handle provided through the ib_pfn_cm_req_cb_t,\r
+* ib_pfn_cm_rep_cb_t, or ib_pfn_cm_lap_cb_t callback, respectively.\r
+*\r
+* p_cm_mra\r
+* [in] Contains the message received acknowledgement data to return to\r
+* the requesting end-point.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The message receive acknowledge was sent successfully.\r
+*\r
+* IB_INVALID_HANDLE\r
+* The connection manager reply handle was invalid.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the message receive acknowledge information was not\r
+* provided.\r
+*\r
+* IB_INVALID_STATE\r
+* The current connection state does not allow sending this message.\r
+*\r
+* IB_INVALID_SETTING\r
+* The class version is not supported by connection manager or the\r
+* specified private data length is invalid.\r
+*\r
+* IB_INSUFFICIENT_MEMORY\r
+* There was insufficient memory to send the message receive acknowledge.\r
+*\r
+* NOTES\r
+* This routine results in the access layer acknowledging a connection or\r
+* load alternate path message. It should be invoked by a client if the\r
+* client is unable to respond to a request within a specified timeout,\r
+* in order to prevent the remote end-point from timing out.\r
+*\r
+* SEE ALSO\r
+* ib_pfn_cm_req_cb_t, ib_pfn_cm_rep_cb_t, ib_pfn_cm_lap_cb_t, ib_cm_mra_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_cm_lap\r
+* NAME\r
+* ib_cm_lap\r
+*\r
+* DESCRIPTION\r
+* Issues a load alternate path request to a specified end-point.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_cm_lap(\r
+ IN const ib_cm_lap_t* const p_cm_lap );\r
+/*\r
+* PARAMETERS\r
+* p_cm_lap\r
+* [in] Information describing the alternate path to load and the remote\r
+* endpoint for the connection.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The load alternate path request was sent successfully.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the load alternate path information was not provided.\r
+*\r
+* IB_UNSUPPORTED\r
+* The passive side of the connection attempted to load an alternate path.\r
+*\r
+* IB_INVALID_STATE\r
+* The current connection state does not allow sending this message.\r
+*\r
+* IB_INVALID_SETTING\r
+* The load alternate path information contains one or more of the\r
+* following errors:\r
+* - The class version, queue pair type, or path is not supported by\r
+* connection manager.\r
+* - The primary path is not on the same channel adapter as the queue\r
+* pair.\r
+* - The primary and alternate paths are on different channel adapters.\r
+* - The primary and alternate paths specify different MTUs.\r
+* - The alternate path record packet lifetime is out of range.\r
+* - The alternate path record pkey is out of range.\r
+* - The specified private data length is invalid.\r
+*\r
+* IB_INVALID_QP_HANDLE\r
+* The queue pair handle specified in the load alternate path information\r
+* was invalid.\r
+*\r
+* IB_INSUFFICIENT_MEMORY\r
+* There was insufficient memory to send the load alternate path request.\r
+*\r
+* NOTES\r
+* This routine issues initiates loading an alternate path on an existing\r
+* connected queue pair or end-to-end context. If the request is successful,\r
+* the alternate path will be loaded and armed for path migration.\r
+*\r
+* The p_cm_lap parameter describes the alternate path to load and indicates\r
+* the remote endpoint of an existing connection that will receive the load\r
+* request.\r
+*\r
+* SEE ALSO\r
+* ib_cm_apr, ib_cm_lap_t, ib_pfn_cm_lap_cb_t, ib_pfn_cm_apr_cb_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_cm_apr\r
+* NAME\r
+* ib_cm_apr\r
+*\r
+* DESCRIPTION\r
+* Responds to a load alternate path request, to accept or reject the\r
+* proposed alternate path.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_cm_apr(\r
+ IN const ib_cm_handle_t h_cm_lap,\r
+ IN const ib_cm_apr_t* const p_cm_apr );\r
+/*\r
+* PARAMETERS\r
+* h_cm_lap\r
+* [in] A handle to a load alternate path request corresponding to the\r
+* response. This handle is provided through the ib_pfn_cm_lap_cb_t.\r
+*\r
+* p_cm_apr\r
+* [in] Information describing the alternate path response. The response\r
+* will accept or reject the load request. If the request is rejected\r
+* this parameter will reference additional rejection information.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The load alternate path response was sent successfully.\r
+*\r
+* IB_INVALID_HANDLE\r
+* The connection manager load alternate path handle was invalid.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the alternate path information was not provided.\r
+*\r
+* IB_INVALID_STATE\r
+* The current connection state does not allow sending this message.\r
+*\r
+* IB_INVALID_SETTING\r
+* The private data length specified in alternate path information is\r
+* invalid.\r
+*\r
+* IB_INVALID_QP_HANDLE\r
+* The queue pair handle specified in the alternate path information\r
+* was invalid.\r
+*\r
+* IB_INSUFFICIENT_MEMORY\r
+* There was insufficient memory to send the alternate path response.\r
+*\r
+* NOTES\r
+* This routine responds to a load alternate path request.\r
+*\r
+* SEE ALSO\r
+* ib_cm_lap, ib_cm_apr_t, ib_pfn_cm_lap_cb_t, ib_pfn_cm_apr_cb_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_force_apm\r
+* NAME\r
+* ib_force_apm\r
+*\r
+* DESCRIPTION\r
+* This routine indicates that a queue pair should immediately migrate to its\r
+* alternate path. All future data transfers will occur over the new path.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_force_apm(\r
+ IN const ib_qp_handle_t h_qp );\r
+/*\r
+* PARAMETERS\r
+* h_qp\r
+* [in] A handle to the queue pair to migrate.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The queue pair or end-to-end context was successfully modified.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* Neither or both of the queue pair or the end-to-end context handles\r
+* were valid.\r
+*\r
+* IB_INVALID_QP_HANDLE\r
+* The queue pair handle was invalid.\r
+*\r
+* IB_INSUFFICIENT_RESOURCES\r
+* There were insufficient resources currently available on the channel\r
+* adapter to register the modify the queue pair or end-to-end context.\r
+*\r
+* IB_UNSUPPORTED\r
+* The requested modification was not supported.\r
+*\r
+* IB_INVALID_QP_STATE\r
+* The queue pair was in an invalid state for the requested operation.\r
+*\r
+* NOTES\r
+* For this routine to operate correctly, the specified queue pair must have\r
+* an existing alternate path loaded. If an alternate path is not loaded, or\r
+* has not yet been armed, this call will fail.\r
+*\r
+* Use of this call results in additional data transfers that occur on the\r
+* given queue pair using the alternate path. Once this call completes, a\r
+* new alternate path may be loaded using the ib_cm_lap call.\r
+*\r
+* SEE ALSO\r
+* ib_cm_lap\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_cm_dreq\r
+* NAME\r
+* ib_cm_dreq\r
+*\r
+* DESCRIPTION\r
+* This routine disconnects a queue pair or end-to-end context.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_cm_dreq(\r
+ IN const ib_cm_dreq_t* const p_cm_dreq );\r
+/*\r
+* PARAMETERS\r
+* p_cm_dreq\r
+* [in] Information that describes the connection being disconnected.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The disconnect request was sent successfully.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the disconnect request information was not provided.\r
+*\r
+* IB_INVALID_STATE\r
+* The current connection state does not allow sending this message.\r
+*\r
+* IB_INVALID_SETTING\r
+* The private data length specified in disconnect request information is\r
+* invalid.\r
+*\r
+* IB_INVALID_QP_HANDLE\r
+* The queue pair handle specified in the disconnect request information\r
+* was invalid.\r
+*\r
+* IB_INSUFFICIENT_MEMORY\r
+* There was insufficient memory to send the disconnect request.\r
+*\r
+* NOTES\r
+* This function will disconnect a queue pair or end-to-end context.\r
+* It results in sending a disconnection request message to the remote\r
+* end-point. After calling this routine, data transfers on the specified\r
+* queue pair or end-to-end context will fail.\r
+*\r
+* SEE ALSO\r
+* ib_cm_drep, ib_pfn_cm_dreq_cb_t, ib_cm_dreq_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_cm_drep\r
+* NAME\r
+* ib_cm_drep\r
+*\r
+* DESCRIPTION\r
+* This routine replies to a disconnection request and disconnects\r
+* a queue pair or end-to-end context.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_cm_drep(\r
+ IN const ib_cm_handle_t h_cm_dreq,\r
+ IN const ib_cm_drep_t* const p_cm_drep );\r
+/*\r
+* PARAMETERS\r
+* h_cm_dreq\r
+* [in] A handle to a disconnection request being replied to. This\r
+* handle is provided through the ib_pfn_cm_dreq_cb_t callback.\r
+*\r
+* p_cm_drep\r
+* [in] Reply information used to respond to the disconnection request.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The disconnect request was sent successfully.\r
+*\r
+* IB_INVALID_HANDLE\r
+* The connection manager disconnect request handle was invalid.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the disconnect repy information was not provided.\r
+*\r
+* IB_INVALID_STATE\r
+* The current connection state does not allow sending this message.\r
+*\r
+* IB_INVALID_SETTING\r
+* The private data length specified in disconnect reply information is\r
+* invalid.\r
+*\r
+* IB_INSUFFICIENT_MEMORY\r
+* There was insufficient memory to send the disconnect reply.\r
+*\r
+* NOTES\r
+* This function will disconnect a queue pair or end-to-end context. It\r
+* results in sending a disconnection reply message to the remote end-point.\r
+* After calling this routine, data transfers on the specified queue pair or\r
+* end-to-end context will fail.\r
+*\r
+* SEE ALSO\r
+* ib_cm_dreq, ib_pfn_cm_dreq_cb_t, ib_cm_drep_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_cm_handoff\r
+* NAME\r
+* ib_cm_handoff\r
+*\r
+* DESCRIPTION\r
+* Hands off the received REQ information to svc_id.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_cm_handoff(\r
+ IN const ib_cm_handle_t h_cm_req,\r
+ IN const ib_net64_t svc_id );\r
+/*\r
+* PARAMETERS\r
+* h_cm_req\r
+* [in] A handle to the connection request being handed off.\r
+* This is the h_cm_req handle provided through the ib_pfn_cm_req_cb_t\r
+* callback.\r
+*\r
+* svc_id\r
+* [in] The service id to which this connection request is handed off.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The handoff was initiated.\r
+*\r
+* IB_INVALID_HANDLE\r
+* The connection manager handle was invalid.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A valid service id was not provided.\r
+*\r
+* IB_INVALID_STATE\r
+* The current connection state does not allow this transfer.\r
+*\r
+* IB_INSUFFICIENT_MEMORY\r
+* There was insufficient memory to complete the request.\r
+*\r
+* NOTES\r
+* This routine results in the access layer handing off the connection\r
+* to the service id as a new incoming connection.\r
+*\r
+* SEE ALSO\r
+* ib_pfn_cm_req_cb_t, ib_cm_rej_t, ib_cm_listen\r
+*****/\r
+\r
+\r
+/****s* Access Layer/ib_cep_listen_t\r
+* NAME\r
+* ib_cep_listen_t\r
+*\r
+* DESCRIPTION\r
+* Request to listen for incoming connection attempts.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_cep_listen\r
+{\r
+ net64_t svc_id;\r
+\r
+ net64_t port_guid;\r
+\r
+ uint8_t* __ptr64 p_cmp_buf;\r
+ uint8_t cmp_len;\r
+ uint8_t cmp_offset;\r
+\r
+} ib_cep_listen_t;\r
+/*\r
+* FIELDS\r
+* svc_id\r
+* The identifier of the service to register for incoming connection\r
+* requests.\r
+*\r
+* port_guid\r
+* Directs the communication manager to register the listen only\r
+* with the specified port. This should be set to IB_ALL_PORTS\r
+* if the listen is not directed to a particular port.\r
+*\r
+* p_cmp_buf\r
+* An optionally provided buffer that will be used to match incoming\r
+* connection requests with a registered service. Use of this buffer\r
+* permits multiple services to listen on the same service ID as long as\r
+* they provide different compare buffers. Incoming requests will\r
+* be matched against the compare buffer.\r
+*\r
+* cmp_len\r
+* Specifies the size of the compare buffer in bytes. The length must\r
+* be the same for all requests using the same service ID.\r
+*\r
+* cmp_offset\r
+* An offset into the user-defined data area of a connection request\r
+* which contains the start of the data that will be compared against.\r
+* The offset must be the same for all requests using the same service ID.\r
+*\r
+* NOTES\r
+* Users fill out this structure when listening on a service ID with the\r
+* local communication manager. The communication manager will use the given\r
+* service ID and compare buffer to route connection requests to the\r
+* appropriate client. Users may direct listens requests on a particular\r
+* channel adapter, port, or LID.\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_create_ioc\r
+* NAME\r
+* ib_create_ioc\r
+*\r
+* DESCRIPTION\r
+* Creates an instance of an I/O controller.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_create_ioc(\r
+ IN const ib_ca_handle_t h_ca,\r
+ IN const ib_ioc_profile_t* const p_ioc_profile,\r
+ OUT ib_ioc_handle_t* const ph_ioc );\r
+/*\r
+* PARAMETERS\r
+* h_ca\r
+* [in] A handle to an opened channel adapter. The controller will be\r
+* created to be exposed through the given adapter.\r
+*\r
+* p_ioc_profile\r
+* [in] I/O controller profile information.\r
+*\r
+* ph_ioc\r
+* [out] Upon successful completion of this call, this references a\r
+* handle to the created I/O controller. This handle may be used to\r
+* add service entries to the controller and register it.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The I/O controller was successfully created.\r
+*\r
+* IB_INVALID_CA_HANDLE\r
+* The channel adapter handle was invalid.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the I/O controller profile information or handle\r
+* was not provided.\r
+*\r
+* IB_INSUFFICIENT_MEMORY\r
+* There was insufficient memory to create the I/O controller.\r
+*\r
+* NOTES\r
+* This routine creates an I/O controller. Once created, services may be\r
+* added to the controller before being registered with the local device\r
+* manager.\r
+*\r
+* SEE ALSO\r
+* ib_destroy_ioc, ib_add_svc_entry, ib_reg_ioc, ib_ioc_profile_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_destroy_ioc\r
+* NAME\r
+* ib_destroy_ioc\r
+*\r
+* DESCRIPTION\r
+* Destroys an instance of an I/O controller.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_destroy_ioc(\r
+ IN const ib_ioc_handle_t h_ioc );\r
+/*\r
+* PARAMETERS\r
+* h_ioc\r
+* [in] A handle to an existing I/O controller.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The I/O controller was successfully destroyed.\r
+*\r
+* IB_INVALID_HANDLE\r
+* The I/O controller handle was invalid.\r
+*\r
+* NOTES\r
+* Once an I/O controller is destroyed, it is no longer reported by the\r
+* local device manager as an exported device. This routine automatically\r
+* removes all services associated with the controller.\r
+*\r
+* SEE ALSO\r
+* ib_create_ioc\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_reg_ioc\r
+* NAME\r
+* ib_reg_ioc\r
+*\r
+* DESCRIPTION\r
+* Registers an I/O controller with the local device manager, which will\r
+* export the controller to the fabric.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_reg_ioc(\r
+ IN const ib_ioc_handle_t h_ioc );\r
+/*\r
+* PARAMETERS\r
+* h_ioc\r
+* [in] A handle to the controller being registered.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The I/O controller was successfully registered.\r
+*\r
+* IB_INSUFFICIENT_MEMORY\r
+* There was insufficient memory to register the I/O controller.\r
+*\r
+* IB_INSUFFICIENT_RESOURCES\r
+* There were insufficient resources currently available on the I/O\r
+* unit to register the I/O controller.\r
+*\r
+* IB_INVALID_HANDLE\r
+* The I/O controller handle was invalid.\r
+*\r
+* NOTES\r
+* This routine registers an I/O controller with the local device manager.\r
+* The device manager exports the controller to the fabric as part of an\r
+* I/O unit. Typically, clients will call ib_add_svc_entry to add services\r
+* to the controller before registering it with the device manager.\r
+*\r
+* SEE ALSO\r
+* ib_create_ioc, ib_destroy_ioc, ib_add_svc_entry\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_add_svc_entry\r
+* NAME\r
+* ib_add_svc_entry\r
+*\r
+* DESCRIPTION\r
+* Adds a new service entry to an existing I/O controller.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_add_svc_entry(\r
+ IN const ib_ioc_handle_t h_ioc,\r
+ IN const ib_svc_entry_t* const p_svc_entry,\r
+ OUT ib_svc_handle_t* const ph_svc );\r
+/*\r
+* PARAMETERS\r
+* h_ioc\r
+* [in] A handle to an existing I/O controller that will support the\r
+* added service.\r
+*\r
+* p_svc_entry\r
+* [in] Service entry information that will be reported as part of the\r
+* controller's service profile.\r
+*\r
+* ph_svc\r
+* [out] Upon successful completion of this call, this references a handle\r
+* to the added service. This handle may be used to remove the service\r
+* entry.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The service entry was successfully added.\r
+*\r
+* IB_INVALID_HANDLE\r
+* The I/O controller handle was invalid.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the service entry information or handle was not\r
+* provided.\r
+*\r
+* IB_INSUFFICIENT_MEMORY\r
+* There was insufficient memory to register the service entry.\r
+*\r
+* IB_INSUFFICIENT_RESOURCES\r
+* There were insufficient resources currently available on the I/O\r
+* controller to register the service entry.\r
+*\r
+* NOTES\r
+* This routine adds a new service to an I/O controller. Once added, the\r
+* service will be reported with the controller profile, provided that the\r
+* controller is registered with the local device manager.\r
+*\r
+* SEE ALSO\r
+* ib_create_ioc, ib_remove_svc_entry, ib_reg_ioc, ib_svc_entry_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_remove_svc_entry\r
+* NAME\r
+* ib_remove_svc_entry\r
+*\r
+* DESCRIPTION\r
+* This removes a service entry from an I/O controller.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_remove_svc_entry(\r
+ IN const ib_svc_handle_t h_svc );\r
+/*\r
+* PARAMETERS\r
+* h_svc\r
+* [in] A handle to an existing service entry.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The service entry was successfully removed.\r
+*\r
+* IB_INVALID_HANDLE\r
+* The service entry handle was invalid.\r
+*\r
+* NOTES\r
+* This routine removes the specified service from its associated I/O\r
+* controller. Once removed, the service information will no longer be\r
+* exported along with the controller.\r
+*\r
+* SEE ALSO\r
+* ib_add_svc_entry\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_get_ca_guids\r
+* NAME\r
+* ib_get_ca_guids\r
+*\r
+* DESCRIPTION\r
+* Returns a list of GUIDS for all channel adapter currently available in\r
+* the system.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_get_ca_guids(\r
+ IN ib_al_handle_t h_al,\r
+ OUT ib_net64_t* const p_guid_array OPTIONAL,\r
+ IN OUT size_t* const p_guid_cnt );\r
+/*\r
+* PARAMETERS\r
+* h_al\r
+* [in] A handle to an opened instance of the access layer.\r
+*\r
+* p_guid_array\r
+* [out] An array of GUIDs provided by the user and filled out by the\r
+* access layer. If this parameter is NULL, the access layer will return\r
+* the number of entries in the array necessary to retrieve the GUID list.\r
+*\r
+* p_guid_cnt\r
+* [in/out] On input, this specifies the number of entries in the\r
+* GUID array.\r
+*\r
+* On output, the access layer will set this to the number of valid\r
+* entries in the p_guid_array or the minimum number of entries needed\r
+* in the GUID array in order to return all channel adapter GUIDs.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The operation was successful.\r
+*\r
+* IB_INVALID_AL_HANDLE\r
+* The access layer handle was invalid.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the GUID count was not provided.\r
+*\r
+* IB_INSUFFICIENT_MEMORY\r
+* There was insufficient memory to perform the operation.\r
+*\r
+* NOTES\r
+* This routine returns a list of GUIDs for all available channel adapters.\r
+* When called, the access layer will examine p_guid_cnt to determine the\r
+* number of entries available in the p_guid_array. If the count is too\r
+* small, the function will return IB_INSUFFICIENT_MEMORY, and set p_guid_cnt\r
+* to the number of needed entries.\r
+*\r
+* SEE ALSO\r
+* ib_open_al, ib_open_ca\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_get_ca_by_gid\r
+* NAME\r
+* ib_get_ca_by_gid\r
+*\r
+* DESCRIPTION\r
+* Returns the GUID of a channel adapter contain the given port GID.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_get_ca_by_gid(\r
+ IN ib_al_handle_t h_al,\r
+ IN const ib_gid_t* const p_gid,\r
+ OUT ib_net64_t* const p_ca_guid );\r
+/*\r
+* PARAMETERS\r
+* h_al\r
+* [in] A handle to an opened instance of the access layer.\r
+*\r
+* p_gid\r
+* [in] A port GID.\r
+*\r
+* p_ca_guid\r
+* [out] A GUID to the CA that contains the port matching the user-\r
+* specified GID.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The operation was successful.\r
+*\r
+* IB_INVALID_AL_HANDLE\r
+* The access layer handle was invalid.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the port GID or CA GUID was not provided.\r
+*\r
+* IB_INSUFFICIENT_MEMORY\r
+* There was insufficient memory to perform the operation.\r
+*\r
+* IB_NOT_FOUND\r
+* No channel adapters in the system contain the specifed port GID.\r
+*\r
+* NOTES\r
+* This routine returns a CA GUID that contains the user-specified port GID.\r
+* If no channel adapters in the system contain the port GID, the call will\r
+* return IB_NOT_FOUND.\r
+*\r
+* SEE ALSO\r
+* ib_open_al, ib_open_ca, ib_get_ca_guids\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_get_port_by_gid\r
+* NAME\r
+* ib_get_port_by_gid\r
+*\r
+* DESCRIPTION\r
+* Returns the GUID of a port that contains the given port GID.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_get_port_by_gid(\r
+ IN ib_al_handle_t h_al,\r
+ IN const ib_gid_t* const p_gid,\r
+ OUT ib_net64_t* const p_port_guid );\r
+/*\r
+* PARAMETERS\r
+* h_al\r
+* [in] A handle to an opened instance of the access layer.\r
+*\r
+* p_gid\r
+* [in] A port GID.\r
+*\r
+* p_port_guid\r
+* [out] A GUID to the port that contains the matching user-\r
+* specified GID.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The operation was successful.\r
+*\r
+* IB_INVALID_AL_HANDLE\r
+* The access layer handle was invalid.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the port GID or port GUID was not provided.\r
+*\r
+* IB_INSUFFICIENT_MEMORY\r
+* There was insufficient memory to perform the operation.\r
+*\r
+* IB_NOT_FOUND\r
+* No channel adapters in the system contain the specifed port GID.\r
+*\r
+* NOTES\r
+* This routine returns a port GUID that contains the user-specified port GID.\r
+* If no channel adapters in the system contain the port GID, the call will\r
+* return IB_NOT_FOUND.\r
+*\r
+* SEE ALSO\r
+* ib_open_al, ib_open_ca, ib_get_ca_guids\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_pfn_mad_comp_cb_t\r
+* NAME\r
+* ib_pfn_mad_comp_cb_t\r
+*\r
+* DESCRIPTION\r
+* User-defined callback used to notify the user of a completion for a\r
+* sent or received datagram.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef void\r
+(AL_API * __ptr64 ib_pfn_mad_comp_cb_t)(\r
+ IN const ib_mad_svc_handle_t h_mad_svc,\r
+ IN void *mad_svc_context,\r
+ IN ib_mad_element_t *p_mad_element );\r
+/*\r
+* PARAMETERS\r
+* h_mad_svc\r
+* [in] Handle to the MAD service on which the completion occured.\r
+*\r
+* mad_svc_context\r
+* [in] User-defined context information associated with the MAD service\r
+* on which the completion occurred.\r
+*\r
+* p_mad_element\r
+* [in] References information on the completed MAD request.\r
+*\r
+* NOTES\r
+* This function is invoked upon completion of a sent or receive MAD.\r
+* It is separate from the normal completion callbacks in order to allow\r
+* the access layer to perform post processing on the MAD, such as\r
+* segmentation and reassembly, and retransmissions if a response was\r
+* expected.\r
+*\r
+* The mad element returned through this call should be returned to its MAD\r
+* pool after completion processing on the MAD has concluded. Completed\r
+* receive MAD elements should not be reposted to the receive queue of a\r
+* MAD QP.\r
+*\r
+* In the kernel, this callback is typically invoked from within a\r
+* tasklet, depending on the implementation of the verbs provider driver.\r
+*\r
+* SEE ALSO\r
+* ib_send_mad, ib_reg_mad_svc\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_create_mad_pool\r
+* NAME\r
+* ib_create_mad_pool\r
+*\r
+* DESCRIPTION\r
+* Creates a pool of MAD elements for use sending and receive management\r
+* datagrams.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_create_mad_pool(\r
+ IN const ib_al_handle_t h_al,\r
+ IN const size_t min,\r
+ IN const size_t max,\r
+ IN const size_t grow_size,\r
+ OUT ib_pool_handle_t* const ph_pool );\r
+/*\r
+* PARAMETERS\r
+* h_al\r
+* [in] A handle to an open instance of the access layer.\r
+*\r
+* min\r
+* [in] The minimum number of MAD elements to create in the pool.\r
+*\r
+* max\r
+* [in] The maximum number of MAD elements that will be created by the\r
+* pool. If max is set to 0, the pool will continue to grow as long\r
+* as system resources are available.\r
+*\r
+* grow_size\r
+* [in] The number of MAD elements to add to the pool when growing it.\r
+* If set to 0, the pool will not grow beyond the number specified\r
+* at creation. This value must be greater than 0, if min is set to 0.\r
+*\r
+* ph_pool\r
+* [out] On successful completion of this call, this returns a handle to\r
+* the newly created pool.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The MAD pool was created successfully.\r
+*\r
+* IB_INVALID_AL_HANDLE\r
+* The access layer handle was invalid.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the pool handle was not provided.\r
+*\r
+* IB_INVALID_SETTING\r
+* The maximum number of MAD elements was non-zero and less than the\r
+* minimum number of MAD elements.\r
+*\r
+* IB_INSUFFICIENT_MEMORY\r
+* There was insufficient memory to create the MAD pool.\r
+*\r
+* NOTES\r
+* This routine creates a pool of MAD elements. The elements may be used\r
+* to send and receive MADs on alias and MAD type QPs.\r
+*\r
+* SEE ALSO\r
+* ib_destroy_mad_pool, ib_get_mad, ib_put_mad, ib_reg_mad_pool,\r
+* ib_dereg_mad_pool\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_destroy_mad_pool\r
+* NAME\r
+* ib_destroy_mad_pool\r
+*\r
+* DESCRIPTION\r
+* Destroys a MAD pool and all associated resources.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_destroy_mad_pool(\r
+ IN const ib_pool_handle_t h_pool );\r
+/*\r
+* PARAMETERS\r
+* h_pool\r
+* [in] A handle to a MAD pool allocated through the ib_create_mad_pool\r
+* routine.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The MAD pool was successfully destroyed.\r
+*\r
+* IB_INVALID_HANDLE\r
+* The MAD pool handle was invalid.\r
+*\r
+* IB_RESOURCE_BUSY\r
+* One or more MAD elements have not been returned to the MAD pool.\r
+*\r
+* NOTES\r
+* This call destroys a MAD pool and all resources allocated by the pool.\r
+*\r
+* SEE ALSO\r
+* ib_create_mad_pool, ib_get_mad, ib_put_mad\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_reg_mad_pool\r
+* NAME\r
+* ib_reg_mad_pool\r
+*\r
+* DESCRIPTION\r
+* Registers a MAD pool for use with a protection domain.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_reg_mad_pool(\r
+ IN const ib_pool_handle_t h_pool,\r
+ IN const ib_pd_handle_t h_pd,\r
+ OUT ib_pool_key_t* const p_pool_key );\r
+/*\r
+* PARAMETERS\r
+* h_pool\r
+* [in] A handle to a MAD pool.\r
+*\r
+* h_pd\r
+* [in] A handle to a protection domain.\r
+*\r
+* p_pool_key\r
+* [out] A key associated with registering the MAD pool with the\r
+* protection domain. This key is returned to the user and is used\r
+* when retrieving MADs from the pool.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The MAD pool was successfully registered with the protection domain.\r
+*\r
+* IB_INVALID_HANDLE\r
+* The MAD pool handle was invalid.\r
+*\r
+* IB_INVALID_PD_HANDLE\r
+* The protection domain handle was invalid.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the pool key was not provided.\r
+*\r
+* IB_INSUFFICIENT_MEMORY\r
+* There was insufficient memory to register the MAD pool.\r
+*\r
+* IB_INSUFFICIENT_RESOURCES\r
+* There were insufficient resources currently available on the channel\r
+* adapter to register the MAD pool.\r
+*\r
+* NOTES\r
+* This function registers a MAD pool with a protection domain. After\r
+* successful completion of this call, the MAD elements of the associated\r
+* pool are usable on any queue pairs associated with the given protection\r
+* domain.\r
+*\r
+* SEE ALSO\r
+* ib_create_mad_pool, ib_destroy_mad_pool, ib_dereg_mad_pool, ib_get_mad\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_dereg_mad_pool\r
+* NAME\r
+* ib_dereg_mad_pool\r
+*\r
+* DESCRIPTION\r
+* Deregisters a MAD pool from a protection domain.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_dereg_mad_pool(\r
+ IN const ib_pool_key_t pool_key );\r
+/*\r
+* PARAMETERS\r
+* pool_key\r
+* [in] Key to the MAD pool to deregister. The specified pool must\r
+* have been registered with a protection domain through a call to\r
+* ib_reg_mad_pool.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The MAD pool was successfully deregistered from the protection domain.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* The MAD pool key was invalid.\r
+*\r
+* IB_RESOURCE_BUSY\r
+* One or more MAD elements were removed from the MAD pool using the\r
+* specified pool key, and were not returned.\r
+*\r
+* NOTES\r
+* This function deregisters a MAD pool with a protection domain. After\r
+* successful completion of this call, the MAD elements of the associated\r
+* pool are no longer usable on the protection domain.\r
+*\r
+* SEE ALSO\r
+* ib_create_mad_pool, ib_destroy_mad_pool, ib_reg_mad_pool\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_get_mad\r
+* NAME\r
+* ib_get_mad\r
+*\r
+* DESCRIPTION\r
+* Obtains a MAD element from the pool.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_get_mad(\r
+ IN const ib_pool_key_t pool_key,\r
+ IN const size_t buf_size,\r
+ OUT ib_mad_element_t **pp_mad_element );\r
+/*\r
+* PARAMETERS\r
+* pool_key\r
+* [in] Key for the pool to obtain a MAD element for the desired\r
+* protection domain.\r
+*\r
+* buf_size\r
+* [in] The size of the buffer referenced by the MAD element.\r
+*\r
+* pp_mad_element\r
+* [out] Upon successful completion of this call, this references\r
+* the returned MAD element.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The MAD element was successfully retrieved from the MAD pool.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* The MAD pool key was invalid or a reference to the MAD element\r
+* pointer was not provided.\r
+*\r
+* IB_INSUFFICIENT_MEMORY\r
+* There was insufficient memory to obtain the MAD element.\r
+*\r
+* IB_INSUFFICIENT_RESOURCES\r
+* There were insufficient resources currently available on the channel\r
+* adapter to grow and register the MAD pool.\r
+*\r
+* NOTES\r
+* This function obtains a MAD element containing a data segment\r
+* that references a data buffer for the given pool key. The data buffer\r
+* referenced by the MAD element is zeroed before being returned to the\r
+* user.\r
+*\r
+* It is recommended that elements retrieved from a MAD pool for use on\r
+* the receive queue of a MAD QP have a buffer size of 256 bytes.\r
+*\r
+* For MADs being sent, buf_size should be set to the size of the relevant\r
+* data sent as part of the MAD, and should not include any padding needed\r
+* to make the MAD size a multiple of 256 bytes. For most MADs, buf_size\r
+* may be set equal to the size of the MAD header plus the amount of user\r
+* data transfered as part of the MAD.\r
+*\r
+* SEE ALSO\r
+* ib_put_mad, ib_send_mad, ib_mad_element_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_put_mad\r
+* NAME\r
+* ib_put_mad\r
+*\r
+* DESCRIPTION\r
+* Returns a list of MAD elements to the pool.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_put_mad(\r
+ IN const ib_mad_element_t* p_mad_element_list );\r
+/*\r
+* PARAMETERS\r
+* p_mad_element_list\r
+* [in] A pointer to a list of MAD elements.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The list of MAD elements was successfully returned to the MAD pool.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the MAD element list was not provided.\r
+*\r
+* NOTES\r
+* This function returns a list of MAD elements to the pool.\r
+*\r
+* SEE ALSO\r
+* ib_get_mad, ib_mad_element_t\r
+*****/\r
+\r
+\r
+/****s* Access Layer/ib_dgrm_info_t\r
+* NAME\r
+* ib_dgrm_info_t\r
+*\r
+* DESCRIPTION\r
+* Information specified when initializing a datagram queue pair before its\r
+* first use.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_dgrm_info\r
+{\r
+ ib_net64_t port_guid;\r
+ uint32_t qkey;\r
+ uint16_t pkey_index;\r
+\r
+} ib_dgrm_info_t;\r
+/*\r
+* FIELDS\r
+* port_guid\r
+* Specifies the port that the datagram service will use. This field\r
+* applies only to IB_QPT_UNRELIABLE_DGRM and IB_QPT_MAD QP types.\r
+*\r
+* qkey\r
+* Specifies the qkey that the queue pair will use. Incoming messages\r
+* must have a matching qkey for the message to be accepted by the\r
+* receiving QP.\r
+*\r
+* pkey_index\r
+* Specifies the pkey associated with this queue pair.\r
+*\r
+* SEE ALSO\r
+* ib_init_dgrm_svc\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_init_dgrm_svc\r
+* NAME\r
+* ib_init_dgrm_svc\r
+*\r
+* DESCRIPTION\r
+* Initializes a datagram queue pair for use.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_init_dgrm_svc(\r
+ IN const ib_qp_handle_t h_qp,\r
+ IN const ib_dgrm_info_t* const p_dgrm_info OPTIONAL );\r
+/*\r
+* PARAMETERS\r
+* h_qp\r
+* [in] A handle to an existing queue pair.\r
+*\r
+* p_dgrm_info\r
+* [in] References information needed to configure the queue pair for\r
+* use sending and receiving datagrams. This field is optional for\r
+* IB_QPT_QP0, IB_QPT_QP1 queue pair types and is not used for\r
+* IB_QPT_RAW_IPV6, and IB_QPT_RAW_ETHER queue pair types.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The datagram queue pair was initialized successfully.\r
+*\r
+* IB_INVALID_QP_HANDLE\r
+* The datagram queue pair handle was invalid.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* The queue pair handle was not created as a datagram queue pair type\r
+* or a reference to the datagram service information was not provided.\r
+*\r
+* IB_INVALID_QP_STATE\r
+* The queue pair was in an invalid state for the requested operation.\r
+*\r
+* IB_INSUFFICIENT_MEMORY\r
+* There was insufficient memory to initialize the datagram queue pair.\r
+*\r
+* NOTES\r
+* This call binds the queue pair to a given port and transitions its state\r
+* to ready to send and receive data. A queue pair must be initialized\r
+* before it can be used to send and receive datagrams.\r
+*\r
+* This routine is used to initialize queue pairs of type:\r
+*\r
+* IB_QPT_QP0\r
+* IB_QPT_QP1\r
+* IB_QPT_MAD\r
+* IB_QPT_RAW_IPV6\r
+* IB_QPT_RAW_ETHER\r
+* IB_QPT_UNRELIABLE_DGRM\r
+*\r
+* For IB_QPT_MAD type queue pairs, receive buffers are automatically posted\r
+* by the access layer, however, users must call ib_reg_mad_svc to receive\r
+* MADs. Received MAD elements must be returned to the access layer through\r
+* the ib_put_mad() call.\r
+*\r
+* SEE ALSO\r
+* ib_create_qp, ib_get_spl_qp, ib_dgrm_info_t, ib_reg_mad_svc\r
+*****/\r
+\r
+\r
+/****d* Access Layer/ib_mad_svc_type_t\r
+* NAME\r
+* ib_mad_svc_type_t\r
+*\r
+* DESCRIPTION\r
+* Indicates the type of services provided by a MAD service.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef enum _ib_mad_svc_type\r
+{\r
+ IB_MAD_SVC_DEFAULT = 0,\r
+ IB_MAD_SVC_RMPP,\r
+ IB_MAD_SVC_RAW\r
+\r
+} ib_mad_svc_type_t;\r
+/*\r
+* VALUES\r
+* IB_MAD_SVC_DEFAULT\r
+* Indicates that the access layer will provide all necessary services,\r
+* including retransmissions and RMPP for well-defined management classes.\r
+*\r
+* IB_MAD_SVC_RMPP\r
+* Indicates that the MAD service requires retransmissions and the RMPP\r
+* header is available on all MADs. (The RMPP protocol will be activated\r
+* on a per send basis.) This service type should be used for\r
+* user-defined management classes requiring RMPP.\r
+*\r
+* IB_MAD_SVC_RAW\r
+* Specifies that the MAD service will not perform retransmissions or\r
+* perform RMPP. All MADs received or sent on a MAD service of this type\r
+*\r
+* NOTES\r
+* This enum is used to define the types of MAD services available to users.\r
+*\r
+* SEE ALSO\r
+* ib_mad_svc_t, ib_reg_mad_svc\r
+*****/\r
+\r
+\r
+\r
+/****s* Access Layer/ib_mad_svc_t\r
+* NAME\r
+* ib_mad_svc_t\r
+*\r
+* DESCRIPTION\r
+* Information used to request management datagram support with a queue pair.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_mad_svc\r
+{\r
+ void *mad_svc_context;\r
+ ib_pfn_mad_comp_cb_t pfn_mad_send_cb;\r
+ ib_pfn_mad_comp_cb_t pfn_mad_recv_cb;\r
+\r
+ boolean_t support_unsol;\r
+ uint8_t mgmt_class;\r
+ uint8_t mgmt_version;\r
+ boolean_t method_array[IB_MAX_METHODS];\r
+\r
+ ib_mad_svc_type_t svc_type;\r
+\r
+} ib_mad_svc_t;\r
+/*\r
+* FIELDS\r
+* mad_svc_context\r
+* User-defined context that is returned by the access layer through\r
+* the pfn_mad_send_cb and pfn_mad_recv_cb.\r
+*\r
+* pfn_mad_send_cb\r
+* A send callback that is invoked to notify the user that a send\r
+* operation has completed for a sent MAD.\r
+*\r
+* pfn_mad_recv_cb\r
+* A receive callback that is invoked to notify the user that a MAD\r
+* has been received.\r
+*\r
+* support_unsol\r
+* If set to TRUE, this field indicates that the registering client\r
+* supports processing unsolicited MADs. Unsolicited MADs are\r
+* received MADs that do not have the response bit set. If set to TRUE,\r
+* the following fields are required (must be non-zero): mgmt_class,\r
+* mgmt_version, and method_array.\r
+*\r
+* mgmt_version\r
+* Indicates which version of a management class the client requires\r
+* support for. The access layer distinguishes between clients\r
+* requiring different versions of the same management class.\r
+* This field is ignored if the support_unsol field is set to FALSE.\r
+*\r
+* mgmt_class\r
+* Indicates the management class that should be supported by the\r
+* access layer. This field is ignored if the support_unsol field is\r
+* set to FALSE.\r
+*\r
+* method_array\r
+* An array of 127 entries specifying which methods are supported by\r
+* a client when receiving unsolicited MADs. Each index corresponds to\r
+* a single method, and each entry in the array indicates if the method\r
+* is supported by the client. This field is ignored if the\r
+* support_unsol field is set to FALSE.\r
+*\r
+* svc_type\r
+* Indicates the type of services that should be provided by the MAD\r
+* service.\r
+*\r
+* NOTES\r
+* Clients use this structure to define which management datagram methods\r
+* they support, and the type of support required for each. A received MAD\r
+* is distinguished by the access layer based on the following three fields:\r
+* management class, management version, and method.\r
+*\r
+* Specific combinations of class, version, and method may be registered\r
+* for unsolicited MADs only once. The access layer supports multiple\r
+* clients registering for unsolicited MADs as long as they do not share the\r
+* same methods, class, or version.\r
+*\r
+* The svc_type field can be set by a client to indicate that the access\r
+* layer should invoke RMPP for the specified management class of MADs. If\r
+* set to IB_MAD_SVC_DEFAULT, the access layer will automatically invoke RMPP\r
+* for well known MAD classes (those defined by the 1.1 version of the\r
+* InfiniBand specification). The svc_type field is intended to be used by\r
+* clients sending and receiving vendor specific management class requiring\r
+* RMPP and clients providing their own MAD services.\r
+*\r
+* SEE ALSO\r
+* ib_reg_mad_svc, ib_pfn_mad_send_cb_t, ib_pfn_mad_recv_cb_t,\r
+* ib_mad_svc_type_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_reg_mad_svc\r
+* NAME\r
+* ib_reg_mad_svc\r
+*\r
+* DESCRIPTION\r
+* Requests management datagram support for a specified class with a\r
+* queue pair.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_reg_mad_svc(\r
+ IN const ib_qp_handle_t h_qp,\r
+ IN const ib_mad_svc_t* const p_mad_svc,\r
+ OUT ib_mad_svc_handle_t* const ph_mad_svc );\r
+/*\r
+* PARAMETERS\r
+* h_qp\r
+* [in] A handle to queue pair. The queue pair must have been created\r
+* as one of the following types: IB_QPT_QP0, IB_QPT_QP0_ALIAS,\r
+* IB_QPT_QP1, IB_QPT_QP1_ALIAS, or IB_QPT_MAD.\r
+*\r
+* p_mad_svc\r
+* [in] A reference to the management class and methods supported by\r
+* this queue pair.\r
+*\r
+* ph_mad_svc\r
+* [out] On successful completion of this call, this references a\r
+* handle to the newly created MAD service.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The queue pair was registered successfully.\r
+*\r
+* IB_INVALID_QP_HANDLE\r
+* The queue pair handle was invalid.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* The queue pair handle was not created with the proper queue pair\r
+* type or a reference to the MAD service information or handle was\r
+* not provided.\r
+*\r
+* IB_INSUFFICIENT_MEMORY\r
+* There was insufficient memory to register the queue pair.\r
+*\r
+* NOTES\r
+* This routine registers a queue pair as using a particular management\r
+* class. This indicates that the access layer should perform additional\r
+* processing on MADs sent and received by this queue pair. Queue pairs\r
+* registered for MAD support receive access layer SAR and retransmissions\r
+* services. A queue pair may be registered for multiple management classes.\r
+*\r
+* SEE ALSO\r
+* ib_create_qp, ib_mad_svc_t\r
+*****/\r
+\r
+/****s* Access Layer/ib_reg_svc_rec_t\r
+* NAME\r
+* _ib_reg_svc_rec_t\r
+*\r
+* DESCRIPTION\r
+* Information returned as a result of registering a service with the subnet\r
+* administrator. This includes name service registration.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_reg_svc_rec\r
+{\r
+ const void* __ptr64 svc_context;\r
+ ib_reg_svc_handle_t h_reg_svc;\r
+ ib_api_status_t req_status;\r
+ ib_net16_t resp_status;\r
+ ib_service_record_t svc_rec;\r
+\r
+} ib_reg_svc_rec_t;\r
+/*\r
+* FIELDS\r
+* svc_context\r
+* User-defined context information associated with the registration\r
+* through the ib_reg_svc call.\r
+*\r
+* req_status\r
+* Indicates the success of the registration operation.\r
+*\r
+* resp_status\r
+* Indicates the status of the response from the SA\r
+*\r
+* h_reg_svc\r
+* For successful queries, this references the first record of\r
+* information returned by the subnet administrator. If multiple\r
+* records of information were returned, the ib_reg_svc_rec_t will\r
+* be chained together.\r
+*\r
+* svc_rec\r
+* The service record returned by the SA for the registered service.\r
+*\r
+* NOTES\r
+* A query result structure is returned to a client through their\r
+* ib_pfn_query_cb_t routine to notify them of the results of a subnet\r
+* administration query.\r
+*\r
+* SEE ALSO\r
+* ib_reg_svc, ib_pfn_reg_svc_cb_t, ib_reg_svc_status_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_pfn_reg_svc_cb_t\r
+* NAME\r
+* ib_pfn_reg_svc_cb_t\r
+*\r
+* DESCRIPTION\r
+* User-defined callback that is invoked to notify a client of the result\r
+* of a service registration attempt.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef void\r
+(AL_API * __ptr64 ib_pfn_reg_svc_cb_t)(\r
+ IN ib_reg_svc_rec_t *p_reg_svc_rec );\r
+/*\r
+* PARAMETERS\r
+* p_reg_svc_rec\r
+* [in] References the result of the service registration attempt.\r
+*\r
+* NOTES\r
+* The callback is used to notify a client of the result of a service\r
+* registration attempt with the subnet administrator.\r
+*\r
+* In the kernel, this callback is usually invoked using a tasklet, dependent\r
+* on the implementation of the underlying verbs provider driver.\r
+*\r
+* SEE ALSO\r
+* ib_reg_svc, ib_reg_svc_rec_t\r
+*****/\r
+\r
+\r
+/****s* Access Layer/ib_reg_svc_req_t\r
+* NAME\r
+* ib_reg_svc_req_t\r
+*\r
+* DESCRIPTION\r
+* Information used to request that a service be registered with the subnet\r
+* administrator.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_reg_svc_req\r
+{\r
+ ib_service_record_t svc_rec;\r
+ ib_net64_t port_guid;\r
+\r
+ uint32_t timeout_ms;\r
+ uint32_t retry_cnt;\r
+ ib_al_flags_t flags;\r
+\r
+ const void *svc_context;\r
+ ib_net64_t svc_data_mask;\r
+\r
+ ib_pfn_reg_svc_cb_t pfn_reg_svc_cb;\r
+\r
+} ib_reg_svc_req_t;\r
+/*\r
+* FIELDS\r
+* svc_rec\r
+* Service record that describes the service being registered.\r
+*\r
+* port_guid\r
+* Directs the registration to use the specified port. The request will\r
+* contact the management entity reachable through the given port.\r
+*\r
+* timeout_ms\r
+* Specifies the number of milliseconds to wait for a response for\r
+* the registration until retrying or timing out the request.\r
+*\r
+* retry_cnt\r
+* Specifies the number of times that the registration will be retried\r
+* before failing the request.\r
+*\r
+* flags\r
+* Used to describe the mode of operation. Set to IB_FLAGS_SYNC to\r
+* process the called routine synchronously.\r
+*\r
+* svc_context\r
+* User-defined context information associated with this registration\r
+* request. This context is returned to the user through the function\r
+* specified by the pfn_reg_svc_cb field.\r
+*\r
+* svc_data_mask\r
+* User-defined component mask indicating which parts of the private\r
+* data is populated. This is used as an extension to the svc_id\r
+* for data compare. Also used as a cheap way to communicate data\r
+* to all clients for this service.\r
+*\r
+* pfn_reg_svc_cb\r
+* A user-defined callback that is invoked upon completion of the\r
+* registration request.\r
+*\r
+* NOTES\r
+* This structure is used to register a service with the subnet administrator.\r
+* The registration call operates asynchronously unless the flags field is\r
+* set to IB_FLAGS_SYNC. If synchronous operation is indicated, the client\r
+* will receive a callback with the results of the registration attempt\r
+* before the ib_reg_svc call returns. Synchronous operation results in\r
+* the calling thread blocking.\r
+*\r
+* SEE ALSO\r
+* ib_reg_svc, ib_svc_rec_t, ib_pfn_reg_svc_cb_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_reg_svc\r
+* NAME\r
+* ib_reg_svc\r
+*\r
+* DESCRIPTION\r
+* Routine used to register for a service with the subnet administrator.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_reg_svc(\r
+ IN const ib_al_handle_t h_al,\r
+ IN const ib_reg_svc_req_t* const p_reg_svc_req,\r
+ OUT ib_reg_svc_handle_t* const ph_reg_svc );\r
+/*\r
+* PARAMETERS\r
+* h_al\r
+* [in] A handle to an open instance of the access layer.\r
+*\r
+* p_reg_svc_req\r
+* [in] Describes the service to register with the subnet administrator.\r
+*\r
+* ph_reg_svc\r
+* [out] Pointer to a service registration handle, used to deregister\r
+* the service. Set upon successful completion of the function.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The service registration was initiated.\r
+*\r
+* IB_INVALID_AL_HANDLE\r
+* The access layer handle was invalid.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the service registration request was not provided.\r
+*\r
+* IB_INSUFFICIENT_MEMORY\r
+* There was insufficient memory to perform the operation.\r
+*\r
+* IB_NOT_FOUND\r
+* No channel adapters in the system contain the GID specified in the\r
+* service record.\r
+*\r
+* IB_INVALID_GID\r
+* No port was found matching the GID specified in the service record.\r
+*\r
+* IB_INSUFFICIENT_RESOURCES\r
+* There were insufficient resources currently available on the channel\r
+* adapter to perform the operation.\r
+*\r
+* NOTES\r
+* This routine registers a service with the subnet administrator. Registered\r
+* services are reported by the subnet administrator to clients querying the\r
+* subnet administrator for service information.\r
+*\r
+* Once registered, a client will receive notification, via a callback,\r
+* that a service has been successfully registered.\r
+*\r
+* SEE ALSO\r
+* ib_dereg_svc, ib_reg_svc_req_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_dereg_svc\r
+* NAME\r
+* ib_dereg_svc\r
+*\r
+* DESCRIPTION\r
+* Remove a service as being registered with the subnet administrator.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_dereg_svc(\r
+ IN const ib_reg_svc_handle_t h_reg_svc,\r
+ IN const ib_pfn_destroy_cb_t pfn_destroy_cb OPTIONAL );\r
+/*\r
+* PARAMETERS\r
+* h_reg_svc\r
+* [in] A handle to a registered service.\r
+*\r
+* pfn_destroy_cb\r
+* [in] A user-specified callback that is invoked after the service\r
+* has been deregistered.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The service deregistration was initiated.\r
+*\r
+* IB_INVALID_HANDLE\r
+* The registered service handle was invalid.\r
+*\r
+* IB_INSUFFICIENT_MEMORY\r
+* There was insufficient memory to perform the operation.\r
+*\r
+* IB_INSUFFICIENT_RESOURCES\r
+* There were insufficient resources currently available on the channel\r
+* adapter to perform the operation.\r
+*\r
+* NOTES\r
+* This routine deregisters a service with the subnet administrator.\r
+* To avoid a race condition deregistering a service at the same time\r
+* the registration completion callback is in progress, the deregister\r
+* operation operates asynchronously. For additional details see\r
+* ib_pfn_destroy_cb_t.\r
+*\r
+* SEE ALSO\r
+* ib_reg_svc, ib_pfn_destroy_cb_t\r
+*****/\r
+\r
+\r
+/****d* Access Layer/ib_query_type_t\r
+* NAME\r
+* ib_query_type_t\r
+*\r
+* DESCRIPTION\r
+* Abstracted queries supported by the access layer.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef enum _ib_query_type\r
+{\r
+ IB_QUERY_USER_DEFINED,\r
+\r
+ IB_QUERY_ALL_SVC_RECS,\r
+ IB_QUERY_SVC_REC_BY_NAME,\r
+ IB_QUERY_SVC_REC_BY_ID,\r
+\r
+ IB_QUERY_CLASS_PORT_INFO,\r
+\r
+ IB_QUERY_NODE_REC_BY_NODE_GUID,\r
+ IB_QUERY_PORT_REC_BY_LID,\r
+\r
+ IB_QUERY_VLARB_BY_LID_PORT_BLOCK,\r
+ IB_QUERY_SLVL_BY_LID_AND_PORTS,\r
+\r
+ IB_QUERY_PATH_REC_BY_PORT_GUIDS,\r
+ IB_QUERY_PATH_REC_BY_GIDS,\r
+ IB_QUERY_PATH_REC_BY_LIDS,\r
+\r
+} ib_query_type_t;\r
+/*\r
+* VALUES\r
+* IB_QUERY_USER_DEFINED\r
+* Query the SA based on user-defined input. Queries of this type\r
+* should reference an ib_user_query_t structure as input into the\r
+* query.\r
+*\r
+* IB_QUERY_SVC_REC_BY_NAME\r
+* Query for service records based on the service name. Queries of\r
+* this type should reference an ib_svc_name_t structure as input\r
+* into the query.\r
+*\r
+* IB_QUERY_SVC_REC_BY_ID\r
+* Query for service records based on the service ID. Queries of\r
+* this type should reference an ib_net64_t value that indicates the\r
+* ID of the service being requested.\r
+*\r
+* IB_QUERY_NODE_REC_BY_NODE_GUID\r
+* Query for node information based on the node's GUID. Queries of\r
+* this type should reference an ib_net64_t value that indicates the\r
+* GUID of the node being requested.\r
+*\r
+* IB_QUERY_PORT_REC_BY_LID\r
+* Query for port information based on the port's base LID. Queries of\r
+* this type should reference an ib_net16_t value that indicates the\r
+* base LID of the port being requested.\r
+*\r
+* IB_QUERY_PATH_REC_BY_PORT_GUIDS\r
+* Query for path records between the specified pair of port GUIDs.\r
+* Queries of this type should reference an ib_guid_pair_t structure\r
+* that indicates the GUIDs of the path being requested.\r
+*\r
+* IB_QUERY_PATH_REC_BY_GIDS\r
+* Query for path records between the specified pair of port GIDs.\r
+* Queries of this type should reference an ib_gid_pair_t structure\r
+* that indicates the GIDs of the path being requested.\r
+*\r
+* IB_QUERY_PATH_REC_BY_LIDS\r
+* Query for path records between the specified pair of port LIDs.\r
+* Queries of this type should reference an ib_lid_pair_t structure\r
+* that indicates the LIDs of the path being requested.\r
+*\r
+* NOTES\r
+* This enum is used to define abstracted queries provided by the access\r
+* layer. Users may issue queries not listed here by sending MADs directly\r
+* to the subnet administrator or a class manager. These queries are\r
+* intended to represent those most often used by clients.\r
+*\r
+* SEE ALSO\r
+* ib_query, ib_query_req_t, ib_user_query_t, ib_gid_pair_t, ib_lid_pair_t\r
+* ib_guid_pair_t\r
+*****/\r
+\r
+\r
+/****s* Access Layer/ib_user_query_t\r
+* NAME\r
+* ib_user_query_t\r
+*\r
+* DESCRIPTION\r
+* User-defined query information.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_user_query\r
+{\r
+ uint8_t method;\r
+ ib_net16_t attr_id;\r
+ uint32_t attr_size;\r
+ ib_net64_t comp_mask;\r
+ void* __ptr64 p_attr;\r
+\r
+} ib_user_query_t;\r
+/*\r
+* FIELDS\r
+*\r
+* method\r
+* Method to be run\r
+*\r
+* attr_id\r
+* Attribute identifier of query data.\r
+*\r
+* attr_size\r
+* Size of the query attribute in bytes. This is translated into the\r
+* attr_offset field of the SA MAD by the ib_query call.\r
+*\r
+* comp_mask\r
+* Indicates the attribute components that are specified for the query.\r
+*\r
+* p_attr\r
+* References the attribute structure used as input into the query.\r
+* This field is ignored if comp_mask is set to 0.\r
+*\r
+* NOTES\r
+* This structure is used to describe a user-defined query. The attribute\r
+* ID, attribute offset, component mask, and attribute structure must match\r
+* those defined by the IBA specification. Users should refer to chapter 15\r
+* of the IBA specification for additional details.\r
+*\r
+* SEE ALSO\r
+* ib_query_type_t, ib_query, ib_get_attr_offset, ib_get_attr_size\r
+*****/\r
+\r
+\r
+/****s* Access Layer/ib_gid_pair_t\r
+* NAME\r
+* ib_gid_pair_t\r
+*\r
+* DESCRIPTION\r
+* Source and destination GIDs.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_gid_pair\r
+{\r
+ ib_gid_t src_gid;\r
+ ib_gid_t dest_gid;\r
+\r
+} ib_gid_pair_t;\r
+/*\r
+* FIELDS\r
+* src_gid\r
+* Source GID of a path.\r
+*\r
+* dest_gid\r
+* Destination GID of a path.\r
+*\r
+* NOTES\r
+* This structure is used to describe the endpoints of a path.\r
+*\r
+* SEE ALSO\r
+* ib_gid_t\r
+*****/\r
+\r
+\r
+/****s* Access Layer/ib_lid_pair_t\r
+* NAME\r
+* ib_lid_pair_t\r
+*\r
+* DESCRIPTION\r
+* Source and destination LIDs.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_lid_pair\r
+{\r
+ ib_net16_t src_lid;\r
+ ib_net16_t dest_lid;\r
+\r
+} ib_lid_pair_t;\r
+/*\r
+* FIELDS\r
+* src_lid\r
+* Source LID of a path.\r
+*\r
+* dest_lid\r
+* Destination LID of a path.\r
+*\r
+* NOTES\r
+* This structure is used to describe the endpoints of a path.\r
+*****/\r
+\r
+\r
+/****s* Access Layer/ib_guid_pair_t\r
+* NAME\r
+* ib_guid_pair_t\r
+*\r
+* DESCRIPTION\r
+* Source and destination GUIDs. These may be port or channel adapter\r
+* GUIDs, depending on the context in which this structure is used.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_guid_pair\r
+{\r
+ ib_net64_t src_guid;\r
+ ib_net64_t dest_guid;\r
+\r
+} ib_guid_pair_t;\r
+/*\r
+* FIELDS\r
+* src_guid\r
+* Source GUID of a path.\r
+*\r
+* dest_guid\r
+* Destination GUID of a path.\r
+*\r
+* NOTES\r
+* This structure is used to describe the endpoints of a path. The given\r
+* GUID pair may belong to either ports or channel adapters.\r
+*\r
+* SEE ALSO\r
+* ib_guid_t\r
+*****/\r
+\r
+\r
+/****s* Access Layer/ib_query_rec_t\r
+* NAME\r
+* ib_query_rec_t\r
+*\r
+* DESCRIPTION\r
+* Contains the results of a subnet administration query.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_query_rec\r
+{\r
+ const void* __ptr64 query_context;\r
+ ib_api_status_t status;\r
+\r
+ ib_query_type_t query_type;\r
+ uint32_t result_cnt;\r
+ ib_mad_element_t* __ptr64 p_result_mad;\r
+\r
+} ib_query_rec_t;\r
+/*\r
+* FIELDS\r
+* query_context\r
+* User-defined context information associated with the query through\r
+* the ib_reg_query call.\r
+*\r
+* status\r
+* Indicates the success of the query operation.\r
+*\r
+* query_type\r
+* Indicates the type of query for which the results are being returned.\r
+* This matches the query_type specified through the ib_reg_query call.\r
+*\r
+* result_cnt\r
+* The number of result structures that were returned by the query.\r
+*\r
+* p_result_mad\r
+* For queries returning IB_SUCCESS or IB_REMOTE_ERROR, this references\r
+* the MAD returned by the subnet administrator containing the list\r
+* of results or the returned error code.\r
+*\r
+* NOTES\r
+* A query result structure is returned to a client through their\r
+* ib_pfn_query_cb_t routine to notify them of the results of a subnet\r
+* administration query. If the query was successful or received an error\r
+* from the subnet administrator, p_result_mad will reference a MAD element\r
+* containing the results. The MAD referenced by p_result_mad is owned by\r
+* the user and remains available even after their callback returns. Users\r
+* must call ib_put_mad() to return the MAD element back to the access layer\r
+* when they are done accessing the results.\r
+*\r
+* To retrieve individual result structures from the p_result_mad, users\r
+* may call ib_get_query_result().\r
+*\r
+* SEE ALSO\r
+* ib_query, ib_pfn_query_cb_t, ib_api_status_t, ib_put_mad, ib_mad_element_t\r
+* ib_query_status_t, ib_query_type_t, ib_get_query_result\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_get_query_result\r
+* NAME\r
+* ib_get_query_result\r
+*\r
+* DESCRIPTION\r
+* Retrieves a result structure from a MAD returned by a call to ib_query().\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE void* AL_API\r
+ib_get_query_result(\r
+ IN ib_mad_element_t *p_result_mad,\r
+ IN uint32_t result_index )\r
+{\r
+ ib_sa_mad_t *p_sa_mad;\r
+\r
+ CL_ASSERT( p_result_mad );\r
+ p_sa_mad = (ib_sa_mad_t*)ib_get_mad_buf( p_result_mad );\r
+ CL_ASSERT( p_sa_mad );\r
+ CL_ASSERT( ib_get_attr_size( p_sa_mad->attr_offset ) * (result_index + 1) +\r
+ IB_SA_MAD_HDR_SIZE <= p_result_mad->size );\r
+\r
+ return( p_sa_mad->data +\r
+ (ib_get_attr_size( p_sa_mad->attr_offset ) * result_index) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_result_mad\r
+* [in] This is a reference to the MAD returned as a result of the\r
+* query.\r
+*\r
+* result_index\r
+* [in] A zero-based index indicating which result to return.\r
+*\r
+* NOTES\r
+* This call returns a pointer to the start of a result structure from a call\r
+* to ib_query(). The type of result structure must be known to the user\r
+* either through the user's context or the query_type returned as part of\r
+* the ib_query_rec_t structure.\r
+*\r
+* SEE ALSO\r
+* ib_query_rec_t, ib_mad_element_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_get_query_path_rec\r
+* NAME\r
+* ib_get_query_path_rec\r
+*\r
+* DESCRIPTION\r
+* Retrieves a path record result from a MAD returned by a call to\r
+* ib_query().\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE ib_path_rec_t* AL_API\r
+ib_get_query_path_rec(\r
+ IN ib_mad_element_t *p_result_mad,\r
+ IN uint32_t result_index )\r
+{\r
+ ib_sa_mad_t *p_sa_mad;\r
+\r
+ CL_ASSERT( p_result_mad );\r
+ p_sa_mad = (ib_sa_mad_t*)ib_get_mad_buf( p_result_mad );\r
+ CL_ASSERT( p_sa_mad && p_sa_mad->attr_id == IB_MAD_ATTR_PATH_RECORD );\r
+\r
+ return( (ib_path_rec_t*)ib_get_query_result( p_result_mad, result_index ) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_result_mad\r
+* [in] This is a reference to the MAD returned as a result of the\r
+* query.\r
+*\r
+* result_index\r
+* [in] A zero-based index indicating which result to return.\r
+*\r
+* NOTES\r
+* This call returns a pointer to the start of a path record result from\r
+* a call to ib_query().\r
+*\r
+* SEE ALSO\r
+* ib_query_rec_t, ib_mad_element_t, ib_get_query_result, ib_path_rec_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_get_query_portinfo_rec\r
+* NAME\r
+* ib_get_query_portinfo_rec\r
+*\r
+* DESCRIPTION\r
+* Retrieves a port info record result from a MAD returned by a call to\r
+* ib_query().\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE ib_portinfo_record_t* AL_API\r
+ib_get_query_portinfo_rec(\r
+ IN ib_mad_element_t *p_result_mad,\r
+ IN uint32_t result_index )\r
+{\r
+ ib_sa_mad_t *p_sa_mad;\r
+\r
+ CL_ASSERT( p_result_mad );\r
+ p_sa_mad = (ib_sa_mad_t*)ib_get_mad_buf( p_result_mad );\r
+ CL_ASSERT( p_sa_mad && p_sa_mad->attr_id == IB_MAD_ATTR_PORTINFO_RECORD );\r
+\r
+ return( (ib_portinfo_record_t*)ib_get_query_result( p_result_mad,\r
+ result_index ) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_result_mad\r
+* [in] This is a reference to the MAD returned as a result of the\r
+* query.\r
+*\r
+* result_index\r
+* [in] A zero-based index indicating which result to return.\r
+*\r
+* NOTES\r
+* This call returns a pointer to the start of a port info record result from\r
+* a call to ib_query().\r
+*\r
+* SEE ALSO\r
+* ib_query_rec_t, ib_mad_element_t, ib_get_query_result, ib_portinfo_record_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_get_query_node_rec\r
+* NAME\r
+* ib_get_query_node_rec\r
+*\r
+* DESCRIPTION\r
+* Retrieves a node record result from a MAD returned by a call to\r
+* ib_query().\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE ib_node_record_t* AL_API\r
+ib_get_query_node_rec(\r
+ IN ib_mad_element_t *p_result_mad,\r
+ IN uint32_t result_index )\r
+{\r
+ ib_sa_mad_t *p_sa_mad;\r
+\r
+ CL_ASSERT( p_result_mad );\r
+ p_sa_mad = (ib_sa_mad_t*)ib_get_mad_buf( p_result_mad );\r
+ CL_ASSERT( p_sa_mad && p_sa_mad->attr_id == IB_MAD_ATTR_NODE_RECORD );\r
+\r
+ return( (ib_node_record_t*)ib_get_query_result( p_result_mad,\r
+ result_index ) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_result_mad\r
+* [in] This is a reference to the MAD returned as a result of the\r
+* query.\r
+*\r
+* result_index\r
+* [in] A zero-based index indicating which result to return.\r
+*\r
+* NOTES\r
+* This call returns a pointer to the start of a node record result from\r
+* a call to ib_query().\r
+*\r
+* SEE ALSO\r
+* ib_query_rec_t, ib_mad_element_t, ib_get_query_result, ib_node_record_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_get_query_svc_rec\r
+* NAME\r
+* ib_get_query_svc_rec\r
+*\r
+* DESCRIPTION\r
+* Retrieves a service record result from a MAD returned by a call to\r
+* ib_query().\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE ib_service_record_t* AL_API\r
+ib_get_query_svc_rec(\r
+ IN ib_mad_element_t *p_result_mad,\r
+ IN uint32_t result_index )\r
+{\r
+ ib_sa_mad_t *p_sa_mad;\r
+\r
+ CL_ASSERT( p_result_mad );\r
+ p_sa_mad = (ib_sa_mad_t*)ib_get_mad_buf( p_result_mad );\r
+ CL_ASSERT( p_sa_mad && p_sa_mad->attr_id == IB_MAD_ATTR_SERVICE_RECORD );\r
+\r
+ return( (ib_service_record_t*)ib_get_query_result( p_result_mad,\r
+ result_index ) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_result_mad\r
+* [in] This is a reference to the MAD returned as a result of the\r
+* query.\r
+*\r
+* result_index\r
+* [in] A zero-based index indicating which result to return.\r
+*\r
+* NOTES\r
+* This call returns a pointer to the start of a service record result from\r
+* a call to ib_query().\r
+*\r
+* SEE ALSO\r
+* ib_query_rec_t, ib_mad_element_t, ib_get_query_result, ib_service_record_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_pfn_query_cb_t\r
+* NAME\r
+* ib_pfn_query_cb_t\r
+*\r
+* DESCRIPTION\r
+* User-defined callback invoked on completion of a subnet administrator\r
+* query.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef void\r
+(AL_API * __ptr64 ib_pfn_query_cb_t)(\r
+ IN ib_query_rec_t *p_query_rec );\r
+/*\r
+* PARAMETERS\r
+* p_query_rec\r
+* [in] This is a reference to a structure containing the result of the\r
+* query.\r
+*\r
+* NOTES\r
+* This routine is invoked to notify a client of the result of a subnet\r
+* administration query. The p_query_rec parameter references the result\r
+* of the query and, in the case of a successful query, any information\r
+* returned by the subnet administrator.\r
+*\r
+* In the kernel, this callback is usually invoked using a tasklet, dependent\r
+* on the implementation of the underlying verbs provider driver.\r
+*\r
+* SEE ALSO\r
+* ib_query_rec_t\r
+*****/\r
+\r
+\r
+/****s* Access Layer/ib_query_req_t\r
+* NAME\r
+* ib_query_req_t\r
+*\r
+* DESCRIPTION\r
+* Information used to request an access layer provided query of the subnet\r
+* administrator.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_query_req\r
+{\r
+ ib_query_type_t query_type;\r
+ const void* __ptr64 p_query_input;\r
+ ib_net64_t port_guid;\r
+\r
+ uint32_t timeout_ms;\r
+ uint32_t retry_cnt;\r
+ ib_al_flags_t flags;\r
+\r
+ const void* __ptr64 query_context;\r
+ ib_pfn_query_cb_t pfn_query_cb;\r
+\r
+} ib_query_req_t;\r
+/*\r
+* FIELDS\r
+* query_type\r
+* Indicates the type of query that the access layer should perform.\r
+*\r
+* p_query_input\r
+* A pointer to the input for the query. The data referenced by this\r
+* structure is dependent on the type of query being requested and is\r
+* determined by the specified query_type.\r
+*\r
+* port_guid\r
+* Directs the query to use the specified port. The request will\r
+* contact the management entity reachable through the given port.\r
+*\r
+* timeout_ms\r
+* Specifies the number of milliseconds to wait for a response for\r
+* this query until retrying or timing out the request.\r
+*\r
+* retry_cnt\r
+* Specifies the number of times that the query will be retried before\r
+* failing the request.\r
+*\r
+* flags\r
+* Used to describe the mode of operation. Set to IB_FLAGS_SYNC to\r
+* process the called routine synchronously.\r
+*\r
+* query_context\r
+* User-defined context information associated with this query. The\r
+* context data is returned to the user as a part of their query\r
+* callback.\r
+*\r
+* pfn_query_cb\r
+* A user-defined callback that is invoked upon completion of the query.\r
+*\r
+* NOTES\r
+* This structure is used when requesting an access layer provided query\r
+* of the subnet administrator. Clients specify the type of query through\r
+* the query_type field. Based on the type of query, the p_query_input\r
+* field is set to reference the appropriate data structure.\r
+*\r
+* The information referenced by the p_query_input field is one of the\r
+* following:\r
+*\r
+* -- a NULL terminated service name\r
+* -- a service id\r
+* -- a single GUID\r
+* -- a pair of GUIDs specified through an ib_guid_pair_t structure\r
+* -- a pair of GIDs specified through an ib_gid_pair_t structure\r
+*\r
+* SEE ALSO\r
+* ib_query_type_t, ib_pfn_query_cb_t, ib_guid_pair_t,\r
+* ib_gid_pair_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_query\r
+* NAME\r
+* ib_query\r
+*\r
+* DESCRIPTION\r
+* Routine used to request an access layer provided query of the subnet\r
+* administrator.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_query(\r
+ IN const ib_al_handle_t h_al,\r
+ IN const ib_query_req_t* const p_query_req,\r
+ OUT ib_query_handle_t* const ph_query OPTIONAL );\r
+/*\r
+* PARAMETERS\r
+* h_al\r
+* [in] A handle to an open instance of the access layer.\r
+*\r
+* p_query_req\r
+* [in] Specifies the type of query that the access layer should perform,\r
+* along with information needed to process the completed query.\r
+*\r
+* ph_query\r
+* [out] Pointer to a query handle that can be used to cancel the query.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The subnet administrator query was initiated.\r
+*\r
+* IB_INVALID_AL_HANDLE\r
+* The access layer handle was invalid.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the query request was not provided.\r
+*\r
+* IB_INSUFFICIENT_MEMORY\r
+* There was insufficient memory to perform the operation.\r
+*\r
+* IB_INVALID_GUID\r
+* No port was found for the port_guid specified in the request.\r
+*\r
+* IB_ERROR\r
+* An invalid query_type was specified in the request.\r
+*\r
+* IB_INSUFFICIENT_RESOURCES\r
+* There were insufficient resources currently available on the channel\r
+* adapter to perform the operation.\r
+*\r
+* NOTES\r
+* This routine directs the access layer to initiate a query to the subnet\r
+* administrator for desired information. The access layer will issue the\r
+* query, collect the results, and report them to the client through a user-\r
+* specified callback. The access layer is responsible for retrying the\r
+* operation as directed by the client.\r
+*\r
+* SEE ALSO\r
+* ib_cancel_query, ib_query_req_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_cancel_query\r
+* NAME\r
+* ib_cancel_query\r
+*\r
+* DESCRIPTION\r
+* Routine used to cancel a query of the subnet administrator.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT void AL_API\r
+ib_cancel_query(\r
+ IN const ib_al_handle_t h_al,\r
+ IN const ib_query_handle_t h_query );\r
+/*\r
+* PARAMETERS\r
+* h_al\r
+* [in] A handle to an open instance of the access layer.\r
+*\r
+* h_query\r
+* [in] Query handle returned by a previous call to ib_query().\r
+*\r
+* RETURN VALUES\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+* This routine directs the access layer to cancel a query to the subnet\r
+* administrator. The access layer will issue notify the user with the\r
+* final status of the query through the query callback specified in the\r
+* call to ib_query().\r
+*\r
+* SEE ALSO\r
+* ib_query\r
+*****/\r
+\r
+\r
+/****d* Access Layer/ib_pnp_class_t\r
+* NAME\r
+* ib_pnp_class_t\r
+*\r
+* DESCRIPTION\r
+* Specifies the class of plug and play events that are being subscribed for.\r
+*\r
+* SYNOPSIS\r
+*/\r
+#define IB_PNP_CA 0x00000001\r
+#define IB_PNP_PORT 0x00000002\r
+#define IB_PNP_IOU 0x00000004\r
+#define IB_PNP_IOC 0x00000008\r
+\r
+#define IB_PNP_FLAG_REG_SYNC 0x40000000\r
+#define IB_PNP_FLAG_REG_COMPLETE 0x80000000\r
+#define IB_PNP_FLAG_MASK 0xF0000000\r
+#define IB_PNP_CLASS_MASK 0x000000FF\r
+\r
+typedef uint32_t ib_pnp_class_t;\r
+/*\r
+* VALUES\r
+* IB_PNP_CA\r
+* Value used to register for local channel adapter events. These\r
+* events include the addition or removal of a local channel adapter.\r
+*\r
+* IB_PNP_PORT\r
+* Value used to register for local port events. These events include\r
+* local port up or down events and port LID or Pkey changes.\r
+*\r
+* IB_PNP_IOU\r
+* Value used to register for I/O unit PnP events. I/O unit events\r
+* include notifications of I/O unit assignment to and dissociation from\r
+* the local host.\r
+*\r
+* IB_PNP_IOC\r
+* Value used to register for an I/O controller PnP event. I/O controller\r
+* events include notification of an I/O controller assignment to a local\r
+* port and indication that an I/O controller dissociation has occurred.\r
+*\r
+* IB_PNP_FLAG_REG_SYNC\r
+* Flag that is ORed with the PnP Class to control behavior of the\r
+* ib_pnp_reg call. When set, ib_pnp_reg returns after client has\r
+* received all events for the current state of the system.\r
+*\r
+* IB_PNP_FLAG_REG_COMPLETE\r
+* Flag that is ORed with the PnP Class to control whether an event\r
+* is generated to indicate that a client has received all events for the\r
+* current state of the system.\r
+*\r
+* NOTES\r
+* When registering for PnP notification, a client specifies the class of\r
+* local events that the client wishes to be notified of. For example to\r
+* request notification of events on a port, a client would use IB_PNP_PORT.\r
+* To be notified of the assignment of an I/O controller, a client would use\r
+* IB_PNP_IOC.\r
+*\r
+* The PnP APIs do not support registration for multiple event classes at\r
+* a time.\r
+*\r
+* SEE ALSO\r
+* ib_pfn_pnp_cb_t, ib_pfn_report_cb_t, ib_pnp_rec_t, ib_pnp_event_t\r
+*****/\r
+\r
+\r
+/****d* Access Layer/ib_pnp_event_t\r
+* NAME\r
+* ib_pnp_event_t\r
+*\r
+* DESCRIPTION\r
+* Indicates the type of plug and play event that has occurred.\r
+*\r
+* SYNOPSIS\r
+*/\r
+#define IB_PNP_EVENT_PATH 0x00000800\r
+#define IB_PNP_EVENT_ADD 0x00001000\r
+#define IB_PNP_EVENT_REMOVE 0x00002000\r
+#define IB_PNP_EVENT_CHANGE 0x00004000\r
+#define IB_PNP_EVENT_INIT 0x00008000\r
+#define IB_PNP_EVENT_ARMED 0x00010000\r
+#define IB_PNP_EVENT_ACTIVE 0x00020000\r
+#define IB_PNP_EVENT_DOWN 0x00040000\r
+#define IB_PNP_EVENT_PKEY 0x00080000\r
+#define IB_PNP_EVENT_SM 0x00100000\r
+#define IB_PNP_EVENT_GID 0x00200000\r
+#define IB_PNP_EVENT_LID 0x00400000\r
+#define IB_PNP_EVENT_SUBNET 0x00800000\r
+\r
+#define IB_PNP_CA_ADD (IB_PNP_CA | IB_PNP_EVENT_ADD)\r
+#define IB_PNP_CA_REMOVE (IB_PNP_CA | IB_PNP_EVENT_REMOVE)\r
+\r
+#define IB_PNP_PORT_ADD (IB_PNP_PORT | IB_PNP_EVENT_ADD)\r
+#define IB_PNP_PORT_REMOVE (IB_PNP_PORT | IB_PNP_EVENT_REMOVE)\r
+#define IB_PNP_PORT_INIT (IB_PNP_PORT | IB_PNP_EVENT_INIT)\r
+#define IB_PNP_PORT_ARMED (IB_PNP_PORT | IB_PNP_EVENT_ARMED)\r
+#define IB_PNP_PORT_ACTIVE (IB_PNP_PORT | IB_PNP_EVENT_ACTIVE)\r
+#define IB_PNP_PORT_DOWN (IB_PNP_PORT | IB_PNP_EVENT_DOWN)\r
+#define IB_PNP_PKEY_CHANGE (IB_PNP_PORT | IB_PNP_EVENT_PKEY)\r
+#define IB_PNP_SM_CHANGE (IB_PNP_PORT | IB_PNP_EVENT_SM)\r
+#define IB_PNP_GID_CHANGE (IB_PNP_PORT | IB_PNP_EVENT_GID)\r
+#define IB_PNP_LID_CHANGE (IB_PNP_PORT | IB_PNP_EVENT_LID)\r
+#define IB_PNP_SUBNET_TIMEOUT_CHANGE (IB_PNP_PORT | IB_PNP_EVENT_SUBNET)\r
+\r
+#define IB_PNP_IOU_ADD (IB_PNP_IOU | IB_PNP_EVENT_ADD)\r
+#define IB_PNP_IOU_REMOVE (IB_PNP_IOU | IB_PNP_EVENT_REMOVE)\r
+#define IB_PNP_IOC_ADD (IB_PNP_IOC | IB_PNP_EVENT_ADD)\r
+#define IB_PNP_IOC_REMOVE (IB_PNP_IOC | IB_PNP_EVENT_REMOVE)\r
+#define IB_PNP_IOC_PATH_ADD (IB_PNP_IOC | IB_PNP_EVENT_PATH | \\r
+ IB_PNP_EVENT_ADD)\r
+#define IB_PNP_IOC_PATH_REMOVE (IB_PNP_IOC | IB_PNP_EVENT_PATH | \\r
+ IB_PNP_EVENT_REMOVE)\r
+\r
+#define IB_PNP_REG_COMPLETE IB_PNP_FLAG_REG_COMPLETE\r
+\r
+typedef uint32_t ib_pnp_event_t;\r
+/*\r
+* VALUES\r
+* IB_PNP_CA_ADD\r
+* Indicates that a new channel adapter has been added.\r
+*\r
+* IB_PNP_CA_REMOVE\r
+* Indicates that a channel adapter has been removed.\r
+*\r
+* IB_PNP_PORT_ADD\r
+* Indicates that a new port has been added. This callback will always\r
+* be followed by a callback to indicate the actual port state to allow\r
+* clients to use the PnP callbacks to drive their state machine.\r
+*\r
+* IB_PNP_PORT_REMOVE\r
+* Indicates that a port has been removed.\r
+* A CA remove event will trigger this event first.\r
+*\r
+* IB_PNP_PORT_INIT\r
+* Indicates that a port is in the IB_LINK_INIT state.\r
+*\r
+* IB_PNP_PORT_ARMED\r
+* Indicates that a port is in the IB_LINK_ARMED state.\r
+*\r
+* IB_PNP_PORT_ACTIVE\r
+* Indicates that a port is in the IB_LINK_ACTIVE state.\r
+*\r
+* IB_PNP_PORT_DOWN\r
+* Indicates that a port down event has occurred.\r
+*\r
+* IB_PNP_PKEY_CHANGE\r
+* Indicates that port Pkey change has ocurred.\r
+*\r
+* IB_PNP_SM_CHANGE\r
+* Indicates that the SM assignment for a port has changed.\r
+*\r
+* IB_PNP_GID_CHANGE\r
+* Indicates that the GID assignment for a port has changed.\r
+*\r
+* IB_PNP_LID_CHANGE\r
+* Indicates that the LID or LMC assignment for a port has changed.\r
+*\r
+* IB_PNP_SUBNET_TIMEOUT_CHANGE\r
+* Indicates that the subnet timeout assignment for a port has changed.\r
+*\r
+* IB_PNP_IOU_ADD\r
+* Indicates that an I/O unit assignment has occured.\r
+*\r
+* IB_PNP_IOU_REMOVE\r
+* Indicates that an I/O unit disassociation has occured.\r
+*\r
+* IB_PNP_IOC_ADD\r
+* Indicates that an I/O controller assignment has occurred.\r
+*\r
+* IB_PNP_IOC_REMOVE\r
+* Indicates that an I/O controller dissociation has occurred.\r
+* A port down event will trigger this event first.\r
+*\r
+* IB_PNP_IOC_PATH_ADD\r
+* Indicates that a new path to an I/O controller is available.\r
+*\r
+* IB_PNP_IOC_PATH_REMOVE\r
+* Indiactes that a path to an I/O controller is no longer avaialble.\r
+*\r
+* IB_PNP_REG_COMPLETE\r
+* Indicates that all events associated with a ib_reg_pnp call have been\r
+* reported to the user. The user's state of the system is now in\r
+* sync with that of the access layer.\r
+*\r
+* NOTES\r
+* The Access Layer maintains a queue of client PnP registrations.\r
+* Using this queue, PnP events are reported to clients in a specific\r
+* order. CA add, port add, and IOC add events are reported from the\r
+* head of the queue, while CA remove, port remove, and IOC remove events\r
+* are reported from the tail. Clients are responsible for performing\r
+* registrations in the proper sequence to ensure that PnP event\r
+* notifiations occur in the desired order.\r
+*\r
+* SEE ALSO\r
+* ib_pfn_pnp_cb_t, ib_pfn_report_cb_t, ib_pnp_rec_t, ib_pnp_class_t\r
+*****/\r
+\r
+\r
+AL_INLINE const char* AL_API\r
+ib_get_pnp_event_str(\r
+ IN ib_pnp_event_t event )\r
+{\r
+ switch( event )\r
+ {\r
+ case IB_PNP_CA_ADD : return "IB_PNP_CA_ADD";\r
+ case IB_PNP_CA_REMOVE : return "IB_PNP_CA_REMOVE";\r
+ case IB_PNP_PORT_ADD : return "IB_PNP_PORT_ADD";\r
+ case IB_PNP_PORT_REMOVE : return "IB_PNP_PORT_REMOVE";\r
+ case IB_PNP_PORT_INIT : return "IB_PNP_PORT_INIT";\r
+ case IB_PNP_PORT_ARMED : return "IB_PNP_PORT_ARMED";\r
+ case IB_PNP_PORT_ACTIVE : return "IB_PNP_PORT_ACTIVE";\r
+ case IB_PNP_PORT_DOWN : return "IB_PNP_PORT_DOWN";\r
+ case IB_PNP_PKEY_CHANGE : return "IB_PNP_PKEY_CHANGE";\r
+ case IB_PNP_SM_CHANGE : return "IB_PNP_SM_CHANGE";\r
+ case IB_PNP_GID_CHANGE : return "IB_PNP_GID_CHANGE";\r
+ case IB_PNP_LID_CHANGE : return "IB_PNP_LID_CHANGE";\r
+ case IB_PNP_SUBNET_TIMEOUT_CHANGE : return "IB_PNP_SUBNET_TIMEOUT_CHANGE";\r
+ case IB_PNP_IOU_ADD : return "IB_PNP_IOU_ADD";\r
+ case IB_PNP_IOU_REMOVE : return "IB_PNP_IOU_REMOVE";\r
+ case IB_PNP_IOC_ADD : return "IB_PNP_IOC_ADD";\r
+ case IB_PNP_IOC_REMOVE : return "IB_PNP_IOC_REMOVE";\r
+ case IB_PNP_IOC_PATH_ADD : return "IB_PNP_IOC_PATH_ADD";\r
+ case IB_PNP_IOC_PATH_REMOVE : return "IB_PNP_IOC_PATH_REMOVE";\r
+ case IB_PNP_REG_COMPLETE : return "IB_PNP_REG_COMPLETE";\r
+ }\r
+ return "Unknown";\r
+}\r
+\r
+\r
+/****s* Access Layer/ib_pnp_rec_t\r
+* NAME\r
+* ib_pnp_rec_t\r
+*\r
+* DESCRIPTION\r
+* Notification information used to describe local channel adapter, port,\r
+* and I/O controller events.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_pnp_rec\r
+{\r
+ ib_pnp_event_t pnp_event;\r
+\r
+ ib_pnp_handle_t h_pnp;\r
+ ib_pnp_handle_t h_ioc_event;\r
+\r
+ void* __ptr64 pnp_context;\r
+ void* __ptr64 context;\r
+ //NOTE:\r
+ //guid and ca_guid use as key to flexi map need to keep these field together\r
+ ib_net64_t guid;\r
+ ib_net64_t ca_guid;\r
+\r
+} ib_pnp_rec_t;\r
+/*\r
+* FIELDS\r
+* pnp_event\r
+* Describes the type of plug and play event that is being reported.\r
+*\r
+* h_pnp\r
+* A handle to the notification registration for which this PnP record\r
+* was generated. This handle will match the handle returned through\r
+* an ib_reg_pnp call. It is provided in case a PnP notification event\r
+* occurs before a client's call to ib_reg_pnp can return. This handle\r
+* may be used to cancel further notification of PnP events.\r
+*\r
+* h_ioc_event\r
+* A handle that is unique to an I/O controller assignment event.\r
+* This handle is used to reject the assignment of an I/O controller\r
+* from within the ib_pfn_pnp_cb_t callback. Valid for IB_PNP_IOC_ADD\r
+* events only.\r
+*\r
+* pnp_context\r
+* User-defined context information specified when registering for\r
+* notification of the event. See the notes section below for\r
+* more details.\r
+*\r
+* context\r
+* This field references a user-specified context on which the event\r
+* occurred. See the notes section below for more details.\r
+*\r
+* guid\r
+* The GUID of the adapter, port, IOU, or IOC for which\r
+* the PnP event occurred.\r
+*\r
+* ca_guid\r
+* The GUID of the HCA \r
+*\r
+* NOTES\r
+* This structure is returned to the user to notify them of: the addition\r
+* of a channel adapter, the removal of a channel adapter, a port up or down\r
+* event, a port pkey change, and I/O controller addition and removal events.\r
+*\r
+* The context field is NULL unless a context value has already been set\r
+* by the user.\r
+*\r
+* The context value can be changed by updating its field\r
+* and will take effect once the notification callback returns.\r
+*\r
+* Once a device has been removed, all context associated with that device\r
+* is lost. Context is maintained between port down and subsequent port up\r
+* events provided that the channel adapter is not removed.\r
+*\r
+* I/O controller path notifications are only delivered with respect to a\r
+* previously reported I/O controller.\r
+*\r
+* SEE ALSO\r
+* ib_open_al, ib_ca_attr_t, ib_reg_pnp, ib_dereg_pnp, ib_pfn_pnp_cb_t,\r
+* ib_ioc_info_t, ib_reject_ioc, ib_pnp_event_t\r
+*****/\r
+\r
+\r
+/****s* Access Layer/ib_pnp_ca_rec_t\r
+* NAME\r
+* ib_pnp_ca_rec_t\r
+*\r
+* DESCRIPTION\r
+* Notification information used to describe local channel adapter events.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_pnp_ca_rec\r
+{\r
+ ib_pnp_rec_t pnp_rec;\r
+ ib_ca_attr_t* __ptr64 p_ca_attr;\r
+\r
+} ib_pnp_ca_rec_t;\r
+/*\r
+* FIELDS\r
+* pnp_rec\r
+* Structure describing the plug and play event being reported.\r
+*\r
+* p_ca_attr\r
+* Attributes of the channel adapter that has experienced the event.\r
+* NULL for IB_PNP_CA_REMOVE, IB_PNP_PORT_REMOVE, and IB_PNP_IOC_REMOVE\r
+* events.\r
+*\r
+* NOTES\r
+* This structure is returned to the user to notify them of the addition\r
+* or the removal of a channel adapter.\r
+*\r
+* The context field is NULL unless a context value has already been set\r
+* by the user.\r
+*\r
+* Context values can be changed by updating the appropriate field\r
+* and will be take effect once the notification callback returns.\r
+*\r
+* Once a device has been removed, all context associated with that device\r
+* is lost.\r
+*\r
+* Recipients of CA-related PnP events should cast the ib_pnp_rec_t structure\r
+* returned in the PnP callback to this type to access CA-specific information.\r
+*\r
+* SEE ALSO\r
+* ib_open_al, ib_ca_attr_t, ib_reg_pnp, ib_dereg_pnp, ib_pfn_pnp_cb_t,\r
+* ib_ioc_info_t, ib_reject_ioc, ib_pnp_event_t\r
+*****/\r
+\r
+\r
+/****s* Access Layer/ib_pnp_port_rec_t\r
+* NAME\r
+* ib_pnp_port_rec_t\r
+*\r
+* DESCRIPTION\r
+* Notification information used to describe local port events.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_pnp_port_rec\r
+{\r
+ ib_pnp_rec_t pnp_rec;\r
+ ib_ca_attr_t* __ptr64 p_ca_attr;\r
+ ib_port_attr_t* __ptr64 p_port_attr;\r
+\r
+} ib_pnp_port_rec_t;\r
+/*\r
+* FIELDS\r
+* pnp_rec\r
+* Structure describing the plug and play event being reported.\r
+*\r
+* p_ca_attr\r
+* Attributes of the channel adapter that has experienced the event.\r
+* NULL for IB_PNP_CA_REMOVE, IB_PNP_PORT_REMOVE, and IB_PNP_IOC_REMOVE\r
+* events.\r
+*\r
+* p_port_attr\r
+* Attributes of the port that has experienced the event. Valid only\r
+* for IB_PNP_PORT_UP, IB_PNP_PORT_DOWN, IB_PNP_PKEY_CHANGE, and\r
+* IB_PNP_IOC_ADD events.\r
+*\r
+* NOTES\r
+* This structure is returned to the user to notify them of port events.\r
+*\r
+* The context field is NULL unless a context value has already been set\r
+* by the user.\r
+*\r
+* Context values can be changed by updating the appropriate field\r
+* and will be take effect once the notification callback returns.\r
+*\r
+* Once a device has been removed, all context associated with that device\r
+* is lost. Context is maintained between port down and subsequent port up\r
+* events provided that the channel adapter is not removed.\r
+*\r
+* Recipients of port related PnP events should cast the ib_pnp_rec_t structure\r
+* returned in the PnP callback to this type to access port specific information.\r
+*\r
+* SEE ALSO\r
+* ib_open_al, ib_ca_attr_t, ib_reg_pnp, ib_dereg_pnp, ib_pfn_pnp_cb_t,\r
+* ib_ioc_info_t, ib_reject_ioc, ib_pnp_event_t\r
+*****/\r
+\r
+\r
+/****s* Access Layer/ib_pnp_iou_rec_t\r
+* NAME\r
+* ib_pnp_iou_rec_t\r
+*\r
+* DESCRIPTION\r
+* Notification information used to describe local I/O unit events.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_pnp_iou_rec\r
+{\r
+ ib_pnp_rec_t pnp_rec;\r
+ net64_t guid;\r
+ net64_t ca_guid;\r
+ net64_t chassis_guid;\r
+ uint8_t slot;\r
+ net32_t vend_id;\r
+ net16_t dev_id;\r
+ net32_t revision;\r
+ char desc[IB_NODE_DESCRIPTION_SIZE + 1];\r
+\r
+} ib_pnp_iou_rec_t;\r
+/*\r
+* FIELDS\r
+* pnp_rec\r
+* Structure describing the plug and play event being reported.\r
+*\r
+* ca_guid\r
+* GUID of the local HCA through which the I/O unit is accessible. Valid\r
+* only for IB_PNP_IOU_ADD events.\r
+*\r
+* chassis guid\r
+* GUID of the chassis in which an I/O unit is installed. Valid only for\r
+* IB_PNP_IOU_ADD events.\r
+*\r
+* slot\r
+* Chassis slot number in which an I/O unit is installed. Valid only for\r
+* IB_PNP_IOU_ADD events.\r
+*\r
+* guid\r
+* GUID of an I/O unit from which one or more I/O controllers are assigned\r
+* to this host. Valid only for IB_PNP_IOU_ADD events.\r
+*\r
+* vend_id\r
+* Vendor ID of an I/O unit from which one or more I/O controllers are\r
+* assigned to this host. Valid only for IB_PNP_IOU_ADD events.\r
+*\r
+* dev_id\r
+* Device ID of an I/O unit from which one or more I/O controllers are\r
+* assigned to this host. Valid only for IB_PNP_IOU_ADD events.\r
+*\r
+* revision\r
+* Revision of an I/O unit from which one or more I/O controllers are\r
+* assigned to this host. Valid only for IB_PNP_IOU_ADD events.\r
+*\r
+* desc\r
+* Node description string for an I/O unit from which one or more I/O\r
+* controllers are assigned to this host. Valid only for IB_PNP_IOU_ADD\r
+* events.\r
+*\r
+* NOTES\r
+* This structure is returned to the user to notify them of the addition\r
+* and removal of an I/O Unit.\r
+*\r
+* The context field is NULL unless a context value has already been set\r
+* by the user.\r
+*\r
+* Context values can be changed by updating the appropriate field\r
+* and will be take effect once the notification callback returns.\r
+*\r
+* Once a device has been removed, all context associated with that device\r
+* is lost. Context is maintained between port down and subsequent port up\r
+* events provided that the channel adapter is not removed.\r
+*\r
+* SEE ALSO\r
+* ib_open_al, ib_ca_attr_t, ib_reg_pnp, ib_dereg_pnp, ib_pfn_pnp_cb_t,\r
+* ib_ioc_info_t, ib_reject_ioc, ib_pnp_event_t\r
+*****/\r
+\r
+\r
+/****s* Access Layer/ib_pnp_ioc_rec_t\r
+* NAME\r
+* ib_pnp_ioc_rec_t\r
+*\r
+* DESCRIPTION\r
+* Notification information used to describe local channel adapter, port,\r
+* and I/O controller events.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_pnp_ioc_rec\r
+{\r
+ ib_pnp_rec_t pnp_rec;\r
+ net64_t ca_guid;\r
+ ib_ioc_info_t info;\r
+ ib_svc_entry_t svc_entry_array[1];\r
+\r
+} ib_pnp_ioc_rec_t;\r
+/*\r
+* FIELDS\r
+* pnp_rec\r
+* Structure describing the plug and play event being reported.\r
+*\r
+* ca_guid\r
+* GUID of the local HCA through which the I/O controller is accessible.\r
+* Valid only for IB_PNP_IOC_ADD events.\r
+*\r
+* p_ioc_info\r
+* The I/O controller information for an assigned controller, including\r
+* information for the I/O unit. Valid only for IB_PNP_IOC_ADD events.\r
+*\r
+* svc_entry_array\r
+* If an I/O controller is being reported, this will reference an array\r
+* of service entries associated with the I/O controller. The actual\r
+* number of entries in the array may be determined by examining the\r
+* svc_entries field in the I/O controller profile. Valid only for\r
+* IB_PNP_IOC_ADD events.\r
+*\r
+* NOTES\r
+* This structure is returned to the user to notify them of the addition\r
+* and removal of an I/O controller.\r
+*\r
+* The context field is NULL unless a context value has already been set\r
+* by the user.\r
+*\r
+* Context values can be changed by updating the appropriate field\r
+* and will be take effect once the notification callback returns.\r
+*\r
+* Once a device has been removed, all context associated with that device\r
+* is lost. Context is maintained between port down and subsequent port up\r
+* events provided that the channel adapter is not removed.\r
+*\r
+* SEE ALSO\r
+* ib_open_al, ib_ca_attr_t, ib_reg_pnp, ib_dereg_pnp, ib_pfn_pnp_cb_t,\r
+* ib_ioc_info_t, ib_reject_ioc, ib_pnp_event_t\r
+*****/\r
+\r
+\r
+/****s* Access Layer/ib_pnp_ioc_path_rec_t\r
+* NAME\r
+* ib_pnp_ioc_path_rec_t\r
+*\r
+* DESCRIPTION\r
+* Notification information used to describe local channel adapter, port,\r
+* and I/O controller events.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_pnp_ioc_path_rec\r
+{\r
+ ib_pnp_rec_t pnp_rec;\r
+ net64_t ca_guid;\r
+ net64_t port_guid;\r
+ ib_path_rec_t path;\r
+\r
+} ib_pnp_ioc_path_rec_t;\r
+/*\r
+* FIELDS\r
+* pnp_rec\r
+* Structure describing the plug and play event being reported.\r
+*\r
+* ca_guid\r
+* GUID of the local HCA through which the I/O controller is accessible.\r
+* Valid only for IB_PNP_IOC_PATH_ADD and IB_PNP_IOC_PATH_REMOVE events.\r
+*\r
+* port_guid\r
+* GUID of the local HCA port through which the I/O controller is\r
+* accessible. Valid only for IB_PNP_IOC_PATH_ADD and\r
+* IB_PNP_IOC_PATH_REMOVE events.\r
+*\r
+* p_path\r
+* Path record that provides connectivity with a given I/O controller.\r
+* Valid only for IB_PNP_IOC_PATH_ADD and IB_PNP_IOC_PATH_REMOVE events.\r
+*\r
+* NOTES\r
+* This structure is returned to the user to notify them of the addition\r
+* and removal of a path to an I/O controller. I/O controller path\r
+* notifications are only delivered with respect to a previously reported\r
+* I/O controller.\r
+*\r
+* The context field is NULL unless a context value has already been set\r
+* by the user.\r
+*\r
+* Context values can be changed by updating the appropriate field\r
+* and will be take effect once the notification callback returns.\r
+*\r
+* Once a device has been removed, all context associated with that device\r
+* is lost. Context is maintained between port down and subsequent port up\r
+* events provided that the channel adapter is not removed.\r
+*\r
+* SEE ALSO\r
+* ib_open_al, ib_ca_attr_t, ib_reg_pnp, ib_dereg_pnp, ib_pfn_pnp_cb_t,\r
+* ib_ioc_info_t, ib_reject_ioc, ib_pnp_event_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_pfn_pnp_cb_t\r
+* NAME\r
+* ib_pfn_pnp_cb_t\r
+*\r
+* DESCRIPTION\r
+* User-defined callback that is invoked to notify a client of the addition\r
+* or removal of a channel adapter, a port up or down event, port changes,\r
+* and the assignment of an I/O controller to a local port.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef ib_api_status_t\r
+(AL_API * __ptr64 ib_pfn_pnp_cb_t)(\r
+ IN ib_pnp_rec_t *p_pnp_rec );\r
+/*\r
+* PARAMETERS\r
+* p_pnp_rec\r
+* [in] A reference to a plug and play record. The plug and play\r
+* record contains details about the type of local event that has\r
+* occurred, along with the relevant device information.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* Indicates to the PnP manager that the callback client requires it\r
+* to maintain a context for this event.\r
+*\r
+* Other\r
+* Indicates to the PnP manager that the callback client does not need\r
+* a context for this event.\r
+*\r
+* NOTES\r
+* The callback is used to notify users of local events that have occurred\r
+* on a given channel adapter. Information about the type of event that\r
+* occurred along with the associated device is returned to the user through\r
+* the p_pnp_rec parameter.\r
+*\r
+* Users register for plug and play changes by requesting notification from\r
+* the access layer. Users may register for notifications either by directly\r
+* invoking the appropriate function in the access layer, or indirectly by\r
+* adding the necessary registration data to the access layer device file.\r
+*\r
+* This callback is invoked from within a system thread context.\r
+*\r
+* If the callback returns a status other than IB_SUCCESS, no further\r
+* callback for related events will be delivered.\r
+*\r
+* SEE ALSO\r
+* ib_pnp_rec_t, ib_reg_pnp, ib_dereg_pnp, ib_reject_ioc\r
+*****/\r
+\r
+\r
+/****s* Access Layer/ib_pnp_req_t\r
+* NAME\r
+* ib_pnp_req_t\r
+*\r
+* DESCRIPTION\r
+* Information used to register for notification of local and I/O\r
+* controller assignment events.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_pnp_req\r
+{\r
+ ib_pnp_class_t pnp_class;\r
+ const void *pnp_context;\r
+ ib_pfn_pnp_cb_t pfn_pnp_cb;\r
+\r
+} ib_pnp_req_t;\r
+/*\r
+* FIELDS\r
+* pnp_class\r
+* Specifies the class of PnP events that the client wishes to be\r
+* notified of.\r
+*\r
+* pnp_context\r
+* User-defined context information associated with this notification.\r
+* The context data is returned to the user as a part of their PnP\r
+* notification callback.\r
+*\r
+* pfn_pnp_cb\r
+* User-defined callback function that is invoked to notify the user of\r
+* the occurrance of a plug and play event.\r
+*\r
+* NOTES\r
+* This structure is used when requesting notification of local events from\r
+* the access layer. The class of PnP events which to be notified of is\r
+* specified through the pnp_class field.\r
+*\r
+* SEE ALSO\r
+* ib_pnp_class_t, ib_pfn_pnp_cb_t, ib_reg_pnp, ib_pnp_rec_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_reg_pnp\r
+* NAME\r
+* ib_reg_pnp\r
+*\r
+* DESCRIPTION\r
+* Routine used to register for notification of local and I/O controller\r
+* assignment events.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_reg_pnp(\r
+ IN const ib_al_handle_t h_al,\r
+ IN const ib_pnp_req_t* const p_pnp_req,\r
+ OUT ib_pnp_handle_t* const ph_pnp );\r
+/*\r
+* PARAMETERS\r
+* h_al\r
+* [in] A handle to an open instance of the access layer.\r
+*\r
+* p_pnp_req\r
+* [in] Specifies the type of events that the user wishes to be notified\r
+* of, along with information needed to process the completed query.\r
+*\r
+* ph_pnp\r
+* [out] Upon successful completion of this call, this references a handle\r
+* to the PnP notification request. This handle may be used to cancel the\r
+* notification registration.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The PnP registration was successful.\r
+*\r
+* IB_INVALID_AL_HANDLE\r
+* The access layer handle was invalid.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the PnP request information or handle was not provided.\r
+*\r
+* IB_INSUFFICIENT_MEMORY\r
+* There was insufficient memory to register for PnP notification.\r
+*\r
+* NOTES\r
+* This routine registers the calling client with the access layer for\r
+* notification of locally occurring events, or the assignment of I/O\r
+* controllers to a local device. Once registered, a client will receive\r
+* notification, via a callback, that a given event has occurred on a\r
+* local device. Clients may restrict the types of events and devices\r
+* that are reported. The p_pnp_req parameter is used to indicate which\r
+* device events to report to the user.\r
+*\r
+* Upon invoking this routine, the client may receive a callback through\r
+* the ib_pfn_pnp_cb_t routine to notify them of the current system state.\r
+* For example, if a client registers for notification of port up events,\r
+* then the access layer will notify the client of all available ports when\r
+* this routine is first invoked.\r
+*\r
+* SEE ALSO\r
+* ib_dereg_pnp, ib_pnp_req_t, ib_pnp_rec_t, ib_pfn_pnp_cb_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_dereg_pnp\r
+* NAME\r
+* ib_dereg_pnp\r
+*\r
+* DESCRIPTION\r
+* Routine used to cancel notification of local events or I/O controller\r
+* assignments.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_dereg_pnp(\r
+ IN const ib_pnp_handle_t h_pnp,\r
+ IN const ib_pfn_destroy_cb_t pfn_destroy_cb OPTIONAL );\r
+/*\r
+* PARAMETERS\r
+* h_pnp\r
+* [in] A handle returned as a result of an ib_reg_pnp operation.\r
+*\r
+* pfn_destroy_cb\r
+* [in] A user-specified callback that is invoked after the PnP\r
+* registration has been successfully deregistered.\r
+*\r
+* NOTES\r
+* This routine cancels a pending PnP operation. To avoid a race condition\r
+* canceling a request at the same time a notification callback is in\r
+* progress, the cancel operation operates asynchronously. For additional\r
+* details see ib_pfn_destroy_cb_t.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The PnP deregistration was initiated.\r
+*\r
+* IB_INVALID_HANDLE\r
+* The PnP handle was invalid.\r
+*\r
+* SEE ALSO\r
+* ib_reg_pnp, ib_pfn_destroy_cb_t\r
+*****/\r
+\r
+\r
+/****s* Access Layer/ib_sub_rec_t\r
+* NAME\r
+* ib_sub_rec_t\r
+*\r
+* DESCRIPTION\r
+* Information returned to a user that indicates the result of a subscription\r
+* request.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_sub_rec\r
+{\r
+ const void* __ptr64 sub_context;\r
+ ib_api_status_t status;\r
+ ib_sub_handle_t h_sub;\r
+\r
+} ib_sub_rec_t;\r
+/*\r
+* FIELDS\r
+* sub_context\r
+* References user-defined context information associated with the\r
+* subscription request. This field is set by the user through the\r
+* ib_subscribe routine.\r
+*\r
+* status\r
+* Indicates the success of the subscription request.\r
+*\r
+* h_sub\r
+* The handle to the subscription request that was returned to the user\r
+* from the ib_subscribe call. This handle is provided to the user to\r
+* avoid a race condition between the return of the ib_subscribe routine\r
+* and the notification of an event.\r
+*\r
+* NOTES\r
+* This structure is returned to the user to notify them of the results\r
+* of a subscription request. After successfully subscribing with a\r
+* class manager for an event, this structure will be returned to the user\r
+* with the status set to IB_SUCCESS. The sub_context field will be set\r
+* to the context specified through the p_sub_req parameter in the\r
+* ib_subscribe routine.\r
+*\r
+* SEE ALSO\r
+* ib_subscribe\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_pfn_sub_cb_t\r
+* NAME\r
+* ib_pfn_sub_cb_t\r
+*\r
+* DESCRIPTION\r
+* User-defined callback invoked on completion of a subscription request.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef void\r
+(AL_API * __ptr64 ib_pfn_sub_cb_t)(\r
+ IN ib_sub_rec_t *p_sub_rec );\r
+/*\r
+* PARAMETERS\r
+* p_sub_rec\r
+* [in] This is a reference to a structure containing the result of the\r
+* subscription request.\r
+*\r
+* NOTES\r
+* This routine is invoked to notify a client of the result of a\r
+* subscription request with a class manager. If the subscription request\r
+* was successful, the client will receive future notifications of the\r
+* subscribed event from the class manager.\r
+*\r
+* This callback will always be invoked before a client receives information\r
+* reported on a subscribed event that has occurred.\r
+*\r
+* In the kernel, this callback is usually invoked using a tasklet, dependent\r
+* on the implementation of the underlying verbs provider driver.\r
+*\r
+* SEE ALSO\r
+* ib_subscribe, ib_sub_rec_t\r
+*****/\r
+\r
+\r
+/****s* Access Layer/ib_report_rec_t\r
+* NAME\r
+* ib_report_rec_t\r
+*\r
+* DESCRIPTION\r
+* Reported event information returned to the user when a subscribed for\r
+* event occurs.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_report_rec\r
+{\r
+ const void* __ptr64 report_context;\r
+ ib_mad_notice_attr_t* __ptr64 p_notice;\r
+\r
+} ib_report_rec_t;\r
+/*\r
+* FIELDS\r
+* report_context\r
+* Client-defined context information specified when registering for\r
+* the report.\r
+*\r
+* p_notice\r
+* Reported information that describes the event that has occurred.\r
+*\r
+* NOTES\r
+* Subscription for reported events is done through a class manager. When\r
+* a class manager detects that such an event occurs, it will generate a\r
+* report to the subscribed client. The reported information is referenced\r
+* through the p_notice field.\r
+*\r
+* SEE ALSO\r
+* ib_mad_notice_attr_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_pfn_report_cb_t\r
+* NAME\r
+* ib_pfn_report_cb_t\r
+*\r
+* DESCRIPTION\r
+* User-defined callback that is invoked to notify a client of an event\r
+* that has occurred on the fabric.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef void\r
+(AL_API * __ptr64 ib_pfn_report_cb_t)(\r
+ IN ib_report_rec_t *p_report_rec );\r
+/*\r
+* PARAMETERS\r
+* p_report_rec\r
+* [in] A reference to an event report. The report contains\r
+* details about the type of event that has occurred, along with the\r
+* relevant device information.\r
+*\r
+* NOTES\r
+* The callback is used to notify users of remote events that have been seen\r
+* by a specified class manager. Information about the type of event that\r
+* occurred along with the associated device is returned to the user through\r
+* the p_report_rec parameter.\r
+*\r
+* Users register for device changes by subscribing with a class manager.\r
+* Users may subscribe for events either by directly invoking the\r
+* appropriate function in the access layer, or indirectly by adding the\r
+* necessary registration data to the access layer device file.\r
+*\r
+* This callback is invoked from within a system thread context.\r
+*\r
+* SEE ALSO\r
+* ib_report_rec_t, ib_subscribe, ib_unsubscribe\r
+*****/\r
+\r
+\r
+/****s* Access Layer/ib_sub_req_t\r
+* NAME\r
+* ib_sub_req_t\r
+*\r
+* DESCRIPTION\r
+* Information used to subscribed for event notification from a class\r
+* manager.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_sub_req\r
+{\r
+ ib_svc_name_t* __ptr64 p_class_mgr_name;\r
+ ib_inform_info_t* __ptr64 p_inform_info;\r
+ ib_net64_t port_guid;\r
+\r
+ uint32_t timeout_ms;\r
+ uint32_t retry_cnt;\r
+ ib_al_flags_t flags;\r
+\r
+ const void* __ptr64 sub_context;\r
+ ib_pfn_sub_cb_t pfn_sub_cb;\r
+\r
+ const void* __ptr64 report_context;\r
+ ib_pfn_report_cb_t pfn_report_cb;\r
+\r
+} ib_sub_req_t;\r
+/*\r
+* FIELDS\r
+* p_class_mgr_name\r
+* The service name of the class manager to subscribe for events with.\r
+*\r
+* p_inform_info\r
+* Information describing the type of event being subscribed to.\r
+*\r
+* port_guid\r
+* Directs the subscription request to use the specified port. The\r
+* request will contact the subnet administrator reachable through the\r
+* given port.\r
+*\r
+* timeout_ms\r
+* Specifies the number of milliseconds to wait for a response for\r
+* this subscription until retrying or timing out the request.\r
+*\r
+* retry_cnt\r
+* Specifies the number of times that the query will be retried before\r
+* failing the request.\r
+*\r
+* flags\r
+* Used to describe the mode of operation. Set to IB_FLAGS_SYNC to\r
+* process the called routine synchronously.\r
+*\r
+* sub_context\r
+* User-defined context information associated with this subscription\r
+* request. This context is returned to the user through the function\r
+* specified by the pfn_sub_cb field.\r
+*\r
+* pfn_sub_cb\r
+* A user-defined callback that is invoked upon completion of the\r
+* subscription request. This is used to notify a client that of the\r
+* result of their subscription request.\r
+*\r
+* report_context\r
+* User-defined context information associated with this subscription.\r
+* This context is returned to the user through the client's\r
+* ib_pfn_report_cb_t callback routine specified in ib_open_al.\r
+*\r
+* pfn_report_cb\r
+* A user-defined callback that is invoked to notify the user that an\r
+* event report has been received.\r
+*\r
+* NOTES\r
+* This structure is used to subscribe for events with a class manager. Both\r
+* the subscription request and any corresponding event notifications operate\r
+* asynchronously. Clients will be notified of the result of their\r
+* subscription request before receiving notification of associated events.\r
+*\r
+* SEE ALSO\r
+* ib_subscribe, ib_svc_name_t, ib_inform_info_t, ib_pfn_sub_cb_t,\r
+* ib_pfn_report_cb_t, ib_open_al\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_subscribe\r
+* NAME\r
+* ib_subscribe\r
+*\r
+* DESCRIPTION\r
+* Subscribe with a class manager for event notification.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_subscribe(\r
+ IN const ib_al_handle_t h_al,\r
+ IN const ib_sub_req_t* const p_sub_req,\r
+ OUT ib_sub_handle_t* const ph_sub );\r
+/*\r
+* PARAMETERS\r
+* h_al\r
+* [in] A handle to an open instance of the access layer.\r
+*\r
+* p_sub_req\r
+* [in] Specifies the type of events that the user wishes to be\r
+* notified of, along with information needed to process the completed\r
+* subscription.\r
+*\r
+* ph_sub\r
+* [out] Upon successful completion of this call, this references a handle\r
+* to the subscription request. This handle may be used to unsubscribe\r
+* from the events.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The subscription request was initiated.\r
+*\r
+* IB_INVALID_AL_HANDLE\r
+* The access layer handle was invalid.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the subscription request or handle was not provided.\r
+*\r
+* IB_INSUFFICIENT_MEMORY\r
+* There was insufficient memory to perform the operation.\r
+*\r
+* IB_INVALID_GUID\r
+* No port was found for the port_guid specified in the request.\r
+*\r
+* IB_INSUFFICIENT_RESOURCES\r
+* There were insufficient resources currently available on the channel\r
+* adapter to perform the operation.\r
+*\r
+* NOTES\r
+* This routine registers the calling client with a class manager for\r
+* notification of events. Once registered, a client will receive\r
+* notification, via a callback, that a given event has occurred on\r
+* a device managed by the class manager.\r
+*\r
+* SEE ALSO\r
+* ib_unsubscribe, ib_sub_req_t, ib_pfn_sub_cb_t, ib_pfn_report_cb_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_unsubscribe\r
+* NAME\r
+* ib_unsubscribe\r
+*\r
+* DESCRIPTION\r
+* Unsubscribe with a class manager for event notification.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_unsubscribe(\r
+ IN const ib_sub_handle_t h_sub,\r
+ IN const ib_pfn_destroy_cb_t pfn_destroy_cb OPTIONAL );\r
+/*\r
+* PARAMETERS\r
+* h_al\r
+* [in] A handle to an open instance of the access layer.\r
+*\r
+* h_sub\r
+* [in] A handle to a subscribed event.\r
+*\r
+* pfn_destroy_cb\r
+* [in] A user-specified callback that is invoked after the subscription\r
+* request has been successfully canceled.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The unsubscribe request was initiated.\r
+*\r
+* IB_INVALID_HANDLE\r
+* The subscription handle was invalid.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the subscription request or handle was not provided.\r
+*\r
+* IB_INSUFFICIENT_MEMORY\r
+* There was insufficient memory to perform the operation.\r
+*\r
+* IB_INSUFFICIENT_RESOURCES\r
+* There were insufficient resources currently available on the channel\r
+* adapter to perform the operation.\r
+*\r
+* NOTES\r
+* This routine cancels an active or pending event subscription with a class\r
+* manager. To avoid a race condition canceling a subscription at the same\r
+* time an event notification callback is in progress, the unsubscribe\r
+* operation operates asynchronously. For additional details see\r
+* ib_pfn_destroy_cb_t.\r
+*\r
+* SEE ALSO\r
+* ib_subscribe, ib_pfn_destroy_cb_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_reject_ioc\r
+* NAME\r
+* ib_reject_ioc\r
+*\r
+* DESCRIPTION\r
+* Rejects an I/O controller assignment to a host.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_reject_ioc(\r
+ IN const ib_al_handle_t h_al,\r
+ IN const ib_pnp_handle_t h_ioc_event );\r
+/*\r
+* PARAMETERS\r
+* h_al\r
+* [in] A handle to an open instance of the access layer.\r
+*\r
+* h_ioc_event\r
+* [in] A handle provided as part of the notification of an I/O controller\r
+* being assigned. This handle is obtained through the ib_pnp_rec_t\r
+* structure given to a client through their ib_pfn_pnp_cb_t callback.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The I/O controller reject request was initiated.\r
+*\r
+* IB_INVALID_AL_HANDLE\r
+* The access layer handle was invalid.\r
+*\r
+* IB_INVALID_HANDLE\r
+* The I/O controller handle was invalid.\r
+*\r
+* IB_INSUFFICIENT_MEMORY\r
+* There was insufficient memory to perform the operation.\r
+*\r
+* IB_INSUFFICIENT_RESOURCES\r
+* There were insufficient resources currently available on the channel\r
+* adapter to perform the operation.\r
+*\r
+* NOTES\r
+* This routine rejects an I/O controller assigned by the configuration\r
+* manager to the local host. The access layer sends a rejection notification\r
+* to the configuration manager and disable access to the controller from\r
+* the local host. This routine must be called from a client's\r
+* ib_pfn_pnp_cb_t callback to reject a newly assigned I/O controller.\r
+*\r
+* SEE ALSO\r
+* ib_pfn_pnp_cb_t, ib_pnp_rec_t\r
+*****/\r
+\r
+\r
+#define IB_ANY_INDEX -1\r
+/****d* Access Layer/ib_device_attr_mask_t\r
+* NAME\r
+* ib_device_attr_mask_t\r
+*\r
+* DESCRIPTION\r
+* Used to specify desired attributes of a device or port.\r
+*\r
+* SYNOPSIS\r
+*/\r
+#define IB_DEV_PORT_ACTIVE 0x1\r
+/*\r
+* VALUES\r
+* IB_DEV_PORT_ACTIVE\r
+* Specifies that a port state should be active. Applies only to port\r
+* GUIDs.\r
+*\r
+* SEE ALSO\r
+* ib_get_guid\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_get_guid\r
+* NAME\r
+* ib_get_guid\r
+*\r
+* DESCRIPTION\r
+* Returns a GUID for a device or port that matches the user-specified\r
+* attributes.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_get_guid(\r
+ IN ib_al_handle_t h_al,\r
+ IN const uint32_t index,\r
+ IN const ib_pnp_class_t device_type,\r
+ IN const uint64_t attr_mask,\r
+ OUT ib_net64_t* const p_guid );\r
+/*\r
+* PARAMETERS\r
+* h_al\r
+* [in] A handle to an opened instance of the access layer.\r
+*\r
+* index\r
+* [in] Specifies the location of the device or port. Users specify this\r
+* value to iterate through all devices or ports on the system. If set\r
+* to IB_ANY_INDEX, then the first device or port matching the given\r
+* attributes will be returned.\r
+*\r
+* device_type\r
+* [in] Indicates the type of device to retrieve the GUID for.\r
+*\r
+* attr_mask\r
+* [in] Specifies a set of attributes that the given device or port\r
+* must have for a successful match to occur.\r
+*\r
+* p_guid\r
+* [out] On successful return, this parameter will reference the GUID\r
+* of the device or port that contains the specified attributes.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The operation was successful.\r
+*\r
+* IB_INVALID_AL_HANDLE\r
+* The access layer handle was invalid.\r
+*\r
+* IB_INVALID_SETTING\r
+* The specified device type is invalid.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* No p_guid parameter was specified.\r
+*\r
+* IB_NO_MATCH\r
+* The device or port at the specified index does not have the given\r
+* attributes.\r
+*\r
+* IB_INVALID_INDEX\r
+* No device or port exists for the specified index.\r
+*\r
+* NOTES\r
+* This routine returns a GUID for a device or port that matches the\r
+* user-specified attributes. If index is IB_ANY_INDEX, then the first\r
+* device or port matching the given attributes is returned if a match is\r
+* found. If no match is found, the call will return IB_NO_MATCH. If a\r
+* valid index is specified, then the device or port located at that index\r
+* will be examined to see if it has the given attributes. If the device\r
+* or port with those attributes is found, its GUID is returned.\r
+*\r
+* This routine may be used to locate a device or port with a given set\r
+* of attributes, or iterate through all devices or ports on the system.\r
+* The specified index values are set by the access layer, but the index\r
+* associated with a GUID may change if devices are removed from the system.\r
+*\r
+* SEE ALSO\r
+* ib_open_al, ib_pnp_class_t, ib_get_ca_guids, ib_query_ca_by_guid\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_ci_call\r
+* NAME\r
+* ib_ci_call\r
+*\r
+* DESCRIPTION\r
+* Performs a vendor specific CA interface function call.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_ci_call(\r
+ IN ib_ca_handle_t h_ca,\r
+ IN const void* __ptr64 * const handle_array OPTIONAL,\r
+ IN uint32_t num_handles,\r
+ IN ib_ci_op_t* const p_ci_op );\r
+/*\r
+* PARAMETERS\r
+* h_ca\r
+* [in] An opened instance of a channel adapter.\r
+*\r
+* handle_array\r
+* [in] This parameter references an array containing handles of\r
+* existing CA resources. This array should contain all of the\r
+* handles specified in the vendor specific data provided with this\r
+* call. All handles specified through this array are validated by\r
+* the access layer as existing and belonging to the calling process.\r
+* The verbs provider driver is responsible for verifying that the\r
+* number and type of handles are correct for the requested operation.\r
+*\r
+* num_handles\r
+* [in] The number of the handles in handle array. This count is\r
+* verified by the access layer.\r
+*\r
+* p_ci_op\r
+* [in] A reference to the vendor specific CA interface data\r
+* structure containing the operation parameters.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The operation was successful.\r
+*\r
+* IB_INVALID_CA_HANDLE\r
+* The specified CA handle was invalid.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the vendor specific data was not provided.\r
+*\r
+* IB_INVALID_HANDLE\r
+* A handle specified in the handle array was invalid.\r
+*\r
+* IB_INSUFFICIENT_MEMORY\r
+* There was insufficient memory to perform the operation.\r
+*\r
+* IB_ERROR\r
+* An error occurred while processing the command. Additional\r
+* error information is provided in the p_ci_op status field.\r
+*\r
+* NOTES\r
+* This routine performs a vendor specific CA interface function call.\r
+* The optional p_ci_op structure provides a means to pass vendor\r
+* specific parameters and data to the verbs provider driver. If the\r
+* vendor specific data contains handles, the client should provide the\r
+* optional handle array that lists all of the handles specified in the\r
+* vendor specific data. The handles in the handle array are restricted\r
+* to the following types: ib_pd_handle_t, ib_cq_handle_t,\r
+* ib_av_handle_t, ib_qp_handle_t, ib_mr_handle_t, or ib_mw_handle_t.\r
+* The contents of the handle array are verified by the access layer and\r
+* the verbs provider driver. This call cannot be used to allocate private\r
+* handles that are passed as parameters in access layer calls.\r
+*\r
+* SEE ALSO\r
+* ib_open_ca, ib_alloc_pd, ib_create_av, ib_create_cq,\r
+* ib_create_qp, ib_reg_mr, ib_reg_phys, ib_reg_shared,\r
+* ib_create_mw, ib_ci_op_t\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_open_al\r
+* NAME\r
+* ib_open_al\r
+*\r
+* DESCRIPTION\r
+* This routine opens an instance of the access layer for the user and\r
+* returns its handle.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_open_al(\r
+ OUT ib_al_handle_t* const ph_al );\r
+/*\r
+* PARAMETERS\r
+* ph_al\r
+* [in] Upon successful completion of this call, this parameter will\r
+* reference a handle to the access layer.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The access layer was opened successfully.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the access layer handle was not provided.\r
+*\r
+* IB_INSUFFICIENT_MEMORY\r
+* There was insufficient memory to perform the operation.\r
+*\r
+* NOTES\r
+* This function opens an instance of the access layer. An instance of the\r
+* access layer is required before allocating additional resources from the\r
+* access layer or a channel adapter. If successful, a handle to the access\r
+* layer is returned. User-mode clients should not call ib_open_al from the\r
+* module initialization routine.\r
+*\r
+* SEE ALSO\r
+* ib_close_al\r
+*****/\r
+\r
+\r
+/****f* Access Layer/ib_close_al\r
+* NAME\r
+* ib_close_al\r
+*\r
+* DESCRIPTION\r
+* Deregisters a channel driver with the access layer and releases all\r
+* associated resources, including queue pairs, connection requests,\r
+* and completion queues.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t AL_API\r
+ib_close_al(\r
+ IN const ib_al_handle_t h_al );\r
+/*\r
+* PARAMETERS\r
+* h_al\r
+* [in] A handle to an instance of the access layer.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The access layer was closed successfully.\r
+*\r
+* IB_INVALID_AL_HANDLE\r
+* The access layer handle was invalid.\r
+*\r
+* NOTES\r
+* This call destroys an existing instance of the access layer. Since\r
+* callbacks may be outstanding against the resources managed by this\r
+* access layer instance when the destroy operation is invoked, this\r
+* call may block until all outstanding callbacks complete. This\r
+* routine may not be called from a callback invoked by the access layer.\r
+*\r
+* SEE ALSO\r
+* ib_open_al\r
+*****/\r
+\r
+\r
+#ifdef __cplusplus\r
+} /* extern "C" */\r
+#endif /* __cplusplus */\r
+\r
+\r
+#endif /* __IB_AL_H__ */\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. \r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+\r
+#ifndef __IB_UAL_IOCTL_H__\r
+#define __IB_UAL_IOCTL_H__\r
+\r
+#include <complib/cl_types.h>\r
+#include <iba/ib_types.h>\r
+#include <iba/ib_ci.h>\r
+#include <iba/ib_al.h>\r
+\r
+\r
+\r
+/*\r
+* Typedefs\r
+*\r
+*/\r
+/*\r
+* ual_close_ca_ioctl:\r
+* NOTES:\r
+* It is sufficient to pass the ca handle to the kernel proxy on close_ca\r
+* The UAL context for this CA instance maintains the application callback\r
+* So, when the proxy notifies for a close_ca_callback, we know which\r
+* app callback to call\r
+*\r
+*/\r
+\r
+\r
+/****s* User-mode Access Layer/ual_bind_file_ioctl_t\r
+* NAME\r
+* ual_bind_file_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input and output parameters for\r
+* binding a file handle to an existing proxy context.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ual_bind_file_ioctl\r
+{\r
+ void* __ptr64 h_file;\r
+\r
+} ual_bind_file_ioctl_t;\r
+/*\r
+* FIELDS\r
+* h_file\r
+* File handle from the user-mode process intended for asynchronous requests.\r
+* The IOCTL code will specify the type of asynchronous requests to be\r
+* performed on this file handle.\r
+*\r
+* SEE ALSO\r
+*\r
+* NOTES\r
+*****/\r
+\r
+\r
+/****s* User-mode Access Layer/ual_get_uvp_name_t\r
+* NAME\r
+* ual_get_uvp_name_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input and output parameters for\r
+* getting the user library information.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ual_get_uvp_name\r
+{\r
+ struct _ual_get_uvp_name_in\r
+ {\r
+ ib_net64_t ca_guid;\r
+\r
+ } in;\r
+ struct _ual_get_uvp_name_out\r
+ {\r
+ ib_api_status_t status;\r
+ char uvp_lib_name[MAX_LIB_NAME];\r
+\r
+ } out;\r
+\r
+} ual_get_uvp_name_ioctl_t;\r
+/*\r
+* FIELDS\r
+* in.ca_guid\r
+* The GUID of the channel adapter\r
+*\r
+* out.status\r
+* Status of the operation\r
+*\r
+* out.uvp_lib_name\r
+* The vendor's library name associated with the CA\r
+*\r
+* SEE ALSO\r
+*\r
+*\r
+* NOTES\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_open_ca_ioctl_t\r
+* NAME\r
+* ual_open_ca_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input and output parameters for\r
+* ib_open_ca\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ual_open_ca_ioctl\r
+{\r
+ struct _ual_open_ca_ioctl_in\r
+ {\r
+ ci_umv_buf_t umv_buf;\r
+ ib_net64_t guid;\r
+ void* __ptr64 context;\r
+\r
+ } in;\r
+\r
+ struct _ual_open_ca_ioctl_out\r
+ {\r
+ ci_umv_buf_t umv_buf;\r
+ ib_api_status_t status;\r
+ uint64_t h_ca;\r
+\r
+ } out;\r
+\r
+} ual_open_ca_ioctl_t;\r
+/*\r
+* FIELDS\r
+* in.umv_buf\r
+* Opaque to IBAL buffer descriptor to allow the user-mode HCA library to\r
+* exchange private information with the kernel-mode HCA driver.\r
+*\r
+* in.guid\r
+* The GUID of the channel adapter to open.\r
+*\r
+* in.context\r
+* A caller-specified context to associate with this opened instance\r
+* of the channel adapter. This context is returned to the user when\r
+* invoking asynchronous callbacks referencing this channel adapter.\r
+*\r
+* out.umv_buf\r
+* Returns the status from the HCA driver to the user-mode HCA library,\r
+* along with any vendor specific output information.\r
+*\r
+* out.status\r
+* Status of the operation\r
+*\r
+* out.h_ca\r
+* On return from IOCTL, contains the CA Handle from AL.\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_query_ca_ioctl_t\r
+* NAME\r
+* ual_query_ca_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input and output parameters for\r
+* ib_query_ca\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ual_query_ca_ioctl\r
+{\r
+ struct _ual_query_ca_ioctl_in\r
+ {\r
+ ci_umv_buf_t umv_buf;\r
+ uint64_t h_ca;\r
+ uint32_t byte_cnt;\r
+ ib_ca_attr_t* __ptr64 p_ca_attr;\r
+\r
+ } in;\r
+ struct _ual_query_ca_ioctl_out\r
+ {\r
+ ci_umv_buf_t umv_buf;\r
+ ib_api_status_t status;\r
+ uint32_t byte_cnt;\r
+\r
+ } out;\r
+\r
+} ual_query_ca_ioctl_t;\r
+/*\r
+* FIELDS\r
+* in.umv_buf\r
+* Opaque to IBAL buffer descriptor to allow the user-mode HCA library to\r
+* exchange private information with the kernel-mode HCA driver.\r
+*\r
+* in.h_ca\r
+* The handle to an open instance of CA returned via a\r
+* ual_open_ca_ioctl structure.\r
+*\r
+* in.byte_cnt\r
+* Specifies the size of the data buffer referenced by the p_ca_attr\r
+* parameter.\r
+*\r
+* p_ca_attr\r
+* A reference to a buffer where the channel adapter attributes,\r
+* including port attribute information will be copied. If this parameter\r
+* is NULL, then the required buffer size needed to return all of the CA\r
+* attribute information is returned through the out.byte_cnt parameter.\r
+* The ib_ca_attr_t structure for the specified channel adapter is stored\r
+* at the top of this buffer.\r
+*\r
+* out.umv_buf\r
+* Returns the status from the HCA driver to the user-mode HCA library,\r
+* along with any vendor specific output information.\r
+*\r
+* out.status\r
+* Status of the operation\r
+*\r
+* out.byte_cnt\r
+* Contains the number of bytes used or needed to copy all CA attributes.\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_modify_ca_ioctl_t\r
+* NAME\r
+* ual_modify_ca_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input and output parameters for\r
+* ib_modify_ca\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ual_modify_ca_ioctl\r
+{\r
+ struct _ual_modify_ca_ioctl_in\r
+ {\r
+ uint64_t h_ca;\r
+ uint8_t port_num;\r
+ ib_ca_mod_t ca_mod;\r
+ ib_port_attr_mod_t port_attr_mod;\r
+\r
+ } in;\r
+ struct _ual_modify_ca_ioclt_out\r
+ {\r
+ ib_api_status_t status;\r
+\r
+ } out;\r
+\r
+\r
+} ual_modify_ca_ioctl_t;\r
+/*\r
+* FIELDS\r
+* in.h_ca\r
+* The handle to an open instance of CA (in KAL space).\r
+*\r
+* in.port_num\r
+* An index of the port that is being modified.\r
+*\r
+* in.ca_mod\r
+* The mask of the attributes and counters to modify.\r
+*\r
+* in.port_attr_mod\r
+* List of port attribute information to modify.\r
+*\r
+* out.status\r
+* Status of the operation\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_close_ca_ioctl_t\r
+* NAME\r
+* ual_close_ca_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input and output parameters for\r
+* ib_close_ca\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ual_close_ca_ioctl\r
+{\r
+ struct _ual_close_ca_ioctl_in\r
+ {\r
+ uint64_t h_ca;\r
+\r
+ } in;\r
+ struct _ual_close_ca_ioctl_out\r
+ {\r
+ ib_api_status_t status;\r
+\r
+ } out;\r
+\r
+} ual_close_ca_ioctl_t;\r
+/*\r
+* FIELDS\r
+* in.h_ca\r
+* The handle to an open instance of CA (in KAL space).\r
+*\r
+* out.status\r
+* Status of the operation\r
+*****/\r
+\r
+/****s* User-mode Access Layer/ual_ci_call_ioctl_t\r
+* NAME\r
+* ual_ci_call_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input and output parameters for\r
+* ib_ci_call\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ual_ci_call_ioctl\r
+{\r
+ struct _ual_ci_call_ioctl_in\r
+ {\r
+ ci_umv_buf_t umv_buf;\r
+ ib_ci_op_t ci_op;\r
+ uint64_t h_ca;\r
+ uint32_t num_handles;\r
+ uint64_t handle_array[1];\r
+\r
+ } in;\r
+ struct _ual_ci_call_ioctl_out\r
+ {\r
+ ci_umv_buf_t umv_buf;\r
+ ib_ci_op_t ci_op;\r
+ ib_api_status_t status;\r
+\r
+ } out;\r
+\r
+} ual_ci_call_ioctl_t;\r
+/*\r
+* FIELDS\r
+* in.umv_buf\r
+* Opaque to IBAL buffer descriptor to allow the user-mode HCA library to\r
+* exchange private information with the kernel-mode HCA driver.\r
+*\r
+* in.ci_op\r
+* Contains information on the operation that needs to be performed\r
+* by the verbs provider. The proxy marshals the data buffer between\r
+* user mode and kernel space.\r
+*\r
+* in.h_ca\r
+* The handle to an open instance of CA returned by a ual_open_ca_ioctl.\r
+*\r
+* in.num_handles\r
+* The number of handles in the array at in.p_handle_array.\r
+*\r
+* in.handle_array\r
+* First entry in an array of handles used for this operation. Ignored if\r
+* in.num_handles is zero.\r
+*\r
+* out.umv_buf\r
+* Returns the status from the HCA driver to the user-mode HCA library,\r
+* along with any vendor specific output information.\r
+*\r
+* out.status\r
+* Status of the operation\r
+*\r
+* out.ci_op\r
+* Contains information on the operation that needs to be performed\r
+* by the verbs provider. The proxy marshals the data buffer between\r
+* user mode and kernel space.\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_alloc_pd_ioctl_t\r
+* NAME\r
+* ual_alloc_pd_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input and output parameters for\r
+* ib_alloc_pd\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ual_alloc_pd_ioctl\r
+{\r
+ struct _ual_alloc_pd_ioctl_in\r
+ {\r
+ ci_umv_buf_t umv_buf;\r
+ uint64_t h_ca;\r
+ ib_pd_type_t type;\r
+ void* __ptr64 context;\r
+\r
+ } in;\r
+ struct _ual_alloc_pd_ioctl_out\r
+ {\r
+ ci_umv_buf_t umv_buf;\r
+ ib_api_status_t status;\r
+ uint64_t h_pd;\r
+\r
+ } out;\r
+\r
+} ual_alloc_pd_ioctl_t;\r
+/*\r
+* FIELDS\r
+* in.umv_buf\r
+* Opaque to IBAL buffer descriptor to allow the user-mode HCA library to\r
+* exchange private information with the kernel-mode HCA driver.\r
+*\r
+* in.h_ca\r
+* The handle to an open instance of CA returned in a ual_open_ca_ioctl.\r
+*\r
+* in.context\r
+* UAL's pd context. This context will be provided on destroy callback.\r
+*\r
+* out.umv_buf\r
+* Returns the status from the HCA driver to the user-mode HCA library,\r
+* along with any vendor specific output information.\r
+*\r
+* out.status\r
+* Status of the operation\r
+*\r
+* out.h_pd\r
+* The handle to the PD to use in further PD-related IOCTLs.\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_dealloc_pd_ioctl_t\r
+* NAME\r
+* ual_dealloc_pd_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input and output parameters for\r
+* ib_dealloc_pd\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ual_dealloc_pd_ioctl\r
+{\r
+ struct _ual_dealloc_pd_ioctl_in\r
+ {\r
+ uint64_t h_pd;\r
+\r
+ } in;\r
+ struct _ual_dealloc_pd_ioctl_out\r
+ {\r
+ ib_api_status_t status;\r
+\r
+ } out;\r
+\r
+} ual_dealloc_pd_ioctl_t;\r
+/*\r
+* FIELDS\r
+* in.h_pd\r
+* The handle of the PD that is going to be deallocated.\r
+*\r
+* out.status\r
+* Status of the operation\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_create_av_ioctl_t\r
+* NAME\r
+* ual_create_av_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input and output parameters for\r
+* ib_create_av\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ual_create_av_ioctl\r
+{\r
+ struct _ual_create_av_ioctl_in\r
+ {\r
+ ci_umv_buf_t umv_buf;\r
+ uint64_t h_pd;\r
+ ib_av_attr_t attr;\r
+\r
+ } in;\r
+ struct _ual_create_av_ioctl_out\r
+ {\r
+ ci_umv_buf_t umv_buf;\r
+ ib_api_status_t status;\r
+ uint64_t h_av;\r
+\r
+ } out;\r
+\r
+} ual_create_av_ioctl_t;\r
+/*\r
+* FIELDS\r
+* in.umv_buf\r
+* Opaque to IBAL buffer descriptor to allow the user-mode HCA library to\r
+* exchange private information with the kernel-mode HCA driver.\r
+*\r
+* in.h_pd\r
+* The handle to an already allocated PD (in KAL space).\r
+*\r
+* in.attr\r
+* Attributes of the address vector that needs to be created.\r
+*\r
+* out.umv_buf\r
+* Returns the status from the HCA driver to the user-mode HCA library,\r
+* along with any vendor specific output information.\r
+*\r
+* out.status\r
+* Status of the operation.\r
+*\r
+* out.h_av\r
+* Handle to the newly created address vector.\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_query_av_ioctl_t\r
+* NAME\r
+* ual_query_av_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input and output parameters for\r
+* ib_query_av\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ual_query_av_ioctl\r
+{\r
+ struct _ual_query_av_ioctl_in\r
+ {\r
+ ci_umv_buf_t umv_buf;\r
+ uint64_t h_av;\r
+\r
+ } in;\r
+ struct _ual_query_av_ioctl_out\r
+ {\r
+ ci_umv_buf_t umv_buf;\r
+ ib_api_status_t status;\r
+ ib_av_attr_t attr;\r
+ void* __ptr64 pd_context;\r
+\r
+ } out;\r
+\r
+} ual_query_av_ioctl_t;\r
+/*\r
+* FIELDS\r
+* in.umv_buf\r
+* Opaque to IBAL buffer descriptor to allow the user-mode HCA library to\r
+* exchange private information with the kernel-mode HCA driver.\r
+*\r
+* in.h_av\r
+* A handle to an existing address vector.\r
+*\r
+* out.umv_buf\r
+* Returns the status from the HCA driver to the user-mode HCA library,\r
+* along with any vendor specific output information.\r
+*\r
+* out.status\r
+* Status of the operation.\r
+*\r
+* out.attr\r
+* Attributes of the address vector.\r
+*\r
+* pd_context\r
+* Context associated with the PD when created.\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_modify_av_ioctl_t\r
+* NAME\r
+* ual_modify_av_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input and output parameters for\r
+* ib_modify_av\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ual_modify_av_ioctl\r
+{\r
+ struct _ual_modify_av_ioctl_in\r
+ {\r
+ ci_umv_buf_t umv_buf;\r
+ uint64_t h_av;\r
+ ib_av_attr_t attr;\r
+\r
+ } in;\r
+ struct _ual_modify_av_ioctl_out\r
+ {\r
+ ci_umv_buf_t umv_buf;\r
+ ib_api_status_t status;\r
+\r
+ } out;\r
+\r
+} ual_modify_av_ioctl_t;\r
+/*\r
+* FIELDS\r
+* in.umv_buf\r
+* Opaque to IBAL buffer descriptor to allow the user-mode HCA library to\r
+* exchange private information with the kernel-mode HCA driver.\r
+*\r
+* in.h_av\r
+* A handle to an existing address vector.\r
+*\r
+* in.attr\r
+* The requested attributes to be used for modifying the address vector.\r
+*\r
+* out.umv_buf\r
+* Returns the status from the HCA driver to the user-mode HCA library,\r
+* along with any vendor specific output information.\r
+*\r
+* out.status\r
+* Status of the operation\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_destroy_av_ioctl_t\r
+* NAME\r
+* ual_destroy_av_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input and output parameters for\r
+* ib_destroy_av\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ual_destroy_av_ioctl\r
+{\r
+ struct _ual_destroy_av_ioctl_in\r
+ {\r
+ uint64_t h_av;\r
+\r
+ } in;\r
+ struct _ual_destroy_av_ioctl_out\r
+ {\r
+ ib_api_status_t status;\r
+\r
+ } out;\r
+\r
+} ual_destroy_av_ioctl_t;\r
+/*\r
+* FIELDS\r
+* in.h_av\r
+* A handle to an existing address vector.\r
+*\r
+* out.status\r
+* Status of the operation.\r
+*****/\r
+\r
+/****s* User-mode Access Layer/ual_create_srq_ioctl_t\r
+* NAME\r
+* ual_create_srq_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input and output parameters for\r
+* ib_create_srq\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ual_create_srq_ioctl\r
+{\r
+ struct _ual_create_srq_ioctl_in\r
+ {\r
+ ci_umv_buf_t umv_buf;\r
+ uint64_t h_pd;\r
+ ib_srq_attr_t srq_attr;\r
+ void* __ptr64 context;\r
+ boolean_t ev_notify;\r
+\r
+ } in;\r
+ struct _ual_create_srq_ioctl_out\r
+ {\r
+ ci_umv_buf_t umv_buf;\r
+ ib_api_status_t status;\r
+ uint64_t h_srq;\r
+\r
+ } out;\r
+\r
+} ual_create_srq_ioctl_t;\r
+/*\r
+* FIELDS\r
+* in.umv_buf\r
+* Opaque to IBAL buffer descriptor to allow the user-mode HCA library to\r
+* exchange private information with the kernel-mode HCA driver.\r
+*\r
+* in.h_pd\r
+* Protection domain on which to create the srq.\r
+*\r
+* in.srq_attr\r
+* Attributes necessary for creating the srq.\r
+*\r
+* in.context\r
+* UAL's srq context that needs to be returned on a callback.\r
+*\r
+* in.ev_notify\r
+* Boolean indicating whether asynchronous events should be\r
+* forwarded to user-mode.\r
+*\r
+* out.umv_buf\r
+* Returns the status from the HCA driver to the user-mode HCA library,\r
+* along with any vendor specific output information.\r
+*\r
+* out.status\r
+* Status of the operation.\r
+*\r
+* out.h_srq\r
+* Handle for the newly created srq.\r
+*****/\r
+\r
+\r
+/****s* User-mode Access Layer/ual_modify_srq_ioctl_t\r
+* NAME\r
+* ual_modify_srq_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input and output parameters for\r
+* ib_modify_srq\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ual_modify_srq_ioctl\r
+{\r
+ struct _ual_modify_srq_ioctl_in\r
+ {\r
+ ci_umv_buf_t umv_buf;\r
+ uint64_t h_srq;\r
+ ib_srq_attr_mask_t srq_attr_mask;\r
+ ib_srq_attr_t srq_attr;\r
+\r
+ } in;\r
+ struct _ual_modify_srq_ioctl_out\r
+ {\r
+ ci_umv_buf_t umv_buf;\r
+ ib_api_status_t status;\r
+\r
+ } out;\r
+\r
+} ual_modify_srq_ioctl_t;\r
+/*\r
+* FIELDS\r
+* in.umv_buf\r
+* Opaque to IBAL buffer descriptor to allow the user-mode HCA library to\r
+* exchange private information with the kernel-mode HCA driver.\r
+*\r
+* in.h_srq\r
+* A handle to an existing Queue Pair.\r
+*\r
+* in.modify_attr\r
+* Attributes used for modifying the srq.\r
+*\r
+* out.umv_buf\r
+* Returns the status from the HCA driver to the user-mode HCA library,\r
+* along with any vendor specific output information.\r
+*\r
+* out.status\r
+* Status of the operation.\r
+*\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_query_srq_ioctl_t\r
+* NAME\r
+* ual_query_srq_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input and output parameters for\r
+* ib_query_srq\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ual_query_srq_ioctl\r
+{\r
+ struct _ual_query_srq_ioctl_in\r
+ {\r
+ ci_umv_buf_t umv_buf;\r
+ uint64_t h_srq;\r
+\r
+ } in;\r
+ struct _ual_query_srq_ioctl_out\r
+ {\r
+ ci_umv_buf_t umv_buf;\r
+ ib_api_status_t status;\r
+ ib_srq_attr_t srq_attr;\r
+\r
+ } out;\r
+\r
+} ual_query_srq_ioctl_t;\r
+/*\r
+* FIELDS\r
+* in.umv_buf\r
+* Opaque to IBAL buffer descriptor to allow the user-mode HCA library to\r
+* exchange private information with the kernel-mode HCA driver.\r
+*\r
+* h_srq\r
+* Handle to the srq whose attributes to query.\r
+*\r
+* out.umv_buf\r
+* Returns the status from the HCA driver to the user-mode HCA library,\r
+* along with any vendor specific output information.\r
+*\r
+* out.status\r
+* Status of the operation.\r
+*\r
+* out.srq_attr\r
+* Attributes of the srq.\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_destroy_srq_ioctl_t\r
+* NAME\r
+* ual_destroy_srq_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input and output parameters for\r
+* ib_destroy_srq\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ual_destroy_srq_ioctl\r
+{\r
+ struct _ual_destroy_srq_ioctl_in\r
+ {\r
+ uint64_t h_srq;\r
+\r
+ } in;\r
+ struct _ual_destroy_srq_ioctl_out\r
+ {\r
+ ib_api_status_t status;\r
+\r
+ } out;\r
+\r
+} ual_destroy_srq_ioctl_t;\r
+/*\r
+* FIELDS\r
+* in.h_srq\r
+* Handle of the srq that needs to be destroyed.\r
+*\r
+* out.status\r
+* Status of the operation.\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_create_qp_ioctl_t\r
+* NAME\r
+* ual_create_qp_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input and output parameters for\r
+* ib_create_qp\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ual_create_qp_ioctl\r
+{\r
+ struct _ual_create_qp_ioctl_in\r
+ {\r
+ ci_umv_buf_t umv_buf;\r
+ uint64_t h_pd;\r
+ ib_qp_create_t qp_create;\r
+ void* __ptr64 context;\r
+ boolean_t ev_notify;\r
+\r
+ } in;\r
+ struct _ual_create_qp_ioctl_out\r
+ {\r
+ ci_umv_buf_t umv_buf;\r
+ ib_api_status_t status;\r
+ ib_qp_attr_t attr;\r
+ uint64_t h_qp;\r
+\r
+ } out;\r
+\r
+} ual_create_qp_ioctl_t;\r
+/*\r
+* FIELDS\r
+* in.umv_buf\r
+* Opaque to IBAL buffer descriptor to allow the user-mode HCA library to\r
+* exchange private information with the kernel-mode HCA driver.\r
+*\r
+* in.h_pd\r
+* Protection domain on which to create the QP.\r
+*\r
+* in.qp_create\r
+* Attributes necessary for creating the QP.\r
+*\r
+* in.context\r
+* UAL's qp context that needs to be returned on a callback.\r
+*\r
+* in.ev_notify\r
+* Boolean indicating whether asynchronous events should be\r
+* forwarded to user-mode.\r
+*\r
+* out.umv_buf\r
+* Returns the status from the HCA driver to the user-mode HCA library,\r
+* along with any vendor specific output information.\r
+*\r
+* out.status\r
+* Status of the operation.\r
+*\r
+* out.attr\r
+* Actual attributes of the newly created QP.\r
+*\r
+* out.h_qp\r
+* Handle for the newly created QP.\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_modify_qp_ioctl_t\r
+* NAME\r
+* ual_modify_qp_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input and output parameters for\r
+* ib_modify_qp\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ual_modify_qp_ioctl\r
+{\r
+ struct _ual_modify_qp_ioctl_in\r
+ {\r
+ ci_umv_buf_t umv_buf;\r
+ uint64_t h_qp;\r
+ ib_qp_mod_t modify_attr;\r
+\r
+ } in;\r
+ struct _ual_modify_qp_ioctl_out\r
+ {\r
+ ci_umv_buf_t umv_buf;\r
+ ib_api_status_t status;\r
+ //ib_qp_query_t query_attr; // Not returned by AL\r
+\r
+ } out;\r
+\r
+} ual_modify_qp_ioctl_t;\r
+/*\r
+* FIELDS\r
+* in.umv_buf\r
+* Opaque to IBAL buffer descriptor to allow the user-mode HCA library to\r
+* exchange private information with the kernel-mode HCA driver.\r
+*\r
+* in.h_qp\r
+* A handle to an existing Queue Pair.\r
+*\r
+* in.modify_attr\r
+* Attributes used for modifying the QP.\r
+*\r
+* out.umv_buf\r
+* Returns the status from the HCA driver to the user-mode HCA library,\r
+* along with any vendor specific output information.\r
+*\r
+* out.status\r
+* Status of the operation.\r
+*\r
+* out.query_attr\r
+* On return from the ioctl, contains the actual attributes of\r
+* the QP just modified.\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_query_qp_ioctl_t\r
+* NAME\r
+* ual_query_qp_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input and output parameters for\r
+* ib_query_qp\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ual_query_qp_ioctl\r
+{\r
+ struct _ual_query_qp_ioctl_in\r
+ {\r
+ ci_umv_buf_t umv_buf;\r
+ uint64_t h_qp;\r
+\r
+ } in;\r
+ struct _ual_query_qp_ioctl_out\r
+ {\r
+ ci_umv_buf_t umv_buf;\r
+ ib_api_status_t status;\r
+ ib_qp_attr_t attr;\r
+\r
+ } out;\r
+\r
+} ual_query_qp_ioctl_t;\r
+/*\r
+* FIELDS\r
+* in.umv_buf\r
+* Opaque to IBAL buffer descriptor to allow the user-mode HCA library to\r
+* exchange private information with the kernel-mode HCA driver.\r
+*\r
+* h_qp\r
+* Handle to the QP whose attributes to query.\r
+*\r
+* out.umv_buf\r
+* Returns the status from the HCA driver to the user-mode HCA library,\r
+* along with any vendor specific output information.\r
+*\r
+* out.status\r
+* Status of the operation.\r
+*\r
+* out.attr\r
+* Attributes of the QP.\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_destroy_qp_ioctl_t\r
+* NAME\r
+* ual_destroy_qp_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input and output parameters for\r
+* ib_destroy_qp\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ual_destroy_qp_ioctl\r
+{\r
+ struct _ual_destroy_qp_ioctl_in\r
+ {\r
+ uint64_t h_qp;\r
+\r
+ } in;\r
+ struct _ual_destroy_qp_ioctl_out\r
+ {\r
+ ib_api_status_t status;\r
+\r
+ } out;\r
+\r
+} ual_destroy_qp_ioctl_t;\r
+/*\r
+* FIELDS\r
+* in.h_qp\r
+* Handle of the QP that needs to be destroyed.\r
+*\r
+* out.status\r
+* Status of the operation.\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_create_cq_ioctl_t\r
+* NAME\r
+* ual_create_cq_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input and output parameters for\r
+* ib_create_cq\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ual_create_cq_ioctl\r
+{\r
+ struct _ual_create_cq_ioctl_in\r
+ {\r
+ ci_umv_buf_t umv_buf;\r
+ uint64_t h_ca;\r
+ void* __ptr64 h_wait_obj;\r
+ void* __ptr64 context;\r
+ uint32_t size;\r
+ boolean_t ev_notify;\r
+\r
+ } in;\r
+ struct _ual_create_cq_ioctl_out\r
+ {\r
+ ci_umv_buf_t umv_buf;\r
+ ib_api_status_t status;\r
+ uint64_t h_cq;\r
+ uint32_t size;\r
+\r
+ } out;\r
+\r
+} ual_create_cq_ioctl_t;\r
+/*\r
+* FIELDS\r
+* in.umv_buf\r
+* Opaque to IBAL buffer descriptor to allow the user-mode HCA library to\r
+* exchange private information with the kernel-mode HCA driver.\r
+*\r
+* in.h_ca\r
+* CA handle on which to create the CQ.\r
+*\r
+* in.cq_create\r
+* Attributes necessary for creating the cq.\r
+*\r
+* in.cq_context\r
+* UAL's cq context that needs to be returned on a callback.\r
+*\r
+* in.ev_notify\r
+* Boolean indicating whether asynchronous events should be\r
+* forwared to user-mode.\r
+*\r
+* out.umv_buf\r
+* Returns the status from the HCA driver to the user-mode HCA library,\r
+* along with any vendor specific output information.\r
+*\r
+* out.status\r
+* Status of the operation.\r
+*\r
+* h_cq\r
+* Handle to the newly created CQ.\r
+*\r
+* size\r
+* Actual size of the newly created CQ.\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_modify_cq_ioctl_t\r
+* NAME\r
+* ual_modify_cq_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input and output parameters for\r
+* ib_modify_cq\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ual_modify_cq_ioctl\r
+{\r
+ struct _ual_modify_cq_ioctl_in\r
+ {\r
+ ci_umv_buf_t umv_buf;\r
+ uint64_t h_cq;\r
+ uint32_t size;\r
+\r
+ } in;\r
+ struct _ual_modify_cq_ioctl_out\r
+ {\r
+ ci_umv_buf_t umv_buf;\r
+ ib_api_status_t status;\r
+ uint32_t size;\r
+\r
+ } out;\r
+\r
+} ual_modify_cq_ioctl_t;\r
+/*\r
+* FIELDS\r
+* in.umv_buf\r
+* Opaque to IBAL buffer descriptor to allow the user-mode HCA library to\r
+* exchange private information with the kernel-mode HCA driver.\r
+*\r
+* in.h_cq\r
+* A handle to the CQ to modify.\r
+*\r
+* in.size\r
+* The requested new size of the CQ.\r
+*\r
+* out.umv_buf\r
+* Returns the status from the HCA driver to the user-mode HCA library,\r
+* along with any vendor specific output information.\r
+*\r
+* out.status\r
+* Status of the operation.\r
+*\r
+* out.size\r
+* The actual size of the CQ.\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_query_cq_ioctl_t\r
+* NAME\r
+* ual_query_cq_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input and output parameters for\r
+* ib_query_cq\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ual_query_cq_ioctl\r
+{\r
+ struct _ual_query_cq_ioctl_in\r
+ {\r
+ ci_umv_buf_t umv_buf;\r
+ uint64_t h_cq;\r
+\r
+ } in;\r
+ struct _ual_query_cq_ioctl_out\r
+ {\r
+ ci_umv_buf_t umv_buf;\r
+ ib_api_status_t status;\r
+ uint32_t size;\r
+\r
+ } out;\r
+\r
+} ual_query_cq_ioctl_t;\r
+/*\r
+* FIELDS\r
+* in.umv_buf\r
+* Opaque to IBAL buffer descriptor to allow the user-mode HCA library to\r
+* exchange private information with the kernel-mode HCA driver.\r
+*\r
+* in.h_cq\r
+* A handle to an existing CQ.\r
+*\r
+* out.umv_buf\r
+* Returns the status from the HCA driver to the user-mode HCA library,\r
+* along with any vendor specific output information.\r
+*\r
+* out.status\r
+* Status of the operation.\r
+*\r
+* out.size\r
+* The size of the CQ.\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_destroy_cq_ioctl_t\r
+* NAME\r
+* ual_destroy_cq_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input and output parameters for\r
+* ib_destroy_cq\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ual_destroy_cq_ioctl\r
+{\r
+ struct _ual_destroy_cq_ioctl_in\r
+ {\r
+ uint64_t h_cq;\r
+\r
+ } in;\r
+ struct _ual_destroy_cq_ioctl_out\r
+ {\r
+ ib_api_status_t status;\r
+\r
+ } out;\r
+\r
+} ual_destroy_cq_ioctl_t;\r
+/*\r
+* FIELDS\r
+* in.h_cq\r
+* Handle of the cq that needs to be destroyed.\r
+*\r
+* out.status\r
+* Status of the operation.\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_reg_mem_ioctl_t\r
+* NAME\r
+* ual_reg_mem_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input and output parameters for\r
+* ib_reg_mem\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ual_reg_mem_ioctl\r
+{\r
+ struct _ual_reg_mem_ioctl_in\r
+ {\r
+ uint64_t h_pd;\r
+ ib_mr_create_t mem_create;\r
+\r
+ } in;\r
+ struct _ual_reg_mem_ioctl_out\r
+ {\r
+ ib_api_status_t status;\r
+ net32_t lkey;\r
+ net32_t rkey;\r
+ uint64_t h_mr;\r
+\r
+ } out;\r
+\r
+} ual_reg_mem_ioctl_t;\r
+/*\r
+* FIELDS\r
+* in.h_pd\r
+* Handle to the protection domain on which to register the memory.\r
+*\r
+* in.mem_create\r
+* Information for registering the memory region.\r
+*\r
+* out.status\r
+* Status of the operation.\r
+*\r
+* out.lkey\r
+* LKey value returned by verb.\r
+*\r
+* out.rkey\r
+* RKey value returned by verb.\r
+*\r
+* h_mr\r
+* Handle to the registered memory region.\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_query_mr_ioctl_t\r
+* NAME\r
+* ual_query_mr_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input and output parameters for\r
+* ib_query_mr\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ual_query_mr_ioctl\r
+{\r
+ struct _ual_query_mr_ioctl_in\r
+ {\r
+ uint64_t h_mr;\r
+\r
+ } in;\r
+ struct _ual_query_mr_ioctl_out\r
+ {\r
+ ib_api_status_t status;\r
+ ib_mr_attr_t attr;\r
+\r
+ } out;\r
+\r
+} ual_query_mr_ioctl_t;\r
+/*\r
+* FIELDS\r
+* in.h_mr\r
+* A handle to a registered memory region.\r
+*\r
+* out.status\r
+* Status of the operation.\r
+*\r
+* out.attr\r
+* Attributes of the registered memory region.\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_rereg_mem_ioctl_t\r
+* NAME\r
+* ual_rereg_mem_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input and output parameters for\r
+* ib_modify_mr\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ual_rereg_mem_ioctl\r
+{\r
+ struct _ual_rereg_mem_ioctl_in\r
+ {\r
+ uint64_t h_mr;\r
+ ib_mr_mod_t mem_mod_mask;\r
+ ib_mr_create_t mem_create;\r
+ uint64_t h_pd;\r
+\r
+ } in;\r
+ struct _ual_rereg_mem_ioctl_out\r
+ {\r
+ ib_api_status_t status;\r
+ net32_t lkey;\r
+ net32_t rkey;\r
+\r
+ } out;\r
+\r
+} ual_rereg_mem_ioctl_t;\r
+/*\r
+* FIELDS\r
+* in.h_mr\r
+* A handle to a registered memory region that is being modified.\r
+*\r
+* in.mem_mod_mask\r
+* The attributes to use when modifying the memory region.\r
+*\r
+* in.mem_create\r
+* Information to use for modifying the memory region. Required only\r
+* for changes other than the PD.\r
+*\r
+* in.h_pd\r
+* PD Handle for changing protection domains.\r
+*\r
+* out.status\r
+* Status of the operation.\r
+*\r
+* out.l_key\r
+* LKey of the memory region.\r
+*\r
+* out.rkey\r
+* RKey of the memory region.\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_reg_shared_ioctl_t\r
+* NAME\r
+* ual_reg_shared_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input and output parameters for\r
+* ib_reg_shared\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ual_reg_shared_ioctl\r
+{\r
+ struct _ual_reg_shared_ioctl_in\r
+ {\r
+ uint64_t h_mr;\r
+ uint64_t h_pd;\r
+ ib_access_t access_ctrl;\r
+ uint64_t vaddr;\r
+\r
+ } in;\r
+ struct _ual_reg_shared_ioctl_out\r
+ {\r
+ ib_api_status_t status;\r
+ uint64_t vaddr;\r
+ net32_t lkey;\r
+ net32_t rkey;\r
+ uint64_t h_new_mr;\r
+\r
+ } out;\r
+\r
+} ual_reg_shared_ioctl_t;\r
+/*\r
+* FIELDS\r
+* in.h_mr\r
+* A handle to the existing registered memory region.\r
+*\r
+* in.h_pd\r
+* A handle to the PD on which memory is being registered.\r
+*\r
+* in.access_ctrl\r
+* Access control for the new memory region.\r
+*\r
+* in.vaddr\r
+* Requested virtual address.\r
+*\r
+* out.status\r
+* Status of the operation.\r
+*\r
+* out.vaddr\r
+* Actual virtual address of the registered region.\r
+*\r
+* out.l_key\r
+* LKey of the memory region.\r
+*\r
+* out.rkey\r
+* RKey of the memory region.\r
+*\r
+* h_new_mr\r
+* Handle to the registered memory region.\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_dereg_mr_ioctl_t\r
+* NAME\r
+* ual_dereg_mr_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input and output parameters for\r
+* ib_dereg_mr\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ual_dereg_mr_ioctl\r
+{\r
+ struct _ual_dereg_mr_ioctl_in\r
+ {\r
+ uint64_t h_mr;\r
+\r
+ } in;\r
+ struct _ual_dereg_mr_ioctl_out\r
+ {\r
+ ib_api_status_t status;\r
+ \r
+ } out;\r
+\r
+} ual_dereg_mr_ioctl_t;\r
+/*\r
+* FIELDS\r
+* in.h_mr\r
+* A handle to a registered memory region.\r
+*\r
+* out.status\r
+* Status of the operation.\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_create_mw_ioctl_t\r
+* NAME\r
+* ual_create_mw_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input and output parameters for\r
+* ib_create_mw\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ual_create_mw_ioctl\r
+{\r
+ struct _ual_create_mw_ioctl_in\r
+ {\r
+ ci_umv_buf_t umv_buf;\r
+ uint64_t h_pd;\r
+\r
+ } in;\r
+ struct _ual_create_mw_ioctl_out\r
+ {\r
+ ci_umv_buf_t umv_buf;\r
+ ib_api_status_t status;\r
+ net32_t rkey;\r
+ uint64_t h_mw;\r
+\r
+ } out;\r
+\r
+} ual_create_mw_ioctl_t;\r
+/*\r
+* FIELDS\r
+* in.umv_buf\r
+* Opaque to IBAL buffer descriptor to allow the user-mode HCA library to\r
+* exchange private information with the kernel-mode HCA driver.\r
+*\r
+* in.h_pd\r
+* A handle to the protection domain on which the memory window should\r
+* be created.\r
+*\r
+* out.umv_buf\r
+* Returns the status from the HCA driver to the user-mode HCA library,\r
+* along with any vendor specific output information.\r
+*\r
+* out.status\r
+* Status of the operation.\r
+*\r
+* out.rkey\r
+* RKey associated with the memory window.\r
+*\r
+* h_mw\r
+* Handle to the newly created MW.\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_query_mw_ioctl_t\r
+* NAME\r
+* ual_query_mw_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input and output parameters for\r
+* ib_query_mw\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ual_query_mw_ioctl\r
+{\r
+ struct _ual_query_mw_ioctl_in\r
+ {\r
+ ci_umv_buf_t umv_buf;\r
+ uint64_t h_mw;\r
+\r
+ } in;\r
+ struct _ual_query_mw_ioctl_out\r
+ {\r
+ ci_umv_buf_t umv_buf;\r
+ ib_api_status_t status;\r
+ void* __ptr64 pd_context;\r
+ net32_t rkey;\r
+\r
+ } out;\r
+\r
+} ual_query_mw_ioctl_t;\r
+/*\r
+* FIELDS\r
+* in.umv_buf\r
+* Opaque to IBAL buffer descriptor to allow the user-mode HCA library to\r
+* exchange private information with the kernel-mode HCA driver.\r
+*\r
+* in.h_mw\r
+* A handle to an existing memory window.\r
+*\r
+* out.umv_buf\r
+* Returns the status from the HCA driver to the user-mode HCA library,\r
+* along with any vendor specific output information.\r
+*\r
+* out.status\r
+* Status of the operation.\r
+*\r
+* pd_context\r
+* This user-mode context for the protection domain\r
+* associated with the memory window.\r
+*\r
+* rkey\r
+* RKey associated with the memory window.\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_bind_mw_ioctl_t\r
+* NAME\r
+* ual_bind_mw_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input and output parameters for\r
+* ib_bind_mw\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ual_bind_mw_ioctl\r
+{\r
+ struct _ual_bind_mw_ioctl_in\r
+ {\r
+ uint64_t h_mw;\r
+ uint64_t h_qp;\r
+ ib_bind_wr_t mw_bind;\r
+\r
+ } in;\r
+ struct _ual_bind_mw_ioctl_out\r
+ {\r
+ ib_api_status_t status;\r
+ uint32_t r_key;\r
+\r
+ } out;\r
+\r
+} ual_bind_mw_ioctl_t;\r
+/*\r
+* FIELDS\r
+* in.h_mw\r
+* A handle to an existing memory window.\r
+*\r
+* in.h_qp\r
+* The qp handle to post the bind request.\r
+*\r
+* in.mw_bind\r
+* Bind request.\r
+*\r
+* out.status\r
+* Status of the operation.\r
+*\r
+* out.rkey\r
+* RKey for the memory window.\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_destroy_mw_ioctl_t\r
+* NAME\r
+* ual_destroy_mw_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input and output parameters for\r
+* ib_destroy_mw\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ual_destroy_mw_ioctl\r
+{\r
+ struct _ual_destroy_mw_ioctl_in\r
+ {\r
+ uint64_t h_mw;\r
+\r
+ } in;\r
+ struct _ual_destroy_mw_ioctl_out\r
+ {\r
+ ib_api_status_t status;\r
+\r
+ } out;\r
+\r
+} ual_destroy_mw_ioctl_t;\r
+/*\r
+* FIELDS\r
+* in.h_mw\r
+* A handle to an existing memory window.\r
+*\r
+* out.status\r
+* Status of the operation\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_post_send_ioctl_t\r
+* NAME\r
+* ual_post_send_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input and output parameters for\r
+* ib_post_send\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ual_post_send_ioctl\r
+{\r
+ struct _ual_post_send_ioctl_in\r
+ {\r
+ uint64_t h_qp;\r
+ uint32_t num_wr;\r
+ uint32_t num_ds;\r
+ ib_send_wr_t send_wr[1];\r
+ /* Additional work requests follow, followed by data segments. */\r
+\r
+ } in;\r
+ struct _ual_post_send_ioctl_out\r
+ {\r
+ ib_api_status_t status;\r
+ uint32_t failed_cnt;\r
+\r
+ } out;\r
+\r
+} ual_post_send_ioctl_t;\r
+/*\r
+* FIELDS\r
+* in.h_qp\r
+* A handle to QP where the work request is being posted.\r
+*\r
+* in.num_wr\r
+* Number of work request items in the array of work requests.\r
+*\r
+* in.num_ds\r
+* Number of data segments following the array of work requests.\r
+*\r
+* in.send_wr\r
+* First work request in the array of work requests being posted.\r
+*\r
+* out.status\r
+* Status of the operation.\r
+*\r
+* out.failed_cnt\r
+* Number of work request that failed.\r
+*****/\r
+\r
+\r
+/****s* User-mode Access Layer/ual_post_srq_recv_ioctl_t\r
+* NAME\r
+* ual_post_srq_recv_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input and output parameters for\r
+* ib_post_srq_recv\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ual_post_srq_recv_ioctl\r
+{\r
+ struct _ual_post_srq_recv_ioctl_in\r
+ {\r
+ uint64_t h_srq;\r
+ uint32_t num_wr;\r
+ uint32_t num_ds;\r
+ ib_recv_wr_t recv_wr[1];\r
+ /* Additional work requests follow, followed by data segments. */\r
+\r
+ } in;\r
+ struct _ual_post_srq_recv_ioctl_out\r
+ {\r
+ ib_api_status_t status;\r
+ uint32_t failed_cnt;\r
+\r
+ } out;\r
+\r
+} ual_post_srq_recv_ioctl_t;\r
+/*\r
+* FIELDS\r
+* in.h_srq\r
+* A handle to SRQ where the work request is being posted.\r
+*\r
+* in.num_wr\r
+* Number of work request items in the array of work requests.\r
+*\r
+* in.num_ds\r
+* Number of data segments following the array of work requests.\r
+*\r
+* in.recv_wr\r
+* First work request in the array of work requests being posted.\r
+*\r
+* out.status\r
+* Status of the operation.\r
+*\r
+* failed_cnt\r
+* Number of work request that failed.\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_post_recv_ioctl_t\r
+* NAME\r
+* ual_post_recv_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input and output parameters for\r
+* ib_post_recv\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ual_post_recv_ioctl\r
+{\r
+ struct _ual_post_recv_ioctl_in\r
+ {\r
+ uint64_t h_qp;\r
+ uint32_t num_wr;\r
+ uint32_t num_ds;\r
+ ib_recv_wr_t recv_wr[1];\r
+ /* Additional work requests follow, followed by data segments. */\r
+\r
+ } in;\r
+ struct _ual_post_recv_ioctl_out\r
+ {\r
+ ib_api_status_t status;\r
+ uint32_t failed_cnt;\r
+\r
+ } out;\r
+\r
+} ual_post_recv_ioctl_t;\r
+/*\r
+* FIELDS\r
+* in.h_qp\r
+* A handle to QP where the work request is being posted.\r
+*\r
+* in.num_wr\r
+* Number of work request items in the array of work requests.\r
+*\r
+* in.num_ds\r
+* Number of data segments following the array of work requests.\r
+*\r
+* in.recv_wr\r
+* First work request in the array of work requests being posted.\r
+*\r
+* out.status\r
+* Status of the operation.\r
+*\r
+* failed_cnt\r
+* Number of work request that failed.\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_peek_cq_ioctl_t\r
+* NAME\r
+* ual_peek_cq_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input and output parameters for\r
+* ib_peek_cq\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ual_peek_cq_ioctl\r
+{\r
+ struct _ual_peek_cq_ioctl_in\r
+ {\r
+ uint64_t h_cq;\r
+\r
+ } in;\r
+ struct _ual_peek_cq_ioctl_out\r
+ {\r
+ ib_api_status_t status;\r
+ uint32_t n_cqes;\r
+\r
+ } out;\r
+\r
+} ual_peek_cq_ioctl_t;\r
+/*\r
+* FIELDS\r
+* in.h_cq\r
+* A handle to a CQ.\r
+*\r
+* out.status\r
+* Status of the operation.\r
+*\r
+* out.n_cqes\r
+* The number of completion queue entries currently on the CQ.\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_poll_cq_ioctl_t\r
+* NAME\r
+* ual_poll_cq_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input and output parameters for\r
+* ib_poll_cq\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ual_poll_cq_ioctl\r
+{\r
+ struct _ual_poll_cq_ioctl_in\r
+ {\r
+ uint64_t h_cq;\r
+ uint32_t num_wc;\r
+\r
+ } in;\r
+ struct _ual_poll_cq_ioctl_out\r
+ {\r
+ ib_api_status_t status;\r
+ uint32_t num_wc;\r
+ ib_wc_t wc[1];\r
+ /* Additional WC's follow. */\r
+ } out;\r
+\r
+} ual_poll_cq_ioctl_t;\r
+/*\r
+* FIELDS\r
+* in.h_cq\r
+* A handle to cq that is going to be polled for completions.\r
+*\r
+* in.num_wc\r
+* Number of work completions in the output array.\r
+*\r
+* out.status\r
+* Status of the operation.\r
+*\r
+* out.num_wc\r
+* Number of work completions polled.\r
+*\r
+* out.wc\r
+* First work completion in the array to use for polling.\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_rearm_cq_ioctl_t\r
+* NAME\r
+* ual_rearm_cq_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input and output parameters for\r
+* ib_rearm_cq\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ual_rearm_cq_ioctl\r
+{\r
+ struct _ual_rearm_cq_ioctl_in\r
+ {\r
+ uint64_t h_cq;\r
+ boolean_t solicited;\r
+\r
+ } in;\r
+ struct _ual_rearm_cq_ioctl_out\r
+ {\r
+ ib_api_status_t status;\r
+\r
+ } out;\r
+\r
+} ual_rearm_cq_ioctl_t;\r
+/*\r
+* FIELDS\r
+* in.h_cq\r
+* A handle to a CQ.\r
+*\r
+* in.solicited\r
+* Flag for rearm CQ.\r
+*\r
+* out.status\r
+* Status of the operation.\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_rearm_n_cq_ioctl_t\r
+* NAME\r
+* ual_rearm_n_cq_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input and output parameters for\r
+* ib_rearm_n_cq\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ual_rearm_n_cq_ioctl\r
+{\r
+ struct _ual_rearm_n_cq_ioctl_in\r
+ {\r
+ uint64_t h_cq;\r
+ uint32_t n_cqes;\r
+\r
+ } in;\r
+ struct _ual_rearm_n_cq_ioctl_out\r
+ {\r
+ ib_api_status_t status;\r
+\r
+ } out;\r
+\r
+} ual_rearm_n_cq_ioctl_t;\r
+/*\r
+* FIELDS\r
+* in.h_cq\r
+* A handle to a CQ.\r
+*\r
+* in.n_cqes\r
+* Rearm the CQ to signal when the next N completions are added.\r
+*\r
+* in.status\r
+* Status of the operation.\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_attach_mcast_ioctl_t\r
+* NAME\r
+* ual_attach_mcast_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input and output parameters for\r
+* verbs attach multicast call.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ual_attach_mcast_ioctl\r
+{\r
+ struct _ual_attach_mcast_ioctl_in\r
+ {\r
+ ci_umv_buf_t umv_buf;\r
+ uint64_t h_qp;\r
+ ib_gid_t mgid;\r
+ ib_net16_t mlid;\r
+\r
+ } in;\r
+ struct _ual_attach_mcast_ioctl_out\r
+ {\r
+ ci_umv_buf_t umv_buf;\r
+ ib_api_status_t status;\r
+ uint64_t h_attach;\r
+\r
+ } out;\r
+\r
+} ual_attach_mcast_ioctl_t;\r
+/*\r
+* FIELDS\r
+* in.umv_buf\r
+* Opaque to IBAL buffer descriptor to allow the user-mode HCA library to\r
+* exchange private information with the kernel-mode HCA driver.\r
+*\r
+* in.h_qp\r
+* Handle to the QP that is joining the multicast group.\r
+*\r
+* in.mgid\r
+* Multicast GID address for this multicast group.\r
+*\r
+* in.mlid\r
+* Multicast LID for this multicast group.\r
+*\r
+* out.umv_buf\r
+* Returns the status from the HCA driver to the user-mode HCA library,\r
+* along with any vendor specific output information.\r
+*\r
+* out.status\r
+* Status of the operation.\r
+*\r
+* h_attach\r
+* Multicast group handle.\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_detach_mcast_ioctl_t\r
+* NAME\r
+* ual_detach_mcast_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input and output parameters for\r
+* verbs detach call.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ual_detach_mcast_ioctl\r
+{\r
+ struct _ual_detach_mcast_ioctl_in\r
+ {\r
+ uint64_t h_attach;\r
+\r
+ } in;\r
+ struct _ual_detach_mcast_ioctl_out\r
+ {\r
+ ib_api_status_t status;\r
+\r
+ } out;\r
+\r
+} ual_detach_mcast_ioctl_t;\r
+/*\r
+* FIELDS\r
+* in.h_attach\r
+* A handle to the multicast group.\r
+*\r
+* out.status\r
+* Status of the operation.\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_reg_mad_svc_ioctl_t\r
+* NAME\r
+* ual_reg_mad_svc_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input and output parameters for\r
+* ib_reg_mad_svc\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ual_reg_mad_svc_ioctl\r
+{\r
+ struct _ual_reg_mad_svc_ioctl_in\r
+ {\r
+ uint64_t h_qp;\r
+ ib_mad_svc_t mad_svc;\r
+\r
+ } in;\r
+ struct _ual_reg_mad_svc_ioctl_out\r
+ {\r
+ ib_api_status_t status;\r
+ uint64_t h_mad_svc;\r
+\r
+ } out;\r
+\r
+} ual_reg_mad_svc_ioctl_t;\r
+/*\r
+* FIELDS\r
+* in.h_qp\r
+* Handle to the special QP or MAD QP.\r
+*\r
+* in.mad_svc\r
+* Mad service definition.\r
+*\r
+* out.status\r
+* Status of the operation.\r
+*\r
+* out.h_mad_svc\r
+* Handle to the mad service.\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_dereg_mad_svc_ioctl_t\r
+* NAME\r
+* ual_dereg_mad_svc_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input and output parameters for\r
+* ib_dereg_mad_svc\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ual_dereg_mad_svc_ioctl\r
+{\r
+ struct _ual_dereg_mad_svc_ioctl_in\r
+ {\r
+ uint64_t h_mad_svc;\r
+\r
+ } in;\r
+ struct _ual_dereg_mad_svc_ioctl_out\r
+ {\r
+ ib_api_status_t status;\r
+\r
+ } out;\r
+\r
+} ual_dereg_mad_svc_ioctl_t;\r
+/*\r
+* FIELDS\r
+* in.h_mad_svc\r
+* Handle to the mad service.\r
+*\r
+* out.status\r
+* Status of the operation.\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_reg_mad_pool_ioctl_t\r
+* NAME\r
+* ual_reg_mad_pool_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input and output parameters for\r
+* registering a mad pool to be used with special qp. This ioctl\r
+* will result in user-mode pool registered. Additionally,\r
+* the kernel proxy will allocate a kernel mad pool and register it\r
+* so that later mad_sends will have the appropriate pool in kernel.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ual_reg_mad_pool_ioctl\r
+{\r
+ struct _ual_reg_mad_pool_ioctl_in\r
+ {\r
+ uint64_t h_pd;\r
+\r
+ } in;\r
+ struct _ual_reg_mad_pool_ioctl_out\r
+ {\r
+ ib_api_status_t status;\r
+ uint64_t pool_key;\r
+\r
+ } out;\r
+\r
+} ual_reg_mad_pool_ioctl_t;\r
+/*\r
+* FIELDS\r
+* in.h_pd\r
+* PD associated with the pool\r
+*\r
+* out.status\r
+* Status of the operation.\r
+*\r
+* out.pool_key\r
+* Pool key to the mad pool in kernel space\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_dereg_mad_pool_ioctl_t\r
+* NAME\r
+* ual_dereg_mad_pool_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input and output parameters for\r
+* deregistering a mad pool to be used with special qp.\r
+* The kernel proxy will deregister and destroy the mad pool\r
+* created on behalf of the user process.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ual_dereg_mad_pool_ioctl\r
+{\r
+ struct _ual_dereg_mad_pool_ioctl_in\r
+ {\r
+ uint64_t pool_key;\r
+\r
+ } in;\r
+ struct _ual_dereg_mad_pool_ioctl_out\r
+ {\r
+ ib_api_status_t status;\r
+\r
+ } out;\r
+\r
+} ual_dereg_mad_pool_ioctl_t;\r
+/*\r
+* FIELDS\r
+* in.pool_key\r
+* Pool key to the mad pool in kernel space.\r
+*\r
+* out.status\r
+* Status of the operation\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_send_mad_ioctl_t\r
+* NAME\r
+* ual_send_mad_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input and output parameters for\r
+* ib_send_mad\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ual_send_mad_ioctl\r
+{\r
+ struct _ual_send_mad_ioctl_in\r
+ {\r
+ uint64_t h_mad_svc;\r
+ uint64_t pool_key;\r
+ uint64_t h_av;\r
+ ib_mad_element_t* __ptr64 p_mad_element;\r
+ uint32_t size;\r
+ void* __ptr64* __ptr64 ph_proxy;\r
+\r
+ } in;\r
+ struct _ual_send_mad_ioctl_out\r
+ {\r
+ ib_api_status_t status;\r
+\r
+ } out;\r
+\r
+} ual_send_mad_ioctl_t;\r
+/*\r
+* FIELDS\r
+* in.h_mad_svc\r
+* Handle to the mad service.\r
+*\r
+* in.pool_key\r
+* Pool key associated with the pool in kernel space.\r
+*\r
+* in.h_av\r
+* handle to address vector of MAD.\r
+*\r
+* in.p_mad_element\r
+* Pointer to the user-mode MAD element. The proxy marshals this data.\r
+*\r
+* in.size\r
+* size of MAD buffer to send.\r
+*\r
+* in.ph_proxy\r
+* Location to which to write the context used to cancel the MAD.\r
+*\r
+* out.status\r
+* Status of the operation.\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_cancel_mad_ioctl_t\r
+* NAME\r
+* ual_cancel_mad_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input and output parameters for\r
+* ib_cancel_mad\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ual_cancel_mad_ioctl\r
+{\r
+ struct _ual_cancel_mad_ioctl_in\r
+ {\r
+ uint64_t h_mad_svc;\r
+ void* __ptr64 h_proxy_element;\r
+\r
+ } in;\r
+ struct _ual_cancel_mad_ioctl_out\r
+ {\r
+ ib_api_status_t status;\r
+\r
+ } out;\r
+\r
+} ual_cancel_mad_ioctl_t;\r
+/*\r
+* FIELDS\r
+* in.h_mad_svc\r
+* contains the handle to the mad service\r
+*\r
+* in.h_mad_send\r
+* this references the handle to the sent MAD operation.\r
+*\r
+* out.status\r
+* Status of the operation.\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_spl_qp_ioctl_t\r
+* NAME\r
+* ual_spl_qp_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input and output parameters to get\r
+* the alias qp from KAL.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ual_spl_qp_ioctl\r
+{\r
+ struct _ual_spl_qp_ioctl_in\r
+ {\r
+ ci_umv_buf_t umv_buf;\r
+ uint64_t h_pd;\r
+ ib_net64_t port_guid;\r
+ ib_qp_create_t qp_create;\r
+ void* __ptr64 context;\r
+\r
+ } in;\r
+ struct _ual_spl_qp_ioctl_out\r
+ {\r
+ ci_umv_buf_t umv_buf;\r
+ ib_api_status_t status;\r
+ uint64_t h_qp;\r
+\r
+ } out;\r
+\r
+} ual_spl_qp_ioctl_t;\r
+/*\r
+* FIELDS\r
+* in.h_pd\r
+* Protection domain for the special qp.\r
+*\r
+* in.port_guid\r
+* Port GUID on which to allocate the special QP.\r
+*\r
+* in.qp_create\r
+* Special QP creation parameters.\r
+*\r
+* in.qp_context\r
+* Context to associate with the QP, to be used in any notifications.\r
+*\r
+* out.status\r
+* Status of the operation.\r
+*\r
+* out.h_qp\r
+* Handle to the special QP.\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_mad_recv_ioctl_t\r
+* NAME\r
+* ual_mad_recv_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input and output parameters to get\r
+* the mad_element information upon receiving MAD.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ual_mad_recv_ioctl\r
+{\r
+ struct _ual_mad_recv_comp_ioctl_in\r
+ {\r
+ uint64_t h_mad;\r
+ ib_mad_element_t* __ptr64 p_user_mad;\r
+ ib_mad_t* __ptr64 p_mad_buf;\r
+ ib_grh_t* __ptr64 p_grh;\r
+\r
+ } in;\r
+ struct _ual_mad_recv_comp_ioctl_out\r
+ {\r
+ ib_api_status_t status;\r
+\r
+ } out;\r
+\r
+} ual_mad_recv_ioctl_t;\r
+/*\r
+* FIELDS\r
+* in.h_mad\r
+* Received MAD handle handed to usermode in the MAD recv notification.\r
+*\r
+* in.p_user_mad\r
+* Pointer to a user-mode mad element.\r
+*\r
+* in.p_mad_buf\r
+* Pointer to the MAD element's user-mode buffer.\r
+*\r
+* in.p_grh\r
+* Ponter to the MAD element's user-mode GRH buffer.\r
+*\r
+* out.status\r
+* Status of the operation.\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_local_mad_ioctl_t\r
+* NAME\r
+* ual_local_mad_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input and output parameters for\r
+* ib_local_mad\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ual_local_mad_ioctl\r
+{\r
+ struct _ual_local_mad_ioctl_in\r
+ {\r
+ uint64_t h_ca;\r
+ __declspec(align(8)) uint8_t mad_in[MAD_BLOCK_SIZE];\r
+ uint8_t port_num;\r
+ \r
+ \r
+ } in;\r
+ struct _ual_local_mad_ioctl_out\r
+ {\r
+ ib_api_status_t status;\r
+ uint32_t _pad; /* 8-byte alignment needed for ia64 */\r
+ __declspec(align(8)) uint8_t mad_out[MAD_BLOCK_SIZE];\r
+\r
+ } out;\r
+\r
+} ual_local_mad_ioctl_t;\r
+/*\r
+** FIELDS\r
+* in.h_ca\r
+* The handle to an open instance of CA returned via a\r
+* ual_open_ca_ioctl structure.\r
+* in.port_num\r
+* Port number this MAD refere to.\r
+* in.mad_in\r
+* Mad structure from user mode to forward to local HCA.\r
+*\r
+** out.status\r
+* Status of the operation.\r
+* out.mad_out\r
+* Mad structure answer from local HCA for user mode.\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_create_cep_ioctl_t\r
+* NAME\r
+* ual_create_cep_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the output parameters to\r
+* create a CEP.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ual_create_cep_ioctl\r
+{\r
+ ib_api_status_t status;\r
+ net32_t cid;\r
+\r
+} ual_create_cep_ioctl_t;\r
+/*\r
+* FIELDS\r
+* status\r
+* Status of the operation.\r
+*\r
+* cid\r
+* CID of the created CEP.\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_cep_listen_ioctl_t\r
+* NAME\r
+* ual_cep_listen_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input parameters to\r
+* perform a CM listen request.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ual_cep_listen_ioctl\r
+{\r
+ net32_t cid;\r
+ ib_cep_listen_t cep_listen;\r
+ uint8_t compare[IB_REQ_PDATA_SIZE];\r
+\r
+} ual_cep_listen_ioctl_t;\r
+/*\r
+* FIELDS\r
+* in.cid\r
+* CID of an existing CEP.\r
+*\r
+* in.cep_listen\r
+* Information used to direct the listen request to match incoming\r
+* connection requests.\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_cm_req_ioctl_t\r
+* NAME\r
+* ual_cm_req_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input and output parameters for\r
+* al_cep_pre_req call.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ual_cep_req_ioctl\r
+{\r
+ struct _ual_cep_req_ioctl_in\r
+ {\r
+ net32_t cid;\r
+ ib_cm_req_t cm_req;\r
+ ib_path_rec_t paths[2];\r
+ uint8_t pdata[IB_REQ_PDATA_SIZE];\r
+ uint8_t compare[IB_REQ_PDATA_SIZE];\r
+\r
+ } in;\r
+ struct _ual_cep_req_ioctl_out\r
+ {\r
+ ib_api_status_t status;\r
+ ib_qp_mod_t init;\r
+\r
+ } out;\r
+\r
+} ual_cep_req_ioctl_t;\r
+/*\r
+* FIELDS\r
+* in.cid\r
+* CID of the target CEP.\r
+*\r
+* in.cm_req\r
+* CM REQ parameters.\r
+*\r
+* in.paths\r
+* Array of paths, the first being the primary path to use for the REQ.\r
+*\r
+* out.status\r
+* Status of the operation\r
+*\r
+* out.init\r
+* QP modify paramters for INIT state transition.\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_cep_rep_ioctl_t\r
+* NAME\r
+* ual_cep_rep_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input and output parameters for\r
+* al_cep_pre_rep call.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ual_cep_rep_ioctl\r
+{\r
+ struct _ual_cep_rep_ioctl_in\r
+ {\r
+ void* __ptr64 context;\r
+ net32_t cid;\r
+ ib_cm_rep_t cm_rep;\r
+ uint8_t pdata[IB_REP_PDATA_SIZE];\r
+\r
+ } in;\r
+ struct _ual_cep_rep_ioctl_out\r
+ {\r
+ ib_api_status_t status;\r
+ ib_qp_mod_t init;\r
+\r
+ } out;\r
+\r
+} ual_cep_rep_ioctl_t;\r
+/*\r
+* FIELDS\r
+* in.h_cm_req\r
+* The cm_req connection handle got on the callback.\r
+*\r
+* in.cm_rep\r
+* CM REP parameters.\r
+*\r
+* out.status\r
+* Status of the operation.\r
+*\r
+* out.init\r
+* QP modify paramters for INIT state transition.\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_cep_get_rtr_ioctl_t\r
+* NAME\r
+* ual_cep_get_rtr_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the output parameters for\r
+* al_cep_get_rtr_attr call.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ual_cep_get_rtr_ioctl\r
+{\r
+ ib_api_status_t status;\r
+ ib_qp_mod_t rtr;\r
+\r
+} ual_cep_get_rtr_ioctl_t;\r
+/*\r
+* FIELDS\r
+* out.status\r
+* Status of the operation.\r
+*\r
+* out.rtr\r
+* QP modify paramters for RTR state transition.\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_cep_get_rts_ioctl_t\r
+* NAME\r
+* ual_cep_get_rts_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the output parameters for\r
+* al_cep_get_rts_attr call.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ual_cep_get_rts_ioctl\r
+{\r
+ ib_api_status_t status;\r
+ ib_qp_mod_t rts;\r
+\r
+} ual_cep_get_rts_ioctl_t;\r
+/*\r
+* FIELDS\r
+* out.status\r
+* Status of the operation.\r
+*\r
+* out.rts\r
+* QP modify paramters for RTS state transition.\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_cep_rtu_ioctl_t\r
+* NAME\r
+* ual_cep_rtu_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input parameters for\r
+* al_cep_rtu call.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ual_cep_rtu_ioctl\r
+{\r
+ net32_t cid;\r
+ uint8_t pdata_len;\r
+ uint8_t pdata[IB_RTU_PDATA_SIZE];\r
+\r
+} ual_cep_rtu_ioctl_t;\r
+/*\r
+* FIELDS\r
+* in.cid\r
+* The cm_rep connection handle got on the callback.\r
+*\r
+* in.pdata_len\r
+* Length of private data.\r
+*\r
+* in.pdata\r
+* Private data.\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_cep_rej_ioctl_t\r
+* NAME\r
+* ual_cep_rej_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input parameters for\r
+* al_cep_rej\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ual_cep_rej_ioctl\r
+{\r
+ net32_t cid;\r
+\r
+ ib_rej_status_t rej_status;\r
+ uint8_t ari_len;\r
+ uint8_t pdata_len;\r
+ uint8_t ari[IB_ARI_SIZE];\r
+ uint8_t pdata[IB_REJ_PDATA_SIZE];\r
+\r
+} ual_cep_rej_ioctl_t;\r
+/*\r
+* FIELDS\r
+* in.cid\r
+* The CID of the target CEP.\r
+*\r
+* in.rej_status\r
+* Rejection status as defined in IB spec.\r
+*\r
+* in.ari_len\r
+* Length of the ARI data.\r
+*\r
+* in.pdata_len\r
+* Length of the private data.\r
+*\r
+* in.ari\r
+* ARI data.\r
+*\r
+* in.pdata\r
+* Private data.\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_cep_handoff_ioctl_t\r
+* NAME\r
+* ual_cep_handoff_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input and output parameters for\r
+* ib_cm_handoff\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ual_cep_handoff_ioctl\r
+{\r
+ struct _ual_cep_handoff_ioctl_in\r
+ {\r
+ uint64_t h_cm;\r
+ net64_t sid;\r
+\r
+ } in;\r
+ struct _ual_cep_handoff_ioctl_out\r
+ {\r
+ ib_api_status_t status;\r
+\r
+ } out;\r
+\r
+} ual_cep_handoff_ioctl_t;\r
+/*\r
+* FIELDS\r
+* in.h_cm\r
+* The connection handle got on the callback.\r
+*\r
+* in.sid\r
+* Service ID to which to handoff the listen.\r
+*\r
+* out.status\r
+* Status of the operation\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_cep_mra_ioctl_t\r
+* NAME\r
+* ual_cep_mra_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input parameters for\r
+* ib_cm_mra\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ual_cep_mra_ioctl\r
+{\r
+ net32_t cid;\r
+ ib_cm_mra_t cm_mra;\r
+ uint8_t pdata[IB_MRA_PDATA_SIZE];\r
+\r
+} ual_cep_mra_ioctl_t;\r
+/*\r
+* FIELDS\r
+* in.cid\r
+* The CID for the target CEP.\r
+*\r
+* in.cm_mra\r
+* CM MRA parameters.\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_cep_lap_ioctl_t\r
+* NAME\r
+* ual_cep_lap_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input parameters for\r
+* ib_cm_lap\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ual_cep_lap_ioctl\r
+{\r
+ net32_t cid;\r
+ ib_cm_lap_t cm_lap;\r
+ ib_path_rec_t alt_path;\r
+ uint8_t pdata[IB_LAP_PDATA_SIZE];\r
+\r
+} ual_cep_lap_ioctl_t;\r
+/*\r
+* FIELDS\r
+* in.cm_lap\r
+* CM LAP parameters\r
+*\r
+* in.alt_path\r
+* Alternate path information.\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_cep_apr_ioctl_t\r
+* NAME\r
+* ual_cep_apr_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input parameters for\r
+* ib_cep_apr\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ual_cep_apr_ioctl\r
+{\r
+ struct _ual_cep_apr_ioctl_in\r
+ {\r
+ net32_t cid;\r
+ ib_cm_apr_t cm_apr;\r
+ uint8_t apr_info[IB_APR_INFO_SIZE];\r
+ uint8_t pdata[IB_APR_PDATA_SIZE];\r
+\r
+ } in;\r
+\r
+ struct _ual_cep_apr_ioctl_out\r
+ {\r
+ ib_api_status_t status;\r
+ ib_qp_mod_t apr;\r
+\r
+ } out;\r
+\r
+} ual_cep_apr_ioctl_t;\r
+/*\r
+* FIELDS\r
+* in.h_cm_lap\r
+* The cm_lap connection handle got on the LAP callback.\r
+*\r
+* in.cm_apr\r
+* CM APR parameters.\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_force_apm_ioctl_t\r
+* NAME\r
+* ual_force_apm_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input and output parameters for\r
+* ib_force_apm\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ual_force_apm_ioctl\r
+{\r
+ union _ual_force_apm_ioctl_in\r
+ {\r
+ uint64_t h_qp;\r
+\r
+ } in;\r
+ struct _ual_force_apm_ioctl_out\r
+ {\r
+ ib_api_status_t status;\r
+\r
+ } out;\r
+\r
+} ual_force_apm_ioctl_t;\r
+/*\r
+* FIELDS\r
+* in.h_qp\r
+* A handle to the QP to migrate.\r
+*\r
+* out.status\r
+* Status of the operation\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_cep_dreq_ioctl_t\r
+* NAME\r
+* ual_cep_dreq_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input parameters for\r
+* ib_cm_dreq\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ual_cep_dreq_ioctl\r
+{\r
+ net32_t cid;\r
+ uint8_t pdata_len;\r
+ uint8_t pdata[IB_DREQ_PDATA_SIZE];\r
+\r
+} ual_cep_dreq_ioctl_t;\r
+/*\r
+* FIELDS\r
+* cm_dreq\r
+* CM DREQ parameters.\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_cep_drep_ioctl_t\r
+* NAME\r
+* ual_cep_drep_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input and output parameters for\r
+* ib_cm_drep\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ual_cep_drep_ioctl\r
+{\r
+ net32_t cid;\r
+ ib_cm_drep_t cm_drep;\r
+ uint8_t pdata[IB_DREP_PDATA_SIZE];\r
+\r
+} ual_cep_drep_ioctl_t;\r
+/*\r
+* FIELDS\r
+* in.h_cm_dreq\r
+* The cm_dreq connection handle got on the callback.\r
+*\r
+* in.cm_drep\r
+* CM DREP parameters.\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_cep_get_timewait_ioctl_t\r
+* NAME\r
+* ual_cep_get_timewait_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the output parameters for\r
+* ib_cep_get_timewait\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ual_cep_get_timewait_ioctl\r
+{\r
+ ib_api_status_t status;\r
+ uint64_t timewait_us;\r
+\r
+} ual_cep_get_timewait_ioctl_t;\r
+/*\r
+* FIELDS\r
+* in.status\r
+* Status of the request.\r
+*\r
+* in.timewait_us\r
+* Timewait value, in microseconds.\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_cep_poll_ioctl_t\r
+* NAME\r
+* ual_cep_poll_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the output parameters to\r
+* poll for incoming events on a CEP. The input parameter is the CID.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ual_cep_poll_ioctl\r
+{\r
+ ib_api_status_t status;\r
+ void* __ptr64 context;\r
+ net32_t new_cid;\r
+ ib_mad_element_t element;\r
+ ib_grh_t grh;\r
+ uint8_t mad_buf[MAD_BLOCK_SIZE];\r
+\r
+} ual_cep_poll_ioctl_t;\r
+/*\r
+* FIELDS\r
+* status\r
+* Status of the operation.\r
+*\r
+* new_cep\r
+* For listen requests, CEP information of CEPs created in response\r
+* to incoming REQs.\r
+*\r
+* mad_buf\r
+* Payload of a received MAD (or failed send)\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_cep_get_pdata_t\r
+* NAME\r
+* ual_cep_get_pdata_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input parameters for\r
+* getting private data of CM RDMA request\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ual_cep_get_pdata_ioctl\r
+{\r
+ struct _ual_cep_get_pdata_ioctl_in\r
+ {\r
+ uint64_t h_qp;\r
+ net32_t cid;\r
+\r
+ } in;\r
+\r
+ struct _ual_cep_get_pdata_ioctl_out\r
+ {\r
+ uint32_t pdata_len;\r
+ uint8_t pdata[IB_REJ_PDATA_SIZE];\r
+\r
+ } out;\r
+\r
+} ual_cep_get_pdata_ioctl_t;\r
+/*\r
+* FIELDS\r
+* h_qp\r
+* A handle to the QP to modify.\r
+*\r
+* in.cid\r
+* The CID for the target CEP.\r
+*\r
+* out.pdata_len\r
+* The size of the private data\r
+*\r
+* out.pdata\r
+* The private data.\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_reg_shmid_ioctl_t\r
+* NAME\r
+* ual_reg_shmid_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input and output parameters for\r
+* ib_create_shmid\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ual_reg_shmid_ioctl\r
+{\r
+ struct _ual_reg_shmid_ioctl_in\r
+ {\r
+ uint64_t h_pd;\r
+ ib_shmid_t shmid;\r
+ ib_mr_create_t mr_create;\r
+\r
+ } in;\r
+ struct _ual_reg_shmid_ioctl_out\r
+ {\r
+ ib_api_status_t status;\r
+ uint64_t vaddr;\r
+ net32_t lkey;\r
+ net32_t rkey;\r
+ uint64_t h_mr;\r
+\r
+ } out;\r
+\r
+} ual_reg_shmid_ioctl_t;\r
+/*\r
+* PARAMETERS\r
+* in.h_pd\r
+* A handle to an existing protection domain that the memory\r
+* should be registered with.\r
+*\r
+* in.shmid\r
+* An identifier to the shared memory region.\r
+*\r
+* in.mr_create\r
+* Information describing the attributes of the memory region to\r
+* register.\r
+*\r
+* out.status\r
+* Status of the operation.\r
+*\r
+* out.vaddr\r
+* Assigned I/O virtual address for the memory region.\r
+*\r
+* out.lkey\r
+* The local access key associated with this registered memory\r
+* region.\r
+*\r
+* out.rkey\r
+* A key that may be used by a remote end-point when performing RDMA\r
+* or atomic operations to this registered memory region.\r
+*\r
+* out.h_mr\r
+* Upon successful completion of this call, this references a handle\r
+* to the registered memory region. This handle is used when performing\r
+* data transfers and to deregister the memory.\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_send_sa_req_t\r
+* NAME\r
+* ual_send_sa_req_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input and output parameters for\r
+* ib_create_shmid\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ual_send_sa_req_ioctl\r
+{\r
+ struct _ual_send_sa_req_ioctl_in\r
+ {\r
+ net64_t port_guid;\r
+ uint32_t timeout_ms;\r
+ uint32_t retry_cnt;\r
+ ib_user_query_t sa_req;\r
+ uint8_t attr[IB_SA_DATA_SIZE];\r
+ uint64_t* __ptr64 ph_sa_req;\r
+ ib_api_status_t* __ptr64 p_status;\r
+\r
+ } in;\r
+ struct _ual_send_sa_req_ioctl_out\r
+ {\r
+ ib_api_status_t status;\r
+ uint64_t h_resp;\r
+ uint32_t resp_size;\r
+\r
+ } out;\r
+\r
+} ual_send_sa_req_ioctl_t;\r
+/*\r
+* PARAMETERS\r
+* in.sa_mad_data\r
+* The SA request to send.\r
+*\r
+* in.attr\r
+* The SA attribute data to send.\r
+*\r
+* in.ph_sa_req\r
+* Pointer to UAL's query handle. The proxy fills this in\r
+* before returning from the IOCTL handler to allow cancelation.\r
+*\r
+* in.p_status\r
+* Pointer to status of the query.\r
+*\r
+* out.status\r
+* Status of the query if it was initiated successfully.\r
+*\r
+* out.h_resp\r
+* Handle to a response MAD.\r
+*\r
+* out.resp_size\r
+* Size, in bytes, of the response MAD's buffer.\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_cancel_sa_req_ioctl_t\r
+* NAME\r
+* ual_cancel_sa_req_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input parameters for cancelling an\r
+* SA request.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ual_cancel_sa_req_ioctl\r
+{\r
+ uint64_t h_sa_req;\r
+\r
+} ual_cancel_sa_req_ioctl_t;\r
+/*\r
+* PARAMETERS\r
+* h_sa_req\r
+* Handle to the query to cancel.\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_reg_pnp_ioctl_in_t\r
+* NAME\r
+* ual_reg_pnp_ioctl_in_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input parameters for registering\r
+* for PnP events.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ual_reg_pnp_ioctl_in\r
+{\r
+ ib_pnp_class_t pnp_class;\r
+ void* __ptr64 sync_event;\r
+ ib_api_status_t* __ptr64 p_status;\r
+ uint64_t* __ptr64 p_hdl;\r
+\r
+} ual_reg_pnp_ioctl_in_t;\r
+/*\r
+* NOTES\r
+* This is an asynchronous IOCTL.\r
+*\r
+* The output parameters are a ual_rearm_pnp_ioctl_out_t.\r
+*\r
+* PARAMETERS\r
+* pnp_class\r
+* Class of PnP events for which to register.\r
+*\r
+* p_status\r
+* Pointer to user-mode status variable to set in failure case.\r
+*\r
+* p_hdl\r
+* Pointer to user-mode handle variable to set in success case.\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_poll_pnp_ioctl_t\r
+* NAME\r
+* ual_poll_pnp_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the parameters for retriveing data for\r
+* a PnP event.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef union _ual_poll_pnp_ioctl\r
+{\r
+ struct _ual_poll_pnp_ioctl_in\r
+ {\r
+ uint64_t evt_hdl;\r
+\r
+ } in;\r
+ struct _ual_poll_pnp_ioctl_out\r
+ {\r
+ ib_pnp_rec_t pnp_rec;\r
+\r
+ } out;\r
+\r
+} ual_poll_pnp_ioctl_t;\r
+/*\r
+* NOTES\r
+* This is a synchronous IOCTL.\r
+*\r
+* PARAMETERS\r
+* in.evt_hdl\r
+* Handle to a new PnP event.\r
+*\r
+* out.pnp_rec\r
+* Buffer for the new PnP event.\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_rearm_pnp_ioctl_in_t\r
+* NAME\r
+* ual_rearm_pnp_ioctl_in_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input parameters for requesting\r
+* notification of the next PnP event.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ual_rearm_pnp_ioctl_in\r
+{\r
+ uint64_t pnp_hdl;\r
+ uint64_t last_evt_hdl;\r
+ void* __ptr64 last_evt_context;\r
+ ib_api_status_t last_evt_status;\r
+\r
+} ual_rearm_pnp_ioctl_in_t;\r
+/*\r
+* NOTES\r
+* This is an asynchronous IOCTL.\r
+*\r
+* The output parameters are a ual_rearm_pnp_ioctl_out_t.\r
+*\r
+* PARAMETERS\r
+* pnp_hdl\r
+* Handle to the PnP registration to rearm.\r
+*\r
+* last_evt_hdl\r
+* Handle to the last PnP event processed.\r
+*\r
+* last_evt_context\r
+* Context value to set for the last reported PnP event.\r
+*\r
+* last_evt_status\r
+* Status value to return for the last reported PnP event.\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_rearm_pnp_ioctl_out_t\r
+* NAME\r
+* ual_rearm_pnp_ioctl_out_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the output parameters for a PnP event.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ual_rearm_pnp_ioctl_out\r
+{\r
+ uint64_t evt_hdl;\r
+ uint32_t evt_size;\r
+\r
+} ual_rearm_pnp_ioctl_out_t;\r
+/*\r
+* NOTES\r
+* This is an asynchronous IOCTL.\r
+*\r
+* The output parameters are identical to that of ual_reg_pnp_ioctl_t.\r
+*\r
+* PARAMETERS\r
+* evt_hdl\r
+* Handle to a new PnP event.\r
+*\r
+* evt_size\r
+* Buffer size needed to poll the new PnP event.\r
+*****/\r
+\r
+\r
+\r
+/****s* User-mode Access Layer/ual_dereg_pnp_ioctl_t\r
+* NAME\r
+* ual_dereg_pnp_ioctl_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input parameters for cancelling an\r
+* SA request.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ual_dereg_pnp_ioctl\r
+{\r
+ uint64_t h_pnp;\r
+\r
+} ual_dereg_pnp_ioctl_t;\r
+/*\r
+* NOTES\r
+* This is an asynchronous IOCTL.\r
+*\r
+* PARAMETERS\r
+* h_pnp\r
+* Handle to the PnP registration to deregister.\r
+*****/\r
+\r
+/****s* User-mode Access Layer/ual_ndi_notify_cq_ioctl_in_t\r
+* NAME\r
+* ual_ndi_notify_cq_ioctl_in_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input parameters for requesting\r
+* notification of the next event on NDI CQ.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ual_ndi_notify_cq_ioctl_in\r
+{\r
+ uint64_t h_cq;\r
+ boolean_t notify_comps;\r
+\r
+} ual_ndi_notify_cq_ioctl_in_t;\r
+/*\r
+* NOTES\r
+* This is an asynchronous IOCTL.\r
+*\r
+* FIELDS\r
+* h_cq\r
+* A handle to the CQ to modify.\r
+*\r
+* notify_comps\r
+* Type of notification, requested. If TRUE - completion events, \r
+* otherwise - errors.\r
+*\r
+*****/\r
+\r
+/****s* User-mode Access Layer/ual_ndi_req_cm_ioctl_in_t\r
+* NAME\r
+* ual_ndi_req_cm_ioctl_in_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input parameters \r
+* sending CM REQ .\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ual_ndi_req_cm_ioctl_in\r
+{\r
+ uint64_t h_qp;\r
+ net64_t guid;\r
+ uint16_t dst_port;\r
+ uint8_t prot;\r
+ uint8_t pdata_size;\r
+ ib_cm_rdma_req_t pdata;\r
+\r
+} ual_ndi_req_cm_ioctl_in_t;\r
+/*\r
+* NOTES\r
+* The output parameter is the new QP state (RTS).\r
+*\r
+* FIELDS\r
+* h_qp\r
+* A handle to the QP to modify.\r
+*\r
+* guid\r
+* Local port GUID to which to bind to.\r
+*\r
+* dst_port\r
+* Destination port number.\r
+*\r
+* prot\r
+* Protocol.\r
+*\r
+* pdata_size\r
+* The size of following private RDMA CM data\r
+*\r
+* pdata\r
+* Private data in format RDMA CM\r
+*\r
+*****/\r
+\r
+/****s* User-mode Access Layer/ual_ndi_rep_cm_ioctl_in_t\r
+* NAME\r
+* ual_ndi_rep_cm_ioctl_in_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input parameters \r
+* sending CM REP response .\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ual_ndi_rep_cm_ioctl_in\r
+{\r
+ uint64_t h_qp;\r
+ net32_t cid;\r
+ uint8_t init_depth;\r
+ uint8_t resp_res;\r
+ uint8_t pdata_size;\r
+ uint8_t pdata[IB_REJ_PDATA_SIZE];\r
+\r
+} ual_ndi_rep_cm_ioctl_in_t;\r
+/*\r
+* NOTES\r
+* The output parameter is the new QP state (RTS).\r
+*\r
+* FIELDS\r
+* h_qp\r
+* A handle to the QP to modify.\r
+*\r
+* cid\r
+* Connection ID.\r
+*\r
+* init_depth\r
+* The maximum number of outstanding RDMA read/atomic operations.\r
+*\r
+* resp_res\r
+* The maximum number of RDMA read/atomic operations from the recipient.\r
+*\r
+* pdata_size\r
+* The size of following private data\r
+*\r
+* pdata\r
+* Private data in format RDMA CM\r
+*\r
+*****/\r
+\r
+/****s* User-mode Access Layer/ual_ndi_rej_cm_ioctl_in_t\r
+* NAME\r
+* ual_ndi_rej_cm_ioctl_in_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input parameters \r
+* sending CM REJ response .\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ual_ndi_rej_cm_ioctl_in\r
+{\r
+ net32_t cid;\r
+ uint8_t pdata_size;\r
+ uint8_t pdata[IB_REJ_PDATA_SIZE];\r
+\r
+} ual_ndi_rej_cm_ioctl_in_t;\r
+/*\r
+* NOTES\r
+* The output parameter is the new QP state (RTS).\r
+*\r
+* FIELDS\r
+* cid\r
+* Connection ID.\r
+*\r
+* pdata_size\r
+* The size of following private data\r
+*\r
+* pdata\r
+* Private data in format RDMA CM\r
+*\r
+*****/\r
+\r
+\r
+/****s* User-mode Access Layer/ual_ndi_rtu_cm_ioctl_in_t\r
+* NAME\r
+* ual_ndi_rtu_cm_ioctl_in_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input parameters \r
+* sending CM RTU response .\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ual_ndi_rtu_cm_ioctl_in\r
+{\r
+ uint64_t h_qp;\r
+ uint8_t init_depth;\r
+ uint8_t resp_res;\r
+\r
+} ual_ndi_rtu_cm_ioctl_in_t;\r
+/*\r
+* NOTES\r
+* The output parameter is the new QP state (RTS).\r
+*\r
+* FIELDS\r
+* h_qp\r
+* A handle to the QP to modify.\r
+*\r
+* init_depth\r
+* The maximum number of outstanding RDMA read/atomic operations.\r
+*\r
+* resp_res\r
+* The maximum number of RDMA read/atomic operations from the recipient.\r
+*\r
+*****/\r
+\r
+/****s* User-mode Access Layer/ual_ndi_modify_qp_ioctl_in_t\r
+* NAME\r
+* ual_ndi_modify_qp_ioctl_in_t\r
+*\r
+* DESCRIPTION\r
+* IOCTL structure containing the input parameters \r
+* for MODIFY_QP .\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ual_ndi_modify_qp_ioctl_in\r
+{\r
+ uint64_t h_qp;\r
+ ib_qp_mod_t qp_mod;\r
+\r
+} ual_ndi_modify_qp_ioctl_in_t;\r
+/*\r
+* NOTES\r
+* The output parameter is the new QP state.\r
+*\r
+* FIELDS\r
+* h_qp\r
+* A handle to the QP to modify.\r
+*\r
+* qp_mod\r
+* Attributes used for modifying the QP.\r
+*\r
+*****/\r
+\r
+\r
+\r
+#endif /* __IB_UAL_IOCTL_H__ */\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 Mellanox Technologies. All rights reserved.\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+/* This file is shared between user- and kernel-mode */\r
+\r
+#include <iba/ib_types.h>\r
+\r
+\r
+#ifndef _IB_AT_IOCTL_H_\r
+#define _IB_AT_IOCTL_H_\r
+\r
+\r
+#define IBAT_IOCTL_VERSION 4\r
+\r
+#define IBAT_MAC_LEN 6\r
+\r
+\r
+#define IOCTL_IBAT( n ) \\r
+ CTL_CODE( FILE_DEVICE_UNKNOWN, (0x800 + n), \\r
+ METHOD_BUFFERED, FILE_ANY_ACCESS )\r
+\r
+/** This IRP is used to return all available CAs ports number\r
+ * and port guid */\r
+#define IOCTL_IBAT_PORTS IOCTL_IBAT( 1 )\r
+\r
+typedef struct _IBAT_PORT_RECORD\r
+{\r
+ UINT64 CaGuid;\r
+ UINT64 PortGuid;\r
+ UINT8 PortNum;\r
+\r
+} IBAT_PORT_RECORD;\r
+\r
+typedef struct _IOCTL_IBAT_PORTS_IN\r
+{\r
+ ULONG Version;\r
+\r
+} IOCTL_IBAT_PORTS_IN;\r
+\r
+typedef struct _IOCTL_IBAT_PORTS_OUT\r
+{\r
+ /** Total size, of the output buffer needed if the\r
+ * suplied buffer wasn't enough */\r
+ ULONG Size;\r
+ LONG NumPorts;\r
+ IBAT_PORT_RECORD Ports[1];\r
+\r
+} IOCTL_IBAT_PORTS_OUT;\r
+\r
+\r
+/** This IRP is used to return all the ip addresses that\r
+ * are assigned to a port */\r
+#define IOCTL_IBAT_IP_ADDRESSES IOCTL_IBAT( 2 )\r
+\r
+typedef struct _IOCTL_IBAT_IP_ADDRESSES_IN\r
+{\r
+ ULONG Version;\r
+ /** The guid of the port that we are querying for. May be\r
+ * zero if querying for IP addresses of all ports. */\r
+ UINT64 PortGuid;\r
+\r
+} IOCTL_IBAT_IP_ADDRESSES_IN;\r
+\r
+typedef struct _IP_ADDRESS\r
+{\r
+ /** Might only be 4 or 6 */\r
+ CHAR IpVersion;\r
+ /** Sized to support both IPv4 and IPv6 */\r
+ UCHAR Address[16];\r
+\r
+} IP_ADDRESS;\r
+\r
+typedef struct _IOCTL_IBAT_IP_ADDRESSES_OUT\r
+{\r
+ /** Total size of the output buffer needed if the\r
+ * suplied buffer wasn't enough */\r
+ ULONG Size;\r
+ LONG AddressCount;\r
+ IP_ADDRESS Address[1];\r
+\r
+} IOCTL_IBAT_IP_ADDRESSES_OUT;\r
+\r
+\r
+/** This IRP is used to convert a remote MAC addresses to a remote GID */\r
+#define IOCTL_IBAT_MAC_TO_GID IOCTL_IBAT( 3 )\r
+\r
+typedef struct _IOCTL_IBAT_MAC_TO_GID_IN\r
+{\r
+ ULONG Version;\r
+ UINT64 PortGuid;\r
+ UCHAR DestMac[IBAT_MAC_LEN];\r
+\r
+} IOCTL_IBAT_MAC_TO_GID_IN;\r
+\r
+typedef struct _IOCTL_IBAT_MAC_TO_GID_OUT\r
+{\r
+ ib_gid_t DestGid;\r
+\r
+} IOCTL_IBAT_MAC_TO_GID_OUT;\r
+\r
+/** This IRP is used to get port record, corresponding to its (loca) IP address */\r
+#define IOCTL_IBAT_IP_TO_PORT IOCTL_IBAT( 4 )\r
+\r
+typedef struct _IOCTL_IBAT_IP_TO_PORT_IN\r
+{\r
+ ULONG Version;\r
+ IP_ADDRESS Address;\r
+\r
+} IOCTL_IBAT_IP_TO_PORT_IN;\r
+\r
+typedef struct _IOCTL_IBAT_IP_TO_PORT_OUT\r
+{\r
+ IBAT_PORT_RECORD Port;\r
+\r
+} IOCTL_IBAT_IP_TO_PORT_OUT;\r
+\r
+\r
+#define IBAT_DEV_NAME L"\\Device\\ibat"\r
+#define IBAT_DOS_DEV_NAME L"\\DosDevices\\Global\\ibat"\r
+#define IBAT_WIN32_NAME L"\\\\.\\ibat"\r
+\r
+#endif /* _IB_AT_IOCTL_H_ */\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. \r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+#if !defined(__IB_CI_H__)\r
+#define __IB_CI_H__\r
+\r
+#include <iba/ib_types.h>\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif /* __cplusplus */\r
+\r
+\r
+/****h* IB_API/Verbs\r
+* NAME\r
+* Verbs -- Verbs implements the hardware and software glue to the OS layer.\r
+* COPYRIGHT\r
+* Copyright© 2001 Intel Corporation - All Rights Reserved.\r
+* DESCRIPTION\r
+* The Verbs API definition defines the interface mechanism between an IHV\r
+* supplied driver component. It implements verbs functionality as defined\r
+* Volume 1, of the InfiniBand(tm) specifications.\r
+* AUTHOR\r
+* Intel Corporation\r
+* CREATION DATE\r
+* XX.XX.XX\r
+* NOTES\r
+* Evolving Spec!!\r
+* Invalid Handle checks are a mere signature checks in kernel mode. Hence\r
+* passing invalid pointer would lead to panics in the kernel. For user mode\r
+* These are verified for most verbs that need to take a kernel transition.\r
+* Verbs those are entirely done in user mode that would affect speed path\r
+* do not perform consistency checks. So invalid pointers would lead to\r
+* application crash with core dumps.\r
+***********\r
+*/\r
+\r
+\r
+/*\r
+ * Version that identifies this version of the header file for interface\r
+ * definition.\r
+ */\r
+#define VERBS_MAJOR_VER (0x0002)\r
+#define VERBS_MINOR_VER (0x0000)\r
+\r
+#define VERBS_VERSION (((VERBS_MAJOR_VER) << 16) | (VERBS_MINOR_VER))\r
+#define MK_VERBS_VERSION(maj,min) ((((maj) & 0xFFFF) << 16) | \\r
+ ((min) & 0xFFFF))\r
+\r
+/*\r
+ * TODO: The in and out buffers should be separated (usage can still make\r
+ * both point to the same actual memory region.\r
+ */\r
+/****s* Verbs/ci_umv_buf_t\r
+* NAME\r
+* ci_umv_buf_t -- Vendor specific structure to facilitate user mode IO\r
+* DESCRIPTION\r
+* This structure is provided to assist the vendor specific user mode\r
+* library to exchange information with its kernel mode driver. The\r
+* user mode InfiniBand(tm) Access Layer will call the vendor specific\r
+* module before a call is made to the kernel mode driver. The kernel mode\r
+* driver is expected to know the format and data in the p_inout_buf,\r
+* and copy any necessary data that must be handed to the user mode\r
+* vendor library.\r
+* PURPOSE\r
+* command\r
+* A command code that is understood by the vendor specific kernel\r
+* mode driver.\r
+* p_inout_buf\r
+* The user mode component of the vendor specific library allocates\r
+* this memory and passes information in this buffer. vendor is expected\r
+* to set both the input and output buffer sizes appropriately.\r
+* This information is required since the kernel mode proxy that passes\r
+* this buffer to the kernel mode vendor specific library will copy the\r
+* content of this buffer to a kernel mode buffer. The kernel mode\r
+* vendor specific driver would copy the data that needs to be returned\r
+* to the user mode component, and set the output size appropriately\r
+* so that the proxy can now copy the data back to user mode buffer.\r
+*\r
+* In the Infiniband Access Layer, it is important to know the\r
+* usage of umv_buf and whether the contents of the p_inout_buf\r
+* can have embedded user-mode pointers. When invoked from an\r
+* arbitrary thread context, Vendor driver can NOT access user-mode\r
+* pointers of a user-process.\r
+* input_size\r
+* Size of the input buffer, must be set by the user mode vendor\r
+* specific library.\r
+* output_size\r
+* Size of the output buffer. Must be set by the user mode component\r
+* to specify the maximum size of the data expected from its kernel\r
+* mode driver. The kernel mode driver would set the size to the exact\r
+* size that needs to be returned to its user mode counterpart.\r
+* status\r
+* Indicates the status of the operation from the kernel mode vendor\r
+* specific driver. The caller is supposed to initialize it appropriately\r
+* to identify if an operation succeded, or failed. For e.g. when\r
+* the user mode library is called after a resource creation, the user\r
+* mode vendor specific code must be able to identify if there is\r
+* post processing required, or if any resource allocation failed.\r
+* SOURCE\r
+*/\r
+typedef struct _umv_buf\r
+{\r
+ uint32_t command;\r
+ uint32_t status;\r
+ uint32_t input_size;\r
+ uint32_t output_size;\r
+ void* __ptr64 p_inout_buf;\r
+} ci_umv_buf_t;\r
+/******/\r
+\r
+/****f* Verbs/ci_completion_cb_t\r
+* NAME\r
+* ci_completion_cb_t -- Completion Notification callback.\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef void\r
+(*ci_completion_cb_t)(\r
+ IN void *cq_context );\r
+\r
+/*\r
+* DESCRIPTION\r
+* This function prototype indicates the parameter passed to ci_open_ca()\r
+* to receive completion callbacks.\r
+* PARAMETERS\r
+* cq_context\r
+* [in] Completion queue context passed during the ci_create_cq\r
+* RETURN VALUE\r
+* None\r
+* NOTES\r
+* The consumer only gets the cq_context and ca_context. It is the client\r
+* responsibility to store the cq_handle in the context after the creation\r
+* time. So it can call ci_poll_cq() after the arrival of the notification.\r
+* SEE ALSO\r
+* ci_open_ca, ci_create_cq\r
+******\r
+*/\r
+\r
+\r
+/****f* Verbs/ci_async_event_cb_t\r
+* NAME\r
+* ci_async_event_cb_t\r
+*\r
+* DESCRIPTION\r
+* Asynchronous event notification routine.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef void\r
+(*ci_async_event_cb_t)(\r
+ IN const ib_event_rec_t* const p_event_record );\r
+/*\r
+* PARAMETERS\r
+* p_event_record\r
+* [in] Information describing the type of event that has occurred.\r
+*\r
+* NOTES\r
+* This routine is called when an asynchronous event is generated by a\r
+* channel adapter. The event notification record passed has relevant\r
+* information on the type of the event, the source that caused the event,\r
+* and the context associated.\r
+*****/\r
+\r
+\r
+/****f* Verbs/ci_open_ca\r
+* NAME\r
+* ci_open_ca -- open and possibly obtain a handle to access the HCA.\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(*ci_open_ca) (\r
+ IN const ib_net64_t ca_guid,\r
+ IN const ci_completion_cb_t pfn_completion_cb,\r
+ IN const ci_async_event_cb_t pfn_async_event_cb,\r
+ IN const void* const ca_context,\r
+ OUT ib_ca_handle_t *ph_ca );\r
+/*\r
+* DESCRIPTION\r
+* This routine returns a handle to an open instance of a HCA. Client can call\r
+* this routine to retrieve a new open instance. Only one instance of the\r
+* open call is active at any time. If a duplicate open is called by the\r
+* consumer or any other consumer, it IB_RESOURCE_BUSY error status is\r
+* returned.\r
+* PARAMETERS\r
+* ca_guid\r
+* [in] The HCA adapter's EUI64 identifier. Clients would use other\r
+* enumeration API's to locate all available adapters and their\r
+* guids in a system, e.g. GetCaGuids(), maintained by the IB\r
+* Access Layer. User mode consumers also have the same mechanism\r
+* to retrieve this information.\r
+* pfn_completion_cb\r
+* [in] Completion Handler, one per open instance.\r
+* pfn_async_event_cb\r
+* [in] Asynchronous event handler, one per open instance.\r
+* ca_context\r
+* [in] Verbs consumer supplied value, which is returned on calls to\r
+* handlers which in turn is used by clients to identify the\r
+* open instance.\r
+* ph_ca\r
+* [out] Pointer to a handle to the newly open instance of the CA returned\r
+* by the Verbs Provider.\r
+*\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The HCA is successfully opened and returned handle is valid.\r
+* IB_INSUFFICIENT_RESOURCES\r
+* Insufficient resources to satisfy request.\r
+* IB_INVALID_PARAMETER\r
+* Callback routine are not provided, GUID value is zero, or ph_ca is NULL\r
+* IB_RESOURCE_BUSY\r
+* The interface is already open by another consumer.\r
+* IB_NOT_FOUND\r
+* ca_guid passed is not valid\r
+*\r
+* SEE ALSO\r
+* ci_query_ca, ci_modify_ca, ci_close_ca\r
+*********/\r
+\r
+\r
+/****f* Verbs/ci_um_open_ca\r
+* NAME\r
+* ci_um_open_ca -- Create a CA context for use by user-mode processes.\r
+* SYNOPSIS\r
+*/\r
+typedef ib_api_status_t\r
+(*ci_um_open_ca_t) (\r
+ IN const ib_ca_handle_t h_ca,\r
+ IN OUT ci_umv_buf_t* const p_umv_buf,\r
+ OUT ib_ca_handle_t* const ph_um_ca );\r
+/*\r
+* DESCRIPTION\r
+* This routine is used called on behalf of a user-mode application to\r
+* establish a per-CA context in user-mode.\r
+*\r
+* PARAMETERS\r
+* h_ca\r
+* [in] Handle returned by an earlier call to ci_open_ca()\r
+* p_umv_buf\r
+* [in/out] Vendor specific parameter to support user mode IO.\r
+* ph_um_ca\r
+* [out] Handle to pass into ci_um_close_ca call to free any kernel\r
+* resources allocated for the user-mode appliation.\r
+*\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The user-mode context information is returned successfully.\r
+* IB_INSUFFICIENT_MEMORY\r
+* The size of the p_ca_attr buffer, specified through p_size, is\r
+* insufficient to store all of the CA attribute information.\r
+* IB_INVALID_CA_HANDLE\r
+* h_ca is invalid\r
+* IB_INVALID_PARAMETER\r
+* The p_umv_buf parameters are insufficient to complete the request.\r
+*\r
+* SEE ALSO\r
+* ci_query_ca, ci_modify_ca, ci_close_ca\r
+*********/\r
+\r
+\r
+/****f* Verbs/ci_query_ca\r
+* NAME\r
+* ci_query_ca -- Query the attributes of the HCA\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(*ci_query_ca) (\r
+ IN const ib_ca_handle_t h_ca,\r
+ OUT ib_ca_attr_t *p_ca_attr OPTIONAL,\r
+ IN OUT uint32_t *p_size,\r
+ IN OUT ci_umv_buf_t *p_umv_buf OPTIONAL );\r
+/*\r
+* DESCRIPTION\r
+* This routine retrieves vital information about this hca. It returns\r
+* necessary information about HCA guid, port guids, LID's assigned by\r
+* the master SM. Clients can use this information to communicate with the\r
+* Master SM node to perform path queries etc.\r
+* PARAMETERS\r
+* h_ca\r
+* [in] Handle returned by an earlier call to ci_open_ca()\r
+* p_ca_attr\r
+* [out] CA attribute of this Host Channel adapter\r
+* p_size\r
+* [in/out] On input, this references the size of the data buffer\r
+* referenced by the p_ca_attr parameter.\r
+* On output, the number of bytes used or needed to copy all CA\r
+* attribute information.\r
+* p_umv_buf\r
+* [in out] Vendor specific parameter to support user mode IO.\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The attribute structure is returned completely.\r
+* IB_INSUFFICIENT_MEMORY\r
+* The size of the p_ca_attr buffer, specified through p_size, is\r
+* insufficient to store all of the CA attribute information.\r
+* IB_INVALID_CA_HANDLE\r
+* h_ca is invalid\r
+* IB_INVALID_PARAMETER\r
+* p_size is NULL.\r
+* NOTES\r
+* Users may obtain the size of the data buffer required to obtain the\r
+* CA attributes by calling this function with p_ca_attr set to NULL.\r
+* The channel interface will then return the necessary size in the\r
+* variable referenced by the p_size parameter. The caller can then allocate\r
+* exact size and call this routine again. No partial information is returned\r
+* if the size is not sufficient.\r
+* SEE ALSO\r
+* ci_open_ca, ci_modify_ca\r
+********/\r
+\r
+/****f* Verbs/ci_modify_ca\r
+* NAME\r
+* ci_modify_ca -- Modify port attributes and error counters\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(*ci_modify_ca) (\r
+ IN const ib_ca_handle_t h_ca,\r
+ IN const uint8_t port_num,\r
+ IN const ib_ca_mod_t ca_mod,\r
+ IN const ib_port_attr_mod_t *p_port_attr_mod );\r
+/*\r
+* DESCRIPTION\r
+* Modifies either the P_KEY/Q_KEY violation counters, or sets the capability\r
+* mask in the port attributes. This is effectively translated to PORTINFO\r
+* values responded later when a MAD from SM or another node arrives to\r
+* retrieve port related attributes.\r
+*\r
+* PARAMETERS\r
+* h_ca\r
+* [in] Handle returned by previous call to ci_open_ca()\r
+* port_num\r
+* [in] Port number, which needs to be modified.\r
+* ca_mod\r
+* [in] Command mask to perform operations on.\r
+* p_port_attr_mod\r
+* [in] port attribute which needs this change to be performed.\r
+* if the capability bit is set, then that corresponding\r
+* port capability is turned on.\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* Modify port attributes was performed\r
+* IB_INVALID_PORT\r
+* Invalid port number supplied in port_att.\r
+* IB_INVALID_PARAMETER\r
+* Unknown Command supplied in port_attr.\r
+* IB_UNSUPPORTED\r
+* Optional Q_KEY and P_KEY violation counters are not supported.\r
+* IB_INVALID_CA_HANDLE\r
+* h_ca is invalid\r
+* NOTES\r
+* No ownership checks are performed in the Verbs Provider Driver.\r
+* All such permission checks are to be performed by the IB access layer\r
+* before passing requests down to the HCA driver. These operations can be\r
+* performed only by the special QP owner. Either the QP0 or QP1. Since port\r
+* attributes is really maintained by the QP0 for SMA to respond with correct\r
+* values, but the agent capability is really a QP1 functionality.\r
+* SEE ALSO\r
+* ci_open_ca, ci_query_ca, ci_close_ca\r
+*/\r
+/********/\r
+\r
+/****f* Verbs/ci_close_ca\r
+* NAME\r
+* ci_close_ca -- Close access to adapter via this h_ca\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(*ci_close_ca) (\r
+ IN ib_ca_handle_t h_ca );\r
+/*\r
+* DESCRIPTION\r
+* This routine is called when the client no longer wishes to use HCA\r
+* resources obtained via this h_ca. All resources allocated as part\r
+* this handle during the ci_open_ca are destroyed.\r
+* PARAMETERS\r
+* h_ca\r
+* [in] CA handle returned via the ci_open_ca() call.\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The intend to destroy is registered. No further calls for\r
+* completion or async event will be sent to this instance. When it is\r
+* appropriate to destroy this instance, the event h_kevent is signaled.\r
+* IB_RESOURCE_BUSY\r
+* Some resource allocated via this handle is not freed.\r
+* IB_INVALID_CA_HANDLE\r
+* h_ca is invalid\r
+* NOTES\r
+* This call cannot be called from any of the notification functions invoked\r
+* by the Verbs driver. For e.g. the completion handler or the async error\r
+* callback provided during the ci_open_ca() call. The call will block until\r
+* all references to this adapter object is closed which includes all the\r
+* pending callbacks returning back to the verbs provider driver.\r
+*\r
+* Resources allocated during the ci_open_ca() is deallocated. Other resource\r
+* cleanup are responsibility of the consumer .\r
+* SEE ALSO\r
+* ci_open_ca\r
+********/\r
+\r
+/****f* Verbs/ci_um_close_ca_t\r
+* NAME\r
+* ci_um_close_ca_t -- Close user-mode access to adapter via this h_ca\r
+* SYNOPSIS\r
+*/\r
+typedef void\r
+(*ci_um_close_ca_t) (\r
+ IN ib_ca_handle_t h_ca,\r
+ IN ib_ca_handle_t h_um_ca );\r
+/*\r
+* DESCRIPTION\r
+* This routine is called when the client no longer wishes to use HCA\r
+* resources obtained via this h_ca. All resources allocated as part\r
+* this handle during the ci_um_open_ca are destroyed.\r
+* PARAMETERS\r
+* h_ca\r
+* [in] CA handle returned via the ci_open_ca() call.\r
+* h_um_ca\r
+* [in] CA handle returned via the ci_um_open_ca() call.\r
+*\r
+* RETURN VALUE\r
+* This funtion does not return a value.\r
+* NOTES\r
+* This call is invoked from the context of a UM application when such an\r
+* appliation closes the HCA in user-mode.\r
+*\r
+* Resources allocated during the ci_um_open_ca() are deallocated.\r
+*\r
+* SEE ALSO\r
+* ci_um_open_ca\r
+********/\r
+\r
+/****f* Verbs/ci_allocate_pd\r
+* NAME\r
+* ci_allocate_pd -- Allocate a protection domain for this adapter.\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(*ci_allocate_pd) (\r
+ IN const ib_ca_handle_t h_ca,\r
+ IN const ib_pd_type_t type,\r
+ OUT ib_pd_handle_t *ph_pd,\r
+ IN OUT ci_umv_buf_t *p_umv_buf OPTIONAL );\r
+/*\r
+* DESCRIPTION\r
+* This routine allocates a protection domain handle, which is later\r
+* used to create QP's, Register Memory Regions, Bind Memory Windows\r
+* and address vectors. Protection domain has no InfiniBand architectural\r
+* attributes but the OS implements policy on its usage and allocation.\r
+* PARAMETERS\r
+* h_ca\r
+* [in] Handle returned by ci_open_ca()\r
+*\r
+* type\r
+* [in] Type of the protection domain. CA vendors may use this\r
+* information to optimize how the PD is allocated.\r
+*\r
+* ph_pd\r
+* [out] The handle to the newly created protection domain\r
+*\r
+* p_umv_buf\r
+* [in/out] Vendor specific parameter to support user mode IO.\r
+*\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* PD is successfully allocated and the ph_pd is valid.\r
+*\r
+* IB_INSUFFICIENT_RESOURCES\r
+* No more PD's available for this adapter.\r
+*\r
+* IB_INVALID_CA_HANDLE\r
+* HCA handle is not valid\r
+*\r
+* SEE ALSO\r
+* ci_deallocate_pd\r
+*******/\r
+\r
+/****f* Verbs/ci_deallocate_pd\r
+* NAME\r
+* ci_deallocate_pd -- Deallocate a protection domain object.\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(*ci_deallocate_pd) (\r
+ IN ib_pd_handle_t h_pd );\r
+\r
+/*\r
+* DESCRIPTION\r
+* This routine deallocates a pd that is allocated via the ci_allocate_pd()\r
+* call. The PD cannot be deallocated if it is still bound to a QP, any memory\r
+* region, memory window or address vector.\r
+* PARAMETERS\r
+* h_pd\r
+* [in] Handle allocated via the ci_allocate_pd()\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* PD is freed successfully\r
+* IB_INVALID_PD_HANDLE\r
+* pd_handle is invalid\r
+* IB_RESOURCE_BUSY\r
+* PD is probably still bound to some resource\r
+* SEE ALSO\r
+* ci_allocate_pd\r
+*******\r
+*/\r
+\r
+\r
+/****f* Verbs/ci_create_av\r
+* NAME\r
+* ci_create_av -- Create an address vector for use in UD.\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(*ci_create_av) (\r
+ IN const ib_pd_handle_t h_pd,\r
+ IN const ib_av_attr_t *p_av_attr,\r
+ OUT ib_av_handle_t *ph_av,\r
+ IN OUT ci_umv_buf_t *p_umv_buf OPTIONAL );\r
+\r
+/*\r
+* DESCRIPTION\r
+* This routine creates an address vector for use in unreliable datagram\r
+* queue pairs. The information necessary to create the address vector\r
+* handle is supplied in the ib_av_attr_t parameter.\r
+* PARAMETERS\r
+* h_pd\r
+* [in] Protection domain to which this av is associated.\r
+* p_av_attr\r
+* [in] Parameters to create the address vector handle\r
+* ph_av\r
+* [out] Handle to use for datagram sends.\r
+* p_umv_buf\r
+* [in out] Vendor specific parameter to support user mode IO.\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The create operation was successful\r
+* IB_INSUFFICIENT_RESOURCES\r
+* No more address handles are available\r
+* IB_INVALID_PD_HANDLE\r
+* The specified protection domain handle is invalid\r
+* IB_INVALID_PORT\r
+* Invalid port number supplied.\r
+* IB_INVALID_PARAMETER\r
+* One of the p_av_attr or p_av_attr was NULL.\r
+* NOTES\r
+* The values in the p_av_attr is not validated for correctness. The values\r
+* in the attribute such as port number, protection domain etc are also\r
+* validated during processing by the channel adapter. If the attribute\r
+* validation fails a processing error IB_WCS_LOCAL_OP_ERR.\r
+* SEE ALSO\r
+* ci_allocate_pd\r
+********/\r
+\r
+/****f* Verbs/ci_query_av\r
+* NAME\r
+* ci_query_av -- Obtain the address vector associated with the handle\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(*ci_query_av) (\r
+ IN const ib_av_handle_t h_av,\r
+ OUT ib_av_attr_t *p_av_attr,\r
+ OUT ib_pd_handle_t *ph_pd,\r
+ IN OUT ci_umv_buf_t *p_umv_buf OPTIONAL );\r
+\r
+/*\r
+* DESCRIPTION\r
+* This routine returns the address vector and pd_handle associated with the\r
+* av_handle.\r
+* PARAMETERS\r
+* h_av\r
+* [in] Handle to the address vector\r
+* p_av_attr\r
+* [out] address vector data referred by the av_handle\r
+* ph_pd\r
+* [out] pd handle associated with the av_handle\r
+* p_umv_buf\r
+* [in out] Vendor specific parameter to support user mode IO.\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* returned values are valid\r
+* IB_INVALID_AV_HANDLE\r
+* The address vector handle was invalid\r
+* IB_INVALID_PARAMETER\r
+* One of the p_av_attr or ph_pd parameters was NULL.\r
+* IB_INVALID_PORT\r
+* Invalid port number passed in the Address Vector.\r
+* SEE ALSO\r
+* ci_create_av, ci_modify_av\r
+*******\r
+*/\r
+\r
+/****f* Verbs/ci_modify_av\r
+* NAME\r
+* ci_modify_av -- Change the address vector referred by the av_handle\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(*ci_modify_av) (\r
+ IN const ib_av_handle_t h_av,\r
+ IN const ib_av_attr_t *p_av_attr,\r
+ IN OUT ci_umv_buf_t *p_umv_buf OPTIONAL );\r
+/*\r
+* DESCRIPTION\r
+* This routine allows a consumer to modify the address information\r
+* passed.\r
+* PARAMETERS\r
+* h_av\r
+* [in] Address handle that needs to be updated with new info.\r
+* p_av_attr\r
+* [in] New address vector to associate with the addr_handle.\r
+* p_umv_buf\r
+* [in out] Vendor specific parameter to support user mode IO.\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* Operation was successful\r
+* IB_INVALID_AV_HANDLE\r
+* The address vector handle was invalid\r
+* IB_INVALID_PORT\r
+* Invalid port number passed in the Address Vector.\r
+* IB_INVALID_PARAMETER\r
+* The parameter p_av_attr is not valid.\r
+* NOTES\r
+* The values in the p_av_attr is not validated for correctness. The values\r
+* in the attribute such as port number, protection domain etc are validated\r
+* during processing by the channel adapter. If the attribute validation fails\r
+* a processing error IB_WCS_LOCAL_OP_ERR.\r
+* SEE ALSO\r
+* ci_create_av, ci_query_av\r
+*********\r
+*/\r
+\r
+/****f* Verbs/ci_destroy_av\r
+* NAME\r
+* ci_destroy_av -- Destroy the address vector\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(*ci_destroy_av) (\r
+ IN const ib_av_handle_t h_av );\r
+/*\r
+* DESCRIPTION\r
+* This routine destroys the specified address handle. After the routine\r
+* returns, this address handle cannot be used to reference the destination.\r
+* PARAMETERS\r
+* h_av\r
+* [in] Handle that needs to be destroyed.\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* Operation was successful.\r
+* IB_INVALID_AV_HANDLE\r
+* The address vector handle was invalid\r
+* SEE ALSO\r
+* ci_create_av\r
+*********\r
+*/\r
+\r
+/****f* Verbs/ci_create_srq\r
+* NAME\r
+* ci_create_srq -- Create a Shared Queue Pair for the specified HCA\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(*ci_create_srq) (\r
+ IN const ib_pd_handle_t h_pd,\r
+ IN const void *srq_context,\r
+ IN const ib_srq_attr_t * const p_srq_attr,\r
+ OUT ib_srq_handle_t *ph_srq,\r
+ IN OUT ci_umv_buf_t *p_umv_buf OPTIONAL );\r
+/*\r
+* DESCRIPTION\r
+* A new shared queue pair is created on the specified HCA. The initial set of\r
+* parameters is provided by the srq_attr_mask/p_srq_attr parameters. The newly created\r
+* queue pair with its attributes is returned in the srq_query_attr structure.\r
+* PARAMETERS\r
+* h_pd\r
+* [in] Handle to Protection Domain\r
+* srq_context\r
+* [in] A user specified context passed in a asynchronous error callback.\r
+* p_srq_attr\r
+* [in out] Initial attributes with which the srq must be created.\r
+* ph_srq\r
+* [out] Handle to the queue pair newly created.\r
+* p_umv_buf\r
+* [in out] Vendor specific parameter to support user mode IO.\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The queue pair is successfully created with the provided initial\r
+* attributes.\r
+* IB_INSUFFICIENT_RESOURCES\r
+* Insufficient resources to complete request.\r
+* IB_INVALID_PD_HANDLE\r
+* pd_handle supplied in the qp_create_attr is invalid\r
+* IB_INVALID_SERVICE_TYPE\r
+* Invalid service type.\r
+* IB_INVALID_MAX_WRS\r
+* Max WRS capacity exceeded\r
+* IB_INVALID_MAX_SGE\r
+* Max Scatter gather element request exceeds HCA capability\r
+* IB_UNSUPPORTED\r
+* Unreliable datagram not supported\r
+* IB_INVALID_PARAMETER\r
+* The parameter p_create_attr is invalid.\r
+* NOTES\r
+* If any of the initial parameters is not valid, the queue pair is not\r
+* created. If the routine call is not successful then the contents of\r
+* qp_query_attr and qp_handle is undefined.\r
+* SEE ALSO\r
+* ci_query_qp, ci_modify_qp, ci_destroy_qp\r
+******\r
+*/\r
+\r
+\r
+/****f* Verbs/ci_modify_srq\r
+* NAME\r
+* ci_modify_srq -- Modify attributes of the specified SRQ.\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(*ci_modify_srq) (\r
+ IN const ib_srq_handle_t h_srq,\r
+ IN const ib_srq_attr_t* const p_srq_attr,\r
+ IN const ib_srq_attr_mask_t srq_attr_mask,\r
+ IN OUT ci_umv_buf_t *p_umv_buf OPTIONAL );\r
+/*\r
+* DESCRIPTION\r
+* This routine is used to modify the srq states or other attributes of the\r
+* srq. On successful completion, the requested state transition is performed\r
+* and the srq is transitioned to the required state.\r
+* PARAMETERS\r
+* h_srq\r
+* [in] Handle to the queue pair whose state is to be modified.\r
+* p_srq_attr\r
+* [in] Initial attributes with which the srq must be created.\r
+* srq_attr_mask\r
+* [in] Flags, specifying valid fields in ib_srq_attr_t structure.\r
+* p_umv_buf\r
+* [in out] Vendor specific parameter to support user mode IO.\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The operation was successful and the QP attributes are modified\r
+* to the requested state.\r
+* IB_INSUFFICIENT_RESOURCES\r
+* Insufficient resources to complete the requested operation.\r
+* IB_INVALID_QP_HANDLE\r
+* Invalid QP handle was passed.\r
+* IB_UNSUPPORTED\r
+* Requested operation is not supported, for e.g. Atomic operations.\r
+* IB_QP_INVALID_STATE\r
+* Invalid state transition request. Current QP state not in allowable\r
+* state.\r
+* IB_INVALID_PARAMETER\r
+* The parameter p_modify_attr is not valid.\r
+* SEE ALSO\r
+* ci_create_qp, ci_destroy_qp, ci_query_qp\r
+******\r
+*/\r
+\r
+\r
+/****f* Verbs/ci_query_srq\r
+* NAME\r
+* ci_query_srq -- Query the current SRQ attributes\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(*ci_query_srq) (\r
+ IN const ib_srq_handle_t h_srq,\r
+ OUT ib_srq_attr_t* const p_srq_attr,\r
+ IN OUT ci_umv_buf_t *p_umv_buf OPTIONAL );\r
+/*\r
+* DESCRIPTION\r
+* This routine queries the current attributes for the srq\r
+* corresponding to h_srq. The attributes are returned in p_query_attr.\r
+* Depending on the current state of the srq, some of the fields in the\r
+* attribute structure may not be valid.\r
+* PARAMETERS\r
+* h_srq\r
+* [in] Handle to the srq for which the attributes are being retrieved\r
+* p_srq_attr\r
+* [out] Pointer to the ib_srq_query_t structure where the current\r
+* attributes of the srq is returned.\r
+* p_umv_buf\r
+* [in out] Vendor specific parameter to support user mode IO.\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The values returned in p_qp_attr are valid.\r
+* IB_INVALID_QP_HANDLE\r
+* The h_qp supplied is not a valid handle.\r
+* IB_INVALID_PARAMETER\r
+* Parameter p_qp_attr is not valid.\r
+* SEE ALSO\r
+* ci_create_qp, ci_destroy_qp, ci_modify_srq\r
+*****\r
+*/\r
+\r
+\r
+/****f* Verbs/ci_destroy_srq\r
+* NAME\r
+* ci_destroy_srq -- Destroy the specified Shared Queue Pair.\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(*ci_destroy_srq) (\r
+ IN const ib_srq_handle_t h_srq );\r
+/*\r
+* DESCRIPTION\r
+* Destroys the associated srq. The srq could have outstanding work requests\r
+* when this call is made. Any outstanding work requests *SHALL NOT* be\r
+* completed after this routine returns.\r
+* PARAMETERS\r
+* h_srq\r
+* [in] Handle to the srq that needs to be destroyed.\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The intend to destroy this queue pair is registered and no further\r
+* work requests will be processed. When no pending callbacks are in\r
+* progress, the destroy_callback function is invoked which marks the\r
+* destruction of the resource. The consumer can be guaranteed that\r
+* no future callbacks will be propagated on behalf of this resource.\r
+* IB_INVALID_QP_HANDLE\r
+* The handle passed is invalid.\r
+* IB_RESOURCE_BUSY\r
+* If the queue pair is a unreliable datagram service type, and\r
+* is still bound to a multicast group.\r
+* NOTES\r
+* This call cannot be called from any of the notification functions invoked\r
+* by the Verbs driver. For e.g. the completion handler or the async error\r
+* callback provided during the ci_open_ca() call. The call will block until\r
+* all references to this adapter object is closed which includes all the\r
+* pending callbacks returning back to the verbs provider driver.\r
+* SEE ALSO\r
+* ci_cquery_qp, ci_destroy_qp, ci_modify_srq\r
+******\r
+*/\r
+\r
+\r
+/****f* Verbs/ci_create_qp\r
+* NAME\r
+* ci_create_qp -- Create a Queue Pair for the specified HCA\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(*ci_create_qp) (\r
+ IN const ib_pd_handle_t h_pd,\r
+ IN const void *qp_context,\r
+ IN const ib_qp_create_t *p_create_attr,\r
+ OUT ib_qp_attr_t *p_qp_attr,\r
+ OUT ib_qp_handle_t *ph_qp,\r
+ IN OUT ci_umv_buf_t *p_umv_buf OPTIONAL );\r
+/*\r
+* DESCRIPTION\r
+* A new queue pair is created on the specified HCA. The initial set of\r
+* parameters is provided by the qp_create_attr parameter. The newly created\r
+* queue pair, with its attributes such as the qp number is returned\r
+* in the qp_query_attr structure.\r
+* PARAMETERS\r
+* h_pd\r
+* [in] Handle to Protection Domain\r
+* qp_context\r
+* [in] A user specified context passed in a asynchronous error callback.\r
+* p_create_attr\r
+* [in] Initial attributes with which the qp must be created.\r
+* p_qp_attr\r
+* [out] Attributes of the newly created queue pair.\r
+* ph_qp\r
+* [out] Handle to the queue pair newly created.\r
+* p_umv_buf\r
+* [in out] Vendor specific parameter to support user mode IO.\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The queue pair is successfully created with the provided initial\r
+* attributes.\r
+* IB_INSUFFICIENT_RESOURCES\r
+* Insufficient resources to complete request.\r
+* IB_INVALID_PD_HANDLE\r
+* pd_handle supplied in the qp_create_attr is invalid\r
+* IB_INVALID_CQ_HANDLE\r
+* cq_handle supplied for send/receive is invalid.\r
+* IB_INVALID_SERVICE_TYPE\r
+* Invalid service type.\r
+* IB_INVALID_MAX_WRS\r
+* Max WRS capacity exceeded\r
+* IB_INVALID_MAX_SGE\r
+* Max Scatter gather element request exceeds HCA capability\r
+* IB_UNSUPPORTED\r
+* Unreliable datagram not supported\r
+* IB_INVALID_PARAMETER\r
+* The parameter p_create_attr is invalid.\r
+* NOTES\r
+* If any of the initial parameters is not valid, the queue pair is not\r
+* created. If the routine call is not successful then the contents of\r
+* qp_query_attr and qp_handle is undefined.\r
+* SEE ALSO\r
+* ci_create_spl_qp, ci_query_qp, ci_modify_qp, ci_destroy_qp\r
+******\r
+*/\r
+\r
+/****f* Verbs/ci_create_spl_qp\r
+* NAME\r
+* ci_create_spl_qp -- Create a special queue pair.\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(*ci_create_spl_qp) (\r
+ IN const ib_pd_handle_t h_pd,\r
+ IN const uint8_t port_num,\r
+ IN const void *qp_context,\r
+ IN const ib_qp_create_t *p_create_attr,\r
+ OUT ib_qp_attr_t *p_qp_attr,\r
+ OUT ib_qp_handle_t *ph_qp );\r
+/*\r
+* DESCRIPTION\r
+* Create and return a handle to for the indicated service type on the\r
+* specified port. QP service types can be one of SMI, GSI, Raw IPv6 or\r
+* Raw ether type as specified in qp_type_t.\r
+* PARAMETERS\r
+* h_pd\r
+* [in] Handle to the PD on which the special queue pair is to be created.\r
+* port_num\r
+* [in] Port number for which this special queue pair is created.\r
+* qp_context\r
+* [in] User specified context passed during the async error callback\r
+* routine.\r
+* p_create_attr\r
+* [in] Initial set of attributes with which the queue pair is to be\r
+* created.\r
+* p_qp_attr\r
+* [out] QP attributes after the qp is successfully created.\r
+*\r
+* ph_qp\r
+* [out] Handle to the special qp after its creation.\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The special queue pair of the requested service type is created.\r
+* IB_INSUFFICIENT_RESOURCES\r
+* Insufficient resources to satisfy the request.\r
+* IB_NOT_FOUND\r
+* Indicated port guid is not found on this HCA.\r
+* IB_INVALID_CQ_HANDLE\r
+* Invalid cq handle passed to send/receive side.\r
+* IB_INVALID_MAX_WRS\r
+* Max WRS capacity exceeded\r
+* IB_INVALID_MAX_SGE\r
+* Max Scatter gather element request exceeds HCA capability\r
+* IB_RESOURCE_BUSY\r
+* Applicable to SMI/GSI qp's. This return code means that the SMI/GSI\r
+* QP is already allocated.\r
+* IB_INVALID_PD\r
+* Invalid protection domain supplied.\r
+* IB_INVALID_PORT\r
+* Invalid port number supplied.\r
+* IB_UNSUPPORTED\r
+* Raw datagram unsupported.\r
+* IB_INVALID_PARAMETER\r
+* The parameter p_create_attr is not valid.\r
+* NOTES\r
+* This verb is privileged and only available in kernel mode. The User mode\r
+* clients that need access to SMI/GSI qp's is recommended to do this via\r
+* a higher level of abstraction.\r
+* SEE ALSO\r
+* ci_create_qp, ci_query_qp, ci_modify_qp, ci_destroy_qp\r
+******\r
+*/\r
+\r
+/****f* Verbs/ci_modify_qp\r
+* NAME\r
+* ci_modify_qp -- Modify attributes of the specified QP.\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(*ci_modify_qp) (\r
+ IN const ib_qp_handle_t h_qp,\r
+ IN const ib_qp_mod_t *p_modify_attr,\r
+ OUT ib_qp_attr_t *p_qp_attr OPTIONAL,\r
+ IN OUT ci_umv_buf_t *p_umv_buf OPTIONAL );\r
+/*\r
+* DESCRIPTION\r
+* This routine is used to modify the qp states or other attributes of the\r
+* QP. On successful completion, the requested state transition is performed\r
+* and the QP is transitioned to the required state.\r
+* PARAMETERS\r
+* h_qp\r
+* [in] Handle to the queue pair whose state is to be modified.\r
+* p_modify_attr\r
+* [in] Specifies what attributes need to be modified in the qp.\r
+* p_qp_attr\r
+* [out] QP attributes after the qp is successfully created.\r
+* p_umv_buf\r
+* [in out] Vendor specific parameter to support user mode IO.\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The operation was successful and the QP attributes are modified\r
+* to the requested state.\r
+* IB_INSUFFICIENT_RESOURCES\r
+* Insufficient resources to complete the requested operation.\r
+* IB_INVALID_QP_HANDLE\r
+* Invalid QP handle was passed.\r
+* IB_UNSUPPORTED\r
+* Requested operation is not supported, for e.g. Atomic operations.\r
+* IB_QP_INVALID_STATE\r
+* Invalid state transition request. Current QP state not in allowable\r
+* state.\r
+* IB_INVALID_PKEY\r
+* Pkey specified in modify request not valid entry in P_KEY table. Or\r
+* index is out of range.\r
+* IB_INVALID_APM_STATE\r
+* Invalid automatic path migration state specified in the request.\r
+* IB_INVALID_PARAMETER\r
+* The parameter p_modify_attr is not valid.\r
+* NOTES\r
+* Refer to Table 79 in chapter 11, Volume 1 of the InfiniBand Specifications.\r
+* SEE ALSO\r
+* ci_create_qp, ci_create_spl_qp, ci_query_qp\r
+******\r
+*/\r
+\r
+/****f* Verbs/ci_ndi_modify_qp\r
+* NAME\r
+* ci_ndi_modify_qp -- Modify attributes of the specified QP.\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(*ci_ndi_modify_qp) (\r
+ IN const ib_qp_handle_t h_qp,\r
+ IN const ib_qp_mod_t *p_modify_attr,\r
+ OUT ib_qp_attr_t *p_qp_attr OPTIONAL,\r
+ IN const uint32_t buf_size,\r
+ IN OUT uint8_t* const p_outbuf);\r
+/*\r
+* DESCRIPTION\r
+* This routine is used to modify the qp states or other attributes of the\r
+* QP. On successful completion, the requested state transition is performed\r
+* and the QP is transitioned to the required state.\r
+* PARAMETERS\r
+* h_qp\r
+* [in] Handle to the queue pair whose state is to be modified.\r
+* p_modify_attr\r
+* [in] Specifies what attributes need to be modified in the qp.\r
+* p_qp_attr\r
+* [out] QP attributes after the qp is successfully created.\r
+* buf_size\r
+* [in] Size of the output buffer\r
+* p_outbuf\r
+* [in out] Output buffer\r
+*\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The operation was successful and the QP attributes are modified\r
+* to the requested state.\r
+* IB_INSUFFICIENT_RESOURCES\r
+* Insufficient resources to complete the requested operation.\r
+* IB_INVALID_QP_HANDLE\r
+* Invalid QP handle was passed.\r
+* IB_UNSUPPORTED\r
+* Requested operation is not supported, for e.g. Atomic operations.\r
+* IB_QP_INVALID_STATE\r
+* Invalid state transition request. Current QP state not in allowable\r
+* state.\r
+* IB_INVALID_PKEY\r
+* Pkey specified in modify request not valid entry in P_KEY table. Or\r
+* index is out of range.\r
+* IB_INVALID_APM_STATE\r
+* Invalid automatic path migration state specified in the request.\r
+* IB_INVALID_PARAMETER\r
+* The parameter p_modify_attr is not valid.\r
+* NOTES\r
+* Refer to Table 79 in chapter 11, Volume 1 of the InfiniBand Specifications.\r
+* SEE ALSO\r
+* ci_create_qp, ci_create_spl_qp, ci_query_qp\r
+******\r
+*/\r
+\r
+/****f* Verbs/ci_query_qp\r
+* NAME\r
+* ci_query_qp -- Query the current QP attributes\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(*ci_query_qp) (\r
+ IN const ib_qp_handle_t h_qp,\r
+ OUT ib_qp_attr_t* const p_qp_attr,\r
+ IN OUT ci_umv_buf_t *p_umv_buf OPTIONAL );\r
+/*\r
+* DESCRIPTION\r
+* This routine queries the current attributes for the QP\r
+* corresponding to h_qp. The attributes are returned in p_query_attr.\r
+* Depending on the current state of the QP, some of the fields in the\r
+* attribute structure may not be valid.\r
+* PARAMETERS\r
+* h_qp\r
+* [in] Handle to the QP for which the attributes are being retrieved\r
+* p_qp_attr\r
+* [out] Pointer to the ib_qp_query_t structure where the current\r
+* attributes of the QP is returned.\r
+* p_umv_buf\r
+* [in out] Vendor specific parameter to support user mode IO.\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The values returned in p_qp_attr are valid.\r
+* IB_INVALID_QP_HANDLE\r
+* The h_qp supplied is not a valid handle.\r
+* IB_INVALID_PARAMETER\r
+* Parameter p_qp_attr is not valid.\r
+* SEE ALSO\r
+* ci_create_qp\r
+*****\r
+*/\r
+\r
+/****f* Verbs/ci_destroy_qp\r
+* NAME\r
+* ci_destroy_qp -- Destroy the specified Queue Pair.\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(*ci_destroy_qp) (\r
+ IN const ib_qp_handle_t h_qp,\r
+ IN const uint64_t timewait );\r
+/*\r
+* DESCRIPTION\r
+* Destroys the associated QP. The QP could have outstanding work requests\r
+* when this call is made. Any outstanding work requests *SHALL NOT* be\r
+* completed after this routine returns.\r
+* PARAMETERS\r
+* h_qp\r
+* [in] Handle to the qp that needs to be destroyed.\r
+* timewait\r
+* [in] Time (in microseconds) at which the QP should leave\r
+* the timewait state and can be reused.\r
+*\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The intend to destroy this queue pair is registered and no further\r
+* work requests will be processed. When no pending callbacks are in\r
+* progress, the destroy_callback function is invoked which marks the\r
+* destruction of the resource. The consumer can be guaranteed that\r
+* no future callbacks will be propagated on behalf of this resource.\r
+* IB_INVALID_QP_HANDLE\r
+* The handle passed is invalid.\r
+* IB_RESOURCE_BUSY\r
+* If the queue pair is a unreliable datagram service type, and\r
+* is still bound to a multicast group.\r
+* NOTES\r
+* This call cannot be called from any of the notification functions invoked\r
+* by the Verbs driver. For e.g. the completion handler or the async error\r
+* callback provided during the ci_open_ca() call. The call will block until\r
+* all references to this adapter object is closed which includes all the\r
+* pending callbacks returning back to the verbs provider driver.\r
+*\r
+* If the CQ associated with this QP is still not destroyed, the completions\r
+* on behalf of this QP can still be pulled via the ci_poll_cq() call. Any\r
+* resources allocated by the Channel Interface must be deallocated as part\r
+* of this call.\r
+* SEE ALSO\r
+* ci_create_qp, ci_create_spl_qp\r
+******\r
+*/\r
+\r
+/****f* Verbs/ci_create_cq\r
+* NAME\r
+* ci_create_cq -- Create a completion queue (CQ) on the specified HCA.\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(*ci_create_cq) (\r
+ IN const ib_ca_handle_t h_ca,\r
+ IN const void *cq_context,\r
+ IN OUT uint32_t* const p_size,\r
+ OUT ib_cq_handle_t *ph_cq,\r
+ IN OUT ci_umv_buf_t *p_umv_buf OPTIONAL );\r
+/*\r
+* DESCRIPTION\r
+* The consumer must specify the minimum number of entries in the CQ. The\r
+* exact number of entries the Channel Interface created is returned to the\r
+* client. If the requested number of entries is larger than what this\r
+* HCA can support, an error is returned.\r
+* PARAMETERS\r
+* h_ca\r
+* [in] A handle to the open HCA\r
+* cq_context\r
+* [in] The context that is passed during the completion callbacks.\r
+* p_size\r
+* [in out] Points to a variable containing the number of CQ entries\r
+* requested by the consumer. On completion points to the size of the\r
+* CQ that was created by the provider.\r
+* ph_cq\r
+* [out] Handle to the newly created CQ on successful creation.\r
+* p_umv_buf\r
+* [in out] Vendor specific parameter to support user mode IO.\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The operation was successful.\r
+* IB_INVALID_CA_HANDLE\r
+* The h_ca passed is invalid.\r
+* IB_INSUFFICIENT_RESOURCES\r
+* Insufficient resources to complete request.\r
+* IB_INVALID_CQ_SIZE\r
+* Requested CQ Size is not supported.\r
+* IB_INVALID_PARAMETER\r
+* one of the parameters was NULL.\r
+* NOTES\r
+* The consumer would need a way to retrieve the cq_handle associated with\r
+* context being returned, so it can perform ci_poll_cq() to retrieve\r
+* completion queue entries. The handle as such is not being passed, since\r
+* there is no information in the handle that is visible to the consumer.\r
+* Passing a context directly would help avoid any reverse lookup that the\r
+* consumer would need to perform in order to identify it's own internal\r
+* data-structures needed to process this completion completely.\r
+* SEE ALSO\r
+* ci_destroy_cq, ci_query_cq, ci_resize_cq\r
+******\r
+*/\r
+\r
+/****f* Verbs/ci_resize_cq\r
+* NAME\r
+* ci_resize_cq -- Modify the maximum number of entries the CQ could hold.\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(*ci_resize_cq) (\r
+ IN const ib_cq_handle_t h_cq,\r
+ IN OUT uint32_t* const p_size,\r
+ IN OUT ci_umv_buf_t *p_umv_buf OPTIONAL );\r
+/*\r
+* DESCRIPTION\r
+* This routine allows the caller to modify the maximum number of entries\r
+* the CQ could hold. It is possible to resize the CQ while there are\r
+* entries in the CQ, and with outstanding work requests that will generate\r
+* completions. If the entries in the CQ are more than the new size which is\r
+* being created, an error is returned.\r
+* PARAMETERS\r
+* h_cq\r
+* [in] Completion Queue handle\r
+* p_size\r
+* [in out] This parameter indicates the requested size of the CQ. On\r
+* successful completion, the current size allocated is returned in\r
+* this same parameter.\r
+* p_umv_buf\r
+* [in out] Vendor specific parameter to support user mode IO.\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The resize operation was successful.\r
+* IB_INVALID_CQ_HANDLE\r
+* The CQ handle is invalid.\r
+* IB_INSUFFICIENT_RESOURCES\r
+* Insufficient resources to complete request.\r
+* IB_INVALID_PARAMETER\r
+* one of the parameters was NULL.\r
+* IB_INVALID_CQ_SIZE\r
+* Requested CQ Size is not supported.\r
+* IB_OVERFLOW\r
+* The CQ has more entries than the resize request. The CQ is not\r
+* modified, and old entries still exist.\r
+* NOTES\r
+* If the consumer wishes to resize the CQ smaller than originally created,\r
+* it is recommended to retrieve all entries before performing a CQ resize\r
+* operation. It is left to the verb implementer on resize operations, to\r
+* actually reduce the entries, or leave it as it. The consumer must make no\r
+* assumptions on the successful completion, and should only rely on the\r
+* size returned in p_size.\r
+* SEE ALSO\r
+* ci_create_cq\r
+******\r
+*/\r
+\r
+/****f* Verbs/ci_query_cq\r
+* NAME\r
+* ci_query_cq -- Query the number of entries configured for the CQ.\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(*ci_query_cq) (\r
+ IN const ib_cq_handle_t h_cq,\r
+ OUT uint32_t *p_size,\r
+ IN OUT ci_umv_buf_t *p_umv_buf OPTIONAL );\r
+/*\r
+* DESCRIPTION\r
+* This routine returns the maximum number of entries this completion\r
+* queue is configured.\r
+* PARAMETERS\r
+* h_cq\r
+* [in] Handle to the completion queue\r
+* p_size\r
+* [out] The number of entries the completion queue is configured to hold\r
+* p_umv_buf\r
+* [in out] Vendor specific parameter to support user mode IO.\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The call completed successfully, and the returned values are valid\r
+* IB_INVALID_CQ_HANDLE\r
+* The cq_handle passed is invalid.\r
+* IB_INVALID_PARAMETER\r
+* one of the parameters was NULL.\r
+* SEE ALSO\r
+* ci_create_cq, ci_resize_cq\r
+******\r
+*/\r
+\r
+/****f* Verbs/ci_destroy_cq\r
+* NAME\r
+* ci_destroy_cq -- Destroy a completion queue.\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(*ci_destroy_cq) (\r
+ IN const ib_cq_handle_t h_cq );\r
+/*\r
+* DESCRIPTION\r
+* Destroys a completion queue. If any queue pairs are still bound\r
+* to this CQ, the attempt to destroy will fail, and the CQ and associated\r
+* resources are *NOT* destroyed.\r
+* PARAMETERS\r
+* cq_handle\r
+* [in] Handle to the cq that is to be destroyed.\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The intend to destroy the completion queue is registered successfully.\r
+* The destroy_callback function will be invoked when it is safe and\r
+* guarantees that no more completion callbacks will be invoked for\r
+* this CQ. Any pending CQ notifications are discarded.\r
+* IB_INVALID_CQ_HANDLE\r
+* The CQ handle is invalid.\r
+* IB_RESOURCE_BUSY\r
+* Queue pairs may still be bound to this completion queue.\r
+* IB_INVALID_PARAMETER\r
+* one of the parameters was NULL.\r
+* SEE ALSO\r
+* ci_create_cq\r
+* NOTES\r
+* This call cannot be called from any of the notification functions invoked\r
+* by the Verbs driver. For e.g. the completion handler or the async error\r
+* callback provided during the ci_open_ca() call. The call will block until\r
+* all references to this adapter object is closed which includes all the\r
+* pending callbacks returning back to the verbs provider driver.\r
+******\r
+*/\r
+\r
+\r
+\r
+/****f* Verbs/ci_register_mr\r
+* NAME\r
+* ci_register_mr -- Register a memory region with the HCA.\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(*ci_register_mr) (\r
+ IN const ib_pd_handle_t h_pd,\r
+ IN const ib_mr_create_t* const p_mr_create,\r
+ OUT net32_t* const p_lkey,\r
+ OUT net32_t* const p_rkey,\r
+ OUT ib_mr_handle_t* const ph_mr,\r
+ IN boolean_t um_call );\r
+/*\r
+* DESCRIPTION\r
+* This routine registers a virtually contiguous region of memory with the\r
+* HCA. All memory regions that need to be used by the HCA must be registered\r
+* prior to use in data transfer operations. On successful completion\r
+* the region handle, lkey are returned. If remote access rights are specified\r
+* then the rkey is also returned.\r
+* PARAMETERS\r
+* h_pd\r
+* [in] Handle to the PD on which memory is being registered\r
+* p_mr_create\r
+* [in] Holds attributes for the region being registered. Look at\r
+* ib_mr_create_t for more details.\r
+* p_lkey\r
+* [out] Local Key Attributes of the registered memory region\r
+* p_rkey\r
+* [out] Remote key of the registered memory region. The verbs provider\r
+* is required to give this in the expected ordering on the wire. When\r
+* rkey's are exchanged between remote nodes, no swapping of this data\r
+* will be performed.\r
+* ph_mr\r
+* [out] Handle to the registered memory region. This handle is used when\r
+* submitting work requests to refer to this region of memory.\r
+* um_call\r
+* [in] Boolean indicating whether the registration originated in user-mode.\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* Registration with the adapter was successful.\r
+* IB_INSUFFICIENT_RESOURCES\r
+* Insufficient resources to satisfy request.\r
+* IB_INVALID_PARAMETER\r
+* One of the input pointers was NULL.\r
+* IB_INVALID_PD_HANDLE\r
+* Invalid mr_pdhandle\r
+* IB_INVALID_PERMISSION\r
+* Invalid access rights.\r
+* NOTES\r
+* In addition to registration, the routine also pins memory, so that the\r
+* physical page associated with the virtual address does not get swapped\r
+* out during the time the HCA is attempting to transfer data to this\r
+* address. If the memory is not pinned, this could lead to data-corruption\r
+* and unpredictable behavior by the operating environment.\r
+*\r
+* SEE ALSO\r
+* ci_deregister_mr, ci_query_mr, ci_register_pmr, ci_modify_mr,\r
+* ci_register_smr\r
+******\r
+*/\r
+\r
+/****f* Verbs/ci_register_pmr\r
+* NAME\r
+* ci_register_pmr -- Register a physical memory region with the HCA.\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(*ci_register_pmr) (\r
+ IN const ib_pd_handle_t h_pd,\r
+ IN const ib_phys_create_t*const p_pmr_create,\r
+ IN OUT uint64_t* const p_vaddr,\r
+ OUT net32_t* const p_lkey,\r
+ OUT net32_t* const p_rkey,\r
+ OUT ib_mr_handle_t* const ph_mr,\r
+ IN boolean_t um_call );\r
+/*\r
+* DESCRIPTION\r
+* This routine registers an array of physical pages as a single virtually\r
+* contiguous region with the HCA. All memory regions that need to be used by\r
+* the HCA must be registered prior to use in data transfer operations.\r
+* On successful completion the region handle, lkey and rkey used for\r
+* local and remote access authentication are returned.\r
+* PARAMETERS\r
+* h_pd\r
+* [in] Handle to the PD on which memory is being registered\r
+* p_pmr_create\r
+* [in] Holds attributes for the region being registered.\r
+* p_vaddr\r
+* [in/out] On input, references the requested virtual address for the\r
+* start of the physical region. On output, references the actual\r
+* virtual address assigned to the registered region.\r
+* p_lkey\r
+* [out] Local key of the registered memory region\r
+* p_rkey\r
+* [out] Remote key of the registered memory region.The verbs provider\r
+* is required to give this in the expected ordering on the wire. When\r
+* rkey's are exchanged between remote nodes, no swapping of this data\r
+* will be performed.\r
+* ph_mr\r
+* [out] Handle to the registered memory region. This handle is used when\r
+* submitting work requests to refer to this region of memory.\r
+* um_call\r
+* [in] Boolean indicating whether the registration originated in user-mode.\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* Registration with the adapter was successful.\r
+* IB_INSUFFICIENT_RESOURCES\r
+* Insufficient resources to satisfy request.\r
+* IB_INVALID_PARAMETER\r
+* Invalid length or address in p_mr_create. Also returned if the page_size\r
+* passed is not one of supported page sizes by the HCA.\r
+* IB_INVALID_PD_HANDLE\r
+* Invalid mr_pdhandle\r
+* IB_INVALID_PERMISSION\r
+* Invalid access rights.\r
+* PORTABILITY\r
+* Kernel Mode only\r
+* NOTES\r
+* Remote and Atomic access settings in ib_access_ctrl_t, requires local\r
+* write access to be enabled, otherwise IB_INVALID_PERMISSION is returned.\r
+* The p_vaddr returned could be different from the vaddr specified in\r
+* p_pmr_create. If the requested virtual addr offset in a page does not\r
+* match, the channel interface is free to pick and assign a pseudo virtual\r
+* address. The address constructed is not a system virtual address, and only\r
+* meaningful to the adapter to which this registration is targeted.\r
+* SEE ALSO\r
+* ci_deregister_mr, ci_query_mr, ci_register_mr, ci_modify_mr,\r
+* ci_register_smr\r
+******\r
+*/\r
+\r
+/****f* Verbs/ci_query_mr\r
+* NAME\r
+* ci_query_mr -- Query attributes of a registered memory region\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(*ci_query_mr) (\r
+ IN const ib_mr_handle_t h_mr,\r
+ OUT ib_mr_attr_t* const p_mr_query );\r
+/*\r
+* DESCRIPTION\r
+* This routine retrieves the memory region attributed of a\r
+* registered memory region. The memory handle could have been\r
+* obtained via ci_register_mr or ci_register_pmr.\r
+* PARAMETERS\r
+* h_mr\r
+* [in] Memory handle for which the attributes need to be retrieved.\r
+* p_mr_query\r
+* [out] Attributes of the memory region associated with memory handle.\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The routine completed successfully and attributes returned\r
+* are valid.\r
+* IB_INVALID_MR_HANDLE\r
+* The memory handle is not valid.\r
+* IB_INVALID_PARAMETER\r
+* One of the input pointers was NULL.\r
+* NOTES\r
+* Invalid handle checks are a mere signature checks in kernel mode.\r
+* Drivers in kernel are expected to be good corporate citizens.\r
+* In user mode, proper ownership is determined before passing handles\r
+* down to kernel to protect from rogue applications.\r
+* SEE ALSO\r
+* ci_register_mr, ci_register_pmr\r
+******\r
+*/\r
+\r
+/****f* Verbs/ci_modify_mr\r
+* NAME\r
+* ci_modify_mr -- Modify some or all parameters of a memory region.\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(*ci_modify_mr) (\r
+ IN const ib_mr_handle_t h_mr,\r
+ IN const ib_mr_mod_t mr_modify_mask,\r
+ IN const ib_mr_create_t* const p_mr_create OPTIONAL,\r
+ OUT net32_t* const p_lkey,\r
+ OUT net32_t* const p_rkey,\r
+ IN const ib_pd_handle_t h_pd OPTIONAL,\r
+ IN boolean_t um_call );\r
+/*\r
+* DESCRIPTION\r
+* This routine modifies attributes of the specified memory region\r
+* irrespective of whether the handle was obtained via ci_register_mr\r
+* or ci_register_pmr. This verb conceptually performs a de-registration\r
+* followed by a ci_register_mr.\r
+* PARAMETERS\r
+* h_mr\r
+* [in] Handle to the memory region whose attributes are to be modified.\r
+* mr_modify_mask\r
+* [in] Command specifying which parts of the mem_region is valid. The\r
+* command is specified as a bit mask.\r
+* p_mr_create\r
+* [in] Desired attributes that need to be modified for mem_handle.\r
+* This is an optional parameter which can be NULL if mr_modify_mask\r
+* is set to IB_MR_MOD_PD.\r
+* p_lkey\r
+* [out] The new l_key for this newly registered memory region.\r
+* p_rkey\r
+* [out] The new r_key for this newly registered memory region.\r
+* The verbs provider is required to give this in the expected ordering\r
+* on the wire. When rkey's are exchanged between remote nodes, no\r
+* swapping of this data will be performed.\r
+* h_pd\r
+* [in] This parameter is valid only if the IB_MR_MOD_PD flag is set\r
+* in the mr_modify_req parameter. This field supplies the new\r
+* protection domain to which the modified region should be\r
+* associated with.\r
+* um_call\r
+* [in] Boolean indicating whether the registration originated in user-mode.\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The modify memory region request completed successfully.\r
+* IB_RESOURCE_BUSY\r
+* The memory region has windows bound to it.\r
+* IB_INSUFFICIENT_RESOURCES\r
+* Insufficient resources to complete the request.\r
+* IB_INVALID_MR_HANDLE\r
+* The memory handle supplied is not a valid memory region handle.\r
+* IB_INVALID_PERMISSION\r
+* Invalid access rights specified.\r
+* IB_INVALID_PARAMETER\r
+* A reference to the lkey or rkey was not provided or the specified\r
+* modify mask is invalid.\r
+* IB_INVALID_SETTING\r
+* The specified memory region attributes are invalid.\r
+* IB_INVALID_PD_HANDLE\r
+* Protection domain handle supplied is not valid.\r
+* NOTES\r
+* Remote and Atomic access settings in ib_access_ctrl_t, requires local\r
+* write access to be enabled.\r
+* TBD: How to handle shared memory region being passed to modify_mem?\r
+* SEE ALSO\r
+* ci_register_mr, ci_register_pmr, ci_register_smr\r
+*******\r
+*/\r
+\r
+/****f* Verbs/ci_modify_pmr\r
+* NAME\r
+* ci_modify_pmr -- Modify some or all parameters of a memory region.\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(*ci_modify_pmr) (\r
+ IN const ib_mr_handle_t h_mr,\r
+ IN const ib_mr_mod_t mr_modify_mask,\r
+ IN const ib_phys_create_t* const p_pmr_create,\r
+ IN OUT uint64_t* const p_vaddr,\r
+ OUT net32_t* const p_lkey,\r
+ OUT net32_t* const p_rkey,\r
+ IN const ib_pd_handle_t h_pd OPTIONAL,\r
+ IN boolean_t um_call );\r
+/*\r
+* DESCRIPTION\r
+* This routine modifies attributes of the specified memory region\r
+* irrespective of whether the handle was obtained via ci_register_mr\r
+* or ci_register_pmr. This verb conceptually performs a de-registration\r
+* followed by a ci_register_pmr.\r
+* PARAMETERS\r
+* h_mr\r
+* [in] Handle to the memory region whose attributes are to be modified.\r
+* mr_modify_mask\r
+* [in] Command specifying which parts of the mem_region is valid. The\r
+* command is specified as a bit mask.\r
+* p_pmr_create\r
+* [in] Desired attributes that need to be modified for mem_handle.\r
+* p_vaddr\r
+* [in/out] On input, references the requested virtual address for the\r
+* start of the physical region. On output, references the actual\r
+* virtual address assigned to the registered region.\r
+* p_lkey\r
+* [out] The new l_key for this newly registered physical memory region.\r
+* p_rkey\r
+* [out] The new r_key for this newly registered physical memory region.\r
+* VPD is required to give this in the expected ordering on the wire. When\r
+* rkey's are exchanged between remote nodes, no swapping of this data\r
+* will be performed.\r
+* h_pd\r
+* [in] This parameter is valid only if the IB_MR_MOD_PD flag is set\r
+* in the mr_modify_req parameter. This field supplies the new\r
+* protection domain to which the modified region should be\r
+* associated with.\r
+* um_call\r
+* [in] Boolean indicating whether the registration originated in user-mode.\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The modify memory region request completed successfully.\r
+* IB_RESOURCE_BUSY\r
+* The memory region has windows bound to it.\r
+* IB_INSUFFICIENT_RESOURCES\r
+* Insufficient resources to complete the request.\r
+* IB_INVALID_MR_HANDLE\r
+* The memory handle supplied is not a valid memory region handle.\r
+* IB_INVALID_PERMISSION\r
+* Invalid access rights specified.\r
+* IB_INVALID_PARAMETER\r
+* A reference to the virtual address, lkey, rkey was not provided or\r
+* the specified modify mask is invalid.\r
+* IB_INVALID_SETTING\r
+* The specified memory region attributes are invalid.\r
+* PORTABILITY\r
+* Kernel Mode only\r
+* NOTES\r
+* Remote and Atomic access settings in ib_access_ctrl_t, requires local\r
+* write access to be enabled.\r
+* SEE ALSO\r
+* ci_register_mr, ci_register_pmr, ci_register_smr\r
+*********\r
+*/\r
+\r
+/****f* Verbs/ci_register_smr\r
+* NAME\r
+* ci_register_smr -- Register a memory region using same physical pages as\r
+* an existing memory region.\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(*ci_register_smr) (\r
+ IN const ib_mr_handle_t h_mr,\r
+ IN const ib_pd_handle_t h_pd,\r
+ IN const ib_access_t access_ctrl,\r
+ IN OUT uint64_t* const p_vaddr,\r
+ OUT net32_t* const p_lkey,\r
+ OUT net32_t* const p_rkey,\r
+ OUT ib_mr_handle_t* const ph_mr,\r
+ IN boolean_t um_call );\r
+/*\r
+* DESCRIPTION\r
+* This routine registers a new memory region but shares the same set of\r
+* physical pages associated with memory handle. For user mode applications\r
+* the process *must* be owning memory handle for this call to be successful.\r
+* PARAMETERS\r
+* h_mr\r
+* [in] Handle to memory region whose physical pages are being registered\r
+* by this shared registration.\r
+* h_pd\r
+* [in] Handle to the PD on which memory is being registered\r
+* access_ctrl\r
+* [in] Memory access restrictions on the registered memory.\r
+* p_vaddr\r
+* [in/out] On input, references the requested virtual address for the\r
+* start of the physical region. On output, references the actual\r
+* virtual address assigned to the registered region.\r
+* p_lkey\r
+* [out] L_KEY for this memory region.\r
+* p_rkey\r
+* [out] R_KEY for this memory region. This is valid only when remote\r
+* access is enabled for this region. The verbs provider\r
+* is required to give this in the expected ordering on the wire. When\r
+* rkey's are exchanged between remote nodes, no swapping of this data\r
+* will be performed.\r
+* ph_mr\r
+* [out] Handle to the registered memory region. This handle is used when\r
+* submitting work requests to refer to this region of memory.\r
+* um_call\r
+* [in] Boolean indicating whether the registration originated in user-mode.\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The call is successful and a new region handle returned is valid.\r
+* IB_INVALID_MR_HANDLE\r
+* mr_handle is invalid.\r
+* IB_INVALID_PD_HANDLE\r
+* mr_pdhandle supplied is invalid.\r
+* IB_INVALID_PERMISSION\r
+* Invalid access rights passed in mr_access.\r
+* NOTES\r
+* ISSUE: how to deal with ci_deregister_mr, ci_modify_mr, ci_modify_pmr\r
+* should we treat them as memory windows and fail those if a shared region\r
+* was registered?\r
+* SEE ALSO\r
+* ci_register_mr, ci_register_pmr, ci_modify_mr, ci_modify_pmr\r
+******\r
+*/\r
+\r
+/****f* Verbs/ci_deregister_mr\r
+* NAME\r
+* ci_deregister_mr -- Deregister a memory region\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(*ci_deregister_mr) (\r
+ IN const ib_mr_handle_t h_mr );\r
+/*\r
+* DESCRIPTION\r
+* This routine deregisters a memory region from the HCA. The region can\r
+* de-registered only if there are no existing memory windows bound to\r
+* this region, and if no existing shared memory regions were registered\r
+* that refers to the same set of physical pages associated with the memory\r
+* handle. If there are outstanding work requests referring to this memory\r
+* region, then after this call is successful, those work requests will\r
+* complete with WRS_LOCAL_PROTECTION_ERR.\r
+* PARAMETERS\r
+* h_mr\r
+* [in] Memory handle that is being de-registered.\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The memory de-registration was successful\r
+* IB_INVALID_MR_HANDLE\r
+* The memory handle supplied is not a valid memory handle.\r
+* IB_RESOURCE_BUSY\r
+* The memory region has active windows bound.\r
+* NOTES\r
+* SEE ALSO\r
+* ci_register_mr, ci_register_pmr, ci_register_smr\r
+******\r
+*/\r
+\r
+\r
+#ifdef CL_KERNEL\r
+/****f* Verbs/ci_alloc_mlnx_fmr\r
+* NAME\r
+* ci_alloc_mlnx_fmr -- Allocate a Mellanox fast memory region with the HCA.\r
+* SYNOPSIS\r
+*/\r
+typedef ib_api_status_t\r
+(*ci_alloc_mlnx_fmr) (\r
+ IN const ib_pd_handle_t h_pd,\r
+ IN mlnx_fmr_create_t const *p_fmr_ctreate,\r
+ OUT mlnx_fmr_handle_t* const ph_fmr);\r
+/*\r
+* DESCRIPTION\r
+* //TODO \r
+* PARAMETERS\r
+* h_pd\r
+* [in] Handle to the PD on which fast memory is being registered\r
+* mr_access_flags\r
+* [in] mask of the access rights to the memory region\r
+* p_fmr_attr\r
+* [in] attribute of this fmr\r
+* ph_fmr\r
+* [out] Handle to the fast memory region. This handle is used when\r
+* mapin/unmaping fmr\r
+* \r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* Registration with the adapter was successful.\r
+* IB_INSUFFICIENT_RESOURCES\r
+* Insufficient resources to satisfy request.\r
+* IB_INVALID_PARAMETER\r
+* One of the input pointers was NULL.\r
+* IB_INVALID_PD_HANDLE\r
+* Invalid pd handle\r
+* IB_INVALID_PERMISSION\r
+* Invalid access rights.\r
+*\r
+* NOTES\r
+* The Alloc operation does not map nor pinned any memory.\r
+* In order to use the FMR the user need to call map\r
+*\r
+* This is a Mellanox specific extension to verbs.\r
+*\r
+* SEE ALSO\r
+* ci_dealloc_mlnx_fmr, ci_map_phys_mlnx_fmr, ci_unmap_mlnx_fmr\r
+******\r
+*/\r
+\r
+\r
+/****f* Verbs/ci_map_phys_mlnx_fmr\r
+* NAME\r
+* ci_map_phys_mlnx_fmr -- Map a Mellanox fast memory region with a\r
+* given page list.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef ib_api_status_t\r
+(*ci_map_phys_mlnx_fmr) (\r
+ IN const mlnx_fmr_handle_t h_fmr,\r
+ IN const uint64_t* const paddr_list,\r
+ IN const int list_len,\r
+ IN OUT uint64_t* const p_vaddr,\r
+ OUT net32_t* const p_lkey,\r
+ OUT net32_t* const p_rkey);\r
+/*\r
+* DESCRIPTION\r
+* //TODO\r
+*\r
+* PARAMETERS\r
+* h_fmr\r
+* [in] Handle to the fast memory region that these pages map to \r
+* page_list\r
+* [in] array of phys address\r
+* list_len\r
+* [in] number of pages in the list\r
+* p_vaddr\r
+* [in/out] On input, references the requested virtual address for the\r
+* start of the FMR. On output, references the actual\r
+* virtual address assigned to the FMR.\r
+* p_lkey\r
+* [out] The local access key associated with this registered memory\r
+* region.\r
+* p_rkey\r
+* [out] A key that may be used by a remote end-point when performing\r
+* RDMA or atomic operations to this registered memory region.\r
+*\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* Registration with the adapter was successful.\r
+* IB_INSUFFICIENT_RESOURCES\r
+* Insufficient resources to satisfy request.\r
+* IB_INVALID_PARAMETER\r
+* One of the input pointers was NULL.\r
+* IB_INVALID_PD_HANDLE\r
+* Invalid pd handle\r
+* IB_INVALID_PERMISSION\r
+* Invalid access rights.\r
+*\r
+* NOTES\r
+* The Alloc operation does not map nor pinned any memory.\r
+* In order to use the FMR the user need to call map \r
+*\r
+* This is a Mellanox specific extension to verbs.\r
+*\r
+* SEE ALSO\r
+* ci_dealloc_mlnx_fmr, ci_alloc_mlnx_fmr, ci_unmap_mlnx_fmr\r
+******\r
+*/\r
+\r
+\r
+/****f* Verbs/ci_unmap_mlnx_fmr\r
+* NAME\r
+* ci_unmap_mlnx_fmr -- UnMap a Mellanox fast memory region.\r
+* SYNOPSIS\r
+*/\r
+typedef ib_api_status_t\r
+(*ci_unmap_mlnx_fmr) (\r
+ IN const mlnx_fmr_handle_t *ph_fmr);\r
+/*\r
+* DESCRIPTION\r
+* //TODO\r
+*\r
+* PARAMETERS\r
+* h_fmr\r
+* [in] Handle to the fast memory region that these pages map to \r
+*\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* Registration with the adapter was successful.\r
+* IB_INSUFFICIENT_RESOURCES\r
+* Insufficient resources to satisfy request.\r
+* IB_INVALID_PARAMETER\r
+* One of the input pointers was NULL.\r
+* IB_INVALID_PD_HANDLE\r
+* Invalid pd handle\r
+* IB_INVALID_PERMISSION\r
+* Invalid access rights.\r
+*\r
+* NOTES\r
+* The Alloc operation does not map nor pinned any memory.\r
+* In order to use the FMR the user need to call map \r
+*\r
+* This is a Mellanox specific extension to verbs.\r
+*\r
+* SEE ALSO\r
+* ci_dealloc_mlnx_fmr, ci_alloc_mlnx_fmr, ci_map_phy_mlnx_fmr\r
+******\r
+*/\r
+\r
+\r
+/****f* Verbs/ci_dealloc_mlnx_fmr\r
+* NAME\r
+* ci_dealloc_mlnx_fmr -- Deallocate a Mellanox fast memory region.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef ib_api_status_t\r
+(*ci_dealloc_mlnx_fmr) (\r
+ IN mlnx_fmr_handle_t const h_fmr);\r
+/*\r
+* DESCRIPTION\r
+* //TODO\r
+*\r
+* PARAMETERS\r
+* h_fmr\r
+* [in] Handle to the fast memory region. This handle is used when\r
+* mapin/unmaping fmr\r
+*\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* Registration with the adapter was successful.\r
+* IB_INSUFFICIENT_RESOURCES\r
+* Insufficient resources to satisfy request.\r
+* IB_INVALID_PARAMETER\r
+* One of the input pointers was NULL.\r
+* IB_INVALID_PD_HANDLE\r
+* Invalid pd handle\r
+* IB_INVALID_PERMISSION\r
+* Invalid access rights.\r
+*\r
+* NOTES\r
+* This is a Mellanox specific extension to verbs.\r
+*\r
+* SEE ALSO\r
+* ci_dealloc_mlnx_fmr, ci_map_phys_mlnx_fmr, ci_unmap_mlnx_fmr\r
+******\r
+*/\r
+#endif\r
+\r
+\r
+/****f* Verbs/ci_create_mw\r
+* NAME\r
+* ci_create_mw -- Create a memory window entry for later use\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(*ci_create_mw) (\r
+ IN const ib_pd_handle_t h_pd,\r
+ OUT net32_t* const p_rkey,\r
+ OUT ib_mw_handle_t *ph_mw,\r
+ IN OUT ci_umv_buf_t *p_umv_buf OPTIONAL );\r
+/*\r
+* DESCRIPTION\r
+* This routine allocates a memory window. This window entry cannot be used\r
+* for remote access unless this window is bound to a memory region\r
+* via the ci_bind_mw call.\r
+* PARAMETERS\r
+* h_pd\r
+* [in] Protection domain handle to use for this memory window\r
+* p_rkey\r
+* [out] Remote access key that can be exchanged with a remote node to\r
+* perform RDMA transactions on this memory window. This R_KEY is still not\r
+* bound to any memory regions, until a successful call to ci_bind_mw.\r
+* VPD is required to give this in the expected ordering on the wire. When\r
+* rkey's are exchanged between remote nodes, no swapping of this data\r
+* will be performed.\r
+* ph_mw\r
+* [out] Handle to the newly created memory window.\r
+* p_umv_buf\r
+* [in out] Vendor specific parameter to support user mode IO.\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The memory window allocation completed successfully.\r
+* IB_INSUFFICIENT_RESOURCES\r
+* Not enough resources to complete the request.\r
+* IB_INVALID_PD_HANDLE\r
+* pd_handle supplied is invalid.\r
+* IB_INVALID_PARAMETER\r
+* One of the pointers was not valid.\r
+* SEE ALSO\r
+* ci_destroy_mw, ci_query_mw, ci_bind_mw\r
+******\r
+*/\r
+\r
+/****f* Verbs/ci_query_mw\r
+* NAME\r
+* ci_query_mw -- Query memory window attributes for memory window handle\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(*ci_query_mw) (\r
+ IN const ib_mw_handle_t h_mw,\r
+ OUT ib_pd_handle_t *ph_pd,\r
+ OUT net32_t* const p_rkey,\r
+ IN OUT ci_umv_buf_t *p_umv_buf OPTIONAL );\r
+/*\r
+* DESCRIPTION\r
+* This routine retrieves the current R_KEY and protection domain\r
+* handle associated with this mw_handle.\r
+* PARAMETERS\r
+* h_mw\r
+* [in] Memory window handle whose attributes are being retrieved.\r
+* ph_pd\r
+* [out] Protection domain handle associated with this mw_handle\r
+* p_rkey\r
+* [out] Current R_KEY associated with this mw_handle.The verbs provider\r
+* is required to give this in the expected ordering on the wire. When\r
+* rkey's are exchanged between remote nodes, no swapping of this data\r
+* will be performed.\r
+* p_umv_buf\r
+* [in out] Vendor specific parameter to support user mode IO.\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The query operation completed successfully.\r
+* IB_INVALID_MW_HANDLE\r
+* mw_handle supplied is an invalid handle\r
+* IB_INVALID_PARAMETER\r
+* One of the pointers was not valid.\r
+* SEE ALSO\r
+* ci_create_mw, ci_bind_mw\r
+******\r
+*/\r
+\r
+/****f* Verbs/ci_bind_mw\r
+* NAME\r
+* ci_bind_mw -- Bind a memory window to a memory region.\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(*ci_bind_mw) (\r
+ IN const ib_mw_handle_t h_mw,\r
+ IN const ib_qp_handle_t h_qp,\r
+ IN ib_bind_wr_t* const p_mw_bind,\r
+ OUT net32_t* const p_rkey );\r
+/*\r
+* DESCRIPTION\r
+* This routine posts a request to bind a memory window to a registered\r
+* memory region. If the queue pair was created with selectable signaling,\r
+* once the operation is completed successfully then a completion queue entry\r
+* is generated indicating the bind operation has completed. The IB_POST_FENCE\r
+* option could be specified to cause the requestor to wait until outstanding\r
+* RDMA operations can be completed.\r
+* PARAMETERS\r
+* h_mw\r
+* [in] Handle to memory window that needs to be bound to a memory region.\r
+* h_qp\r
+* [in] Queue Pair to which this bind request is to be posted.\r
+* p_mw_bind\r
+* [in] Input parameters for this bind request, consisting of virtual\r
+* addr range of bind request etc.\r
+* p_rkey\r
+* [out] On successful completion, the new R_KEY is returned.\r
+* VPD is required to give this in the expected ordering on the wire. When\r
+* rkey's are exchanged between remote nodes, no swapping of this data\r
+* will be performed.\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The memory bind operation was posted successfully.\r
+* IB_INSUFFICIENT_RESOURCES\r
+* Insufficient resources to complete the request.\r
+* No more WQE's to post this request\r
+* No more free WQE's to post this request\r
+* IB_INVALID_MW_HANDLE\r
+* memw_handle supplied is an invalid memory window handle.\r
+* IB_INVALID_PERMISSION\r
+* Invalid access rights specified in request\r
+* IB_INVALID_SERVICE_TYPE\r
+* Invalid service type for this qp_handle.\r
+* IB_INVALID_PARAMETER\r
+* One of the pointers was not valid.\r
+* IB_INVALID_RKEY\r
+* R_KEY specified is invalid for the memory region being bound.\r
+* IB_INVALID_QP_HANDLE\r
+* h_qp supplied was an invalid QP handle.\r
+* NOTES\r
+* - A previously bound memory window can be bound to the same or different\r
+* memory region.\r
+*\r
+* - A bind operation with length of 0, invalidates any previous binding\r
+* and returns an R_KEY in the unbound state.\r
+* SEE ALSO\r
+* ci_create_mw\r
+******\r
+*/\r
+\r
+/****f* Verbs/ci_destroy_mw\r
+* NAME\r
+* ci_destroy_mw -- Destroy a memory window.\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(*ci_destroy_mw) (\r
+ IN const ib_mw_handle_t h_mw );\r
+/*\r
+* DESCRIPTION\r
+* This routine deallocates a window entry created via a ci_create_mw.\r
+* Once this operation is complete, the channel interface guarantees that\r
+* no future remote accesses will be permitted to this window entry.\r
+* PARAMETERS\r
+* h_mw\r
+* [in] Handle to the memory window that is being destroyed.\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The destroy window request completed successfully.\r
+* IB_INVALID_MW_HANDLE\r
+* memw_handle supplied is invalid.\r
+* NOTES\r
+* Deallocate memory window implicitly means the window is also unbound\r
+* once the call completes successfully. Any future remote access with\r
+* the same R_KEY should fail with protection violation.\r
+* SEE ALSO\r
+* ci_create_mw\r
+******\r
+*/\r
+\r
+/****f* Verbs/ci_post_send\r
+* NAME\r
+* ci_post_send -- Post a work request to the send side of a queue pair.\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(*ci_post_send) (\r
+ IN const ib_qp_handle_t h_qp,\r
+ IN ib_send_wr_t* const p_send_wr,\r
+ OUT ib_send_wr_t **pp_failed );\r
+/*\r
+* DESCRIPTION\r
+* This routine posts a work request to the send side of the queue pair.\r
+* The different types of work request that can be posted are explained in\r
+* the ib_wr_t structure. For exact details on ordering rules please consult\r
+* the Volume 1, of the InfiniBand Specifications. If there is more\r
+* outstanding requests posted that what the queue is configured for, an\r
+* immediate error is returned.\r
+* PARAMETERS\r
+* h_qp\r
+* [in] The queue pair to which this work request is being submitted.\r
+* p_send_wr\r
+* [in] A pointer to the head of the list that must be posted to the\r
+* Send Queue.\r
+* pp_failed\r
+* [out] A pointer to the head of the list that holds the failed WRs.\r
+* If all the entries provided are posted with the CI, then this parameter\r
+* would be set to NULL.\r
+* RETURN VALUE\r
+* Any unsuccessful status indicates the status of the first failed request.\r
+*\r
+* IB_SUCCESS\r
+* All the work requests are completed successfully\r
+* IB_INVALID_QP_HANDLE\r
+* The qp_handle supplied is invalid.\r
+* IB_INSUFFICIENT_RESOURCES\r
+* Insufficient resources to complete the request.\r
+* There are no more work elements in the channel interface to\r
+* process this request, and the total outstanding work request has\r
+* been exceeded.\r
+* IB_INVALID_WR_TYPE\r
+* The work request type was not valid.\r
+* IB_INVALID_QP_STATE\r
+* The queue pair is either in Reset, Init, RTR or Error state.\r
+* IB_INVALID_MAX_SGE\r
+* The work request has too many scatter gather elements than what the\r
+* QP is configured.\r
+* IB_UNSUPPORTED\r
+* Atomics or Reliable datagram request is not supported by this HCA.\r
+* IB_INVALID_ADDR_HANDLE\r
+* Address handle supplied in the work request is invalid.\r
+* NOTES\r
+* Please refer to Table 81 and Table 82 for allowed operation types\r
+* on different types of queue pairs, and the different modifiers\r
+* acceptable for the work request for different QP service types.\r
+* SEE ALSO\r
+* ci_post_recv, ci_poll_cq\r
+******\r
+*/\r
+\r
+/****f* Verbs/ci_post_srq_recv\r
+* NAME\r
+* ci_post_srq_recv -- Post a work request to the receive queue of a queue pair.\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(*ci_post_srq_recv) (\r
+ IN const ib_srq_handle_t h_srq,\r
+ IN ib_recv_wr_t* const p_recv_wr,\r
+ OUT ib_recv_wr_t **pp_failed );\r
+/*\r
+* DESCRIPTION\r
+* This routine allows to queue a work request to the receive side of a\r
+* shared queue pair. The work_req holds necessary data to satisfy an incoming\r
+* receive message. If an attempt is made to queue more work requests than\r
+* what is available, an error is returned.\r
+* PARAMETERS\r
+* h_srq\r
+* [in] Handle to the queue pair to which the receive work request is being\r
+* posted.\r
+* p_recv_wr\r
+* [in] Holds the WRs to be posted to the receive queue.\r
+* pp_failed\r
+* [out] If any entry could not be posted with the CI, then this points\r
+* to the first WR that completed unsuccessfully. If all entries are\r
+* posted, then this field is set to NULL on successful exit.\r
+* RETURN VALUE\r
+* Any unsuccessful status indicates the status of the first failed request.\r
+*\r
+* IB_SUCCESS\r
+* The work request was successfully queued to the receive side of the QP.\r
+* IB_INVALID_SRQ_HANDLE\r
+* srq_handle supplied is not valid.\r
+* IB_INSUFFICIENT_RESOURCES\r
+* The qp has exceeded its receive queue depth than what is has been\r
+* configured.\r
+* IB_INVALID_WR_TYPE\r
+* Invalid work request type found in the request.\r
+* SEE ALSO\r
+******\r
+*/\r
+\r
+\r
+\r
+/****f* Verbs/ci_post_recv\r
+* NAME\r
+* ci_post_recv -- Post a work request to the receive queue of a queue pair.\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(*ci_post_recv) (\r
+ IN const ib_qp_handle_t h_qp,\r
+ IN ib_recv_wr_t* const p_recv_wr,\r
+ OUT ib_recv_wr_t **pp_failed );\r
+/*\r
+* DESCRIPTION\r
+* This routine allows to queue a work request to the receive side of a\r
+* queue pair. The work_req holds necessary data to satisfy an incoming\r
+* receive message. If an attempt is made to queue more work requests than\r
+* what is available, an error is returned.\r
+* PARAMETERS\r
+* h_qp\r
+* [in] Handle to the queue pair to which the receive work request is being\r
+* posted.\r
+* p_recv_wr\r
+* [in] Holds the WRs to be posted to the receive queue.\r
+* pp_failed\r
+* [out] If any entry could not be posted with the CI, then this points\r
+* to the first WR that completed unsuccessfully. If all entries are\r
+* posted, then this field is set to NULL on successful exit.\r
+* RETURN VALUE\r
+* Any unsuccessful status indicates the status of the first failed request.\r
+*\r
+* IB_SUCCESS\r
+* The work request was successfully queued to the receive side of the QP.\r
+* IB_INVALID_QP_HANDLE\r
+* qp_handle supplied is not valid.\r
+* IB_INSUFFICIENT_RESOURCES\r
+* The qp has exceeded its receive queue depth than what is has been\r
+* configured.\r
+* IB_INVALID_WR_TYPE\r
+* Invalid work request type found in the request.\r
+* IB_INVALID_QP_STATE\r
+* QP was in reset or init state.\r
+* (TBD: there may be an errata that allows posting in init state)\r
+* SEE ALSO\r
+* ci_post_send, ci_poll_cq.\r
+******\r
+*/\r
+\r
+/****f* Verbs/ci_peek_cq\r
+* NAME\r
+* ci_peek_cq\r
+*\r
+* DESCRIPTION\r
+* Returns the number of entries currently on the completion queue.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef ib_api_status_t\r
+(*ci_peek_cq) (\r
+ IN const ib_cq_handle_t h_cq,\r
+ OUT uint32_t* const p_n_cqes );\r
+/*\r
+* PARAMETERS\r
+* h_cq\r
+* [in] Handle to the completion queue to peek.\r
+*\r
+* p_n_cqes\r
+* [out] The number of completion entries on the CQ.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The peek operation completed successfully.\r
+* IB_INVALID_CQ_HANDLE\r
+* The completion queue handle was invalid.\r
+* IB_INVALID_PARAMETER\r
+* A reference to the completion queue entry count was not provided.\r
+* IB_UNSUPPORTED\r
+* This operation is not supported by the channel adapter.\r
+*\r
+* NOTES\r
+* The value returned is a snapshot of the number of compleiton queue\r
+* entries curently on the completion queue. Support for this operation\r
+* is optional by a channel adapter vendor.\r
+*\r
+* SEE ALSO\r
+* ci_create_cq, ci_poll_cq, ci_enable_cq_notify, ci_enable_ncomp_cq_notify\r
+*****/\r
+\r
+/****f* Verbs/ci_poll_cq\r
+* NAME\r
+* ci_poll_cq -- Retrieve a work completion record from a completion queue\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(*ci_poll_cq) (\r
+ IN const ib_cq_handle_t h_cq,\r
+ IN OUT ib_wc_t** const pp_free_wclist,\r
+ OUT ib_wc_t** const pp_done_wclist );\r
+/*\r
+* DESCRIPTION\r
+* This routine retrieves a work completion entry from the specified\r
+* completion queue. The contents of the data returned in a work completion\r
+* is specified in ib_wc_t.\r
+* PARAMETERS\r
+* h_cq\r
+* [in] Handle to the completion queue being polled.\r
+* pp_free_wclist\r
+* [in out] A list of work request structures provided by the consumer\r
+* for the channel interface to return completed Completion Queue\r
+* entries. If not all the entries are consumed, this list holds the\r
+* list of un-utilized completion entries provided back to the consumer.\r
+* pp_done_wclist\r
+* [out] A list of work completions retrieved from the completion queue\r
+* and successfully processed.\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* Poll completed successfully and found one or more entries. If on\r
+* completion the pp_free_wclist is empty, then there are potentially more\r
+* entries and the consumer must continue to retrieve entries.\r
+* IB_INVALID_CQ_HANDLE\r
+* The cq_handle supplied is not valid.\r
+* IB_NOT_FOUND\r
+* There were no completion entries found in the specified CQ.\r
+* SEE ALSO\r
+* ci_create_cq, ci_post_send, ci_post_recv, ci_bind_mw\r
+******\r
+*/\r
+\r
+/****f* Verbs/ci_enable_cq_notify\r
+* NAME\r
+* ci_enable_cq_notify -- Invoke the Completion handler, on next entry added.\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(*ci_enable_cq_notify) (\r
+ IN const ib_cq_handle_t h_cq,\r
+ IN const boolean_t solicited );\r
+/*\r
+* DESCRIPTION\r
+* This routine instructs the channel interface to invoke the completion\r
+* handler when the next completion queue entry is added to this CQ.\r
+* Please refer to Volume 1, of the InfiniBand specification for a complete\r
+* description.\r
+* PARAMETERS\r
+* h_cq\r
+* [in] Handle to the CQ on which the notification is being enabled.\r
+* solicited\r
+* [in] A boolean flag indicating whether the request is to generate a\r
+* notification on the next entry or on the next solicited entry\r
+* being added to the completion queue.\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The notification request was registered successfully.\r
+* IB_INVALID_CQ_HANDLE\r
+* cq_handle supplied is not a valid handle.\r
+* NOTES\r
+* The consumer cannot call a request for notification without emptying\r
+* entries from the CQ. i.e if a consumer registers for a notification\r
+* request in the completion callback before pulling entries from the\r
+* CQ via ci_poll_cq, the notification is not generated for completions\r
+* already in the CQ. For e.g. in the example below, if there are no calls\r
+* to ci_poll_cq() after the ci_enable_cq_notify(). For any CQ entries added\r
+* before calling this ci_enable_cq_notify() call, the consumer does not\r
+* get a completion notification callback. In order to comply with the verb\r
+* spec, consumer is supposed to perform a ci_poll_cq() after the\r
+* ci_enable_cq_notify() is made to retrive any entries that might have\r
+* been added to the CQ before the CI registers the notification enable.\r
+*\r
+* while ((ret_val = ci_poll_cq(cq_handle, &free_list, &done_list)\r
+* == FSUCCESS))\r
+* {\r
+* process entries;\r
+* }\r
+* if (ret_val == IB_NOT_FOUND)\r
+* ci_enable_cq_notify(cq_handle);\r
+* // Need to perform a ci_poll_cq()\r
+* // after the enable.\r
+* SEE ALSO\r
+* ci_create_cq, ci_peek_cq, ci_poll_cq, ci_enable_ncomp_cq_notify\r
+******\r
+*/\r
+\r
+/****f* Verbs/ci_enable_ncomp_cq_notify\r
+* NAME\r
+* ci_enable_ncomp_cq_notify -- Invoke the Completion handler when the next\r
+* N completions are added.\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(*ci_enable_ncomp_cq_notify) (\r
+ IN const ib_cq_handle_t h_cq,\r
+ IN const uint32_t n_cqes );\r
+/*\r
+* DESCRIPTION\r
+* This routine instructs the channel interface to invoke the completion\r
+* handler when the next N completions have been added to this CQ.\r
+* PARAMETERS\r
+* h_cq\r
+* [in] Handle to the CQ on which the notification is being enabled.\r
+* n_cqes\r
+* [in] The number of completion queue entries to be added to the\r
+* completion queue before notifying the client. This value must\r
+* greater than or equal to one and less than or equal to the size\r
+* of the completion queue.\r
+*\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The notification request was registered successfully.\r
+* IB_INVALID_CQ_HANDLE\r
+* cq_handle supplied is not a valid handle.\r
+* IB_INVALID_PARAMETER\r
+* The requested number of completion queue entries was invalid.\r
+* IB_UNSUPPORTED\r
+* This operation is not supported by the channel adapter.\r
+*\r
+* NOTES\r
+* This routine instructs the channel interface to invoke the completion\r
+* handler when the next N completions have been added to this CQ regardless\r
+* of the completion type (solicited or unsolicited). Any CQ entries that\r
+* existed before the rearm is enabled will not result in a call to the\r
+* handler. Support for this operation is optional by a channel adapter\r
+* vendor.\r
+*\r
+* SEE ALSO\r
+* ci_create_cq, ci_peek_cq, ci_poll_cq, ci_enable_cq_notify\r
+******\r
+*/\r
+\r
+/****f* Verbs/ci_attach_mcast\r
+* NAME\r
+* ci_attach_mcast -- Attach a queue pair to a multicast group\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(*ci_attach_mcast) (\r
+ IN const ib_qp_handle_t h_qp,\r
+ IN const ib_gid_t *p_mcast_gid,\r
+ IN const ib_net16_t mcast_lid,\r
+ OUT ib_mcast_handle_t *ph_mcast,\r
+ IN OUT ci_umv_buf_t *p_umv_buf OPTIONAL );\r
+/*\r
+* DESCRIPTION\r
+* This routine attaches the given qp_handle to a multicast gid as specified\r
+* by mcast_gid parameter.\r
+* PARAMETERS\r
+* h_qp\r
+* [in] Queue pair handle which needs to be added to the multicast group\r
+* on the adapter.\r
+* mcast_lid\r
+* [in] The multicast group LID value.\r
+* p_mcast_gid\r
+* [in] IPv6 address associated with this multicast group.\r
+* ph_mcast\r
+* [out] Multicast handle holding the association of this queue pair\r
+* to the multicast group.\r
+* p_umv_buf\r
+* [in out] Vendor specific parameter to support user mode IO.\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The queue pair handle was successfully added to the multicast\r
+* group.\r
+* IB_INVALID_QP_HANDLE\r
+* qp_handle supplied is invalid.\r
+* IB_INVALID_SERVICE_TYPE\r
+* Queue pair handle supplied is not of unreliable datagram type.\r
+* IB_INVALID_GID\r
+* The supplied addr is not a valid multicast ipv6 address.\r
+* IB_INVALID_LID\r
+* The supplied lid is not a valid multicast lid.\r
+* IB_UNSUPPORTED\r
+* Multicast is not supported by this HCA.\r
+* IB_INSUFFICIENT_RESOURCES\r
+* Insufficient resources to complete request.\r
+* IB_INVALID_PARAMETER\r
+* One of the parameters was NULL.\r
+* SEE ALSO\r
+* ci_create_qp, ci_detach_mcast\r
+******\r
+*/\r
+\r
+\r
+/****f* Verbs/ci_detach_mcast\r
+* NAME\r
+* ci_detach_mcast -- Detach a queue pair from a multicast group\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(*ci_detach_mcast) (\r
+ IN const ib_mcast_handle_t h_mcast );\r
+/*\r
+* DESCRIPTION\r
+* This routine detaches a queue pair from its previously associated multicast\r
+* group.\r
+* PARAMETERS\r
+* h_mcast\r
+* [in] The multicast handle passed back to consumer after the\r
+* ci_mcast_attach call.\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The qp was successfully detached from the multicast group.\r
+* IB_INVALID_MCAST_HANDLE\r
+* mcast_handle supplied is an invalid handle\r
+* IB_INVALID_PARAMETER\r
+* One of the parameters was NULL.\r
+* SEE ALSO\r
+* ci_attach_mcast\r
+******\r
+*/\r
+\r
+/****f* Verbs/ci_local_mad\r
+* NAME\r
+* ci_local_mad -- Request a mad to be processed by the local adapter.\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(*ci_local_mad) (\r
+ IN const ib_ca_handle_t h_ca,\r
+ IN const uint8_t port_num,\r
+ IN const ib_av_attr_t *p_src_av_attr,\r
+ IN const ib_mad_t *p_mad_in,\r
+ OUT ib_mad_t *p_mad_out );\r
+/*\r
+* DESCRIPTION\r
+* This routine is OPTIONAL for the channel interface. This is required\r
+* for adapters which do not have the agents such as Subnet Management\r
+* agent (SMA) Or the GSA in the Verbs Provider driver.\r
+* hardware, for all such adapters the exact queue pair management of\r
+* special queue pairs happen above the channel interface. This routine\r
+* is used to perform local operations, since there is no agent below the\r
+* channel interface. For e.g: If a Subnet Management packet (SMP) to\r
+* set PORT_STATE is received, this reception is processed above the channel\r
+* interface, then this call is done to set the port state on the local\r
+* adapter. On successful return, the response is generated and sent to the\r
+* Subnet Manager.\r
+* PARAMETERS\r
+* h_ca\r
+* [in] A handle to the channel adapter that should process the MAD.\r
+* This must be the same adapter that the MAD was received on.\r
+* port_num\r
+* [in] port number to which this request is directed is to be sent.\r
+* p_mad_in\r
+* [in] pointer to a management datagram (MAD) structure containing\r
+* the command to be processed.\r
+* p_mad_out\r
+* [out] Response packet after processing the command. The storage to this\r
+* must be allocated by the consumer.\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* Command processed successfully.\r
+* IB_INVALID_CA_HANDLE\r
+* The HCA handle supplied is not valid.\r
+* IB_INVALID_PORT\r
+* The port number supplied is invalid.\r
+* PORTABILITY\r
+* Kernel Mode only\r
+* NOTES\r
+* This call is provided to aid adapters that don't have a agent functionality\r
+* built in the channel interface. Some adapters do have a local processor\r
+* to process these packets, hence even for local port management, we can\r
+* use the same mechanism we use to configure external nodes by using a\r
+* hop counter = 1 in the MAD packets. If the SMA indicates it has a local\r
+* sma in the ib_ca_attr_t, then the packets are posted to the adapter\r
+* instead of making a private call to the adapter.\r
+* SEE ALSO\r
+* ci_query_ca, ci_ca_attr_t\r
+******\r
+*/\r
+\r
+\r
+/****f* Verbs/ci_vendor_call\r
+* NAME\r
+* ci_vendor_call\r
+*\r
+* DESCRIPTION\r
+* Performs a vendor specific CA interface function call.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef ib_api_status_t\r
+(*ci_vendor_call)(\r
+ IN const ib_ca_handle_t h_ca,\r
+ IN const void* __ptr64* const handle_array OPTIONAL,\r
+ IN uint32_t num_handles,\r
+ IN ib_ci_op_t* const p_ci_op,\r
+ IN OUT ci_umv_buf_t *p_umv_buf OPTIONAL );\r
+/*\r
+* PARAMETERS\r
+* h_ca\r
+* [in] A handle to an opened CA.\r
+*\r
+* handle_array\r
+* [in] This parameter references an array containing handles of\r
+* existing CA resources. This array should contain all of the\r
+* handles specified in the vendor specific data provided with this\r
+* call. All handles specified through this array are validated by\r
+* the verbs provider driver to ensure that the number and type of\r
+* handles are correct for the requested operation.\r
+*\r
+* num_handles\r
+* [in] The number of the handles in handle array. This count is\r
+* verified by the access layer.\r
+*\r
+* p_ci_op\r
+* [in] A reference to the vendor specific CA interface data\r
+* structure containing the operation parameters.\r
+*\r
+* p_umv_buf\r
+* [in out] Vendor specific parameter to support user mode IO.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The operation was successful.\r
+*\r
+* IB_INVALID_CA_HANDLE\r
+* The CA handle was invalid.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the vendor specific data was not provided.\r
+*\r
+* IB_INVALID_HANDLE\r
+* A handle specified in the handle array was invalid.\r
+*\r
+* IB_INSUFFICIENT_MEMORY\r
+* There was insufficient memory to perform the operation.\r
+*\r
+* IB_ERROR\r
+* An error occurred while processing the command. Additional\r
+* error information is provided in the p_ci_op status field.\r
+*\r
+* NOTES\r
+* This routine performs a vendor specific CA interface function call.\r
+* The p_ci_op structure provides a means to pass vendor specific data to\r
+* the verbs provider driver. If the vendor specific data contains handles,\r
+* the client should provide the optional handle array that lists all of\r
+* all of the handles specified in the vendor specific data. The handles\r
+* in the handle array are restricted to the following types: ib_ca_handle_t,\r
+* ib_pd_handle_t, ib_cq_handle_t, ib_av_handle_t, ib_qp_handle_t,\r
+* ib_mr_handle_t, or ib_mw_handle_t\r
+* The contents of the handle array are verified by the\r
+* access layer and the verbs provider driver.\r
+*\r
+* SEE ALSO\r
+* ci_open_ca, ci_allocate_pd, ci_create_av, ci_create_cq,\r
+* ci_create_qp, ci_register_mr, ci_register_pmr,\r
+* ci_register_smr, ci_create_mw, ib_ci_op_t\r
+*****/\r
+\r
+\r
+#define MAX_LIB_NAME 32\r
+\r
+#ifdef CL_KERNEL\r
+\r
+/****s* Verbs/ci_interface_t\r
+* NAME\r
+* ci_interface_t -- Interface holding Channel Interface API's\r
+* PURPOSE\r
+* The following structure is supplied by a Channel Interface\r
+* providing verbs functionality.\r
+* SOURCE\r
+*/\r
+\r
+typedef struct _ci_interface\r
+{\r
+ net64_t guid;\r
+\r
+ /*\r
+ * Device object of the HCA. In Windows, this is a pointer to the PDO\r
+ * for the HCA device.\r
+ */\r
+ void *p_hca_dev;\r
+\r
+ /*\r
+ * Vendor ID, Device ID, Device Revision of the HCA\r
+ * libname refers to the user mode library to load\r
+ * to support direct user mode IO. If vendor does not support one\r
+ * then the fields must be initialized to all zero's.\r
+ */\r
+ uint32_t vend_id;\r
+ uint16_t dev_id;\r
+ uint16_t dev_revision;\r
+ char libname[MAX_LIB_NAME];\r
+ /*\r
+ * Version of the header file this interface export can handle\r
+ */\r
+ uint32_t version;\r
+\r
+ /*\r
+ * HCA Access Verbs\r
+ */\r
+ ci_open_ca open_ca;\r
+ ci_um_open_ca_t um_open_ca;\r
+ ci_query_ca query_ca;\r
+ ci_modify_ca modify_ca;\r
+ ci_close_ca close_ca;\r
+ ci_um_close_ca_t um_close_ca;\r
+\r
+ ci_vendor_call vendor_call;\r
+\r
+ /*\r
+ * Protection Domain\r
+ */\r
+ ci_allocate_pd allocate_pd;\r
+ ci_deallocate_pd deallocate_pd;\r
+\r
+ /*\r
+ * Address Vector Management Verbs\r
+ */\r
+\r
+ ci_create_av create_av;\r
+ ci_query_av query_av;\r
+ ci_modify_av modify_av;\r
+ ci_destroy_av destroy_av;\r
+\r
+ /*\r
+ * SRQ Management Verbs\r
+ */\r
+ ci_create_srq create_srq;\r
+ ci_modify_srq modify_srq;\r
+ ci_query_srq query_srq;\r
+ ci_destroy_srq destroy_srq;\r
+\r
+ /*\r
+ * QP Management Verbs\r
+ */\r
+ ci_create_qp create_qp;\r
+ ci_create_spl_qp create_spl_qp;\r
+ ci_modify_qp modify_qp;\r
+ ci_query_qp query_qp;\r
+ ci_destroy_qp destroy_qp;\r
+ ci_ndi_modify_qp ndi_modify_qp;\r
+\r
+ /*\r
+ * Completion Queue Management Verbs\r
+ */\r
+ ci_create_cq create_cq;\r
+ ci_resize_cq resize_cq;\r
+ ci_query_cq query_cq;\r
+ ci_destroy_cq destroy_cq;\r
+\r
+ /*\r
+ * Memory Management Verbs\r
+ */\r
+ ci_register_mr register_mr;\r
+ ci_register_pmr register_pmr;\r
+ ci_query_mr query_mr;\r
+ ci_modify_mr modify_mr;\r
+ ci_modify_pmr modify_pmr;\r
+ ci_register_smr register_smr;\r
+ ci_deregister_mr deregister_mr;\r
+\r
+ /*\r
+ * Mellanox Fast Memory Management Verbs\r
+ */\r
+ ci_alloc_mlnx_fmr alloc_mlnx_fmr;\r
+ ci_map_phys_mlnx_fmr map_phys_mlnx_fmr;\r
+ ci_unmap_mlnx_fmr unmap_mlnx_fmr;\r
+ ci_dealloc_mlnx_fmr dealloc_mlnx_fmr;\r
+\r
+\r
+ /*\r
+ * Memory Window Verbs\r
+ */\r
+ ci_create_mw create_mw;\r
+ ci_query_mw query_mw;\r
+ ci_bind_mw bind_mw;\r
+ ci_destroy_mw destroy_mw;\r
+\r
+ /*\r
+ * Work Request Processing Verbs\r
+ */\r
+ ci_post_send post_send;\r
+ ci_post_recv post_recv;\r
+ ci_post_srq_recv post_srq_recv;\r
+\r
+ /*\r
+ * Completion Processing and\r
+ * Completion Notification Request Verbs.\r
+ */\r
+ ci_peek_cq peek_cq; /* Optional */\r
+ ci_poll_cq poll_cq;\r
+ ci_enable_cq_notify enable_cq_notify;\r
+ ci_enable_ncomp_cq_notify enable_ncomp_cq_notify; /* Optional */\r
+\r
+ /*\r
+ * Multicast Support Verbs\r
+ */\r
+ ci_attach_mcast attach_mcast;\r
+ ci_detach_mcast detach_mcast;\r
+\r
+ /*\r
+ * Local MAD support, for HCA's that do not support\r
+ * Agents in the HW.\r
+ */\r
+ ci_local_mad local_mad;\r
+\r
+} ci_interface_t;\r
+/********/\r
+\r
+\r
+/****f* Verbs/ib_register_ca\r
+* NAME\r
+* ib_register_ca -- Inform the IB Access Layer about a new HCA\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t\r
+ib_register_ca (\r
+ IN const ci_interface_t *p_ci );\r
+/*\r
+* DESCRIPTION\r
+* This routine is called by a HCA kernel mode driver to inform the\r
+* IB Access Layer about a new HCA that is ready for use. It is expected\r
+* that the Access Layer could immediatly turn around and call for services\r
+* even before the call returns back the HCA driver code. The HCA driver\r
+* must initialize all resources and be ready to service any calls before adding\r
+* its services to the IB Access Layer.\r
+*\r
+* PARAMETERS\r
+* p_ci\r
+* [in] Pointer to the ci_interface_t structure that has the function\r
+* vector to support verbs functionality.\r
+*\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The registration is successful.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the CI interface structure was not provided.\r
+*\r
+* IB_INSUFFICIENT_RESOURCES\r
+* Insufficient memory to satisfy resource requirements.\r
+*\r
+* IB_DUPLICATE_CA\r
+* HCA GUID is already registered with the IB Access Layer\r
+*\r
+* PORTABILITY\r
+* Kernel Mode only\r
+*\r
+* SEE ALSO\r
+* ib_deregister_ca, ci_interface_t\r
+*******/\r
+\r
+/****f* Verbs/ib_deregister_ca\r
+* NAME\r
+* ib_deregister_ca -- Inform the IB Access Layer that this HCA is no longer available\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_api_status_t\r
+ib_deregister_ca (\r
+ IN const net64_t ca_guid );\r
+/*\r
+* DESCRIPTION\r
+* This routine is called by the HCA driver when this HCA would no longer be\r
+* available for services. The access layer is expected to return all resources\r
+* back to the HCA driver, and perform a ci_close_ca on this interface.\r
+*\r
+* PARAMETERS\r
+* ca_guid\r
+* [in] GUID of the HCA that is being removed.\r
+*\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The deregistration is successful.\r
+*\r
+* IB_NOT_FOUND\r
+* No HCA with the specified GUID is registered.\r
+*\r
+* IB_BUSY\r
+* The HCA is still in use and cannot be released.\r
+*\r
+* PORTABILITY\r
+* Kernel Mode only\r
+*\r
+* SEE ALSO\r
+* ib_register_ca, ci_interface_t\r
+*******/\r
+\r
+#endif /* CL_KERNEL */\r
+\r
+\r
+#ifdef __cplusplus\r
+} /* extern "C" */\r
+#endif /* __cplusplus */\r
+\r
+#endif // __IB_CI_H__\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved.\r
+ * Copyright (c) 2002-2006 Mellanox Technologies LTD. All rights reserved.\r
+ * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. \r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+#if !defined(__IB_TYPES_H__)\r
+#define __IB_TYPES_H__\r
+\r
+#include <complib/cl_types.h>\r
+#include <complib/cl_byteswap.h>\r
+\r
+#ifdef CL_KERNEL\r
+ #define AL_EXPORT\r
+ #define AL_API\r
+ #define AL_INLINE static inline\r
+#else\r
+ #if defined( EXPORT_AL_SYMBOLS )\r
+ #define AL_EXPORT __declspec(dllexport)\r
+ #else\r
+ #define AL_EXPORT __declspec(dllimport)\r
+ #endif\r
+ #define AL_API __stdcall\r
+ #define AL_INLINE AL_EXPORT inline\r
+#endif /* CL_KERNEL */\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif /* __cplusplus */\r
+\r
+\r
+/****h* IBA Base/Constants\r
+* NAME\r
+* Constants\r
+*\r
+* DESCRIPTION\r
+* The following constants are used throughout the IBA code base.\r
+*\r
+* Definitions are from the InfiniBand Architecture Specification v1.2\r
+*\r
+*********/\r
+\r
+/****d* IBA Base: Constants/MAD_BLOCK_SIZE\r
+* NAME\r
+* MAD_BLOCK_SIZE\r
+*\r
+* DESCRIPTION\r
+* Size of a non-RMPP MAD datagram.\r
+*\r
+* SOURCE\r
+*/\r
+#define MAD_BLOCK_SIZE 256\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/MAD_RMPP_HDR_SIZE\r
+* NAME\r
+* MAD_RMPP_HDR_SIZE\r
+*\r
+* DESCRIPTION\r
+* Size of an RMPP header, including the common MAD header.\r
+*\r
+* SOURCE\r
+*/\r
+#define MAD_RMPP_HDR_SIZE 36\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/MAD_RMPP_DATA_SIZE\r
+* NAME\r
+* MAD_RMPP_DATA_SIZE\r
+*\r
+* DESCRIPTION\r
+* Size of an RMPP transaction data section.\r
+*\r
+* SOURCE\r
+*/\r
+#define MAD_RMPP_DATA_SIZE (MAD_BLOCK_SIZE - MAD_RMPP_HDR_SIZE)\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/MAD_BLOCK_GRH_SIZE\r
+* NAME\r
+* MAD_BLOCK_GRH_SIZE\r
+*\r
+* DESCRIPTION\r
+* Size of a MAD datagram, including the GRH.\r
+*\r
+* SOURCE\r
+*/\r
+#define MAD_BLOCK_GRH_SIZE 296\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_LID_PERMISSIVE\r
+* NAME\r
+* IB_LID_PERMISSIVE\r
+*\r
+* DESCRIPTION\r
+* Permissive LID\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_LID_PERMISSIVE 0xFFFF\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_DEFAULT_PKEY\r
+* NAME\r
+* IB_DEFAULT_PKEY\r
+*\r
+* DESCRIPTION\r
+* P_Key value for the default partition.\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_DEFAULT_PKEY 0xFFFF\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_QP1_WELL_KNOWN_Q_KEY\r
+* NAME\r
+* IB_QP1_WELL_KNOWN_Q_KEY\r
+*\r
+* DESCRIPTION\r
+* Well-known Q_Key for QP1 privileged mode access (15.4.2).\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_QP1_WELL_KNOWN_Q_KEY CL_NTOH32(0x80010000)\r
+/*********/\r
+\r
+#define IB_QP0 0\r
+#define IB_QP1 CL_NTOH32(1)\r
+\r
+#define IB_QP_PRIVILEGED_Q_KEY CL_NTOH32(0x80000000)\r
+\r
+/****d* IBA Base: Constants/IB_LID_UCAST_START\r
+* NAME\r
+* IB_LID_UCAST_START\r
+*\r
+* DESCRIPTION\r
+* Lowest valid unicast LID value.\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_LID_UCAST_START_HO 0x0001\r
+#define IB_LID_UCAST_START (CL_HTON16(IB_LID_UCAST_START_HO))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_LID_UCAST_END\r
+* NAME\r
+* IB_LID_UCAST_END\r
+*\r
+* DESCRIPTION\r
+* Highest valid unicast LID value.\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_LID_UCAST_END_HO 0xBFFF\r
+#define IB_LID_UCAST_END (CL_HTON16(IB_LID_UCAST_END_HO))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_LID_MCAST_START\r
+* NAME\r
+* IB_LID_MCAST_START\r
+*\r
+* DESCRIPTION\r
+* Lowest valid multicast LID value.\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_LID_MCAST_START_HO 0xC000\r
+#define IB_LID_MCAST_START (CL_HTON16(IB_LID_MCAST_START_HO))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_LID_MCAST_END\r
+* NAME\r
+* IB_LID_MCAST_END\r
+*\r
+* DESCRIPTION\r
+* Highest valid multicast LID value.\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_LID_MCAST_END_HO 0xFFFE\r
+#define IB_LID_MCAST_END (CL_HTON16(IB_LID_MCAST_END_HO))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_DEFAULT_SUBNET_PREFIX\r
+* NAME\r
+* IB_DEFAULT_SUBNET_PREFIX\r
+*\r
+* DESCRIPTION\r
+* Default subnet GID prefix.\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_DEFAULT_SUBNET_PREFIX (CL_HTON64(0xFE80000000000000ULL))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_NODE_NUM_PORTS_MAX\r
+* NAME\r
+* IB_NODE_NUM_PORTS_MAX\r
+*\r
+* DESCRIPTION\r
+* Maximum number of ports in a single node (14.2.5.7).\r
+* SOURCE\r
+*/\r
+#define IB_NODE_NUM_PORTS_MAX 0xFE\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_INVALID_PORT_NUM\r
+* NAME\r
+* IB_INVALID_PORT_NUM\r
+*\r
+* DESCRIPTION\r
+* Value used to indicate an invalid port number (14.2.5.10).\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_INVALID_PORT_NUM 0xFF\r
+/*********/\r
+\r
+/****d* IBA Base: Constants/IB_SUBNET_PATH_HOPS_MAX\r
+* NAME\r
+* IB_SUBNET_PATH_HOPS_MAX\r
+*\r
+* DESCRIPTION\r
+* Maximum number of directed route switch hops in a subnet (14.2.1.2).\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_SUBNET_PATH_HOPS_MAX 64\r
+/*********/\r
+\r
+/****d* IBA Base: Constants/IB_PKEY_MAX_BLOCKS\r
+* NAME\r
+* IB_PKEY_MAX_BLOCKS\r
+*\r
+* DESCRIPTION\r
+* Maximum number of PKEY blocks (14.2.5.7).\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_PKEY_MAX_BLOCKS 2048\r
+/*********/\r
+\r
+/****d* IBA Base: Constants/IB_MCAST_MAX_BLOCK_ID\r
+* NAME\r
+* IB_MCAST_MAX_BLOCK_ID\r
+*\r
+* DESCRIPTION\r
+* Maximum number of Multicast port mask blocks\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MCAST_MAX_BLOCK_ID 511\r
+/*********/\r
+\r
+/****d* IBA Base: Constants/IB_MCAST_BLOCK_ID_MASK_HO\r
+* NAME\r
+* IB_MCAST_BLOCK_ID_MASK_HO\r
+*\r
+* DESCRIPTION\r
+* Mask (host order) to recover the Multicast block ID.\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MCAST_BLOCK_ID_MASK_HO 0x000001FF\r
+/*********/\r
+\r
+/****d* IBA Base: Constants/IB_MCAST_BLOCK_SIZE\r
+* NAME\r
+* IB_MCAST_BLOCK_SIZE\r
+*\r
+* DESCRIPTION\r
+* Number of port mask entries in a multicast forwarding table block.\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MCAST_BLOCK_SIZE 32\r
+/*********/\r
+\r
+/****d* IBA Base: Constants/IB_MCAST_MASK_SIZE\r
+* NAME\r
+* IB_MCAST_MASK_SIZE\r
+*\r
+* DESCRIPTION\r
+* Number of port mask bits in each entry in the multicast forwarding table.\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MCAST_MASK_SIZE 16\r
+/*********/\r
+\r
+/****d* IBA Base: Constants/IB_MCAST_POSITION_MASK_HO\r
+* NAME\r
+* IB_MCAST_POSITION_MASK_HO\r
+*\r
+* DESCRIPTION\r
+* Mask (host order) to recover the multicast block position.\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MCAST_POSITION_MASK_HO 0xF0000000\r
+/*********/\r
+\r
+/****d* IBA Base: Constants/IB_MCAST_POSITION_MAX\r
+* NAME\r
+* IB_MCAST_POSITION_MAX\r
+*\r
+* DESCRIPTION\r
+* Maximum value for the multicast block position.\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MCAST_POSITION_MAX 0xF\r
+/*********/\r
+\r
+/****d* IBA Base: Constants/IB_MCAST_POSITION_SHIFT\r
+* NAME\r
+* IB_MCAST_POSITION_SHIFT\r
+*\r
+* DESCRIPTION\r
+* Shift value to normalize the multicast block position value.\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MCAST_POSITION_SHIFT 28\r
+/*********/\r
+\r
+/****d* IBA Base: Constants/IB_PKEY_ENTRIES_MAX\r
+* NAME\r
+* IB_PKEY_ENTRIES_MAX\r
+*\r
+* DESCRIPTION\r
+* Maximum number of PKEY entries per port (14.2.5.7).\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_PKEY_ENTRIES_MAX (IB_PKEY_MAX_BLOCKS * IB_PKEY_BLOCK_SIZE)\r
+/*********/\r
+\r
+/****d* IBA Base: Constants/IB_PKEY_BASE_MASK\r
+* NAME\r
+* IB_PKEY_BASE_MASK\r
+*\r
+* DESCRIPTION\r
+* Masks for the base P_Key value given a P_Key Entry.\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_PKEY_BASE_MASK (CL_HTON16(0x7FFF))\r
+/*********/\r
+\r
+/****d* IBA Base: Constants/IB_PKEY_TYPE_MASK\r
+* NAME\r
+* IB_PKEY_TYPE_MASK\r
+*\r
+* DESCRIPTION\r
+* Masks for the P_Key membership type given a P_Key Entry.\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_PKEY_TYPE_MASK (CL_NTOH16(0x8000))\r
+/*********/\r
+\r
+/****d* IBA Base: Constants/IB_DEFAULT_PARTIAL_PKEY\r
+* NAME\r
+* IB_DEFAULT_PARTIAL_PKEY \r
+*\r
+* DESCRIPTION\r
+* 0x7FFF in network order\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_DEFAULT_PARTIAL_PKEY (CL_HTON16(0x7FFF))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MCLASS_SUBN_LID\r
+* NAME\r
+* IB_MCLASS_SUBN_LID\r
+*\r
+* DESCRIPTION\r
+* Subnet Management Class, Subnet Manager LID routed (13.4.4)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MCLASS_SUBN_LID 0x01\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MCLASS_SUBN_DIR\r
+* NAME\r
+* IB_MCLASS_SUBN_DIR\r
+*\r
+* DESCRIPTION\r
+* Subnet Management Class, Subnet Manager directed route (13.4.4)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MCLASS_SUBN_DIR 0x81\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MCLASS_SUBN_ADM\r
+* NAME\r
+* IB_MCLASS_SUBN_ADM\r
+*\r
+* DESCRIPTION\r
+* Subnet Management Class, Subnet Administration (13.4.4)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MCLASS_SUBN_ADM 0x03\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MCLASS_PERF\r
+* NAME\r
+* IB_MCLASS_PERF\r
+*\r
+* DESCRIPTION\r
+* Subnet Management Class, Performance Manager (13.4.4)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MCLASS_PERF 0x04\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MCLASS_BM\r
+* NAME\r
+* IB_MCLASS_BM\r
+*\r
+* DESCRIPTION\r
+* Subnet Management Class, Baseboard Manager (13.4.4)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MCLASS_BM 0x05\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MCLASS_DEV_MGMT\r
+* NAME\r
+* IB_MCLASS_DEV_MGMT\r
+*\r
+* DESCRIPTION\r
+* Subnet Management Class, Device Management (13.4.4)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MCLASS_DEV_MGMT 0x06\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MCLASS_COMM_MGMT\r
+* NAME\r
+* IB_MCLASS_COMM_MGMT\r
+*\r
+* DESCRIPTION\r
+* Subnet Management Class, Communication Management (13.4.4)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MCLASS_COMM_MGMT 0x07\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MCLASS_SNMP\r
+* NAME\r
+* IB_MCLASS_SNMP\r
+*\r
+* DESCRIPTION\r
+* Subnet Management Class, SNMP Tunneling (13.4.4)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MCLASS_SNMP 0x08\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MCLASS_VENDOR_LOW_RANGE_MIN\r
+* NAME\r
+* IB_MCLASS_VENDOR_LOW_RANGE_MIN\r
+*\r
+* DESCRIPTION\r
+* Subnet Management Class, Vendor Specific Low Range Start\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MCLASS_VENDOR_LOW_RANGE_MIN 0x09\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MCLASS_VENDOR_LOW_RANGE_MAX\r
+* NAME\r
+* IB_MCLASS_VENDOR_LOW_RANGE_MAX\r
+*\r
+* DESCRIPTION\r
+* Subnet Management Class, Vendor Specific Low Range End\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MCLASS_VENDOR_LOW_RANGE_MAX 0x0f\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MCLASS_DEV_ADM\r
+* NAME\r
+* IB_MCLASS_DEV_ADM\r
+*\r
+* DESCRIPTION\r
+* Subnet Management Class, Device Administration\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MCLASS_DEV_ADM 0x10\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MCLASS_BIS\r
+* NAME\r
+* IB_MCLASS_BIS\r
+*\r
+* DESCRIPTION\r
+* Subnet Management Class, BIS\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MCLASS_BIS 0x12\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MCLASS_VENDOR_HIGH_RANGE_MIN\r
+* NAME\r
+* IB_MCLASS_VENDOR_HIGH_RANGE_MIN\r
+*\r
+* DESCRIPTION\r
+* Subnet Management Class, Vendor Specific High Range Start\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MCLASS_VENDOR_HIGH_RANGE_MIN 0x30\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MCLASS_VENDOR_HIGH_RANGE_MAX\r
+* NAME\r
+* IB_MCLASS_VENDOR_HIGH_RANGE_MAX\r
+*\r
+* DESCRIPTION\r
+* Subnet Management Class, Vendor Specific High Range End\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MCLASS_VENDOR_HIGH_RANGE_MAX 0x4f\r
+/**********/\r
+\r
+/****f* IBA Base: Types/ib_class_is_vendor_specific_low\r
+* NAME\r
+* ib_class_is_vendor_specific_low\r
+*\r
+* DESCRIPTION\r
+* Indicates if the Class Code if a vendor specific class from \r
+* the low range\r
+*\r
+* SYNOPSIS\r
+*/\r
+static inline boolean_t\r
+ib_class_is_vendor_specific_low(\r
+ IN const uint8_t class_code )\r
+{\r
+ return( (class_code >= IB_MCLASS_VENDOR_LOW_RANGE_MIN) &&\r
+ (class_code <= IB_MCLASS_VENDOR_LOW_RANGE_MAX)) ;\r
+}\r
+/*\r
+* PARAMETERS\r
+* class_code\r
+* [in] The Management Datagram Class Code\r
+*\r
+* RETURN VALUE\r
+* TRUE if the class is in the Low range of Vendor Specific MADs \r
+* FALSE otherwise.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+* IB_MCLASS_VENDOR_LOW_RANGE_MIN, IB_MCLASS_VENDOR_LOW_RANGE_MAX\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_class_is_vendor_specific_high\r
+* NAME\r
+* ib_class_is_vendor_specific_high\r
+*\r
+* DESCRIPTION\r
+* Indicates if the Class Code if a vendor specific class from \r
+* the high range\r
+*\r
+* SYNOPSIS\r
+*/\r
+static inline boolean_t\r
+ib_class_is_vendor_specific_high(\r
+ IN const uint8_t class_code )\r
+{\r
+ return( (class_code >= IB_MCLASS_VENDOR_HIGH_RANGE_MIN) &&\r
+ (class_code <= IB_MCLASS_VENDOR_HIGH_RANGE_MAX)) ;\r
+}\r
+/*\r
+* PARAMETERS\r
+* class_code\r
+* [in] The Management Datagram Class Code\r
+*\r
+* RETURN VALUE\r
+* TRUE if the class is in the High range of Vendor Specific MADs \r
+* FALSE otherwise.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+* IB_MCLASS_VENDOR_HIGH_RANGE_MIN, IB_MCLASS_VENDOR_HIGH_RANGE_MAX\r
+*********/\r
+\r
+\r
+/****f* IBA Base: Types/ib_class_is_vendor_specific\r
+* NAME\r
+* ib_class_is_vendor_specific\r
+*\r
+* DESCRIPTION\r
+* Indicates if the Class Code if a vendor specific class\r
+*\r
+* SYNOPSIS\r
+*/\r
+static inline boolean_t\r
+ib_class_is_vendor_specific(\r
+ IN const uint8_t class_code )\r
+{\r
+ return( ib_class_is_vendor_specific_low(class_code) ||\r
+ ib_class_is_vendor_specific_high(class_code) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* class_code\r
+* [in] The Management Datagram Class Code\r
+*\r
+* RETURN VALUE\r
+* TRUE if the class is a Vendor Specific MAD\r
+* FALSE otherwise.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+* ib_class_is_vendor_specific_low, ib_class_is_vendor_specific_high\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_class_is_rmpp\r
+* NAME\r
+* ib_class_is_rmpp\r
+*\r
+* DESCRIPTION\r
+* Indicates if the Class Code supports RMPP\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE boolean_t AL_API\r
+ib_class_is_rmpp(\r
+ IN const uint8_t class_code )\r
+{\r
+ return( (class_code == IB_MCLASS_SUBN_ADM) ||\r
+ (class_code == IB_MCLASS_DEV_MGMT) ||\r
+ (class_code == IB_MCLASS_DEV_ADM) ||\r
+ (class_code == IB_MCLASS_BIS) ||\r
+ ib_class_is_vendor_specific_high( class_code ) ); \r
+}\r
+/*\r
+* PARAMETERS\r
+* class_code\r
+* [in] The Management Datagram Class Code\r
+*\r
+* RETURN VALUE\r
+* TRUE if the class supports RMPP\r
+* FALSE otherwise.\r
+*\r
+* NOTES\r
+*\r
+*********/\r
+\r
+/*\r
+ * MAD methods\r
+ */\r
+\r
+/****d* IBA Base: Constants/IB_MAX_METHOD\r
+* NAME\r
+* IB_MAX_METHOD\r
+*\r
+* DESCRIPTION\r
+* Total number of methods available to a class, not including the R-bit.\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAX_METHODS 128\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MAD_METHOD_RESP_MASK\r
+* NAME\r
+* IB_MAD_METHOD_RESP_MASK\r
+*\r
+* DESCRIPTION\r
+* Response mask to extract 'R' bit from the method field. (13.4.5)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAD_METHOD_RESP_MASK 0x80\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MAD_METHOD_GET\r
+* NAME\r
+* IB_MAD_METHOD_GET\r
+*\r
+* DESCRIPTION\r
+* Get() Method (13.4.5)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAD_METHOD_GET 0x01\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MAD_METHOD_SET\r
+* NAME\r
+* IB_MAD_METHOD_SET\r
+*\r
+* DESCRIPTION\r
+* Set() Method (13.4.5)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAD_METHOD_SET 0x02\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MAD_METHOD_GET_RESP\r
+* NAME\r
+* IB_MAD_METHOD_GET_RESP\r
+*\r
+* DESCRIPTION\r
+* GetResp() Method (13.4.5)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAD_METHOD_GET_RESP 0x81\r
+/**********/\r
+\r
+#define IB_MAD_METHOD_DELETE 0x15\r
+\r
+/****d* IBA Base: Constants/IB_MAD_METHOD_GETTABLE\r
+* NAME\r
+* IB_MAD_METHOD_GETTABLE\r
+*\r
+* DESCRIPTION\r
+* SubnAdmGetTable() Method (15.2.2)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAD_METHOD_GETTABLE 0x12\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MAD_METHOD_GETTABLE_RESP\r
+* NAME\r
+* IB_MAD_METHOD_GETTABLE_RESP\r
+*\r
+* DESCRIPTION\r
+* SubnAdmGetTableResp() Method (15.2.2)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAD_METHOD_GETTABLE_RESP 0x92\r
+\r
+/**********/\r
+\r
+#define IB_MAD_METHOD_GETTRACETABLE 0x13\r
+#define IB_MAD_METHOD_GETMULTI 0x14\r
+#define IB_MAD_METHOD_GETMULTI_RESP 0x94\r
+\r
+\r
+/****d* IBA Base: Constants/IB_MAD_METHOD_SEND\r
+* NAME\r
+* IB_MAD_METHOD_SEND\r
+*\r
+* DESCRIPTION\r
+* Send() Method (13.4.5)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAD_METHOD_SEND 0x03\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MAD_METHOD_TRAP\r
+* NAME\r
+* IB_MAD_METHOD_TRAP\r
+*\r
+* DESCRIPTION\r
+* Trap() Method (13.4.5)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAD_METHOD_TRAP 0x05\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MAD_METHOD_REPORT\r
+* NAME\r
+* IB_MAD_METHOD_REPORT\r
+*\r
+* DESCRIPTION\r
+* Report() Method (13.4.5)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAD_METHOD_REPORT 0x06\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MAD_METHOD_REPORT_RESP\r
+* NAME\r
+* IB_MAD_METHOD_REPORT_RESP\r
+*\r
+* DESCRIPTION\r
+* ReportResp() Method (13.4.5)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAD_METHOD_REPORT_RESP 0x86\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MAD_METHOD_TRAP_REPRESS\r
+* NAME\r
+* IB_MAD_METHOD_TRAP_REPRESS\r
+*\r
+* DESCRIPTION\r
+* TrapRepress() Method (13.4.5)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAD_METHOD_TRAP_REPRESS 0x07\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MAD_STATUS_BUSY\r
+* NAME\r
+* IB_MAD_STATUS_BUSY\r
+*\r
+* DESCRIPTION\r
+* Temporarily busy, MAD discarded (13.4.7)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAD_STATUS_BUSY (CL_HTON16(0x0001))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MAD_STATUS_REDIRECT\r
+* NAME\r
+* IB_MAD_STATUS_REDIRECT\r
+*\r
+* DESCRIPTION\r
+* QP Redirection required (13.4.7)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAD_STATUS_REDIRECT (CL_HTON16(0x0002))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MAD_STATUS_UNSUP_CLASS_VER\r
+* NAME\r
+* IB_MAD_STATUS_UNSUP_CLASS_VER\r
+*\r
+* DESCRIPTION\r
+* Unsupported class version (13.4.7)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAD_STATUS_UNSUP_CLASS_VER (CL_HTON16(0x0004))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MAD_STATUS_UNSUP_METHOD\r
+* NAME\r
+* IB_MAD_STATUS_UNSUP_METHOD\r
+*\r
+* DESCRIPTION\r
+* Unsupported method (13.4.7)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAD_STATUS_UNSUP_METHOD (CL_HTON16(0x0008))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MAD_STATUS_UNSUP_METHOD_ATTR\r
+* NAME\r
+* IB_MAD_STATUS_UNSUP_METHOD_ATTR\r
+*\r
+* DESCRIPTION\r
+* Unsupported method/attribute combination (13.4.7)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAD_STATUS_UNSUP_METHOD_ATTR (CL_HTON16(0x000C))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MAD_STATUS_INVALID_FIELD\r
+* NAME\r
+* IB_MAD_STATUS_INVALID_FIELD\r
+*\r
+* DESCRIPTION\r
+* Attribute contains one or more invalid fields (13.4.7)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAD_STATUS_INVALID_FIELD (CL_HTON16(0x001C))\r
+/**********/\r
+\r
+#define IB_MAD_STATUS_CLASS_MASK (CL_HTON16(0xFF00))\r
+\r
+#define IB_SA_MAD_STATUS_SUCCESS (CL_HTON16(0x0000))\r
+#define IB_SA_MAD_STATUS_NO_RESOURCES (CL_HTON16(0x0100))\r
+#define IB_SA_MAD_STATUS_REQ_INVALID (CL_HTON16(0x0200))\r
+#define IB_SA_MAD_STATUS_NO_RECORDS (CL_HTON16(0x0300))\r
+#define IB_SA_MAD_STATUS_TOO_MANY_RECORDS (CL_HTON16(0x0400))\r
+#define IB_SA_MAD_STATUS_INVALID_GID (CL_HTON16(0x0500))\r
+#define IB_SA_MAD_STATUS_INSUF_COMPS (CL_HTON16(0x0600))\r
+\r
+#define IB_DM_MAD_STATUS_NO_IOC_RESP (CL_HTON16(0x0100))\r
+#define IB_DM_MAD_STATUS_NO_SVC_ENTRIES (CL_HTON16(0x0200))\r
+#define IB_DM_MAD_STATUS_IOC_FAILURE (CL_HTON16(0x8000))\r
+\r
+/****d* IBA Base: Constants/IB_MAD_ATTR_CLASS_PORT_INFO\r
+* NAME\r
+* IB_MAD_ATTR_CLASS_PORT_INFO\r
+*\r
+* DESCRIPTION\r
+* ClassPortInfo attribute (13.4.8)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAD_ATTR_CLASS_PORT_INFO (CL_NTOH16(0x0001))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MAD_ATTR_NOTICE\r
+* NAME\r
+* IB_MAD_ATTR_NOTICE\r
+*\r
+* DESCRIPTION\r
+* Notice attribute (13.4.8)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAD_ATTR_NOTICE (CL_NTOH16(0x0002))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MAD_ATTR_INFORM_INFO\r
+* NAME\r
+* IB_MAD_ATTR_INFORM_INFO\r
+*\r
+* DESCRIPTION\r
+* InformInfo attribute (13.4.8)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAD_ATTR_INFORM_INFO (CL_NTOH16(0x0003))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MAD_ATTR_NODE_DESC\r
+* NAME\r
+* IB_MAD_ATTR_NODE_DESC\r
+*\r
+* DESCRIPTION\r
+* NodeDescription attribute (14.2.5)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAD_ATTR_NODE_DESC (CL_NTOH16(0x0010))\r
+\r
+/****d* IBA Base: Constants/IB_MAD_ATTR_PORT_SMPL_CTRL\r
+* NAME\r
+* IB_MAD_ATTR_PORT_SMPL_CTRL\r
+*\r
+* DESCRIPTION\r
+* NodeDescription attribute (16.1.2)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAD_ATTR_PORT_SMPL_CTRL (CL_NTOH16(0x0010))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MAD_ATTR_NODE_INFO\r
+* NAME\r
+* IB_MAD_ATTR_NODE_INFO\r
+*\r
+* DESCRIPTION\r
+* NodeInfo attribute (14.2.5)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAD_ATTR_NODE_INFO (CL_NTOH16(0x0011))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MAD_ATTR_PORT_SMPL_RSLT\r
+* NAME\r
+* IB_MAD_ATTR_PORT_SMPL_RSLT\r
+*\r
+* DESCRIPTION\r
+* NodeInfo attribute (16.1.2)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAD_ATTR_PORT_SMPL_RSLT (CL_NTOH16(0x0011))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MAD_ATTR_SWITCH_INFO\r
+* NAME\r
+* IB_MAD_ATTR_SWITCH_INFO\r
+*\r
+* DESCRIPTION\r
+* SwitchInfo attribute (14.2.5)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAD_ATTR_SWITCH_INFO (CL_NTOH16(0x0012))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MAD_ATTR_PORT_CNTRS\r
+* NAME\r
+* IB_MAD_ATTR_PORT_CNTRS\r
+*\r
+* DESCRIPTION\r
+* SwitchInfo attribute (16.1.2)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAD_ATTR_PORT_CNTRS (CL_NTOH16(0x0012))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MAD_ATTR_GUID_INFO\r
+* NAME\r
+* IB_MAD_ATTR_GUID_INFO\r
+*\r
+* DESCRIPTION\r
+* GUIDInfo attribute (14.2.5)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAD_ATTR_GUID_INFO (CL_NTOH16(0x0014))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MAD_ATTR_PORT_INFO\r
+* NAME\r
+* IB_MAD_ATTR_PORT_INFO\r
+*\r
+* DESCRIPTION\r
+* PortInfo attribute (14.2.5)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAD_ATTR_PORT_INFO (CL_NTOH16(0x0015))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MAD_ATTR_P_KEY_TABLE\r
+* NAME\r
+* IB_MAD_ATTR_P_KEY_TABLE\r
+*\r
+* DESCRIPTION\r
+* PartitionTable attribute (14.2.5)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAD_ATTR_P_KEY_TABLE (CL_NTOH16(0x0016))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MAD_ATTR_SLVL_TABLE\r
+* NAME\r
+* IB_MAD_ATTR_SLVL_TABLE\r
+*\r
+* DESCRIPTION\r
+* SL VL Mapping Table attribute (14.2.5)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAD_ATTR_SLVL_TABLE (CL_NTOH16(0x0017))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MAD_ATTR_VL_ARBITRATION\r
+* NAME\r
+* IB_MAD_ATTR_VL_ARBITRATION\r
+*\r
+* DESCRIPTION\r
+* VL Arbitration Table attribute (14.2.5)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAD_ATTR_VL_ARBITRATION (CL_NTOH16(0x0018))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MAD_ATTR_LIN_FWD_TBL\r
+* NAME\r
+* IB_MAD_ATTR_LIN_FWD_TBL\r
+*\r
+* DESCRIPTION\r
+* Switch linear forwarding table\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAD_ATTR_LIN_FWD_TBL (CL_NTOH16(0x0019))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MAD_ATTR_RND_FWD_TBL\r
+* NAME\r
+* IB_MAD_ATTR_RND_FWD_TBL\r
+*\r
+* DESCRIPTION\r
+* Switch random forwarding table\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAD_ATTR_RND_FWD_TBL (CL_NTOH16(0x001A))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MAD_ATTR_MCAST_FWD_TBL\r
+* NAME\r
+* IB_MAD_ATTR_MCAST_FWD_TBL\r
+*\r
+* DESCRIPTION\r
+* Switch multicast forwarding table\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAD_ATTR_MCAST_FWD_TBL (CL_NTOH16(0x001B))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MAD_ATTR_NODE_RECORD\r
+* NAME\r
+* IB_MAD_ATTR_NODE_RECORD\r
+*\r
+* DESCRIPTION\r
+* NodeRecord attribute (15.2.5)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAD_ATTR_NODE_RECORD (CL_NTOH16(0x0011))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MAD_ATTR_PORTINFO_RECORD\r
+* NAME\r
+* IB_MAD_ATTR_PORTINFO_RECORD\r
+*\r
+* DESCRIPTION\r
+* PortInfoRecord attribute (15.2.5)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAD_ATTR_PORTINFO_RECORD (CL_NTOH16(0x0012))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MAD_ATTR_SWITCH_INFO_RECORD\r
+* NAME\r
+* IB_MAD_ATTR_SWITCH_INFO_RECORD\r
+*\r
+* DESCRIPTION\r
+* SwitchInfoRecord attribute (15.2.5)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAD_ATTR_SWITCH_INFO_RECORD (CL_NTOH16(0x0014))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MAD_ATTR_LINK_RECORD\r
+* NAME\r
+* IB_MAD_ATTR_LINK_RECORD\r
+*\r
+* DESCRIPTION\r
+* LinkRecord attribute (15.2.5)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAD_ATTR_LINK_RECORD (CL_NTOH16(0x0020))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MAD_ATTR_SM_INFO\r
+* NAME\r
+* IB_MAD_ATTR_SM_INFO\r
+*\r
+* DESCRIPTION\r
+* SMInfo attribute (14.2.5)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAD_ATTR_SM_INFO (CL_NTOH16(0x0020))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MAD_ATTR_SMINFO_RECORD\r
+* NAME\r
+* IB_MAD_ATTR_SMINFO_RECORD\r
+*\r
+* DESCRIPTION\r
+* SMInfoRecord attribute (15.2.5)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAD_ATTR_SMINFO_RECORD (CL_NTOH16(0x0018))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MAD_ATTR_GUIDINFO_RECORD\r
+* NAME\r
+* IB_MAD_ATTR_GUIDINFO_RECORD\r
+*\r
+* DESCRIPTION\r
+* GuidInfoRecord attribute (15.2.5)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAD_ATTR_GUIDINFO_RECORD (CL_NTOH16(0x0030))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MAD_ATTR_VENDOR_DIAG\r
+* NAME\r
+* IB_MAD_ATTR_VENDOR_DIAG\r
+*\r
+* DESCRIPTION\r
+* VendorDiag attribute (14.2.5)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAD_ATTR_VENDOR_DIAG (CL_NTOH16(0x0030))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MAD_ATTR_LED_INFO\r
+* NAME\r
+* IB_MAD_ATTR_LED_INFO\r
+*\r
+* DESCRIPTION\r
+* LedInfo attribute (14.2.5)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAD_ATTR_LED_INFO (CL_NTOH16(0x0031))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MAD_ATTR_SERVICE_RECORD\r
+* NAME\r
+* IB_MAD_ATTR_SERVICE_RECORD\r
+*\r
+* DESCRIPTION\r
+* ServiceRecord attribute (15.2.5)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAD_ATTR_SERVICE_RECORD (CL_NTOH16(0x0031))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MAD_ATTR_LFT_RECORD\r
+* NAME\r
+* IB_MAD_ATTR_LFT_RECORD\r
+*\r
+* DESCRIPTION\r
+* LinearForwardingTableRecord attribute (15.2.5.6)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAD_ATTR_LFT_RECORD (CL_NTOH16(0x0015))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MAD_ATTR_MFT_RECORD\r
+* NAME\r
+* IB_MAD_ATTR_MFT_RECORD\r
+*\r
+* DESCRIPTION\r
+* MulticastForwardingTableRecord attribute (15.2.5.8)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAD_ATTR_MFT_RECORD (CL_NTOH16(0x0017))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MAD_ATTR_PKEYTBL_RECORD\r
+* NAME\r
+* IB_MAD_ATTR_PKEYTBL_RECORD\r
+*\r
+* DESCRIPTION\r
+* PKEY Table Record attribute (15.2.5)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAD_ATTR_PKEY_TBL_RECORD (CL_NTOH16(0x0033))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MAD_ATTR_PATH_RECORD\r
+* NAME\r
+* IB_MAD_ATTR_PATH_RECORD\r
+*\r
+* DESCRIPTION\r
+* PathRecord attribute (15.2.5)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAD_ATTR_PATH_RECORD (CL_NTOH16(0x0035))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MAD_ATTR_VLARB_RECORD\r
+* NAME\r
+* IB_MAD_ATTR_VLARB_RECORD\r
+*\r
+* DESCRIPTION\r
+* VL Arbitration Table Record attribute (15.2.5)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAD_ATTR_VLARB_RECORD (CL_NTOH16(0x0036))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MAD_ATTR_SLVL_RECORD\r
+* NAME\r
+* IB_MAD_ATTR_SLVL_RECORD\r
+*\r
+* DESCRIPTION\r
+* SLtoVL Mapping Table Record attribute (15.2.5)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAD_ATTR_SLVL_RECORD (CL_NTOH16(0x0013))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MAD_ATTR_MCMEMBER_RECORD\r
+* NAME\r
+* IB_MAD_ATTR_MCMEMBER_RECORD\r
+*\r
+* DESCRIPTION\r
+* MCMemberRecord attribute (15.2.5)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAD_ATTR_MCMEMBER_RECORD (CL_NTOH16(0x0038))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MAD_ATTR_TRACE_RECORD\r
+* NAME\r
+* IB_MAD_ATTR_TRACE_RECORD\r
+*\r
+* DESCRIPTION\r
+* TraceRecord attribute (15.2.5)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAD_ATTR_TRACE_RECORD (CL_NTOH16(0x0039))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MAD_ATTR_MULTIPATH_RECORD\r
+* NAME\r
+* IB_MAD_ATTR_MULTIPATH_RECORD\r
+*\r
+* DESCRIPTION\r
+* MultiPathRecord attribute (15.2.5)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAD_ATTR_MULTIPATH_RECORD (CL_NTOH16(0x003A))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MAD_ATTR_SVC_ASSOCIATION_RECORD\r
+* NAME\r
+* IB_MAD_ATTR_SVC_ASSOCIATION_RECORD\r
+*\r
+* DESCRIPTION\r
+* Service Association Record attribute (15.2.5)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAD_ATTR_SVC_ASSOCIATION_RECORD (CL_NTOH16(0x003B))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MAD_ATTR_INFORM_INFO_RECORD\r
+* NAME\r
+* IB_MAD_ATTR_INFORM_INFO_RECORD\r
+*\r
+* DESCRIPTION\r
+* InformInfo Record attribute (15.2.5)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAD_ATTR_INFORM_INFO_RECORD (CL_NTOH16(0x00F3))\r
+\r
+/****d* IBA Base: Constants/IB_MAD_ATTR_IO_UNIT_INFO\r
+* NAME\r
+* IB_MAD_ATTR_IO_UNIT_INFO\r
+*\r
+* DESCRIPTION\r
+* IOUnitInfo attribute (16.3.3)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAD_ATTR_IO_UNIT_INFO (CL_NTOH16(0x0010))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MAD_ATTR_IO_CONTROLLER_PROFILE\r
+* NAME\r
+* IB_MAD_ATTR_IO_CONTROLLER_PROFILE\r
+*\r
+* DESCRIPTION\r
+* IOControllerProfile attribute (16.3.3)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAD_ATTR_IO_CONTROLLER_PROFILE (CL_NTOH16(0x0011))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MAD_ATTR_SERVICE_ENTRIES\r
+* NAME\r
+* IB_MAD_ATTR_SERVICE_ENTRIES\r
+*\r
+* DESCRIPTION\r
+* ServiceEntries attribute (16.3.3)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAD_ATTR_SERVICE_ENTRIES (CL_NTOH16(0x0012))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MAD_ATTR_DIAGNOSTIC_TIMEOUT\r
+* NAME\r
+* IB_MAD_ATTR_DIAGNOSTIC_TIMEOUT\r
+*\r
+* DESCRIPTION\r
+* DiagnosticTimeout attribute (16.3.3)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAD_ATTR_DIAGNOSTIC_TIMEOUT (CL_NTOH16(0x0020))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MAD_ATTR_PREPARE_TO_TEST\r
+* NAME\r
+* IB_MAD_ATTR_PREPARE_TO_TEST\r
+*\r
+* DESCRIPTION\r
+* PrepareToTest attribute (16.3.3)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAD_ATTR_PREPARE_TO_TEST (CL_NTOH16(0x0021))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MAD_ATTR_TEST_DEVICE_ONCE\r
+* NAME\r
+* IB_MAD_ATTR_TEST_DEVICE_ONCE\r
+*\r
+* DESCRIPTION\r
+* TestDeviceOnce attribute (16.3.3)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAD_ATTR_TEST_DEVICE_ONCE (CL_NTOH16(0x0022))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MAD_ATTR_TEST_DEVICE_LOOP\r
+* NAME\r
+* IB_MAD_ATTR_TEST_DEVICE_LOOP\r
+*\r
+* DESCRIPTION\r
+* TestDeviceLoop attribute (16.3.3)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAD_ATTR_TEST_DEVICE_LOOP (CL_NTOH16(0x0023))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MAD_ATTR_DIAG_CODE\r
+* NAME\r
+* IB_MAD_ATTR_DIAG_CODE\r
+*\r
+* DESCRIPTION\r
+* DiagCode attribute (16.3.3)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MAD_ATTR_DIAG_CODE (CL_NTOH16(0x0024))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_NODE_TYPE_CA\r
+* NAME\r
+* IB_NODE_TYPE_CA\r
+*\r
+* DESCRIPTION\r
+* Encoded generic node type used in MAD attributes (13.4.8.2)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_NODE_TYPE_CA 0x01\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_NODE_TYPE_SWITCH\r
+* NAME\r
+* IB_NODE_TYPE_SWITCH\r
+*\r
+* DESCRIPTION\r
+* Encoded generic node type used in MAD attributes (13.4.8.2)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_NODE_TYPE_SWITCH 0x02\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_NODE_TYPE_ROUTER\r
+* NAME\r
+* IB_NODE_TYPE_ROUTER\r
+*\r
+* DESCRIPTION\r
+* Encoded generic node type used in MAD attributes (13.4.8.2)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_NODE_TYPE_ROUTER 0x03\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_NOTICE_NODE_TYPE_CA\r
+* NAME\r
+* IB_NOTICE_NODE_TYPE_CA\r
+*\r
+* DESCRIPTION\r
+* Encoded generic node type used in MAD attributes (13.4.8.2)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_NOTICE_NODE_TYPE_CA (CL_NTOH32(0x000001))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_NOTICE_NODE_TYPE_SWITCH\r
+* NAME\r
+* IB_NOTICE_NODE_TYPE_SWITCH\r
+*\r
+* DESCRIPTION\r
+* Encoded generic node type used in MAD attributes (13.4.8.2)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_NOTICE_NODE_TYPE_SWITCH (CL_NTOH32(0x000002))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_NOTICE_NODE_TYPE_ROUTER\r
+* NAME\r
+* IB_NOTICE_NODE_TYPE_ROUTER\r
+*\r
+* DESCRIPTION\r
+* Encoded generic node type used in MAD attributes (13.4.8.2)\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_NOTICE_NODE_TYPE_ROUTER (CL_NTOH32(0x000003))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_NOTICE_NODE_TYPE_SUBN_MGMT\r
+* NAME\r
+* IB_NOTICE_NODE_TYPE_SUBN_MGMT\r
+*\r
+* DESCRIPTION\r
+* Encoded generic node type used in MAD attributes (13.4.8.2).\r
+* Note that this value is not defined for the NodeType field\r
+* of the NodeInfo attribute (14.2.5.3).\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_NOTICE_NODE_TYPE_SUBN_MGMT (CL_NTOH32(0x000004))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MTU_LEN_TYPE\r
+* NAME\r
+* IB_MTU_LEN_TYPE\r
+*\r
+* DESCRIPTION\r
+* Encoded path MTU.\r
+* 1: 256\r
+* 2: 512\r
+* 3: 1024\r
+* 4: 2048\r
+* 5: 4096\r
+* others: reserved\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MTU_LEN_256 1\r
+#define IB_MTU_LEN_512 2\r
+#define IB_MTU_LEN_1024 3\r
+#define IB_MTU_LEN_2048 4\r
+#define IB_MTU_LEN_4096 5\r
+\r
+#define IB_MIN_MTU IB_MTU_LEN_256\r
+#define IB_MAX_MTU IB_MTU_LEN_4096\r
+\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_PATH_SELECTOR_TYPE\r
+* NAME\r
+* IB_PATH_SELECTOR_TYPE\r
+*\r
+* DESCRIPTION\r
+* Path selector.\r
+* 0: greater than specified\r
+* 1: less than specified\r
+* 2: exactly the specified\r
+* 3: largest available\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_PATH_SELECTOR_GREATER_THAN 0\r
+#define IB_PATH_SELECTOR_LESS_THAN 1\r
+#define IB_PATH_SELECTOR_EXACTLY 2\r
+#define IB_PATH_SELECTOR_LARGEST 3\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_SMINFO_STATE_NOTACTIVE\r
+* NAME\r
+* IB_SMINFO_STATE_NOTACTIVE\r
+*\r
+* DESCRIPTION\r
+* Encoded state value used in the SMInfo attribute.\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_SMINFO_STATE_NOTACTIVE 0\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_SMINFO_STATE_DISCOVERING\r
+* NAME\r
+* IB_SMINFO_STATE_DISCOVERING\r
+*\r
+* DESCRIPTION\r
+* Encoded state value used in the SMInfo attribute.\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_SMINFO_STATE_DISCOVERING 1\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_SMINFO_STATE_STANDBY\r
+* NAME\r
+* IB_SMINFO_STATE_STANDBY\r
+*\r
+* DESCRIPTION\r
+* Encoded state value used in the SMInfo attribute.\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_SMINFO_STATE_STANDBY 2\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_SMINFO_STATE_MASTER\r
+* NAME\r
+* IB_SMINFO_STATE_MASTER\r
+*\r
+* DESCRIPTION\r
+* Encoded state value used in the SMInfo attribute.\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_SMINFO_STATE_MASTER 3\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_PATH_REC_SELECTOR_MASK\r
+* NAME\r
+* IB_PATH_REC_SELECTOR_MASK\r
+*\r
+* DESCRIPTION\r
+* Mask for the selector field for path record MTU, rate,\r
+* and packet lifetime.\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_PATH_REC_SELECTOR_MASK 0xC0\r
+\r
+/****d* IBA Base: Constants/IB_MULTIPATH_REC_SELECTOR_MASK\r
+* NAME\r
+* IB_MULTIPATH_REC_SELECTOR_MASK\r
+*\r
+* DESCRIPTION\r
+* Mask for the selector field for multipath record MTU, rate,\r
+* and packet lifetime.\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MULTIPATH_REC_SELECTOR_MASK 0xC0\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_PATH_REC_BASE_MASK\r
+* NAME\r
+* IB_PATH_REC_BASE_MASK\r
+*\r
+* DESCRIPTION\r
+* Mask for the base value field for path record MTU, rate,\r
+* and packet lifetime.\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_PATH_REC_BASE_MASK 0x3F\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_MULTIPATH_REC_BASE_MASK\r
+* NAME\r
+* IB_MULTIPATH_REC_BASE_MASK\r
+*\r
+* DESCRIPTION\r
+* Mask for the base value field for multipath record MTU, rate,\r
+* and packet lifetime.\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_MULTIPATH_REC_BASE_MASK 0x3F\r
+/**********/\r
+\r
+/****h* IBA Base/Type Definitions\r
+* NAME\r
+* Type Definitions\r
+*\r
+* DESCRIPTION\r
+* Definitions are from the InfiniBand Architecture Specification v1.2\r
+*\r
+*********/\r
+\r
+/****d* IBA Base: Types/ib_net16_t\r
+* NAME\r
+* ib_net16_t\r
+*\r
+* DESCRIPTION\r
+* Defines the network ordered type for 16-bit values.\r
+*\r
+* SOURCE\r
+*/\r
+typedef uint16_t ib_net16_t;\r
+/**********/\r
+\r
+/****d* IBA Base: Types/ib_net32_t\r
+* NAME\r
+* ib_net32_t\r
+*\r
+* DESCRIPTION\r
+* Defines the network ordered type for 32-bit values.\r
+*\r
+* SOURCE\r
+*/\r
+typedef uint32_t ib_net32_t;\r
+/**********/\r
+\r
+/****d* IBA Base: Types/ib_net64_t\r
+* NAME\r
+* ib_net64_t\r
+*\r
+* DESCRIPTION\r
+* Defines the network ordered type for 64-bit values.\r
+*\r
+* SOURCE\r
+*/\r
+typedef uint64_t ib_net64_t;\r
+/**********/\r
+\r
+/****d* IBA Base: Types/ib_gid_prefix_t\r
+* NAME\r
+* ib_gid_prefix_t\r
+*\r
+* DESCRIPTION\r
+*\r
+* SOURCE\r
+*/\r
+typedef ib_net64_t ib_gid_prefix_t;\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/ib_link_states_t\r
+* NAME\r
+* ib_link_states_t\r
+*\r
+* DESCRIPTION\r
+* Defines the link states of a port.\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_LINK_NO_CHANGE 0\r
+#define IB_LINK_DOWN 1\r
+#define IB_LINK_INIT 2\r
+#define IB_LINK_ARMED 3\r
+#define IB_LINK_ACTIVE 4\r
+#define IB_LINK_ACT_DEFER 5\r
+/**********/\r
+\r
+static const char* const __ib_node_type_str[] =\r
+{\r
+ "UNKNOWN",\r
+ "Channel Adapter",\r
+ "Switch",\r
+ "Router",\r
+ "Subnet Management"\r
+};\r
+\r
+/****f* IBA Base: Types/ib_get_node_type_str\r
+* NAME\r
+* ib_get_node_type_str\r
+*\r
+* DESCRIPTION\r
+* Returns a string for the specified node type.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE const char* AL_API\r
+ib_get_node_type_str(\r
+ IN uint8_t node_type )\r
+{\r
+ if( node_type >= IB_NODE_TYPE_ROUTER )\r
+ node_type = 0;\r
+ return( __ib_node_type_str[node_type] );\r
+}\r
+/*\r
+* PARAMETERS\r
+* node_type\r
+* [in] Encoded node type as returned in the NodeInfo attribute.\r
+\r
+* RETURN VALUES\r
+* Pointer to the node type string.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+* ib_node_info_t\r
+*********/\r
+\r
+static const char* const __ib_port_state_str[] =\r
+{\r
+ "No State Change (NOP)",\r
+ "DOWN",\r
+ "INIT",\r
+ "ARMED",\r
+ "ACTIVE",\r
+ "ACTDEFER",\r
+ "UNKNOWN"\r
+};\r
+\r
+/****f* IBA Base: Types/ib_get_port_state_str\r
+* NAME\r
+* ib_get_port_state_str\r
+*\r
+* DESCRIPTION\r
+* Returns a string for the specified port state.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE const char* AL_API\r
+ib_get_port_state_str(\r
+ IN uint8_t port_state )\r
+{\r
+ if( port_state > IB_LINK_ACTIVE )\r
+ port_state = IB_LINK_ACTIVE + 1;\r
+ return( __ib_port_state_str[port_state] );\r
+}\r
+/*\r
+* PARAMETERS\r
+* port_state\r
+* [in] Encoded port state as returned in the PortInfo attribute.\r
+\r
+* RETURN VALUES\r
+* Pointer to the port state string.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+* ib_port_info_t\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_get_port_state_from_str\r
+* NAME\r
+* ib_get_port_state_from_str\r
+*\r
+* DESCRIPTION\r
+* Returns a string for the specified port state.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE const uint8_t AL_API\r
+ib_get_port_state_from_str(\r
+ IN char* p_port_state_str )\r
+{\r
+ if( !strncmp(p_port_state_str,"No State Change (NOP)",12) )\r
+ return(0);\r
+ else if( !strncmp(p_port_state_str, "DOWN",4) )\r
+ return(1);\r
+ else if( !strncmp(p_port_state_str, "INIT", 4) )\r
+ return(2);\r
+ else if( !strncmp(p_port_state_str,"ARMED", 5) )\r
+ return(3);\r
+ else if( !strncmp(p_port_state_str, "ACTIVE", 6) )\r
+ return(4);\r
+ else if( !strncmp(p_port_state_str, "ACTDEFER", 8) )\r
+ return(5);\r
+ return(6);\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_port_state_str\r
+* [in] A string matching one returned by ib_get_port_state_str\r
+*\r
+* RETURN VALUES\r
+* The appropriate code.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+* ib_port_info_t\r
+*********/\r
+\r
+/****d* IBA Base: Constants/Join States\r
+* NAME\r
+* Join States\r
+*\r
+* DESCRIPTION\r
+* Defines the join state flags for multicast group management.\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_JOIN_STATE_FULL 1\r
+#define IB_JOIN_STATE_NON 2\r
+#define IB_JOIN_STATE_SEND_ONLY 4\r
+/**********/\r
+\r
+/****f* IBA Base: Types/ib_pkey_get_base\r
+* NAME\r
+* ib_pkey_get_base\r
+*\r
+* DESCRIPTION\r
+* Returns the base P_Key value with the membership bit stripped.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE ib_net16_t AL_API\r
+ib_pkey_get_base(\r
+ IN const ib_net16_t pkey )\r
+{\r
+ return( (ib_net16_t)(pkey & IB_PKEY_BASE_MASK) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* pkey\r
+* [in] P_Key value\r
+*\r
+* RETURN VALUE\r
+* Returns the base P_Key value with the membership bit stripped.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_pkey_is_full_member\r
+* NAME\r
+* ib_pkey_is_full_member\r
+*\r
+* DESCRIPTION\r
+* Indicates if the port is a full member of the parition.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE boolean_t AL_API\r
+ib_pkey_is_full_member(\r
+ IN const ib_net16_t pkey )\r
+{\r
+ return( (pkey & IB_PKEY_TYPE_MASK) == IB_PKEY_TYPE_MASK );\r
+}\r
+/*\r
+* PARAMETERS\r
+* pkey\r
+* [in] P_Key value\r
+*\r
+* RETURN VALUE\r
+* TRUE if the port is a full member of the partition.\r
+* FALSE otherwise.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+* ib_pkey_get_base, ib_net16_t\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_pkey_is_invalid\r
+* NAME\r
+* ib_pkey_is_invalid\r
+*\r
+* DESCRIPTION\r
+* Returns TRUE if the given P_Key is an invalid P_Key\r
+* C10-116: the CI shall regard a P_Key as invalid if its low-order\r
+* 15 bits are all zero...\r
+*\r
+* SYNOPSIS\r
+*/\r
+static inline boolean_t \r
+ib_pkey_is_invalid(\r
+ IN const ib_net16_t pkey )\r
+{\r
+ if (ib_pkey_get_base(pkey) == 0x0000)\r
+ return TRUE;\r
+\r
+ return FALSE;\r
+}\r
+/*\r
+* PARAMETERS\r
+* pkey\r
+* [in] P_Key value\r
+*\r
+* RETURN VALUE\r
+* Returns the base P_Key value with the membership bit stripped.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+*********/\r
+\r
+/****d* IBA Base: Types/ib_gid_t\r
+* NAME\r
+* ib_gid_t\r
+*\r
+* DESCRIPTION\r
+*\r
+* SYNOPSIS\r
+*/\r
+#include <complib/cl_packon.h>\r
+typedef union _ib_gid\r
+{\r
+ uint8_t raw[16];\r
+ struct _ib_gid_unicast\r
+ {\r
+ ib_gid_prefix_t prefix;\r
+ ib_net64_t interface_id;\r
+\r
+ } PACK_SUFFIX unicast;\r
+\r
+ struct _ib_gid_multicast\r
+ {\r
+ uint8_t header[2];\r
+ uint8_t raw_group_id[14];\r
+\r
+ } PACK_SUFFIX multicast;\r
+\r
+} PACK_SUFFIX ib_gid_t;\r
+#include <complib/cl_packoff.h>\r
+/*\r
+* FIELDS\r
+* raw\r
+* GID represented as an unformated byte array.\r
+*\r
+* unicast\r
+* Typical unicast representation with subnet prefix and\r
+* port GUID.\r
+*\r
+* multicast\r
+* Representation for multicast use.\r
+*\r
+* SEE ALSO\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_gid_is_multicast\r
+* NAME\r
+* ib_gid_is_multicast\r
+*\r
+* DESCRIPTION\r
+* Returns a boolean indicating whether a GID is a multicast GID.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE boolean_t AL_API\r
+ib_gid_is_multicast(\r
+ IN const ib_gid_t* p_gid )\r
+{\r
+ return( p_gid->raw[0] == 0xFF );\r
+}\r
+\r
+/****f* IBA Base: Types/ib_gid_get_scope\r
+* NAME\r
+* ib_gid_get_scope\r
+*\r
+* DESCRIPTION\r
+* Returns scope of (assumed) multicast GID.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE uint8_t AL_API\r
+ib_mgid_get_scope(\r
+ IN const ib_gid_t* p_gid )\r
+{\r
+ return( p_gid->raw[1] & 0x0F );\r
+}\r
+\r
+/****f* IBA Base: Types/ib_gid_set_scope\r
+* NAME\r
+* ib_gid_set_scope\r
+*\r
+* DESCRIPTION\r
+* Sets scope of (assumed) multicast GID.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE void AL_API\r
+ib_mgid_set_scope(\r
+ IN ib_gid_t* const p_gid,\r
+ IN const uint8_t scope )\r
+{\r
+ p_gid->raw[1] &= 0xF0;\r
+ p_gid->raw[1] |= scope & 0x0F;\r
+}\r
+\r
+/****f* IBA Base: Types/ib_gid_set_default\r
+* NAME\r
+* ib_gid_set_default\r
+*\r
+* DESCRIPTION\r
+* Sets a GID to the default value.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE void AL_API\r
+ib_gid_set_default(\r
+ IN ib_gid_t* const p_gid,\r
+ IN const ib_net64_t interface_id )\r
+{\r
+ p_gid->unicast.prefix = IB_DEFAULT_SUBNET_PREFIX;\r
+ p_gid->unicast.interface_id = interface_id;\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_gid\r
+* [in] Pointer to the GID object.\r
+*\r
+* interface_id\r
+* [in] Manufacturer assigned EUI64 value of a port.\r
+*\r
+* RETURN VALUES\r
+* None.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+* ib_gid_t\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_gid_get_subnet_prefix\r
+* NAME\r
+* ib_gid_get_subnet_prefix\r
+*\r
+* DESCRIPTION\r
+* Gets the subnet prefix from a GID.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE ib_net64_t AL_API\r
+ib_gid_get_subnet_prefix(\r
+ IN const ib_gid_t* const p_gid )\r
+{\r
+ return( p_gid->unicast.prefix );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_gid\r
+* [in] Pointer to the GID object.\r
+*\r
+* RETURN VALUES\r
+* 64-bit subnet prefix value.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+* ib_gid_t\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_gid_is_link_local\r
+* NAME\r
+* ib_gid_is_link_local\r
+*\r
+* DESCRIPTION\r
+* Returns TRUE if the unicast GID scoping indicates link local,\r
+* FALSE otherwise.\r
+*\r
+* SYNOPSIS\r
+*/\r
+static inline boolean_t\r
+ib_gid_is_link_local(\r
+ IN const ib_gid_t* const p_gid )\r
+{\r
+ return( ib_gid_get_subnet_prefix( p_gid ) == IB_DEFAULT_SUBNET_PREFIX );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_gid\r
+* [in] Pointer to the GID object.\r
+*\r
+* RETURN VALUES\r
+* Returns TRUE if the unicast GID scoping indicates link local,\r
+* FALSE otherwise.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+* ib_gid_t\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_gid_is_site_local\r
+* NAME\r
+* ib_gid_is_site_local\r
+*\r
+* DESCRIPTION\r
+* Returns TRUE if the unicast GID scoping indicates site local,\r
+* FALSE otherwise.\r
+*\r
+* SYNOPSIS\r
+*/\r
+static inline boolean_t\r
+ib_gid_is_site_local(\r
+ IN const ib_gid_t* const p_gid )\r
+{\r
+ return( ( ib_gid_get_subnet_prefix( p_gid ) &\r
+ CL_HTON64( 0xFFFFFFFFFFFF0000ULL ) ) == CL_HTON64( 0xFEC0000000000000ULL ) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_gid\r
+* [in] Pointer to the GID object.\r
+*\r
+* RETURN VALUES\r
+* Returns TRUE if the unicast GID scoping indicates site local,\r
+* FALSE otherwise.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+* ib_gid_t\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_gid_get_guid\r
+* NAME\r
+* ib_gid_get_guid\r
+*\r
+* DESCRIPTION\r
+* Gets the guid from a GID.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE ib_net64_t AL_API\r
+ib_gid_get_guid(\r
+ IN const ib_gid_t* const p_gid )\r
+{\r
+ return( p_gid->unicast.interface_id );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_gid\r
+* [in] Pointer to the GID object.\r
+*\r
+* RETURN VALUES\r
+* 64-bit GUID value.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+* ib_gid_t\r
+*********/\r
+\r
+/****s* IBA Base: Types/ib_field32_t\r
+* NAME\r
+* ib_field32_t\r
+*\r
+* DESCRIPTION\r
+* Represents a 32-bit field, and allows access as a 32-bit network byte\r
+* ordered or a 4-byte array.\r
+*\r
+* SYNOPSIS\r
+*/\r
+#include <complib/cl_packon.h>\r
+typedef union _ib_field32_t\r
+{\r
+ net32_t val;\r
+ uint8_t bytes[4];\r
+\r
+} PACK_SUFFIX ib_field32_t;\r
+#include <complib/cl_packoff.h>\r
+/*\r
+* FIELDS\r
+* val\r
+* Full field value.\r
+*\r
+* bytes\r
+* Byte array representing the field. The byte array provides identical\r
+* access independently from CPU byte-ordering.\r
+*********/\r
+\r
+/****s* IBA Base: Types/ib_path_rec_t\r
+* NAME\r
+* ib_path_rec_t\r
+*\r
+* DESCRIPTION\r
+* Path records encapsulate the properties of a given\r
+* route between two end-points on a subnet.\r
+*\r
+* SYNOPSIS\r
+*/\r
+#include <complib/cl_packon.h>\r
+typedef __declspec(align(8)) struct _ib_path_rec\r
+{\r
+ uint64_t resv0;\r
+ ib_gid_t dgid;\r
+ ib_gid_t sgid;\r
+ ib_net16_t dlid;\r
+ ib_net16_t slid;\r
+ ib_field32_t hop_flow_raw;\r
+ uint8_t tclass;\r
+ uint8_t num_path;\r
+ ib_net16_t pkey;\r
+ ib_net16_t sl;\r
+ uint8_t mtu;\r
+ uint8_t rate;\r
+ uint8_t pkt_life;\r
+ uint8_t preference;\r
+ uint16_t resv1;\r
+ uint32_t resv2;\r
+\r
+} PACK_SUFFIX ib_path_rec_t;\r
+#include <complib/cl_packoff.h>\r
+/*\r
+* FIELDS\r
+* resv0\r
+* Reserved bytes.\r
+*\r
+* dgid\r
+* GID of destination port.\r
+*\r
+* sgid\r
+* GID of source port.\r
+*\r
+* dlid\r
+* LID of destination port.\r
+*\r
+* slid\r
+* LID of source port.\r
+*\r
+* hop_flow_raw\r
+* Global routing parameters: hop count, flow label and raw bit.\r
+*\r
+* tclass\r
+* Another global routing parameter.\r
+*\r
+* num_path\r
+* Reversible path - 1 bit to say if path is reversible.\r
+* num_path [6:0] In queries, maximum number of paths to return.\r
+* In responses, undefined.\r
+*\r
+* pkey\r
+* Partition key (P_Key) to use on this path.\r
+*\r
+* resv1\r
+* Reserved byte.\r
+*\r
+* sl\r
+* Service level to use on this path.\r
+*\r
+* mtu\r
+* MTU and MTU selector fields to use on this path\r
+*\r
+* rate\r
+* Rate and rate selector fields to use on this path.\r
+*\r
+* pkt_life\r
+* Packet lifetime\r
+*\r
+* preference\r
+* Indicates the relative merit of this path versus other path\r
+* records returned from the SA. Lower numbers are better.\r
+*\r
+* resv1\r
+* Reserved bytes.\r
+*\r
+* resv2\r
+* Reserved bytes.\r
+* SEE ALSO\r
+*********/\r
+\r
+/* Path Record Component Masks */\r
+#define IB_PR_COMPMASK_DGID (CL_HTON64(((uint64_t)1)<<2))\r
+#define IB_PR_COMPMASK_SGID (CL_HTON64(((uint64_t)1)<<3))\r
+#define IB_PR_COMPMASK_DLID (CL_HTON64(((uint64_t)1)<<4))\r
+#define IB_PR_COMPMASK_SLID (CL_HTON64(((uint64_t)1)<<5))\r
+#define IB_PR_COMPMASK_RAWTRAFFIC (CL_HTON64(((uint64_t)1)<<6))\r
+#define IB_PR_COMPMASK_RESV0 (CL_HTON64(((uint64_t)1)<<7))\r
+#define IB_PR_COMPMASK_FLOWLABEL (CL_HTON64(((uint64_t)1)<<8))\r
+#define IB_PR_COMPMASK_HOPLIMIT (CL_HTON64(((uint64_t)1)<<9))\r
+#define IB_PR_COMPMASK_TCLASS (CL_HTON64(((uint64_t)1)<<10))\r
+#define IB_PR_COMPMASK_REVERSIBLE (CL_HTON64(((uint64_t)1)<<11))\r
+#define IB_PR_COMPMASK_NUM_PATH (CL_HTON64(((uint64_t)1)<<12))\r
+#define IB_PR_COMPMASK_PKEY (CL_HTON64(((uint64_t)1)<<13))\r
+#define IB_PR_COMPMASK_RESV1 (CL_HTON64(((uint64_t)1)<<14))\r
+#define IB_PR_COMPMASK_SL (CL_HTON64(((uint64_t)1)<<15))\r
+#define IB_PR_COMPMASK_MTUSELEC (CL_HTON64(((uint64_t)1)<<16))\r
+#define IB_PR_COMPMASK_MTU (CL_HTON64(((uint64_t)1)<<17))\r
+#define IB_PR_COMPMASK_RATESELEC (CL_HTON64(((uint64_t)1)<<18))\r
+#define IB_PR_COMPMASK_RATE (CL_HTON64(((uint64_t)1)<<19))\r
+#define IB_PR_COMPMASK_PKTLIFETIMESELEC (CL_HTON64(((uint64_t)1)<<20))\r
+#define IB_PR_COMPMASK_PKTLIFETIME (CL_HTON64(((uint64_t)1)<<21))\r
+\r
+/* Link Record Component Masks */\r
+#define IB_LR_COMPMASK_FROM_LID (CL_HTON64(((uint64_t)1)<<0))\r
+#define IB_LR_COMPMASK_FROM_PORT (CL_HTON64(((uint64_t)1)<<1))\r
+#define IB_LR_COMPMASK_TO_PORT (CL_HTON64(((uint64_t)1)<<2))\r
+#define IB_LR_COMPMASK_TO_LID (CL_HTON64(((uint64_t)1)<<3))\r
+\r
+/* VL Arbitration Record Masks */\r
+#define IB_VLA_COMPMASK_LID (CL_HTON64(((uint64_t)1)<<0))\r
+#define IB_VLA_COMPMASK_OUT_PORT (CL_HTON64(((uint64_t)1)<<1))\r
+#define IB_VLA_COMPMASK_BLOCK (CL_HTON64(((uint64_t)1)<<2))\r
+\r
+/* SLtoVL Mapping Record Masks */\r
+#define IB_SLVL_COMPMASK_LID (CL_HTON64(((uint64_t)1)<<0))\r
+#define IB_SLVL_COMPMASK_IN_PORT (CL_HTON64(((uint64_t)1)<<1))\r
+#define IB_SLVL_COMPMASK_OUT_PORT (CL_HTON64(((uint64_t)1)<<2))\r
+\r
+/* P_Key Table Record Masks */\r
+#define IB_PKEY_COMPMASK_LID (CL_HTON64(((uint64_t)1)<<0))\r
+#define IB_PKEY_COMPMASK_BLOCK (CL_HTON64(((uint64_t)1)<<1))\r
+#define IB_PKEY_COMPMASK_PORT (CL_HTON64(((uint64_t)1)<<2))\r
+\r
+/* Switch Info Record Masks */\r
+#define IB_SWIR_COMPMASK_LID (CL_HTON64(((uint64_t)1)<<0))\r
+#define IB_SWIR_COMPMASK_RESERVED1 (CL_HTON64(((uint64_t)1)<<1))\r
+\r
+/* LFT Record Masks */\r
+#define IB_LFTR_COMPMASK_LID (CL_HTON64(((uint64_t)1)<<0))\r
+#define IB_LFTR_COMPMASK_BLOCK (CL_HTON64(((uint64_t)1)<<1))\r
+\r
+/* MFT Record Masks */\r
+#define IB_MFTR_COMPMASK_LID (CL_HTON64(((uint64_t)1)<<0))\r
+#define IB_MFTR_COMPMASK_POSITION (CL_HTON64(((uint64_t)1)<<1))\r
+#define IB_MFTR_COMPMASK_RESERVED1 (CL_HTON64(((uint64_t)1)<<2))\r
+#define IB_MFTR_COMPMASK_BLOCK (CL_HTON64(((uint64_t)1)<<3))\r
+#define IB_MFTR_COMPMASK_RESERVED2 (CL_HTON64(((uint64_t)1)<<4))\r
+\r
+/* NodeInfo Record Masks */\r
+#define IB_NR_COMPMASK_LID (CL_HTON64(((uint64_t)1)<<0))\r
+#define IB_NR_COMPMASK_RESERVED1 (CL_HTON64(((uint64_t)1)<<1))\r
+#define IB_NR_COMPMASK_BASEVERSION (CL_HTON64(((uint64_t)1)<<2))\r
+#define IB_NR_COMPMASK_CLASSVERSION (CL_HTON64(((uint64_t)1)<<3))\r
+#define IB_NR_COMPMASK_NODETYPE (CL_HTON64(((uint64_t)1)<<4))\r
+#define IB_NR_COMPMASK_NUMPORTS (CL_HTON64(((uint64_t)1)<<5))\r
+#define IB_NR_COMPMASK_SYSIMAGEGUID (CL_HTON64(((uint64_t)1)<<6))\r
+#define IB_NR_COMPMASK_NODEGUID (CL_HTON64(((uint64_t)1)<<7))\r
+#define IB_NR_COMPMASK_PORTGUID (CL_HTON64(((uint64_t)1)<<8))\r
+#define IB_NR_COMPMASK_PARTCAP (CL_HTON64(((uint64_t)1)<<9))\r
+#define IB_NR_COMPMASK_DEVID (CL_HTON64(((uint64_t)1)<<10))\r
+#define IB_NR_COMPMASK_REV (CL_HTON64(((uint64_t)1)<<11))\r
+#define IB_NR_COMPMASK_PORTNUM (CL_HTON64(((uint64_t)1)<<12))\r
+#define IB_NR_COMPMASK_VENDID (CL_HTON64(((uint64_t)1)<<13))\r
+#define IB_NR_COMPMASK_NODEDESC (CL_HTON64(((uint64_t)1)<<14))\r
+\r
+/* Service Record Component Masks Sec 15.2.5.14 Ver 1.1*/\r
+#define IB_SR_COMPMASK_SID (CL_HTON64(((uint64_t)1)<<0))\r
+#define IB_SR_COMPMASK_SGID (CL_HTON64(((uint64_t)1)<<1))\r
+#define IB_SR_COMPMASK_SPKEY (CL_HTON64(((uint64_t)1)<<2))\r
+#define IB_SR_COMPMASK_RES1 (CL_HTON64(((uint64_t)1)<<3))\r
+#define IB_SR_COMPMASK_SLEASE (CL_HTON64(((uint64_t)1)<<4))\r
+#define IB_SR_COMPMASK_SKEY (CL_HTON64(((uint64_t)1)<<5))\r
+#define IB_SR_COMPMASK_SNAME (CL_HTON64(((uint64_t)1)<<6))\r
+#define IB_SR_COMPMASK_SDATA8_0 (CL_HTON64(((uint64_t)1)<<7))\r
+#define IB_SR_COMPMASK_SDATA8_1 (CL_HTON64(((uint64_t)1)<<8))\r
+#define IB_SR_COMPMASK_SDATA8_2 (CL_HTON64(((uint64_t)1)<<9))\r
+#define IB_SR_COMPMASK_SDATA8_3 (CL_HTON64(((uint64_t)1)<<10))\r
+#define IB_SR_COMPMASK_SDATA8_4 (CL_HTON64(((uint64_t)1)<<11))\r
+#define IB_SR_COMPMASK_SDATA8_5 (CL_HTON64(((uint64_t)1)<<12))\r
+#define IB_SR_COMPMASK_SDATA8_6 (CL_HTON64(((uint64_t)1)<<13))\r
+#define IB_SR_COMPMASK_SDATA8_7 (CL_HTON64(((uint64_t)1)<<14))\r
+#define IB_SR_COMPMASK_SDATA8_8 (CL_HTON64(((uint64_t)1)<<15))\r
+#define IB_SR_COMPMASK_SDATA8_9 (CL_HTON64(((uint64_t)1)<<16))\r
+#define IB_SR_COMPMASK_SDATA8_10 (CL_HTON64(((uint64_t)1)<<17))\r
+#define IB_SR_COMPMASK_SDATA8_11 (CL_HTON64(((uint64_t)1)<<18))\r
+#define IB_SR_COMPMASK_SDATA8_12 (CL_HTON64(((uint64_t)1)<<19))\r
+#define IB_SR_COMPMASK_SDATA8_13 (CL_HTON64(((uint64_t)1)<<20))\r
+#define IB_SR_COMPMASK_SDATA8_14 (CL_HTON64(((uint64_t)1)<<21))\r
+#define IB_SR_COMPMASK_SDATA8_15 (CL_HTON64(((uint64_t)1)<<22))\r
+#define IB_SR_COMPMASK_SDATA16_0 (CL_HTON64(((uint64_t)1)<<23))\r
+#define IB_SR_COMPMASK_SDATA16_1 (CL_HTON64(((uint64_t)1)<<24))\r
+#define IB_SR_COMPMASK_SDATA16_2 (CL_HTON64(((uint64_t)1)<<25))\r
+#define IB_SR_COMPMASK_SDATA16_3 (CL_HTON64(((uint64_t)1)<<26))\r
+#define IB_SR_COMPMASK_SDATA16_4 (CL_HTON64(((uint64_t)1)<<27))\r
+#define IB_SR_COMPMASK_SDATA16_5 (CL_HTON64(((uint64_t)1)<<28))\r
+#define IB_SR_COMPMASK_SDATA16_6 (CL_HTON64(((uint64_t)1)<<29))\r
+#define IB_SR_COMPMASK_SDATA16_7 (CL_HTON64(((uint64_t)1)<<30))\r
+#define IB_SR_COMPMASK_SDATA32_0 (CL_HTON64(((uint64_t)1)<<31))\r
+#define IB_SR_COMPMASK_SDATA32_1 (CL_HTON64(((uint64_t)1)<<32))\r
+#define IB_SR_COMPMASK_SDATA32_2 (CL_HTON64(((uint64_t)1)<<33))\r
+#define IB_SR_COMPMASK_SDATA32_3 (CL_HTON64(((uint64_t)1)<<34))\r
+#define IB_SR_COMPMASK_SDATA64_0 (CL_HTON64(((uint64_t)1)<<35))\r
+#define IB_SR_COMPMASK_SDATA64_1 (CL_HTON64(((uint64_t)1)<<36))\r
+\r
+/* Port Info Record Component Masks */\r
+#define IB_PIR_COMPMASK_LID (CL_HTON64(((uint64_t)1)<<0))\r
+#define IB_PIR_COMPMASK_PORTNUM (CL_HTON64(((uint64_t)1)<<1))\r
+#define IB_PIR_COMPMASK_RESV1 (CL_HTON64(((uint64_t)1)<<2))\r
+#define IB_PIR_COMPMASK_MKEY (CL_HTON64(((uint64_t)1)<<3))\r
+#define IB_PIR_COMPMASK_GIDPRE (CL_HTON64(((uint64_t)1)<<4))\r
+#define IB_PIR_COMPMASK_BASELID (CL_HTON64(((uint64_t)1)<<5))\r
+#define IB_PIR_COMPMASK_SMLID (CL_HTON64(((uint64_t)1)<<6))\r
+#define IB_PIR_COMPMASK_CAPMASK (CL_HTON64(((uint64_t)1)<<7))\r
+#define IB_PIR_COMPMASK_DIAGCODE (CL_HTON64(((uint64_t)1)<<8))\r
+#define IB_PIR_COMPMASK_MKEYLEASEPRD (CL_HTON64(((uint64_t)1)<<9))\r
+#define IB_PIR_COMPMASK_LOCALPORTNUM (CL_HTON64(((uint64_t)1)<<10))\r
+#define IB_PIR_COMPMASK_LINKWIDTHENABLED (CL_HTON64(((uint64_t)1)<<11))\r
+#define IB_PIR_COMPMASK_LNKWIDTHSUPPORT (CL_HTON64(((uint64_t)1)<<12))\r
+#define IB_PIR_COMPMASK_LNKWIDTHACTIVE (CL_HTON64(((uint64_t)1)<<13))\r
+#define IB_PIR_COMPMASK_LNKSPEEDSUPPORT (CL_HTON64(((uint64_t)1)<<14))\r
+#define IB_PIR_COMPMASK_PORTSTATE (CL_HTON64(((uint64_t)1)<<15))\r
+#define IB_PIR_COMPMASK_PORTPHYSTATE (CL_HTON64(((uint64_t)1)<<16))\r
+#define IB_PIR_COMPMASK_LINKDWNDFLTSTATE (CL_HTON64(((uint64_t)1)<<17))\r
+#define IB_PIR_COMPMASK_MKEYPROTBITS (CL_HTON64(((uint64_t)1)<<18))\r
+#define IB_PIR_COMPMASK_RESV2 (CL_HTON64(((uint64_t)1)<<19))\r
+#define IB_PIR_COMPMASK_LMC (CL_HTON64(((uint64_t)1)<<20))\r
+#define IB_PIR_COMPMASK_LINKSPEEDACTIVE (CL_HTON64(((uint64_t)1)<<21))\r
+#define IB_PIR_COMPMASK_LINKSPEEDENABLE (CL_HTON64(((uint64_t)1)<<22))\r
+#define IB_PIR_COMPMASK_NEIGHBORMTU (CL_HTON64(((uint64_t)1)<<23))\r
+#define IB_PIR_COMPMASK_MASTERSMSL (CL_HTON64(((uint64_t)1)<<24))\r
+#define IB_PIR_COMPMASK_VLCAP (CL_HTON64(((uint64_t)1)<<25))\r
+#define IB_PIR_COMPMASK_INITTYPE (CL_HTON64(((uint64_t)1)<<26))\r
+#define IB_PIR_COMPMASK_VLHIGHLIMIT (CL_HTON64(((uint64_t)1)<<27))\r
+#define IB_PIR_COMPMASK_VLARBHIGHCAP (CL_HTON64(((uint64_t)1)<<28))\r
+#define IB_PIR_COMPMASK_VLARBLOWCAP (CL_HTON64(((uint64_t)1)<<29))\r
+#define IB_PIR_COMPMASK_INITTYPEREPLY (CL_HTON64(((uint64_t)1)<<30))\r
+#define IB_PIR_COMPMASK_MTUCAP (CL_HTON64(((uint64_t)1)<<31))\r
+#define IB_PIR_COMPMASK_VLSTALLCNT (CL_HTON64(((uint64_t)1)<<32))\r
+#define IB_PIR_COMPMASK_HOQLIFE (CL_HTON64(((uint64_t)1)<<33))\r
+#define IB_PIR_COMPMASK_OPVLS (CL_HTON64(((uint64_t)1)<<34))\r
+#define IB_PIR_COMPMASK_PARENFIN (CL_HTON64(((uint64_t)1)<<35))\r
+#define IB_PIR_COMPMASK_PARENFOUT (CL_HTON64(((uint64_t)1)<<36))\r
+#define IB_PIR_COMPMASK_FILTERRAWIN (CL_HTON64(((uint64_t)1)<<37))\r
+#define IB_PIR_COMPMASK_FILTERRAWOUT (CL_HTON64(((uint64_t)1)<<38))\r
+#define IB_PIR_COMPMASK_MKEYVIO (CL_HTON64(((uint64_t)1)<<39))\r
+#define IB_PIR_COMPMASK_PKEYVIO (CL_HTON64(((uint64_t)1)<<40))\r
+#define IB_PIR_COMPMASK_QKEYVIO (CL_HTON64(((uint64_t)1)<<41))\r
+#define IB_PIR_COMPMASK_GUIDCAP (CL_HTON64(((uint64_t)1)<<42))\r
+#define IB_PIR_COMPMASK_RESV3 (CL_HTON64(((uint64_t)1)<<43))\r
+#define IB_PIR_COMPMASK_SUBNTO (CL_HTON64(((uint64_t)1)<<44))\r
+#define IB_PIR_COMPMASK_RESV4 (CL_HTON64(((uint64_t)1)<<45))\r
+#define IB_PIR_COMPMASK_RESPTIME (CL_HTON64(((uint64_t)1)<<46))\r
+#define IB_PIR_COMPMASK_LOCALPHYERR (CL_HTON64(((uint64_t)1)<<47))\r
+#define IB_PIR_COMPMASK_OVERRUNERR (CL_HTON64(((uint64_t)1)<<48))\r
+\r
+/* Multicast Member Record Component Masks */\r
+#define IB_MCR_COMPMASK_GID (CL_HTON64(((uint64_t)1)<<0))\r
+#define IB_MCR_COMPMASK_MGID (CL_HTON64(((uint64_t)1)<<0))\r
+#define IB_MCR_COMPMASK_PORT_GID (CL_HTON64(((uint64_t)1)<<1))\r
+#define IB_MCR_COMPMASK_QKEY (CL_HTON64(((uint64_t)1)<<2))\r
+#define IB_MCR_COMPMASK_MLID (CL_HTON64(((uint64_t)1)<<3))\r
+#define IB_MCR_COMPMASK_MTU_SEL (CL_HTON64(((uint64_t)1)<<4))\r
+#define IB_MCR_COMPMASK_MTU (CL_HTON64(((uint64_t)1)<<5))\r
+#define IB_MCR_COMPMASK_TCLASS (CL_HTON64(((uint64_t)1)<<6))\r
+#define IB_MCR_COMPMASK_PKEY (CL_HTON64(((uint64_t)1)<<7))\r
+#define IB_MCR_COMPMASK_RATE_SEL (CL_HTON64(((uint64_t)1)<<8))\r
+#define IB_MCR_COMPMASK_RATE (CL_HTON64(((uint64_t)1)<<9))\r
+#define IB_MCR_COMPMASK_LIFE_SEL (CL_HTON64(((uint64_t)1)<<10))\r
+#define IB_MCR_COMPMASK_LIFE (CL_HTON64(((uint64_t)1)<<11))\r
+#define IB_MCR_COMPMASK_SL (CL_HTON64(((uint64_t)1)<<12))\r
+#define IB_MCR_COMPMASK_FLOW (CL_HTON64(((uint64_t)1)<<13))\r
+#define IB_MCR_COMPMASK_HOP (CL_HTON64(((uint64_t)1)<<14))\r
+#define IB_MCR_COMPMASK_SCOPE (CL_HTON64(((uint64_t)1)<<15))\r
+#define IB_MCR_COMPMASK_JOIN_STATE (CL_HTON64(((uint64_t)1)<<16))\r
+#define IB_MCR_COMPMASK_PROXY (CL_HTON64(((uint64_t)1)<<17))\r
+\r
+/* GUID Info Record Component Masks */\r
+#define IB_GIR_COMPMASK_LID (CL_HTON64(((uint64_t)1)<<0))\r
+#define IB_GIR_COMPMASK_BLOCKNUM (CL_HTON64(((uint64_t)1)<<1))\r
+#define IB_GIR_COMPMASK_RESV1 (CL_HTON64(((uint64_t)1)<<2))\r
+#define IB_GIR_COMPMASK_RESV2 (CL_HTON64(((uint64_t)1)<<3))\r
+#define IB_GIR_COMPMASK_GID0 (CL_HTON64(((uint64_t)1)<<4))\r
+#define IB_GIR_COMPMASK_GID1 (CL_HTON64(((uint64_t)1)<<5))\r
+#define IB_GIR_COMPMASK_GID2 (CL_HTON64(((uint64_t)1)<<6))\r
+#define IB_GIR_COMPMASK_GID3 (CL_HTON64(((uint64_t)1)<<7))\r
+#define IB_GIR_COMPMASK_GID4 (CL_HTON64(((uint64_t)1)<<8))\r
+#define IB_GIR_COMPMASK_GID5 (CL_HTON64(((uint64_t)1)<<9))\r
+#define IB_GIR_COMPMASK_GID6 (CL_HTON64(((uint64_t)1)<<10))\r
+#define IB_GIR_COMPMASK_GID7 (CL_HTON64(((uint64_t)1)<<11))\r
+\r
+/* MultiPath Record Component Masks */\r
+#define IB_MPR_COMPMASK_RAWTRAFFIC (CL_HTON64(((uint64_t)1)<<0))\r
+#define IB_MPR_COMPMASK_RESV0 (CL_HTON64(((uint64_t)1)<<1))\r
+#define IB_MPR_COMPMASK_FLOWLABEL (CL_HTON64(((uint64_t)1)<<2))\r
+#define IB_MPR_COMPMASK_HOPLIMIT (CL_HTON64(((uint64_t)1)<<3))\r
+#define IB_MPR_COMPMASK_TCLASS (CL_HTON64(((uint64_t)1)<<4))\r
+#define IB_MPR_COMPMASK_REVERSIBLE (CL_HTON64(((uint64_t)1)<<5))\r
+#define IB_MPR_COMPMASK_NUMBPATH (CL_HTON64(((uint64_t)1)<<6))\r
+#define IB_MPR_COMPMASK_PKEY (CL_HTON64(((uint64_t)1)<<7))\r
+#define IB_MPR_COMPMASK_RESV1 (CL_HTON64(((uint64_t)1)<<8))\r
+#define IB_MPR_COMPMASK_SL (CL_HTON64(((uint64_t)1)<<9))\r
+#define IB_MPR_COMPMASK_MTUSELEC (CL_HTON64(((uint64_t)1)<<10))\r
+#define IB_MPR_COMPMASK_MTU (CL_HTON64(((uint64_t)1)<<11))\r
+#define IB_MPR_COMPMASK_RATESELEC (CL_HTON64(((uint64_t)1)<<12))\r
+#define IB_MPR_COMPMASK_RATE (CL_HTON64(((uint64_t)1)<<13))\r
+#define IB_MPR_COMPMASK_PKTLIFETIMESELEC (CL_HTON64(((uint64_t)1)<<14))\r
+#define IB_MPR_COMPMASK_PKTLIFETIME (CL_HTON64(((uint64_t)1)<<15))\r
+#define IB_MPR_COMPMASK_RESV2 (CL_HTON64(((uint64_t)1)<<16))\r
+#define IB_MPR_COMPMASK_INDEPSELEC (CL_HTON64(((uint64_t)1)<<17))\r
+#define IB_MPR_COMPMASK_RESV3 (CL_HTON64(((uint64_t)1)<<18))\r
+#define IB_MPR_COMPMASK_SGIDCOUNT (CL_HTON64(((uint64_t)1)<<19))\r
+#define IB_MPR_COMPMASK_DGIDCOUNT (CL_HTON64(((uint64_t)1)<<20))\r
+#define IB_MPR_COMPMASK_RESV4 (CL_HTON64(((uint64_t)1)<<21))\r
+\r
+/* SMInfo Record Component Masks */\r
+#define IB_SMIR_COMPMASK_LID (CL_HTON64(((uint64_t)1)<<0))\r
+#define IB_SMIR_COMPMASK_RESV0 (CL_HTON64(((uint64_t)1)<<1))\r
+#define IB_SMIR_COMPMASK_GUID (CL_HTON64(((uint64_t)1)<<2))\r
+#define IB_SMIR_COMPMASK_SMKEY (CL_HTON64(((uint64_t)1)<<3))\r
+#define IB_SMIR_COMPMASK_ACTCOUNT (CL_HTON64(((uint64_t)1)<<4))\r
+#define IB_SMIR_COMPMASK_PRIORITY (CL_HTON64(((uint64_t)1)<<5))\r
+#define IB_SMIR_COMPMASK_SMSTATE (CL_HTON64(((uint64_t)1)<<6))\r
+\r
+/* InformInfo Record Component Masks */\r
+#define IB_IIR_COMPMASK_SUBSCRIBERGID (CL_HTON64(((uint64_t)1)<<0))\r
+#define IB_IIR_COMPMASK_ENUM (CL_HTON64(((uint64_t)1)<<1))\r
+#define IB_IIR_COMPMASK_RESV0 (CL_HTON64(((uint64_t)1)<<2))\r
+#define IB_IIR_COMPMASK_GID (CL_HTON64(((uint64_t)1)<<3))\r
+#define IB_IIR_COMPMASK_LIDRANGEBEGIN (CL_HTON64(((uint64_t)1)<<4))\r
+#define IB_IIR_COMPMASK_LIDRANGEEND (CL_HTON64(((uint64_t)1)<<5))\r
+#define IB_IIR_COMPMASK_RESV1 (CL_HTON64(((uint64_t)1)<<6))\r
+#define IB_IIR_COMPMASK_ISGENERIC (CL_HTON64(((uint64_t)1)<<7))\r
+#define IB_IIR_COMPMASK_SUBSCRIBE (CL_HTON64(((uint64_t)1)<<8))\r
+#define IB_IIR_COMPMASK_TYPE (CL_HTON64(((uint64_t)1)<<9))\r
+#define IB_IIR_COMPMASK_TRAPNUMB (CL_HTON64(((uint64_t)1)<<10))\r
+#define IB_IIR_COMPMASK_DEVICEID (CL_HTON64(((uint64_t)1)<<10))\r
+#define IB_IIR_COMPMASK_QPN (CL_HTON64(((uint64_t)1)<<11))\r
+#define IB_IIR_COMPMASK_RESV2 (CL_HTON64(((uint64_t)1)<<12))\r
+#define IB_IIR_COMPMASK_RESPTIME (CL_HTON64(((uint64_t)1)<<13))\r
+#define IB_IIR_COMPMASK_RESV3 (CL_HTON64(((uint64_t)1)<<14))\r
+#define IB_IIR_COMPMASK_PRODTYPE (CL_HTON64(((uint64_t)1)<<15))\r
+#define IB_IIR_COMPMASK_VENDID (CL_HTON64(((uint64_t)1)<<15))\r
+\r
+/****f* IBA Base: Types/ib_path_rec_init_local\r
+* NAME\r
+* ib_path_rec_init_local\r
+*\r
+* DESCRIPTION\r
+* Initializes a subnet local path record.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE void AL_API\r
+ib_path_rec_init_local(\r
+ IN ib_path_rec_t* const p_rec,\r
+ IN const ib_gid_t* const p_dgid,\r
+ IN const ib_gid_t* const p_sgid,\r
+ IN const ib_net16_t dlid,\r
+ IN const ib_net16_t slid,\r
+ IN const uint8_t num_path,\r
+ IN const ib_net16_t pkey,\r
+ IN const uint8_t sl,\r
+ IN const uint8_t mtu_selector,\r
+ IN const uint8_t mtu,\r
+ IN const uint8_t rate_selector,\r
+ IN const uint8_t rate,\r
+ IN const uint8_t pkt_life_selector,\r
+ IN const uint8_t pkt_life,\r
+ IN const uint8_t preference )\r
+{\r
+ p_rec->dgid = *p_dgid;\r
+ p_rec->sgid = *p_sgid;\r
+ p_rec->dlid = dlid;\r
+ p_rec->slid = slid;\r
+ p_rec->num_path = num_path;\r
+ p_rec->pkey = pkey;\r
+ /* Lower 4 bits of path rec's SL are reserved. */\r
+ p_rec->sl = cl_ntoh16( sl );\r
+ p_rec->mtu = (uint8_t)((mtu & IB_PATH_REC_BASE_MASK) |\r
+ (uint8_t)(mtu_selector << 6));\r
+ p_rec->rate = (uint8_t)((rate & IB_PATH_REC_BASE_MASK) |\r
+ (uint8_t)(rate_selector << 6));\r
+ p_rec->pkt_life = (uint8_t)((pkt_life & IB_PATH_REC_BASE_MASK) |\r
+ (uint8_t)(pkt_life_selector << 6));\r
+ p_rec->preference = preference;\r
+\r
+ /* Clear global routing fields for local path records */\r
+ p_rec->hop_flow_raw.val = 0;\r
+ p_rec->tclass = 0;\r
+\r
+ p_rec->resv0 = 0;\r
+ p_rec->resv1 = 0;\r
+ p_rec->resv2 = 0;\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_rec\r
+* [in] Pointer to the path record object.\r
+*\r
+* dgid\r
+* [in] GID of destination port.\r
+*\r
+* sgid\r
+* [in] GID of source port.\r
+*\r
+* dlid\r
+* [in] LID of destination port.\r
+*\r
+* slid\r
+* [in] LID of source port.\r
+*\r
+* num_path\r
+* [in] Reversible path - 1 bit to say if path is reversible.\r
+* num_path [6:0] In queries, maximum number of paths to return.\r
+* In responses, undefined.\r
+*\r
+* pkey\r
+* [in] Partition key (P_Key) to use on this path.\r
+*\r
+* sl\r
+* [in] Service level to use on this path. Lower 4-bits are valid.\r
+*\r
+* mtu_selector\r
+* [in] Encoded MTU selector value to use on this path\r
+*\r
+* mtu\r
+* [in] Encoded MTU to use on this path\r
+*\r
+* rate_selector\r
+* [in] Encoded rate selector value to use on this path.\r
+*\r
+* rate\r
+* [in] Encoded rate to use on this path.\r
+*\r
+* pkt_life_selector\r
+* [in] Encoded Packet selector value lifetime for this path.\r
+*\r
+* pkt_life\r
+* [in] Encoded Packet lifetime for this path.\r
+*\r
+* preference\r
+* [in] Indicates the relative merit of this path versus other path\r
+* records returned from the SA. Lower numbers are better.\r
+*\r
+* RETURN VALUES\r
+* None.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+* ib_gid_t\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_path_rec_num_path\r
+* NAME\r
+* ib_path_rec_num_path\r
+*\r
+* DESCRIPTION\r
+* Get max number of paths to return.\r
+*\r
+* SYNOPSIS\r
+*/\r
+static inline uint8_t \r
+ib_path_rec_num_path(\r
+ IN const ib_path_rec_t* const p_rec )\r
+{\r
+ return( p_rec->num_path &0x7F );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_rec\r
+* [in] Pointer to the path record object.\r
+*\r
+* RETURN VALUES\r
+* Maximum number of paths to return for each unique SGID_DGID combination.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+* ib_path_rec_t\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_path_rec_sl\r
+* NAME\r
+* ib_path_rec_sl\r
+*\r
+* DESCRIPTION\r
+* Get path service level.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE uint8_t AL_API\r
+ib_path_rec_sl(\r
+ IN const ib_path_rec_t* const p_rec )\r
+{\r
+ return( (uint8_t)((cl_ntoh16( p_rec->sl )) & 0xF) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_rec\r
+* [in] Pointer to the path record object.\r
+*\r
+* RETURN VALUES\r
+* SL.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+* ib_path_rec_t\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_path_rec_mtu\r
+* NAME\r
+* ib_path_rec_mtu\r
+*\r
+* DESCRIPTION\r
+* Get encoded path MTU.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE uint8_t AL_API\r
+ib_path_rec_mtu(\r
+ IN const ib_path_rec_t* const p_rec )\r
+{\r
+ return( (uint8_t)(p_rec->mtu & IB_PATH_REC_BASE_MASK) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_rec\r
+* [in] Pointer to the path record object.\r
+*\r
+* RETURN VALUES\r
+* Encoded path MTU.\r
+* 1: 256\r
+* 2: 512\r
+* 3: 1024\r
+* 4: 2048\r
+* 5: 4096\r
+* others: reserved\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+* ib_path_rec_t\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_path_rec_mtu_sel\r
+* NAME\r
+* ib_path_rec_mtu_sel\r
+*\r
+* DESCRIPTION\r
+* Get encoded path MTU selector.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE uint8_t AL_API\r
+ib_path_rec_mtu_sel(\r
+ IN const ib_path_rec_t* const p_rec )\r
+{\r
+ return( (uint8_t)((p_rec->mtu & IB_PATH_REC_SELECTOR_MASK) >> 6) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_rec\r
+* [in] Pointer to the path record object.\r
+*\r
+* RETURN VALUES\r
+* Encoded path MTU selector value (for queries).\r
+* 0: greater than MTU specified\r
+* 1: less than MTU specified\r
+* 2: exactly the MTU specified\r
+* 3: largest MTU available\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+* ib_path_rec_t\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_path_rec_rate\r
+* NAME\r
+* ib_path_rec_rate\r
+*\r
+* DESCRIPTION\r
+* Get encoded path rate.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE uint8_t AL_API\r
+ib_path_rec_rate(\r
+ IN const ib_path_rec_t* const p_rec )\r
+{\r
+ return( (uint8_t)(p_rec->rate & IB_PATH_REC_BASE_MASK) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_rec\r
+* [in] Pointer to the path record object.\r
+*\r
+* RETURN VALUES\r
+* Encoded path rate.\r
+* 2: 2.5 Gb/sec.\r
+* 3: 10 Gb/sec.\r
+* 4: 30 Gb/sec.\r
+* 5: 5 Gb/sec.\r
+* 6: 20 Gb/sec.\r
+* 7: 40 Gb/sec.\r
+* 8: 60 Gb/sec.\r
+* 9: 80 Gb/sec.\r
+* 10: 120 Gb/sec.\r
+* others: reserved\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+* ib_path_rec_t\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_path_rec_rate_sel\r
+* NAME\r
+* ib_path_rec_rate_sel\r
+*\r
+* DESCRIPTION\r
+* Get encoded path rate selector.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE uint8_t AL_API\r
+ib_path_rec_rate_sel(\r
+ IN const ib_path_rec_t* const p_rec )\r
+{\r
+ return( (uint8_t)((p_rec->rate & IB_PATH_REC_SELECTOR_MASK) >> 6) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_rec\r
+* [in] Pointer to the path record object.\r
+*\r
+* RETURN VALUES\r
+* Encoded path rate selector value (for queries).\r
+* 0: greater than rate specified\r
+* 1: less than rate specified\r
+* 2: exactly the rate specified\r
+* 3: largest rate available\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+* ib_path_rec_t\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_path_rec_pkt_life\r
+* NAME\r
+* ib_path_rec_pkt_life\r
+*\r
+* DESCRIPTION\r
+* Get encoded path pkt_life.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE uint8_t AL_API\r
+ib_path_rec_pkt_life(\r
+ IN const ib_path_rec_t* const p_rec )\r
+{\r
+ return( (uint8_t)(p_rec->pkt_life & IB_PATH_REC_BASE_MASK) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_rec\r
+* [in] Pointer to the path record object.\r
+*\r
+* RETURN VALUES\r
+* Encoded path pkt_life = 4.096 µsec * 2 ** PacketLifeTime.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+* ib_path_rec_t\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_path_rec_pkt_life_sel\r
+* NAME\r
+* ib_path_rec_pkt_life_sel\r
+*\r
+* DESCRIPTION\r
+* Get encoded path pkt_lifetime selector.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE uint8_t AL_API\r
+ib_path_rec_pkt_life_sel(\r
+ IN const ib_path_rec_t* const p_rec )\r
+{\r
+ return( (uint8_t)((p_rec->pkt_life & IB_PATH_REC_SELECTOR_MASK) >> 6 ));\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_rec\r
+* [in] Pointer to the path record object.\r
+*\r
+* RETURN VALUES\r
+* Encoded path pkt_lifetime selector value (for queries).\r
+* 0: greater than rate specified\r
+* 1: less than rate specified\r
+* 2: exactly the rate specified\r
+* 3: smallest packet lifetime available\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+* ib_path_rec_t\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_path_rec_flow_lbl\r
+* NAME\r
+* ib_path_rec_flow_lbl\r
+*\r
+* DESCRIPTION\r
+* Get flow label.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE net32_t AL_API\r
+ib_path_rec_flow_lbl(\r
+ IN const ib_path_rec_t* const p_rec )\r
+{\r
+ return( cl_hton32( (cl_ntoh32(p_rec->hop_flow_raw.val) >> 8) & 0x000FFFFF ) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_rec\r
+* [in] Pointer to the path record object.\r
+*\r
+* RETURN VALUES\r
+* Flow label of the path record.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+* ib_path_rec_t\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_path_rec_hop_limit\r
+* NAME\r
+* ib_path_rec_hop_limit\r
+*\r
+* DESCRIPTION\r
+* Get hop limit.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE uint8_t AL_API\r
+ib_path_rec_hop_limit(\r
+ IN const ib_path_rec_t* const p_rec )\r
+{\r
+ return( p_rec->hop_flow_raw.bytes[3] );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_rec\r
+* [in] Pointer to the path record object.\r
+*\r
+* RETURN VALUES\r
+* Hop limit of the path record.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+* ib_path_rec_t\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_path_rec_set_hop_flow_raw\r
+* NAME\r
+* ib_path_rec_set_hop_flow_raw\r
+*\r
+* DESCRIPTION\r
+* Sets the hop limit, flow label, and raw traffic bits of a path record.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE void AL_API\r
+ib_path_rec_set_hop_flow_raw(\r
+ OUT ib_path_rec_t* const p_rec,\r
+ IN const uint8_t hop_limit,\r
+ IN const net32_t flow_lbl,\r
+ IN const boolean_t raw )\r
+{\r
+ p_rec->hop_flow_raw.val = (cl_ntoh32( flow_lbl ) & 0x000FFFFF) << 8;\r
+ if( raw )\r
+ p_rec->hop_flow_raw.val |= 0x80000000;\r
+ p_rec->hop_flow_raw.val = cl_hton32( p_rec->hop_flow_raw.val );\r
+ p_rec->hop_flow_raw.bytes[3] = hop_limit;\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_rec\r
+* Pointer to the path record whose hop limit, flow label, and rab\r
+* traffic fields to set.\r
+*\r
+* hop_limit\r
+* Hop limit to set in the path record.\r
+*\r
+* flow_lbl\r
+* Flow label, in network byte order, to set in the path record.\r
+*\r
+* raw\r
+* Boolean flag to indicate whether the path record is for raw traffic.\r
+*\r
+* SEE ALSO\r
+* ib_path_rec_t\r
+*********/\r
+\r
+\r
+/****s* IBA Base: Constants/IB_CLASS_CAP_TRAP\r
+* NAME\r
+* IB_CLASS_CAP_TRAP\r
+*\r
+* DESCRIPTION\r
+* ClassPortInfo CapabilityMask bits. This bit will be set\r
+* if the class supports Trap() MADs (13.4.8.1).\r
+*\r
+* SEE ALSO\r
+* ib_class_port_info_t, IB_CLASS_CAP_GETSET\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_CLASS_CAP_TRAP 0x0001\r
+/*********/\r
+\r
+/****s* IBA Base: Constants/IB_CLASS_CAP_GETSET\r
+* NAME\r
+* IB_CLASS_CAP_GETSET\r
+*\r
+* DESCRIPTION\r
+* ClassPortInfo CapabilityMask bits. This bit will be set\r
+* if the class supports Get(Notice) and Set(Notice) MADs (13.4.8.1).\r
+*\r
+* SEE ALSO\r
+* ib_class_port_info_t, IB_CLASS_CAP_TRAP\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_CLASS_CAP_GETSET 0x0002\r
+/*********/\r
+\r
+/****s* IBA Base: Constants/IB_CLASS_RESP_TIME_MASK\r
+* NAME\r
+* IB_CLASS_RESP_TIME_MASK\r
+*\r
+* DESCRIPTION\r
+* Mask bits to extract the reponse time value from the\r
+* resp_time_val field of ib_class_port_info_t.\r
+*\r
+* SEE ALSO\r
+* ib_class_port_info_t\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_CLASS_RESP_TIME_MASK 0x1F\r
+/*********/\r
+/****s* IBA Base: Types/ib_class_port_info_t\r
+* NAME\r
+* ib_class_port_info_t\r
+*\r
+* DESCRIPTION\r
+* IBA defined ClassPortInfo attribute (13.4.8.1)\r
+* route between two end-points on a subnet.\r
+*\r
+* SYNOPSIS\r
+*/\r
+#include <complib/cl_packon.h>\r
+typedef struct _ib_class_port_info\r
+{\r
+ uint8_t base_ver;\r
+ uint8_t class_ver;\r
+ ib_net16_t cap_mask;\r
+ ib_net32_t resp_time_val;\r
+ ib_gid_t redir_gid;\r
+ ib_net32_t redir_tc_sl_fl;\r
+ ib_net16_t redir_lid;\r
+ ib_net16_t redir_pkey;\r
+ ib_net32_t redir_qp;\r
+ ib_net32_t redir_qkey;\r
+ ib_gid_t trap_gid;\r
+ ib_net32_t trap_tc_sl_fl;\r
+ ib_net16_t trap_lid;\r
+ ib_net16_t trap_pkey;\r
+ ib_net32_t trap_hop_qp;\r
+ ib_net32_t trap_qkey;\r
+\r
+} PACK_SUFFIX ib_class_port_info_t;\r
+#include <complib/cl_packoff.h>\r
+/*\r
+* FIELDS\r
+* base_ver\r
+* Maximum supported MAD Base Version.\r
+*\r
+* class_ver\r
+* Maximum supported management class version.\r
+*\r
+* cap_mask\r
+* Supported capabilities of this management class.\r
+*\r
+* resp_time_value\r
+* Maximum expected response time.\r
+*\r
+* redr_gid\r
+* GID to use for redirection, or zero\r
+*\r
+* recdir_tc_sl_fl\r
+* Traffic class, service level and flow label the requester\r
+* should use if the service is redirected.\r
+*\r
+* redir_lid\r
+* LID used for redirection, or zero\r
+*\r
+* redir_pkey\r
+* P_Key used for redirection\r
+*\r
+* redir_qp\r
+* QP number used for redirection\r
+*\r
+* redir_qkey\r
+* Q_Key associated with the redirected QP. This shall be the\r
+* well known Q_Key value.\r
+*\r
+* trap_gid\r
+* GID value used for trap messages from this service.\r
+*\r
+* trap_tc_sl_fl\r
+* Traffic class, service level and flow label used for\r
+* trap messages originated by this service.\r
+*\r
+* trap_lid\r
+* LID used for trap messages, or zero\r
+*\r
+* trap_pkey\r
+* P_Key used for trap messages\r
+*\r
+* trap_hop_qp\r
+* Hop limit (upper 8 bits) and QP number used for trap messages\r
+*\r
+* trap_qkey\r
+* Q_Key associated with the trap messages QP.\r
+*\r
+* SEE ALSO\r
+* IB_CLASS_CAP_GETSET, IB_CLASS_CAP_TRAP\r
+*\r
+*********/\r
+\r
+/****s* IBA Base: Types/ib_sm_info_t\r
+* NAME\r
+* ib_sm_info_t\r
+*\r
+* DESCRIPTION\r
+* SMInfo structure (14.2.5.13).\r
+*\r
+* SYNOPSIS\r
+*/\r
+#include <complib/cl_packon.h>\r
+typedef struct _ib_sm_info\r
+{\r
+ ib_net64_t guid;\r
+ ib_net64_t sm_key;\r
+ ib_net32_t act_count;\r
+ uint8_t pri_state;\r
+\r
+} PACK_SUFFIX ib_sm_info_t;\r
+#include <complib/cl_packoff.h>\r
+/*\r
+* FIELDS\r
+* guid\r
+* Port GUID for this SM.\r
+*\r
+* sm_key\r
+* SM_Key of this SM.\r
+*\r
+* act_count\r
+* Activity counter used as a heartbeat.\r
+*\r
+* pri_state\r
+* Priority and State information\r
+*\r
+* SEE ALSO\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_sminfo_get_priority\r
+* NAME\r
+* ib_sminfo_get_priority\r
+*\r
+* DESCRIPTION\r
+* Returns the priority value.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE uint8_t AL_API\r
+ib_sminfo_get_priority(\r
+ IN const ib_sm_info_t* const p_smi )\r
+{\r
+ return( (uint8_t)((p_smi->pri_state & 0xF0)>>4) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_smi\r
+* [in] Pointer to the SMInfo Attribute.\r
+*\r
+* RETURN VALUES\r
+* Returns the priority value.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_sminfo_get_state\r
+* NAME\r
+* ib_sminfo_get_state\r
+*\r
+* DESCRIPTION\r
+* Returns the state value.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE uint8_t AL_API\r
+ib_sminfo_get_state(\r
+ IN const ib_sm_info_t* const p_smi )\r
+{\r
+ return( (uint8_t)(p_smi->pri_state & 0x0F) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_smi\r
+* [in] Pointer to the SMInfo Attribute.\r
+*\r
+* RETURN VALUES\r
+* Returns the state value.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+*********/\r
+\r
+/****s* IBA Base: Types/ib_mad_t\r
+* NAME\r
+* ib_mad_t\r
+*\r
+* DESCRIPTION\r
+* IBA defined MAD header (13.4.3)\r
+*\r
+* SYNOPSIS\r
+*/\r
+#include <complib/cl_packon.h>\r
+typedef struct _ib_mad\r
+{\r
+ uint8_t base_ver;\r
+ uint8_t mgmt_class;\r
+ uint8_t class_ver;\r
+ uint8_t method;\r
+ ib_net16_t status;\r
+ ib_net16_t class_spec;\r
+ ib_net64_t trans_id;\r
+ ib_net16_t attr_id;\r
+ ib_net16_t resv;\r
+ ib_net32_t attr_mod;\r
+} PACK_SUFFIX ib_mad_t;\r
+#include <complib/cl_packoff.h>\r
+/*\r
+* FIELDS\r
+* base_ver\r
+* MAD base format.\r
+*\r
+* mgmt_class\r
+* Class of operation.\r
+*\r
+* class_ver\r
+* Version of MAD class-specific format.\r
+*\r
+* method\r
+* Method to perform, including 'R' bit.\r
+*\r
+* status\r
+* Status of operation.\r
+*\r
+* class_spec\r
+* Reserved for subnet management.\r
+*\r
+* trans_id\r
+* Transaction ID.\r
+*\r
+* attr_id\r
+* Attribute ID.\r
+*\r
+* resv\r
+* Reserved field.\r
+*\r
+* attr_mod\r
+* Attribute modifier.\r
+*\r
+* SEE ALSO\r
+*********/\r
+\r
+\r
+/****s* IBA Base: Types/ib_rmpp_mad_t\r
+* NAME\r
+* ib_rmpp_mad_t\r
+*\r
+* DESCRIPTION\r
+* IBA defined MAD RMPP header (13.6.2.1)\r
+*\r
+* SYNOPSIS\r
+*/\r
+#include <complib/cl_packon.h>\r
+typedef struct _ib_rmpp_mad\r
+{\r
+ ib_mad_t common_hdr;\r
+\r
+ uint8_t rmpp_version;\r
+ uint8_t rmpp_type;\r
+ uint8_t rmpp_flags;\r
+ uint8_t rmpp_status;\r
+\r
+ ib_net32_t seg_num;\r
+ ib_net32_t paylen_newwin;\r
+\r
+} PACK_SUFFIX ib_rmpp_mad_t;\r
+#include <complib/cl_packoff.h>\r
+/*\r
+* SEE ALSO\r
+* ib_mad_t\r
+*********/\r
+\r
+\r
+/****f* IBA Base: Types/ib_mad_init_new\r
+* NAME\r
+* ib_mad_init_new\r
+*\r
+* DESCRIPTION\r
+* Initializes a MAD common header.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE void AL_API\r
+ib_mad_init_new(\r
+ IN ib_mad_t* const p_mad,\r
+ IN const uint8_t mgmt_class,\r
+ IN const uint8_t class_ver,\r
+ IN const uint8_t method,\r
+ IN const ib_net64_t trans_id,\r
+ IN const ib_net16_t attr_id,\r
+ IN const ib_net32_t attr_mod )\r
+{\r
+ CL_ASSERT( p_mad );\r
+ p_mad->base_ver = 1;\r
+ p_mad->mgmt_class = mgmt_class;\r
+ p_mad->class_ver = class_ver;\r
+ p_mad->method = method;\r
+ p_mad->status = 0;\r
+ p_mad->class_spec = 0;\r
+ p_mad->trans_id = trans_id;\r
+ p_mad->attr_id = attr_id;\r
+ p_mad->resv = 0;\r
+ p_mad->attr_mod = attr_mod;\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_mad\r
+* [in] Pointer to the MAD common header.\r
+*\r
+* mgmt_class\r
+* [in] Class of operation.\r
+*\r
+* class_ver\r
+* [in] Version of MAD class-specific format.\r
+*\r
+* method\r
+* [in] Method to perform, including 'R' bit.\r
+*\r
+* trans_Id\r
+* [in] Transaction ID.\r
+*\r
+* attr_id\r
+* [in] Attribute ID.\r
+*\r
+* attr_mod\r
+* [in] Attribute modifier.\r
+*\r
+* RETURN VALUES\r
+* None.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+* ib_mad_t\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_mad_init_response\r
+* NAME\r
+* ib_mad_init_response\r
+*\r
+* DESCRIPTION\r
+* Initializes a MAD common header as a response.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE void AL_API\r
+ib_mad_init_response(\r
+ IN const ib_mad_t* const p_req_mad,\r
+ IN ib_mad_t* const p_mad,\r
+ IN const ib_net16_t status )\r
+{\r
+ CL_ASSERT( p_req_mad );\r
+ CL_ASSERT( p_mad );\r
+ *p_mad = *p_req_mad;\r
+ p_mad->status = status;\r
+ if( p_mad->method == IB_MAD_METHOD_SET )\r
+ p_mad->method = IB_MAD_METHOD_GET;\r
+ p_mad->method |= IB_MAD_METHOD_RESP_MASK;\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_req_mad\r
+* [in] Pointer to the MAD common header in the original request MAD.\r
+*\r
+* p_mad\r
+* [in] Pointer to the MAD common header to initialize.\r
+*\r
+* status\r
+* [in] MAD Status value to return;\r
+*\r
+* RETURN VALUES\r
+* None.\r
+*\r
+* NOTES\r
+* p_req_mad and p_mad may point to the same MAD.\r
+*\r
+* SEE ALSO\r
+* ib_mad_t\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_mad_is_response\r
+* NAME\r
+* ib_mad_is_response\r
+*\r
+* DESCRIPTION\r
+* Returns TRUE if the MAD is a response ('R' bit set),\r
+* FALSE otherwise.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE boolean_t AL_API\r
+ib_mad_is_response(\r
+ IN const ib_mad_t* const p_mad )\r
+{\r
+ CL_ASSERT( p_mad );\r
+ return( (p_mad->method & IB_MAD_METHOD_RESP_MASK) ==\r
+ IB_MAD_METHOD_RESP_MASK );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_mad\r
+* [in] Pointer to the MAD.\r
+*\r
+* RETURN VALUES\r
+* Returns TRUE if the MAD is a response ('R' bit set),\r
+* FALSE otherwise.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+* ib_mad_t\r
+*********/\r
+\r
+#define IB_RMPP_TYPE_DATA 1\r
+#define IB_RMPP_TYPE_ACK 2\r
+#define IB_RMPP_TYPE_STOP 3\r
+#define IB_RMPP_TYPE_ABORT 4\r
+\r
+#define IB_RMPP_NO_RESP_TIME 0x1F\r
+#define IB_RMPP_FLAG_ACTIVE 0x01\r
+#define IB_RMPP_FLAG_FIRST 0x02\r
+#define IB_RMPP_FLAG_LAST 0x04\r
+\r
+#define IB_RMPP_STATUS_SUCCESS 0\r
+#define IB_RMPP_STATUS_RESX 1 /* resources exhausted */\r
+#define IB_RMPP_STATUS_T2L 118 /* time too long */\r
+#define IB_RMPP_STATUS_BAD_LEN 119 /* incon. last and payload len */\r
+#define IB_RMPP_STATUS_BAD_SEG 120 /* incon. first and segment no */\r
+#define IB_RMPP_STATUS_BADT 121 /* bad rmpp type */\r
+#define IB_RMPP_STATUS_W2S 122 /* newwindowlast too small */\r
+#define IB_RMPP_STATUS_S2B 123 /* segment no too big */\r
+#define IB_RMPP_STATUS_BAD_STATUS 124 /* illegal status */\r
+#define IB_RMPP_STATUS_UNV 125 /* unsupported version */\r
+#define IB_RMPP_STATUS_TMR 126 /* too many retries */\r
+#define IB_RMPP_STATUS_UNSPEC 127 /* unspecified */\r
+\r
+/****f* IBA Base: Types/ib_rmpp_is_flag_set\r
+* NAME\r
+* ib_rmpp_is_flag_set\r
+*\r
+* DESCRIPTION\r
+* Returns TRUE if the MAD has the given RMPP flag set.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE boolean_t AL_API\r
+ib_rmpp_is_flag_set(\r
+ IN const ib_rmpp_mad_t* const p_rmpp_mad,\r
+ IN const uint8_t flag )\r
+{\r
+ CL_ASSERT( p_rmpp_mad );\r
+ return( (p_rmpp_mad->rmpp_flags & flag) == flag );\r
+}\r
+/*\r
+* PARAMETERS\r
+* ib_rmpp_mad_t\r
+* [in] Pointer to a MAD with an RMPP header.\r
+*\r
+* flag\r
+* [in] The RMPP flag being examined.\r
+*\r
+* RETURN VALUES\r
+* Returns TRUE if the MAD has the given RMPP flag set.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+* ib_mad_t, ib_rmpp_mad_t\r
+*********/\r
+\r
+AL_INLINE void AL_API\r
+ib_rmpp_set_resp_time(\r
+ IN ib_rmpp_mad_t* const p_rmpp_mad,\r
+ IN const uint8_t resp_time )\r
+{\r
+ CL_ASSERT( p_rmpp_mad );\r
+ p_rmpp_mad->rmpp_flags |= (resp_time << 3);\r
+}\r
+\r
+\r
+AL_INLINE uint8_t AL_API\r
+ib_rmpp_get_resp_time(\r
+ IN const ib_rmpp_mad_t* const p_rmpp_mad )\r
+{\r
+ CL_ASSERT( p_rmpp_mad );\r
+ return( (uint8_t)(p_rmpp_mad->rmpp_flags >> 3) );\r
+}\r
+\r
+/****d* IBA Base: Constants/IB_SMP_DIRECTION\r
+* NAME\r
+* IB_SMP_DIRECTION\r
+*\r
+* DESCRIPTION\r
+* The Direction bit for directed route SMPs.\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_SMP_DIRECTION_HO 0x8000\r
+#define IB_SMP_DIRECTION (CL_HTON16(IB_SMP_DIRECTION_HO))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_SMP_STATUS_MASK\r
+* NAME\r
+* IB_SMP_STATUS_MASK\r
+*\r
+* DESCRIPTION\r
+* Mask value for extracting status from a directed route SMP.\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_SMP_STATUS_MASK_HO 0x7FFF\r
+#define IB_SMP_STATUS_MASK (CL_HTON16(IB_SMP_STATUS_MASK_HO))\r
+/**********/\r
+\r
+/****s* IBA Base: Types/ib_smp_t\r
+* NAME\r
+* ib_smp_t\r
+*\r
+* DESCRIPTION\r
+* IBA defined SMP. (14.2.1.2)\r
+*\r
+* SYNOPSIS\r
+*/\r
+#define IB_SMP_DATA_SIZE 64\r
+#include <complib/cl_packon.h>\r
+typedef struct _ib_smp\r
+{\r
+ uint8_t base_ver;\r
+ uint8_t mgmt_class;\r
+ uint8_t class_ver;\r
+ uint8_t method;\r
+ ib_net16_t status;\r
+ uint8_t hop_ptr;\r
+ uint8_t hop_count;\r
+ ib_net64_t trans_id;\r
+ ib_net16_t attr_id;\r
+ ib_net16_t resv;\r
+ ib_net32_t attr_mod;\r
+ ib_net64_t m_key;\r
+ ib_net16_t dr_slid;\r
+ ib_net16_t dr_dlid;\r
+ uint32_t resv1[7];\r
+ uint8_t data[IB_SMP_DATA_SIZE];\r
+ uint8_t initial_path[IB_SUBNET_PATH_HOPS_MAX];\r
+ uint8_t return_path[IB_SUBNET_PATH_HOPS_MAX];\r
+\r
+} PACK_SUFFIX ib_smp_t;\r
+#include <complib/cl_packoff.h>\r
+/*\r
+* FIELDS\r
+* base_ver\r
+* MAD base format.\r
+*\r
+* mgmt_class\r
+* Class of operation.\r
+*\r
+* class_ver\r
+* Version of MAD class-specific format.\r
+*\r
+* method\r
+* Method to perform, including 'R' bit.\r
+*\r
+* status\r
+* Status of operation.\r
+*\r
+* hop_ptr\r
+* Hop pointer for directed route MADs.\r
+*\r
+* hop_count\r
+* Hop count for directed route MADs.\r
+*\r
+* trans_Id\r
+* Transaction ID.\r
+*\r
+* attr_id\r
+* Attribute ID.\r
+*\r
+* resv\r
+* Reserved field.\r
+*\r
+* attr_mod\r
+* Attribute modifier.\r
+*\r
+* m_key\r
+* Management key value.\r
+*\r
+* dr_slid\r
+* Directed route source LID.\r
+*\r
+* dr_dlid\r
+* Directed route destination LID.\r
+*\r
+* resv0\r
+* Reserved for 64 byte alignment.\r
+*\r
+* data\r
+* MAD data payload.\r
+*\r
+* initial_path\r
+* Outbound port list.\r
+*\r
+* return_path\r
+* Inbound port list.\r
+*\r
+* SEE ALSO\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_smp_get_status\r
+* NAME\r
+* ib_smp_get_status\r
+*\r
+* DESCRIPTION\r
+* Returns the SMP status value in network order.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE ib_net16_t AL_API\r
+ib_smp_get_status(\r
+ IN const ib_smp_t* const p_smp )\r
+{\r
+ return( (ib_net16_t)(p_smp->status & IB_SMP_STATUS_MASK) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_smp\r
+* [in] Pointer to the SMP packet.\r
+*\r
+* RETURN VALUES\r
+* Returns the SMP status value in network order.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+* ib_smp_t\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_smp_is_response\r
+* NAME\r
+* ib_smp_is_response\r
+*\r
+* DESCRIPTION\r
+* Returns TRUE if the SMP is a response MAD, FALSE otherwise.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE boolean_t AL_API\r
+ib_smp_is_response(\r
+ IN const ib_smp_t* const p_smp )\r
+{\r
+ return( ib_mad_is_response( (const ib_mad_t*)p_smp ) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_smp\r
+* [in] Pointer to the SMP packet.\r
+*\r
+* RETURN VALUES\r
+* Returns TRUE if the SMP is a response MAD, FALSE otherwise.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+* ib_smp_t\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_smp_is_d\r
+* NAME\r
+* ib_smp_is_d\r
+*\r
+* DESCRIPTION\r
+* Returns TRUE if the SMP 'D' (direction) bit is set.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE boolean_t AL_API\r
+ib_smp_is_d(\r
+ IN const ib_smp_t* const p_smp )\r
+{\r
+ return( (p_smp->status & IB_SMP_DIRECTION) == IB_SMP_DIRECTION );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_smp\r
+* [in] Pointer to the SMP packet.\r
+*\r
+* RETURN VALUES\r
+* Returns TRUE if the SMP 'D' (direction) bit is set.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+* ib_smp_t\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_smp_init_new\r
+* NAME\r
+* ib_smp_init_new\r
+*\r
+* DESCRIPTION\r
+* Initializes a MAD common header.\r
+*\r
+* TODO\r
+* This is too big for inlining, but leave it here for now\r
+* since there is not yet another convient spot.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE void AL_API\r
+ib_smp_init_new(\r
+ IN ib_smp_t* const p_smp,\r
+ IN const uint8_t method,\r
+ IN const ib_net64_t trans_id,\r
+ IN const ib_net16_t attr_id,\r
+ IN const ib_net32_t attr_mod,\r
+ IN const uint8_t hop_count,\r
+ IN const ib_net64_t m_key,\r
+ IN const uint8_t* path_out,\r
+ IN const ib_net16_t dr_slid,\r
+ IN const ib_net16_t dr_dlid )\r
+{\r
+ CL_ASSERT( p_smp );\r
+ CL_ASSERT( hop_count < IB_SUBNET_PATH_HOPS_MAX );\r
+ p_smp->base_ver = 1;\r
+ p_smp->mgmt_class = IB_MCLASS_SUBN_DIR;\r
+ p_smp->class_ver = 1;\r
+ p_smp->method = method;\r
+ p_smp->status = 0;\r
+ p_smp->hop_ptr = 0;\r
+ p_smp->hop_count = hop_count;\r
+ p_smp->trans_id = trans_id;\r
+ p_smp->attr_id = attr_id;\r
+ p_smp->resv = 0;\r
+ p_smp->attr_mod = attr_mod;\r
+ p_smp->m_key = m_key;\r
+ p_smp->dr_slid = dr_slid;\r
+ p_smp->dr_dlid = dr_dlid;\r
+\r
+ cl_memclr( p_smp->resv1,\r
+ sizeof(p_smp->resv1) +\r
+ sizeof(p_smp->data) +\r
+ sizeof(p_smp->initial_path) +\r
+ sizeof(p_smp->return_path) );\r
+\r
+ /* copy the path */\r
+ cl_memcpy( &p_smp->initial_path, path_out,\r
+ sizeof( p_smp->initial_path ) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_smp\r
+* [in] Pointer to the SMP packet.\r
+*\r
+* method\r
+* [in] Method to perform, including 'R' bit.\r
+*\r
+* trans_Id\r
+* [in] Transaction ID.\r
+*\r
+* attr_id\r
+* [in] Attribute ID.\r
+*\r
+* attr_mod\r
+* [in] Attribute modifier.\r
+*\r
+* hop_count\r
+* [in] Number of hops in the path.\r
+*\r
+* m_key\r
+* [in] Management key for this SMP.\r
+*\r
+* path_out\r
+* [in] Port array for outbound path.\r
+*\r
+*\r
+* RETURN VALUES\r
+* None.\r
+*\r
+* NOTES\r
+* Payload area is initialized to zero.\r
+*\r
+*\r
+* SEE ALSO\r
+* ib_mad_t\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_smp_get_payload_ptr\r
+* NAME\r
+* ib_smp_get_payload_ptr\r
+*\r
+* DESCRIPTION\r
+* Gets a pointer to the SMP payload area.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE void* AL_API\r
+ib_smp_get_payload_ptr(\r
+ IN const ib_smp_t* const p_smp )\r
+{\r
+ return( (void*)p_smp->data );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_smp\r
+* [in] Pointer to the SMP packet.\r
+*\r
+* RETURN VALUES\r
+* Pointer to SMP payload area.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+* ib_mad_t\r
+*********/\r
+\r
+/****s* IBA Base: Types/ib_node_info_t\r
+* NAME\r
+* ib_node_info_t\r
+*\r
+* DESCRIPTION\r
+* IBA defined NodeInfo. (14.2.5.3)\r
+*\r
+* SYNOPSIS\r
+*/\r
+#include <complib/cl_packon.h>\r
+typedef struct _ib_node_info\r
+{\r
+ uint8_t base_version;\r
+ uint8_t class_version;\r
+ uint8_t node_type;\r
+ uint8_t num_ports;\r
+ ib_net64_t sys_guid;\r
+ ib_net64_t node_guid;\r
+ ib_net64_t port_guid;\r
+ ib_net16_t partition_cap;\r
+ ib_net16_t device_id;\r
+ ib_net32_t revision;\r
+ ib_net32_t port_num_vendor_id;\r
+\r
+} PACK_SUFFIX ib_node_info_t;\r
+#include <complib/cl_packoff.h>\r
+/************/\r
+\r
+/****s* IBA Base: Types/ib_sa_mad_t\r
+* NAME\r
+* ib_sa_mad_t\r
+*\r
+* DESCRIPTION\r
+* IBA defined SA MAD format. (15.2.1)\r
+*\r
+* SYNOPSIS\r
+*/\r
+#define IB_SA_DATA_SIZE 200\r
+\r
+#include <complib/cl_packon.h>\r
+typedef struct _ib_sa_mad\r
+{\r
+ uint8_t base_ver;\r
+ uint8_t mgmt_class;\r
+ uint8_t class_ver;\r
+ uint8_t method;\r
+ ib_net16_t status;\r
+ ib_net16_t resv;\r
+ ib_net64_t trans_id;\r
+ ib_net16_t attr_id;\r
+ ib_net16_t resv1;\r
+ ib_net32_t attr_mod;\r
+\r
+ uint8_t rmpp_version;\r
+ uint8_t rmpp_type;\r
+ uint8_t rmpp_flags;\r
+ uint8_t rmpp_status;\r
+\r
+ ib_net32_t seg_num;\r
+ ib_net32_t paylen_newwin;\r
+\r
+ ib_net64_t sm_key;\r
+\r
+ ib_net16_t attr_offset;\r
+ ib_net16_t resv3;\r
+\r
+ ib_net64_t comp_mask;\r
+\r
+ uint8_t data[IB_SA_DATA_SIZE];\r
+} PACK_SUFFIX ib_sa_mad_t;\r
+#include <complib/cl_packoff.h>\r
+/**********/\r
+#define IB_SA_MAD_HDR_SIZE (sizeof(ib_sa_mad_t) - IB_SA_DATA_SIZE)\r
+\r
+\r
+\r
+AL_INLINE uint32_t AL_API\r
+ib_get_attr_size(\r
+ IN const ib_net16_t attr_offset )\r
+{\r
+ return( ((uint32_t)cl_ntoh16( attr_offset )) << 3 );\r
+}\r
+\r
+AL_INLINE ib_net16_t AL_API\r
+ib_get_attr_offset(\r
+ IN const uint32_t attr_size )\r
+{\r
+ if( attr_size & 0x07 )\r
+ return( cl_hton16( (uint16_t)(attr_size >> 3) + 1 ) );\r
+ else\r
+ return( cl_hton16( (uint16_t)(attr_size >> 3) ) );\r
+}\r
+\r
+/****f* IBA Base: Types/ib_sa_mad_get_payload_ptr\r
+* NAME\r
+* ib_sa_mad_get_payload_ptr\r
+*\r
+* DESCRIPTION\r
+* Gets a pointer to the SA MAD's payload area.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE void* AL_API\r
+ib_sa_mad_get_payload_ptr(\r
+ IN const ib_sa_mad_t* const p_sa_mad )\r
+{\r
+ return( (void*)p_sa_mad->data );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_smp\r
+* [in] Pointer to the SA MAD packet.\r
+*\r
+* RETURN VALUES\r
+* Pointer to SA MAD payload area.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+* ib_mad_t\r
+*********/\r
+\r
+#define IB_NODE_INFO_PORT_NUM_MASK (CL_NTOH32(0xFF000000))\r
+#define IB_NODE_INFO_VEND_ID_MASK (CL_NTOH32(0x00FFFFFF))\r
+#if CPU_LE\r
+ #define IB_NODE_INFO_PORT_NUM_SHIFT 0\r
+#else\r
+ #define IB_NODE_INFO_PORT_NUM_SHIFT 24\r
+#endif\r
+\r
+/****f* IBA Base: Types/ib_node_info_get_local_port_num\r
+* NAME\r
+* ib_node_info_get_local_port_num\r
+*\r
+* DESCRIPTION\r
+* Gets a the local port number from the NodeInfo attribute.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE uint8_t AL_API\r
+ib_node_info_get_local_port_num(\r
+ IN const ib_node_info_t* const p_ni )\r
+{\r
+ return( (uint8_t)(( p_ni->port_num_vendor_id &\r
+ IB_NODE_INFO_PORT_NUM_MASK )\r
+ >> IB_NODE_INFO_PORT_NUM_SHIFT ));\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_ni\r
+* [in] Pointer to a NodeInfo attribute.\r
+*\r
+* RETURN VALUES\r
+* Local port number that returned the attribute.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+* ib_node_info_t\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_node_info_get_vendor_id\r
+* NAME\r
+* ib_node_info_get_vendor_id\r
+*\r
+* DESCRIPTION\r
+* Gets the VendorID from the NodeInfo attribute.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE ib_net32_t AL_API\r
+ib_node_info_get_vendor_id(\r
+ IN const ib_node_info_t* const p_ni )\r
+{\r
+ return( (ib_net32_t)( p_ni->port_num_vendor_id &\r
+ IB_NODE_INFO_VEND_ID_MASK ) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_ni\r
+* [in] Pointer to a NodeInfo attribute.\r
+*\r
+* RETURN VALUES\r
+* VendorID that returned the attribute.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+* ib_node_info_t\r
+*********/\r
+\r
+#define IB_NODE_DESCRIPTION_SIZE 64\r
+\r
+#include <complib/cl_packon.h>\r
+typedef struct _ib_node_desc\r
+{\r
+ // Node String is an array of UTF-8 character that\r
+ // describes the node in text format\r
+ // Note that this string is NOT NULL TERMINATED!\r
+ uint8_t description[IB_NODE_DESCRIPTION_SIZE];\r
+\r
+} PACK_SUFFIX ib_node_desc_t;\r
+#include <complib/cl_packoff.h>\r
+\r
+#include <complib/cl_packon.h>\r
+typedef struct _ib_node_record_t\r
+{\r
+ ib_net16_t lid;\r
+ ib_net16_t resv;\r
+ ib_node_info_t node_info;\r
+ ib_node_desc_t node_desc;\r
+ uint8_t pad[4];\r
+\r
+} PACK_SUFFIX ib_node_record_t;\r
+#include <complib/cl_packoff.h>\r
+\r
+/****s* IBA Base: Types/ib_port_info_t\r
+* NAME\r
+* ib_port_info_t\r
+*\r
+* DESCRIPTION\r
+* IBA defined PortInfo. (14.2.5.6)\r
+*\r
+* SYNOPSIS\r
+*/\r
+#include <complib/cl_packon.h>\r
+typedef struct _ib_port_info\r
+{\r
+ ib_net64_t m_key;\r
+ ib_net64_t subnet_prefix;\r
+ ib_net16_t base_lid;\r
+ ib_net16_t master_sm_base_lid;\r
+ ib_net32_t capability_mask;\r
+ ib_net16_t diag_code;\r
+ ib_net16_t m_key_lease_period;\r
+ uint8_t local_port_num;\r
+ uint8_t link_width_enabled;\r
+ uint8_t link_width_supported;\r
+ uint8_t link_width_active;\r
+ uint8_t state_info1; /* LinkSpeedSupported and PortState */\r
+ uint8_t state_info2; /* PortPhysState and LinkDownDefaultState */\r
+ uint8_t mkey_lmc;\r
+ uint8_t link_speed; /* LinkSpeedEnabled and LinkSpeedActive */\r
+ uint8_t mtu_smsl;\r
+ uint8_t vl_cap; /* VLCap and InitType */\r
+ uint8_t vl_high_limit;\r
+ uint8_t vl_arb_high_cap;\r
+ uint8_t vl_arb_low_cap;\r
+ uint8_t mtu_cap;\r
+ uint8_t vl_stall_life;\r
+ uint8_t vl_enforce;\r
+ ib_net16_t m_key_violations;\r
+ ib_net16_t p_key_violations;\r
+ ib_net16_t q_key_violations;\r
+ uint8_t guid_cap;\r
+ uint8_t subnet_timeout; /* cli_rereg(1b), resrv(\r
+2b), timeout(5b) */\r
+ uint8_t resp_time_value;\r
+ uint8_t error_threshold;\r
+\r
+} PACK_SUFFIX ib_port_info_t;\r
+#include <complib/cl_packoff.h>\r
+/************/\r
+\r
+#define IB_PORT_STATE_MASK 0x0F\r
+#define IB_PORT_LMC_MASK 0x07\r
+#define IB_PORT_LMC_MAX 0x07\r
+#define IB_PORT_MPB_MASK 0xC0\r
+#define IB_PORT_MPB_SHIFT 6\r
+#define IB_PORT_LINK_SPEED_SHIFT 4\r
+#define IB_PORT_LINK_SPEED_SUPPORTED_MASK 0xF0\r
+#define IB_PORT_LINK_SPEED_ACTIVE_MASK 0xF0\r
+#define IB_PORT_LINK_SPEED_ENABLED_MASK 0x0F\r
+#define IB_PORT_PHYS_STATE_MASK 0xF0\r
+#define IB_PORT_PHYS_STATE_SHIFT 4\r
+#define IB_PORT_LNKDWNDFTSTATE_MASK 0x0F\r
+\r
+#define IB_PORT_CAP_RESV0 (CL_NTOH32(0x00000001))\r
+#define IB_PORT_CAP_IS_SM (CL_NTOH32(0x00000002))\r
+#define IB_PORT_CAP_HAS_NOTICE (CL_NTOH32(0x00000004))\r
+#define IB_PORT_CAP_HAS_TRAP (CL_NTOH32(0x00000008))\r
+#define IB_PORT_CAP_HAS_IPD (CL_NTOH32(0x00000010))\r
+#define IB_PORT_CAP_HAS_AUTO_MIG (CL_NTOH32(0x00000020))\r
+#define IB_PORT_CAP_HAS_SL_MAP (CL_NTOH32(0x00000040))\r
+#define IB_PORT_CAP_HAS_NV_MKEY (CL_NTOH32(0x00000080))\r
+#define IB_PORT_CAP_HAS_NV_PKEY (CL_NTOH32(0x00000100))\r
+#define IB_PORT_CAP_HAS_LED_INFO (CL_NTOH32(0x00000200))\r
+#define IB_PORT_CAP_SM_DISAB (CL_NTOH32(0x00000400))\r
+#define IB_PORT_CAP_HAS_SYS_IMG_GUID (CL_NTOH32(0x00000800))\r
+#define IB_PORT_CAP_HAS_PKEY_SW_EXT_PORT_TRAP (CL_NTOH32(0x00001000))\r
+#define IB_PORT_CAP_RESV13 (CL_NTOH32(0x00002000))\r
+#define IB_PORT_CAP_RESV14 (CL_NTOH32(0x00004000))\r
+#define IB_PORT_CAP_RESV15 (CL_NTOH32(0x00008000))\r
+#define IB_PORT_CAP_HAS_COM_MGT (CL_NTOH32(0x00010000))\r
+#define IB_PORT_CAP_HAS_SNMP (CL_NTOH32(0x00020000))\r
+#define IB_PORT_CAP_REINIT (CL_NTOH32(0x00040000))\r
+#define IB_PORT_CAP_HAS_DEV_MGT (CL_NTOH32(0x00080000))\r
+#define IB_PORT_CAP_HAS_VEND_CLS (CL_NTOH32(0x00100000))\r
+#define IB_PORT_CAP_HAS_DR_NTC (CL_NTOH32(0x00200000))\r
+#define IB_PORT_CAP_HAS_CAP_NTC (CL_NTOH32(0x00400000))\r
+#define IB_PORT_CAP_HAS_BM (CL_NTOH32(0x00800000))\r
+#define IB_PORT_CAP_HAS_LINK_RT_LATENCY (CL_NTOH32(0x01000000))\r
+#define IB_PORT_CAP_HAS_CLIENT_REREG (CL_NTOH32(0x02000000))\r
+#define IB_PORT_CAP_RESV26 (CL_NTOH32(0x04000000))\r
+#define IB_PORT_CAP_RESV27 (CL_NTOH32(0x08000000))\r
+#define IB_PORT_CAP_RESV28 (CL_NTOH32(0x10000000))\r
+#define IB_PORT_CAP_RESV29 (CL_NTOH32(0x20000000))\r
+#define IB_PORT_CAP_RESV30 (CL_NTOH32(0x40000000))\r
+#define IB_PORT_CAP_RESV31 (CL_NTOH32(0x80000000))\r
+\r
+/****f* IBA Base: Types/ib_port_info_get_port_state\r
+* NAME\r
+* ib_port_info_get_port_state\r
+*\r
+* DESCRIPTION\r
+* Returns the port state.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE uint8_t AL_API\r
+ib_port_info_get_port_state(\r
+ IN const ib_port_info_t* const p_pi )\r
+{\r
+ return( (uint8_t)(p_pi->state_info1 & IB_PORT_STATE_MASK) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_pi\r
+* [in] Pointer to a PortInfo attribute.\r
+*\r
+* RETURN VALUES\r
+* Port state.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_port_info_set_port_state\r
+* NAME\r
+* ib_port_info_set_port_state\r
+*\r
+* DESCRIPTION\r
+* Sets the port state.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE void AL_API\r
+ib_port_info_set_port_state(\r
+ IN ib_port_info_t* const p_pi,\r
+ IN const uint8_t port_state )\r
+{\r
+ p_pi->state_info1 = (uint8_t)((p_pi->state_info1 & 0xF0) | port_state );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_pi\r
+* [in] Pointer to a PortInfo attribute.\r
+*\r
+* port_state\r
+* [in] Port state value to set.\r
+*\r
+* RETURN VALUES\r
+* None.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_port_info_get_vl_cap\r
+* NAME\r
+* ib_port_info_get_vl_cap\r
+*\r
+* DESCRIPTION\r
+* Gets the VL Capability of a port.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE uint8_t AL_API\r
+ib_port_info_get_vl_cap(\r
+ IN const ib_port_info_t* const p_pi)\r
+{\r
+ return((p_pi->vl_cap >> 4) & 0x0F);\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_pi\r
+* [in] Pointer to a PortInfo attribute.\r
+*\r
+* RETURN VALUES\r
+* VL_CAP field\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_port_info_get_init_type\r
+* NAME\r
+* ib_port_info_get_init_type\r
+*\r
+* DESCRIPTION\r
+* Gets the init type of a port.\r
+*\r
+* SYNOPSIS\r
+*/\r
+static inline uint8_t \r
+ib_port_info_get_init_type(\r
+ IN const ib_port_info_t* const p_pi)\r
+{\r
+ return (uint8_t) (p_pi->vl_cap & 0x0F);\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_pi\r
+* [in] Pointer to a PortInfo attribute.\r
+*\r
+* RETURN VALUES\r
+* InitType field\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_port_info_get_op_vls\r
+* NAME\r
+* ib_port_info_get_op_vls\r
+*\r
+* DESCRIPTION\r
+* Gets the operational VLs on a port.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE uint8_t AL_API\r
+ib_port_info_get_op_vls(\r
+ IN const ib_port_info_t* const p_pi)\r
+{\r
+ return((p_pi->vl_enforce >> 4) & 0x0F);\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_pi\r
+* [in] Pointer to a PortInfo attribute.\r
+*\r
+* RETURN VALUES\r
+* OP_VLS field\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_port_info_set_op_vls\r
+* NAME\r
+* ib_port_info_set_op_vls\r
+*\r
+* DESCRIPTION\r
+* Sets the operational VLs on a port.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE void AL_API\r
+ib_port_info_set_op_vls(\r
+ IN ib_port_info_t* const p_pi,\r
+ IN const uint8_t op_vls )\r
+{\r
+ p_pi->vl_enforce = (uint8_t)((p_pi->vl_enforce & 0x0F) | (op_vls << 4) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_pi\r
+* [in] Pointer to a PortInfo attribute.\r
+*\r
+* op_vls\r
+* [in] Encoded operation VLs value.\r
+*\r
+* RETURN VALUES\r
+* None.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_port_info_set_state_no_change\r
+* NAME\r
+* ib_port_info_set_state_no_change\r
+*\r
+* DESCRIPTION\r
+* Sets the port state fields to the value for "no change".\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE void AL_API\r
+ib_port_info_set_state_no_change(\r
+ IN ib_port_info_t* const p_pi )\r
+{\r
+ ib_port_info_set_port_state( p_pi, IB_LINK_NO_CHANGE );\r
+ p_pi->state_info2 = 0;\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_pi\r
+* [in] Pointer to a PortInfo attribute.\r
+*\r
+* RETURN VALUES\r
+* None.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_port_info_get_link_speed_sup\r
+* NAME\r
+* ib_port_info_get_link_speed_sup\r
+*\r
+* DESCRIPTION\r
+* Returns the encoded value for the link speed supported.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE uint8_t AL_API\r
+ib_port_info_get_link_speed_sup(\r
+ IN const ib_port_info_t* const p_pi )\r
+{\r
+ return( (uint8_t)((p_pi->state_info1 &\r
+ IB_PORT_LINK_SPEED_SUPPORTED_MASK) >>\r
+ IB_PORT_LINK_SPEED_SHIFT) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_pi\r
+* [in] Pointer to a PortInfo attribute.\r
+*\r
+* RETURN VALUES\r
+* Returns the encoded value for the link speed supported.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_port_info_set_link_speed_sup\r
+* NAME\r
+* ib_port_info_set_link_speed_sup\r
+*\r
+* DESCRIPTION\r
+* Given an integer of the supported link speed supported.\r
+* Set the appropriate bits in state_info1\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE void AL_API\r
+ib_port_info_set_link_speed_sup(\r
+ IN uint8_t const speed,\r
+ IN ib_port_info_t* p_pi )\r
+{\r
+ p_pi->state_info1 =\r
+ ( ~IB_PORT_LINK_SPEED_SUPPORTED_MASK & p_pi->state_info1 ) |\r
+ ( IB_PORT_LINK_SPEED_SUPPORTED_MASK &\r
+ (speed << IB_PORT_LINK_SPEED_SHIFT) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* speed\r
+* [in] Supported Speeds Code.\r
+*\r
+* p_pi\r
+* [in] Pointer to a PortInfo attribute.\r
+*\r
+* RETURN VALUES\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_port_info_get_port_phys_state\r
+* NAME\r
+* ib_port_info_get_port_phys_state\r
+*\r
+* DESCRIPTION\r
+* Returns the encoded value for the port physical state.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE uint8_t AL_API\r
+ib_port_info_get_port_phys_state(\r
+ IN const ib_port_info_t* const p_pi )\r
+{\r
+ return( (uint8_t)((p_pi->state_info2 &\r
+ IB_PORT_PHYS_STATE_MASK) >>\r
+ IB_PORT_PHYS_STATE_SHIFT) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_pi\r
+* [in] Pointer to a PortInfo attribute.\r
+*\r
+* RETURN VALUES\r
+* Returns the encoded value for the port physical state.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_port_info_set_port_phys_state\r
+* NAME\r
+* ib_port_info_set_port_phys_state\r
+*\r
+* DESCRIPTION\r
+* Given an integer of the port physical state,\r
+* Set the appropriate bits in state_info2\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE void AL_API\r
+ib_port_info_set_port_phys_state(\r
+ IN uint8_t const phys_state,\r
+ IN ib_port_info_t* p_pi )\r
+{\r
+ p_pi->state_info2 =\r
+ ( ~IB_PORT_PHYS_STATE_MASK & p_pi->state_info2 ) |\r
+ ( IB_PORT_PHYS_STATE_MASK &\r
+ (phys_state << IB_PORT_PHYS_STATE_SHIFT) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* phys_state\r
+* [in] port physical state.\r
+*\r
+* p_pi\r
+* [in] Pointer to a PortInfo attribute.\r
+*\r
+* RETURN VALUES\r
+* This function does not return a value.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_port_info_get_link_down_def_state\r
+* NAME\r
+* ib_port_info_get_link_down_def_state\r
+*\r
+* DESCRIPTION\r
+* Returns the link down default state.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE uint8_t AL_API\r
+ib_port_info_get_link_down_def_state(\r
+ IN const ib_port_info_t* const p_pi )\r
+{\r
+ return( (uint8_t)(p_pi->state_info2 & IB_PORT_LNKDWNDFTSTATE_MASK) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_pi\r
+* [in] Pointer to a PortInfo attribute.\r
+*\r
+* RETURN VALUES\r
+* link down default state of the port.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_port_info_set_link_down_def_state\r
+* NAME\r
+* ib_port_info_set_link_down_def_state\r
+*\r
+* DESCRIPTION\r
+* Sets the link down default state of the port.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE void AL_API\r
+ib_port_info_set_link_down_def_state(\r
+ IN ib_port_info_t* const p_pi,\r
+ IN const uint8_t link_dwn_state )\r
+{\r
+ p_pi->state_info2 = (uint8_t)((p_pi->state_info2 & 0xF0) | link_dwn_state );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_pi\r
+* [in] Pointer to a PortInfo attribute.\r
+*\r
+* link_dwn_state\r
+* [in] Link down default state of the port.\r
+*\r
+* RETURN VALUES\r
+* None.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_port_info_get_link_speed_active\r
+* NAME\r
+* ib_port_info_get_link_speed_active\r
+*\r
+* DESCRIPTION\r
+* Returns the Link Speed Active value assigned to this port.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE uint8_t AL_API\r
+ib_port_info_get_link_speed_active(\r
+ IN const ib_port_info_t* const p_pi )\r
+{\r
+ return( (uint8_t)((p_pi->link_speed &\r
+ IB_PORT_LINK_SPEED_ACTIVE_MASK) >>\r
+ IB_PORT_LINK_SPEED_SHIFT) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_pi\r
+* [in] Pointer to a PortInfo attribute.\r
+*\r
+* RETURN VALUES\r
+* Returns the link speed active value assigned to this port.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+*********/\r
+\r
+#define IB_LINK_WIDTH_ACTIVE_1X 1\r
+#define IB_LINK_WIDTH_ACTIVE_4X 2\r
+#define IB_LINK_WIDTH_ACTIVE_12X 8\r
+#define IB_LINK_SPEED_ACTIVE_2_5 1\r
+#define IB_LINK_SPEED_ACTIVE_5 2\r
+#define IB_LINK_SPEED_ACTIVE_10 4\r
+\r
+/* following v1 ver1.2 p901 */\r
+#define IB_PATH_RECORD_RATE_2_5_GBS 2\r
+#define IB_PATH_RECORD_RATE_10_GBS 3\r
+#define IB_PATH_RECORD_RATE_30_GBS 4\r
+#define IB_PATH_RECORD_RATE_5_GBS 5\r
+#define IB_PATH_RECORD_RATE_20_GBS 6\r
+#define IB_PATH_RECORD_RATE_40_GBS 7\r
+#define IB_PATH_RECORD_RATE_60_GBS 8\r
+#define IB_PATH_RECORD_RATE_80_GBS 9\r
+#define IB_PATH_RECORD_RATE_120_GBS 10\r
+\r
+#define IB_MIN_RATE IB_PATH_RECORD_RATE_2_5_GBS\r
+#define IB_MAX_RATE IB_PATH_RECORD_RATE_120_GBS \r
+\r
+/****f* IBA Base: Types/ib_port_info_compute_rate\r
+* NAME\r
+* ib_port_info_compute_rate\r
+*\r
+* DESCRIPTION\r
+* Returns the encoded value for the path rate.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE uint8_t AL_API\r
+ib_port_info_compute_rate(\r
+ IN const ib_port_info_t* const p_pi )\r
+{\r
+ uint8_t rate = 0;\r
+\r
+ switch (ib_port_info_get_link_speed_active(p_pi))\r
+ {\r
+ case IB_LINK_SPEED_ACTIVE_2_5:\r
+ switch (p_pi->link_width_active)\r
+ {\r
+ case IB_LINK_WIDTH_ACTIVE_1X:\r
+ rate = IB_PATH_RECORD_RATE_2_5_GBS;\r
+ break;\r
+ \r
+ case IB_LINK_WIDTH_ACTIVE_4X:\r
+ rate = IB_PATH_RECORD_RATE_10_GBS;\r
+ break;\r
+\r
+ case IB_LINK_WIDTH_ACTIVE_12X:\r
+ rate = IB_PATH_RECORD_RATE_30_GBS;\r
+ break;\r
+\r
+ default:\r
+ rate = IB_PATH_RECORD_RATE_2_5_GBS;\r
+ break;\r
+ }\r
+ break;\r
+ case IB_LINK_SPEED_ACTIVE_5:\r
+ switch (p_pi->link_width_active)\r
+ {\r
+ case IB_LINK_WIDTH_ACTIVE_1X:\r
+ rate = IB_PATH_RECORD_RATE_5_GBS;\r
+ break;\r
+\r
+ case IB_LINK_WIDTH_ACTIVE_4X:\r
+ rate = IB_PATH_RECORD_RATE_20_GBS;\r
+ break;\r
+\r
+ case IB_LINK_WIDTH_ACTIVE_12X:\r
+ rate = IB_PATH_RECORD_RATE_60_GBS;\r
+ break;\r
+\r
+ default:\r
+ rate = IB_PATH_RECORD_RATE_5_GBS;\r
+ break;\r
+ }\r
+ break;\r
+ case IB_LINK_SPEED_ACTIVE_10:\r
+ switch (p_pi->link_width_active)\r
+ {\r
+ case IB_LINK_WIDTH_ACTIVE_1X:\r
+ rate = IB_PATH_RECORD_RATE_10_GBS;\r
+ break;\r
+\r
+ case IB_LINK_WIDTH_ACTIVE_4X:\r
+ rate = IB_PATH_RECORD_RATE_40_GBS;\r
+ break;\r
+\r
+ case IB_LINK_WIDTH_ACTIVE_12X:\r
+ rate =IB_PATH_RECORD_RATE_120_GBS;\r
+ break;\r
+\r
+ default:\r
+ rate = IB_PATH_RECORD_RATE_10_GBS;\r
+ break;\r
+ }\r
+ break;\r
+ default:\r
+ rate = IB_PATH_RECORD_RATE_2_5_GBS;\r
+ break;\r
+ }\r
+\r
+ return rate;\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_pi\r
+* [in] Pointer to a PortInfo attribute.\r
+*\r
+* RETURN VALUES\r
+* Returns the encoded value for the link speed supported.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_path_get_ipd\r
+* NAME\r
+* ib_path_get_ipd\r
+*\r
+* DESCRIPTION\r
+* Returns the encoded value for the inter packet delay.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE uint8_t AL_API\r
+ib_path_get_ipd(\r
+ IN uint8_t local_link_width_supported,\r
+ IN uint8_t path_rec_rate )\r
+{\r
+ uint8_t ipd = 0;\r
+\r
+ switch(local_link_width_supported)\r
+ {\r
+ /* link_width_supported = 1: 1x */\r
+ case 1:\r
+ break;\r
+\r
+ /* link_width_supported = 3: 1x or 4x */\r
+ case 3:\r
+ switch(path_rec_rate & 0x3F)\r
+ {\r
+ case IB_PATH_RECORD_RATE_2_5_GBS:\r
+ ipd = 3;\r
+ break;\r
+ default:\r
+ break;\r
+ }\r
+ break;\r
+\r
+ /* link_width_supported = 11: 1x or 4x or 12x */\r
+ case 11:\r
+ switch(path_rec_rate & 0x3F)\r
+ {\r
+ case IB_PATH_RECORD_RATE_2_5_GBS:\r
+ ipd = 11;\r
+ break;\r
+ case IB_PATH_RECORD_RATE_10_GBS:\r
+ ipd = 2;\r
+ break;\r
+ default:\r
+ break;\r
+ }\r
+ break;\r
+\r
+ default:\r
+ break;\r
+ }\r
+\r
+ return ipd;\r
+}\r
+/*\r
+* PARAMETERS\r
+* local_link_width_supported\r
+* [in] link with supported for this port\r
+*\r
+* path_rec_rate\r
+* [in] rate field of the path record\r
+*\r
+* RETURN VALUES\r
+* Returns the ipd\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_port_info_get_mtu_cap\r
+* NAME\r
+* ib_port_info_get_mtu_cap\r
+*\r
+* DESCRIPTION\r
+* Returns the encoded value for the maximum MTU supported by this port.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE uint8_t AL_API\r
+ib_port_info_get_mtu_cap(\r
+ IN const ib_port_info_t* const p_pi )\r
+{\r
+ return( (uint8_t)(p_pi->mtu_cap & 0x0F) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_pi\r
+* [in] Pointer to a PortInfo attribute.\r
+*\r
+* RETURN VALUES\r
+* Returns the LMC value assigned to this port.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_port_info_get_neighbor_mtu\r
+* NAME\r
+* ib_port_info_get_neighbor_mtu\r
+*\r
+* DESCRIPTION\r
+* Returns the encoded value for the neighbor MTU at this port.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE uint8_t AL_API\r
+ib_port_info_get_neighbor_mtu(\r
+ IN const ib_port_info_t* const p_pi )\r
+{\r
+ return( (uint8_t)((p_pi->mtu_smsl & 0xF0) >> 4) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_pi\r
+* [in] Pointer to a PortInfo attribute.\r
+*\r
+* RETURN VALUES\r
+* Returns the encoded value for the neighbor MTU at this port.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_port_info_set_neighbor_mtu\r
+* NAME\r
+* ib_port_info_set_neighbor_mtu\r
+*\r
+* DESCRIPTION\r
+* Sets the Neighbor MTU value in the PortInfo attribute.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE void AL_API\r
+ib_port_info_set_neighbor_mtu(\r
+ IN ib_port_info_t* const p_pi,\r
+ IN const uint8_t mtu )\r
+{\r
+ CL_ASSERT( mtu <= 5 );\r
+ CL_ASSERT( mtu != 0 );\r
+ p_pi->mtu_smsl = (uint8_t)((p_pi->mtu_smsl & 0x0F) | (mtu << 4));\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_pi\r
+* [in] Pointer to a PortInfo attribute.\r
+*\r
+* mtu\r
+* [in] Encoded MTU value to set\r
+*\r
+* RETURN VALUES\r
+* None.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+*********/\r
+\r
+\r
+/****f* IBA Base: Types/ib_port_info_get_sm_sl\r
+* NAME\r
+* ib_port_info_get_sm_sl\r
+*\r
+* DESCRIPTION\r
+* Returns the encoded value for the SM sl at this port.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE uint8_t AL_API\r
+ib_port_info_get_sm_sl(\r
+ IN const ib_port_info_t* const p_pi )\r
+{\r
+ return( (uint8_t)(p_pi->mtu_smsl & 0x0F) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_pi\r
+* [in] Pointer to a PortInfo attribute.\r
+*\r
+* RETURN VALUES\r
+* Returns the encoded value for the neighbor MTU at this port.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+*********/\r
+/****f* IBA Base: Types/ib_port_info_set_sm_sl\r
+* NAME\r
+* ib_port_info_set_sm_sl\r
+*\r
+* DESCRIPTION\r
+* Sets the SM sl value in the PortInfo attribute.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE void AL_API\r
+ib_port_info_set_sm_sl(\r
+ IN ib_port_info_t* const p_pi,\r
+ IN const uint8_t sm_sl )\r
+{\r
+ CL_ASSERT( sm_sl<= 5 );\r
+ CL_ASSERT( sm_sl != 0 );\r
+ p_pi->mtu_smsl = (uint8_t)((p_pi->mtu_smsl & 0xF0) | sm_sl );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_pi\r
+* [in] Pointer to a PortInfo attribute.\r
+*\r
+* mtu\r
+* [in] Encoded SM sl value to set\r
+*\r
+* RETURN VALUES\r
+* None.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_port_info_set_timeout\r
+* NAME\r
+* ib_port_info_set_timeout\r
+*\r
+* DESCRIPTION\r
+* Sets the encoded subnet timeout value in the PortInfo attribute.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE void AL_API\r
+ib_port_info_set_timeout(\r
+ IN ib_port_info_t* const p_pi,\r
+ IN const uint8_t timeout )\r
+{\r
+ CL_ASSERT( timeout <= 0x1F );\r
+ p_pi->subnet_timeout =\r
+ (uint8_t)(\r
+ (p_pi->subnet_timeout & 0x80) | (timeout & 0x1F));\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_pi\r
+* [in] Pointer to a PortInfo attribute.\r
+*\r
+* timeout\r
+* [in] Encoded timeout value to set\r
+*\r
+* RETURN VALUES\r
+* None.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_port_info_set_client_rereg\r
+* NAME\r
+* ib_port_info_set_client_rereg\r
+*\r
+* DESCRIPTION\r
+* Sets the encoded client reregistration bit value in the PortInfo attribute.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE void AL_API\r
+ib_port_info_set_client_rereg(\r
+ IN ib_port_info_t* const p_pi,\r
+ IN const uint8_t client_rereg )\r
+{\r
+ CL_ASSERT( client_rereg <= 0x1 );\r
+ p_pi->subnet_timeout =\r
+ (uint8_t)(\r
+ (p_pi->subnet_timeout & 0x1F) | ((client_rereg << 7) & 0x80));\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_pi\r
+* [in] Pointer to a PortInfo attribute.\r
+*\r
+* client_rereg\r
+* [in] Client reregistration value to set (either 1 or 0).\r
+*\r
+* RETURN VALUES\r
+* None.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_port_info_get_timeout\r
+* NAME\r
+* ib_port_info_get_timeout\r
+*\r
+* DESCRIPTION\r
+* Gets the encoded subnet timeout value in the PortInfo attribute.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE uint8_t AL_API\r
+ib_port_info_get_timeout(\r
+ IN ib_port_info_t const* p_pi )\r
+{\r
+ return(p_pi->subnet_timeout & 0x1F );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_pi\r
+* [in] Pointer to a PortInfo attribute.\r
+*\r
+* RETURN VALUES\r
+* The encoded timeout value\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_port_info_get_client_rereg\r
+* NAME\r
+* ib_port_info_get_client_rereg\r
+*\r
+* DESCRIPTION\r
+* Gets the encoded client reregistration bit value in the PortInfo attribute.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE uint8_t AL_API\r
+ib_port_info_get_client_rereg(\r
+ IN ib_port_info_t const* p_pi )\r
+{\r
+ return ( (p_pi->subnet_timeout & 0x80 ) >> 7);\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_pi\r
+* [in] Pointer to a PortInfo attribute.\r
+*\r
+* RETURN VALUES\r
+* Client reregistration value (either 1 or 0).\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_port_info_set_hoq_lifetime\r
+* NAME\r
+* ib_port_info_set_hoq_lifetime\r
+*\r
+* DESCRIPTION\r
+* Sets the Head of Queue Lifetime for which a packet can live in the head \r
+* of VL queue\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE void AL_API\r
+ib_port_info_set_hoq_lifetime(\r
+ IN ib_port_info_t* const p_pi,\r
+ IN const uint8_t hoq_life )\r
+{\r
+ p_pi->vl_stall_life = (uint8_t)((hoq_life & 0x1f) |\r
+ (p_pi->vl_stall_life & 0xe0));\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_pi\r
+* [in] Pointer to a PortInfo attribute.\r
+*\r
+* hoq_life\r
+* [in] Encoded lifetime value to set\r
+*\r
+* RETURN VALUES\r
+* None.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_port_info_get_hoq_lifetime\r
+* NAME\r
+* ib_port_info_get_hoq_lifetime\r
+*\r
+* DESCRIPTION\r
+* Gets the Head of Queue Lifetime for which a packet can live in the head \r
+* of VL queue\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE uint8_t AL_API\r
+ib_port_info_get_hoq_lifetime(\r
+ IN const ib_port_info_t* const p_pi )\r
+{\r
+ return( (uint8_t)(p_pi->vl_stall_life & 0x1f) );\r
+}\r
+\r
+/*\r
+* PARAMETERS\r
+* p_pi\r
+* [in] Pointer to a PortInfo attribute.\r
+*\r
+* RETURN VALUES\r
+* Encoded lifetime value\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_port_info_set_vl_stall_count\r
+* NAME\r
+* ib_port_info_set_vl_stall_count\r
+*\r
+* DESCRIPTION\r
+* Sets the VL Stall Count which define the number of contiguous \r
+* HLL (hoq) drops that will put the VL into stalled mode.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE void AL_API\r
+ib_port_info_set_vl_stall_count(\r
+ IN ib_port_info_t* const p_pi,\r
+ IN const uint8_t vl_stall_count )\r
+{\r
+ p_pi->vl_stall_life = (uint8_t)((p_pi->vl_stall_life & 0x1f) |\r
+ ((vl_stall_count << 5) & 0xe0));\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_pi\r
+* [in] Pointer to a PortInfo attribute.\r
+*\r
+* vl_stall_count \r
+* [in] value to set\r
+*\r
+* RETURN VALUES\r
+* None.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_port_info_get_vl_stall_count\r
+* NAME\r
+* ib_port_info_get_vl_stall_count\r
+*\r
+* DESCRIPTION\r
+* Gets the VL Stall Count which define the number of contiguous \r
+* HLL (hoq) drops that will put the VL into stalled mode\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE uint8_t AL_API\r
+ib_port_info_get_vl_stall_count(\r
+ IN const ib_port_info_t* const p_pi )\r
+{\r
+ return( (uint8_t)(p_pi->vl_stall_life & 0xe0) >> 5);\r
+}\r
+\r
+/*\r
+* PARAMETERS\r
+* p_pi\r
+* [in] Pointer to a PortInfo attribute.\r
+*\r
+* RETURN VALUES\r
+* vl stall count\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_port_info_get_lmc\r
+* NAME\r
+* ib_port_info_get_lmc\r
+*\r
+* DESCRIPTION\r
+* Returns the LMC value assigned to this port.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE uint8_t AL_API\r
+ib_port_info_get_lmc(\r
+ IN const ib_port_info_t* const p_pi )\r
+{\r
+ return( (uint8_t)(p_pi->mkey_lmc & IB_PORT_LMC_MASK) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_pi\r
+* [in] Pointer to a PortInfo attribute.\r
+*\r
+* RETURN VALUES\r
+* Returns the LMC value assigned to this port.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_port_info_set_lmc\r
+* NAME\r
+* ib_port_info_set_lmc\r
+*\r
+* DESCRIPTION\r
+* Sets the LMC value in the PortInfo attribute.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE void AL_API\r
+ib_port_info_set_lmc(\r
+ IN ib_port_info_t* const p_pi,\r
+ IN const uint8_t lmc )\r
+{\r
+ CL_ASSERT( lmc <= IB_PORT_LMC_MAX );\r
+ p_pi->mkey_lmc = (uint8_t)((p_pi->mkey_lmc & 0xF8) | lmc);\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_pi\r
+* [in] Pointer to a PortInfo attribute.\r
+*\r
+* lmc\r
+* [in] LMC value to set, must be less than 7.\r
+*\r
+* RETURN VALUES\r
+* None.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_port_info_get_link_speed_enabled\r
+* NAME\r
+* ib_port_info_get_link_speed_enabled\r
+*\r
+* DESCRIPTION\r
+* Returns the link speed enabled value assigned to this port.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE uint8_t AL_API\r
+ib_port_info_get_link_speed_enabled(\r
+ IN const ib_port_info_t* const p_pi )\r
+{\r
+ return( (uint8_t)(p_pi->link_speed & IB_PORT_LINK_SPEED_ENABLED_MASK) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_pi\r
+* [in] Pointer to a PortInfo attribute.\r
+*\r
+* RETURN VALUES\r
+* Port state.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_port_info_set_link_speed_enabled\r
+* NAME\r
+* ib_port_info_set_link_speed_enabled\r
+*\r
+* DESCRIPTION\r
+* Sets the link speed enabled value in the PortInfo attribute.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE void AL_API\r
+ib_port_info_set_link_speed_enabled(\r
+ IN ib_port_info_t* const p_pi,\r
+ IN const uint8_t link_speed_enabled )\r
+{\r
+ p_pi->link_speed = (uint8_t)((p_pi->link_speed & 0xF0) | link_speed_enabled );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_pi\r
+* [in] Pointer to a PortInfo attribute.\r
+*\r
+* link_speed_enabled\r
+* [in] link speed enabled value to set.\r
+*\r
+* RETURN VALUES\r
+* None.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_port_info_get_mpb\r
+* NAME\r
+* ib_port_info_get_mpb\r
+*\r
+* DESCRIPTION\r
+* Returns the M_Key protect bits assigned to this port.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE uint8_t AL_API\r
+ib_port_info_get_mpb(\r
+ IN const ib_port_info_t* const p_pi )\r
+{\r
+ return( (uint8_t)((p_pi->mkey_lmc & IB_PORT_MPB_MASK) >>\r
+ IB_PORT_MPB_SHIFT) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_ni\r
+* [in] Pointer to a PortInfo attribute.\r
+*\r
+* RETURN VALUES\r
+* Returns the M_Key protect bits assigned to this port.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_port_info_set_mpb\r
+* NAME\r
+* ib_port_info_set_mpb\r
+*\r
+* DESCRIPTION\r
+* Set the M_Key protect bits of this port.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE void AL_API\r
+ib_port_info_set_mpb(\r
+ IN ib_port_info_t* p_pi,\r
+ IN uint8_t mpb )\r
+{\r
+ p_pi->mkey_lmc =\r
+ (~IB_PORT_MPB_MASK & p_pi->mkey_lmc) |\r
+ ( IB_PORT_MPB_MASK & (mpb << IB_PORT_MPB_SHIFT) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* mpb\r
+* [in] M_Key protect bits\r
+* p_ni\r
+* [in] Pointer to a PortInfo attribute.\r
+*\r
+* RETURN VALUES\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_port_info_get_local_phy_err_thd\r
+* NAME\r
+* ib_port_info_get_local_phy_err_thd\r
+*\r
+* DESCRIPTION\r
+* Returns the Phy Link Threshold\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE uint8_t AL_API\r
+ib_port_info_get_local_phy_err_thd(\r
+ IN const ib_port_info_t* const p_pi )\r
+{\r
+ return (uint8_t)( (p_pi->error_threshold & 0xF0) >> 4);\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_pi\r
+* [in] Pointer to a PortInfo attribute.\r
+*\r
+* RETURN VALUES\r
+* Returns the Phy Link error threshold assigned to this port.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_port_info_get_overrun_err_thd\r
+* NAME\r
+* ib_port_info_get_local_overrun_err_thd\r
+*\r
+* DESCRIPTION\r
+* Returns the Credits Overrun Errors Threshold\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE uint8_t AL_API\r
+ib_port_info_get_overrun_err_thd(\r
+ IN const ib_port_info_t* const p_pi )\r
+{\r
+ return (uint8_t)(p_pi->error_threshold & 0x0F);\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_pi\r
+* [in] Pointer to a PortInfo attribute.\r
+*\r
+* RETURN VALUES\r
+* Returns the Credits Overrun errors threshold assigned to this port.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_port_info_set_phy_and_overrun_err_thd\r
+* NAME\r
+* ib_port_info_set_phy_and_overrun_err_thd\r
+*\r
+* DESCRIPTION\r
+* Sets the Phy Link and Credits Overrun Errors Threshold\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE void AL_API\r
+ib_port_info_set_phy_and_overrun_err_thd(\r
+ IN ib_port_info_t* const p_pi,\r
+ IN uint8_t phy_threshold,\r
+ IN uint8_t overrun_threshold )\r
+{\r
+ p_pi->error_threshold = \r
+ (uint8_t)( ((phy_threshold & 0x0F) << 4) | (overrun_threshold & 0x0F) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_pi\r
+* [in] Pointer to a PortInfo attribute.\r
+*\r
+* phy_threshold\r
+* [in] Physical Link Errors Threshold above which Trap 129 is generated \r
+*\r
+* overrun_threshold\r
+* [in] Credits overrun Errors Threshold above which Trap 129 is generated \r
+*\r
+* RETURN VALUES\r
+* None.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+*********/\r
+\r
+typedef uint8_t ib_svc_name_t[64];\r
+\r
+#include <complib/cl_packon.h>\r
+typedef struct _ib_service_record\r
+{\r
+ ib_net64_t service_id;\r
+ ib_gid_t service_gid;\r
+ ib_net16_t service_pkey;\r
+ ib_net16_t resv;\r
+ ib_net32_t service_lease;\r
+ uint8_t service_key[16];\r
+ ib_svc_name_t service_name;\r
+ uint8_t service_data8[16];\r
+ ib_net16_t service_data16[8];\r
+ ib_net32_t service_data32[4];\r
+ ib_net64_t service_data64[2];\r
+\r
+} PACK_SUFFIX ib_service_record_t;\r
+#include <complib/cl_packoff.h>\r
+\r
+#include <complib/cl_packon.h>\r
+typedef struct _ib_portinfo_record\r
+{\r
+ ib_net16_t lid;\r
+ uint8_t port_num;\r
+ uint8_t resv;\r
+ ib_port_info_t port_info;\r
+ uint8_t pad[6];\r
+\r
+} PACK_SUFFIX ib_portinfo_record_t;\r
+#include <complib/cl_packoff.h>\r
+\r
+#include <complib/cl_packon.h>\r
+typedef struct _ib_link_record\r
+{\r
+ ib_net16_t from_lid;\r
+ uint8_t from_port_num;\r
+ uint8_t to_port_num;\r
+ ib_net16_t to_lid;\r
+ uint8_t pad[2];\r
+\r
+} PACK_SUFFIX ib_link_record_t;\r
+#include <complib/cl_packoff.h>\r
+\r
+#include <complib/cl_packon.h>\r
+typedef struct _ib_sminfo_record\r
+{\r
+ ib_net16_t lid;\r
+ uint16_t resv0;\r
+ ib_sm_info_t sm_info;\r
+ uint8_t pad[7];\r
+\r
+} PACK_SUFFIX ib_sminfo_record_t;\r
+#include <complib/cl_packoff.h>\r
+\r
+/****s* IBA Base: Types/ib_lft_record_t\r
+* NAME\r
+* ib_lft_record_t\r
+*\r
+* DESCRIPTION\r
+* IBA defined LinearForwardingTableRecord (15.2.5.6)\r
+*\r
+* SYNOPSIS\r
+*/\r
+#include <complib/cl_packon.h>\r
+typedef struct _ib_lft_record\r
+{\r
+ ib_net16_t lid;\r
+ ib_net16_t block_num;\r
+ uint32_t resv0;\r
+ uint8_t lft[64];\r
+} PACK_SUFFIX ib_lft_record_t;\r
+#include <complib/cl_packoff.h>\r
+/************/\r
+\r
+/****s* IBA Base: Types/ib_mft_record_t\r
+* NAME\r
+* ib_mft_record_t\r
+*\r
+* DESCRIPTION\r
+* IBA defined MulticastForwardingTableRecord (15.2.5.8)\r
+*\r
+* SYNOPSIS\r
+*/\r
+#include <complib/cl_packon.h>\r
+typedef struct _ib_mft_record\r
+{\r
+ ib_net16_t lid;\r
+ ib_net16_t position_block_num;\r
+ uint32_t resv0;\r
+ ib_net16_t mft[IB_MCAST_BLOCK_SIZE];\r
+} PACK_SUFFIX ib_mft_record_t;\r
+#include <complib/cl_packoff.h>\r
+/************/\r
+\r
+/****s* IBA Base: Types/ib_switch_info_t\r
+* NAME\r
+* ib_switch_info_t\r
+*\r
+* DESCRIPTION\r
+* IBA defined SwitchInfo. (14.2.5.4)\r
+*\r
+* SYNOPSIS\r
+*/\r
+#include <complib/cl_packon.h>\r
+typedef struct _ib_switch_info\r
+{\r
+ ib_net16_t lin_cap;\r
+ ib_net16_t rand_cap;\r
+ ib_net16_t mcast_cap;\r
+ ib_net16_t lin_top;\r
+ uint8_t def_port;\r
+ uint8_t def_mcast_pri_port;\r
+ uint8_t def_mcast_not_port;\r
+ uint8_t life_state;\r
+ ib_net16_t lids_per_port;\r
+ ib_net16_t enforce_cap;\r
+ uint8_t flags;\r
+\r
+} PACK_SUFFIX ib_switch_info_t;\r
+#include <complib/cl_packoff.h>\r
+/************/\r
+\r
+#include <complib/cl_packon.h>\r
+typedef struct _ib_switch_info_record\r
+{\r
+ ib_net16_t lid;\r
+ uint16_t resv0;\r
+ ib_switch_info_t switch_info;\r
+ uint8_t pad[3];\r
+\r
+} PACK_SUFFIX ib_switch_info_record_t;\r
+#include <complib/cl_packoff.h>\r
+\r
+#define IB_SWITCH_PSC 0x04\r
+\r
+/****f* IBA Base: Types/ib_switch_info_get_state_change\r
+* NAME\r
+* ib_switch_info_get_state_change\r
+*\r
+* DESCRIPTION\r
+* Returns the value of the state change flag.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE boolean_t AL_API\r
+ib_switch_info_get_state_change(\r
+ IN const ib_switch_info_t* const p_si )\r
+{\r
+ return( (p_si->life_state & IB_SWITCH_PSC) == IB_SWITCH_PSC );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_si\r
+* [in] Pointer to a SwitchInfo attribute.\r
+*\r
+* RETURN VALUES\r
+* Returns the value of the state change flag.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_switch_info_clear_state_change\r
+* NAME\r
+* ib_switch_info_clear_state_change\r
+*\r
+* DESCRIPTION\r
+* Clears the switch's state change bit.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE void AL_API\r
+ib_switch_info_clear_state_change(\r
+ IN ib_switch_info_t* const p_si )\r
+{\r
+ p_si->life_state = (uint8_t)(p_si->life_state & 0xFB);\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_ni\r
+* [in] Pointer to a PortInfo attribute.\r
+*\r
+* RETURN VALUES\r
+* Returns the LMC value assigned to this port.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_switch_info_is_enhanced_port0\r
+* NAME\r
+* ib_switch_info_is_enhanced_port0\r
+*\r
+* DESCRIPTION\r
+* Returns TRUE if the enhancedPort0 bit is on (meaning the switch\r
+* port zero supports enhanced functions).\r
+* Returns FALSE otherwise.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE boolean_t AL_API\r
+ib_switch_info_is_enhanced_port0(\r
+ IN const ib_switch_info_t* const p_si )\r
+{\r
+ return( (p_si->flags & 0x08) == 0x08 );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_si\r
+* [in] Pointer to a SwitchInfo attribute.\r
+*\r
+* RETURN VALUES\r
+* Returns TRUE if the switch supports enhanced port 0. FALSE otherwise.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+*********/\r
+\r
+/****s* IBA Base: Types/ib_guid_info_t\r
+* NAME\r
+* ib_guid_info_t\r
+*\r
+* DESCRIPTION\r
+* IBA defined GuidInfo. (14.2.5.5)\r
+*\r
+* SYNOPSIS\r
+*/\r
+#define GUID_TABLE_MAX_ENTRIES 8\r
+\r
+#include <complib/cl_packon.h>\r
+typedef struct _ib_guid_info\r
+{\r
+ ib_net64_t guid[GUID_TABLE_MAX_ENTRIES];\r
+\r
+} PACK_SUFFIX ib_guid_info_t;\r
+#include <complib/cl_packoff.h>\r
+/************/\r
+\r
+#include <complib/cl_packon.h>\r
+typedef struct _ib_guidinfo_record\r
+{\r
+ ib_net16_t lid;\r
+ uint8_t block_num;\r
+ uint8_t resv;\r
+ uint32_t reserved;\r
+ ib_guid_info_t guid_info;\r
+} PACK_SUFFIX ib_guidinfo_record_t;\r
+#include <complib/cl_packoff.h>\r
+\r
+#define IB_MULTIPATH_MAX_GIDS 11 /* Support max that can fit into first MAD (for now) */\r
+\r
+#include <complib/cl_packon.h>\r
+typedef struct _ib_multipath_rec_t\r
+{\r
+ ib_net32_t hop_flow_raw;\r
+ uint8_t tclass;\r
+ uint8_t num_path;\r
+ ib_net16_t pkey;\r
+ uint8_t resv0;\r
+ uint8_t sl;\r
+ uint8_t mtu;\r
+ uint8_t rate;\r
+ uint8_t pkt_life;\r
+ uint8_t resv1;\r
+ uint8_t independence; /* formerly resv2 */\r
+ uint8_t sgid_count;\r
+ uint8_t dgid_count;\r
+ uint8_t resv3[7];\r
+ ib_gid_t gids[IB_MULTIPATH_MAX_GIDS];\r
+} PACK_SUFFIX ib_multipath_rec_t;\r
+#include <complib/cl_packoff.h>\r
+/*\r
+* FIELDS\r
+* hop_flow_raw\r
+* Global routing parameters: hop count, flow label and raw bit.\r
+*\r
+* tclass\r
+* Another global routing parameter.\r
+*\r
+* num_path\r
+* Reversible path - 1 bit to say if path is reversible.\r
+* num_path [6:0] In queries, maximum number of paths to return.\r
+* In responses, undefined.\r
+*\r
+* pkey\r
+* Partition key (P_Key) to use on this path.\r
+*\r
+* sl\r
+* Service level to use on this path.\r
+*\r
+* mtu\r
+* MTU and MTU selector fields to use on this path\r
+* rate\r
+* Rate and rate selector fields to use on this path.\r
+*\r
+* pkt_life\r
+* Packet lifetime\r
+*\r
+* preference\r
+* Indicates the relative merit of this path versus other path\r
+* records returned from the SA. Lower numbers are better.\r
+*\r
+* SEE ALSO\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_multipath_rec_num_path\r
+* NAME\r
+* ib_multipath_rec_num_path\r
+*\r
+* DESCRIPTION\r
+* Get max number of paths to return.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE uint8_t AL_API\r
+ib_multipath_rec_num_path(\r
+ IN const ib_multipath_rec_t* const p_rec )\r
+{\r
+ return( p_rec->num_path &0x7F );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_rec\r
+* [in] Pointer to the multipath record object.\r
+*\r
+* RETURN VALUES\r
+* Maximum number of paths to return for each unique SGID_DGID combination.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+* ib_multipath_rec_t\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_multipath_rec_sl\r
+* NAME\r
+* ib_multipath_rec_sl\r
+*\r
+* DESCRIPTION\r
+* Get multipath service level.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE uint8_t AL_API\r
+ib_multipath_rec_sl(\r
+ IN const ib_multipath_rec_t* const p_rec )\r
+{\r
+ return( (uint8_t)((cl_ntoh16( p_rec->sl )) & 0xF) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_rec\r
+* [in] Pointer to the multipath record object.\r
+*\r
+* RETURN VALUES\r
+* SL.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+* ib_multipath_rec_t\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_multipath_rec_mtu\r
+* NAME\r
+* ib_multipath_rec_mtu\r
+*\r
+* DESCRIPTION\r
+* Get encoded path MTU.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE uint8_t AL_API\r
+ib_multipath_rec_mtu(\r
+ IN const ib_multipath_rec_t* const p_rec )\r
+{\r
+ return( (uint8_t)(p_rec->mtu & IB_MULTIPATH_REC_BASE_MASK) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_rec\r
+* [in] Pointer to the multipath record object.\r
+*\r
+* RETURN VALUES\r
+* Encoded path MTU.\r
+* 1: 256\r
+* 2: 512\r
+* 3: 1024\r
+* 4: 2048\r
+* 5: 4096\r
+* others: reserved\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+* ib_multipath_rec_t\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_multipath_rec_mtu_sel\r
+* NAME\r
+* ib_multipath_rec_mtu_sel\r
+*\r
+* DESCRIPTION\r
+* Get encoded multipath MTU selector.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE uint8_t AL_API\r
+ib_multipath_rec_mtu_sel(\r
+ IN const ib_multipath_rec_t* const p_rec )\r
+{\r
+ return( (uint8_t)((p_rec->mtu & IB_MULTIPATH_REC_SELECTOR_MASK) >> 6) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_rec\r
+* [in] Pointer to the multipath record object.\r
+*\r
+* RETURN VALUES\r
+* Encoded path MTU selector value (for queries).\r
+* 0: greater than MTU specified\r
+* 1: less than MTU specified\r
+* 2: exactly the MTU specified\r
+* 3: largest MTU available\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+* ib_multipath_rec_t\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_multipath_rec_rate\r
+* NAME\r
+* ib_multipath_rec_rate\r
+*\r
+* DESCRIPTION\r
+* Get encoded multipath rate.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE uint8_t AL_API\r
+ib_multipath_rec_rate(\r
+ IN const ib_multipath_rec_t* const p_rec )\r
+{\r
+ return( (uint8_t)(p_rec->rate & IB_MULTIPATH_REC_BASE_MASK) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_rec\r
+* [in] Pointer to the multipath record object.\r
+*\r
+* RETURN VALUES\r
+* Encoded multipath rate.\r
+* 2: 2.5 Gb/sec.\r
+* 3: 10 Gb/sec.\r
+* 4: 30 Gb/sec.\r
+* others: reserved\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+* ib_multipath_rec_t\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_multipath_rec_rate_sel\r
+* NAME\r
+* ib_multipath_rec_rate_sel\r
+*\r
+* DESCRIPTION\r
+* Get encoded multipath rate selector.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE uint8_t AL_API\r
+ib_multipath_rec_rate_sel(\r
+ IN const ib_multipath_rec_t* const p_rec )\r
+{\r
+ return( (uint8_t)((p_rec->rate & IB_MULTIPATH_REC_SELECTOR_MASK) >> 6) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_rec\r
+* [in] Pointer to the multipath record object.\r
+*\r
+* RETURN VALUES\r
+* Encoded path rate selector value (for queries).\r
+* 0: greater than rate specified\r
+* 1: less than rate specified\r
+* 2: exactly the rate specified\r
+* 3: largest rate available\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+* ib_multipath_rec_t\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_multipath_rec_pkt_life\r
+* NAME\r
+* ib_multipath_rec_pkt_life\r
+*\r
+* DESCRIPTION\r
+* Get encoded multipath pkt_life.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE uint8_t AL_API\r
+ib_multipath_rec_pkt_life(\r
+ IN const ib_multipath_rec_t* const p_rec )\r
+{\r
+ return( (uint8_t)(p_rec->pkt_life & IB_MULTIPATH_REC_BASE_MASK) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_rec\r
+* [in] Pointer to the multipath record object.\r
+*\r
+* RETURN VALUES\r
+* Encoded multipath pkt_life = 4.096 µsec * 2 ** PacketLifeTime.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+* ib_multipath_rec_t\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_multipath_rec_pkt_life_sel\r
+* NAME\r
+* ib_multipath_rec_pkt_life_sel\r
+*\r
+* DESCRIPTION\r
+* Get encoded multipath pkt_lifetime selector.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE uint8_t AL_API\r
+ib_multipath_rec_pkt_life_sel(\r
+ IN const ib_multipath_rec_t* const p_rec )\r
+{\r
+ return( (uint8_t)((p_rec->pkt_life & IB_MULTIPATH_REC_SELECTOR_MASK) >> 6 ));\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_rec\r
+* [in] Pointer to the multipath record object.\r
+*\r
+* RETURN VALUES\r
+* Encoded path pkt_lifetime selector value (for queries).\r
+* 0: greater than rate specified\r
+* 1: less than rate specified\r
+* 2: exactly the rate specified\r
+* 3: smallest packet lifetime available\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+* ib_multipath_rec_t\r
+*********/\r
+\r
+#define IB_NUM_PKEY_ELEMENTS_IN_BLOCK 32\r
+/****s* IBA Base: Types/ib_pkey_table_t\r
+* NAME\r
+* ib_pkey_table_t\r
+*\r
+* DESCRIPTION\r
+* IBA defined PKey table. (14.2.5.7)\r
+*\r
+* SYNOPSIS\r
+*/\r
+\r
+#include <complib/cl_packon.h>\r
+typedef struct _ib_pkey_table\r
+{\r
+ ib_net16_t pkey_entry[IB_NUM_PKEY_ELEMENTS_IN_BLOCK];\r
+\r
+} PACK_SUFFIX ib_pkey_table_t;\r
+#include <complib/cl_packoff.h>\r
+/************/\r
+\r
+/****s* IBA Base: Types/ib_pkey_table_record_t\r
+* NAME\r
+* ib_pkey_table_record_t\r
+*\r
+* DESCRIPTION\r
+* IBA defined P_Key Table Record for SA Query. (15.2.5.11)\r
+*\r
+* SYNOPSIS\r
+*/\r
+#include <complib/cl_packon.h>\r
+typedef struct _ib_pkey_table_record\r
+{\r
+ ib_net16_t lid; // for CA: lid of port, for switch lid of port 0\r
+ uint16_t block_num;\r
+ uint8_t port_num; // for switch: port number, for CA: reserved\r
+ uint8_t reserved1;\r
+ uint16_t reserved2;\r
+ ib_pkey_table_t pkey_tbl;\r
+\r
+} PACK_SUFFIX ib_pkey_table_record_t;\r
+#include <complib/cl_packoff.h>\r
+/************/\r
+\r
+#define IB_DROP_VL 15\r
+#define IB_MAX_NUM_VLS 16\r
+/****s* IBA Base: Types/ib_slvl_table_t\r
+* NAME\r
+* ib_slvl_table_t\r
+*\r
+* DESCRIPTION\r
+* IBA defined SL2VL Mapping Table Attribute. (14.2.5.8)\r
+*\r
+* SYNOPSIS\r
+*/\r
+#include <complib/cl_packon.h>\r
+typedef struct _ib_slvl_table\r
+{\r
+ uint8_t vl_table[IB_MAX_NUM_VLS/2];\r
+\r
+} PACK_SUFFIX ib_slvl_table_t;\r
+#include <complib/cl_packoff.h>\r
+/************/\r
+\r
+/****s* IBA Base: Types/ib_slvl_table_record_t\r
+* NAME\r
+* ib_slvl_table_record_t\r
+*\r
+* DESCRIPTION\r
+* IBA defined SL to VL Mapping Table Record for SA Query. (15.2.5.4)\r
+*\r
+* SYNOPSIS\r
+*/\r
+#include <complib/cl_packon.h>\r
+typedef struct _ib_slvl_table_record\r
+{\r
+ ib_net16_t lid; // for CA: lid of port, for switch lid of port 0\r
+ uint8_t in_port_num; // reserved for CAs\r
+ uint8_t out_port_num; // reserved for CAs\r
+ uint32_t resv;\r
+ ib_slvl_table_t slvl_tbl;\r
+\r
+} PACK_SUFFIX ib_slvl_table_record_t;\r
+#include <complib/cl_packoff.h>\r
+/************/\r
+\r
+/****f* IBA Base: Types/ib_slvl_table_set\r
+* NAME\r
+* ib_slvl_table_set\r
+*\r
+* DESCRIPTION\r
+* Set slvl table entry.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE void AL_API\r
+ib_slvl_table_set(\r
+ IN ib_slvl_table_t* p_slvl_tbl,\r
+ IN const uint8_t sl_index,\r
+ IN const uint8_t vl )\r
+ {\r
+ uint8_t idx = sl_index/2;\r
+ CL_ASSERT(vl <= 15);\r
+ CL_ASSERT(sl_index <= 15);\r
+\r
+ if (sl_index%2)\r
+ {\r
+ /* this is an odd sl. Need to update the ls bits */\r
+ p_slvl_tbl->vl_table[idx] = ( p_slvl_tbl->vl_table[idx] & 0xF0 ) | vl ;\r
+ }\r
+ else\r
+ {\r
+ /* this is an even sl. Need to update the ms bits */\r
+ p_slvl_tbl->vl_table[idx] = ( vl << 4 ) | ( p_slvl_tbl->vl_table[idx] & 0x0F );\r
+ }\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_slvl_tbl\r
+* [in] pointer to ib_slvl_table_t object.\r
+*\r
+* sl_index\r
+* [in] the sl index in the table to be updated.\r
+*\r
+* vl\r
+* [in] the vl value to update for that sl.\r
+*\r
+* RETURN VALUES\r
+* None\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+* ib_slvl_table_t\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_slvl_table_get\r
+* NAME\r
+* ib_slvl_table_get\r
+*\r
+* DESCRIPTION\r
+* Get slvl table entry.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE uint8_t AL_API\r
+ib_slvl_table_get(\r
+IN const ib_slvl_table_t* p_slvl_tbl,\r
+IN const uint8_t sl_index )\r
+{\r
+ uint8_t idx = sl_index/2;\r
+ CL_ASSERT(sl_index <= 15);\r
+\r
+ if (sl_index%2)\r
+ {\r
+ /* this is an odd sl. Need to return the ls bits. */\r
+ return ( p_slvl_tbl->vl_table[idx] & 0x0F );\r
+ }\r
+ else\r
+ {\r
+ /* this is an even sl. Need to return the ms bits. */\r
+ return ( (p_slvl_tbl->vl_table[idx] & 0xF0) >> 4 );\r
+ }\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_slvl_tbl\r
+* [in] pointer to ib_slvl_table_t object.\r
+*\r
+* sl_index\r
+* [in] the sl index in the table whose value should be returned.\r
+*\r
+* RETURN VALUES\r
+* vl for the requested sl_index.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+* ib_slvl_table_t\r
+*********/\r
+\r
+/****s* IBA Base: Types/ib_vl_arb_element_t\r
+* NAME\r
+* ib_vl_arb_element_t\r
+*\r
+* DESCRIPTION\r
+* IBA defined VL Arbitration Table Element. (14.2.5.9)\r
+*\r
+* SYNOPSIS\r
+*/\r
+#include <complib/cl_packon.h>\r
+typedef struct _ib_vl_arb_element\r
+{\r
+ uint8_t res_vl;\r
+ uint8_t weight;\r
+} PACK_SUFFIX ib_vl_arb_element_t;\r
+#include <complib/cl_packoff.h>\r
+/************/\r
+\r
+/****f* IBA Base: Types/ib_vl_arb_element_get_vl\r
+* NAME\r
+* ib_vl_arb_element_get_vl\r
+*\r
+* DESCRIPTION\r
+* Retrieves the VL from a VL arbitration table element.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE uint8_t AL_API\r
+ib_vl_arb_element_get_vl(\r
+ IN const ib_vl_arb_element_t vl_arb_element )\r
+{\r
+ return (vl_arb_element.res_vl >> 4);\r
+}\r
+/*\r
+* PARAMETERS\r
+* vl_arb_element\r
+* [in] VL arbitration table element from which to return the VL.\r
+*\r
+* RETURN VALUES\r
+* Returns the VL value for the specified VL arbitration table element.\r
+*\r
+* SEE ALSO\r
+* vl_arb_element, ib_vl_arb_element_set_vl\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_vl_arb_element_set_vl\r
+* NAME\r
+* ib_vl_arb_element_set_vl\r
+*\r
+* DESCRIPTION\r
+* Retrieves the VL from a VL arbitration table element.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE void AL_API\r
+ib_vl_arb_element_set_vl(\r
+ IN OUT ib_vl_arb_element_t* const p_vl_arb_element,\r
+ IN const uint8_t vl )\r
+{\r
+ p_vl_arb_element->res_vl = vl << 4;\r
+}\r
+/*\r
+* PARAMETERS\r
+* vl_arb_element\r
+* [in/out] VL arbitration table element in which to store the VL.\r
+*\r
+* vl\r
+* [in] VL to store in the specified element.\r
+*\r
+* RETURN VALUES\r
+* This function does not return a value.\r
+*\r
+* SEE ALSO\r
+* vl_arb_element, ib_vl_arb_element_get_vl\r
+*********/\r
+\r
+#define IB_NUM_VL_ARB_ELEMENTS_IN_BLOCK 32\r
+\r
+/****s* IBA Base: Types/ib_vl_arb_table_t\r
+* NAME\r
+* ib_vl_arb_table_t\r
+*\r
+* DESCRIPTION\r
+* IBA defined VL Arbitration Table. (14.2.5.9)\r
+*\r
+* SYNOPSIS\r
+*/\r
+#include <complib/cl_packon.h>\r
+typedef struct _ib_vl_arb_table\r
+{\r
+ ib_vl_arb_element_t vl_entry[IB_NUM_VL_ARB_ELEMENTS_IN_BLOCK];\r
+} PACK_SUFFIX ib_vl_arb_table_t;\r
+#include <complib/cl_packoff.h>\r
+/************/\r
+\r
+/****s* IBA Base: Types/ib_vl_arb_table_record_t\r
+* NAME\r
+* ib_vl_arb_table_record_t\r
+*\r
+* DESCRIPTION\r
+* IBA defined VL Arbitration Table Record for SA Query. (15.2.5.9)\r
+*\r
+* SYNOPSIS\r
+*/\r
+#include <complib/cl_packon.h>\r
+typedef struct _ib_vl_arb_table_record\r
+{\r
+ ib_net16_t lid; // for CA: lid of port, for switch lid of port 0\r
+ uint8_t port_num;\r
+ uint8_t block_num;\r
+ uint32_t reserved;\r
+ ib_vl_arb_table_t vl_arb_tbl;\r
+} PACK_SUFFIX ib_vl_arb_table_record_t;\r
+#include <complib/cl_packoff.h>\r
+/************/\r
+\r
+/****s* IBA Base: Types/ib_grh_t\r
+* NAME\r
+* ib_grh_t\r
+*\r
+* DESCRIPTION\r
+* Global route header information received with unreliable datagram messages\r
+*\r
+* SYNOPSIS\r
+*/\r
+#include <complib/cl_packon.h>\r
+typedef struct _ib_grh\r
+{\r
+ ib_net32_t ver_class_flow;\r
+ ib_net16_t resv1;\r
+ uint8_t resv2;\r
+ uint8_t hop_limit;\r
+ ib_gid_t src_gid;\r
+ ib_gid_t dest_gid;\r
+} PACK_SUFFIX ib_grh_t;\r
+#include <complib/cl_packoff.h>\r
+/************/\r
+\r
+/****f* IBA Base: Types/ib_grh_get_ver_class_flow\r
+* NAME\r
+* ib_grh_get_ver_class_flow\r
+*\r
+* DESCRIPTION\r
+* Get encoded version, traffic class and flow label in grh\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE void AL_API\r
+ib_grh_get_ver_class_flow(\r
+ IN const ib_net32_t ver_class_flow,\r
+ OUT uint8_t* const p_ver OPTIONAL,\r
+ OUT uint8_t* const p_tclass OPTIONAL,\r
+ OUT net32_t* const p_flow_lbl OPTIONAL )\r
+{\r
+ ib_net32_t tmp_ver_class_flow;\r
+\r
+ tmp_ver_class_flow = cl_ntoh32( ver_class_flow );\r
+\r
+ if (p_ver)\r
+ *p_ver = (uint8_t)(tmp_ver_class_flow >> 28);\r
+\r
+ if (p_tclass)\r
+ *p_tclass = (uint8_t)(tmp_ver_class_flow >> 20);\r
+\r
+ if (p_flow_lbl)\r
+ *p_flow_lbl = (ver_class_flow & CL_HTON32( 0x000FFFFF ));\r
+}\r
+/*\r
+* PARAMETERS\r
+* ver_class_flow\r
+* [in] the version, traffic class and flow label info.\r
+*\r
+* RETURN VALUES\r
+* p_ver\r
+* [out] pointer to the version info.\r
+*\r
+* p_tclass\r
+* [out] pointer to the traffic class info.\r
+*\r
+* p_flow_lbl\r
+* [out] pointer to the flow label info\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+* ib_grh_t\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_grh_set_ver_class_flow\r
+* NAME\r
+* ib_grh_set_ver_class_flow\r
+*\r
+* DESCRIPTION\r
+* Set encoded version, traffic class and flow label in grh\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE ib_net32_t AL_API\r
+ib_grh_set_ver_class_flow(\r
+ IN const uint8_t ver,\r
+ IN const uint8_t tclass,\r
+ IN const net32_t flow_lbl )\r
+{\r
+ ib_net32_t ver_class_flow;\r
+\r
+ ver_class_flow = cl_hton32( (ver << 28) | (tclass << 20) );\r
+ ver_class_flow |= (flow_lbl & CL_HTON32( 0x000FFFFF ));\r
+ return (ver_class_flow);\r
+}\r
+/*\r
+* PARAMETERS\r
+* ver\r
+* [in] the version info.\r
+*\r
+* tclass\r
+* [in] the traffic class info.\r
+*\r
+* flow_lbl\r
+* [in] the flow label info\r
+*\r
+* RETURN VALUES\r
+* ver_class_flow\r
+* [out] the version, traffic class and flow label info.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+* ib_grh_t\r
+*********/\r
+\r
+/****s* IBA Base: Types/ib_member_rec_t\r
+* NAME\r
+* ib_member_rec_t\r
+*\r
+* DESCRIPTION\r
+* Multicast member record, used to create, join, and leave multicast\r
+* groups.\r
+*\r
+* SYNOPSIS\r
+*/\r
+#include <complib/cl_packon.h>\r
+typedef struct _ib_member_rec\r
+{\r
+ ib_gid_t mgid;\r
+ ib_gid_t port_gid;\r
+ ib_net32_t qkey;\r
+ ib_net16_t mlid;\r
+ uint8_t mtu;\r
+ uint8_t tclass;\r
+ ib_net16_t pkey;\r
+ uint8_t rate;\r
+ uint8_t pkt_life;\r
+ ib_net32_t sl_flow_hop;\r
+ uint8_t scope_state;\r
+ uint8_t proxy_join;\r
+ uint8_t reserved[2];\r
+ uint8_t pad[4];\r
+\r
+} PACK_SUFFIX ib_member_rec_t;\r
+#include <complib/cl_packoff.h>\r
+/*\r
+* FIELDS\r
+* mgid\r
+* Multicast GID address for this multicast group.\r
+*\r
+* port_gid\r
+* Valid GID of the endpoint joining this multicast group.\r
+*\r
+* requestor_gid\r
+* GID of the endpoint making this request on hehave of port_gid.\r
+*\r
+* qkey\r
+* Q_Key to be used by this multicast group.\r
+*\r
+* mlid\r
+* Multicast LID for this multicast group.\r
+*\r
+* mtu\r
+* MTU and MTU selector fields to use on this path\r
+*\r
+* tclass\r
+* Another global routing parameter.\r
+*\r
+* pkey\r
+* Partition key (P_Key) to use for this member.\r
+*\r
+* rate\r
+* Rate and rate selector fields to use on this path.\r
+*\r
+* pkt_life\r
+* Packet lifetime\r
+*\r
+* sl_flow_hop\r
+* Global routing parameters: service level, hop count, and flow label.\r
+*\r
+* scope_state\r
+* MGID scope and JoinState of multicast request.\r
+*\r
+* proxy_join\r
+* Enables others in the Partition to proxy add/remove from the group\r
+*\r
+* SEE ALSO\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_member_get_sl_flow_hop\r
+* NAME\r
+* ib_member_get_sl_flow_hop\r
+*\r
+* DESCRIPTION\r
+* Get encoded sl, flow label, and hop limit\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE void AL_API\r
+ib_member_get_sl_flow_hop(\r
+ IN const ib_net32_t sl_flow_hop,\r
+ OUT uint8_t* const p_sl OPTIONAL,\r
+ OUT net32_t* const p_flow_lbl OPTIONAL,\r
+ OUT uint8_t* const p_hop OPTIONAL )\r
+{\r
+ ib_net32_t tmp_sl_flow_hop;\r
+\r
+ if (p_sl)\r
+ *p_sl = (uint8_t)(sl_flow_hop & 0x0f);\r
+\r
+ tmp_sl_flow_hop = sl_flow_hop >> 4;\r
+\r
+ if (p_flow_lbl)\r
+ *p_flow_lbl = (uint32_t)(tmp_sl_flow_hop & 0xffffff);\r
+\r
+ tmp_sl_flow_hop = tmp_sl_flow_hop >> 20;\r
+\r
+ if (p_hop)\r
+ *p_hop = (uint8_t)(tmp_sl_flow_hop & 0xff);\r
+}\r
+/*\r
+* PARAMETERS\r
+* sl_flow_hop\r
+* [in] the sl, flow label, and hop limit of MC Group\r
+*\r
+* RETURN VALUES\r
+* p_sl\r
+* [out] pointer to the service level\r
+*\r
+* p_flow_lbl\r
+* [out] pointer to the flow label info\r
+*\r
+* p_hop\r
+* [out] pointer to the hop count limit.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+* ib_member_rec_t\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_member_set_sl_flow_hop\r
+* NAME\r
+* ib_member_set_sl_flow_hop\r
+*\r
+* DESCRIPTION\r
+* Set encoded sl, flow label, and hop limit\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE ib_net32_t AL_API\r
+ib_member_set_sl_flow_hop(\r
+ IN const uint8_t sl,\r
+ IN const net32_t flow_lbl,\r
+ IN const uint8_t hop_limit )\r
+{\r
+ ib_net32_t sl_flow_hop;\r
+\r
+ sl_flow_hop = sl;\r
+ sl_flow_hop <<= 20;\r
+ sl_flow_hop |= (cl_ntoh32( flow_lbl ) & 0x000FFFFF);\r
+ sl_flow_hop <<= 8;\r
+ sl_flow_hop |= hop_limit;\r
+ return cl_hton32(sl_flow_hop);\r
+}\r
+/*\r
+* PARAMETERS\r
+* sl\r
+* [in] the service level.\r
+*\r
+* flow_lbl\r
+* [in] the flow label info\r
+*\r
+* hop_limit\r
+* [in] the hop limit.\r
+*\r
+* RETURN VALUES\r
+* sl_flow_hop\r
+* [out] the encoded sl, flow label, and hop limit\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+* ib_member_rec_t\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_member_get_scope\r
+* NAME\r
+* ib_member_get_scope\r
+*\r
+* DESCRIPTION\r
+* Get encoded MGID scope\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE uint8_t AL_API\r
+ib_member_get_scope(\r
+ IN const uint8_t scope_state )\r
+{\r
+ return (scope_state >> 4);\r
+}\r
+/*\r
+* PARAMETERS\r
+* scope_state\r
+* [in] the scope and state\r
+*\r
+* RETURN VALUES\r
+* Encoded scope.\r
+*\r
+* SEE ALSO\r
+* ib_member_rec_t\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_member_get_state\r
+* NAME\r
+* ib_member_get_state\r
+*\r
+* DESCRIPTION\r
+* Get encoded MGID JoinState\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE uint8_t AL_API\r
+ib_member_get_state(\r
+ IN const uint8_t scope_state )\r
+{\r
+ return (scope_state & 0x0f);\r
+}\r
+/*\r
+* PARAMETERS\r
+* scope_state\r
+* [in] the scope and state\r
+*\r
+* RETURN VALUES\r
+* Encoded JoinState\r
+*\r
+* SEE ALSO\r
+* ib_member_rec_t\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_member_get_scope_state\r
+* NAME\r
+* ib_member_get_scope_state\r
+*\r
+* DESCRIPTION\r
+* Get encoded MGID scope and JoinState\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE void AL_API\r
+ib_member_get_scope_state(\r
+ IN const uint8_t scope_state,\r
+ OUT uint8_t* const p_scope,\r
+ OUT uint8_t* const p_state )\r
+{\r
+ if (p_scope)\r
+ *p_scope = ib_member_get_scope( scope_state );\r
+\r
+ if (p_state)\r
+ *p_state = ib_member_get_state( scope_state );\r
+}\r
+/*\r
+* PARAMETERS\r
+* scope_state\r
+* [in] the scope and state\r
+*\r
+* RETURN VALUES\r
+* p_scope\r
+* [out] pointer to the MGID scope\r
+*\r
+* p_state\r
+* [out] pointer to the join state\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+* ib_member_rec_t\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_member_set_scope\r
+* NAME\r
+* ib_member_set_scope\r
+*\r
+* DESCRIPTION\r
+* Set encoded scope of a MCR.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE void AL_API\r
+ib_member_set_scope(\r
+ IN OUT uint8_t* const p_scope_state,\r
+ IN const uint8_t scope )\r
+{\r
+ CL_ASSERT( scope <= 0x0F );\r
+ /* Scope is MS 4-bits. */\r
+ *p_scope_state &= 0xF0;\r
+ *p_scope_state |= (scope << 4);\r
+}\r
+/*\r
+* PARAMETERS\r
+* scope_state\r
+* [in/out] Pointer to the MCR scope_state field.\r
+*\r
+* scope\r
+* [in] The desired scope.\r
+*\r
+* RETURN VALUES\r
+* This function does not return a value.\r
+*\r
+* SEE ALSO\r
+* ib_member_rec_t\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_member_set_state\r
+* NAME\r
+* ib_member_set_state\r
+*\r
+* DESCRIPTION\r
+* Set encoded JoinState of a MCR.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE void AL_API\r
+ib_member_set_state(\r
+ IN OUT uint8_t* const p_scope_state,\r
+ IN const uint8_t state )\r
+{\r
+ CL_ASSERT( state <= 0x0F );\r
+ /* State is LS 4-bits. */\r
+ *p_scope_state &= 0x0F;\r
+ *p_scope_state |= (state & 0x0F);\r
+}\r
+/*\r
+* PARAMETERS\r
+* scope_state\r
+* [in/out] Pointer to the MCR scope_state field to modify.\r
+*\r
+* state\r
+* [in] the JoinState\r
+*\r
+* RETURN VALUES\r
+* This function does not return a value.\r
+*\r
+* SEE ALSO\r
+* ib_member_rec_t\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_member_set_scope_state\r
+* NAME\r
+* ib_member_set_scope_state\r
+*\r
+* DESCRIPTION\r
+* Set encoded version, MGID scope and JoinState\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE uint8_t AL_API\r
+ib_member_set_scope_state(\r
+ IN const uint8_t scope,\r
+ IN const uint8_t state )\r
+{\r
+ /* Scope is MS 4-bits, state is LS 4-bits */\r
+ return ((scope << 4) | (state & 0xF));\r
+}\r
+/*\r
+* PARAMETERS\r
+* scope\r
+* [in] the MGID scope\r
+*\r
+* state\r
+* [in] the JoinState\r
+*\r
+* RETURN VALUES\r
+* scope_state\r
+* [out] the encoded one\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+* ib_member_rec_t\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_member_set_join_state\r
+* NAME\r
+* ib_member_set_join_state\r
+*\r
+* DESCRIPTION\r
+* Set JoinState\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE void AL_API\r
+ib_member_set_join_state(\r
+ IN OUT ib_member_rec_t *p_mc_rec,\r
+ IN const uint8_t state )\r
+{\r
+ p_mc_rec->scope_state &= 0xF0;\r
+ p_mc_rec->scope_state |= (state & 0x0F);\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_mc_rec\r
+* [in] pointer to the member record\r
+*\r
+* state\r
+* [in] the JoinState\r
+*\r
+* RETURN VALUES\r
+* NONE\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+* ib_member_rec_t\r
+*********/\r
+\r
+/*\r
+ * Join State Codes:\r
+ */\r
+#define IB_MC_REC_STATE_FULL_MEMBER 0x01\r
+#define IB_MC_REC_STATE_NON_MEMBER 0x02\r
+#define IB_MC_REC_STATE_SEND_ONLY_MEMBER 0x04\r
+\r
+/*\r
+ * Generic MAD notice types\r
+ */\r
+#define IB_NOTICE_TYPE_FATAL 0x00\r
+#define IB_NOTICE_TYPE_URGENT 0x01\r
+#define IB_NOTICE_TYPE_SECURITY 0x02\r
+#define IB_NOTICE_TYPE_SUBN_MGMT 0x03\r
+#define IB_NOTICE_TYPE_INFO 0x04\r
+#define IB_NOTICE_TYPE_EMPTY 0x7F\r
+\r
+#include <complib/cl_packon.h>\r
+typedef struct _ib_mad_notice_attr\r
+{\r
+ /* is_generic:1, type:7, producer type or vendor id:24 */\r
+ net32_t combo1;\r
+ /* trap number or device id, depending on is_generic. */\r
+ net16_t combo2;\r
+\r
+ net16_t issuer_lid;\r
+ /* notice toggle:1, notice_count:15 */\r
+ net16_t combo3;\r
+\r
+ uint8_t data_details[54];\r
+ ib_gid_t issuer_gid;\r
+\r
+} PACK_SUFFIX ib_mad_notice_attr_t;\r
+#include <complib/cl_packoff.h>\r
+\r
+/****f* IBA Base: Types/ib_notice_get_generic\r
+* NAME\r
+* ib_notice_get_generic\r
+*\r
+* DESCRIPTION\r
+* Retrieves whether a notice trap is generic.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE boolean_t AL_API\r
+ib_notice_get_generic(\r
+ IN const ib_mad_notice_attr_t* const p_notice_attr )\r
+{\r
+ if( cl_ntoh32( p_notice_attr->combo1 ) & 0x00000001 )\r
+ return TRUE;\r
+ return FALSE;\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_notice_attr\r
+* [in] Pointer to the notice attribute structure for which to return\r
+* whether it is generic or not.\r
+*\r
+* RETURN VALUES\r
+* Returns TRUE if the notice is generic.\r
+*\r
+* Returns FALSE if the notice is vendor specific.\r
+*\r
+* SEE ALSO\r
+* ib_mad_notice_attr_t, ib_notice_set_generic\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_notice_set_generic\r
+* NAME\r
+* ib_notice_set_generic\r
+*\r
+* DESCRIPTION\r
+* Sets whether a notice trap is generic.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE void AL_API\r
+ib_notice_set_generic(\r
+ IN OUT ib_mad_notice_attr_t* const p_notice_attr,\r
+ IN const boolean_t is_generic )\r
+{\r
+ uint32_t val;\r
+\r
+ val = cl_ntoh32( p_notice_attr->combo1 );\r
+ if( is_generic )\r
+ val |= 0x00000001;\r
+ else\r
+ val &= 0xFFFFFFFE;\r
+ p_notice_attr->combo1 = cl_hton32( val );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_notice_attr\r
+* [in/out] Pointer to the notice attribute structure for which to set\r
+* the generic bit.\r
+*\r
+* is_generic\r
+* [in] TRUE if the notice is generic, FALSE if vendor specific.\r
+*\r
+* RETURN VALUES\r
+* This function does not return a value.\r
+*\r
+* SEE ALSO\r
+* ib_mad_notice_attr_t, ib_notice_get_generic\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_notice_get_type\r
+* NAME\r
+* ib_notice_get_type\r
+*\r
+* DESCRIPTION\r
+* Retrieves the type of a notice trap.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE uint8_t AL_API\r
+ib_notice_get_type(\r
+ IN const ib_mad_notice_attr_t* const p_notice_attr )\r
+{\r
+ return (uint8_t)((cl_ntoh32( p_notice_attr->combo1 ) >> 1) & 0x0000007F);\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_notice_attr\r
+* [in] Pointer to the notice attribute structure whose type to return.\r
+*\r
+* RETURN VALUES\r
+* Returns the type of the notice.\r
+*\r
+* SEE ALSO\r
+* ib_mad_notice_attr_t, ib_notice_set_type\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_notice_set_type\r
+* NAME\r
+* ib_notice_set_type\r
+*\r
+* DESCRIPTION\r
+* Sets the type of a notice trap.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE void AL_API\r
+ib_notice_set_type(\r
+ IN OUT ib_mad_notice_attr_t* const p_notice_attr,\r
+ IN const uint8_t type )\r
+{\r
+ uint32_t val;\r
+\r
+ val = cl_ntoh32( p_notice_attr->combo1 );\r
+ /* Clear the type. */\r
+ val &= 0xFFFFFF01;\r
+ /* Set new value. */\r
+ val |= (((uint32_t)(type & 0x7F)) << 1);\r
+ p_notice_attr->combo1 = cl_hton32( val );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_notice_attr\r
+* [in/out] Pointer to the notice attribute structure whose type to set.\r
+*\r
+* type\r
+* [in] Type of notice trap.\r
+*\r
+* RETURN VALUES\r
+* This function does not return a value.\r
+*\r
+* SEE ALSO\r
+* ib_mad_notice_attr_t, ib_notice_get_type\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_notice_get_prod_type\r
+* NAME\r
+* ib_notice_get_prod_type\r
+*\r
+* DESCRIPTION\r
+* Retrieves the producer type from a generic notice trap.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE uint32_t AL_API\r
+ib_notice_get_prod_type(\r
+ IN const ib_mad_notice_attr_t* const p_notice_attr )\r
+{\r
+ return (cl_ntoh32( p_notice_attr->combo1 ) >> 8);\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_notice_attr\r
+* [in] Pointer to the notice attribute structure whose\r
+* prducer type to return.\r
+*\r
+* RETURN VALUES\r
+* Returns the producer type of the notice, in host byte order.\r
+*\r
+* SEE ALSO\r
+* ib_mad_notice_attr_t, ib_notice_set_prod_type\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_notice_set_prod_type\r
+* NAME\r
+* ib_notice_set_prod_type\r
+*\r
+* DESCRIPTION\r
+* Sets the producer type of a generic notice trap.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE void AL_API\r
+ib_notice_set_prod_type(\r
+ IN OUT ib_mad_notice_attr_t* const p_notice_attr,\r
+ IN const uint32_t prod_type )\r
+{\r
+ uint32_t val;\r
+\r
+ val = cl_ntoh32( p_notice_attr->combo1 );\r
+ /* Clear the type. */\r
+ val &= 0x000000FF;\r
+ /* Set new value. */\r
+ val |= (prod_type << 8);\r
+ p_notice_attr->combo1 = cl_hton32( val );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_notice_attr\r
+* [in/out] Pointer to the notice attribute structure\r
+* whose producer type to set.\r
+*\r
+* prod_type\r
+* [in] Producer type of notice trap.\r
+*\r
+* RETURN VALUES\r
+* This function does not return a value.\r
+*\r
+* SEE ALSO\r
+* ib_mad_notice_attr_t, ib_notice_get_prod_type\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_notice_get_vend_id\r
+* NAME\r
+* ib_notice_get_vend_id\r
+*\r
+* DESCRIPTION\r
+* Retrieves the vendor ID from a vendor specific notice trap.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE uint32_t AL_API\r
+ib_notice_get_vend_id(\r
+ IN const ib_mad_notice_attr_t* const p_notice_attr )\r
+{\r
+ return ib_notice_get_prod_type( p_notice_attr );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_notice_attr\r
+* [in] Pointer to the notice attribute structure whose\r
+* vendor ID to return.\r
+*\r
+* RETURN VALUES\r
+* Returns the vendor ID of the notice, in host byte order.\r
+*\r
+* SEE ALSO\r
+* ib_mad_notice_attr_t, ib_notice_set_vend_id\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_notice_set_vend_id\r
+* NAME\r
+* ib_notice_set_vend_id\r
+*\r
+* DESCRIPTION\r
+* Sets the vendor ID of a vendor specific notice trap.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE void AL_API\r
+ib_notice_set_vend_id(\r
+ IN OUT ib_mad_notice_attr_t* const p_notice_attr,\r
+ IN const uint32_t vend_id )\r
+{\r
+ ib_notice_set_prod_type( p_notice_attr, vend_id );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_notice_attr\r
+* [in/out] Pointer to the notice attribute structure\r
+* whose vendor ID to set.\r
+*\r
+* vend_id\r
+* [in] Vendor ID of notice trap.\r
+*\r
+* RETURN VALUES\r
+* This function does not return a value.\r
+*\r
+* SEE ALSO\r
+* ib_mad_notice_attr_t, ib_notice_get_vend_id\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_notice_get_trap_num\r
+* NAME\r
+* ib_notice_get_trap_num\r
+*\r
+* DESCRIPTION\r
+* Retrieves the trap number from a generic notice trap.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE uint16_t AL_API\r
+ib_notice_get_trap_num(\r
+ IN const ib_mad_notice_attr_t* const p_notice_attr )\r
+{\r
+ return cl_ntoh16( p_notice_attr->combo2 );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_notice_attr\r
+* [in] Pointer to the notice attribute structure whose\r
+* trap number to return.\r
+*\r
+* RETURN VALUES\r
+* Returns the vendor ID of the notice, in host byte order.\r
+*\r
+* SEE ALSO\r
+* ib_mad_notice_attr_t, ib_notice_set_trap_num\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_notice_set_trap_num\r
+* NAME\r
+* ib_notice_set_trap_num\r
+*\r
+* DESCRIPTION\r
+* Sets the trap number of a generic notice trap.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE void AL_API\r
+ib_notice_set_trap_num(\r
+ IN OUT ib_mad_notice_attr_t* const p_notice_attr,\r
+ IN const uint16_t trap_num )\r
+{\r
+ p_notice_attr->combo2 = cl_hton16( trap_num );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_notice_attr\r
+* [in/out] Pointer to the notice attribute structure\r
+* whose trap number to set.\r
+*\r
+* trap_num\r
+* [in] Trap number to set.\r
+*\r
+* RETURN VALUES\r
+* This function does not return a value.\r
+*\r
+* SEE ALSO\r
+* ib_mad_notice_attr_t, ib_notice_get_trap_num\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_notice_get_dev_id\r
+* NAME\r
+* ib_notice_get_dev_id\r
+*\r
+* DESCRIPTION\r
+* Retrieves the device ID from a vendor specific notice trap.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE uint16_t AL_API\r
+ib_notice_get_dev_id(\r
+ IN const ib_mad_notice_attr_t* const p_notice_attr )\r
+{\r
+ return ib_notice_get_trap_num( p_notice_attr );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_notice_attr\r
+* [in] Pointer to the notice attribute structure whose\r
+* device ID to return.\r
+*\r
+* RETURN VALUES\r
+* Returns the vendor ID of the notice, in host byte order.\r
+*\r
+* SEE ALSO\r
+* ib_mad_notice_attr_t, ib_notice_set_dev_id\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_notice_set_dev_id\r
+* NAME\r
+* ib_notice_set_dev_id\r
+*\r
+* DESCRIPTION\r
+* Sets the producer type of a vendor specific notice trap.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE void AL_API\r
+ib_notice_set_dev_id(\r
+ IN OUT ib_mad_notice_attr_t* const p_notice_attr,\r
+ IN const uint16_t dev_id )\r
+{\r
+ ib_notice_set_trap_num( p_notice_attr, dev_id );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_notice_attr\r
+* [in/out] Pointer to the notice attribute structure\r
+* whose device ID to set.\r
+*\r
+* dev_id\r
+* [in] Device ID of notice trap.\r
+*\r
+* RETURN VALUES\r
+* This function does not return a value.\r
+*\r
+* SEE ALSO\r
+* ib_mad_notice_attr_t, ib_notice_get_dev_id\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_notice_get_toggle\r
+* NAME\r
+* ib_notice_get_toggle\r
+*\r
+* DESCRIPTION\r
+* Retrieves the notice toggle bit from a notice trap.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE boolean_t AL_API\r
+ib_notice_get_toggle(\r
+ IN const ib_mad_notice_attr_t* const p_notice_attr )\r
+{\r
+ return (cl_ntoh16( p_notice_attr->combo3 ) & 0x0001);\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_notice_attr\r
+* [in] Pointer to the notice attribute structure whose\r
+* notice toggle bit value to return.\r
+*\r
+* RETURN VALUES\r
+* Returns TRUE if the notice toggle bit of the notice is set.\r
+*\r
+* Returns FALSE otherwise.\r
+*\r
+* SEE ALSO\r
+* ib_mad_notice_attr_t, ib_notice_set_toggle\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_notice_set_toggle\r
+* NAME\r
+* ib_notice_set_toggle\r
+*\r
+* DESCRIPTION\r
+* Sets the notice toggle bit of a notice trap.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE void AL_API\r
+ib_notice_set_toggle(\r
+ IN OUT ib_mad_notice_attr_t* const p_notice_attr,\r
+ IN const boolean_t toggle_val )\r
+{\r
+ uint16_t val;\r
+ val = cl_ntoh16( p_notice_attr->combo3 );\r
+ if( toggle_val )\r
+ val |= 0x0001;\r
+ else\r
+ val &= 0xFFFE;\r
+ p_notice_attr->combo3 = cl_hton16( val );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_notice_attr\r
+* [in/out] Pointer to the notice attribute structure\r
+* whose notice toggle bit to set or clear.\r
+*\r
+* toggle_val\r
+* [in] Boolean value indicating whether the toggle bit of the notice\r
+* should be set or cleared.\r
+*\r
+* RETURN VALUES\r
+* This function does not return a value.\r
+*\r
+* SEE ALSO\r
+* ib_mad_notice_attr_t, ib_notice_get_toggle\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_notice_get_count\r
+* NAME\r
+* ib_notice_get_count\r
+*\r
+* DESCRIPTION\r
+* Retrieves the notice toggle count from a notice trap.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE boolean_t AL_API\r
+ib_notice_get_count(\r
+ IN const ib_mad_notice_attr_t* const p_notice_attr )\r
+{\r
+ return ((cl_ntoh16( p_notice_attr->combo3 ) & 0xFFFE) >> 1);\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_notice_attr\r
+* [in] Pointer to the notice attribute structure whose\r
+* notice toggle count to return.\r
+*\r
+* RETURN VALUES\r
+* Returns the notice toggle count of the notice.\r
+*\r
+* SEE ALSO\r
+* ib_mad_notice_attr_t, ib_notice_set_count\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_notice_set_count\r
+* NAME\r
+* ib_notice_set_count\r
+*\r
+* DESCRIPTION\r
+* Sets the toggle count of a notice trap.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE void AL_API\r
+ib_notice_set_count(\r
+ IN OUT ib_mad_notice_attr_t* const p_notice_attr,\r
+ IN const uint16_t toggle_cnt )\r
+{\r
+ uint16_t val;\r
+ val = cl_ntoh16( p_notice_attr->combo3 );\r
+ val &= 0x0001;\r
+ val |= (toggle_cnt << 1);\r
+ p_notice_attr->combo3 = cl_hton16( val );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_notice_attr\r
+* [in/out] Pointer to the notice attribute structure\r
+* whose device ID to set.\r
+*\r
+* toggle_cnt\r
+* [in] Toggle count value of the notice.\r
+*\r
+* RETURN VALUES\r
+* This function does not return a value.\r
+*\r
+* SEE ALSO\r
+* ib_mad_notice_attr_t, ib_notice_get_count\r
+*********/\r
+\r
+#include <complib/cl_packon.h>\r
+typedef struct _ib_inform_info\r
+{\r
+ ib_gid_t gid;\r
+\r
+ ib_net16_t lid_range_begin;\r
+ ib_net16_t lid_range_end;\r
+ // EZ: not v1.1 ib_net16_t pkey;\r
+ ib_net16_t reserved;\r
+ uint8_t is_generic;\r
+ uint8_t subscribe;\r
+ // EZ: not v1.1 ib_net16_t class_range;\r
+ ib_net16_t trap_type;\r
+\r
+ /* trap num or dev_id */\r
+ ib_net16_t combo1;\r
+ /* QPN:24, resv:3, resp_time_val:5 */\r
+ ib_net32_t combo2;\r
+ /* resv:8, producer type or vendor id:24 */\r
+ ib_net32_t combo3;\r
+\r
+} PACK_SUFFIX ib_inform_info_t;\r
+#include <complib/cl_packoff.h>\r
+\r
+/****f* IBA Base: Types/ib_inform_get_trap_num\r
+* NAME\r
+* ib_inform_get_trap_num\r
+*\r
+* DESCRIPTION\r
+* Retrieves the trap number from an inform info structure.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE uint16_t AL_API\r
+ib_inform_get_trap_num(\r
+ IN const ib_inform_info_t* const p_inform_info )\r
+{\r
+ return cl_ntoh16( p_inform_info->combo1 );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_inform_info\r
+* [in] Pointer to the inform info structure whose\r
+* trap number to return.\r
+*\r
+* RETURN VALUES\r
+* Returns the trap number of the infrom info, in host byte order.\r
+*\r
+* SEE ALSO\r
+* ib_inform_info_t, ib_inform_set_trap_num\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_inform_set_trap_num\r
+* NAME\r
+* ib_inform_set_trap_num\r
+*\r
+* DESCRIPTION\r
+* Sets the trap number of an inform info structure.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE void AL_API\r
+ib_inform_set_trap_num(\r
+ IN OUT ib_inform_info_t* const p_inform_info,\r
+ IN const uint16_t trap_num )\r
+{\r
+ p_inform_info->combo1 = cl_hton16( trap_num );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_inform_info\r
+* [in/out] Pointer to the inform info structure\r
+* whose trap number to set.\r
+*\r
+* trap_num\r
+* [in] Trap number to set.\r
+*\r
+* RETURN VALUES\r
+* This function does not return a value.\r
+*\r
+* SEE ALSO\r
+* ib_inform_info_t, ib_inform_get_trap_num\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_inform_get_dev_id\r
+* NAME\r
+* ib_inform_get_dev_id\r
+*\r
+* DESCRIPTION\r
+* Retrieves the device ID from a vendor specific inform trap.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE uint16_t AL_API\r
+ib_inform_get_dev_id(\r
+ IN const ib_inform_info_t* const p_inform_info )\r
+{\r
+ return ib_inform_get_trap_num( p_inform_info );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_inform_info\r
+* [in] Pointer to the inform info structure whose\r
+* device ID to return.\r
+*\r
+* RETURN VALUES\r
+* Returns the vendor ID of the inform info, in host byte order.\r
+*\r
+* SEE ALSO\r
+* ib_inform_info_t, ib_inform_set_dev_id\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_inform_set_dev_id\r
+* NAME\r
+* ib_inform_set_dev_id\r
+*\r
+* DESCRIPTION\r
+* Sets the producer type of a vendor specific inform trap.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE void AL_API\r
+ib_inform_set_dev_id(\r
+ IN OUT ib_inform_info_t* const p_inform_info,\r
+ IN const uint16_t dev_id )\r
+{\r
+ ib_inform_set_trap_num( p_inform_info, dev_id );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_inform_info\r
+* [in/out] Pointer to the inform info structure\r
+* whose device ID to set.\r
+*\r
+* dev_id\r
+* [in] Device ID of inform trap.\r
+*\r
+* RETURN VALUES\r
+* This function does not return a value.\r
+*\r
+* SEE ALSO\r
+* ib_inform_info_t, ib_inform_get_dev_id\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_inform_get_qpn\r
+* NAME\r
+* ib_inform_get_qpn\r
+*\r
+* DESCRIPTION\r
+* Retrieves the QPN from an inform info structure.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE net32_t AL_API\r
+ib_inform_get_qpn(\r
+ IN const ib_inform_info_t* const p_inform_info )\r
+{\r
+ return (p_inform_info->combo2 & CL_NTOH32( 0x00FFFFFF ));\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_inform_info\r
+* [in] Pointer to the inform info structure whose\r
+* QPN to return.\r
+*\r
+* RETURN VALUES\r
+* Returns the QPN of the infrom info.\r
+*\r
+* SEE ALSO\r
+* ib_inform_info_t, ib_inform_set_qpn\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_inform_set_qpn\r
+* NAME\r
+* ib_inform_set_qpn\r
+*\r
+* DESCRIPTION\r
+* Sets the QPN of an inform info structure.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE void AL_API\r
+ib_inform_set_qpn(\r
+ IN OUT ib_inform_info_t* const p_inform_info,\r
+ IN const net32_t qpn )\r
+{\r
+ p_inform_info->combo2 &= CL_NTOH32( 0xFF000000 );\r
+ p_inform_info->combo2 |= (qpn & CL_NTOH32( 0x00FFFFFF ));\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_inform_info\r
+* [in/out] Pointer to the inform info structure\r
+* whose QPN to set.\r
+*\r
+* qpn\r
+* [in] QPN of the inform info.\r
+*\r
+* RETURN VALUES\r
+* This function does not return a value.\r
+*\r
+* SEE ALSO\r
+* ib_inform_info_t, ib_inform_get_qpn\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_inform_get_resp_time_val\r
+* NAME\r
+* ib_inform_get_resp_time_val\r
+*\r
+* DESCRIPTION\r
+* Retrieves the response time value from an inform info structure.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE uint8_t AL_API\r
+ib_inform_get_resp_time_val(\r
+ IN const ib_inform_info_t* const p_inform_info )\r
+{\r
+ return (uint8_t)(cl_ntoh32( p_inform_info->combo2 ) >> 27);\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_inform_info\r
+* [in] Pointer to the inform info structure whose\r
+* response time value to return.\r
+*\r
+* RETURN VALUES\r
+* Returns the response time value of the infrom info.\r
+*\r
+* SEE ALSO\r
+* ib_inform_info_t, ib_inform_set_resp_time_val\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_inform_set_resp_time_val\r
+* NAME\r
+* ib_inform_set_resp_time_val\r
+*\r
+* DESCRIPTION\r
+* Sets the response time value of an inform info structure.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE void AL_API\r
+ib_inform_set_resp_time_val(\r
+ IN OUT ib_inform_info_t* const p_inform_info,\r
+ IN const uint8_t resp_time_val )\r
+{\r
+ uint32_t val;\r
+\r
+ val = cl_ntoh32( p_inform_info->combo2 );\r
+ val &= 0x07FFFFFF;\r
+ val |= (resp_time_val << 27);\r
+ p_inform_info->combo2 = cl_hton32( val );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_inform_info\r
+* [in/out] Pointer to the inform info structure\r
+* whose response time value to set.\r
+*\r
+* resp_time_val\r
+* [in] Response time value of the inform info.\r
+*\r
+* RETURN VALUES\r
+* This function does not return a value.\r
+*\r
+* SEE ALSO\r
+* ib_inform_info_t, ib_inform_get_resp_time_val\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_inform_get_prod_type\r
+* NAME\r
+* ib_inform_get_prod_type\r
+*\r
+* DESCRIPTION\r
+* Retrieves the producer type from an inform info structure.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE uint32_t AL_API\r
+ib_inform_get_prod_type(\r
+ IN const ib_inform_info_t* const p_inform_info )\r
+{\r
+ return (cl_ntoh32( p_inform_info->combo3 ) >> 8);\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_inform_info\r
+* [in] Pointer to the inform info structure whose\r
+* prducer type to return.\r
+*\r
+* RETURN VALUES\r
+* Returns the producer type of the infrom info, in host byte order.\r
+*\r
+* SEE ALSO\r
+* ib_inform_info_t, ib_inform_set_prod_type\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_inform_set_prod_type\r
+* NAME\r
+* ib_inform_set_prod_type\r
+*\r
+* DESCRIPTION\r
+* Sets the producer type of an inform info structure.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE void AL_API\r
+ib_inform_set_prod_type(\r
+ IN OUT ib_inform_info_t* const p_inform_info,\r
+ IN const uint32_t prod_type )\r
+{\r
+ p_inform_info->combo3 = cl_hton32( prod_type << 8 );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_inform_info\r
+* [in/out] Pointer to the inform info structure\r
+* whose producer type to set.\r
+*\r
+* prod_type\r
+* [in] Producer type of inform trap.\r
+*\r
+* RETURN VALUES\r
+* This function does not return a value.\r
+*\r
+* SEE ALSO\r
+* ib_inform_info_t, ib_inform_get_prod_type\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_inform_get_vend_id\r
+* NAME\r
+* ib_inform_get_vend_id\r
+*\r
+* DESCRIPTION\r
+* Retrieves the vendor ID from an inform info structure.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE uint32_t AL_API\r
+ib_inform_get_vend_id(\r
+ IN const ib_inform_info_t* const p_inform_info )\r
+{\r
+ return ib_inform_get_prod_type( p_inform_info );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_inform_info\r
+* [in] Pointer to the inform info structure whose\r
+* vendor ID to return.\r
+*\r
+* RETURN VALUES\r
+* Returns the vendor ID of the infrom info, in host byte order.\r
+*\r
+* SEE ALSO\r
+* ib_inform_info_t, ib_inform_set_vend_id\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_inform_set_vend_id\r
+* NAME\r
+* ib_inform_set_vend_id\r
+*\r
+* DESCRIPTION\r
+* Sets the vendor ID of an inform info structure.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE void AL_API\r
+ib_inform_set_vend_id(\r
+ IN OUT ib_inform_info_t* const p_inform_info,\r
+ IN const uint32_t vend_id )\r
+{\r
+ ib_inform_set_prod_type( p_inform_info, vend_id );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_inform_info\r
+* [in/out] Pointer to the inform info structure\r
+* whose vendor ID to set.\r
+*\r
+* vend_id\r
+* [in] Vendor ID of inform trap.\r
+*\r
+* RETURN VALUES\r
+* This function does not return a value.\r
+*\r
+* SEE ALSO\r
+* ib_mad_inform_info_t, ib_inform_get_vend_id\r
+*********/\r
+\r
+/****s* IBA Base: Types/ib_inform_info_record_t\r
+* NAME\r
+* ib_inform_info_record_t\r
+*\r
+* DESCRIPTION\r
+* IBA defined InformInfo Record. (15.2.5.12)\r
+*\r
+* SYNOPSIS\r
+*/\r
+#include <complib/cl_packon.h>\r
+typedef struct _ib_inform_info_record\r
+{\r
+ ib_gid_t subscriber_gid;\r
+ net16_t subscriber_enum;\r
+ uint16_t reserved[3];\r
+ ib_inform_info_t inform_info;\r
+\r
+} PACK_SUFFIX ib_inform_info_record_t;\r
+#include <complib/cl_packoff.h>\r
+/********/\r
+/****d* IBA Base: Types/DM_SVC_NAME\r
+* NAME\r
+* DM_SVC_NAME\r
+*\r
+* DESCRIPTION\r
+* IBA defined Device Management service name (16.3)\r
+*\r
+* SYNOPSIS\r
+*/\r
+#define DM_SVC_NAME "DeviceManager.IBTA"\r
+/*\r
+* SEE ALSO\r
+*********/\r
+\r
+/****s* IBA Base: Types/ib_dm_mad_t\r
+* NAME\r
+* ib_dm_mad_t\r
+*\r
+* DESCRIPTION\r
+* IBA defined Device Management MAD (16.3.1)\r
+*\r
+* SYNOPSIS\r
+*/\r
+#include <complib/cl_packon.h>\r
+typedef struct _ib_dm_mad\r
+{\r
+ ib_mad_t hdr;\r
+ uint8_t resv[40];\r
+\r
+#define IB_DM_DATA_SIZE 192\r
+ uint8_t data[IB_DM_DATA_SIZE];\r
+\r
+} PACK_SUFFIX ib_dm_mad_t;\r
+#include <complib/cl_packoff.h>\r
+/*\r
+* FIELDS\r
+* hdr\r
+* Common MAD header.\r
+*\r
+* resv\r
+* Reserved.\r
+*\r
+* data\r
+* Device Management payload. The structure and content of this field\r
+* depend upon the method, attr_id, and attr_mod fields in the header.\r
+*\r
+* SEE ALSO\r
+* ib_mad_t\r
+*********/\r
+\r
+/****s* IBA Base: Types/ib_iou_info_t\r
+* NAME\r
+* ib_iou_info_t\r
+*\r
+* DESCRIPTION\r
+* IBA defined IO Unit information structure (16.3.3.3)\r
+*\r
+* SYNOPSIS\r
+*/\r
+#include <complib/cl_packon.h>\r
+typedef struct _ib_iou_info\r
+{\r
+ ib_net16_t change_id;\r
+ uint8_t max_controllers;\r
+ uint8_t diag_rom;\r
+\r
+#define IB_DM_CTRL_LIST_SIZE 128\r
+#define IB_DM_MAX_CTRL 0xFF;\r
+\r
+ uint8_t controller_list[IB_DM_CTRL_LIST_SIZE];\r
+#define IOC_NOT_INSTALLED 0x0\r
+#define IOC_INSTALLED 0x1\r
+// Reserved values 0x02-0xE\r
+#define SLOT_DOES_NOT_EXIST 0xF\r
+\r
+} PACK_SUFFIX ib_iou_info_t;\r
+#include <complib/cl_packoff.h>\r
+/*\r
+* FIELDS\r
+* change_id\r
+* Value incremented, with rollover, by any change to the controller_list.\r
+*\r
+* max_controllers\r
+* Number of slots in controller_list.\r
+*\r
+* diag_rom\r
+* A byte containing two fields: DiagDeviceID and OptionROM.\r
+* These fields may be read using the ib_iou_info_diag_dev_id\r
+* and ib_iou_info_option_rom functions.\r
+*\r
+* controller_list\r
+* A series of 4-bit nibbles, with each nibble representing a slot\r
+* in the IO Unit. Individual nibbles may be read using the\r
+* ioc_at_slot function.\r
+*\r
+* SEE ALSO\r
+* ib_dm_mad_t, ib_iou_info_diag_dev_id, ib_iou_info_option_rom, ioc_at_slot\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_iou_info_diag_dev_id\r
+* NAME\r
+* ib_iou_info_diag_dev_id\r
+*\r
+* DESCRIPTION\r
+* Returns the DiagDeviceID.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE uint8_t AL_API\r
+ib_iou_info_diag_dev_id(\r
+ IN const ib_iou_info_t* const p_iou_info )\r
+{\r
+ return( (uint8_t)(p_iou_info->diag_rom >> 6 & 1) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_iou_info\r
+* [in] Pointer to the IO Unit information structure.\r
+*\r
+* RETURN VALUES\r
+* DiagDeviceID field of the IO Unit information.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+* ib_iou_info_t\r
+*********/\r
+\r
+/****f* IBA Base: Types/ib_iou_info_option_rom\r
+* NAME\r
+* ib_iou_info_option_rom\r
+*\r
+* DESCRIPTION\r
+* Returns the OptionROM.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE uint8_t AL_API\r
+ib_iou_info_option_rom(\r
+ IN const ib_iou_info_t* const p_iou_info )\r
+{\r
+ return( (uint8_t)(p_iou_info->diag_rom >> 7) );\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_iou_info\r
+* [in] Pointer to the IO Unit information structure.\r
+*\r
+* RETURN VALUES\r
+* OptionROM field of the IO Unit information.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+* ib_iou_info_t\r
+*********/\r
+\r
+/****f* IBA Base: Types/ioc_at_slot\r
+* NAME\r
+* ioc_at_slot\r
+*\r
+* DESCRIPTION\r
+* Returns the IOC value at the specified slot.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_INLINE uint8_t AL_API\r
+ioc_at_slot(\r
+ IN const ib_iou_info_t* const p_iou_info,\r
+ IN uint8_t slot )\r
+{\r
+ if( !slot )\r
+ return SLOT_DOES_NOT_EXIST;\r
+ else if( slot-- & 0x01 )\r
+ return (p_iou_info->controller_list[slot >> 1] >> 4);\r
+ else\r
+ return (p_iou_info->controller_list[slot >> 1] & 0x0F);\r
+}\r
+/*\r
+* PARAMETERS\r
+* p_iou_info\r
+* [in] Pointer to the IO Unit information structure.\r
+*\r
+* slot\r
+* [in] 1-based slot number of the IOC slot to check.\r
+*\r
+* RETURN VALUES\r
+* Returns the encoded value for the desired slot. Possible values are\r
+* SLOT_DOES_NOT_EXIST, IOC_NOT_INSTALLED, and IOC_INSTALLED.\r
+*\r
+* NOTES\r
+* The input slot number is 1-based, not zero based.\r
+*\r
+* SEE ALSO\r
+* ib_iou_info_t\r
+*********/\r
+\r
+/****s* IBA Base: Types/ib_ioc_profile_t\r
+* NAME\r
+* ib_ioc_profile_t\r
+*\r
+* DESCRIPTION\r
+* IBA defined IO Controller profile structure (16.3.3.4)\r
+*\r
+* SYNOPSIS\r
+*/\r
+#include <complib/cl_packon.h>\r
+typedef __declspec(align(8)) struct _ib_ioc_profile\r
+{\r
+ ib_net64_t ioc_guid;\r
+\r
+ ib_net32_t vend_id;\r
+\r
+ ib_net32_t dev_id;\r
+ ib_net16_t dev_ver;\r
+ ib_net16_t resv2;\r
+\r
+ ib_net32_t subsys_vend_id;\r
+ ib_net32_t subsys_id;\r
+\r
+ ib_net16_t io_class;\r
+ ib_net16_t io_subclass;\r
+ ib_net16_t protocol;\r
+ ib_net16_t protocol_ver;\r
+\r
+ ib_net32_t resv3;\r
+ ib_net16_t send_msg_depth;\r
+ uint8_t resv4;\r
+ uint8_t rdma_read_depth;\r
+ ib_net32_t send_msg_size;\r
+ ib_net32_t rdma_size;\r
+\r
+ uint8_t ctrl_ops_cap;\r
+#define CTRL_OPS_CAP_ST 0x01\r
+#define CTRL_OPS_CAP_SF 0x02\r
+#define CTRL_OPS_CAP_RT 0x04\r
+#define CTRL_OPS_CAP_RF 0x08\r
+#define CTRL_OPS_CAP_WT 0x10\r
+#define CTRL_OPS_CAP_WF 0x20\r
+#define CTRL_OPS_CAP_AT 0x40\r
+#define CTRL_OPS_CAP_AF 0x80\r
+\r
+ uint8_t resv5;\r
+\r
+ uint8_t num_svc_entries;\r
+#define MAX_NUM_SVC_ENTRIES 0xff\r
+\r
+ uint8_t resv6[9];\r
+\r
+#define CTRL_ID_STRING_LEN 64\r
+ char id_string[CTRL_ID_STRING_LEN];\r
+\r
+} PACK_SUFFIX ib_ioc_profile_t;\r
+#include <complib/cl_packoff.h>\r
+/*\r
+* FIELDS\r
+* ioc_guid\r
+* An EUI-64 GUID used to uniquely identify the IO controller.\r
+*\r
+* vend_id\r
+* IO controller vendor ID, IEEE format.\r
+*\r
+* dev_id\r
+* A number assigned by the vendor to identify the type of controller.\r
+*\r
+* dev_ver\r
+* A number assigned by the vendor to identify the divice version.\r
+*\r
+* subsys_vend_id\r
+* ID of the vendor of the enclosure, if any, in which the IO controller\r
+* resides in IEEE format; otherwise zero.\r
+*\r
+* subsys_id\r
+* A number identifying the subsystem where the controller resides.\r
+*\r
+* io_class\r
+* 0x0000 - 0xfffe = reserved for IO classes encompased by InfiniBand\r
+* Architecture. 0xffff = Vendor specific.\r
+*\r
+* io_subclass\r
+* 0x0000 - 0xfffe = reserved for IO subclasses encompased by InfiniBand\r
+* Architecture. 0xffff = Vendor specific. This shall be set to 0xfff\r
+* if the io_class component is 0xffff.\r
+*\r
+* protocol\r
+* 0x0000 - 0xfffe = reserved for IO subclasses encompased by InfiniBand\r
+* Architecture. 0xffff = Vendor specific. This shall be set to 0xfff\r
+* if the io_class component is 0xffff.\r
+*\r
+* protocol_ver\r
+* Protocol specific.\r
+*\r
+* send_msg_depth\r
+* Maximum depth of the send message queue.\r
+*\r
+* rdma_read_depth\r
+* Maximum depth of the per-channel RDMA read queue.\r
+*\r
+* send_msg_size\r
+* Maximum size of send messages.\r
+*\r
+* ctrl_ops_cap\r
+* Supported operation types of this IO controller. A bit set to one\r
+* for affirmation of supported capability.\r
+*\r
+* num_svc_entries\r
+* Number of entries in the service entries table.\r
+*\r
+* id_string\r
+* UTF-8 encoded string for identifying the controller to an operator.\r
+*\r
+* SEE ALSO\r
+* ib_dm_mad_t\r
+*********/\r
+\r
+\r
+AL_INLINE uint32_t AL_API\r
+ib_ioc_profile_get_vend_id(\r
+ IN const ib_ioc_profile_t* const p_ioc_profile )\r
+{\r
+ return( cl_ntoh32(p_ioc_profile->vend_id) >> 8 );\r
+}\r
+\r
+\r
+AL_INLINE void AL_API\r
+ib_ioc_profile_set_vend_id(\r
+ IN ib_ioc_profile_t* const p_ioc_profile,\r
+ IN const uint32_t vend_id )\r
+{\r
+ p_ioc_profile->vend_id = (cl_hton32(vend_id) << 8);\r
+}\r
+\r
+\r
+AL_INLINE uint32_t AL_API\r
+ib_ioc_profile_get_subsys_vend_id(\r
+ IN const ib_ioc_profile_t* const p_ioc_profile )\r
+{\r
+ return( cl_ntoh32(p_ioc_profile->subsys_vend_id) >> 8 );\r
+}\r
+\r
+\r
+AL_INLINE void AL_API\r
+ib_ioc_profile_set_subsys_vend_id(\r
+ IN ib_ioc_profile_t* const p_ioc_profile,\r
+ IN const uint32_t subsys_vend_id )\r
+{\r
+ p_ioc_profile->subsys_id = (cl_hton32(subsys_vend_id) << 8);\r
+}\r
+\r
+/****s* IBA Base: Types/ib_svc_entry_t\r
+* NAME\r
+* ib_svc_entry_t\r
+*\r
+* DESCRIPTION\r
+* IBA defined IO Controller service entry structure (16.3.3.5)\r
+*\r
+* SYNOPSIS\r
+*/\r
+#include <complib/cl_packon.h>\r
+typedef struct _ib_svc_entry\r
+{\r
+#define MAX_SVC_ENTRY_NAME_LEN 40\r
+ char name[MAX_SVC_ENTRY_NAME_LEN];\r
+\r
+ ib_net64_t id;\r
+\r
+} PACK_SUFFIX ib_svc_entry_t;\r
+#include <complib/cl_packoff.h>\r
+/*\r
+* FIELDS\r
+* name\r
+* UTF-8 encoded, null-terminated name of the service.\r
+*\r
+* id\r
+* An identifier of the associated Service.\r
+*\r
+* SEE ALSO\r
+* ib_svc_entries_t\r
+*********/\r
+\r
+/****s* IBA Base: Types/ib_svc_entries_t\r
+* NAME\r
+* ib_svc_entries_t\r
+*\r
+* DESCRIPTION\r
+* IBA defined IO Controller service entry array (16.3.3.5)\r
+*\r
+* SYNOPSIS\r
+*/\r
+#include <complib/cl_packon.h>\r
+typedef struct _ib_svc_entries\r
+{\r
+#define SVC_ENTRY_COUNT 4\r
+ ib_svc_entry_t service_entry[SVC_ENTRY_COUNT];\r
+\r
+} PACK_SUFFIX ib_svc_entries_t;\r
+#include <complib/cl_packoff.h>\r
+/*\r
+* FIELDS\r
+* service_entry\r
+* An array of IO controller service entries.\r
+*\r
+* SEE ALSO\r
+* ib_dm_mad_t, ib_svc_entry_t\r
+*********/\r
+\r
+\r
+/****f* IBA Bases: Types/ib_dm_get_slot_lo_hi\r
+* DESCRIPTION\r
+* Returns the IOC slot number, and the lower and upper bound of the\r
+* service entries given the attribute modifier of ServiceEntries response.\r
+*/\r
+AL_INLINE void AL_API\r
+ib_dm_get_slot_lo_hi(\r
+ IN const ib_net32_t slot_lo_hi,\r
+ OUT uint8_t *const p_slot OPTIONAL,\r
+ OUT uint8_t *const p_lo OPTIONAL,\r
+ OUT uint8_t *const p_hi OPTIONAL )\r
+{\r
+ ib_net32_t tmp_slot_lo_hi = CL_NTOH32( slot_lo_hi );\r
+\r
+ if( p_slot )\r
+ *p_slot = (uint8_t)( ( tmp_slot_lo_hi >> 16 ) );\r
+\r
+ if( p_hi )\r
+ *p_hi = (uint8_t)( ( tmp_slot_lo_hi >> 8 ) );\r
+\r
+ if( p_lo )\r
+ *p_lo = (uint8_t)( ( tmp_slot_lo_hi >> 0 ) );\r
+}\r
+/* SEE ALSO\r
+* ib_dm_set_slot_lo_hi\r
+********/\r
+\r
+/****f* IBA Bases: Types/ib_dm_set_slot_lo_hi\r
+* DESCRIPTION\r
+* Joins the IOC slot number, and the lower and upper bound of the service \r
+* entries and returns it.\r
+*/\r
+AL_INLINE net32_t AL_API\r
+ib_dm_set_slot_lo_hi(\r
+ IN const uint8_t slot,\r
+ IN const uint8_t lo,\r
+ IN const uint8_t hi )\r
+{\r
+ uint32_t tmp;\r
+\r
+ tmp = slot << 16;\r
+ tmp |= hi << 8;\r
+ tmp |= lo;\r
+ return cl_hton32( tmp );\r
+}\r
+/* SEE ALSO\r
+* ib_dm_get_slot_lo_hi\r
+********/\r
+\r
+/*\r
+ * Information describing an I/O controller\r
+ */\r
+#pragma warning(disable:4324)\r
+typedef struct _ib_ioc_info\r
+{\r
+ net64_t chassis_guid;\r
+ uint8_t chassis_slot;\r
+ net64_t iou_guid;\r
+ uint8_t iou_slot;\r
+ ib_ioc_profile_t profile;\r
+\r
+} ib_ioc_info_t;\r
+#pragma warning(default:4324)\r
+\r
+\r
+/*\r
+ * Defines known Communication management class versions\r
+ */\r
+#define IB_MCLASS_CM_VER_2 2\r
+#define IB_MCLASS_CM_VER_1 1\r
+\r
+/*\r
+ * Defines the size of user available data in communication management MADs\r
+ */\r
+#define IB_REQ_PDATA_SIZE 92\r
+#define IB_MRA_PDATA_SIZE 222\r
+#define IB_REJ_PDATA_SIZE 148\r
+#define IB_REP_PDATA_SIZE 196\r
+#define IB_RTU_PDATA_SIZE 224\r
+#define IB_LAP_PDATA_SIZE 168\r
+#define IB_APR_PDATA_SIZE 148\r
+#define IB_DREQ_PDATA_SIZE 220\r
+#define IB_DREP_PDATA_SIZE 224\r
+#define IB_SIDR_REQ_PDATA_SIZE 216\r
+#define IB_SIDR_REP_PDATA_SIZE 136\r
+\r
+#define IB_ARI_SIZE 72 // redefine\r
+#define IB_APR_INFO_SIZE 72\r
+\r
+/****d* Access Layer/ib_rej_status_t\r
+* NAME\r
+* ib_rej_status_t\r
+*\r
+* DESCRIPTION\r
+* Rejection reasons.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef ib_net16_t ib_rej_status_t;\r
+/*\r
+* SEE ALSO\r
+* ib_cm_rej, ib_cm_rej_rec_t\r
+*\r
+* SOURCE\r
+ */\r
+#define IB_REJ_INSUF_QP CL_HTON16(1)\r
+#define IB_REJ_INSUF_EEC CL_HTON16(2)\r
+#define IB_REJ_INSUF_RESOURCES CL_HTON16(3)\r
+#define IB_REJ_TIMEOUT CL_HTON16(4)\r
+#define IB_REJ_UNSUPPORTED CL_HTON16(5)\r
+#define IB_REJ_INVALID_COMM_ID CL_HTON16(6)\r
+#define IB_REJ_INVALID_COMM_INSTANCE CL_HTON16(7)\r
+#define IB_REJ_INVALID_SID CL_HTON16(8)\r
+#define IB_REJ_INVALID_XPORT CL_HTON16(9)\r
+#define IB_REJ_STALE_CONN CL_HTON16(10)\r
+#define IB_REJ_RDC_NOT_EXIST CL_HTON16(11)\r
+#define IB_REJ_INVALID_GID CL_HTON16(12)\r
+#define IB_REJ_INVALID_LID CL_HTON16(13)\r
+#define IB_REJ_INVALID_SL CL_HTON16(14)\r
+#define IB_REJ_INVALID_TRAFFIC_CLASS CL_HTON16(15)\r
+#define IB_REJ_INVALID_HOP_LIMIT CL_HTON16(16)\r
+#define IB_REJ_INVALID_PKT_RATE CL_HTON16(17)\r
+#define IB_REJ_INVALID_ALT_GID CL_HTON16(18)\r
+#define IB_REJ_INVALID_ALT_LID CL_HTON16(19)\r
+#define IB_REJ_INVALID_ALT_SL CL_HTON16(20)\r
+#define IB_REJ_INVALID_ALT_TRAFFIC_CLASS CL_HTON16(21)\r
+#define IB_REJ_INVALID_ALT_HOP_LIMIT CL_HTON16(22)\r
+#define IB_REJ_INVALID_ALT_PKT_RATE CL_HTON16(23)\r
+#define IB_REJ_PORT_REDIRECT CL_HTON16(24)\r
+#define IB_REJ_INVALID_MTU CL_HTON16(26)\r
+#define IB_REJ_INSUFFICIENT_RESP_RES CL_HTON16(27)\r
+#define IB_REJ_USER_DEFINED CL_HTON16(28)\r
+#define IB_REJ_INVALID_RNR_RETRY CL_HTON16(29)\r
+#define IB_REJ_DUPLICATE_LOCAL_COMM_ID CL_HTON16(30)\r
+#define IB_REJ_INVALID_CLASS_VER CL_HTON16(31)\r
+#define IB_REJ_INVALID_FLOW_LBL CL_HTON16(32)\r
+#define IB_REJ_INVALID_ALT_FLOW_LBL CL_HTON16(33)\r
+\r
+#define IB_REJ_SERVICE_HANDOFF CL_HTON16(65535)\r
+/******/\r
+\r
+/****d* Access Layer/ib_apr_status_t\r
+* NAME\r
+* ib_apr_status_t\r
+*\r
+* DESCRIPTION\r
+* Automatic path migration status information.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef uint8_t ib_apr_status_t;\r
+/*\r
+* SEE ALSO\r
+* ib_cm_apr, ib_cm_apr_rec_t\r
+*\r
+* SOURCE\r
+ */\r
+#define IB_AP_SUCCESS 0\r
+#define IB_AP_INVALID_COMM_ID 1\r
+#define IB_AP_UNSUPPORTED 2\r
+#define IB_AP_REJECT 3\r
+#define IB_AP_REDIRECT 4\r
+#define IB_AP_IS_CURRENT 5\r
+#define IB_AP_INVALID_QPN 6\r
+#define IB_AP_INVALID_LID 7\r
+#define IB_AP_INVALID_GID 8\r
+#define IB_AP_INVALID_FLOW_LBL 9\r
+#define IB_AP_INVALID_TCLASS 10\r
+#define IB_AP_INVALID_HOP_LIMIT 11\r
+#define IB_AP_INVALID_PKT_RATE 12\r
+#define IB_AP_INVALID_SL 13\r
+/******/\r
+\r
+/****d* Access Layer/ib_cm_cap_mask_t\r
+* NAME\r
+* ib_cm_cap_mask_t\r
+*\r
+* DESCRIPTION\r
+* Capability mask values in ClassPortInfo.\r
+*\r
+* SYNOPSIS\r
+*/\r
+#define IB_CM_RELIABLE_CONN_CAPABLE CL_HTON16(9)\r
+#define IB_CM_RELIABLE_DGRM_CAPABLE CL_HTON16(10)\r
+#define IB_CM_RDGRM_CAPABLE CL_HTON16(11)\r
+#define IB_CM_UNRELIABLE_CONN_CAPABLE CL_HTON16(12)\r
+#define IB_CM_SIDR_CAPABLE CL_HTON16(13)\r
+/*\r
+* SEE ALSO\r
+* ib_cm_rep, ib_class_port_info_t\r
+*\r
+* SOURCE\r
+*\r
+*******/\r
+\r
+/*\r
+ * Service ID resolution status\r
+ */\r
+typedef uint8_t ib_sidr_status_t;\r
+#define IB_SIDR_SUCCESS 0\r
+#define IB_SIDR_UNSUPPORTED 1\r
+#define IB_SIDR_REJECT 2\r
+#define IB_SIDR_NO_QP 3\r
+#define IB_SIDR_REDIRECT 4\r
+#define IB_SIDR_UNSUPPORTED_VER 5\r
+\r
+\r
+/************/\r
+/****s* IBA Base: Types/ib_gmp_t\r
+* NAME\r
+* ib_gmp_t\r
+*\r
+* DESCRIPTION\r
+* IBA defined GMP MAD format. (16.1.1)\r
+*\r
+* SYNOPSIS\r
+*/\r
+#define IB_GMP_DATA_SIZE 200\r
+\r
+#include <complib/cl_packon.h>\r
+typedef struct _ib_gmp\r
+{\r
+ uint8_t base_ver;\r
+ uint8_t mgmt_class;\r
+ uint8_t class_ver;\r
+ uint8_t method;\r
+ ib_net16_t status;\r
+ ib_net16_t resv;\r
+ ib_net64_t trans_id;\r
+ ib_net16_t attr_id;\r
+ ib_net16_t resv1;\r
+ ib_net32_t attr_mod;\r
+ uint8_t resv2[40];\r
+ uint8_t data[IB_GMP_DATA_SIZE];\r
+\r
+} PACK_SUFFIX ib_gmp_t;\r
+#include <complib/cl_packoff.h>\r
+/**********/\r
+#define IB_GMP_MAD_HDR_SIZE (sizeof(ib_gmp_t) - IB_GMP_DATA_SIZE)\r
+\r
+\r
+\r
+/************/\r
+/****s* IBA Base: Types/ib_port_counters_t\r
+* NAME\r
+* ib_gmp_t\r
+*\r
+* DESCRIPTION\r
+* IBA defined PortCounters MAD format. (16.1.3.5)\r
+*\r
+* SYNOPSIS\r
+*/\r
+#include <complib/cl_packon.h>\r
+typedef struct _ib_port_counters\r
+{\r
+ uint8_t reserved0;\r
+ uint8_t port_select;\r
+ ib_net16_t counter_select;\r
+ ib_net16_t symbol_error_counter; \r
+ uint8_t link_error_recovery_counter;\r
+ uint8_t link_down_counter; \r
+ ib_net16_t port_rcv_errors; \r
+ ib_net16_t port_rcv_remote_physical_errors;\r
+ ib_net16_t port_rcv_switch_relay_errors; \r
+ ib_net16_t port_xmit_discard; \r
+ uint8_t port_xmit_constraint_errors;\r
+ uint8_t port_rcv_constraint_errors;\r
+ uint8_t reserved1;\r
+ /* uint4_t excessive_buffer_overrun_errors;\r
+ uint4_t local_link_integrity_errors; */\r
+ uint8_t lli_errors_exc_buf_errors;\r
+ ib_net16_t reserved2; \r
+ ib_net16_t vl15_dropped;\r
+ ib_net32_t port_xmit_data;\r
+ ib_net32_t port_rcv_data;\r
+ ib_net32_t port_xmit_pkts;\r
+ ib_net32_t port_rcv_pkts;\r
+\r
+} PACK_SUFFIX ib_port_counters_t;\r
+#include <complib/cl_packoff.h>\r
+/**********/\r
+\r
+#define IB_COUNTER_SYMBOL_ERROR CL_NTOH16(1<<0)\r
+#define IB_COUNTER_LINK_RECOVERY_ERROR CL_NTOH16(1<<1)\r
+#define IB_COUNTER_LINK_DOWN CL_NTOH16(1<<2)\r
+#define IB_COUNTER_RCV_ERROR CL_NTOH16(1<<3)\r
+#define IB_COUNTERT_RCV_RMT_PHY_ERROR CL_NTOH16(1<<4)\r
+#define IB_COUNTER_RCV_SWITCH_RELAY_ERROR CL_NTOH16(1<<5)\r
+#define IB_COUNTER_XMIT_DISCARD CL_NTOH16(1<<6)\r
+#define IB_COUNTER_XMIT_CONSTRAIN CL_NTOH16(1<<7)\r
+#define IB_COUNTER_RCV_CONSTRAIN CL_NTOH16(1<<8)\r
+#define IB_COUNTER_LINK_INTEG_ERROR CL_NTOH16(1<<9)\r
+#define IB_COUNTER_EXECE_BUF_ERROR CL_NTOH16(1<<10)\r
+#define IB_COUNTER_VL15_DROP CL_NTOH16(1<<11)\r
+#define IB_COUNTER_XMIT_DATA CL_NTOH16(1<<12)\r
+#define IB_COUNTER_XMIT_PKT CL_NTOH16(1<<13)\r
+#define IB_COUNTER_RCV_DATA CL_NTOH16(1<<14)\r
+#define IB_COUNTER_RCV_PKT CL_NTOH16(1<<15)\r
+#define IB_COUNTER_ALL 0xff\r
+\r
+\r
+/*\r
+ * The following definitions are shared between the Access Layer and VPD\r
+ */\r
+\r
+\r
+typedef struct _ib_ca* __ptr64 ib_ca_handle_t;\r
+typedef struct _ib_pd* __ptr64 ib_pd_handle_t;\r
+typedef struct _ib_mr* __ptr64 ib_mr_handle_t;\r
+typedef struct _ib_mw* __ptr64 ib_mw_handle_t;\r
+typedef struct _ib_qp* __ptr64 ib_qp_handle_t;\r
+typedef struct _ib_srq* __ptr64 ib_srq_handle_t;\r
+typedef struct _ib_cq* __ptr64 ib_cq_handle_t;\r
+typedef struct _ib_av* __ptr64 ib_av_handle_t;\r
+typedef struct _ib_mcast* __ptr64 ib_mcast_handle_t;\r
+typedef struct _mlnx_fmr* __ptr64 mlnx_fmr_handle_t;\r
+typedef struct _mlnx_fmr_pool* __ptr64 mlnx_fmr_pool_handle_t;\r
+\r
+\r
+/****d* Access Layer/ib_api_status_t\r
+* NAME\r
+* ib_api_status_t\r
+*\r
+* DESCRIPTION\r
+* Function return codes indicating the success or failure of an API call.\r
+* Note that success is indicated by the return value IB_SUCCESS, which\r
+* is always zero.\r
+*\r
+* NOTES\r
+* IB_VERBS_PROCESSING_DONE is used by UVP library to terminate a verbs call\r
+* in the pre-ioctl step itself.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef enum _ib_api_status_t\r
+{\r
+ IB_SUCCESS,\r
+ IB_INSUFFICIENT_RESOURCES,\r
+ IB_INSUFFICIENT_MEMORY,\r
+ IB_INVALID_PARAMETER,\r
+ IB_INVALID_SETTING,\r
+ IB_NOT_FOUND,\r
+ IB_TIMEOUT,\r
+ IB_CANCELED,\r
+ IB_INTERRUPTED,\r
+ IB_INVALID_PERMISSION,\r
+ IB_UNSUPPORTED,\r
+ IB_OVERFLOW,\r
+ IB_MAX_MCAST_QPS_REACHED,\r
+ IB_INVALID_QP_STATE,\r
+ IB_INVALID_APM_STATE,\r
+ IB_INVALID_PORT_STATE,\r
+ IB_INVALID_STATE,\r
+ IB_RESOURCE_BUSY,\r
+ IB_INVALID_PKEY,\r
+ IB_INVALID_LKEY,\r
+ IB_INVALID_RKEY,\r
+ IB_INVALID_MAX_WRS,\r
+ IB_INVALID_MAX_SGE,\r
+ IB_INVALID_CQ_SIZE,\r
+ IB_INVALID_SRQ_SIZE,\r
+ IB_INVALID_SERVICE_TYPE,\r
+ IB_INVALID_GID,\r
+ IB_INVALID_LID,\r
+ IB_INVALID_GUID,\r
+ IB_INVALID_CA_HANDLE,\r
+ IB_INVALID_AV_HANDLE,\r
+ IB_INVALID_CQ_HANDLE,\r
+ IB_INVALID_QP_HANDLE,\r
+ IB_INVALID_SRQ_HANDLE,\r
+ IB_INVALID_PD_HANDLE,\r
+ IB_INVALID_MR_HANDLE,\r
+ IB_INVALID_FMR_HANDLE,\r
+ IB_INVALID_MW_HANDLE,\r
+ IB_INVALID_MCAST_HANDLE,\r
+ IB_INVALID_CALLBACK,\r
+ IB_INVALID_AL_HANDLE, /* InfiniBand Access Layer */\r
+ IB_INVALID_HANDLE, /* InfiniBand Access Layer */\r
+ IB_ERROR, /* InfiniBand Access Layer */\r
+ IB_REMOTE_ERROR, /* Infiniband Access Layer */\r
+ IB_VERBS_PROCESSING_DONE, /* See Notes above */\r
+ IB_INVALID_WR_TYPE,\r
+ IB_QP_IN_TIMEWAIT,\r
+ IB_EE_IN_TIMEWAIT,\r
+ IB_INVALID_PORT,\r
+ IB_NOT_DONE,\r
+ IB_INVALID_INDEX,\r
+ IB_NO_MATCH,\r
+ IB_PENDING,\r
+ IB_UNKNOWN_ERROR /* ALWAYS LAST ENUM VALUE! */\r
+\r
+} ib_api_status_t;\r
+/*****/\r
+\r
+\r
+\r
+/****f* IBA Base: Types/ib_get_err_str\r
+* NAME\r
+* ib_get_err_str\r
+*\r
+* DESCRIPTION\r
+* Returns a string for the specified status value.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT const char* AL_API\r
+ib_get_err_str(\r
+ IN ib_api_status_t status );\r
+/*\r
+* PARAMETERS\r
+* status\r
+* [in] status value\r
+*\r
+* RETURN VALUES\r
+* Pointer to the status description string.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+*********/\r
+\r
+/****d* Verbs/ib_async_event_t\r
+* NAME\r
+* ib_async_event_t -- Async event types\r
+*\r
+* DESCRIPTION\r
+* This type indicates the reason the async callback was called.\r
+* The context in the ib_event_rec_t indicates the resource context\r
+* that associated with the callback. For example, for IB_AE_CQ_ERROR\r
+* the context provided during the ib_create_cq is returned in the event.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef enum _ib_async_event_t\r
+{\r
+ IB_AE_SQ_ERROR = 1,\r
+ IB_AE_SQ_DRAINED,\r
+ IB_AE_RQ_ERROR,\r
+ IB_AE_CQ_ERROR,\r
+ IB_AE_QP_FATAL,\r
+ IB_AE_QP_COMM,\r
+ IB_AE_QP_APM,\r
+ IB_AE_LOCAL_FATAL,\r
+ IB_AE_PKEY_TRAP,\r
+ IB_AE_QKEY_TRAP,\r
+ IB_AE_MKEY_TRAP,\r
+ IB_AE_PORT_TRAP,\r
+ IB_AE_SYSIMG_GUID_TRAP,\r
+ IB_AE_BUF_OVERRUN,\r
+ IB_AE_LINK_INTEGRITY,\r
+ IB_AE_FLOW_CTRL_ERROR,\r
+ IB_AE_BKEY_TRAP,\r
+ IB_AE_QP_APM_ERROR,\r
+ IB_AE_WQ_REQ_ERROR,\r
+ IB_AE_WQ_ACCESS_ERROR,\r
+ IB_AE_PORT_ACTIVE,\r
+ IB_AE_PORT_DOWN,\r
+ IB_AE_CLIENT_REREGISTER,\r
+ IB_AE_SRQ_LIMIT_REACHED,\r
+ IB_AE_SRQ_CATAS_ERROR,\r
+ IB_AE_SRQ_QP_LAST_WQE_REACHED,\r
+ IB_AE_UNKNOWN /* ALWAYS LAST ENUM VALUE */\r
+\r
+} ib_async_event_t;\r
+/*\r
+* VALUES\r
+* IB_AE_SQ_ERROR\r
+* An error occurred when accessing the send queue of the QP or EEC.\r
+* This event is optional.\r
+*\r
+* IB_AE_SQ_DRAINED\r
+* The send queue of the specified QP has completed the outstanding\r
+* messages in progress when the state change was requested and, if\r
+* applicable, has received all acknowledgements for those messages.\r
+*\r
+* IB_AE_RQ_ERROR\r
+* An error occurred when accessing the receive queue of the QP or EEC.\r
+* This event is optional.\r
+*\r
+* IB_AE_CQ_ERROR\r
+* An error occurred when writing an entry to the CQ.\r
+*\r
+* IB_AE_QP_FATAL\r
+* A catastrophic error occurred while accessing or processing the\r
+* work queue that prevents reporting of completions.\r
+*\r
+* IB_AE_QP_COMM\r
+* The first packet has arrived for the receive work queue where the\r
+* QP is still in the RTR state.\r
+*\r
+* IB_AE_QP_APM\r
+* If alternate path migration is supported, this event indicates that\r
+* the QP connection has migrated to the alternate path.\r
+*\r
+* IB_AE_LOCAL_FATAL\r
+* A catastrophic HCA error occurred which cannot be attributed to any\r
+* resource; behavior is indeterminate.\r
+*\r
+* IB_AE_PKEY_TRAP\r
+* A PKEY violation was detected. This event is optional.\r
+*\r
+* IB_AE_QKEY_TRAP\r
+* A QKEY violation was detected. This event is optional.\r
+*\r
+* IB_AE_MKEY_TRAP\r
+* An MKEY violation was detected. This event is optional.\r
+*\r
+* IB_AE_PORT_TRAP\r
+* A port capability change was detected. This event is optional.\r
+*\r
+* IB_AE_SYSIMG_GUID_TRAP\r
+* If the system image GUID is supported, this event indicates that the\r
+* system image GUID of this HCA has been changed. This event is\r
+* optional.\r
+*\r
+* IB_AE_BUF_OVERRUN\r
+* The number of consecutive flow control update periods with at least\r
+* one overrun error in each period has exceeded the threshold specified\r
+* in the port info attributes. This event is optional.\r
+*\r
+* IB_AE_LINK_INTEGRITY\r
+* The detection of excessively frequent local physical errors has\r
+* exceeded the threshold specified in the port info attributes. This\r
+* event is optional.\r
+*\r
+* IB_AE_FLOW_CTRL_ERROR\r
+* An HCA watchdog timer monitoring the arrival of flow control updates\r
+* has expired without receiving an update. This event is optional.\r
+*\r
+* IB_AE_BKEY_TRAP\r
+* An BKEY violation was detected. This event is optional.\r
+*\r
+* IB_AE_QP_APM_ERROR\r
+* If alternate path migration is supported, this event indicates that\r
+* an incoming path migration request to this QP was not accepted.\r
+*\r
+* IB_AE_WQ_REQ_ERROR\r
+* An OpCode violation was detected at the responder.\r
+*\r
+* IB_AE_WQ_ACCESS_ERROR\r
+* An access violation was detected at the responder.\r
+*\r
+* IB_AE_PORT_ACTIVE\r
+* If the port active event is supported, this event is generated\r
+* when the link becomes active: IB_LINK_ACTIVE.\r
+*\r
+* IB_AE_PORT_DOWN\r
+* The link is declared unavailable: IB_LINK_INIT, IB_LINK_ARMED,\r
+* IB_LINK_DOWN.\r
+*\r
+* IB_AE_CLIENT_REREGISTER\r
+* The SM idicate to client to reregister its SA records.\r
+*\r
+* IB_AE_SRQ_LIMIT_REACHED\r
+* Reached SRQ low watermark\r
+*\r
+* IB_AE_SRQ_CATAS_ERROR\r
+* An error occurred while processing or accessing the SRQ that prevents\r
+* dequeuing a WQE from the SRQ and reporting of receive completions.\r
+*\r
+* IB_AE_SRQ_QP_LAST_WQE_REACHED\r
+* An event, issued for a QP, associated with a shared receive queue, when\r
+* a CQE is generated for the last WQE, or\r
+* the QP gets in the Error State and there are no more WQEs on the RQ.\r
+*\r
+* IB_AE_UNKNOWN\r
+* An unknown error occurred which cannot be attributed to any\r
+* resource; behavior is indeterminate.\r
+*\r
+*****/\r
+\r
+\r
+\r
+/****f* IBA Base: Types/ib_get_async_event_str\r
+* NAME\r
+* ib_get_async_event_str\r
+*\r
+* DESCRIPTION\r
+* Returns a string for the specified asynchronous event.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT const char* AL_API\r
+ib_get_async_event_str(\r
+ IN ib_async_event_t event );\r
+/*\r
+* PARAMETERS\r
+* event\r
+* [in] event value\r
+*\r
+* RETURN VALUES\r
+* Pointer to the asynchronous event description string.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+*********/\r
+\r
+/****s* Verbs/ib_event_rec_t\r
+* NAME\r
+* ib_event_rec_t -- Async event notification record\r
+*\r
+* DESCRIPTION\r
+* When an async event callback is made, this structure is passed to indicate\r
+* the type of event, the source of event that caused it, and the context\r
+* associated with this event.\r
+*\r
+* context -- Context of the resource that caused the event.\r
+* -- ca_context if this is a port/adapter event.\r
+* -- qp_context if the source is a QP event\r
+* -- cq_context if the source is a CQ event.\r
+* -- ee_context if the source is an EE event.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_event_rec\r
+{\r
+ void* __ptr64 context;\r
+ ib_async_event_t type;\r
+\r
+ /* HCA vendor specific event information. */\r
+ uint64_t vendor_specific;\r
+\r
+ /* The following structures are valid only for trap types. */\r
+ union _trap\r
+ {\r
+ struct\r
+ {\r
+ uint16_t lid;\r
+ ib_net64_t port_guid;\r
+ uint8_t port_num;\r
+\r
+ /*\r
+ * The following structure is valid only for\r
+ * P_KEY, Q_KEY, and M_KEY violation traps.\r
+ */\r
+ struct\r
+ {\r
+ uint8_t sl;\r
+ uint16_t src_lid;\r
+ uint16_t dest_lid;\r
+ union _key\r
+ {\r
+ uint16_t pkey;\r
+ uint32_t qkey;\r
+ uint64_t mkey;\r
+ } key;\r
+ uint32_t src_qp;\r
+ uint32_t dest_qp;\r
+ ib_gid_t src_gid;\r
+ ib_gid_t dest_gid;\r
+\r
+ } violation;\r
+\r
+ } info;\r
+\r
+ ib_net64_t sysimg_guid;\r
+\r
+ } trap;\r
+\r
+} ib_event_rec_t;\r
+/*******/\r
+\r
+/****d* Access Layer/ib_atomic_t\r
+* NAME\r
+* ib_atomic_t\r
+*\r
+* DESCRIPTION\r
+* Indicates atomicity levels supported by an adapter.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef enum _ib_atomic_t\r
+{\r
+ IB_ATOMIC_NONE,\r
+ IB_ATOMIC_LOCAL,\r
+ IB_ATOMIC_GLOBAL\r
+\r
+} ib_atomic_t;\r
+/*\r
+* VALUES\r
+* IB_ATOMIC_NONE\r
+* Atomic operations not supported.\r
+*\r
+* IB_ATOMIC_LOCAL\r
+* Atomic operations guaranteed between QPs of a single CA.\r
+*\r
+* IB_ATOMIC_GLOBAL\r
+* Atomic operations are guaranteed between CA and any other entity\r
+* in the system.\r
+*****/\r
+\r
+/****s* Access Layer/ib_port_cap_t\r
+* NAME\r
+* ib_port_cap_t\r
+*\r
+* DESCRIPTION\r
+* Indicates which management agents are currently available on the specified\r
+* port.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_port_cap\r
+{\r
+ boolean_t cm;\r
+ boolean_t snmp;\r
+ boolean_t dev_mgmt;\r
+ boolean_t vend;\r
+ boolean_t sm;\r
+ boolean_t sm_disable;\r
+ boolean_t qkey_ctr;\r
+ boolean_t pkey_ctr;\r
+ boolean_t notice;\r
+ boolean_t trap;\r
+ boolean_t apm;\r
+ boolean_t slmap;\r
+ boolean_t pkey_nvram;\r
+ boolean_t mkey_nvram;\r
+ boolean_t sysguid;\r
+ boolean_t dr_notice;\r
+ boolean_t boot_mgmt;\r
+ boolean_t capm_notice;\r
+ boolean_t reinit;\r
+ boolean_t ledinfo;\r
+ boolean_t port_active;\r
+ boolean_t ipd;\r
+ boolean_t pkey_switch_ext_port;\r
+ boolean_t bm;\r
+ boolean_t link_rtl;\r
+ boolean_t client_reregister;\r
+\r
+} ib_port_cap_t;\r
+/*****/\r
+\r
+/****d* Access Layer/ib_init_type_t\r
+* NAME\r
+* ib_init_type_t\r
+*\r
+* DESCRIPTION\r
+* If supported by the HCA, the type of initialization requested by\r
+* this port before SM moves it to the active or armed state. If the\r
+* SM implements reinitialization, it shall set these bits to indicate\r
+* the type of initialization performed prior to activating the port.\r
+* Otherwise, these bits shall be set to 0.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef uint8_t ib_init_type_t;\r
+#define IB_INIT_TYPE_NO_LOAD 0x01\r
+#define IB_INIT_TYPE_PRESERVE_CONTENT 0x02\r
+#define IB_INIT_TYPE_PRESERVE_PRESENCE 0x04\r
+#define IB_INIT_TYPE_DO_NOT_RESUSCITATE 0x08\r
+/*****/\r
+\r
+/****s* Access Layer/ib_port_attr_mod_t\r
+* NAME\r
+* ib_port_attr_mod_t\r
+*\r
+* DESCRIPTION\r
+* Port attributes that may be modified.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_port_attr_mod\r
+{\r
+ ib_port_cap_t cap;\r
+ uint16_t pkey_ctr;\r
+ uint16_t qkey_ctr;\r
+\r
+ ib_init_type_t init_type;\r
+ ib_net64_t system_image_guid;\r
+\r
+} ib_port_attr_mod_t;\r
+/*\r
+* SEE ALSO\r
+* ib_port_cap_t\r
+*****/\r
+\r
+/****s* Access Layer/ib_port_attr_t\r
+* NAME\r
+* ib_port_attr_t\r
+*\r
+* DESCRIPTION\r
+* Information about a port on a given channel adapter.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_port_attr\r
+{\r
+ ib_net64_t port_guid;\r
+ uint8_t port_num;\r
+ uint8_t mtu;\r
+ uint64_t max_msg_size;\r
+ ib_net16_t lid;\r
+ uint8_t lmc;\r
+\r
+ /*\r
+ * LinkWidthSupported as defined in PortInfo. Required to calculate\r
+ * inter-packet delay (a.k.a. static rate).\r
+ */\r
+ uint8_t link_width_supported;\r
+\r
+ uint16_t max_vls;\r
+\r
+ ib_net16_t sm_lid;\r
+ uint8_t sm_sl;\r
+ uint8_t link_state;\r
+\r
+ ib_init_type_t init_type_reply; /* Optional */\r
+\r
+ /*\r
+ * subnet_timeout:\r
+ * The maximum expected subnet propagation delay to reach any port on\r
+ * the subnet. This value also determines the rate at which traps can\r
+ * be generated from this node.\r
+ *\r
+ * timeout = 4.096 microseconds * 2^subnet_timeout\r
+ */\r
+ uint8_t subnet_timeout;\r
+\r
+ ib_port_cap_t cap;\r
+ uint16_t pkey_ctr;\r
+ uint16_t qkey_ctr;\r
+\r
+ uint16_t num_gids;\r
+ uint16_t num_pkeys;\r
+ /*\r
+ * Pointers at the end of the structure to allow doing a simple\r
+ * memory comparison of contents up to the first pointer.\r
+ */\r
+ ib_gid_t* __ptr64 p_gid_table;\r
+ ib_net16_t* __ptr64 p_pkey_table;\r
+\r
+} ib_port_attr_t;\r
+/*\r
+* SEE ALSO\r
+* uint8_t, ib_port_cap_t, ib_link_states_t\r
+*****/\r
+\r
+/****s* Access Layer/ib_ca_attr_t\r
+* NAME\r
+* ib_ca_attr_t\r
+*\r
+* DESCRIPTION\r
+* Information about a channel adapter.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_ca_attr\r
+{\r
+ ib_net64_t ca_guid;\r
+\r
+ uint32_t vend_id;\r
+ uint16_t dev_id;\r
+ uint16_t revision;\r
+ uint64_t fw_ver;\r
+\r
+ /*\r
+ * Total size of the ca attributes in bytes\r
+ */\r
+ uint32_t size;\r
+ uint32_t max_qps;\r
+ uint32_t max_wrs;\r
+\r
+ uint32_t max_sges;\r
+ uint32_t max_rd_sges;\r
+\r
+ uint32_t max_cqs;\r
+ uint32_t max_cqes;\r
+\r
+ uint32_t max_pds;\r
+\r
+ uint32_t init_regions;\r
+ uint64_t init_region_size;\r
+\r
+ uint32_t init_windows;\r
+ uint32_t max_addr_handles;\r
+\r
+ uint32_t max_partitions;\r
+\r
+ ib_atomic_t atomicity;\r
+\r
+ uint8_t max_qp_resp_res;\r
+ uint8_t max_resp_res;\r
+\r
+ uint8_t max_qp_init_depth;\r
+\r
+ uint32_t max_ipv6_qps;\r
+ uint32_t max_ether_qps;\r
+\r
+ uint32_t max_mcast_grps;\r
+ uint32_t max_mcast_qps;\r
+ uint32_t max_qps_per_mcast_grp;\r
+ uint32_t max_fmr;\r
+ uint32_t max_map_per_fmr;\r
+ uint32_t max_srq;\r
+ uint32_t max_srq_wrs;\r
+ uint32_t max_srq_sges;\r
+\r
+ /*\r
+ * local_ack_delay:\r
+ * Specifies the maximum time interval between the local CA receiving\r
+ * a message and the transmission of the associated ACK or NAK.\r
+ *\r
+ * timeout = 4.096 microseconds * 2^local_ack_delay\r
+ */\r
+ uint8_t local_ack_delay;\r
+\r
+ boolean_t bad_pkey_ctr_support;\r
+ boolean_t bad_qkey_ctr_support;\r
+ boolean_t raw_mcast_support;\r
+ boolean_t apm_support;\r
+ boolean_t av_port_check;\r
+ boolean_t change_primary_port;\r
+ boolean_t modify_wr_depth;\r
+ boolean_t modify_srq_depth;\r
+ boolean_t current_qp_state_support;\r
+ boolean_t shutdown_port_capability;\r
+ boolean_t init_type_support;\r
+ boolean_t port_active_event_support;\r
+ boolean_t system_image_guid_support;\r
+ boolean_t hw_agents;\r
+\r
+ ib_net64_t system_image_guid;\r
+\r
+ uint32_t num_page_sizes;\r
+ uint8_t num_ports;\r
+\r
+ uint32_t* __ptr64 p_page_size;\r
+ ib_port_attr_t* __ptr64 p_port_attr;\r
+\r
+} ib_ca_attr_t;\r
+/*\r
+* FIELDS\r
+* ca_guid\r
+* GUID for this adapter.\r
+*\r
+* vend_id\r
+* IEEE vendor ID for this adapter\r
+*\r
+* dev_id\r
+* Device ID of this adapter. (typically from PCI device ID)\r
+*\r
+* revision\r
+* Revision ID of this adapter\r
+*\r
+* fw_ver\r
+* Device Firmware version.\r
+*\r
+* size\r
+* Total size in bytes for the HCA attributes. This size includes total\r
+* size required for all the variable members of the structure. If a\r
+* vendor requires to pass vendor specific fields beyond this structure,\r
+* the HCA vendor can choose to report a larger size. If a vendor is\r
+* reporting extended vendor specific features, they should also provide\r
+* appropriate access functions to aid with the required interpretation.\r
+*\r
+* max_qps\r
+* Maximum number of QP's supported by this HCA.\r
+*\r
+* max_wrs\r
+* Maximum number of work requests supported by this HCA.\r
+*\r
+* max_sges\r
+* Maximum number of scatter gather elements supported per work request.\r
+*\r
+* max_rd_sges\r
+* Maximum number of scatter gather elements supported for READ work\r
+* requests for a Reliable Datagram QP. This value must be zero if RD\r
+* service is not supported.\r
+*\r
+* max_cqs\r
+* Maximum number of Completion Queues supported.\r
+*\r
+* max_cqes\r
+* Maximum number of CQ elements supported per CQ.\r
+*\r
+* max_pds\r
+* Maximum number of protection domains supported.\r
+*\r
+* init_regions\r
+* Initial number of memory regions supported. These are only informative\r
+* values. HCA vendors can extended and grow these limits on demand.\r
+*\r
+* init_region_size\r
+* Initial limit on the size of the registered memory region.\r
+*\r
+* init_windows\r
+* Initial number of window entries supported.\r
+*\r
+* max_addr_handles\r
+* Maximum number of address handles supported.\r
+*\r
+* max_partitions\r
+* Maximum number of partitions supported.\r
+*\r
+* atomicity\r
+* Indicates level of atomic operations supported by this HCA.\r
+*\r
+* max_qp_resp_res\r
+* Maximum limit on number of responder resources for incomming RDMA\r
+* operations on QPs.\r
+*\r
+* max_fmr\r
+* Maximum number of Fast Memory Regions supported.\r
+*\r
+* max_map_per_fmr\r
+* Maximum number of mappings, supported by a Fast Memory Region.\r
+*\r
+* max_srq\r
+* Maximum number of Shared Receive Queues supported.\r
+*\r
+* max_srq_wrs\r
+* Maximum number of work requests supported by this SRQ.\r
+*\r
+* max_srq_sges\r
+* Maximum number of scatter gather elements supported per work request on SRQ.\r
+*\r
+* max_resp_res\r
+* Maximum number of responder resources per HCA, with this HCA used as\r
+* the target.\r
+*\r
+* max_qp_init_depth\r
+* Maximimum initiator depth per QP for initiating RDMA reads and\r
+* atomic operations.\r
+*\r
+* max_ipv6_qps\r
+* max_ether_qps\r
+* Maximum number of IPV6 and raw ether QP's supported by this HCA.\r
+*\r
+* max_mcast_grps\r
+* Maximum number of multicast groups supported.\r
+*\r
+* max_mcast_qps\r
+* Maximum number of QP's that can support multicast operations.\r
+*\r
+* max_qps_per_mcast_grp\r
+* Maximum number of multicast QP's per multicast group.\r
+*\r
+* local_ack_delay\r
+* Specifies the maximum time interval between the local CA receiving\r
+* a message and the transmission of the associated ACK or NAK.\r
+* timeout = 4.096 microseconds * 2^local_ack_delay\r
+*\r
+* bad_pkey_ctr_support\r
+* bad_qkey_ctr_support\r
+* Indicates support for the bad pkey and qkey counters.\r
+*\r
+* raw_mcast_support\r
+* Indicates support for raw packet multicast.\r
+*\r
+* apm_support\r
+* Indicates support for Automatic Path Migration.\r
+*\r
+* av_port_check\r
+* Indicates ability to check port number in address handles.\r
+*\r
+* change_primary_port\r
+* Indicates ability to change primary port for a QP or EEC during a\r
+* SQD->RTS transition.\r
+*\r
+* modify_wr_depth\r
+* Indicates ability to modify QP depth during a modify QP operation.\r
+* Check the verb specification for permitted states.\r
+*\r
+* modify_srq_depth\r
+* Indicates ability to modify SRQ depth during a modify SRQ operation.\r
+* Check the verb specification for permitted states.\r
+*\r
+* current_qp_state_support\r
+* Indicates ability of the HCA to support the current QP state modifier\r
+* during a modify QP operation.\r
+*\r
+* shutdown_port_capability\r
+* Shutdown port capability support indicator.\r
+*\r
+* init_type_support\r
+* Indicates init_type_reply and ability to set init_type is supported.\r
+*\r
+* port_active_event_support\r
+* Port active event support indicator.\r
+*\r
+* system_image_guid_support\r
+* System image GUID support indicator.\r
+*\r
+* hw_agents\r
+* Indicates SMA is implemented in HW.\r
+*\r
+* system_image_guid\r
+* Optional system image GUID. This field is valid only if the\r
+* system_image_guid_support flag is set.\r
+*\r
+* num_page_sizes\r
+* Indicates support for different page sizes supported by the HCA.\r
+* The variable size array can be obtained from p_page_size.\r
+*\r
+* num_ports\r
+* Number of physical ports supported on this HCA.\r
+*\r
+* p_page_size\r
+* Array holding different page size supported.\r
+*\r
+* p_port_attr\r
+* Array holding port attributes.\r
+*\r
+* NOTES\r
+* This structure contains the attributes of a channel adapter. Users must\r
+* call ib_copy_ca_attr to copy the contents of this structure to a new\r
+* memory region.\r
+*\r
+* SEE ALSO\r
+* ib_port_attr_t, ib_atomic_t, ib_copy_ca_attr\r
+*****/\r
+\r
+/****f* Access layer/ib_copy_ca_attr\r
+* NAME\r
+* ib_copy_ca_attr\r
+*\r
+* DESCRIPTION\r
+* Copies CA attributes.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT ib_ca_attr_t* AL_API\r
+ib_copy_ca_attr(\r
+ IN ib_ca_attr_t* const p_dest,\r
+ IN const ib_ca_attr_t* const p_src );\r
+/*\r
+* PARAMETERS\r
+* p_dest\r
+* Pointer to the buffer that is the destination of the copy.\r
+*\r
+* p_src\r
+* Pointer to the CA attributes to copy.\r
+*\r
+* RETURN VALUE\r
+* Pointer to the copied CA attributes.\r
+*\r
+* NOTES\r
+* The buffer pointed to by the p_dest parameter must be at least the size\r
+* specified in the size field of the buffer pointed to by p_src.\r
+*\r
+* SEE ALSO\r
+* ib_ca_attr_t, ib_dup_ca_attr, ib_free_ca_attr\r
+*****/\r
+\r
+\r
+/****d* Access Layer/ib_pd_type_t\r
+* NAME\r
+* ib_pd_type_t\r
+*\r
+* DESCRIPTION\r
+* Indicates the type of protection domain being allocated.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef enum _ib_pd_type\r
+{\r
+ IB_PDT_NORMAL,\r
+ IB_PDT_ALIAS,\r
+ IB_PDT_SQP,\r
+ IB_PDT_UD\r
+\r
+} ib_pd_type_t;\r
+/*\r
+* VALUES\r
+* IB_PDT_NORMAL\r
+* Protection domain for all non-aliased QPs.\r
+*\r
+* IB_PDT_ALIAS\r
+* Protection domain for IB_QPT_QP0_ALIAS and IB_QPT_QP1_ALIAS QPs.\r
+*\r
+* IB_PDT_SQP\r
+* Protection domain for special queue pair usage.\r
+*\r
+* IB_PDT_UD\r
+* Protection domain for UD queue pair usage.\r
+*****/\r
+\r
+\r
+/****s* Access Layer/ib_av_attr_t\r
+* NAME\r
+* ib_av_attr_t\r
+*\r
+* DESCRIPTION\r
+* IBA address vector.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_av_attr\r
+{\r
+ uint8_t port_num;\r
+\r
+ uint8_t sl;\r
+ ib_net16_t dlid;\r
+\r
+ boolean_t grh_valid;\r
+ ib_grh_t grh;\r
+ uint8_t static_rate;\r
+ uint8_t path_bits;\r
+\r
+ struct _av_conn\r
+ {\r
+ uint8_t path_mtu;\r
+ uint8_t local_ack_timeout;\r
+ uint8_t seq_err_retry_cnt;\r
+ uint8_t rnr_retry_cnt;\r
+\r
+ } conn;\r
+\r
+} ib_av_attr_t;\r
+/*\r
+* SEE ALSO\r
+* ib_gid_t\r
+*****/\r
+\r
+/****d* Access Layer/ib_qp_type_t\r
+* NAME\r
+* ib_qp_type_t\r
+*\r
+* DESCRIPTION\r
+* Indicates the type of queue pair being created.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef enum _ib_qp_type\r
+{\r
+ IB_QPT_RELIABLE_CONN = 0, /* Matches CM REQ transport type */\r
+ IB_QPT_UNRELIABLE_CONN = 1, /* Matches CM REQ transport type */\r
+ IB_QPT_RELIABLE_DGRM = 2, /* Matches CM REQ transport type */\r
+ IB_QPT_UNRELIABLE_DGRM,\r
+ IB_QPT_QP0,\r
+ IB_QPT_QP1,\r
+ IB_QPT_RAW_IPV6,\r
+ IB_QPT_RAW_ETHER,\r
+ IB_QPT_MAD, /* InfiniBand Access Layer */\r
+ IB_QPT_QP0_ALIAS, /* InfiniBand Access Layer */\r
+ IB_QPT_QP1_ALIAS, /* InfiniBand Access Layer */\r
+ IB_QPT_UNKNOWN\r
+} ib_qp_type_t;\r
+/*\r
+* VALUES\r
+* IB_QPT_RELIABLE_CONN\r
+* Reliable, connected queue pair.\r
+*\r
+* IB_QPT_UNRELIABLE_CONN\r
+* Unreliable, connected queue pair.\r
+*\r
+* IB_QPT_RELIABLE_DGRM\r
+* Reliable, datagram queue pair.\r
+*\r
+* IB_QPT_UNRELIABLE_DGRM\r
+* Unreliable, datagram queue pair.\r
+*\r
+* IB_QPT_QP0\r
+* Queue pair 0.\r
+*\r
+* IB_QPT_QP1\r
+* Queue pair 1.\r
+*\r
+* IB_QPT_RAW_DGRM\r
+* Raw datagram queue pair.\r
+*\r
+* IB_QPT_RAW_IPV6\r
+* Raw IP version 6 queue pair.\r
+*\r
+* IB_QPT_RAW_ETHER\r
+* Raw Ethernet queue pair.\r
+*\r
+* IB_QPT_MAD\r
+* Unreliable, datagram queue pair that will send and receive management\r
+* datagrams with assistance from the access layer.\r
+*\r
+* IB_QPT_QP0_ALIAS\r
+* Alias to queue pair 0. Aliased QPs can only be created on an aliased\r
+* protection domain.\r
+*\r
+* IB_QPT_QP1_ALIAS\r
+* Alias to queue pair 1. Aliased QPs can only be created on an aliased\r
+* protection domain.\r
+*****/\r
+\r
+\r
+/****f* IBA Base: Types/ib_get_qp_type_str\r
+* NAME\r
+* ib_get_qp_type_str\r
+*\r
+* DESCRIPTION\r
+* Returns a string for the specified QP type\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT const char* AL_API\r
+ib_get_qp_type_str(\r
+ IN uint8_t qp_type );\r
+\r
+/*\r
+* PARAMETERS\r
+* qp_type\r
+* [in] Encoded QP type as defined in the\r
+QP attribute.\r
+\r
+* RETURN VALUES\r
+* Pointer to the QP type string.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+* ib_qp_type_t\r
+*********/\r
+\r
+/****d* Access Layer/ib_access_t\r
+* NAME\r
+* ib_access_t\r
+*\r
+* DESCRIPTION\r
+* Indicates the type of access is permitted on resources such as QPs,\r
+* memory regions and memory windows.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef uint32_t ib_access_t;\r
+#define IB_AC_RDMA_READ 0x00000001\r
+#define IB_AC_RDMA_WRITE 0x00000002\r
+#define IB_AC_ATOMIC 0x00000004\r
+#define IB_AC_LOCAL_WRITE 0x00000008\r
+#define IB_AC_MW_BIND 0x00000010\r
+/*\r
+* NOTES\r
+* Users may combine access rights using a bit-wise or operation to specify\r
+* additional access. For example: IB_AC_RDMA_READ | IB_AC_RDMA_WRITE grants\r
+* RDMA read and write access.\r
+*****/\r
+\r
+/****d* Access Layer/ib_qp_state_t\r
+* NAME\r
+* ib_qp_state_t\r
+*\r
+* DESCRIPTION\r
+* Indicates or sets the state of a queue pair. The current state of a queue\r
+* pair is returned through the ib_qp_query call and set via the\r
+* ib_qp_modify call.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef uint32_t ib_qp_state_t;\r
+#define IB_QPS_RESET 0x00000001\r
+#define IB_QPS_INIT 0x00000002\r
+#define IB_QPS_RTR 0x00000004\r
+#define IB_QPS_RTS 0x00000008\r
+#define IB_QPS_SQD 0x00000010\r
+#define IB_QPS_SQD_DRAINING 0x00000030\r
+#define IB_QPS_SQD_DRAINED 0x00000050\r
+#define IB_QPS_SQERR 0x00000080\r
+#define IB_QPS_ERROR 0x00000100\r
+#define IB_QPS_TIME_WAIT 0xDEAD0000 /* InfiniBand Access Layer */\r
+/*****/\r
+\r
+/****d* Access Layer/ib_apm_state_t\r
+* NAME\r
+* ib_apm_state_t\r
+*\r
+* DESCRIPTION\r
+* The current automatic path migration state of a queue pair\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef enum _ib_apm_state\r
+{\r
+ IB_APM_MIGRATED = 1,\r
+ IB_APM_REARM,\r
+ IB_APM_ARMED\r
+\r
+} ib_apm_state_t;\r
+/*****/\r
+\r
+/****d* Access Layer/ib_srq_attr_mask_t\r
+* NAME\r
+* ib_srq_attr_mask_t\r
+*\r
+* DESCRIPTION\r
+* Indicates valid fields in ib_srq_attr_t structure\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef enum _ib_srq_attr_mask {\r
+ IB_SRQ_MAX_WR = 1 << 0,\r
+ IB_SRQ_LIMIT = 1 << 1,\r
+} ib_srq_attr_mask_t;\r
+/*****/\r
+\r
+\r
+/****s* Access Layer/ib_srq_attr_t\r
+* NAME\r
+* ib_srq_attr_t\r
+*\r
+* DESCRIPTION\r
+* Attributes used to initialize a shared queue pair at creation time.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_srq_attr {\r
+ uint32_t max_wr;\r
+ uint32_t max_sge;\r
+ uint32_t srq_limit;\r
+} ib_srq_attr_t;\r
+/*\r
+* FIELDS\r
+* max_wr\r
+* Specifies the max number of work request on SRQ.\r
+*\r
+* max_sge\r
+* Specifies the max number of scatter/gather elements in one work request.\r
+*\r
+* srq_limit\r
+* Specifies the low water mark for SRQ.\r
+*\r
+* SEE ALSO\r
+* ib_qp_type_t, ib_srq_attr_mask_t\r
+*****/\r
+\r
+\r
+/****s* Access Layer/ib_qp_create_t\r
+* NAME\r
+* ib_qp_create_t\r
+*\r
+* DESCRIPTION\r
+* Attributes used to initialize a queue pair at creation time.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_qp_create\r
+{\r
+ ib_qp_type_t qp_type;\r
+\r
+ uint32_t sq_depth;\r
+ uint32_t rq_depth;\r
+ uint32_t sq_sge;\r
+ uint32_t rq_sge;\r
+\r
+ ib_cq_handle_t h_sq_cq;\r
+ ib_cq_handle_t h_rq_cq;\r
+ ib_srq_handle_t h_srq;\r
+\r
+ boolean_t sq_signaled;\r
+\r
+} ib_qp_create_t;\r
+/*\r
+* FIELDS\r
+* type\r
+* Specifies the type of queue pair to create.\r
+*\r
+* sq_depth\r
+* Indicates the requested maximum number of work requests that may be\r
+* outstanding on the queue pair's send queue. This value must be less\r
+* than or equal to the maximum reported by the channel adapter associated\r
+* with the queue pair.\r
+*\r
+* rq_depth\r
+* Indicates the requested maximum number of work requests that may be\r
+* outstanding on the queue pair's receive queue. This value must be less\r
+* than or equal to the maximum reported by the channel adapter associated\r
+* with the queue pair.\r
+*\r
+* sq_sge\r
+* Indicates the maximum number scatter-gather elements that may be\r
+* given in a send work request. This value must be less\r
+* than or equal to the maximum reported by the channel adapter associated\r
+* with the queue pair.\r
+*\r
+* rq_sge\r
+* Indicates the maximum number scatter-gather elements that may be\r
+* given in a receive work request. This value must be less\r
+* than or equal to the maximum reported by the channel adapter associated\r
+* with the queue pair.\r
+*\r
+* h_sq_cq\r
+* A handle to the completion queue that will be used to report send work\r
+* request completions. This handle must be NULL if the type is\r
+* IB_QPT_MAD, IB_QPT_QP0_ALIAS, or IB_QPT_QP1_ALIAS.\r
+*\r
+* h_rq_cq\r
+* A handle to the completion queue that will be used to report receive\r
+* work request completions. This handle must be NULL if the type is\r
+* IB_QPT_MAD, IB_QPT_QP0_ALIAS, or IB_QPT_QP1_ALIAS.\r
+*\r
+* h_srq\r
+* A handle to an SRQ to get receive completions via. Must be coded NULL \r
+* when QP is not associated with SRQ\r
+*\r
+* sq_signaled\r
+* A flag that is used to indicate whether the queue pair will signal\r
+* an event upon completion of a send work request. If set to\r
+* TRUE, send work requests will always generate a completion\r
+* event. If set to FALSE, a completion event will only be\r
+* generated if the send_opt field of the send work request has the\r
+* IB_SEND_OPT_SIGNALED flag set.\r
+*\r
+* SEE ALSO\r
+* ib_qp_type_t, ib_qp_attr_t\r
+*****/\r
+\r
+/****s* Access Layer/ib_qp_attr_t\r
+* NAME\r
+* ib_qp_attr_t\r
+*\r
+* DESCRIPTION\r
+* Queue pair attributes returned through ib_query_qp.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_qp_attr\r
+{\r
+ ib_pd_handle_t h_pd;\r
+ ib_qp_type_t qp_type;\r
+ ib_access_t access_ctrl;\r
+ uint16_t pkey_index;\r
+\r
+ uint32_t sq_max_inline;\r
+ uint32_t sq_depth;\r
+ uint32_t rq_depth;\r
+ uint32_t sq_sge;\r
+ uint32_t rq_sge;\r
+ uint8_t init_depth;\r
+ uint8_t resp_res;\r
+\r
+ ib_cq_handle_t h_sq_cq;\r
+ ib_cq_handle_t h_rq_cq;\r
+ ib_srq_handle_t h_srq;\r
+\r
+ boolean_t sq_signaled;\r
+\r
+ ib_qp_state_t state;\r
+ ib_net32_t num;\r
+ ib_net32_t dest_num;\r
+ ib_net32_t qkey;\r
+\r
+ ib_net32_t sq_psn;\r
+ ib_net32_t rq_psn;\r
+\r
+ uint8_t primary_port;\r
+ uint8_t alternate_port;\r
+ ib_av_attr_t primary_av;\r
+ ib_av_attr_t alternate_av;\r
+ ib_apm_state_t apm_state;\r
+\r
+} ib_qp_attr_t;\r
+/*\r
+* FIELDS\r
+* h_pd\r
+* This is a handle to a protection domain associated with the QP.\r
+*\r
+* sq_max_inline\r
+* Maximum payload that can be inlined directly in a WQE, eliminating\r
+* protection checks and additional DMA operations.\r
+*\r
+* NOTES\r
+* Other fields are defined by the Infiniband specification.\r
+*\r
+* SEE ALSO\r
+* ib_qp_type_t, ib_access_t, ib_qp_state_t, ib_av_attr_t, ib_apm_state_t\r
+*****/\r
+\r
+/****d* Access Layer/ib_qp_opts_t\r
+* NAME\r
+* ib_qp_opts_t\r
+*\r
+* DESCRIPTION\r
+* Optional fields supplied in the modify QP operation.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef uint32_t ib_qp_opts_t;\r
+#define IB_MOD_QP_ALTERNATE_AV 0x00000001\r
+#define IB_MOD_QP_PKEY 0x00000002\r
+#define IB_MOD_QP_APM_STATE 0x00000004\r
+#define IB_MOD_QP_PRIMARY_AV 0x00000008\r
+#define IB_MOD_QP_RNR_NAK_TIMEOUT 0x00000010\r
+#define IB_MOD_QP_RESP_RES 0x00000020\r
+#define IB_MOD_QP_INIT_DEPTH 0x00000040\r
+#define IB_MOD_QP_PRIMARY_PORT 0x00000080\r
+#define IB_MOD_QP_ACCESS_CTRL 0x00000100\r
+#define IB_MOD_QP_QKEY 0x00000200\r
+#define IB_MOD_QP_SQ_DEPTH 0x00000400\r
+#define IB_MOD_QP_RQ_DEPTH 0x00000800\r
+#define IB_MOD_QP_CURRENT_STATE 0x00001000\r
+#define IB_MOD_QP_RETRY_CNT 0x00002000\r
+#define IB_MOD_QP_LOCAL_ACK_TIMEOUT 0x00004000\r
+#define IB_MOD_QP_RNR_RETRY_CNT 0x00008000\r
+/*\r
+* SEE ALSO\r
+* ib_qp_mod_t\r
+*****/\r
+\r
+/****s* Access Layer/ib_qp_mod_t\r
+* NAME\r
+* ib_qp_mod_t\r
+*\r
+* DESCRIPTION\r
+* Information needed to change the state of a queue pair through the\r
+* ib_modify_qp call.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_qp_mod\r
+{\r
+ ib_qp_state_t req_state;\r
+\r
+ union _qp_state\r
+ {\r
+ struct _qp_init\r
+ {\r
+ uint8_t primary_port;\r
+ ib_net32_t qkey;\r
+ uint16_t pkey_index;\r
+ ib_access_t access_ctrl;\r
+\r
+ } init;\r
+\r
+ struct _qp_rtr\r
+ {\r
+ ib_net32_t rq_psn;\r
+ ib_net32_t dest_qp;\r
+ ib_av_attr_t primary_av;\r
+ uint8_t resp_res;\r
+ uint8_t rnr_nak_timeout;\r
+\r
+ ib_qp_opts_t opts;\r
+ ib_av_attr_t alternate_av;\r
+ ib_net32_t qkey;\r
+ uint16_t pkey_index;\r
+ ib_access_t access_ctrl;\r
+ uint32_t sq_depth;\r
+ uint32_t rq_depth;\r
+\r
+ } rtr;\r
+\r
+ struct _qp_rts\r
+ {\r
+ ib_net32_t sq_psn;\r
+ uint8_t retry_cnt;\r
+ uint8_t rnr_retry_cnt;\r
+ uint8_t local_ack_timeout;\r
+ uint8_t init_depth;\r
+\r
+ ib_qp_opts_t opts;\r
+ uint8_t rnr_nak_timeout;\r
+ ib_qp_state_t current_state;\r
+ ib_net32_t qkey;\r
+ ib_access_t access_ctrl;\r
+ uint8_t resp_res;\r
+\r
+ ib_av_attr_t primary_av;\r
+ ib_av_attr_t alternate_av;\r
+\r
+ uint32_t sq_depth;\r
+ uint32_t rq_depth;\r
+\r
+ ib_apm_state_t apm_state;\r
+ uint8_t primary_port;\r
+ uint16_t pkey_index;\r
+\r
+ } rts;\r
+\r
+ struct _qp_sqd\r
+ {\r
+ boolean_t sqd_event;\r
+\r
+ } sqd;\r
+\r
+ } state;\r
+\r
+} ib_qp_mod_t;\r
+/*\r
+* SEE ALSO\r
+* ib_qp_state_t, ib_access_t, ib_av_attr_t, ib_apm_state_t\r
+*****/\r
+\r
+\r
+/****d* Access Layer/ib_wr_type_t\r
+* NAME\r
+* ib_wr_type_t\r
+*\r
+* DESCRIPTION\r
+* Identifies the type of work request posted to a queue pair.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef enum _ib_wr_type_t\r
+{\r
+ WR_SEND = 1,\r
+ WR_RDMA_WRITE,\r
+ WR_RDMA_READ,\r
+ WR_COMPARE_SWAP,\r
+ WR_FETCH_ADD,\r
+ WR_UNKNOWN\r
+\r
+} ib_wr_type_t;\r
+/*****/\r
+\r
+\r
+/****f* IBA Base: Types/ib_get_wr_type_str\r
+* NAME\r
+* ib_get_wr_type_str\r
+*\r
+* DESCRIPTION\r
+* Returns a string for the specified work request type\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT const char* AL_API\r
+ib_get_wr_type_str(\r
+ IN uint8_t wr_type );\r
+\r
+/*\r
+* PARAMETERS\r
+* wr_type\r
+* [in] Encoded work request type as defined in the\r
+work request attribute.\r
+\r
+* RETURN VALUES\r
+* Pointer to the work request type string.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+* ib_wr_type_t\r
+*********/\r
+\r
+\r
+/****s* Access Layer/ib_local_ds_t\r
+* NAME\r
+* ib_local_ds_t\r
+*\r
+* DESCRIPTION\r
+* Local data segment information referenced by send and receive work\r
+* requests. This is used to specify local data buffers used as part of a\r
+* work request.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_local_ds\r
+{\r
+ uint64_t vaddr;\r
+ uint32_t length;\r
+ uint32_t lkey;\r
+\r
+} ib_local_ds_t;\r
+/*****/\r
+\r
+/****d* Access Layer/ib_send_opt_t\r
+* NAME\r
+* ib_send_opt_t\r
+*\r
+* DESCRIPTION\r
+* Optional flags used when posting send work requests. These flags\r
+* indicate specific processing for the send operation.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef uint32_t ib_send_opt_t;\r
+#define IB_SEND_OPT_IMMEDIATE 0x00000001\r
+#define IB_SEND_OPT_FENCE 0x00000002\r
+#define IB_SEND_OPT_SIGNALED 0x00000004\r
+#define IB_SEND_OPT_SOLICITED 0x00000008\r
+#define IB_SEND_OPT_INLINE 0x00000010\r
+#define IB_SEND_OPT_LOCAL 0x00000020\r
+#define IB_SEND_OPT_VEND_MASK 0xFFFF0000\r
+/*\r
+* VALUES\r
+* The following flags determine the behavior of a work request when\r
+* posted to the send side.\r
+*\r
+* IB_SEND_OPT_IMMEDIATE\r
+* Send immediate data with the given request.\r
+*\r
+* IB_SEND_OPT_FENCE\r
+* The operation is fenced. Complete all pending send operations\r
+* before processing this request.\r
+*\r
+* IB_SEND_OPT_SIGNALED\r
+* If the queue pair is configured for signaled completion, then\r
+* generate a completion queue entry when this request completes.\r
+*\r
+* IB_SEND_OPT_SOLICITED\r
+* Set the solicited bit on the last packet of this request.\r
+*\r
+* IB_SEND_OPT_INLINE\r
+* Indicates that the requested send data should be copied into a VPD\r
+* owned data buffer. This flag permits the user to issue send operations\r
+* without first needing to register the buffer(s) associated with the\r
+* send operation. Verb providers that support this operation may place\r
+* vendor specific restrictions on the size of send operation that may\r
+* be performed as inline.\r
+*\r
+*\r
+* IB_SEND_OPT_LOCAL\r
+* Indicates that a sent MAD request should be given to the local VPD for\r
+* processing. MADs sent using this option are not placed on the wire.\r
+* This send option is only valid for MAD send operations.\r
+*\r
+*\r
+* IB_SEND_OPT_VEND_MASK\r
+* This mask indicates bits reserved in the send options that may be used\r
+* by the verbs provider to indicate vendor specific options. Bits set\r
+* in this area of the send options are ignored by the Access Layer, but\r
+* may have specific meaning to the underlying VPD.\r
+*\r
+*****/\r
+\r
+/****s* Access Layer/ib_send_wr_t\r
+* NAME\r
+* ib_send_wr_t\r
+*\r
+* DESCRIPTION\r
+* Information used to submit a work request to the send queue of a queue\r
+* pair.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_send_wr\r
+{\r
+ struct _ib_send_wr* __ptr64 p_next;\r
+ uint64_t wr_id;\r
+ ib_wr_type_t wr_type;\r
+ ib_send_opt_t send_opt;\r
+ uint32_t num_ds;\r
+ ib_local_ds_t* __ptr64 ds_array;\r
+ ib_net32_t immediate_data;\r
+\r
+ union _send_dgrm\r
+ {\r
+ struct _send_ud\r
+ {\r
+ ib_net32_t remote_qp;\r
+ ib_net32_t remote_qkey;\r
+ ib_av_handle_t h_av;\r
+ uint16_t pkey_index;\r
+ void* __ptr64 rsvd;\r
+\r
+ } ud;\r
+\r
+ struct _send_rd\r
+ {\r
+ ib_net32_t remote_qp;\r
+ ib_net32_t remote_qkey;\r
+ ib_net32_t eecn;\r
+\r
+ } rd;\r
+\r
+ struct _send_raw_ether\r
+ {\r
+ ib_net16_t dest_lid;\r
+ uint8_t path_bits;\r
+ uint8_t sl;\r
+ uint8_t max_static_rate;\r
+ ib_net16_t ether_type;\r
+\r
+ } raw_ether;\r
+\r
+ struct _send_raw_ipv6\r
+ {\r
+ ib_net16_t dest_lid;\r
+ uint8_t path_bits;\r
+ uint8_t sl;\r
+ uint8_t max_static_rate;\r
+\r
+ } raw_ipv6;\r
+\r
+ } dgrm;\r
+\r
+ struct _send_remote_ops\r
+ {\r
+ uint64_t vaddr;\r
+ net32_t rkey;\r
+\r
+ ib_net64_t atomic1;\r
+ ib_net64_t atomic2;\r
+\r
+ } remote_ops;\r
+\r
+} ib_send_wr_t;\r
+/*\r
+* FIELDS\r
+* p_next\r
+* A pointer used to chain work requests together. This permits multiple\r
+* work requests to be posted to a queue pair through a single function\r
+* call. This value is set to NULL to mark the end of the chain.\r
+*\r
+* wr_id\r
+* A 64-bit work request identifier that is returned to the consumer\r
+* as part of the work completion.\r
+*\r
+* wr_type\r
+* The type of work request being submitted to the send queue.\r
+*\r
+* send_opt\r
+* Optional send control parameters.\r
+*\r
+* num_ds\r
+* Number of local data segments specified by this work request.\r
+*\r
+* ds_array\r
+* A reference to an array of local data segments used by the send\r
+* operation.\r
+*\r
+* immediate_data\r
+* 32-bit field sent as part of a message send or RDMA write operation.\r
+* This field is only valid if the send_opt flag IB_SEND_OPT_IMMEDIATE\r
+* has been set.\r
+*\r
+* dgrm.ud.remote_qp\r
+* Identifies the destination queue pair of an unreliable datagram send\r
+* operation.\r
+*\r
+* dgrm.ud.remote_qkey\r
+* The qkey for the destination queue pair.\r
+*\r
+* dgrm.ud.h_av\r
+* An address vector that specifies the path information used to route\r
+* the outbound datagram to the destination queue pair.\r
+*\r
+* dgrm.ud.pkey_index\r
+* The pkey index for this send work request. This is valid only\r
+* for IB_QPT_QP1 and IB_QPT_QP1_ALIAS QP types. The work request\r
+* is posted to using this pkey index build the GMP's BTH instead\r
+* of the QP's pkey.\r
+*\r
+* dgrm.ud.rsvd\r
+* Reserved for use by the Access Layer.\r
+*\r
+* dgrm.raw_ether.dest_lid\r
+* The destination LID that will receive this raw ether send.\r
+*\r
+* dgrm.raw_ether.path_bits\r
+* path bits...\r
+*\r
+* dgrm.raw_ether.sl\r
+* service level...\r
+*\r
+* dgrm.raw_ether.max_static_rate\r
+* static rate...\r
+*\r
+* dgrm.raw_ether.ether_type\r
+* ether type...\r
+*\r
+* dgrm.raw_ipv6.dest_lid\r
+* The destination LID that will receive this raw ether send.\r
+*\r
+* dgrm.raw_ipv6.path_bits\r
+* path bits...\r
+*\r
+* dgrm.raw_ipv6.sl\r
+* service level...\r
+*\r
+* dgrm.raw_ipv6.max_static_rate\r
+* static rate...\r
+*\r
+* remote_ops.vaddr\r
+* The registered virtual memory address of the remote memory to access\r
+* with an RDMA or atomic operation.\r
+*\r
+* remote_ops.rkey\r
+* The rkey associated with the specified remote vaddr. This data must\r
+* be presented exactly as obtained from the remote node. No swapping\r
+* of data must be performed.\r
+*\r
+* atomic1\r
+* The first operand for an atomic operation.\r
+*\r
+* atomic2\r
+* The second operand for an atomic operation.\r
+*\r
+* NOTES\r
+* The format of data sent over the fabric is user-defined and is considered\r
+* opaque to the access layer. The sole exception to this are MADs posted\r
+* to a MAD QP service. MADs are expected to match the format defined by\r
+* the Infiniband specification and must be in network-byte order when posted\r
+* to the MAD QP service.\r
+*\r
+* SEE ALSO\r
+* ib_wr_type_t, ib_local_ds_t, ib_send_opt_t\r
+*****/\r
+\r
+/****s* Access Layer/ib_recv_wr_t\r
+* NAME\r
+* ib_recv_wr_t\r
+*\r
+* DESCRIPTION\r
+* Information used to submit a work request to the receive queue of a queue\r
+* pair.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_recv_wr\r
+{\r
+ struct _ib_recv_wr* __ptr64 p_next;\r
+ uint64_t wr_id;\r
+ uint32_t num_ds;\r
+ ib_local_ds_t* __ptr64 ds_array;\r
+\r
+} ib_recv_wr_t;\r
+/*\r
+* FIELDS\r
+* p_next\r
+* A pointer used to chain work requests together. This permits multiple\r
+* work requests to be posted to a queue pair through a single function\r
+* call. This value is set to NULL to mark the end of the chain.\r
+*\r
+* wr_id\r
+* A 64-bit work request identifier that is returned to the consumer\r
+* as part of the work completion.\r
+*\r
+* num_ds\r
+* Number of local data segments specified by this work request.\r
+*\r
+* ds_array\r
+* A reference to an array of local data segments used by the send\r
+* operation.\r
+*\r
+* SEE ALSO\r
+* ib_local_ds_t\r
+*****/\r
+\r
+/****s* Access Layer/ib_bind_wr_t\r
+* NAME\r
+* ib_bind_wr_t\r
+*\r
+* DESCRIPTION\r
+* Information used to submit a memory window bind work request to the send\r
+* queue of a queue pair.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_bind_wr\r
+{\r
+ uint64_t wr_id;\r
+ ib_send_opt_t send_opt;\r
+\r
+ ib_mr_handle_t h_mr;\r
+ ib_access_t access_ctrl;\r
+ net32_t current_rkey;\r
+\r
+ ib_local_ds_t local_ds;\r
+\r
+} ib_bind_wr_t;\r
+/*\r
+* FIELDS\r
+* wr_id\r
+* A 64-bit work request identifier that is returned to the consumer\r
+* as part of the work completion.\r
+*\r
+* send_opt\r
+* Optional send control parameters.\r
+*\r
+* h_mr\r
+* Handle to the memory region to which this window is being bound.\r
+*\r
+* access_ctrl\r
+* Access rights for this memory window.\r
+*\r
+* current_rkey\r
+* The current rkey assigned to this window for remote access.\r
+*\r
+* local_ds\r
+* A reference to a local data segment used by the bind operation.\r
+*\r
+* SEE ALSO\r
+* ib_send_opt_t, ib_access_t, ib_local_ds_t\r
+*****/\r
+\r
+/****d* Access Layer/ib_wc_status_t\r
+* NAME\r
+* ib_wc_status_t\r
+*\r
+* DESCRIPTION\r
+* Indicates the status of a completed work request. These VALUES are\r
+* returned to the user when retrieving completions. Note that success is\r
+* identified as IB_WCS_SUCCESS, which is always zero.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef enum _ib_wc_status_t\r
+{\r
+ IB_WCS_SUCCESS,\r
+ IB_WCS_LOCAL_LEN_ERR,\r
+ IB_WCS_LOCAL_OP_ERR,\r
+ IB_WCS_LOCAL_PROTECTION_ERR,\r
+ IB_WCS_WR_FLUSHED_ERR,\r
+ IB_WCS_MEM_WINDOW_BIND_ERR,\r
+ IB_WCS_REM_ACCESS_ERR,\r
+ IB_WCS_REM_OP_ERR,\r
+ IB_WCS_RNR_RETRY_ERR,\r
+ IB_WCS_TIMEOUT_RETRY_ERR,\r
+ IB_WCS_REM_INVALID_REQ_ERR,\r
+ IB_WCS_BAD_RESP_ERR,\r
+ IB_WCS_LOCAL_ACCESS_ERR,\r
+ IB_WCS_GENERAL_ERR,\r
+ IB_WCS_UNMATCHED_RESPONSE, /* InfiniBand Access Layer */\r
+ IB_WCS_CANCELED, /* InfiniBand Access Layer */\r
+ IB_WCS_UNKNOWN /* Must be last. */\r
+\r
+} ib_wc_status_t;\r
+/*\r
+* VALUES\r
+* IB_WCS_SUCCESS\r
+* Work request completed successfully.\r
+*\r
+* IB_WCS_MAD\r
+* The completed work request was associated with a managmenet datagram\r
+* that requires post processing. The MAD will be returned to the user\r
+* through a callback once all post processing has completed.\r
+*\r
+* IB_WCS_LOCAL_LEN_ERR\r
+* Generated for a work request posted to the send queue when the\r
+* total of the data segment lengths exceeds the message length of the\r
+* channel. Generated for a work request posted to the receive queue when\r
+* the total of the data segment lengths is too small for a\r
+* valid incoming message.\r
+*\r
+* IB_WCS_LOCAL_OP_ERR\r
+* An internal QP consistency error was generated while processing this\r
+* work request. This may indicate that the QP was in an incorrect state\r
+* for the requested operation.\r
+*\r
+* IB_WCS_LOCAL_PROTECTION_ERR\r
+* The data segments of the locally posted work request did not refer to\r
+* a valid memory region. The memory may not have been properly\r
+* registered for the requested operation.\r
+*\r
+* IB_WCS_WR_FLUSHED_ERR\r
+* The work request was flushed from the QP before being completed.\r
+*\r
+* IB_WCS_MEM_WINDOW_BIND_ERR\r
+* A memory window bind operation failed due to insufficient access\r
+* rights.\r
+*\r
+* IB_WCS_REM_ACCESS_ERR,\r
+* A protection error was detected at the remote node for a RDMA or atomic\r
+* operation.\r
+*\r
+* IB_WCS_REM_OP_ERR,\r
+* The operation could not be successfully completed at the remote node.\r
+* This may indicate that the remote QP was in an invalid state or\r
+* contained an invalid work request.\r
+*\r
+* IB_WCS_RNR_RETRY_ERR,\r
+* The RNR retry count was exceeded while trying to send this message.\r
+*\r
+* IB_WCS_TIMEOUT_RETRY_ERR\r
+* The local transport timeout counter expired while trying to send this\r
+* message.\r
+*\r
+* IB_WCS_REM_INVALID_REQ_ERR,\r
+* The remote node detected an invalid message on the channel. This error\r
+* is usually a result of one of the following:\r
+* - The operation was not supported on receive queue.\r
+* - There was insufficient buffers to receive a new RDMA request.\r
+* - There was insufficient buffers to receive a new atomic operation.\r
+* - An RDMA request was larger than 2^31 bytes.\r
+*\r
+ * IB_WCS_BAD_RESP_ERR,\r
+ * An unexpected transport layer opcode was returned\r
+ * by the responder.\r
+ *\r
+ * IB_WCS_LOCAL_ACCESS_ERR,\r
+ * A protection error occurred on a local data buffer\r
+ * during the processing of a RDMA Write with Immediate Data \r
+ * operation sent from the remote node.\r
+ *\r
+* IB_WCS_UNMATCHED_RESPONSE\r
+* A response MAD was received for which there was no matching send. The\r
+* send operation may have been canceled by the user or may have timed\r
+* out.\r
+*\r
+* IB_WCS_CANCELED\r
+* The completed work request was canceled by the user.\r
+ *\r
+ * IB_WCS_GENERAL_ERR,\r
+ * Any other error\r
+ *\r
+*****/\r
+\r
+\r
+\r
+/****f* IBA Base: Types/ib_get_wc_status_str\r
+* NAME\r
+* ib_get_wc_status_str\r
+*\r
+* DESCRIPTION\r
+* Returns a string for the specified work completion status.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT const char* AL_API\r
+ib_get_wc_status_str(\r
+ IN ib_wc_status_t wc_status );\r
+/*\r
+* PARAMETERS\r
+* wc_status\r
+* [in] work completion status value\r
+*\r
+* RETURN VALUES\r
+* Pointer to the work completion status description string.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+*********/\r
+\r
+/****d* Access Layer/ib_wc_type_t\r
+* NAME\r
+* ib_wc_type_t\r
+*\r
+* DESCRIPTION\r
+* Indicates the type of work completion.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef enum _ib_wc_type_t\r
+{\r
+ IB_WC_SEND,\r
+ IB_WC_RDMA_WRITE,\r
+ IB_WC_RECV,\r
+ IB_WC_RDMA_READ,\r
+ IB_WC_MW_BIND,\r
+ IB_WC_FETCH_ADD,\r
+ IB_WC_COMPARE_SWAP,\r
+ IB_WC_RECV_RDMA_WRITE,\r
+ IB_WC_UNKNOWN\r
+\r
+} ib_wc_type_t;\r
+/*****/\r
+\r
+\r
+/****f* IBA Base: Types/ib_get_wc_type_str\r
+* NAME\r
+* ib_get_wc_type_str\r
+*\r
+* DESCRIPTION\r
+* Returns a string for the specified work completion type.\r
+*\r
+* SYNOPSIS\r
+*/\r
+AL_EXPORT const char* AL_API\r
+ib_get_wc_type_str(\r
+ IN ib_wc_type_t wc_type );\r
+/*\r
+* PARAMETERS\r
+* wc_type\r
+* [in] work completion type value\r
+*\r
+* RETURN VALUES\r
+* Pointer to the work completion type description string.\r
+*\r
+* NOTES\r
+*\r
+* SEE ALSO\r
+*********/\r
+\r
+\r
+/****d* Access Layer/ib_recv_opt_t\r
+* NAME\r
+* ib_recv_opt_t\r
+*\r
+* DESCRIPTION\r
+* Indicates optional fields valid in a receive work completion.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef uint32_t ib_recv_opt_t;\r
+#define IB_RECV_OPT_IMMEDIATE 0x00000001\r
+#define IB_RECV_OPT_FORWARD 0x00000002\r
+#define IB_RECV_OPT_GRH_VALID 0x00000004\r
+#define IB_RECV_OPT_VEND_MASK 0xFFFF0000\r
+/*\r
+* VALUES\r
+* IB_RECV_OPT_IMMEDIATE\r
+* Indicates that immediate data is valid for this work completion.\r
+*\r
+* IB_RECV_OPT_FORWARD\r
+* Indicates that the received trap should be forwarded to the SM.\r
+*\r
+* IB_RECV_OPT_GRH_VALID\r
+* Indicates presence of the global route header. When set, the first\r
+* 40 bytes received are the GRH.\r
+*\r
+* IB_RECV_OPT_VEND_MASK\r
+* This mask indicates bits reserved in the receive options that may be\r
+* used by the verbs provider to indicate vendor specific options. Bits\r
+* set in this area of the receive options are ignored by the Access Layer,\r
+* but may have specific meaning to the underlying VPD.\r
+*****/\r
+\r
+/****s* Access Layer/ib_wc_t\r
+* NAME\r
+* ib_wc_t\r
+*\r
+* DESCRIPTION\r
+* Work completion information.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_wc\r
+{\r
+ struct _ib_wc* __ptr64 p_next;\r
+ uint64_t wr_id;\r
+ ib_wc_type_t wc_type;\r
+\r
+ uint32_t length;\r
+ ib_wc_status_t status;\r
+ uint64_t vendor_specific;\r
+\r
+ union _wc_recv\r
+ {\r
+ struct _wc_conn\r
+ {\r
+ ib_recv_opt_t recv_opt;\r
+ ib_net32_t immediate_data;\r
+\r
+ } conn;\r
+\r
+ struct _wc_ud\r
+ {\r
+ ib_recv_opt_t recv_opt;\r
+ ib_net32_t immediate_data;\r
+ ib_net32_t remote_qp;\r
+ uint16_t pkey_index;\r
+ ib_net16_t remote_lid;\r
+ uint8_t remote_sl;\r
+ uint8_t path_bits;\r
+\r
+ } ud;\r
+\r
+ struct _wc_rd\r
+ {\r
+ ib_net32_t remote_eecn;\r
+ ib_net32_t remote_qp;\r
+ ib_net16_t remote_lid;\r
+ uint8_t remote_sl;\r
+ uint32_t free_cnt;\r
+\r
+ } rd;\r
+\r
+ struct _wc_raw_ipv6\r
+ {\r
+ ib_net16_t remote_lid;\r
+ uint8_t remote_sl;\r
+ uint8_t path_bits;\r
+\r
+ } raw_ipv6;\r
+\r
+ struct _wc_raw_ether\r
+ {\r
+ ib_net16_t remote_lid;\r
+ uint8_t remote_sl;\r
+ uint8_t path_bits;\r
+ ib_net16_t ether_type;\r
+\r
+ } raw_ether;\r
+\r
+ } recv;\r
+\r
+} ib_wc_t;\r
+/*\r
+* FIELDS\r
+* p_next\r
+* A pointer used to chain work completions. This permits multiple\r
+* work completions to be retrieved from a completion queue through a\r
+* single function call. This value is set to NULL to mark the end of\r
+* the chain.\r
+*\r
+* wr_id\r
+* The 64-bit work request identifier that was specified when posting the\r
+* work request.\r
+*\r
+* wc_type\r
+* Indicates the type of work completion.\r
+*\r
+*\r
+* length\r
+* The total length of the data sent or received with the work request.\r
+*\r
+* status\r
+* The result of the work request.\r
+*\r
+* vendor_specific\r
+* HCA vendor specific information returned as part of the completion.\r
+*\r
+* recv.conn.recv_opt\r
+* Indicates optional fields valid as part of a work request that\r
+* completed on a connected (reliable or unreliable) queue pair.\r
+*\r
+* recv.conn.immediate_data\r
+* 32-bit field received as part of an inbound message on a connected\r
+* queue pair. This field is only valid if the recv_opt flag\r
+* IB_RECV_OPT_IMMEDIATE has been set.\r
+*\r
+* recv.ud.recv_opt\r
+* Indicates optional fields valid as part of a work request that\r
+* completed on an unreliable datagram queue pair.\r
+*\r
+* recv.ud.immediate_data\r
+* 32-bit field received as part of an inbound message on a unreliable\r
+* datagram queue pair. This field is only valid if the recv_opt flag\r
+* IB_RECV_OPT_IMMEDIATE has been set.\r
+*\r
+* recv.ud.remote_qp\r
+* Identifies the source queue pair of a received datagram.\r
+*\r
+* recv.ud.pkey_index\r
+* The pkey index for the source queue pair. This is valid only for\r
+* GSI type QP's.\r
+*\r
+* recv.ud.remote_lid\r
+* The source LID of the received datagram.\r
+*\r
+* recv.ud.remote_sl\r
+* The service level used by the source of the received datagram.\r
+*\r
+* recv.ud.path_bits\r
+* path bits...\r
+*\r
+* recv.rd.remote_eecn\r
+* The remote end-to-end context number that sent the received message.\r
+*\r
+* recv.rd.remote_qp\r
+* Identifies the source queue pair of a received message.\r
+*\r
+* recv.rd.remote_lid\r
+* The source LID of the received message.\r
+*\r
+* recv.rd.remote_sl\r
+* The service level used by the source of the received message.\r
+*\r
+* recv.rd.free_cnt\r
+* The number of available entries in the completion queue. Reliable\r
+* datagrams may complete out of order, so this field may be used to\r
+* determine the number of additional completions that may occur.\r
+*\r
+* recv.raw_ipv6.remote_lid\r
+* The source LID of the received message.\r
+*\r
+* recv.raw_ipv6.remote_sl\r
+* The service level used by the source of the received message.\r
+*\r
+* recv.raw_ipv6.path_bits\r
+* path bits...\r
+*\r
+* recv.raw_ether.remote_lid\r
+* The source LID of the received message.\r
+*\r
+* recv.raw_ether.remote_sl\r
+* The service level used by the source of the received message.\r
+*\r
+* recv.raw_ether.path_bits\r
+* path bits...\r
+*\r
+* recv.raw_ether.ether_type\r
+* ether type...\r
+* NOTES\r
+* When the work request completes with error, the only values that the\r
+* consumer can depend on are the wr_id field, and the status of the\r
+* operation.\r
+*\r
+* If the consumer is using the same CQ for completions from more than\r
+* one type of QP (i.e Reliable Connected, Datagram etc), then the consumer\r
+* must have additional information to decide what fields of the union are\r
+* valid.\r
+* SEE ALSO\r
+* ib_wc_type_t, ib_qp_type_t, ib_wc_status_t, ib_recv_opt_t\r
+*****/\r
+\r
+/****s* Access Layer/ib_mr_create_t\r
+* NAME\r
+* ib_mr_create_t\r
+*\r
+* DESCRIPTION\r
+* Information required to create a registered memory region.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_mr_create\r
+{\r
+ void* __ptr64 vaddr;\r
+ uint64_t length;\r
+ ib_access_t access_ctrl;\r
+} ib_mr_create_t;\r
+/*\r
+* FIELDS\r
+* vaddr\r
+* Starting virtual address of the region being registered.\r
+*\r
+* length\r
+* Length of the buffer to register.\r
+*\r
+* access_ctrl\r
+* Access rights of the registered region.\r
+*\r
+* SEE ALSO\r
+* ib_access_t\r
+*****/\r
+\r
+#ifdef CL_KERNEL\r
+\r
+/****s* Access Layer/mlnx_fmr_create_t\r
+* NAME\r
+* mlnx_fmr_create_t\r
+*\r
+* DESCRIPTION\r
+* Information required to create a Mellanox fast memory region.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _mlnx_fmr_create\r
+{\r
+ int max_pages;\r
+ int max_maps;\r
+ uint8_t page_size;\r
+ ib_access_t access_ctrl;\r
+\r
+} mlnx_fmr_create_t;\r
+/*\r
+* FIELDS\r
+* max_pages\r
+* max pages in the region.\r
+*\r
+* max_maps\r
+* max times, the region can be mapped before remapping.\r
+*\r
+* page_size\r
+* log2 of the page size (e.g. 12 for 4KB).\r
+*\r
+* access_ctrl\r
+* Access rights of the registered region.\r
+*\r
+* NOTES\r
+* This is a Mellanox specific extension to verbs.\r
+*\r
+* SEE ALSO\r
+* ib_access_t\r
+*****/\r
+\r
+\r
+/****s* Access Layer/mlnx_fmr_pool_create_t\r
+* NAME\r
+* mlnx_fmr_pool_create_t\r
+*\r
+* DESCRIPTION\r
+* Information required to create a Mellanox fast memory region pool.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _mlnx_fmr_pool_create\r
+{\r
+ int max_pages_per_fmr;\r
+ uint8_t page_size; /* really - page_shift, log2 of page_size */\r
+ enum ib_access_flags access_ctrl;\r
+ int pool_size;\r
+ int dirty_watermark;\r
+ void (*flush_function)(mlnx_fmr_pool_handle_t h_pool, void *arg);\r
+ void *flush_arg;\r
+ boolean_t cache;\r
+} mlnx_fmr_pool_create_t;\r
+/*\r
+* FIELDS\r
+* max_pages\r
+* max pages in the region.\r
+*\r
+* max_maps\r
+* max times, the region can be mapped before remapping.\r
+*\r
+* page_size\r
+* log2 of the page size (e.g. 12 for 4KB).\r
+*\r
+* access_ctrl\r
+* Access rights of the registered region.\r
+*\r
+* NOTES\r
+* This is a Mellanox specific extension to verbs.\r
+*\r
+* SEE ALSO\r
+* ib_access_t\r
+*****/\r
+#endif\r
+\r
+/****s* Access Layer/ib_phys_range_t\r
+* NAME\r
+* ib_phys_range_t\r
+*\r
+* DESCRIPTION\r
+* Information describing a physical memory range.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_phys_range\r
+{\r
+ uint64_t base_addr;\r
+ uint64_t size;\r
+\r
+} ib_phys_range_t;\r
+/*\r
+* FIELDS\r
+* base_addr\r
+* Physical address of the base of the memory range.\r
+*\r
+* size\r
+* size, in bytes, of the memory range.\r
+*\r
+* NOTES\r
+* The base address must be start and end on an HCA-supported page boundary.\r
+*\r
+* SEE ALSO\r
+* ib_phys_create_t\r
+*********/\r
+\r
+\r
+/****s* Access Layer/ib_phys_create_t\r
+* NAME\r
+* ib_phys_create_t\r
+*\r
+* DESCRIPTION\r
+* Information required to create a physical memory region.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_phys_create\r
+{\r
+ uint64_t length;\r
+ uint32_t num_ranges;\r
+ ib_phys_range_t* __ptr64 range_array;\r
+ uint32_t buf_offset;\r
+ uint32_t hca_page_size;\r
+ ib_access_t access_ctrl;\r
+} ib_phys_create_t;\r
+/*\r
+* FIELDS\r
+* length\r
+* The length of the memory region in bytes.\r
+*\r
+* num_ranges\r
+* Number of ib_phys_range structures listed in the specified range array.\r
+*\r
+* range_array\r
+* An array of ib_phys_range structures to be registered as a single memory\r
+* region.\r
+*\r
+* buf_offset\r
+* The offset into the first physical memory range of the specified memory\r
+* region on which to start the virtual address.\r
+*\r
+* hca_page_size\r
+* The HCA page size to use to register the memory.\r
+*\r
+* access_ctrl\r
+* Access rights of the registered region.\r
+*\r
+* SEE ALSO\r
+* ib_access_t\r
+*****/\r
+\r
+/****s* Access Layer/ib_mr_attr_t\r
+* NAME\r
+* ib_mr_attr_t\r
+*\r
+* DESCRIPTION\r
+* Attributes of a registered memory region.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_mr_attr\r
+{\r
+ ib_pd_handle_t h_pd;\r
+ uint64_t local_lb;\r
+ uint64_t local_ub;\r
+ uint64_t remote_lb;\r
+ uint64_t remote_ub;\r
+ ib_access_t access_ctrl;\r
+ net32_t lkey;\r
+ net32_t rkey;\r
+\r
+} ib_mr_attr_t;\r
+/*\r
+* DESCRIPTION\r
+* h_pd\r
+* Handle to the protection domain for this memory region.\r
+*\r
+* local_lb\r
+* The virtual address of the lower bound of protection for local\r
+* memory access. This is always a 64-bit quantity to support registering\r
+* more than 4GB of memory on 32-bit systems with PAE.\r
+*\r
+* local_ub\r
+* The virtual address of the upper bound of protection for local\r
+* memory access. This is always a 64-bit quantity to support registering\r
+* more than 4GB of memory on 32-bit systems with PAE.\r
+*\r
+* remote_lb\r
+* The virtual address of the lower bound of protection for remote\r
+* memory access. This is always a 64-bit quantity to support registering\r
+* more than 4GB of memory on 32-bit systems with PAE.\r
+*\r
+* remote_ub\r
+* The virtual address of the upper bound of protection for remote\r
+* memory access. This is always a 64-bit quantity to support registering\r
+* more than 4GB of memory on 32-bit systems with PAE.\r
+*\r
+* access_ctrl\r
+* Access rights for the specified memory region.\r
+*\r
+* lkey\r
+* The lkey associated with this memory region.\r
+*\r
+* rkey\r
+* The rkey associated with this memory region.\r
+*\r
+* NOTES\r
+* The remote_lb, remote_ub, and rkey are only valid if remote memory access\r
+* is enabled for this memory region.\r
+*\r
+* SEE ALSO\r
+* ib_access_t\r
+*****/\r
+\r
+/****d* Access Layer/ib_ca_mod_t\r
+* NAME\r
+* ib_ca_mod_t -- Modify port attributes and error counters\r
+*\r
+* DESCRIPTION\r
+* Specifies modifications to the port attributes of a channel adapter.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef uint32_t ib_ca_mod_t;\r
+#define IB_CA_MOD_IS_CM_SUPPORTED 0x00000001\r
+#define IB_CA_MOD_IS_SNMP_SUPPORTED 0x00000002\r
+#define IB_CA_MOD_IS_DEV_MGMT_SUPPORTED 0x00000004\r
+#define IB_CA_MOD_IS_VEND_SUPPORTED 0x00000008\r
+#define IB_CA_MOD_IS_SM 0x00000010\r
+#define IB_CA_MOD_IS_SM_DISABLED 0x00000020\r
+#define IB_CA_MOD_QKEY_CTR 0x00000040\r
+#define IB_CA_MOD_PKEY_CTR 0x00000080\r
+#define IB_CA_MOD_IS_NOTICE_SUPPORTED 0x00000100\r
+#define IB_CA_MOD_IS_TRAP_SUPPORTED 0x00000200\r
+#define IB_CA_MOD_IS_APM_SUPPORTED 0x00000400\r
+#define IB_CA_MOD_IS_SLMAP_SUPPORTED 0x00000800\r
+#define IB_CA_MOD_IS_PKEY_NVRAM_SUPPORTED 0x00001000\r
+#define IB_CA_MOD_IS_MKEY_NVRAM_SUPPORTED 0x00002000\r
+#define IB_CA_MOD_IS_SYSGUID_SUPPORTED 0x00004000\r
+#define IB_CA_MOD_IS_DR_NOTICE_SUPPORTED 0x00008000\r
+#define IB_CA_MOD_IS_BOOT_MGMT_SUPPORTED 0x00010000\r
+#define IB_CA_MOD_IS_CAPM_NOTICE_SUPPORTED 0x00020000\r
+#define IB_CA_MOD_IS_REINIT_SUPORTED 0x00040000\r
+#define IB_CA_MOD_IS_LEDINFO_SUPPORTED 0x00080000\r
+#define IB_CA_MOD_SHUTDOWN_PORT 0x00100000\r
+#define IB_CA_MOD_INIT_TYPE_VALUE 0x00200000\r
+#define IB_CA_MOD_SYSTEM_IMAGE_GUID 0x00400000\r
+#define IB_CA_MOD_IS_CLIENT_REREGISTER_SUPPORTED 0x00800000\r
+#define IB_CA_MOD_RESERVED_MASK 0xFF000000\r
+/*\r
+* VALUES\r
+* IB_CA_MOD_IS_CM_SUPPORTED\r
+* Indicates if there is a communication manager accessible through\r
+* the port.\r
+*\r
+* IB_CA_MOD_IS_SNMP_SUPPORTED\r
+* Indicates if there is an SNMP agent accessible through the port.\r
+*\r
+* IB_CA_MOD_IS_DEV_MGMT_SUPPORTED\r
+* Indicates if there is a device management agent accessible\r
+* through the port.\r
+*\r
+* IB_CA_MOD_IS_VEND_SUPPORTED\r
+* Indicates if there is a vendor supported agent accessible\r
+* through the port.\r
+*\r
+* IB_CA_MOD_IS_SM\r
+* Indicates if there is a subnet manager accessible through\r
+* the port.\r
+*\r
+* IB_CA_MOD_IS_SM_DISABLED\r
+* Indicates if the port has been disabled for configuration by the\r
+* subnet manager.\r
+*\r
+* IB_CA_MOD_QKEY_CTR\r
+* Used to reset the qkey violation counter associated with the\r
+* port.\r
+*\r
+* IB_CA_MOD_PKEY_CTR\r
+* Used to reset the pkey violation counter associated with the\r
+* port.\r
+*\r
+* IB_CA_MOD_IS_NOTICE_SUPPORTED\r
+* Indicates that this CA supports ability to generate Notices for\r
+* Port State changes. (only applicable to switches)\r
+*\r
+* IB_CA_MOD_IS_TRAP_SUPPORTED\r
+* Indicates that this management port supports ability to generate\r
+* trap messages. (only applicable to switches)\r
+*\r
+* IB_CA_MOD_IS_APM_SUPPORTED\r
+* Indicates that this port is capable of performing Automatic\r
+* Path Migration.\r
+*\r
+* IB_CA_MOD_IS_SLMAP_SUPPORTED\r
+* Indicates this port supports SLMAP capability.\r
+*\r
+* IB_CA_MOD_IS_PKEY_NVRAM_SUPPORTED\r
+* Indicates that PKEY is supported in NVRAM\r
+*\r
+* IB_CA_MOD_IS_MKEY_NVRAM_SUPPORTED\r
+* Indicates that MKEY is supported in NVRAM\r
+*\r
+* IB_CA_MOD_IS_SYSGUID_SUPPORTED\r
+* Indicates System Image GUID support.\r
+*\r
+* IB_CA_MOD_IS_DR_NOTICE_SUPPORTED\r
+* Indicate support for generating Direct Routed Notices\r
+*\r
+* IB_CA_MOD_IS_BOOT_MGMT_SUPPORTED\r
+* Indicates support for Boot Management\r
+*\r
+* IB_CA_MOD_IS_CAPM_NOTICE_SUPPORTED\r
+* Indicates capability to generate notices for changes to CAPMASK\r
+*\r
+* IB_CA_MOD_IS_REINIT_SUPORTED\r
+* Indicates type of node init supported. Refer to Chapter 14 for\r
+* Initialization actions.\r
+*\r
+* IB_CA_MOD_IS_LEDINFO_SUPPORTED\r
+* Indicates support for LED info.\r
+*\r
+* IB_CA_MOD_SHUTDOWN_PORT\r
+* Used to modify the port active indicator.\r
+*\r
+* IB_CA_MOD_INIT_TYPE_VALUE\r
+* Used to modify the init_type value for the port.\r
+*\r
+* IB_CA_MOD_SYSTEM_IMAGE_GUID\r
+* Used to modify the system image GUID for the port.\r
+*\r
+* IB_CA_MOD_IS_CLIENT_REREGISTER_SUPPORTED\r
+* Used to modify the system image GUID for the port.\r
+*\r
+* IB_CA_MOD_RESERVED_MASK\r
+* Mask of all the reserved bits. If any of these bits are set\r
+* ib_modify_ca will return IB_INVALID_PARAMETER.\r
+*****/\r
+\r
+/****d* Access Layer/ib_mr_mod_t\r
+* NAME\r
+* ib_mr_mod_t\r
+*\r
+* DESCRIPTION\r
+* Mask used to specify which attributes of a registered memory region are\r
+* being modified.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef uint32_t ib_mr_mod_t;\r
+#define IB_MR_MOD_ADDR 0x00000001\r
+#define IB_MR_MOD_PD 0x00000002\r
+#define IB_MR_MOD_ACCESS 0x00000004\r
+/*\r
+* PARAMETERS\r
+* IB_MEM_MOD_ADDR\r
+* The address of the memory region is being modified.\r
+*\r
+* IB_MEM_MOD_PD\r
+* The protection domain associated with the memory region is being\r
+* modified.\r
+*\r
+* IB_MEM_MOD_ACCESS\r
+* The access rights the memory region are being modified.\r
+*****/\r
+\r
+/****d* IBA Base: Constants/IB_SMINFO_STATE_INIT\r
+* NAME\r
+* IB_SMINFO_STATE_INIT\r
+*\r
+* DESCRIPTION\r
+* Encoded state value used in the SMInfo attribute.\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_SMINFO_STATE_INIT 4\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_SMINFO_ATTR_MOD_HANDOVER\r
+* NAME\r
+* IB_SMINFO_ATTR_MOD_HANDOVER\r
+*\r
+* DESCRIPTION\r
+* Encoded attribute modifier value used on SubnSet(SMInfo) SMPs.\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_SMINFO_ATTR_MOD_HANDOVER (CL_NTOH32(0x000001))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_SMINFO_ATTR_MOD_ACKNOWLEDGE\r
+* NAME\r
+* IB_SMINFO_ATTR_MOD_ACKNOWLEDGE\r
+*\r
+* DESCRIPTION\r
+* Encoded attribute modifier value used on SubnSet(SMInfo) SMPs.\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_SMINFO_ATTR_MOD_ACKNOWLEDGE (CL_NTOH32(0x000002))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_SMINFO_ATTR_MOD_DISABLE\r
+* NAME\r
+* IB_SMINFO_ATTR_MOD_DISABLE\r
+*\r
+* DESCRIPTION\r
+* Encoded attribute modifier value used on SubnSet(SMInfo) SMPs.\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_SMINFO_ATTR_MOD_DISABLE (CL_NTOH32(0x000003))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_SMINFO_ATTR_MOD_STANDBY\r
+* NAME\r
+* IB_SMINFO_ATTR_MOD_STANDBY\r
+*\r
+* DESCRIPTION\r
+* Encoded attribute modifier value used on SubnSet(SMInfo) SMPs.\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_SMINFO_ATTR_MOD_STANDBY (CL_NTOH32(0x000004))\r
+/**********/\r
+\r
+/****d* IBA Base: Constants/IB_SMINFO_ATTR_MOD_DISCOVER\r
+* NAME\r
+* IB_SMINFO_ATTR_MOD_DISCOVER\r
+*\r
+* DESCRIPTION\r
+* Encoded attribute modifier value used on SubnSet(SMInfo) SMPs.\r
+*\r
+* SOURCE\r
+*/\r
+#define IB_SMINFO_ATTR_MOD_DISCOVER (CL_NTOH32(0x000005))\r
+/**********/\r
+\r
+/****s* Access Layer/ib_ci_op_t\r
+* NAME\r
+* ib_ci_op_t\r
+*\r
+* DESCRIPTION\r
+* A structure used for vendor specific CA interface communication.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_ci_op\r
+{\r
+ IN uint32_t command;\r
+ IN uint32_t buf_size;\r
+ IN uint32_t buf_info;\r
+ IN OUT int32_t status;\r
+ OUT uint32_t num_bytes_ret;\r
+ IN OUT void* __ptr64 p_buf OPTIONAL;\r
+\r
+} ib_ci_op_t;\r
+/*\r
+* FIELDS\r
+* command\r
+* A command code that is understood by the verbs provider.\r
+*\r
+* status\r
+* The completion status from the verbs provider. This field should be\r
+* initialize to indicate an error to allow detection and cleanup in\r
+* case a communication error occurs between user-mode and kernel-mode.\r
+*\r
+* buf_size\r
+* The size of the buffer in bytes.\r
+*\r
+* buf_info\r
+* Additional buffer information\r
+*\r
+* p_buf\r
+* A reference to a buffer containing vendor specific data. The verbs\r
+* provider must not access pointers in the p_buf between user-mode and\r
+* kernel-mode. Any pointers embedded in the p_buf are invalidated by\r
+* the user-mode/kernel-mode transition.\r
+*\r
+* num_bytes_ret\r
+* The size in bytes of the vendor specific data returned in the buffer.\r
+* This field is set by the verbs provider. The verbs provider should\r
+* verify that the buffer size is sufficient to hold the data being\r
+* returned.\r
+*\r
+* NOTES\r
+* This structure is provided to allow the exchange of vendor specific\r
+* data between the originator and the verbs provider. Users of this\r
+* structure are expected to know the format of data in the p_buf based\r
+* on the structure command field or the usage context.\r
+*****/\r
+\r
+\r
+#define IB_REQ_CM_RDMA_SID_PREFIX 0x0000000001000000\r
+#define IB_REQ_CM_RDMA_PDATA_SIZE 56\r
+#define IB_REQ_CM_RDMA_MAJOR_VERSION 0\r
+#define IB_REQ_CM_RDMA_MINOR_VERSION 0\r
+\r
+\r
+/****s* Access Layer/ib_cm_rep_t\r
+* NAME\r
+* ib_cm_rdma_req_t\r
+*\r
+* DESCRIPTION\r
+* Connection reply information used when establishing a connection.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_cm_rdma_req\r
+{\r
+ uint8_t maj_min_ver; /* min_ver: bits 0-3, maj_ver: bits 4-7 */\r
+ uint8_t ipv; /* resides in bits 4-7 */\r
+ net16_t src_port;\r
+ net32_t src_ip_addr[4];\r
+ net32_t dst_ip_addr[4];\r
+ uint8_t pdata[IB_REQ_CM_RDMA_PDATA_SIZE];\r
+\r
+} PACK_SUFFIX ib_cm_rdma_req_t;\r
+/*\r
+* FIELDS\r
+* maj_min_ver\r
+* Defines the major and minor versions of RDMA IP CM Service protocol, supported\r
+*\r
+* ipv\r
+* Defines IP protocol version (4 or 6).\r
+*\r
+* src_port\r
+* Defines the local IP protocol port number of the client.\r
+*\r
+* src_ip_addr\r
+* Contains the source IP address.\r
+*\r
+* dst_ip_addr\r
+* Contains the destination IP address.\r
+*\r
+* pdata\r
+* Contains Consumer Private Data.\r
+*\r
+*****/\r
+\r
+\r
+#ifdef __cplusplus\r
+} /* extern "C" */\r
+#endif /* __cplusplus */\r
+\r
+\r
+#endif /* __IB_TYPES_H__ */\r
+\r
+\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+\r
+\r
+#ifndef _CL_ATOMIC_OSD_H_\r
+#define _CL_ATOMIC_OSD_H_\r
+\r
+\r
+#include "complib/cl_types.h"\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif\r
+\r
+\r
+CL_INLINE int32_t\r
+cl_atomic_inc( \r
+ IN atomic32_t* const p_value )\r
+{\r
+ return( InterlockedIncrement( (LONG*)p_value ) );\r
+}\r
+\r
+\r
+CL_INLINE int32_t\r
+cl_atomic_dec( \r
+ IN atomic32_t* const p_value )\r
+{\r
+ return( InterlockedDecrement( (LONG*)p_value ) );\r
+}\r
+\r
+\r
+CL_INLINE int32_t\r
+cl_atomic_add(\r
+ IN atomic32_t* const p_value,\r
+ IN const int32_t increment )\r
+{\r
+ /* Return the incremented value. */\r
+ return( InterlockedExchangeAdd( (long*)p_value, increment ) + increment );\r
+}\r
+\r
+\r
+CL_INLINE int32_t\r
+cl_atomic_sub(\r
+ IN atomic32_t* const p_value,\r
+ IN const int32_t decrement )\r
+{\r
+ /* Return the decremented value. */\r
+ return( InterlockedExchangeAdd( (long*)p_value, -decrement ) - decrement );\r
+}\r
+\r
+\r
+CL_INLINE int32_t\r
+cl_atomic_xchg(\r
+ IN atomic32_t* const p_value,\r
+ IN const int32_t new_value )\r
+{\r
+ return( InterlockedExchange( (long*)p_value, new_value ) );\r
+}\r
+\r
+\r
+CL_INLINE int32_t\r
+cl_atomic_comp_xchg(\r
+ IN atomic32_t* const p_value,\r
+ IN const int32_t compare,\r
+ IN const int32_t new_value )\r
+{\r
+ return( InterlockedCompareExchange( (long*)p_value, new_value, compare ) );\r
+}\r
+\r
+\r
+#ifdef __cplusplus\r
+} // extern "C"\r
+#endif\r
+\r
+#endif // _CL_ATOMIC_OSD_H_\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+\r
+\r
+#ifndef _CL_BUS_IFC_H_\r
+#define _CL_BUS_IFC_H_\r
+\r
+\r
+#include <complib/cl_types.h>\r
+\r
+\r
+/****f* Component Library: Plug and Play/cl_fwd_query_ifc\r
+* NAME\r
+* cl_fwd_query_ifc\r
+*\r
+* DESCRIPTION\r
+* Forwards a IRP_MN_QUERY_INTERFACE request to the device stack\r
+* represented by the input device object.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT NTSTATUS\r
+cl_fwd_query_ifc(\r
+ IN DEVICE_OBJECT* const p_dev_obj,\r
+ IN IO_STACK_LOCATION* const p_io_stack );\r
+/*\r
+* PARAMETERS\r
+* p_dev_obj\r
+* Pointer to the device object that is the IRP target.\r
+*\r
+* p_io_stack\r
+* Pointer to the original IRP's I/O stack location, used to format\r
+* the forwarded IRP.\r
+*\r
+* RETURN VALUES\r
+* IRP status value.\r
+*\r
+* NOTES\r
+* The IRP forwarded is synchronous, so this call must be invoked at PASSIVE.\r
+*\r
+* SEE ALSO\r
+* Plug and Play\r
+*********/\r
+\r
+#endif /* _CL_BUS_IFC_H_ */
\ No newline at end of file
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+\r
+#ifndef _CL_BYTESWAP_OSD_H_\r
+#define _CL_BYTESWAP_OSD_H_\r
+\r
+\r
+#include "complib/cl_types.h"\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif\r
+\r
+#define CPU_LE 1\r
+#define CPU_BE 0\r
+\r
+#define cl_ntoh16 _byteswap_ushort\r
+#define cl_hton16 _byteswap_ushort\r
+\r
+#define cl_ntoh32 _byteswap_ulong\r
+#define cl_hton32 _byteswap_ulong\r
+\r
+#define cl_ntoh64 _byteswap_uint64\r
+#define cl_hton64 _byteswap_uint64\r
+\r
+#ifdef __cplusplus\r
+} // extern "C"\r
+#endif\r
+\r
+#endif // _CL_BYTESWAP_OSD_H_\r
+\r
+\r
+\r
+\r
+\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+\r
+\r
+#ifndef _CL_DEBUG_OSD_H_\r
+#define _CL_DEBUG_OSD_H_\r
+\r
+\r
+#include "complib/cl_types.h"\r
+\r
+\r
+#if !defined(__MODULE__)\r
+#define __MODULE__ ""\r
+#define __MOD_DELIMITER__ ""\r
+#else /* !defined(__MODULE__) */\r
+#define __MOD_DELIMITER__ ":"\r
+#endif /* !defined(__MODULE__) */\r
+\r
+\r
+#if defined( _WIN64 )\r
+#define PRIdSIZE_T "I64d"\r
+#else\r
+#define PRIdSIZE_T "d"\r
+#endif\r
+#define PRId64 "I64d"\r
+#define PRIx64 "I64x"\r
+#define PRIo64 "I64o"\r
+#define PRIu64 "I64u"\r
+\r
+\r
+#if defined( _DEBUG_ )\r
+#define cl_dbg_out DbgPrint\r
+#else\r
+#define cl_dbg_out __noop\r
+#endif /* defined( _DEBUG_ ) */\r
+\r
+#define cl_msg_out DbgPrint\r
+\r
+\r
+/*\r
+ * The following macros are used internally by the CL_ENTER, CL_TRACE, \r
+ * CL_TRACE_EXIT, and CL_EXIT macros.\r
+ */\r
+#if defined( _WDMDDK_ )\r
+/* wdm.h does not provide for a way to get the current processor number. */\r
+#define _CL_DBG_ENTER \\r
+ ("%s%s%s() [\n", __MODULE__, __MOD_DELIMITER__, __FUNCTION__)\r
+\r
+#define _CL_DBG_EXIT \\r
+ ("%s%s%s() ]\n", __MODULE__, __MOD_DELIMITER__, __FUNCTION__)\r
+\r
+#define _CL_DBG_INFO \\r
+ ("%s%s%s(): ", __MODULE__, __MOD_DELIMITER__, __FUNCTION__)\r
+\r
+#define _CL_DBG_ERROR \\r
+ ("%s%s%s() !ERROR!: ", __MODULE__, __MOD_DELIMITER__, __FUNCTION__)\r
+\r
+#else // !defined( _WDMDDK_ )\r
+\r
+#define _CL_DBG_ENTER \\r
+ ("~%d:(%x)%s%s%s() [\n", KeGetCurrentProcessorNumber(), PsGetCurrentThread(), __MODULE__, \\r
+ __MOD_DELIMITER__, __FUNCTION__)\r
+\r
+#define _CL_DBG_EXIT \\r
+ ("~%d:%s%s%s() ]\n", KeGetCurrentProcessorNumber(), __MODULE__, \\r
+ __MOD_DELIMITER__, __FUNCTION__)\r
+\r
+#define _CL_DBG_INFO \\r
+ ("~%d:%s%s%s(): ", KeGetCurrentProcessorNumber(), __MODULE__, \\r
+ __MOD_DELIMITER__, __FUNCTION__)\r
+\r
+#define _CL_DBG_ERROR \\r
+ ("~%d:%s%s%s() !ERROR!: ", KeGetCurrentProcessorNumber(), __MODULE__, \\r
+ __MOD_DELIMITER__, __FUNCTION__)\r
+\r
+#endif // !defined( _WDMDDK_ )\r
+\r
+#define CL_CHK_STK\r
+\r
+\r
+#endif /* _CL_DEBUG_OSD_H_ */\r
+\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+\r
+\r
+#ifndef _CL_EVENT_OSD_H_\r
+#define _CL_EVENT_OSD_H_\r
+\r
+\r
+#include "complib/cl_types.h"\r
+#include "complib/cl_memory.h"\r
+\r
+\r
+/* Simple definition, eh? */\r
+typedef KEVENT cl_event_t;\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif\r
+\r
+\r
+CL_INLINE void\r
+cl_event_construct( \r
+ IN cl_event_t* const p_event )\r
+{\r
+ CL_ASSERT( p_event );\r
+\r
+ cl_memclr( p_event, sizeof(cl_event_t) );\r
+}\r
+\r
+\r
+CL_INLINE cl_status_t\r
+cl_event_init( \r
+ IN cl_event_t* const p_event,\r
+ IN const boolean_t manual_reset )\r
+{\r
+ CL_ASSERT( p_event );\r
+\r
+ cl_event_construct( p_event );\r
+\r
+ if( manual_reset )\r
+ KeInitializeEvent( p_event, NotificationEvent, FALSE );\r
+ else\r
+ KeInitializeEvent( p_event, SynchronizationEvent, FALSE );\r
+\r
+ return( CL_SUCCESS );\r
+}\r
+\r
+\r
+CL_INLINE void\r
+cl_event_destroy( \r
+ IN cl_event_t* const p_event )\r
+{\r
+ UNUSED_PARAM( p_event );\r
+}\r
+\r
+\r
+CL_INLINE cl_status_t\r
+cl_event_signal( \r
+ IN cl_event_t* const p_event )\r
+{\r
+ CL_ASSERT( p_event );\r
+ CL_ASSERT( KeGetCurrentIrql() <= DISPATCH_LEVEL );\r
+\r
+ KeSetEvent( p_event, 0, FALSE );\r
+\r
+ return( CL_SUCCESS );\r
+}\r
+\r
+\r
+CL_INLINE cl_status_t\r
+cl_event_reset( \r
+ IN cl_event_t* const p_event )\r
+{\r
+ CL_ASSERT( p_event );\r
+ CL_ASSERT( KeGetCurrentIrql() <= DISPATCH_LEVEL );\r
+\r
+ KeClearEvent( p_event );\r
+\r
+ return( CL_SUCCESS );\r
+}\r
+\r
+\r
+#ifdef __cplusplus\r
+} // extern "C"\r
+#endif\r
+\r
+#endif // _CL_EVENT_OSD_H_
\ No newline at end of file
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+#ifndef _CL_INIT_H_\r
+#define _CL_INIT_H_\r
+\r
+\r
+#include <complib/cl_memory.h>\r
+#include <complib/cl_obj.h>\r
+\r
+\r
+#ifdef CL_TRACK_MEM\r
+#ifdef NEED_CL_OBJ\r
+#define CL_INIT (__cl_mem_track( TRUE ), cl_obj_mgr_create())\r
+#define CL_DEINIT (cl_obj_mgr_destroy(), __cl_mem_track( FALSE ))\r
+#else /* NEED_CL_OBJ */\r
+#define CL_INIT (__cl_mem_track( TRUE ), STATUS_SUCCESS)\r
+#define CL_DEINIT (__cl_mem_track( FALSE ))\r
+#endif /* NEED_CL_OBJ */\r
+#else /* CL_TRACK_MEM */\r
+#ifdef NEED_CL_OBJ\r
+#define CL_INIT cl_obj_mgr_create()\r
+#define CL_DEINIT cl_obj_mgr_destroy()\r
+#else /* NEED_CL_OBJ */\r
+#define CL_INIT STATUS_SUCCESS\r
+#define CL_DEINIT\r
+#endif /* NEED_CL_OBJ */\r
+#endif /* CL_TRACK_MEM */\r
+\r
+#endif // _CL_INIT_H_\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+/*\r
+ * Abstract:\r
+ * Declaration of IOCTL object\r
+ *\r
+ * Environment:\r
+ * Windows Kernel Mode\r
+ */\r
+\r
+\r
+#ifndef _CL_IOCTL_OSD_H_\r
+#define _CL_IOCTL_OSD_H_\r
+\r
+\r
+#include <complib/cl_types.h>\r
+\r
+\r
+#define IOCTL_CODE( type, cmd ) \\r
+ CTL_CODE( type, (cmd & 0x0FFF), METHOD_BUFFERED, FILE_ANY_ACCESS)\r
+\r
+\r
+typedef PIRP cl_ioctl_handle_t;\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif /* __cplusplus */\r
+\r
+\r
+CL_INLINE cl_status_t\r
+cl_ioctl_process(\r
+ IN void *p_ioctl,\r
+ IN cl_status_t (pfn_ioctl_handler( cl_ioctl_handle_t, void*, void* ) ),\r
+ IN void *context_1,\r
+ IN void *context_2 )\r
+{\r
+ return pfn_ioctl_handler( ((PIRP)p_ioctl), context_1, context_2 );\r
+}\r
+\r
+\r
+CL_INLINE uint16_t\r
+cl_ioctl_type(\r
+ IN cl_ioctl_handle_t h_ioctl )\r
+{\r
+ IO_STACK_LOCATION *p_io_stack;\r
+\r
+ p_io_stack = IoGetCurrentIrpStackLocation( h_ioctl );\r
+ return (uint16_t)DEVICE_TYPE_FROM_CTL_CODE(\r
+ p_io_stack->Parameters.DeviceIoControl.IoControlCode );\r
+}\r
+\r
+\r
+CL_INLINE uint16_t\r
+cl_ioctl_cmd(\r
+ IN cl_ioctl_handle_t h_ioctl )\r
+{\r
+ IO_STACK_LOCATION *p_io_stack;\r
+\r
+ p_io_stack = IoGetCurrentIrpStackLocation( h_ioctl );\r
+ return (uint16_t)\r
+ ((p_io_stack->Parameters.DeviceIoControl.IoControlCode >> 2) & 0x0FFF);\r
+}\r
+\r
+\r
+CL_INLINE uint32_t\r
+cl_ioctl_ctl_code(\r
+ IN cl_ioctl_handle_t h_ioctl )\r
+{\r
+ IO_STACK_LOCATION *p_io_stack;\r
+\r
+ p_io_stack = IoGetCurrentIrpStackLocation( h_ioctl );\r
+ return p_io_stack->Parameters.DeviceIoControl.IoControlCode;\r
+}\r
+\r
+\r
+CL_INLINE void*\r
+cl_ioctl_in_buf(\r
+ IN cl_ioctl_handle_t h_ioctl )\r
+{\r
+ IO_STACK_LOCATION *p_io_stack;\r
+\r
+ p_io_stack = IoGetCurrentIrpStackLocation( h_ioctl );\r
+ switch( p_io_stack->Parameters.DeviceIoControl.IoControlCode & 0x03 )\r
+ {\r
+ case METHOD_BUFFERED:\r
+ case METHOD_OUT_DIRECT:\r
+ return (h_ioctl)->AssociatedIrp.SystemBuffer;\r
+\r
+ case METHOD_IN_DIRECT:\r
+ return (h_ioctl)->MdlAddress;\r
+\r
+ case METHOD_NEITHER:\r
+ return p_io_stack->Parameters.DeviceIoControl.Type3InputBuffer;\r
+ }\r
+ return NULL;\r
+}\r
+\r
+\r
+CL_INLINE ULONG\r
+cl_ioctl_in_size(\r
+ IN cl_ioctl_handle_t h_ioctl )\r
+{\r
+ IO_STACK_LOCATION *p_io_stack;\r
+\r
+ p_io_stack = IoGetCurrentIrpStackLocation( h_ioctl );\r
+ switch( p_io_stack->Parameters.DeviceIoControl.IoControlCode & 0x03 )\r
+ {\r
+ case METHOD_BUFFERED:\r
+ case METHOD_OUT_DIRECT:\r
+ case METHOD_NEITHER:\r
+ return p_io_stack->Parameters.DeviceIoControl.InputBufferLength;\r
+\r
+ case METHOD_IN_DIRECT:\r
+ return p_io_stack->Parameters.DeviceIoControl.OutputBufferLength;\r
+ }\r
+ return 0;\r
+}\r
+\r
+\r
+CL_INLINE void*\r
+cl_ioctl_out_buf(\r
+ IN cl_ioctl_handle_t h_ioctl )\r
+{\r
+ IO_STACK_LOCATION *p_io_stack;\r
+\r
+ p_io_stack = IoGetCurrentIrpStackLocation( h_ioctl );\r
+ switch( p_io_stack->Parameters.DeviceIoControl.IoControlCode & 0x03 )\r
+ {\r
+ case METHOD_BUFFERED:\r
+ return (h_ioctl)->AssociatedIrp.SystemBuffer;\r
+\r
+ case METHOD_IN_DIRECT:\r
+ case METHOD_OUT_DIRECT:\r
+ return (h_ioctl)->MdlAddress;\r
+\r
+ case METHOD_NEITHER:\r
+ return (h_ioctl)->UserBuffer;\r
+ }\r
+ return NULL;\r
+}\r
+\r
+\r
+CL_INLINE ULONG\r
+cl_ioctl_out_size(\r
+ IN cl_ioctl_handle_t h_ioctl )\r
+{\r
+ IO_STACK_LOCATION *p_io_stack;\r
+\r
+ p_io_stack = IoGetCurrentIrpStackLocation( h_ioctl );\r
+ return p_io_stack->Parameters.DeviceIoControl.OutputBufferLength;\r
+}\r
+\r
+\r
+CL_INLINE void\r
+cl_ioctl_complete(\r
+ IN cl_ioctl_handle_t h_ioctl,\r
+ IN cl_status_t io_status,\r
+ IN size_t ret_bytes )\r
+{\r
+ h_ioctl->IoStatus.Status = cl_to_ntstatus( io_status );\r
+ h_ioctl->IoStatus.Information = ret_bytes;\r
+ IoCompleteRequest( h_ioctl, IO_NO_INCREMENT );\r
+}\r
+\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif /* __cplusplus */\r
+\r
+\r
+#endif // _CL_IOCTL_OSD_H_\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+/*\r
+ * Abstract:\r
+ * Implementation of IRQ lock object.\r
+ *\r
+ * Environment:\r
+ * Windows Kernel Mode\r
+ */\r
+\r
+\r
+#ifndef _CL_IRQLOCK_OSD_H_\r
+#define _CL_IRQLOCK_OSD_H_\r
+\r
+\r
+#include <complib/cl_spinlock.h>\r
+\r
+\r
+typedef struct _cl_irqlock\r
+{\r
+ PKINTERRUPT p_interrupt;\r
+ KIRQL irql;\r
+\r
+} cl_irqlock_t;\r
+\r
+\r
+typedef struct _KINTERRUPT cl_interrupt_t;\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif\r
+\r
+\r
+CL_INLINE void\r
+cl_irqlock_construct( \r
+ IN cl_irqlock_t* const p_irqlock )\r
+{\r
+ p_irqlock->p_interrupt = NULL;\r
+}\r
+\r
+\r
+CL_INLINE cl_status_t\r
+cl_irqlock_init( \r
+ IN cl_irqlock_t* const p_irqlock,\r
+ IN cl_interrupt_t* const p_interrupt )\r
+{\r
+ cl_irqlock_construct( p_irqlock );\r
+ p_irqlock->p_interrupt = p_interrupt;\r
+ return CL_SUCCESS;\r
+}\r
+\r
+\r
+CL_INLINE void\r
+cl_irqlock_destroy( \r
+ IN cl_irqlock_t* const p_irqlock )\r
+{\r
+ p_irqlock->p_interrupt = NULL;\r
+}\r
+\r
+\r
+CL_INLINE void\r
+cl_irqlock_acquire( \r
+ IN cl_irqlock_t* const p_irqlock )\r
+{\r
+#if WINVER > 0x500\r
+ p_irqlock->irql = KeAcquireInterruptSpinLock( p_irqlock->p_interrupt );\r
+#else\r
+ UNUSED_PARAM( p_irqlock );\r
+#pragma warning( push, 3 )\r
+ ASSERT( 0 );\r
+#pragma warning( pop )\r
+#endif\r
+}\r
+\r
+\r
+CL_INLINE void\r
+cl_irqlock_release(\r
+ IN cl_irqlock_t* const p_irqlock )\r
+{\r
+#if WINVER > 0x500\r
+ KeReleaseInterruptSpinLock( p_irqlock->p_interrupt, p_irqlock->irql );\r
+#else\r
+ UNUSED_PARAM( p_irqlock );\r
+#pragma warning( push, 3 )\r
+ ASSERT( 0 );\r
+#pragma warning( pop )\r
+#endif\r
+}\r
+\r
+\r
+#ifdef __cplusplus\r
+} /* extern "C" */\r
+#endif\r
+\r
+\r
+#endif /* _CL_IRQLOCK_OSD_H_ */\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+/*\r
+ * Abstract:\r
+ * Defines kernel-only memory related functions.\r
+ *\r
+ * Environment:\r
+ * Windows Kernel Mode\r
+ */\r
+\r
+\r
+#ifndef _CL_MEMORY_OSD_H_\r
+#define _CL_MEMORY_OSD_H_\r
+\r
+\r
+#include <complib/cl_types.h>\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif\r
+\r
+ \r
+CL_INLINE void\r
+cl_memset( \r
+ IN void* const p_memory, \r
+ IN const uint8_t fill, \r
+ IN const size_t count )\r
+{\r
+ RtlFillMemory( p_memory, count, fill );\r
+}\r
+\r
+\r
+CL_INLINE void*\r
+cl_memcpy( \r
+ IN void* const p_dest, \r
+ IN const void* const p_src, \r
+ IN const size_t count )\r
+{\r
+ RtlCopyMemory( p_dest, p_src, count );\r
+ return p_dest;\r
+}\r
+\r
+\r
+CL_INLINE int32_t\r
+cl_memcmp( \r
+ IN const void* const p_memory1,\r
+ IN const void* const p_memory2, \r
+ IN const size_t count )\r
+{\r
+ return( memcmp( p_memory1, p_memory2, count ) );\r
+}\r
+\r
+\r
+CL_INLINE uint32_t\r
+cl_get_pagesize( void )\r
+{\r
+ return (PAGE_SIZE);\r
+}\r
+\r
+\r
+#ifdef CL_NTDDK\r
+CL_INLINE uint64_t\r
+cl_get_physaddr(\r
+ IN void *vaddr )\r
+{\r
+ return MmGetPhysicalAddress( vaddr ).QuadPart;\r
+}\r
+#endif\r
+\r
+\r
+CL_INLINE cl_status_t\r
+cl_check_for_read(\r
+ IN const void* const vaddr,\r
+ IN const size_t count )\r
+{\r
+ __try\r
+ {\r
+ ProbeForRead( ( void *)vaddr, count, sizeof(void*) );\r
+ }\r
+ __except(EXCEPTION_EXECUTE_HANDLER)\r
+ {\r
+ return CL_INVALID_PERMISSION;\r
+ }\r
+ return CL_SUCCESS;\r
+}\r
+\r
+\r
+CL_INLINE cl_status_t\r
+cl_check_for_write(\r
+ IN void* const vaddr,\r
+ IN const size_t count )\r
+{\r
+ __try\r
+ {\r
+ /*\r
+ * We use ProbeForRead instead of ProbeForWrite because\r
+ * the additional checks to make sure the pages can be written\r
+ * are not guaranteed to still hold by the time we copy into\r
+ * the buffer.\r
+ *\r
+ * Furthermore, even if the pages don't change, ProbeForWrite will\r
+ * cause all pages to be paged in, and these pages could be paged out\r
+ * before the copy, requiring the copy to page them in once again.\r
+ *\r
+ * Micky Snir (mailto:mickys@microsoft.com) recommended *not* using\r
+ * ProbeForWrite because the page validity/permissions can change after\r
+ * the call and the actual access.\r
+ */\r
+ ProbeForRead( vaddr, count, sizeof(void*) );\r
+ }\r
+ __except(EXCEPTION_EXECUTE_HANDLER)\r
+ {\r
+ return CL_INVALID_PERMISSION;\r
+ }\r
+ return CL_SUCCESS;\r
+}\r
+\r
+\r
+CL_INLINE cl_status_t\r
+cl_copy_to_user(\r
+ IN void* const p_dest,\r
+ IN const void* const p_src,\r
+ IN const size_t count )\r
+{\r
+ /*\r
+ * The memory copy must be done within a try/except block as the\r
+ * memory could be changing while the buffer is copied.\r
+ */\r
+ __try\r
+ {\r
+ /*\r
+ * We use ProbeForRead instead of ProbeForWrite because\r
+ * the additional checks to make sure the pages can be written\r
+ * are not guaranteed to still hold by the time we copy into\r
+ * the buffer.\r
+ *\r
+ * Furthermore, even if the pages don't change, ProbeForWrite will\r
+ * cause all pages to be paged in, and these pages could be paged out\r
+ * before the copy, requiring the copy to page them in once again.\r
+ *\r
+ * Micky Snir (mailto:mickys@microsoft.com) recommended *not* using\r
+ * ProbeForWrite because the page validity/permissions can change after\r
+ * the call and the actual access.\r
+ */\r
+ ProbeForRead( p_dest, count, 1 );\r
+ cl_memcpy( p_dest, p_src, count );\r
+ return CL_SUCCESS;\r
+ }\r
+ __except(EXCEPTION_EXECUTE_HANDLER)\r
+ {\r
+ return CL_INVALID_PERMISSION;\r
+ }\r
+}\r
+\r
+\r
+CL_INLINE cl_status_t\r
+cl_copy_from_user(\r
+ IN void* const p_dest,\r
+ IN const void* const p_src,\r
+ IN const size_t count )\r
+{\r
+ /*\r
+ * The memory copy must be done within a try/except block as the\r
+ * memory could be changing while the buffer is copied.\r
+ */\r
+ __try\r
+ {\r
+ ProbeForRead( (void*)p_src, count, 1 );\r
+ cl_memcpy( p_dest, p_src, count );\r
+ return CL_SUCCESS;\r
+ }\r
+ __except(EXCEPTION_EXECUTE_HANDLER)\r
+ {\r
+ return CL_INVALID_PERMISSION;\r
+ }\r
+}\r
+\r
+\r
+#ifdef __cplusplus\r
+} /* extern "C" */\r
+#endif\r
+\r
+#endif /* _CL_MEMORY_OSD_H_ */\r
+\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+/*\r
+ * Abstract:\r
+ * Declaration of mutex object.\r
+ *\r
+ * Environment:\r
+ * Windows Kernel Mode\r
+ */\r
+\r
+\r
+#ifndef _CL_MUTEX_OSD_H_\r
+#define _CL_MUTEX_OSD_H_\r
+\r
+\r
+#include <complib/cl_types.h>\r
+\r
+\r
+typedef FAST_MUTEX cl_mutex_t;\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif\r
+\r
+\r
+CL_INLINE void\r
+cl_mutex_construct(\r
+ IN cl_mutex_t* const p_mutex )\r
+{\r
+ UNUSED_PARAM( p_mutex );\r
+}\r
+\r
+\r
+CL_INLINE cl_status_t\r
+cl_mutex_init(\r
+ IN cl_mutex_t* const p_mutex )\r
+{\r
+ CL_ASSERT( KeGetCurrentIrql() <= DISPATCH_LEVEL );\r
+ ExInitializeFastMutex( p_mutex );\r
+ return CL_SUCCESS;\r
+}\r
+\r
+\r
+CL_INLINE void\r
+cl_mutex_destroy(\r
+ IN cl_mutex_t* const p_mutex )\r
+{\r
+ UNUSED_PARAM( p_mutex );\r
+}\r
+\r
+\r
+CL_INLINE void\r
+cl_mutex_acquire(\r
+ IN cl_mutex_t* const p_mutex )\r
+{\r
+ CL_ASSERT( KeGetCurrentIrql() < DISPATCH_LEVEL );\r
+ ExAcquireFastMutex( p_mutex );\r
+}\r
+\r
+\r
+CL_INLINE void\r
+cl_mutex_release(\r
+ IN cl_mutex_t* const p_mutex )\r
+{\r
+ CL_ASSERT( KeGetCurrentIrql() == APC_LEVEL );\r
+ ExReleaseFastMutex( p_mutex );\r
+}\r
+\r
+\r
+#ifdef __cplusplus\r
+} /* extern "C" */\r
+#endif\r
+\r
+#endif /* _CL_MUTEX_OSD_H_ */\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+\r
+\r
+/* Note: The lack of conditional inclusion is intentional. */\r
+#include <poppack.h>\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+\r
+\r
+/* Note: The lack of conditional inclusion is intentional. */\r
+#include <pshpack1.h>\r
+\r
+\r
+/*\r
+ * Abstract:\r
+ * Turns on byte packing, which is necessary for passing information from\r
+ * system to system over a network to ensure no padding by the compiler has \r
+ * taken place.\r
+ *\r
+ * Note:\r
+ * No Robodoc documentation as with other headers.\r
+ */\r
+\r
+#ifndef PACK_SUFFIX\r
+#define PACK_SUFFIX\r
+#endif \r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+\r
+\r
+#ifndef _CL_PNP_PO_H_\r
+#define _CL_PNP_PO_H_\r
+\r
+\r
+#include "complib/cl_types.h"\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif\r
+\r
+\r
+/****h* Component Library/Plug and Play\r
+* NAME\r
+* Plug and Play\r
+*\r
+* DESCRIPTION\r
+* Provides plug and play support for kernel drivers.\r
+*\r
+* SEE ALSO\r
+* Callback Types:\r
+* cl_pfn_pnp_po_t\r
+*\r
+* Structures:\r
+* cl_vfptr_pnp_t\r
+*********/\r
+\r
+\r
+#define CL_DBG_PNP (1 << 1)\r
+\r
+\r
+/****d* Component Library: Plug and Play/cl_irp_action_t\r
+* NAME\r
+* cl_irp_action_t\r
+*\r
+* DESCRIPTION\r
+* Indicates what kind of action to take in response to an IRP. Used\r
+* when processing PnP IRPs.\r
+*\r
+* SYNOPSIS:\r
+*/\r
+typedef enum _cl_irp_action\r
+{\r
+ IrpPassDown,\r
+ IrpSkip,\r
+ IrpIgnore,\r
+ IrpComplete,\r
+ IrpDoNothing\r
+\r
+} cl_irp_action_t;\r
+/*\r
+* VALUES:\r
+* IrpPassDown\r
+* Pass the IRP down to the next driver. The IRP's current stack location\r
+* has been setup properly.\r
+*\r
+* IrpSkip\r
+* Skip the current IRP stack location but sets the IRP's status.\r
+*\r
+* IrpIgnore\r
+* Skip the current IRP without setting its status value since the IRP \r
+* is not interesting.\r
+*\r
+* IrpComplete\r
+* Complete the IRP. Sets the status in the IoStatus block, completes the\r
+* IRP, and returns the status.\r
+*\r
+* IrpDoNothing\r
+* The routine assumed control of the IRP completion. No further \r
+* processing is required in the dispatch routine. The remove lock should\r
+* not be released.\r
+*********/\r
+\r
+\r
+/****d* Component Library: Plug and Play/cl_pfn_pnp_po_t\r
+* NAME\r
+* cl_pfn_pnp_po_t\r
+*\r
+* DESCRIPTION\r
+* Function prototype for PnP and Power Management IRPs handlers.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef NTSTATUS\r
+(*cl_pfn_pnp_po_t)(\r
+ IN DEVICE_OBJECT* const p_dev_obj,\r
+ IN IRP* const p_irp, \r
+ OUT cl_irp_action_t* const p_action );\r
+/*\r
+* PARAMETERS\r
+* p_dev_obj\r
+* Pointer to the device object that is the IRP target.\r
+*\r
+* p_irp\r
+* Pointer to the request IRP.\r
+*\r
+* p_action\r
+* Action to take for propagating the IRP.\r
+*\r
+* RETURN VALUES\r
+* IRP status value.\r
+*\r
+* SEE ALSO\r
+* Plug and Play, cl_irp_action_t, cl_vfptr_pnp_po_t\r
+*********/\r
+\r
+\r
+/****d* Component Library: Plug and Play/cl_pfn_release_resources_t\r
+* NAME\r
+* cl_pfn_release_resources_t\r
+*\r
+* DESCRIPTION\r
+* Function prototype for releasing resources associated with a device.\r
+* Called from either the remove handler or the surprise remove handler.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef void\r
+(*cl_pfn_release_resources_t)(\r
+ IN DEVICE_OBJECT* const p_dev_obj );\r
+/*\r
+* PARAMETERS\r
+* p_dev_obj\r
+* Pointer to the device object whose resources to release.\r
+*\r
+* RETURN VALUES\r
+* This function does not return a value.\r
+*\r
+* SEE ALSO\r
+* Plug and Play, cl_vfptr_pnp_po_t\r
+*********/\r
+\r
+\r
+/****d* Component Library: Plug and Play/cl_vfptr_pnp_po_t\r
+* NAME\r
+* cl_vfptr_pnp_po_t\r
+*\r
+* DESCRIPTION\r
+* Virtual function pointer table for PnP and Power Management IRPs.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _cl_vfptr_pnp_po\r
+{\r
+ const char* identity;\r
+ cl_pfn_pnp_po_t pfn_start;\r
+ cl_pfn_pnp_po_t pfn_query_stop;\r
+ cl_pfn_pnp_po_t pfn_stop;\r
+ cl_pfn_pnp_po_t pfn_cancel_stop;\r
+ cl_pfn_pnp_po_t pfn_query_remove;\r
+ cl_pfn_release_resources_t pfn_release_resources;\r
+ cl_pfn_pnp_po_t pfn_remove;\r
+ cl_pfn_pnp_po_t pfn_cancel_remove;\r
+ cl_pfn_pnp_po_t pfn_surprise_remove;\r
+ cl_pfn_pnp_po_t pfn_query_capabilities;\r
+ cl_pfn_pnp_po_t pfn_query_pnp_state;\r
+ cl_pfn_pnp_po_t pfn_filter_res_req;\r
+ cl_pfn_pnp_po_t pfn_dev_usage_notification;\r
+ cl_pfn_pnp_po_t pfn_query_bus_relations;\r
+ cl_pfn_pnp_po_t pfn_query_ejection_relations;\r
+ cl_pfn_pnp_po_t pfn_query_removal_relations;\r
+ cl_pfn_pnp_po_t pfn_query_target_relations;\r
+ cl_pfn_pnp_po_t pfn_unknown;\r
+ cl_pfn_pnp_po_t pfn_query_resources;\r
+ cl_pfn_pnp_po_t pfn_query_res_req;\r
+ cl_pfn_pnp_po_t pfn_query_bus_info;\r
+ cl_pfn_pnp_po_t pfn_query_interface;\r
+ cl_pfn_pnp_po_t pfn_read_config;\r
+ cl_pfn_pnp_po_t pfn_write_config;\r
+ cl_pfn_pnp_po_t pfn_eject;\r
+ cl_pfn_pnp_po_t pfn_set_lock;\r
+ cl_pfn_pnp_po_t pfn_query_power;\r
+ cl_pfn_pnp_po_t pfn_set_power;\r
+ cl_pfn_pnp_po_t pfn_power_sequence;\r
+ cl_pfn_pnp_po_t pfn_wait_wake;\r
+\r
+} cl_vfptr_pnp_po_t;\r
+/*\r
+* FIELDS\r
+* identity\r
+* string identifying the target, used in generating debug output.\r
+*\r
+* pfn_start\r
+* IRP_MN_START_DEVICE handler. Users must send forward the IRP to lower\r
+* devices as required for their driver type.\r
+*\r
+* pfn_query_stop\r
+* IRP_MN_QUERY_STOP_DEVICE handler.\r
+*\r
+* pfn_stop\r
+* IRP_MN_STOP_DEVICE handler.\r
+*\r
+* pfn_cancel_stop\r
+* IRP_MN_CANCEL_STOP_DEVICE handler. Users must send forward the IRP to \r
+* lower devices as required for their driver type.\r
+*\r
+* pfn_query_remove\r
+* IRP_MN_QUERY_REMOVE_DEVICE handler.\r
+*\r
+* pfn_release_resources\r
+* Called to release resources allocated for the device.\r
+*\r
+* pfn_remove\r
+* IRP_MN_REMOVE_DEVICE handler.\r
+*\r
+* pfn_cancel_remove\r
+* IRP_MN_CANCEL_REMOVE_DEVICE handler. Users must send forward the IRP\r
+* to lower devices as required for their driver type.\r
+*\r
+* pfn_surprise_remove\r
+* IRP_MN_SURPRISE_REMOVE_DEVICE handler.\r
+*\r
+* pfn_query_capabilities\r
+* IRP_MN_QUERY_DEVICE_CAPABILITIES handler.\r
+*\r
+* pfn_query_pnp_state\r
+* IRP_MN_QUERY_PNP_STATE handler.\r
+*\r
+* pfn_filter_res_req\r
+* IRP_MN_FILTER_RESOURCE_REQUIREMENTS handler.\r
+*\r
+* pfn_dev_usage_notification\r
+* IRP_MN_QUERY_DEVICE_USAGE_NOTIFICATION handler.\r
+*\r
+* pfn_query_bus_relations\r
+* IRP_MN_QUERY_BUS_RELATIONS handler.\r
+*\r
+* pfn_query_ejection_relations\r
+* IRP_MN_QUERY_EJECTION_RELATIONS handler.\r
+*\r
+* pfn_query_removal_relations\r
+* IRP_MN_QUERY_REMOVAL_RELATIONS handler.\r
+*\r
+* pfn_query_target_relations\r
+* IRP_MN_QUERY_TARGET_RELATIONS handler.\r
+*\r
+* pfn_unknown\r
+* FDO and Filter drivers should pass this IRP down. Bus drivers should \r
+* complete the request for their PDOs without modifying the status.\r
+* The component library provides the cl_irp_skip and cl_irp_complete \r
+* functions to skip and complete and IRP, respectively. These functions\r
+* can be used to perform the required action. This handler is invoked\r
+* when an undocumented PNP irp is received.\r
+*\r
+* pfn_query_resources\r
+* IRP_MN_QUERY_RESOURCES handler.\r
+*\r
+* pfn_query_res_req\r
+* IRP_MN_QUERY_RESOURCE_REQUIREMENTS handler.\r
+*\r
+* pfn_query_bus_info\r
+* IRP_MN_QUERY_BUS_INFORMATION handler.\r
+*\r
+* pfn_query_interface\r
+* IRP_MN_QUERY_INTERFACE handler.\r
+*\r
+* pfn_read_config\r
+* IRP_MN_READ_CONFIG handler.\r
+*\r
+* pfn_write_config\r
+* IRP_MN_WRITE_CONFIG handler.\r
+*\r
+* pfn_eject\r
+* IRP_MN_EJECT handler.\r
+*\r
+* pfn_set_lock\r
+* IRP_MN_SET_LOCK handler.\r
+*\r
+* pfn_query_power\r
+* IRP_MN_QUERY_POWER handler.\r
+*\r
+* pfn_set_power\r
+* IRP_MN_SET_POWER handler.\r
+*\r
+* pfn_power_sequence\r
+* IRP_MN_POWER_SEQUENCE handler.\r
+*\r
+* pfn_wait_wake\r
+* IRP_MN_WAIT_WAKE handler.\r
+*\r
+* NOTES\r
+* The component library provides default handlers for skiping the IRP,\r
+* completing the IRP without changing the status, and processing the IRP\r
+* on the way up the device stack. Users can set the handler to \r
+* cl_irp_skip, cl_irp_complete, cl_do_sync_pnp.\r
+*\r
+* The handlers specified in pfn_query_power, pfn_set_power, \r
+* pfn_power_sequence, and pfn_wait_wake, if implemented as pageable code,\r
+* should be marked in a single pageable code section. The component library\r
+* will use the first function that is not a component library handler to\r
+* lock down the user's power management code.\r
+*\r
+* SEE ALSO\r
+* Plug and Play, cl_pfn_pnp_po_t, cl_pfn_release_resources_t, cl_do_sync_pnp,\r
+* cl_irp_skip, cl_irp_complete, cl_irp_unsupported, cl_irp_fail\r
+***********/\r
+\r
+\r
+/****d* Component Library: Plug and Play/cl_pfn_query_text_t\r
+* NAME\r
+* cl_pfn_query_text_t\r
+*\r
+* DESCRIPTION\r
+* Function pointer type for handling IRP_MN_QUERY_DEVICE_TEXT IRPs.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef NTSTATUS\r
+(*cl_pfn_query_text_t)(\r
+ IN DEVICE_OBJECT* const p_dev_obj,\r
+ OUT IRP* const p_irp );\r
+/*\r
+* PARAMETERS\r
+* pDevObj\r
+* Pointer to the device object that is the IRP target.\r
+*\r
+* pIrp\r
+* [out] Pointer to the request IRP. Sets the requested device text in\r
+* pIrp->IoStatus.Information.\r
+*\r
+* RETURN VALUES\r
+* NTSTATUS value indicating the result of the query.\r
+*\r
+* NOTES\r
+* Only bus drivers handle the IRP_MN_QUERY_DEVICE_TEXT IRP for their PDOs.\r
+*\r
+* SEE ALSO\r
+* Plug and Play\r
+*********/\r
+\r
+\r
+/****d* Component Library: Plug and Play/cl_vfptr_query_txt\r
+* NAME\r
+* cl_vfptr_query_txt\r
+*\r
+* DESCRIPTION\r
+* Function pointer table for the various type of text requested by\r
+* IRP_MN_QUERY_DEVICE_TEXT IRPs.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _cl_vfptr_query_txt\r
+{\r
+ cl_pfn_query_text_t pfn_query_device_id;\r
+ cl_pfn_query_text_t pfn_query_hardware_id;\r
+ cl_pfn_query_text_t pfn_query_compatible_id;\r
+ cl_pfn_query_text_t pfn_query_unique_id;\r
+ cl_pfn_query_text_t pfn_query_description;\r
+ cl_pfn_query_text_t pfn_query_location;\r
+\r
+} cl_vfptr_query_txt_t;\r
+/*\r
+* FIELDS\r
+* pfn_query_device_id\r
+* The request is for the target device's device ID.\r
+*\r
+* pfn_query_hardware_id\r
+* The request is for the target device's device IDs.\r
+*\r
+* pfn_query_compatible_id\r
+* The request is for the target device's comptible IDs.\r
+*\r
+* pfn_query_unique_id\r
+* The request is for the target device's unique ID.\r
+*\r
+* pfn_query_description\r
+* The request is for the target device's description.\r
+*\r
+* pfn_query_location\r
+* The request is for the target device's location text.\r
+*\r
+* NOTES\r
+* Hardware and compatible IDs should be returned in the most specific to\r
+* most general order. The IDs are used to match drivers to devices.\r
+*\r
+* The query text function pointer table is maintained separately from the\r
+* PnP function pointer table to allow FDO and filter drivers to not define\r
+* the table since they typically do not handle these requests.\r
+*\r
+* SEE ALSO\r
+* Plug and Play, cl_pfn_query_text_t\r
+*********/\r
+\r
+\r
+/****d* Component Library: Plug and Play/cl_pnp_state_t\r
+* NAME\r
+* cl_pnp_state_t\r
+*\r
+* DESCRIPTION\r
+* PnP States for device objects managed by this driver.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef enum _cl_pnp_state\r
+{\r
+ NotStarted = 0,\r
+ Started,\r
+ StopPending,\r
+ Stopped,\r
+ RemovePending,\r
+ SurpriseRemoved,\r
+ Deleted,\r
+ UnKnown\r
+\r
+} cl_pnp_state_t;\r
+/*\r
+* VALUES\r
+* NotStarted\r
+* Not started yet.\r
+*\r
+* Started\r
+* Device has received the IPR_MN_START_DEVICE IRP\r
+*\r
+* StopPending\r
+* Device has received the IPR_MN_QUERY_STOP_DEVICE IRP\r
+*\r
+* Stopped\r
+* Device has received the IPR_MN_STOP_DEVICE IRP\r
+*\r
+* RemovePending\r
+* Device has received the IPR_MN_QUERY_REMOVE_DEVICE IRP\r
+*\r
+* SurpriseRemoved\r
+* Device has received the IPR_MN_SURPRISE_REMOVE_DEVICE IRP\r
+*\r
+* Deleted\r
+* Device has received the IPR_MN_REMOVE_DEVICE IRP\r
+*\r
+* UnKnown\r
+* Unknown state\r
+*\r
+* SEE ALSO\r
+* Plug and Play, cl_pnp_po_ext_t\r
+*********/\r
+\r
+\r
+/****d* Component Library: Plug and Play/cl_pnp_po_ext_t\r
+* NAME\r
+* cl_pnp_po_ext_t\r
+*\r
+* DESCRIPTION\r
+* Device extension structure required for using the component library\r
+* plug and play helper routines.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _cl_pnp_po_ext\r
+{\r
+ cl_pnp_state_t pnp_state;\r
+ cl_pnp_state_t last_pnp_state;\r
+\r
+ DEVICE_OBJECT *p_self_do;\r
+ DEVICE_OBJECT *p_next_do;\r
+ DEVICE_OBJECT *p_pdo;\r
+\r
+ IO_REMOVE_LOCK remove_lock;\r
+ IO_REMOVE_LOCK stop_lock;\r
+\r
+ atomic32_t n_paging_files;\r
+ atomic32_t n_crash_files;\r
+ atomic32_t n_hibernate_files;\r
+\r
+ const cl_vfptr_pnp_po_t *vfptr_pnp_po;\r
+ const cl_vfptr_query_txt_t *vfptr_query_txt;\r
+\r
+ void *h_cl_locked_section;\r
+ void *h_user_locked_section;\r
+\r
+ atomic32_t n_ifc_ref;\r
+\r
+ uint32_t dbg_lvl;\r
+\r
+} cl_pnp_po_ext_t;\r
+/*\r
+* FIELDS\r
+* pnp_state\r
+* Current PnP device state.\r
+*\r
+* last_pnp_state\r
+* Previous PnP device state, to restore in case a query is cancelled.\r
+*\r
+* p_self_do\r
+* Pointer to the device's own device object.\r
+*\r
+* p_next_do\r
+* Pointer to the next device object. Null if the device is a PDO.\r
+*\r
+* p_pdo\r
+* The pointer to the PDO for the device node.\r
+* \r
+* remove_lock\r
+* Remove lock used to synchronize access to the device when handling\r
+* PnP IRPs.\r
+*\r
+* stop_lock\r
+* Lock used to track non-PnP and non-Power IO operations. \r
+* \r
+* n_paging_files\r
+* Number of times the device is in a paging file path.\r
+*\r
+* n_crash_files\r
+* Number of times the device is in a dump file path.\r
+*\r
+* n_hibernate_files\r
+* Number of times the device is in a hibernation files path.\r
+* \r
+* vfptr_pnp\r
+* Funtion pointer table for the PnP and Power Management handlers.\r
+*\r
+* vfptr_query_txt\r
+* Function pointer table for IRP_MN_QUERY_DEVICE_TEXT handlers.\r
+*\r
+* NOTES\r
+* This structure must be first in the device extension so that the device\r
+* extension can successfully be cast to a cl_pnp_po_ext_t pointer by the\r
+* IRP handler routines.\r
+*\r
+* When performing I/O operations, users should acquire the stop lock and\r
+* check status before starting an I/O operation, and release the stop lock\r
+* after completing an I/O operation using the cl_start_io and cl_end_io\r
+* functions respectively.\r
+*\r
+* SEE ALSO\r
+* Plug and Play, cl_vfptr_pnp_po_t, cl_pnp_state_t, cl_start_io, cl_end_io\r
+*********/\r
+\r
+\r
+/****f* Component Library: Plug and Play/cl_init_pnp_po_ext\r
+* NAME\r
+* cl_init_pnp_po_ext\r
+*\r
+* DESCRIPTION\r
+* Initializes the component library device extension for use.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT void\r
+cl_init_pnp_po_ext(\r
+ IN OUT DEVICE_OBJECT* const p_dev_obj,\r
+ IN DEVICE_OBJECT* const p_next_do,\r
+ IN DEVICE_OBJECT* const p_pdo,\r
+ IN const uint32_t pnp_po_dbg_lvl,\r
+ IN const cl_vfptr_pnp_po_t* const vfptr_pnp,\r
+ IN const cl_vfptr_query_txt_t* const vfptr_query_txt OPTIONAL );\r
+/*\r
+* PARAMETERS\r
+* p_dev_obj\r
+* Pointer to the device object for the device.\r
+*\r
+* p_next_do\r
+* Pointer to the next device object in the device stack. Must be NULL\r
+* for PDO objects.\r
+*\r
+* p_pdo\r
+* Pointer to the PDO for the device node.\r
+*\r
+* pnp_po_dbg_lvl\r
+* Debug level to control flow of debug messages. If the bit for\r
+* CL_DBG_PNP is set, verbose debug messages are generated.\r
+*\r
+* vfptr_pnp_po\r
+* Pointer to the function table of PnP and Power Management handlers.\r
+*\r
+* vfptr_query_txt\r
+* Pointer to the function table for IRP_MN_QUERY_DEVICE_TEXT handlers.\r
+*\r
+* SEE ALSO\r
+* Plug and Play, cl_pnp_po_ext_t, cl_vfptr_pnp_po_t, cl_vfptr_query_txt_t\r
+*********/\r
+\r
+\r
+/****f* Component Library: Plug and Play/cl_set_pnp_state\r
+* NAME\r
+* cl_set_pnp_state\r
+*\r
+* DESCRIPTION\r
+* Sets the PnP state stored in the common device extension to the desired\r
+* state. Stores the previous state for rollback purposes.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE void\r
+cl_set_pnp_state(\r
+ OUT cl_pnp_po_ext_t* const p_ext,\r
+ IN const cl_pnp_state_t new_state )\r
+{\r
+ p_ext->last_pnp_state = p_ext->pnp_state;\r
+ p_ext->pnp_state = new_state;\r
+}\r
+/*\r
+* PARAMTETERS\r
+* p_ext\r
+* Pointer to the device extension whose PnP state to set.\r
+*\r
+* new_state\r
+* New PnP state to store in the device extension.\r
+*\r
+* RETURN VALUES\r
+* This function does not return a value.\r
+*\r
+* SEE ALSO\r
+* Plug and Play, cl_pnp_po_ext_t, cl_pnp_state_t\r
+*********/\r
+\r
+\r
+/****f* Component Library: Plug and Play/cl_rollback_pnp_state\r
+* NAME\r
+* cl_rollback_pnp_state\r
+*\r
+* DESCRIPTION\r
+* Rolls back a PnP state change.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_INLINE void\r
+cl_rollback_pnp_state(\r
+ OUT cl_pnp_po_ext_t* const p_ext )\r
+{\r
+ p_ext->pnp_state = p_ext->last_pnp_state;\r
+}\r
+/*\r
+* PARAMTETERS\r
+* p_ext\r
+* Pointer to the device extension whose PnP state to set.\r
+*\r
+* RETURN VALUES\r
+* This function does not return a value.\r
+*\r
+* SEE ALSO\r
+* Plug and Play, cl_pnp_po_ext_t\r
+*********/\r
+\r
+\r
+/****f* Component Library: Plug and Play:/cl_pnp\r
+* NAME\r
+* cl_pnp\r
+*\r
+* DESCRIPTION\r
+* Main PnP entry point for the driver.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT NTSTATUS\r
+cl_pnp(\r
+ IN PDEVICE_OBJECT p_dev_obj,\r
+ IN PIRP p_irp );\r
+/*\r
+* PARAMTETERS\r
+* p_dev_obj\r
+* Pointer to the device object that is the target of the PnP IRP.\r
+*\r
+* p_irp\r
+* Pointer to the PnP IRP to perform on the specified device.\r
+*\r
+* RETURN VALUES\r
+* STATUS_SUCCESS if the operation is successful\r
+*\r
+* Other NTSTATUS values in case of error.\r
+*\r
+* SEE ALSO\r
+* Plug and Play\r
+**********/\r
+\r
+\r
+/****f* Component Library: Plug and Play:/cl_power\r
+* NAME\r
+* cl_power\r
+*\r
+* DESCRIPTION\r
+* Main Power Management entry point for the driver.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT NTSTATUS\r
+cl_power(\r
+ IN PDEVICE_OBJECT p_dev_obj,\r
+ IN PIRP p_irp );\r
+/*\r
+* PARAMTETERS\r
+* p_dev_obj\r
+* Pointer to the device object that is the target of the PnP IRP.\r
+*\r
+* p_irp\r
+* Pointer to the PnP IRP to perform on the specified device.\r
+*\r
+* RETURN VALUES\r
+* STATUS_SUCCESS if the operation is successful\r
+*\r
+* Other NTSTATUS values in case of error.\r
+*\r
+* SEE ALSO\r
+* Plug and Play\r
+**********/\r
+\r
+\r
+/****f* Component Library: Plug and Play/cl_do_sync_pnp\r
+* NAME\r
+* cl_do_sync_pnp\r
+*\r
+* DESCRIPTION\r
+* Sends an IRP to the next driver synchronously. Returns when the lower \r
+* drivers have completed the IRP. Used to process IRPs on the way up the\r
+* device node.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT NTSTATUS\r
+cl_do_sync_pnp(\r
+ IN DEVICE_OBJECT* const p_dev_obj,\r
+ IN IRP* const p_irp, \r
+ OUT cl_irp_action_t* const p_action );\r
+/*\r
+* PARAMETER\r
+* p_dev_obj\r
+* Pointer to the device object that is the IRP target.\r
+*\r
+* p_irp\r
+* Pointer to the request IRP.\r
+*\r
+* p_action\r
+* Action to take for propagating the IRP.\r
+*\r
+* RETURN VALUES\r
+* IRP status value returned by lower driver.\r
+*********/\r
+\r
+\r
+/****f* Component Library: Plug and Play/cl_alloc_relations\r
+* NAME\r
+* cl_alloc_relations\r
+*\r
+* DESCRIPTION\r
+* Allocates device relations and copies existing device relations, if any.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT NTSTATUS\r
+cl_alloc_relations(\r
+ IN IRP* const p_irp,\r
+ IN const size_t n_devs );\r
+/*\r
+* PARAMETERS\r
+* p_irp\r
+* Pointer to the IPR_MN_QUERY_DEVICE_RELATIONS IRP for which the\r
+* relations are being allocated.\r
+*\r
+* n_devs\r
+* Number of devices the caller will report in the DEVICE_RELATIONS\r
+* structure stored at pIrp->IoStatus.Infomation upon success.\r
+*\r
+* RETURN VALUES\r
+* STATUS_SUCCESS if the DEVICE_RELATIONS structure was allocated successfully.\r
+*\r
+* STATUS_INSUFFICIENT_RESOURCES if there was not enough memory to complete\r
+* the operation.\r
+*\r
+* NOTES\r
+* Upon failure, any original relations buffer is freed. Users should fail\r
+* the IRP with the returned status value.\r
+*\r
+* SEE ALSO\r
+* Plug and Play\r
+**********/\r
+\r
+\r
+/****f* Component Library: Plug and Play/cl_do_remove\r
+* NAME\r
+* cl_do_remove\r
+*\r
+* DESCRIPTION\r
+* Propagates an IRP_MN_REMOVE_DEVICE IRP, detaches, and deletes the\r
+* device object. Useable by function and filter drivers only.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT NTSTATUS\r
+cl_do_remove(\r
+ IN DEVICE_OBJECT* const pDevObj,\r
+ IN IRP* const pIrp, \r
+ OUT cl_irp_action_t* const pAction );\r
+/**********/\r
+\r
+\r
+/****f* Component Library: Plug and Play:/cl_irp_skip\r
+* NAME\r
+* cl_irp_skip\r
+*\r
+* DESCRIPTION\r
+* Default function for skipping a PnP IRP. Sets the IRP's status value.\r
+* Useable only by function and filter drivers. Bus drivers should use \r
+* cl_irp_complete for their PDOs to complete an IRP with no change in status.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT NTSTATUS\r
+cl_irp_skip(\r
+ IN DEVICE_OBJECT* const p_dev_obj,\r
+ IN IRP* const p_irp, \r
+ OUT cl_irp_action_t* const p_action );\r
+/*\r
+* PARAMETERS\r
+* p_dev_obj\r
+* Pointer to the device object that is the IRP target.\r
+*\r
+* p_irp\r
+* Pointer to the request IRP.\r
+*\r
+* p_action\r
+* Action to take for propagating the IRP.\r
+*\r
+* RETURN VALUES\r
+* IRP status value.\r
+*\r
+* SEE ALSO\r
+* Plug and Play, cl_irp_action_t\r
+*********/\r
+\r
+\r
+/****f* Component Library: Plug and Play:/cl_irp_ignore\r
+* NAME\r
+* cl_irp_ignore\r
+*\r
+* DESCRIPTION\r
+* Default function for skipping a PnP IRP without setting the IRP's status.\r
+* Useable only by function and filter drivers. Bus drivers should use \r
+* cl_irp_complete for their PDOs to complete an IRP with no change in status.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT NTSTATUS\r
+cl_irp_ignore(\r
+ IN DEVICE_OBJECT* const p_dev_obj,\r
+ IN IRP* const p_irp, \r
+ OUT cl_irp_action_t* const p_action );\r
+/*\r
+* PARAMETERS\r
+* p_dev_obj\r
+* Pointer to the device object that is the IRP target.\r
+*\r
+* p_irp\r
+* Pointer to the request IRP.\r
+*\r
+* p_action\r
+* Action to take for propagating the IRP.\r
+*\r
+* RETURN VALUES\r
+* IRP status value.\r
+*\r
+* SEE ALSO\r
+* Plug and Play, cl_irp_action_t\r
+*********/\r
+\r
+\r
+/****f* Component Library: Plug and Play:/cl_irp_complete\r
+* NAME\r
+* cl_irp_complete\r
+*\r
+* DESCRIPTION\r
+* Default handler for completeing a PnP or Power Management IRP with no \r
+* action. Should only be used by bus drivers for their PDOs to complete \r
+* an IRP with no change in status.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT NTSTATUS\r
+cl_irp_complete(\r
+ IN DEVICE_OBJECT* const p_dev_obj,\r
+ IN IRP* const p_irp, \r
+ OUT cl_irp_action_t* const p_action );\r
+/*\r
+* PARAMETERS\r
+* p_dev_obj\r
+* Pointer to the device object that is the IRP target.\r
+*\r
+* p_irp\r
+* Pointer to the request IRP.\r
+*\r
+* p_action\r
+* Action to take for propagating the IRP.\r
+*\r
+* RETURN VALUES\r
+* IRP status value.\r
+*\r
+* SEE ALSO\r
+* Plug and Play, cl_irp_action_t, cl_vfptr_pnp_po_t\r
+*********/\r
+\r
+\r
+/****f* Component Library: Plug and Play:/cl_irp_succeed\r
+* NAME\r
+* cl_irp_succeed\r
+*\r
+* DESCRIPTION\r
+* Default handler for succeeding an IRP with STATUS_SUCCESS.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT NTSTATUS\r
+cl_irp_succeed(\r
+ IN DEVICE_OBJECT* const p_dev_obj,\r
+ IN IRP* const p_irp, \r
+ OUT cl_irp_action_t* const p_action );\r
+/*\r
+* PARAMETERS\r
+* p_dev_obj\r
+* Pointer to the device object that is the IRP target.\r
+*\r
+* p_irp\r
+* Pointer to the request IRP.\r
+*\r
+* p_action\r
+* Action to take for propagating the IRP.\r
+*\r
+* RETURN VALUES\r
+* IRP status value.\r
+*\r
+* SEE ALSO\r
+* Plug and Play, cl_irp_action_t\r
+*********/\r
+\r
+\r
+/****f* Component Library: Plug and Play:/cl_irp_unsupported\r
+* NAME\r
+* cl_irp_unsupported\r
+*\r
+* DESCRIPTION\r
+* Default handler for failing an IRP with STATUS_UNSUPPORTED.\r
+*\r
+* SYNOPSIS\r
+*/\r
+CL_EXPORT NTSTATUS\r
+cl_irp_unsupported(\r
+ IN DEVICE_OBJECT* const p_dev_obj,\r
+ IN IRP* const p_irp, \r
+ OUT cl_irp_action_t* const p_action );\r
+/*\r
+* PARAMETERS\r
+* p_dev_obj\r
+* Pointer to the device object that is the IRP target.\r
+*\r
+* p_irp\r
+* Pointer to the request IRP.\r
+*\r
+* p_action\r
+* Action to take for propagating the IRP.\r
+*\r
+* RETURN VALUES\r
+* IRP status value.\r
+*\r
+* SEE ALSO\r
+* Plug and Play, cl_irp_action_t\r
+*********/\r
+\r
+\r
+#ifdef __cplusplus\r
+} /* extern "C" */\r
+#endif\r
+\r
+#endif /* _CL_PNP_PO_H_ */\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+\r
+\r
+#ifndef _CL_SPINLOCK_OSD_H_\r
+#define _CL_SPINLOCK_OSD_H_\r
+\r
+\r
+#include "complib/cl_types.h"\r
+#include "complib/cl_memory.h"\r
+\r
+\r
+/* Spinlock object definition. */\r
+typedef struct _cl_spinlock\r
+{\r
+ KSPIN_LOCK lock;\r
+ KIRQL irql;\r
+\r
+} cl_spinlock_t;\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif\r
+\r
+\r
+CL_INLINE void\r
+cl_spinlock_construct( \r
+ IN cl_spinlock_t* const p_spinlock )\r
+{\r
+ cl_memclr( p_spinlock, sizeof(cl_spinlock_t*) );\r
+}\r
+\r
+\r
+CL_INLINE cl_status_t\r
+cl_spinlock_init( \r
+ IN cl_spinlock_t* const p_spinlock )\r
+{\r
+ CL_ASSERT( p_spinlock );\r
+\r
+ cl_spinlock_construct( p_spinlock );\r
+\r
+ KeInitializeSpinLock( &p_spinlock->lock );\r
+ return( CL_SUCCESS );\r
+}\r
+\r
+\r
+CL_INLINE void\r
+cl_spinlock_destroy( \r
+ IN cl_spinlock_t* const p_spinlock )\r
+{\r
+ UNUSED_PARAM( p_spinlock );\r
+}\r
+\r
+\r
+CL_INLINE void\r
+cl_spinlock_acquire( \r
+ IN cl_spinlock_t* const p_spinlock )\r
+{\r
+ KIRQL irql = KeGetCurrentIrql();\r
+ CL_ASSERT( p_spinlock );\r
+\r
+ if (irql == DISPATCH_LEVEL) {\r
+ KeAcquireSpinLockAtDpcLevel( &p_spinlock->lock );\r
+ p_spinlock->irql = irql;\r
+ }\r
+ else\r
+ KeAcquireSpinLock( &p_spinlock->lock, &p_spinlock->irql );\r
+}\r
+\r
+\r
+CL_INLINE void\r
+cl_spinlock_release(\r
+ IN cl_spinlock_t* const p_spinlock )\r
+{\r
+ CL_ASSERT( p_spinlock );\r
+\r
+ if (p_spinlock->irql == DISPATCH_LEVEL)\r
+ KeReleaseSpinLockFromDpcLevel( &p_spinlock->lock );\r
+ else\r
+ KeReleaseSpinLock( &p_spinlock->lock, p_spinlock->irql );\r
+}\r
+\r
+\r
+#ifdef __cplusplus\r
+} // extern "C"\r
+#endif\r
+\r
+#endif // _CL_SPINLOCK_OSD_H_\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+\r
+\r
+#ifndef _CL_SYS_CALLBACK_OSD_H_\r
+#define _CL_SYS_CALLBACK_OSD_H_\r
+\r
+\r
+#include "complib/cl_types.h"\r
+\r
+\r
+typedef struct _IO_WORKITEM cl_sys_callback_item_t;\r
+\r
+\r
+#endif // _CL_SYS_CALLBACK_OSD_H_
\ No newline at end of file
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+\r
+\r
+#ifndef _CL_THREAD_OSD_H_\r
+#define _CL_THREAD_OSD_H_\r
+\r
+\r
+#include "complib/cl_types.h"\r
+#include "complib/cl_timer.h"\r
+\r
+\r
+/* OS specific information about the thread. */\r
+typedef struct _cl_thread_osd\r
+{\r
+ HANDLE h_thread;\r
+ PKTHREAD p_thread;\r
+\r
+} cl_thread_osd_t;\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif\r
+\r
+CL_INLINE void\r
+cl_thread_suspend( \r
+ IN const uint32_t pause_ms )\r
+{\r
+ LARGE_INTEGER interval;\r
+\r
+ // Convert the delay in milliseconds to 100 nanosecond intervals.\r
+ interval.QuadPart = -(int64_t)(((uint64_t)pause_ms * 10000));\r
+ KeDelayExecutionThread( KernelMode, FALSE, &interval );\r
+}\r
+\r
+\r
+CL_INLINE void\r
+cl_thread_stall( \r
+ IN const uint32_t pause_us )\r
+{\r
+ KeStallExecutionProcessor( pause_us );\r
+}\r
+\r
+\r
+CL_INLINE boolean_t\r
+cl_is_blockable( void )\r
+{\r
+ return ( KeGetCurrentIrql() < DISPATCH_LEVEL );\r
+}\r
+\r
+\r
+#ifdef __cplusplus\r
+} // extern "C"\r
+#endif\r
+\r
+\r
+#endif // _CL_THREAD_OSD_H_\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. \r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+\r
+\r
+#ifndef _CL_TIMER_OSD_H_\r
+#define _CL_TIMER_OSD_H_\r
+\r
+\r
+#include "complib/cl_types.h"\r
+\r
+\r
+/* Timer object definition. */\r
+typedef struct _cl_timer\r
+{\r
+ KTIMER timer;\r
+ KDPC dpc;\r
+ cl_pfn_timer_callback_t pfn_callback;\r
+ const void *context;\r
+ uint64_t timeout_time;\r
+\r
+} cl_timer_t;\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif\r
+\r
+/* 100ns to s conversion */\r
+#define HUNDREDNS_TO_SEC CL_CONST64(10000000)\r
+/* s to µs conversion */\r
+#define SEC_TO_MICRO CL_CONST64(1000000)\r
+\r
+CL_INLINE uint64_t CL_API\r
+cl_get_time_stamp( void )\r
+{\r
+ LARGE_INTEGER tick_count, frequency;\r
+\r
+ tick_count = KeQueryPerformanceCounter( &frequency );\r
+ return( tick_count.QuadPart / (frequency.QuadPart / SEC_TO_MICRO) );\r
+}\r
+\r
+CL_INLINE uint32_t CL_API\r
+cl_get_time_stamp_sec( void )\r
+{\r
+ return( (uint32_t)(KeQueryInterruptTime() / HUNDREDNS_TO_SEC) );\r
+}\r
+\r
+CL_INLINE uint64_t CL_API\r
+cl_get_tick_count( void )\r
+{\r
+ LARGE_INTEGER tick_count;\r
+\r
+ tick_count = KeQueryPerformanceCounter( NULL );\r
+ return tick_count.QuadPart;\r
+}\r
+\r
+CL_INLINE uint64_t CL_API\r
+cl_get_tick_freq( void )\r
+{\r
+ LARGE_INTEGER frequency;\r
+\r
+ KeQueryPerformanceCounter( &frequency );\r
+ return frequency.QuadPart;\r
+}\r
+\r
+#ifdef __cplusplus\r
+} /* extern "C" */\r
+#endif\r
+\r
+#endif // _CL_TIMER_OSD_H_
\ No newline at end of file
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+\r
+\r
+#ifndef _CL_TYPES_OSD_H_\r
+#define _CL_TYPES_OSD_H_\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif\r
+\r
+\r
+#pragma warning( push )\r
+#include <wdmwarn4.h>\r
+#if defined( NDIS_MINIPORT_DRIVER )\r
+#include <ndis.h>\r
+#if NDIS_WDM\r
+#define CL_NTDDK\r
+#endif /* NDIS_WDM */\r
+#elif !defined( _MINIPORT_ )\r
+#include <ntddk.h>\r
+#define CL_NTDDK\r
+#endif /* defined( NDIS_MINIPORT_DRIVER ) */\r
+#pragma warning( pop )\r
+/*\r
+ * Disable warnings related to taking the address of a dllimport function.\r
+ * This is needed to allow user of the PNP/PO abstraction to use the default\r
+ * handlers.\r
+ */\r
+#pragma warning( disable:4232 )\r
+\r
+/* For DECLSPEC_EXPORT and DECLSPEC_IMPORT */\r
+#include <ntdef.h>\r
+\r
+#define CL_KERNEL\r
+\r
+#if DBG\r
+ #define _DEBUG_\r
+#else\r
+ #undef _DEBUG_\r
+#endif\r
+\r
+typedef __int8 int8_t;\r
+typedef unsigned __int8 uint8_t;\r
+typedef __int16 int16_t;\r
+typedef unsigned __int16 uint16_t;\r
+typedef __int32 int32_t;\r
+typedef unsigned __int32 uint32_t;\r
+typedef __int64 int64_t;\r
+typedef unsigned __int64 uint64_t;\r
+/* boolean_t must be intergral sized to avoid a bunch of warnings. */\r
+typedef int boolean_t;\r
+typedef unsigned char uchar_t;\r
+typedef _W64 __int3264 intn_t;\r
+typedef _W64 unsigned __int3264 uintn_t;\r
+typedef volatile __int32 atomic32_t;\r
+\r
+\r
+#ifndef CL_ASSERT\r
+#define CL_ASSERT ASSERT\r
+#endif\r
+\r
+\r
+#define UNUSED_PARAM UNREFERENCED_PARAMETER\r
+#if defined(EVENT_TRACING)\r
+#define UNUSED_PARAM_WOWPP(a)\r
+#else\r
+#define UNUSED_PARAM_WOWPP(a)UNREFERENCED_PARAMETER(a)\r
+#endif\r
+\r
+\r
+#define CL_EXPORT\r
+\r
+#if !defined( __cplusplus )\r
+#define inline __inline\r
+#endif\r
+\r
+#define CL_INLINE CL_EXPORT inline\r
+\r
+#define CL_API\r
+\r
+#define cl_panic DbgBreakPoint\r
+\r
+#ifndef offsetof\r
+#define offsetof FIELD_OFFSET\r
+#endif\r
+\r
+#define PARENT_STRUCT( P, T, M ) CONTAINING_RECORD( (void*)P, T, M )\r
+\r
+typedef enum _cl_status cl_status_t;\r
+\r
+#define CL_CONST64( x ) x##ui64\r
+\r
+NTSTATUS\r
+cl_to_ntstatus(\r
+ IN enum _cl_status status );\r
+\r
+DECLSPEC_DEPRECATED enum _cl_status\r
+cl_from_ntstatus(\r
+ IN NTSTATUS status );\r
+\r
+#ifdef __cplusplus\r
+} /* extern "C" */\r
+#endif\r
+\r
+#endif // _CL_TYPES_OSD_H_\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+\r
+\r
+#ifndef _CL_WAITOBJ_OSD_H_\r
+#define _CL_WAITOBJ_OSD_H_\r
+\r
+\r
+#include <complib/cl_types.h>\r
+#include <complib/cl_event.h>\r
+\r
+\r
+typedef PKEVENT cl_waitobj_handle_t;\r
+\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif /* __cplusplus */\r
+\r
+ \r
+CL_INLINE cl_waitobj_handle_t\r
+cl_waitobj_ref(\r
+ IN void *h_user_wait_obj )\r
+{\r
+ cl_waitobj_handle_t h_kevent = NULL;\r
+\r
+ /* \r
+ * Assumption that if the call fails, the h_kevent parameter is unchanged,\r
+ * or set to NULL.\r
+ */\r
+ ObReferenceObjectByHandle( h_user_wait_obj, STANDARD_RIGHTS_ALL,\r
+ *ExEventObjectType, UserMode, (PVOID*)&h_kevent, NULL );\r
+\r
+ return h_kevent;\r
+}\r
+\r
+\r
+CL_INLINE void\r
+cl_waitobj_deref(\r
+ IN cl_waitobj_handle_t h_kernel_wait_obj )\r
+{\r
+ ObDereferenceObject( h_kernel_wait_obj );\r
+}\r
+\r
+\r
+CL_INLINE cl_status_t\r
+cl_waitobj_signal(\r
+ IN cl_waitobj_handle_t h_wait_obj )\r
+{\r
+ return cl_event_signal( (cl_event_t*)h_wait_obj );\r
+}\r
+\r
+\r
+CL_INLINE cl_status_t\r
+cl_waitobj_reset( \r
+ IN cl_waitobj_handle_t h_wait_obj )\r
+{\r
+ return cl_event_reset( (cl_event_t*)h_wait_obj );\r
+}\r
+\r
+\r
+CL_INLINE cl_status_t\r
+cl_waitobj_wait_on( \r
+ IN cl_waitobj_handle_t h_wait_obj,\r
+ IN const uint32_t wait_us,\r
+ IN const boolean_t interruptible )\r
+{\r
+ return cl_event_wait_on( (cl_event_t*)h_wait_obj, wait_us, interruptible );\r
+}\r
+\r
+\r
+#ifdef __cplusplus\r
+} /* extern "C" */\r
+#endif /* __cplusplus */\r
+\r
+\r
+#endif /* _CL_WAITOBJ_OSD_H_ */\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+\r
+#if !defined _IB_AL_IFC_H_\r
+#define _IB_AL_IFC_H_\r
+\r
+\r
+#include <iba/ib_al.h>\r
+\r
+\r
+/****h* Access Layer/AL Interface\r
+* NAME\r
+* AL Interface\r
+*\r
+* DESCRIPTION\r
+* Header file for the interface exported to ICT client drivers for access to\r
+* IB resources provided by HCAs.\r
+*********/\r
+\r
+#define AL_INTERFACE_VERSION (11)\r
+\r
+\r
+\r
+/* Function prototypes. Match definitions in ib_al.h. */\r
+typedef void\r
+(*ib_pfn_sync_destroy_t)(\r
+ IN void *context );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_open_ca_t)(\r
+ IN const ib_al_handle_t h_al,\r
+ IN const ib_net64_t ca_guid,\r
+ IN const ib_pfn_event_cb_t ca_event_cb OPTIONAL,\r
+ IN const void* const ca_context,\r
+ OUT ib_ca_handle_t* const ph_ca );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_query_ca_t)(\r
+ IN const ib_ca_handle_t h_ca,\r
+ OUT ib_ca_attr_t* const p_ca_attr OPTIONAL,\r
+ IN OUT uint32_t* const p_size );\r
+\r
+typedef DEVICE_OBJECT*\r
+(*ib_pfn_get_ca_dev_t)(\r
+ IN const ib_ca_handle_t h_ca );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_query_ca_by_guid_t)(\r
+ IN const ib_al_handle_t h_al,\r
+ IN const ib_net64_t ca_guid,\r
+ OUT ib_ca_attr_t* const p_ca_attr OPTIONAL,\r
+ IN OUT size_t* const p_size );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_modify_ca_t)(\r
+ IN const ib_ca_handle_t h_ca,\r
+ IN const uint8_t port_num,\r
+ IN const ib_ca_mod_t ca_mod,\r
+ IN const ib_port_attr_mod_t* const p_port_attr_mod );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_close_ca_t)(\r
+ IN const ib_ca_handle_t h_ca,\r
+ IN const ib_pfn_destroy_cb_t destroy_cb OPTIONAL );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_alloc_pd_t)(\r
+ IN const ib_ca_handle_t h_ca,\r
+ IN const ib_pd_type_t pd_type,\r
+ IN const void* const pd_context,\r
+ OUT ib_pd_handle_t* const ph_pd );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_dealloc_pd_t)(\r
+ IN const ib_pd_handle_t h_pd,\r
+ IN const ib_pfn_destroy_cb_t destroy_cb OPTIONAL );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_create_av_t)(\r
+ IN const ib_pd_handle_t h_pd,\r
+ IN const ib_av_attr_t* const p_av_attr,\r
+ OUT ib_av_handle_t* const ph_av );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_query_av_t)(\r
+ IN const ib_av_handle_t h_av,\r
+ OUT ib_av_attr_t* const p_av_attr,\r
+ OUT ib_pd_handle_t* const ph_pd );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_modify_av_t)(\r
+ IN const ib_av_handle_t h_av,\r
+ IN const ib_av_attr_t* const p_av_attr );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_destroy_av_t)(\r
+ IN const ib_av_handle_t h_av );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_create_srq_t)(\r
+ IN const ib_pd_handle_t h_pd,\r
+ IN const ib_srq_attr_t* const p_srq_attr,\r
+ IN const void* const srq_context,\r
+ IN const ib_pfn_event_cb_t srq_event_cb OPTIONAL,\r
+ OUT ib_srq_handle_t* const ph_srq );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_query_srq_t)(\r
+ IN const ib_srq_handle_t h_srq,\r
+ OUT ib_srq_attr_t* const p_srq_attr );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_modify_srq_t)(\r
+ IN const ib_srq_handle_t h_srq,\r
+ IN const ib_srq_attr_t* const p_srq_attr,\r
+ IN const ib_srq_attr_mask_t srq_attr_mask );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_destroy_srq_t)(\r
+ IN const ib_srq_handle_t h_srq,\r
+ IN const ib_pfn_destroy_cb_t destroy_cb OPTIONAL );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_post_srq_recv_t)(\r
+ IN const ib_srq_handle_t h_srq,\r
+ IN ib_recv_wr_t* const p_recv_wr,\r
+ OUT ib_recv_wr_t **pp_recv_failure OPTIONAL );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_create_qp_t)(\r
+ IN const ib_pd_handle_t h_pd,\r
+ IN const ib_qp_create_t* const p_qp_create,\r
+ IN const void* const qp_context,\r
+ IN const ib_pfn_event_cb_t qp_event_cb OPTIONAL,\r
+ OUT ib_qp_handle_t* const ph_qp );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_get_spl_qp_t)(\r
+ IN const ib_pd_handle_t h_pd,\r
+ IN const ib_net64_t port_guid,\r
+ IN const ib_qp_create_t* const p_qp_create,\r
+ IN const void* const qp_context,\r
+ IN const ib_pfn_event_cb_t qp_event_cb OPTIONAL,\r
+ OUT ib_pool_key_t* const p_pool_key OPTIONAL,\r
+ OUT ib_qp_handle_t* const ph_qp );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_query_qp_t)(\r
+ IN const ib_qp_handle_t h_qp,\r
+ OUT ib_qp_attr_t* const p_qp_attr );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_modify_qp_t)(\r
+ IN const ib_qp_handle_t h_qp,\r
+ IN const ib_qp_mod_t* const p_qp_mod );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_destroy_qp_t)(\r
+ IN const ib_qp_handle_t h_qp,\r
+ IN const ib_pfn_destroy_cb_t destroy_cb OPTIONAL );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_create_cq_t)(\r
+ IN const ib_ca_handle_t h_ca,\r
+ IN OUT ib_cq_create_t* const p_cq_create,\r
+ IN const void* const cq_context,\r
+ IN const ib_pfn_event_cb_t cq_event_cb OPTIONAL,\r
+ OUT ib_cq_handle_t* const ph_cq );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_modify_cq_t)(\r
+ IN const ib_cq_handle_t h_cq,\r
+ IN OUT uint32_t* const p_size );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_query_cq_t)(\r
+ IN const ib_cq_handle_t h_cq,\r
+ OUT uint32_t* const p_size );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_destroy_cq_t)(\r
+ IN const ib_cq_handle_t h_cq,\r
+ IN const ib_pfn_destroy_cb_t destroy_cb OPTIONAL );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_reg_mem_t)(\r
+ IN const ib_pd_handle_t h_pd,\r
+ IN const ib_mr_create_t* const p_mr_create,\r
+ OUT uint32_t* const p_lkey,\r
+ OUT uint32_t* const p_rkey,\r
+ OUT ib_mr_handle_t* const ph_mr );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_reg_phys_t)(\r
+ IN const ib_pd_handle_t h_pd,\r
+ IN const ib_phys_create_t* const p_phys_create,\r
+ IN OUT uint64_t* const p_vaddr,\r
+ OUT uint32_t* const p_lkey,\r
+ OUT uint32_t* const p_rkey,\r
+ OUT ib_mr_handle_t* const ph_mr );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_query_mr_t)(\r
+ IN const ib_mr_handle_t h_mr,\r
+ OUT ib_mr_attr_t* const p_mr_attr );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_rereg_mem_t)(\r
+ IN const ib_mr_handle_t h_mr,\r
+ IN const ib_mr_mod_t mr_mod_mask,\r
+ IN const ib_mr_create_t* const p_mr_create OPTIONAL,\r
+ OUT uint32_t* const p_lkey,\r
+ OUT uint32_t* const p_rkey,\r
+ IN const ib_pd_handle_t h_pd OPTIONAL );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_rereg_phys_t)(\r
+ IN const ib_mr_handle_t h_mr,\r
+ IN const ib_mr_mod_t mr_mod_mask,\r
+ IN const ib_phys_create_t* const p_phys_create OPTIONAL,\r
+ IN OUT void** const p_vaddr,\r
+ OUT uint32_t* const p_lkey,\r
+ OUT uint32_t* const p_rkey,\r
+ IN const ib_pd_handle_t h_pd OPTIONAL );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_reg_shared_t)(\r
+ IN const ib_mr_handle_t h_mr,\r
+ IN const ib_pd_handle_t h_pd,\r
+ IN const ib_access_t access_ctrl,\r
+ IN OUT void** const p_vaddr,\r
+ OUT uint32_t* const p_lkey,\r
+ OUT uint32_t* const p_rkey,\r
+ OUT ib_mr_handle_t* const ph_mr );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_create_shmid_t)(\r
+ IN const ib_pd_handle_t h_pd,\r
+ IN const int shmid,\r
+ IN const ib_mr_create_t* const p_mr_create,\r
+ OUT uint32_t* const p_lkey,\r
+ OUT uint32_t* const p_rkey,\r
+ OUT ib_mr_handle_t* const ph_mr );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_reg_shmid_t)(\r
+ IN const ib_pd_handle_t h_pd,\r
+ IN const ib_shmid_t shmid,\r
+ IN const ib_mr_create_t* const p_mr_create,\r
+ IN OUT uint64_t* const p_vaddr,\r
+ OUT net32_t* const p_lkey,\r
+ OUT net32_t* const p_rkey,\r
+ OUT ib_mr_handle_t* const ph_mr );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_dereg_mr_t)(\r
+ IN const ib_mr_handle_t h_mr );\r
+\r
+typedef ib_api_status_t\r
+(*mlnx_pfn_create_fmr_t)(\r
+ IN const ib_pd_handle_t h_pd,\r
+ IN const mlnx_fmr_create_t* const p_fmr_create,\r
+ OUT mlnx_fmr_handle_t* const ph_fmr );\r
+\r
+typedef ib_api_status_t\r
+(*mlnx_pfn_map_phys_fmr_t)(\r
+ IN const mlnx_fmr_handle_t h_fmr,\r
+ IN const uint64_t* const paddr_list,\r
+ IN const int list_len,\r
+ IN OUT uint64_t* const p_vaddr,\r
+ OUT net32_t* const p_lkey,\r
+ OUT net32_t* const p_rkey );\r
+\r
+typedef ib_api_status_t\r
+(*mlnx_pfn_unmap_fmr_t)(\r
+ IN const mlnx_fmr_handle_t h_fmr );\r
+\r
+typedef ib_api_status_t\r
+(*mlnx_pfn_destroy_fmr_t)(\r
+ IN mlnx_fmr_handle_t const h_fmr );\r
+\r
+\r
+typedef ib_api_status_t\r
+(*mlnx_pfn_create_fmr_pool_t)(\r
+ IN const ib_pd_handle_t h_pd,\r
+ IN const mlnx_fmr_pool_create_t *p_fmr_pool_attr,\r
+ OUT mlnx_fmr_pool_handle_t* const ph_pool );\r
+\r
+\r
+typedef ib_api_status_t\r
+(*mlnx_pfn_destroy_fmr_pool_t)(\r
+ IN const mlnx_fmr_pool_handle_t h_pool );\r
+\r
+\r
+typedef ib_api_status_t\r
+(*mlnx_pfn_map_phys_fmr_pool_t)(\r
+ IN const mlnx_fmr_pool_handle_t h_pool ,\r
+ IN const uint64_t* const paddr_list,\r
+ IN const int list_len,\r
+ IN OUT uint64_t* const p_vaddr,\r
+ OUT net32_t* const p_lkey,\r
+ OUT net32_t* const p_rkey,\r
+ OUT mlnx_fmr_pool_el_t *p_fmr_el);\r
+\r
+typedef ib_api_status_t\r
+(*mlnx_pfn_unmap_fmr_pool_t)(\r
+ IN mlnx_fmr_pool_el_t p_fmr_el );\r
+\r
+typedef ib_api_status_t\r
+(*mlnx_pfn_flush_fmr_pool_t)(\r
+ IN const mlnx_fmr_pool_handle_t h_pool );\r
+\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_create_mw_t)(\r
+ IN const ib_pd_handle_t h_pd,\r
+ OUT uint32_t* const p_rkey,\r
+ OUT ib_mw_handle_t* const ph_mw );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_query_mw_t)(\r
+ IN const ib_mw_handle_t h_mw,\r
+ OUT ib_pd_handle_t* const ph_pd,\r
+ OUT uint32_t* const p_rkey );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_bind_mw_t)(\r
+ IN const ib_mw_handle_t h_mw,\r
+ IN const ib_qp_handle_t h_qp,\r
+ IN ib_bind_wr_t* const p_mw_bind,\r
+ OUT uint32_t* const p_rkey );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_destroy_mw_t)(\r
+ IN const ib_mw_handle_t h_mw );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_post_send_t)(\r
+ IN const ib_qp_handle_t h_qp,\r
+ IN ib_send_wr_t* const p_send_wr,\r
+ OUT ib_send_wr_t **pp_send_failure OPTIONAL );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_post_recv_t)(\r
+ IN const ib_qp_handle_t h_qp,\r
+ IN ib_recv_wr_t* const p_recv_wr,\r
+ OUT ib_recv_wr_t **pp_recv_failure OPTIONAL );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_send_mad_t)(\r
+ IN const ib_mad_svc_handle_t h_mad_svc,\r
+ IN ib_mad_element_t* const p_mad_element_list,\r
+ OUT ib_mad_element_t **pp_mad_failure OPTIONAL );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_cancel_mad_t)(\r
+ IN const ib_mad_svc_handle_t h_mad_svc,\r
+ IN ib_mad_element_t* const p_mad_element );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_poll_cq_t)(\r
+ IN const ib_cq_handle_t h_cq,\r
+ IN OUT ib_wc_t** const pp_free_wclist,\r
+ OUT ib_wc_t** const pp_done_wclist );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_rearm_cq_t)(\r
+ IN const ib_cq_handle_t h_cq,\r
+ IN const boolean_t solicited );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_join_mcast_t)(\r
+ IN const ib_qp_handle_t h_qp,\r
+ IN const ib_mcast_req_t* const p_mcast_req );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_leave_mcast_t)(\r
+ IN const ib_mcast_handle_t h_mcast,\r
+ IN const ib_pfn_destroy_cb_t destroy_cb );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_local_mad_t)(\r
+ IN const ib_ca_handle_t h_ca,\r
+ IN const uint8_t port_num,\r
+ IN const void* const p_mad_in,\r
+ OUT void* p_mad_out );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_cm_listen_t)(\r
+ IN const ib_al_handle_t h_al,\r
+ IN const ib_cm_listen_t* const p_cm_listen,\r
+ IN const ib_pfn_listen_err_cb_t listen_err_cb,\r
+ IN const void* const listen_context,\r
+ OUT ib_listen_handle_t* const ph_cm_listen );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_cm_cancel_t)(\r
+ IN const ib_listen_handle_t h_cm_listen,\r
+ IN const ib_pfn_destroy_cb_t destroy_cb OPTIONAL );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_cm_req_t)(\r
+ IN const ib_cm_req_t* const p_cm_req );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_cm_rep_t)(\r
+ IN const ib_cm_handle_t h_cm_req,\r
+ IN const ib_cm_rep_t* const p_cm_rep );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_cm_rtu_t)(\r
+ IN const ib_cm_handle_t h_cm_rep,\r
+ IN const ib_cm_rtu_t* const p_cm_rtu );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_cm_rej_t)(\r
+ IN const ib_cm_handle_t h_cm,\r
+ IN const ib_cm_rej_t* const p_cm_rej );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_cm_mra_t)(\r
+ IN const ib_cm_handle_t h_cm,\r
+ IN const ib_cm_mra_t* const p_cm_mra );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_cm_lap_t)(\r
+ IN const ib_cm_lap_t* const p_cm_lap );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_cm_apr_t)(\r
+ IN const ib_cm_handle_t h_cm_lap,\r
+ IN const ib_cm_apr_t* const p_cm_apr );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_force_apm_t)(\r
+ IN const ib_qp_handle_t h_qp );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_cm_dreq_t)(\r
+ IN const ib_cm_dreq_t* const p_cm_dreq );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_cm_drep_t)(\r
+ IN const ib_cm_handle_t h_cm_dreq,\r
+ IN const ib_cm_drep_t* const p_cm_drep );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_cm_handoff_t)(\r
+ IN const ib_cm_handle_t h_cm_req,\r
+ IN const ib_net64_t svc_id );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_create_ioc_t)(\r
+ IN const ib_ca_handle_t h_ca,\r
+ IN const ib_ioc_profile_t* const p_ioc_profile,\r
+ OUT ib_ioc_handle_t* const ph_ioc );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_destroy_ioc_t)(\r
+ IN const ib_ioc_handle_t h_ioc );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_reg_ioc_t)(\r
+ IN const ib_ioc_handle_t h_ioc );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_add_svc_entry_t)(\r
+ IN const ib_ioc_handle_t h_ioc,\r
+ IN const ib_svc_entry_t* const p_svc_entry,\r
+ OUT ib_svc_handle_t* const ph_svc );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_remove_svc_entry_t)(\r
+ IN const ib_svc_handle_t h_svc );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_get_ca_guids_t)(\r
+ IN ib_al_handle_t h_al,\r
+ OUT ib_net64_t* const p_guid_array OPTIONAL,\r
+ IN OUT uintn_t* const p_guid_cnt );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_get_ca_by_gid_t)(\r
+ IN ib_al_handle_t h_al,\r
+ IN const ib_gid_t* const p_gid,\r
+ OUT ib_net64_t* const p_ca_guid );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_get_ca_by_gid_t)(\r
+ IN ib_al_handle_t h_al,\r
+ IN const ib_gid_t* const p_gid,\r
+ OUT ib_net64_t* const p_ca_guid );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_get_port_by_gid_t)(\r
+ IN ib_al_handle_t h_al,\r
+ IN const ib_gid_t* const p_gid,\r
+ OUT ib_net64_t* const p_port_guid );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_create_mad_pool_t)(\r
+ IN const ib_al_handle_t h_al,\r
+ IN const size_t min,\r
+ IN const size_t max,\r
+ IN const size_t grow_size,\r
+ OUT ib_pool_handle_t* const ph_pool );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_destroy_mad_pool_t)(\r
+ IN const ib_pool_handle_t h_pool );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_reg_mad_pool_t)(\r
+ IN const ib_pool_handle_t h_pool,\r
+ IN const ib_pd_handle_t h_pd,\r
+ OUT ib_pool_key_t* const p_pool_key );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_dereg_mad_pool_t)(\r
+ IN const ib_pool_key_t pool_key );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_get_mad_t)(\r
+ IN const ib_pool_key_t pool_key,\r
+ IN const size_t buf_size,\r
+ OUT ib_mad_element_t **pp_mad_element );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_put_mad_t)(\r
+ IN const ib_mad_element_t* p_mad_element_list );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_init_dgrm_svc_t)(\r
+ IN const ib_qp_handle_t h_qp,\r
+ IN const ib_dgrm_info_t* const p_dgrm_info OPTIONAL );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_reg_mad_svc_t)(\r
+ IN const ib_qp_handle_t h_qp,\r
+ IN const ib_mad_svc_t* const p_mad_svc,\r
+ OUT ib_mad_svc_handle_t* const ph_mad_svc );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_reg_svc_t)(\r
+ IN const ib_al_handle_t h_al,\r
+ IN const ib_reg_svc_req_t* const p_reg_svc_req,\r
+ OUT ib_reg_svc_handle_t* const ph_reg_svc );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_dereg_svc_t)(\r
+ IN const ib_reg_svc_handle_t h_reg_svc,\r
+ IN const ib_pfn_destroy_cb_t destroy_cb OPTIONAL );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_query_t)(\r
+ IN const ib_al_handle_t h_al,\r
+ IN const ib_query_req_t* const p_query_req,\r
+ OUT ib_query_handle_t* const ph_query OPTIONAL );\r
+\r
+typedef void\r
+(*ib_pfn_cancel_query_t)(\r
+ IN const ib_al_handle_t h_al,\r
+ IN const ib_query_handle_t query_hndl );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_reg_pnp_t)(\r
+ IN const ib_al_handle_t h_al,\r
+ IN const ib_pnp_req_t* const p_pnp_req,\r
+ OUT ib_pnp_handle_t* const ph_pnp );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_dereg_pnp_t)(\r
+ IN const ib_pnp_handle_t h_pnp,\r
+ IN const ib_pfn_destroy_cb_t destroy_cb OPTIONAL );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_subscribe_t)(\r
+ IN const ib_al_handle_t h_al,\r
+ IN const ib_sub_req_t* const p_sub_req,\r
+ OUT ib_sub_handle_t* const ph_sub );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_unsubscribe_t)(\r
+ IN const ib_sub_handle_t h_sub,\r
+ IN const ib_pfn_destroy_cb_t destroy_cb OPTIONAL );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_reject_ioc_t)(\r
+ IN const ib_al_handle_t h_al,\r
+ IN const ib_pnp_handle_t h_ioc_event );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_ci_call_t)(\r
+ IN ib_ca_handle_t h_ca,\r
+ IN const void* __ptr64 * const handle_array OPTIONAL,\r
+ IN uint32_t num_handles,\r
+ IN ib_ci_op_t* const p_ci_op );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_open_al_t)(\r
+ OUT ib_al_handle_t* const ph_al );\r
+\r
+typedef ib_api_status_t\r
+(*ib_pfn_close_al_t)(\r
+ IN const ib_al_handle_t h_al );\r
+\r
+typedef const char*\r
+(*ib_pfn_get_err_str_t)(\r
+ IN ib_api_status_t status );\r
+\r
+typedef const char*\r
+(*ib_pfn_get_wc_status_str_t)(\r
+ IN ib_wc_status_t wc_status );\r
+\r
+\r
+/* Interface specific data header. */\r
+typedef struct _ib_al_ifc_data\r
+{\r
+ const GUID *type;\r
+ USHORT size;\r
+ USHORT version;\r
+ void *p_data;\r
+\r
+} ib_al_ifc_data_t;\r
+\r
+\r
+/* Interface definitions */\r
+typedef struct _ib_al_ifc\r
+{\r
+ /* Standard interface header. */\r
+ INTERFACE wdm;\r
+\r
+ /* AL entry points. */\r
+ ib_pfn_sync_destroy_t sync_destroy;\r
+ ib_pfn_open_ca_t open_ca;\r
+ ib_pfn_query_ca_t query_ca;\r
+ ib_pfn_get_ca_dev_t get_dev;\r
+ ib_pfn_close_ca_t close_ca;\r
+ ib_pfn_alloc_pd_t alloc_pd;\r
+ ib_pfn_dealloc_pd_t dealloc_pd;\r
+ ib_pfn_create_av_t create_av;\r
+ ib_pfn_query_av_t query_av;\r
+ ib_pfn_modify_av_t modify_av;\r
+ ib_pfn_destroy_av_t destroy_av;\r
+ ib_pfn_create_qp_t create_qp;\r
+ ib_pfn_get_spl_qp_t get_spl_qp;\r
+ ib_pfn_query_qp_t query_qp;\r
+ ib_pfn_modify_qp_t modify_qp;\r
+ ib_pfn_destroy_qp_t destroy_qp;\r
+ ib_pfn_create_cq_t create_cq;\r
+ ib_pfn_modify_cq_t modify_cq;\r
+ ib_pfn_query_cq_t query_cq;\r
+ ib_pfn_destroy_cq_t destroy_cq;\r
+ ib_pfn_reg_mem_t reg_mem;\r
+ ib_pfn_reg_phys_t reg_phys;\r
+ ib_pfn_query_mr_t query_mr;\r
+ ib_pfn_rereg_mem_t rereg_mem;\r
+ ib_pfn_create_shmid_t create_shmid;\r
+ ib_pfn_reg_shmid_t reg_shmid;\r
+ ib_pfn_dereg_mr_t dereg_mr;\r
+ ib_pfn_create_mw_t create_mw;\r
+ ib_pfn_query_mw_t query_mw;\r
+ ib_pfn_bind_mw_t bind_mw;\r
+ ib_pfn_destroy_mw_t destroy_mw;\r
+ ib_pfn_post_send_t post_send;\r
+ ib_pfn_post_recv_t post_recv;\r
+ ib_pfn_send_mad_t send_mad;\r
+ ib_pfn_cancel_mad_t cancel_mad;\r
+ ib_pfn_poll_cq_t poll_cq;\r
+ ib_pfn_rearm_cq_t rearm_cq;\r
+ ib_pfn_join_mcast_t join_mcast;\r
+ ib_pfn_leave_mcast_t leave_mcast;\r
+ ib_pfn_local_mad_t local_mad;\r
+ ib_pfn_cm_listen_t cm_listen;\r
+ ib_pfn_cm_cancel_t cm_cancel;\r
+ ib_pfn_cm_req_t cm_req;\r
+ ib_pfn_cm_rep_t cm_rep;\r
+ ib_pfn_cm_rtu_t cm_rtu;\r
+ ib_pfn_cm_rej_t cm_rej;\r
+ ib_pfn_cm_mra_t cm_mra;\r
+ ib_pfn_cm_lap_t cm_lap;\r
+ ib_pfn_cm_apr_t cm_apr;\r
+ ib_pfn_force_apm_t force_apm;\r
+ ib_pfn_cm_dreq_t cm_dreq;\r
+ ib_pfn_cm_drep_t cm_drep;\r
+ ib_pfn_cm_handoff_t cm_handoff;\r
+ ib_pfn_create_ioc_t create_ioc;\r
+ ib_pfn_destroy_ioc_t destroy_ioc;\r
+ ib_pfn_reg_ioc_t reg_ioc;\r
+ ib_pfn_add_svc_entry_t add_svc_entry;\r
+ ib_pfn_remove_svc_entry_t remove_svc_entry;\r
+ ib_pfn_get_ca_guids_t get_ca_guids;\r
+ ib_pfn_get_ca_by_gid_t get_ca_by_gid;\r
+ ib_pfn_get_port_by_gid_t get_port_by_gid;\r
+ ib_pfn_create_mad_pool_t create_mad_pool;\r
+ ib_pfn_destroy_mad_pool_t destroy_mad_pool;\r
+ ib_pfn_reg_mad_pool_t reg_mad_pool;\r
+ ib_pfn_dereg_mad_pool_t dereg_mad_pool;\r
+ ib_pfn_get_mad_t get_mad;\r
+ ib_pfn_put_mad_t put_mad;\r
+ ib_pfn_init_dgrm_svc_t init_dgrm_svc;\r
+ ib_pfn_reg_mad_svc_t reg_mad_svc;\r
+ ib_pfn_reg_svc_t reg_svc;\r
+ ib_pfn_dereg_svc_t dereg_svc;\r
+ ib_pfn_query_t query;\r
+ ib_pfn_cancel_query_t cancel_query;\r
+ ib_pfn_reg_pnp_t reg_pnp;\r
+ ib_pfn_dereg_pnp_t dereg_pnp;\r
+ ib_pfn_subscribe_t subscribe;\r
+ ib_pfn_unsubscribe_t unsubscribe;\r
+ ib_pfn_reject_ioc_t reject_ioc;\r
+ ib_pfn_ci_call_t ci_call;\r
+ ib_pfn_open_al_t open_al;\r
+ ib_pfn_close_al_t close_al;\r
+ ib_pfn_get_err_str_t get_err_str;\r
+ ib_pfn_get_wc_status_str_t get_wc_status_str;\r
+ mlnx_pfn_create_fmr_t create_mlnx_fmr;\r
+ mlnx_pfn_map_phys_fmr_t map_phys_mlnx_fmr;\r
+ mlnx_pfn_unmap_fmr_t unmap_mlnx_fmr;\r
+ mlnx_pfn_destroy_fmr_t destroy_mlnx_fmr;\r
+ mlnx_pfn_create_fmr_pool_t create_mlnx_fmr_pool;\r
+ mlnx_pfn_destroy_fmr_pool_t destroy_mlnx_fmr_pool;\r
+ mlnx_pfn_map_phys_fmr_pool_t map_phys_mlnx_fmr_pool;\r
+ mlnx_pfn_unmap_fmr_pool_t unmap_mlnx_fmr_pool;\r
+ mlnx_pfn_flush_fmr_pool_t flush_mlnx_fmr_pool;\r
+ \r
+ ib_pfn_create_srq_t create_srq;\r
+ ib_pfn_query_srq_t query_srq;\r
+ ib_pfn_modify_srq_t modify_srq;\r
+ ib_pfn_destroy_srq_t destroy_srq;\r
+ ib_pfn_post_srq_recv_t post_srq_recv;\r
+\r
+} ib_al_ifc_t;\r
+\r
+\r
+#endif /* !defined _IB_AL_IFC_H_ */\r
+\r
+/*\r
+ * AL interface GUID. The GUID is defined outside the conditional include\r
+ * on purpose so that it can be instantiated only once where it is actually\r
+ * needed. See the DDK docs section "Using GUIDs in Drivers" for more info.\r
+ */\r
+/* {707A1BDE-BF9F-4565-8FDD-144EF6514FE8} */\r
+DEFINE_GUID(GUID_IB_AL_INTERFACE, \r
+0x707a1bde, 0xbf9f, 0x4565, 0x8f, 0xdd, 0x14, 0x4e, 0xf6, 0x51, 0x4f, 0xe8);\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+\r
+#if !defined _IB_CI_IFC_H_\r
+#define _IB_CI_IFC_H_\r
+\r
+\r
+#include "iba/ib_ci.h"\r
+\r
+\r
+/****h* Access Layer/AL Channel Interface\r
+* NAME\r
+* AL Channel Interface\r
+*\r
+* DESCRIPTION\r
+* Header file for the interface exported to HCA drivers to allow them\r
+* to register with AL for use by AL clients.\r
+*********/\r
+\r
+\r
+#define IB_CI_INTERFACE_VERSION (3)\r
+\r
+\r
+/* Function type for ib_register_ca. Match the definition in ib_ci.h */\r
+typedef ib_api_status_t\r
+(*ib_pfn_register_ca_t)(\r
+ IN const ci_interface_t* const p_ci );\r
+\r
+\r
+/* Function type for ib_deregister_ca. Matches the definition in ib_ci.h */\r
+typedef ib_api_status_t\r
+(*ib_pfn_deregister_ca_t)(\r
+ IN const net64_t ca_guid );\r
+\r
+\r
+/*\r
+ * Appends a CA's device relations given a CA guid to an existing list\r
+ * of relations.\r
+ */\r
+typedef NTSTATUS\r
+(*ib_pfn_get_relations_t)(\r
+ IN net64_t ca_guid,\r
+ IN OUT IRP* const p_irp );\r
+\r
+\r
+typedef const char*\r
+(*ib_pfn_get_err_str_t)(\r
+ IN ib_api_status_t status );\r
+\r
+\r
+\r
+/****s* Access Layer: AL Channel Interface/ib_ci_ifc_t\r
+* NAME\r
+* ib_ci_ifc_t\r
+*\r
+* DESCRIPTION\r
+* \r
+* SYNOPSIS\r
+*/\r
+typedef struct _ib_ci_ifc\r
+{\r
+\r
+ INTERFACE wdm;\r
+\r
+ ib_pfn_register_ca_t register_ca;\r
+ ib_pfn_deregister_ca_t deregister_ca;\r
+ ib_pfn_get_relations_t get_relations;\r
+ ib_pfn_get_err_str_t get_err_str;\r
+\r
+} ib_ci_ifc_t;\r
+/*\r
+* FIELDS\r
+* wdmr.\r
+* Standard interface header.\r
+*\r
+* register_ca\r
+* Pointer to ib_pfn_register_ca_t function\r
+*\r
+* deregister_ca\r
+* Pointer to ib_pfn_deregister_ca_t function\r
+*\r
+* get_relations\r
+* Pointer to ib_pfn_get_relations_t function\r
+*\r
+* get_err_str\r
+* Pointer to ib_pfn_get_err_str_t function\r
+*\r
+* SEE ALSO\r
+* ib_register_ca,ib_deregister_ca,\r
+*********/\r
+\r
+\r
+#endif /* !defined _IB_CI_IFC_H_ */\r
+\r
+/*\r
+ * CI interface GUID. The GUID is defined outside the conditional include\r
+ * on purpose so that it can be instantiated only once where it is actually\r
+ * needed. See the DDK docs section "Using GUIDs in Drivers" for more info.\r
+ */\r
+/* {9B617D6B-65AB-4fe5-9601-555271F7534D} */\r
+DEFINE_GUID(GUID_IB_CI_INTERFACE, \r
+0x9b617d6b, 0x65ab, 0x4fe5, 0x96, 0x1, 0x55, 0x52, 0x71, 0xf7, 0x53, 0x4d);\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+\r
+#include <iba/ib_al_ifc.h>\r
+\r
+\r
+#if !defined _IOC_IFC_H_\r
+#define _IOC_IFC_H_\r
+\r
+\r
+/****h* Access Layer/IO Controler Interface\r
+* NAME\r
+* IO Controler Interface\r
+*\r
+* DESCRIPTION\r
+* Header file for the interface exported to IOC client drivers to retrieve\r
+* IOC device information.\r
+*\r
+* The interface contains information about the particular instance of an IOC.\r
+*********/\r
+\r
+\r
+#define IOC_INTERFACE_DATA_VERSION (3)\r
+\r
+\r
+\r
+/****s* Access Layer: IO Controler Interface/ioc_ifc_data_t\r
+* NAME\r
+* ioc_ifc_data_t\r
+*\r
+* DESCRIPTION\r
+* I/O Controler interface data.\r
+*\r
+* The ioc_ifc_data_t structure \r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ioc_ifc_data\r
+{\r
+ net64_t ca_guid;\r
+ net64_t guid;\r
+\r
+} ioc_ifc_data_t;\r
+/*\r
+* FIELDS\r
+* ca_guid\r
+* Local CA GUID through which IOC is accessible.\r
+*\r
+* guid\r
+* IOC GUID.\r
+*\r
+* SEE ALSO\r
+* \r
+*********/\r
+\r
+\r
+#endif /* !defined _IOC_IFC_H_ */\r
+\r
+/*\r
+ * IOC interface GUID. The GUID is defined outside the conditional include\r
+ * on purpose so that it can be instantiated only once where it is actually\r
+ * needed. See the DDK docs section "Using GUIDs in Drivers" for more info.\r
+ */\r
+/* {20883ACD-57F3-4da3-AD03-73D0178ACAE9} */\r
+DEFINE_GUID(GUID_IOC_INTERFACE_DATA, \r
+0x20883acd, 0x57f3, 0x4da3, 0xad, 0x3, 0x73, 0xd0, 0x17, 0x8a, 0xca, 0xe9);\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+\r
+#include "iba/ib_al_ifc.h"\r
+\r
+\r
+#if !defined _IOU_IFC_H_\r
+#define _IOU_IFC_H_\r
+\r
+\r
+/****h* Access Layer/ IO Unit Interface\r
+* NAME\r
+* IO Unit Interface\r
+*\r
+* DESCRIPTION\r
+* Header file for the interface exported to IOU client drivers to retrieve\r
+* IOU device information.\r
+*\r
+* The interface contains information about the particular instance of an IOU.\r
+*********/\r
+\r
+\r
+#define IOU_INTERFACE_DATA_VERSION (4)\r
+\r
+\r
+\r
+/****s* Access Layer: IO Unit Interface/iou_ifc_data_t\r
+* NAME\r
+* iou_ifc_data_t\r
+*\r
+* DESCRIPTION\r
+* I/O Unit interface data.\r
+*\r
+* The iou_ifc_data_t structure \r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _iou_ifc_data\r
+{\r
+ net64_t ca_guid;\r
+ net64_t chassis_guid;\r
+ uint8_t slot;\r
+ net64_t guid;\r
+\r
+} iou_ifc_data_t;\r
+/*\r
+* FIELDS\r
+* ca_guid\r
+* Local CA GUID through which IOU is accessible.\r
+*\r
+* chassis_guid\r
+* IOU chassis GUID.\r
+*\r
+* slot\r
+* IOU slot.\r
+*\r
+* guid\r
+* IOU GUID.\r
+*\r
+* SEE ALSO\r
+* \r
+*********/\r
+\r
+#endif /* !defined _IOU_IFC_H_ */\r
+\r
+/*\r
+ * IOU interface GUID. The GUID is defined outside the conditional include\r
+ * on purpose so that it can be instantiated only once where it is actually\r
+ * needed. See the DDK docs section "Using GUIDs in Drivers" for more info.\r
+ */\r
+/* {C78F0228-E564-4d46-8A4B-295030414C1A} */\r
+DEFINE_GUID(GUID_IOU_INTERFACE_DATA, \r
+0xc78f0228, 0xe564, 0x4d46, 0x8a, 0x4b, 0x29, 0x50, 0x30, 0x41, 0x4c, 0x1a);\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ * Copyright (c) 2006 Mellanox Technologies. All rights reserved.\r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+\r
+#include "iba/ib_al_ifc.h"\r
+\r
+\r
+#if !defined _IPOIB_IFC_H_\r
+#define _IPOIB_IFC_H_\r
+\r
+\r
+/****h* Access Layer/IPoIB Interface\r
+* NAME\r
+* IPoIB Interface\r
+*\r
+* DESCRIPTION\r
+* Header file for the interface exported to IPoIB client drivers for access\r
+* to IB resources provided by HCAs.\r
+*\r
+* The actual interface returned is an contains information about the\r
+* particular instance of an IPoIB device.\r
+*********/\r
+\r
+\r
+#define IPOIB_INTERFACE_DATA_VERSION (5)\r
+\r
+\r
+/****s* Access Layer: IPoIB Interface/ipoib_ifc_data_t\r
+* NAME\r
+* ipoib_ifc_data_t\r
+*\r
+* DESCRIPTION\r
+* IPoIB interface datat.\r
+*\r
+* The ipoib_ifc_data_t structure \r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ipoib_ifc_data\r
+{\r
+ net64_t ca_guid;\r
+ net64_t port_guid;\r
+ uint8_t port_num;\r
+\r
+} ipoib_ifc_data_t;\r
+/*\r
+* FIELDS\r
+* ca_guid\r
+* HCA GUID for this IPoIB interface\r
+*\r
+* port_guid\r
+* Port GUID for this IPoIB interface\r
+*\r
+* port_num\r
+* Port Number GUID for this IPoIB interface\r
+*\r
+* SEE ALSO\r
+* \r
+*********/\r
+\r
+\r
+\r
+#endif /* !defined _IPOIB_IFC_H_ */\r
+\r
+/*\r
+ * IPOIB interface GUID. The GUID is defined outside the conditional include\r
+ * on purpose so that it can be instantiated only once where it is actually\r
+ * needed. See the DDK docs section "Using GUIDs in Drivers" for more info.\r
+ */\r
+/* {B40DDB48-5710-487a-B812-6DAF56C7F423} */\r
+DEFINE_GUID(GUID_IPOIB_INTERFACE_DATA, \r
+0xb40ddb48, 0x5710, 0x487a, 0xb8, 0x12, 0x6d, 0xaf, 0x56, 0xc7, 0xf4, 0x23);\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+#ifndef _IP_PACKET_H_\r
+#define _IP_PACKET_H_\r
+\r
+\r
+#include <complib/cl_types.h>\r
+#include <complib/cl_byteswap.h>\r
+\r
+\r
+#ifndef HW_ADDR_LEN\r
+#define HW_ADDR_LEN 6\r
+#endif /* HW_ADDR_LEN */\r
+\r
+\r
+#define ETH_PROT_TYPE_IP CL_HTON16(0x800)\r
+#define ETH_PROT_TYPE_ARP CL_HTON16(0x806)\r
+#define ETH_PROT_VLAN_TAG CL_HTON16(0x8100)\r
+\r
+\r
+#define ETH_IS_LOCALLY_ADMINISTERED(addr) \\r
+ (BOOLEAN)(((PUCHAR)(addr))[0] & ((UCHAR)0x02))\r
+\r
+\r
+#include <complib/cl_packon.h>\r
+/****s* IB Network Drivers/mac_addr_t\r
+* NAME\r
+* mac_addr_t\r
+*\r
+* DESCRIPTION\r
+* Defines the ehternet MAC address.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _mac_addr\r
+{\r
+ uint8_t addr[HW_ADDR_LEN];\r
+\r
+} PACK_SUFFIX mac_addr_t;\r
+/*\r
+* FIELDS\r
+* addr\r
+* Byte array representing the MAC address.\r
+*\r
+* NOTES\r
+* The HW_ADDR_LEN value must be defined before including this header in order\r
+* to support various address lengths. If not defined, the default length for\r
+* ethernet (6 bytes) is used.\r
+*\r
+* addr[0] & 0x1 indicates multicast\r
+* addr[0] & 0x2 indicates LAA if not multicast\r
+*\r
+* SEE ALSO\r
+* IB Network Drivers, arp_pkt_t, ip_hdr_t, tcp_hdr_t, udp_hdr_t\r
+*********/\r
+#include <complib/cl_packoff.h>\r
+\r
+\r
+#include <complib/cl_packon.h>\r
+/****s* IB Network Drivers/eth_hdr_t\r
+* NAME\r
+* eth_hdr_t\r
+*\r
+* DESCRIPTION\r
+* Defines the ehternet header for IP packets.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _eth_hdr\r
+{\r
+ mac_addr_t dst;\r
+ mac_addr_t src;\r
+ net16_t type;\r
+\r
+} PACK_SUFFIX eth_hdr_t;\r
+/*\r
+* FIELDS\r
+* dst\r
+* Destination address\r
+*\r
+* src\r
+* Source address\r
+*\r
+* type\r
+* Ethernet protocol type\r
+*\r
+* NOTES\r
+* The HW_ADDR_LEN value must be defined before including this header in order\r
+* to support various address lengths.\r
+*\r
+* SEE ALSO\r
+* IB Network Drivers, arp_pkt_t, ip_hdr_t, tcp_hdr_t, udp_hdr_t\r
+*********/\r
+#include <complib/cl_packoff.h>\r
+\r
+\r
+#define ARP_HW_TYPE_ETH CL_HTON16(1)\r
+#define ARP_HW_TYPE_IB CL_HTON16(32)\r
+\r
+#define ARP_OP_REQ CL_HTON16(1)\r
+#define ARP_OP_REP CL_HTON16(2)\r
+\r
+\r
+#include <complib/cl_packon.h>\r
+/****s* IB Network Drivers/arp_pkt_t\r
+* NAME\r
+* arp_pkt_t\r
+*\r
+* DESCRIPTION\r
+* Defines the ARP packet for IP packets.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _arp_pkt\r
+{\r
+ net16_t hw_type;\r
+ net16_t prot_type;\r
+ uint8_t hw_size;\r
+ uint8_t prot_size;\r
+ net16_t op;\r
+ mac_addr_t src_hw;\r
+ net32_t src_ip;\r
+ mac_addr_t dst_hw;\r
+ net32_t dst_ip;\r
+\r
+} PACK_SUFFIX arp_pkt_t;\r
+/*\r
+* FIELDS\r
+* hw_type\r
+* Hardware type\r
+*\r
+* prot_type\r
+* Protocol type. See ETH_PROT_TYPE_XXX definitions.\r
+*\r
+* hw_size\r
+* Size of the hardware address\r
+*\r
+* prot_size\r
+* Size of the protocol address\r
+*\r
+* op\r
+* ARP operation\r
+*\r
+* src_hw\r
+* Source HW (MAC) address\r
+*\r
+* src_ip\r
+* Source IP address\r
+*\r
+* dst_hw\r
+* Destination HW (MAC) address\r
+*\r
+* dst_ip\r
+* Destination IP address\r
+*\r
+* NOTES\r
+* The HW_ADDR_LEN value must be defined before including this header in order\r
+* to support various MAC address lengths.\r
+*\r
+* SEE ALSO\r
+* IB Network Drivers, eth_hdr_t, ip_hdr_t, tcp_hdr_t, udp_hdr_t\r
+*********/\r
+#include <complib/cl_packoff.h>\r
+\r
+\r
+#define IP_PROT_IP 4\r
+#define IP_PROT_TCP 6\r
+#define IP_PROT_UDP 17\r
+\r
+\r
+#include <complib/cl_packon.h>\r
+/****s* IB Network Drivers/ip_hdr_t\r
+* NAME\r
+* ip_hdr_t\r
+*\r
+* DESCRIPTION\r
+* Defines the IP header for IP packets.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _ip_hdr\r
+{\r
+ uint8_t ver_hl;\r
+ uint8_t svc_type;\r
+ net16_t length;\r
+ net16_t id;\r
+ net16_t offset;\r
+ uint8_t ttl;\r
+ uint8_t prot;\r
+ net16_t chksum;\r
+ net32_t src_ip;\r
+ net32_t dst_ip;\r
+\r
+} PACK_SUFFIX ip_hdr_t;\r
+/*\r
+* FIELDS\r
+* ver_hl\r
+* Header version and length.\r
+*\r
+* svc_type\r
+* Service type.\r
+*\r
+* length\r
+* Total length.\r
+*\r
+* id\r
+* Packet identification.\r
+*\r
+* offset\r
+* Fragment offset.\r
+*\r
+* ttl\r
+* Time to live.\r
+*\r
+* prot\r
+* Protocol.\r
+*\r
+* chksum\r
+* Checksum.\r
+*\r
+* src_ip\r
+* Source IP address\r
+*\r
+* dst_ip\r
+* Destination IP address\r
+*\r
+* SEE ALSO\r
+* IB Network Drivers, eth_hdr_t, arp_pkt_t, tcp_hdr_t, udp_hdr_t\r
+*********/\r
+#include <complib/cl_packoff.h>\r
+\r
+\r
+#include <complib/cl_packon.h>\r
+/****s* IB Network Drivers/tcp_hdr_t\r
+* NAME\r
+* tcp_hdr_t\r
+*\r
+* DESCRIPTION\r
+* Defines the IP header for IP packets.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _tcp_hdr\r
+{\r
+ net16_t src_port;\r
+ net16_t dst_port;\r
+ net32_t seq_num;\r
+ net32_t ack_num;\r
+ uint8_t offset;\r
+ uint8_t flags;\r
+ net16_t window;\r
+ net16_t chksum;\r
+ net16_t urp;\r
+\r
+} PACK_SUFFIX tcp_hdr_t;\r
+/*\r
+* FIELDS\r
+* src_port\r
+* Source port.\r
+*\r
+* dst_port\r
+* Destination port.\r
+*\r
+* seq_num\r
+* Sequence number.\r
+*\r
+* ack_num\r
+* Acknowledge number.\r
+*\r
+* offset\r
+* data offset.\r
+*\r
+* flags\r
+* TCP flags.\r
+*\r
+* window\r
+* Window number.\r
+*\r
+* chksum\r
+* Checksum.\r
+*\r
+* urp\r
+* Urgent pointer.\r
+*\r
+* SEE ALSO\r
+* IB Network Drivers, eth_hdr_t, arp_pkt_t, ip_hdr_t, udp_hdr_t\r
+*********/\r
+#include <complib/cl_packoff.h>\r
+\r
+\r
+#include <complib/cl_packon.h>\r
+/****s* IB Network Drivers/udp_hdr_t\r
+* NAME\r
+* udp_hdr_t\r
+*\r
+* DESCRIPTION\r
+* Defines the IP header for IP packets.\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _udp_hdr\r
+{\r
+ net16_t src_port;\r
+ net16_t dst_port;\r
+ net16_t length;\r
+ net16_t chksum;\r
+\r
+} PACK_SUFFIX udp_hdr_t;\r
+/*\r
+* FIELDS\r
+* src_port\r
+* Source port.\r
+*\r
+* dst_port\r
+* Destination port.\r
+*\r
+* length\r
+* Length of datagram.\r
+*\r
+* chksum\r
+* Checksum.\r
+*\r
+* SEE ALSO\r
+* IB Network Drivers, eth_hdr_t, arp_pkt_t, ip_hdr_t, tcp_hdr_t\r
+*********/\r
+#include <complib/cl_packoff.h>\r
+\r
+\r
+#define DHCP_PORT_SERVER CL_HTON16(67)\r
+#define DHCP_PORT_CLIENT CL_HTON16(68)\r
+\r
+#define DHCP_REQUEST 1\r
+#define DHCP_REPLY 2\r
+#define DHCP_HW_TYPE_ETH 1\r
+#define DHCP_HW_TYPE_IB 32\r
+#define DHCP_OPT_PAD 0\r
+#define DHCP_OPT_END 255\r
+#define DHCP_OPT_MSG 53\r
+#define DHCP_OPT_CLIENT_ID 61\r
+\r
+#define DHCPDISCOVER 1\r
+#define DHCPOFFER 2\r
+#define DHCPREQUEST 3\r
+#define DHCPDECLINE 4\r
+#define DHCPACK 5\r
+#define DHCPNAK 6\r
+#define DHCPRELEASE 7\r
+#define DHCPINFORM 8\r
+\r
+#define DHCP_FLAGS_BROADCAST CL_HTON16(0x8000)\r
+#define DHCP_COOKIE 0x63538263\r
+#define DHCP_OPTIONS_SIZE 312\r
+#define DHCP_COOKIE_SIZE 4\r
+\r
+\r
+/* Minimum DHCP size is without options (but with 4-byte magic cookie). */\r
+#define DHCP_MIN_SIZE (sizeof(dhcp_pkt_t) + DHCP_COOKIE_SIZE - DHCP_OPTIONS_SIZE )\r
+\r
+#include <complib/cl_packon.h>\r
+/****s* IB Network Drivers/dhcp_pkt_t\r
+* NAME\r
+* dhcp_pkt_t\r
+*\r
+* DESCRIPTION\r
+* Defines the DHCP packet format as documented in RFC 2131\r
+* http://www.zvon.org/tmRFC/RFC2131/Output/index.html\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef struct _dhcp_pkt\r
+{\r
+ uint8_t op;\r
+ uint8_t htype;\r
+ uint8_t hlen;\r
+ uint8_t hops;\r
+ net32_t xid;\r
+ net16_t secs;\r
+ net16_t flags;\r
+ net32_t ciaddr;\r
+ net32_t yiaddr;\r
+ net32_t siaddr;\r
+ net32_t giaddr;\r
+ uint8_t chaddr[16];\r
+ uint8_t sname[64];\r
+ uint8_t file[128];\r
+ uint8_t options[312];\r
+\r
+} PACK_SUFFIX dhcp_pkt_t;\r
+/*\r
+* SEE ALSO\r
+* IB Network Drivers, eth_hdr_t, arp_pkt_t, ip_hdr_t, udp_hdr_t\r
+*********/\r
+#include <complib/cl_packoff.h>\r
+\r
+\r
+#include <complib/cl_packon.h>\r
+typedef struct _udp_pkt\r
+{\r
+ udp_hdr_t hdr;\r
+ dhcp_pkt_t dhcp;\r
+\r
+} PACK_SUFFIX udp_pkt_t;\r
+\r
+typedef struct _ip_pkt\r
+{\r
+ ip_hdr_t hdr;\r
+ union _ip_payload\r
+ {\r
+ tcp_hdr_t tcp;\r
+ udp_pkt_t udp;\r
+\r
+ } PACK_SUFFIX prot;\r
+\r
+} PACK_SUFFIX ip_pkt_t;\r
+\r
+typedef struct _eth_pkt\r
+{\r
+ eth_hdr_t hdr;\r
+ union _eth_payload\r
+ {\r
+ arp_pkt_t arp;\r
+ ip_pkt_t ip;\r
+\r
+ } PACK_SUFFIX type;\r
+\r
+} PACK_SUFFIX eth_pkt_t;\r
+#include <complib/cl_packoff.h>\r
+\r
+\r
+#endif /* _IP_PACKET_H_ */\r
--- /dev/null
+/*
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.
+ * Copyright (c) 2004-2005 Mellanox Technologies, Inc. All rights reserved.
+ *
+ * This software is available to you under the OpenIB.org BSD license
+ * below:
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * - Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * $Id$
+ */
+
+#ifndef MTHCA_VC_H
+#define MTHCA_VC_H
+
+typedef
+struct _map_crspace {
+ unsigned __int64 va; /* address of CRSPACE, mapped to user space */
+ unsigned long size; /* size of CRSPACE, mapped to user space */
+ unsigned long reserved; /* to align on quadword boundary */
+} map_crspace;
+
+/* Definitions for hca_driver commands*/
+#define FW_READ 0x00
+#define FW_WRITE 0x01
+#define FW_READ_CMD 0x08
+#define FW_WRITE_CMD 0x09
+#define FW_MAP_CRSPACE 0x0A
+#define FW_UNMAP_CRSPACE 0x0B
+#define FW_REREGISTER_HCA 0x0c
+#define FW_OPEN_IF 0xe7
+#define FW_CLOSE_IF 0x7e
+
+/* uplink info */
+typedef struct {
+ uint8_t bus_type; /* 1 - PCI, 2 - PCI-X, 3 - PCI_E */
+#define UPLINK_BUS_PCI 1
+#define UPLINK_BUS_PCIX 2
+#define UPLINK_BUS_PCIE 3
+ union {
+ struct {
+ uint8_t capabilities;
+#define UPLINK_BUS_PCIX_133 2 /* 133 MHz capable */
+ uint16_t frequency; /* in MHz */
+ } pci_x;
+ struct {
+ uint8_t capabilities;
+ uint8_t link_speed; /* 1X link speed */
+#define UPLINK_BUS_PCIE_SDR 1 /* 2.5 Gbps */
+#define UPLINK_BUS_PCIE_DDR 2 /* 5 Gbps */
+ uint8_t link_width; /* x1, x2, x4, x8, x12, x16, x32 */
+ } pci_e;
+ } u;
+} uplink_info_t;
+
+/* Defines for get data for vendor specific */
+#define MTHCA_BRD_ID_LEN 64
+
+inline char* mthca_get_board_id(ib_ca_attr_t *ca_attr)
+{
+ return (char*)(ca_attr)+(ca_attr->size - MTHCA_BRD_ID_LEN - sizeof(uplink_info_t));
+}
+
+inline void* mthca_get_uplink_info(ib_ca_attr_t *ca_attr)
+{
+ return (char*)(ca_attr)+(ca_attr->size - sizeof(uplink_info_t));
+}
+
+#endif
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+#include <windows.h>\r
+#include <ntverp.h>\r
+\r
+#if (VER_FILEBUILD < 10)\r
+#define VER_FILEBPAD "000"\r
+#elif (VER_FILEBUILD < 100)\r
+#define VER_FILEBPAD "00"\r
+#elif (VER_FILEBUILD < 1000)\r
+#define VER_FILEBPAD "0"\r
+#else\r
+#define VER_FILEBPAD\r
+#endif\r
+\r
+#define VER_FILEVERSION VER_FILEMAJORVERSION,\\r
+ VER_FILEMINORVERSION,\\r
+ VER_FILEBUILD,\\r
+ VER_FILEREV\r
+\r
+#define VER_FILEVERSION_STR2(M,m,b,r) #M "." #m "." VER_FILEBPAD #b "." #r\r
+#define VER_FILEVERSION_STR1(M,m,b,r) VER_FILEVERSION_STR2(M,m,b,r)\r
+#define VER_FILEVERSION_STR VER_FILEVERSION_STR1( VER_FILEMAJORVERSION, \\r
+ VER_FILEMINORVERSION, \\r
+ VER_FILEBUILD, \\r
+ VER_FILEREV )\r
+\r
+#undef __BUILDMACHINE__\r
+\r
+#ifdef VER_COMPANYNAME_STR\r
+#undef VER_COMPANYNAME_STR\r
+#endif\r
+#define VER_COMPANYNAME_STR IB_COMPANYNAME\r
+\r
+#ifdef VER_PRODUCTNAME_STR\r
+#undef VER_PRODUCTNAME_STR\r
+#endif\r
+#define VER_PRODUCTNAME_STR IB_PRODUCTNAME\r
+\r
+#define VER_LEGALCOPYRIGHT_STR "Copyright\xa9 2007 OpenFabrics Alliance"\r
--- /dev/null
+!INCLUDE $(NTMAKEENV)\makefile.def\r
+\r
+# Allow overriding the company name.\r
+!IF !DEFINED(IB_COMPANYNAME)\r
+IB_COMPANYNAME="""OpenFabrics\x20Alliance"""\r
+!ENDIF\r
+\r
+# Allow overriding the product name.\r
+!IF !DEFINED(IB_PRODUCTNAME)\r
+IB_PRODUCTNAME="""OpenFabrics\x20Windows"""\r
+!ENDIF\r
+\r
+!IF !DEFINED(IB_MAJORVERSION)\r
+IB_MAJORVERSION=1\r
+!endif\r
+\r
+!IF !DEFINED(IB_MINORVERSION)\r
+IB_MINORVERSION=0\r
+!endif\r
+\r
+!IF !DEFINED(IB_FILEBUILD)\r
+IB_FILEBUILD=0\r
+!endif\r
+\r
+!IF !DEFINED(IB_FILEREV)\r
+IB_FILEREV=$(OPENIB_REV)\r
+\r
+!endif\r
+\r
+!IFNDEF VER_PROVIDER\r
+VER_PROVIDER="""OpenIB"""\r
+!ENDIF\r
+\r
+C_DEFINES=$(C_DEFINES) -DIB_COMPANYNAME=$(IB_COMPANYNAME) \\r
+ -DIB_PRODUCTNAME=$(IB_PRODUCTNAME) \\r
+ -DVER_FILEMAJORVERSION=$(IB_MAJORVERSION) \\r
+ -DVER_FILEMINORVERSION=$(IB_MINORVERSION) \\r
+ -DVER_FILEBUILD=$(IB_FILEBUILD) \\r
+ -DVER_FILEREV=$(IB_FILEREV) \\r
+ -DVER_PROVIDER=$(VER_PROVIDER)
\ No newline at end of file
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+\r
+\r
+#ifndef _CL_ATOMIC_OSD_H_\r
+#define _CL_ATOMIC_OSD_H_\r
+\r
+\r
+#include "cl_types.h"\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif\r
+\r
+\r
+CL_INLINE int32_t CL_API\r
+cl_atomic_inc(\r
+ IN atomic32_t* const p_value )\r
+{\r
+ return( InterlockedIncrement( (LONG*)p_value ) );\r
+}\r
+\r
+\r
+CL_INLINE int32_t CL_API\r
+cl_atomic_dec(\r
+ IN atomic32_t* const p_value )\r
+{\r
+ return( InterlockedDecrement( (LONG*)p_value ) );\r
+}\r
+\r
+\r
+CL_INLINE int32_t CL_API\r
+cl_atomic_add(\r
+ IN atomic32_t* const p_value,\r
+ IN const int32_t increment )\r
+{\r
+ /* Return the incremented value. */\r
+ return( InterlockedExchangeAdd( (long*)p_value, increment ) + increment );\r
+}\r
+\r
+\r
+CL_INLINE int32_t CL_API\r
+cl_atomic_sub(\r
+ IN atomic32_t* const p_value,\r
+ IN const int32_t decrement )\r
+{\r
+ /* Return the decremented value. */\r
+ return( InterlockedExchangeAdd( (long*)p_value, -decrement ) - decrement );\r
+}\r
+\r
+\r
+CL_INLINE int32_t CL_API\r
+cl_atomic_xchg(\r
+ IN atomic32_t* const p_value,\r
+ IN const int32_t new_value )\r
+{\r
+ return( InterlockedExchange( (long*)p_value, new_value ) );\r
+}\r
+\r
+\r
+CL_INLINE int32_t CL_API\r
+cl_atomic_comp_xchg(\r
+ IN atomic32_t* const p_value,\r
+ IN const int32_t compare,\r
+ IN const int32_t new_value )\r
+{\r
+ return( InterlockedCompareExchange( (long*)p_value, new_value, compare ) );\r
+}\r
+\r
+\r
+#ifdef __cplusplus\r
+} // extern "C"\r
+#endif\r
+\r
+#endif // _CL_ATOMIC_OSD_H_\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+\r
+#ifndef _CL_BYTESWAP_OSD_H_\r
+#define _CL_BYTESWAP_OSD_H_\r
+\r
+\r
+#include "complib/cl_types.h"\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif\r
+\r
+#define CPU_LE 1\r
+#define CPU_BE 0\r
+\r
+#define cl_ntoh16 _byteswap_ushort\r
+#define cl_hton16 _byteswap_ushort\r
+\r
+#define cl_ntoh32 _byteswap_ulong\r
+#define cl_hton32 _byteswap_ulong\r
+\r
+#define cl_ntoh64 _byteswap_uint64\r
+#define cl_hton64 _byteswap_uint64\r
+\r
+#ifdef __cplusplus\r
+} // extern "C"\r
+#endif\r
+\r
+#endif // _CL_BYTESWAP_OSD_H_\r
+\r
+\r
+\r
+\r
+\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+#ifndef _CL_DEBUG_OSD_H_\r
+#define _CL_DEBUG_OSD_H_\r
+\r
+\r
+#include "cl_types.h"\r
+#include <stdio.h>\r
+#include <stdarg.h>\r
+\r
+\r
+#if !defined(__MODULE__)\r
+#define __MODULE__ ""\r
+#define __MOD_DELIMITER__ ""\r
+#else /* !defined(__MODULE__) */\r
+#define __MOD_DELIMITER__ ":"\r
+#endif /* !defined(__MODULE__) */\r
+\r
+\r
+#if defined( _WIN64 )\r
+#define PRIdSIZE_T "I64d"\r
+#else\r
+#define PRIdSIZE_T "d"\r
+#endif\r
+#define PRId64 "I64d"\r
+#define PRIx64 "I64x"\r
+#define PRIo64 "I64o"\r
+#define PRIu64 "I64u"\r
+\r
+\r
+#if defined( _DEBUG_ )\r
+#define cl_dbg_out cl_msg_out\r
+#else\r
+#define cl_dbg_out __noop\r
+#endif /* defined( _DEBUG_ ) */\r
+\r
+\r
+/*\r
+ * The following macros are used internally by the CL_ENTER, CL_TRACE, \r
+ * CL_TRACE_EXIT, and CL_EXIT macros.\r
+ */\r
+#define _CL_DBG_ENTER \\r
+ ("0x%x:%s%s%s() [\n", GetCurrentThreadId(), __MODULE__, __MOD_DELIMITER__, __FUNCTION__)\r
+\r
+#define _CL_DBG_EXIT \\r
+ ("0x%x:%s%s%s() ]\n", GetCurrentThreadId(), __MODULE__, __MOD_DELIMITER__, __FUNCTION__)\r
+\r
+#define _CL_DBG_INFO \\r
+ ("0x%x:%s%s%s(): ", GetCurrentThreadId(), __MODULE__, __MOD_DELIMITER__, __FUNCTION__)\r
+\r
+#define _CL_DBG_ERROR \\r
+ ("0x%x:%s%s%s() !ERROR!: ", GetCurrentThreadId(), __MODULE__, __MOD_DELIMITER__, __FUNCTION__)\r
+\r
+#define CL_CHK_STK\r
+\r
+#endif /* _CL_DEBUG_OSD_H_ */\r
+\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+\r
+\r
+#ifndef _CL_EVENT_OSD_H_\r
+#define _CL_EVENT_OSD_H_\r
+\r
+\r
+#include "cl_types.h"\r
+\r
+\r
+/* Simple definition, eh? */\r
+typedef HANDLE cl_event_t;\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif\r
+\r
+\r
+CL_INLINE void CL_API\r
+cl_event_construct(\r
+ IN cl_event_t* const p_event )\r
+{\r
+ CL_ASSERT( p_event );\r
+\r
+ *p_event = NULL;\r
+}\r
+\r
+\r
+CL_INLINE cl_status_t CL_API\r
+cl_event_init(\r
+ IN cl_event_t* const p_event,\r
+ IN const boolean_t manual_reset )\r
+{\r
+ CL_ASSERT( p_event );\r
+\r
+ *p_event = CreateEvent( NULL, manual_reset, FALSE, NULL );\r
+ if( !*p_event )\r
+ return( CL_ERROR );\r
+\r
+ return( CL_SUCCESS );\r
+}\r
+\r
+\r
+CL_INLINE void CL_API\r
+cl_event_destroy(\r
+ IN cl_event_t* const p_event )\r
+{\r
+ CL_ASSERT( p_event );\r
+\r
+ if( *p_event )\r
+ CloseHandle( *p_event );\r
+}\r
+\r
+\r
+CL_INLINE cl_status_t CL_API\r
+cl_event_signal(\r
+ IN cl_event_t* const p_event )\r
+{\r
+ CL_ASSERT( p_event );\r
+ CL_ASSERT( *p_event );\r
+\r
+ if( !SetEvent( *p_event ) )\r
+ return( CL_ERROR );\r
+\r
+ return( CL_SUCCESS );\r
+}\r
+\r
+\r
+CL_INLINE cl_status_t CL_API\r
+cl_event_reset(\r
+ IN cl_event_t* const p_event )\r
+{\r
+ CL_ASSERT( p_event );\r
+ CL_ASSERT( *p_event );\r
+\r
+ if( !ResetEvent( *p_event ) )\r
+ return( CL_ERROR );\r
+\r
+ return( CL_SUCCESS );\r
+}\r
+\r
+\r
+#ifdef __cplusplus\r
+} // extern "C"\r
+#endif\r
+\r
+#endif // _CL_EVENT_OSD_H_
\ No newline at end of file
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+/*\r
+ * Abstract:\r
+ * Declaration of IOCTL object\r
+ *\r
+ * Environment:\r
+ * Windows User Mode\r
+ */\r
+\r
+\r
+#ifndef _CL_IOCTL_OSD_H_\r
+#define _CL_IOCTL_OSD_H_\r
+\r
+\r
+#include <complib/cl_types.h>\r
+#pragma warning(push, 3)\r
+#include <winioctl.h>\r
+#pragma warning(pop)\r
+\r
+\r
+#define IOCTL_CODE( type, cmd ) \\r
+ CTL_CODE( type, (cmd & 0x0FFF), METHOD_BUFFERED, FILE_ANY_ACCESS)\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif /* __cplusplus */\r
+\r
+\r
+CL_INLINE cl_status_t CL_API\r
+cl_ioctl_request(\r
+ IN void *h_dev,\r
+ IN uint32_t ioctl_code,\r
+ IN void *p_in_buf,\r
+ IN size_t in_size,\r
+ OUT void *p_out_buf,\r
+ IN size_t out_size,\r
+ OUT size_t *p_ret_bytes OPTIONAL,\r
+ IN void *p_async_info OPTIONAL )\r
+{\r
+ DWORD bytes_ret;\r
+\r
+ if( !DeviceIoControl( h_dev, ioctl_code, p_in_buf, (DWORD)in_size,\r
+ p_out_buf, (DWORD)out_size, &bytes_ret, (LPOVERLAPPED)p_async_info ) )\r
+ {\r
+ if( GetLastError() == ERROR_IO_PENDING )\r
+ return CL_PENDING;\r
+ else\r
+ return CL_ERROR;\r
+ }\r
+\r
+ *p_ret_bytes = bytes_ret;\r
+ return CL_SUCCESS;\r
+}\r
+\r
+\r
+CL_INLINE cl_status_t CL_API\r
+cl_ioctl_result(\r
+ IN void *h_dev,\r
+ IN void *p_async_info,\r
+ OUT size_t *p_ret_bytes,\r
+ IN boolean_t blocking )\r
+{\r
+ DWORD bytes_ret;\r
+\r
+ if( !GetOverlappedResult(\r
+ h_dev, (LPOVERLAPPED)p_async_info, &bytes_ret, blocking ) )\r
+ {\r
+ if( GetLastError() == ERROR_IO_INCOMPLETE )\r
+ return CL_NOT_DONE;\r
+ else\r
+ return CL_ERROR;\r
+ }\r
+\r
+ *p_ret_bytes = bytes_ret;\r
+ return CL_SUCCESS;\r
+}\r
+\r
+\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif /* __cplusplus */\r
+\r
+\r
+#endif // _CL_IOCTL_OSD_H_\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+/*\r
+ * Abstract:\r
+ * Defines platform specific memory related functions.\r
+ *\r
+ * Environment:\r
+ * Windows User Mode\r
+ */\r
+\r
+\r
+#ifndef _CL_MEMORY_OSD_H_\r
+#define _CL_MEMORY_OSD_H_\r
+\r
+\r
+#include <complib/cl_types.h>\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif\r
+\r
+\r
+CL_INLINE void CL_API\r
+cl_memset(\r
+ IN void* const p_memory, \r
+ IN const uint8_t fill, \r
+ IN const size_t count )\r
+{\r
+ RtlFillMemory( p_memory, count, fill );\r
+}\r
+\r
+\r
+CL_INLINE void* CL_API\r
+cl_memcpy(\r
+ IN void* const p_dest, \r
+ IN const void* const p_src, \r
+ IN const size_t count )\r
+{\r
+ RtlCopyMemory( p_dest, p_src, count );\r
+ return p_dest;\r
+}\r
+\r
+\r
+CL_INLINE int32_t CL_API\r
+cl_memcmp(\r
+ IN const void* const p_memory1,\r
+ IN const void* const p_memory2, \r
+ IN const size_t count )\r
+{\r
+ return( memcmp( p_memory1, p_memory2, count ) );\r
+}\r
+\r
+\r
+#define _CL_MEMCLR_DEFINED_\r
+CL_INLINE void CL_API\r
+cl_memclr(\r
+ IN void* const p_memory,\r
+ IN const size_t count )\r
+{\r
+ RtlSecureZeroMemory( p_memory, count );\r
+}\r
+\r
+\r
+#ifdef __cplusplus\r
+} /* extern "C" */\r
+#endif\r
+\r
+#endif /* _CL_MEMORY_OSD_H_ */\r
+\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+/*\r
+ * Abstract:\r
+ * Declaration of mutex object.\r
+ *\r
+ * Environment:\r
+ * Windows User Mode\r
+ */\r
+\r
+\r
+#ifndef _CL_MUTEX_OSD_H_\r
+#define _CL_MUTEX_OSD_H_\r
+\r
+\r
+#include <complib/cl_types.h>\r
+\r
+\r
+typedef HANDLE cl_mutex_t;\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif\r
+\r
+\r
+CL_INLINE void CL_API\r
+cl_mutex_construct(\r
+ IN cl_mutex_t* const p_mutex )\r
+{\r
+ *p_mutex = NULL;\r
+}\r
+\r
+\r
+CL_INLINE cl_status_t CL_API\r
+cl_mutex_init(\r
+ IN cl_mutex_t* const p_mutex )\r
+{\r
+ *p_mutex = CreateMutex( NULL, FALSE, NULL );\r
+ if( *p_mutex )\r
+ return CL_SUCCESS;\r
+ else\r
+ return CL_ERROR;\r
+}\r
+\r
+\r
+CL_INLINE void CL_API\r
+cl_mutex_destroy(\r
+ IN cl_mutex_t* const p_mutex )\r
+{\r
+ CloseHandle( *p_mutex );\r
+}\r
+\r
+\r
+CL_INLINE void CL_API\r
+cl_mutex_acquire(\r
+ IN cl_mutex_t* const p_mutex )\r
+{\r
+ WaitForSingleObject( *p_mutex, INFINITE );\r
+}\r
+\r
+\r
+CL_INLINE void CL_API\r
+cl_mutex_release(\r
+ IN cl_mutex_t* const p_mutex )\r
+{\r
+ ReleaseMutex( *p_mutex );\r
+}\r
+\r
+\r
+#ifdef __cplusplus\r
+} /* extern "C" */\r
+#endif\r
+\r
+#endif /* _CL_MUTEX_OSD_H_ */\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+\r
+\r
+/* Note: The lack of conditional inclusion is intentional. */\r
+#include <poppack.h>\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+\r
+\r
+/* Note: The lack of conditional inclusion is intentional. */\r
+#include <pshpack1.h>\r
+\r
+\r
+/*\r
+ * Abstract:\r
+ * Turns on byte packing, which is necessary for passing information from\r
+ * system to system over a network to ensure no padding by the compiler has \r
+ * taken place.\r
+ *\r
+ * Note:\r
+ * No Robodoc documentation as with other headers.\r
+ */\r
+\r
+#ifndef PACK_SUFFIX\r
+#define PACK_SUFFIX\r
+#endif \r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+\r
+\r
+#ifndef _CL_SPINLOCK_OSD_H_\r
+#define _CL_SPINLOCK_OSD_H_\r
+\r
+\r
+#include "cl_types.h"\r
+\r
+\r
+/* Spinlock object definition. */\r
+typedef struct _cl_spinlock\r
+{\r
+ CRITICAL_SECTION crit_sec;\r
+ /* The flag is necessary to conditionally destroy the critical section. */\r
+ boolean_t initialized;\r
+\r
+} cl_spinlock_t;\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif\r
+\r
+\r
+CL_INLINE void CL_API\r
+cl_spinlock_construct(\r
+ IN cl_spinlock_t* const p_spinlock )\r
+{\r
+ p_spinlock->initialized = FALSE;\r
+}\r
+\r
+\r
+CL_INLINE cl_status_t CL_API\r
+cl_spinlock_init(\r
+ IN cl_spinlock_t* const p_spinlock )\r
+{\r
+ CL_ASSERT( p_spinlock );\r
+\r
+ cl_spinlock_construct( p_spinlock );\r
+\r
+ /*\r
+ * Documentation recommends a spin count ~4K.\r
+ * High bit set to force pre-allocation of event.\r
+ */\r
+ if( !InitializeCriticalSectionAndSpinCount( \r
+ &p_spinlock->crit_sec, 0x80001000 ) )\r
+ {\r
+ return( CL_ERROR );\r
+ }\r
+\r
+ p_spinlock->initialized = TRUE;\r
+ return( CL_SUCCESS );\r
+}\r
+\r
+\r
+CL_INLINE void CL_API\r
+cl_spinlock_destroy(\r
+ IN cl_spinlock_t* const p_spinlock )\r
+{\r
+ CL_ASSERT( p_spinlock );\r
+\r
+ if( p_spinlock->initialized )\r
+ {\r
+ p_spinlock->initialized = FALSE;\r
+ DeleteCriticalSection( &p_spinlock->crit_sec );\r
+ }\r
+}\r
+\r
+\r
+CL_INLINE void CL_API\r
+cl_spinlock_acquire(\r
+ IN cl_spinlock_t* const p_spinlock )\r
+{\r
+ CL_ASSERT( p_spinlock && p_spinlock->initialized );\r
+\r
+ EnterCriticalSection( &p_spinlock->crit_sec );\r
+}\r
+\r
+\r
+CL_INLINE void CL_API\r
+cl_spinlock_release(\r
+ IN cl_spinlock_t* const p_spinlock )\r
+{\r
+ CL_ASSERT( p_spinlock && p_spinlock->initialized );\r
+\r
+ LeaveCriticalSection( &p_spinlock->crit_sec );\r
+}\r
+\r
+\r
+#ifdef __cplusplus\r
+} // extern "C"\r
+#endif\r
+\r
+#endif // _CL_SPINLOCK_OSD_H_\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+\r
+\r
+#ifndef _CL_SYS_CALLBACK_OSD_H_\r
+#define _CL_SYS_CALLBACK_OSD_H_\r
+\r
+\r
+#include "cl_types.h"\r
+\r
+\r
+typedef struct _cl_sys_callback_item\r
+{\r
+ cl_pfn_sys_callback_t pfn_callback;\r
+ const void* get_context;\r
+ const void* queue_context;\r
+\r
+} cl_sys_callback_item_t;\r
+\r
+\r
+#endif // _CL_SYS_CALLBACK_OSD_H_
\ No newline at end of file
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+\r
+\r
+#ifndef _CL_THREAD_OSD_H_\r
+#define _CL_THREAD_OSD_H_\r
+\r
+\r
+#include "cl_types.h"\r
+#include "cl_timer.h"\r
+\r
+\r
+/* OS specific information about the thread. */\r
+typedef struct _cl_thread_osd\r
+{\r
+ HANDLE h_thread;\r
+ DWORD thread_id;\r
+\r
+} cl_thread_osd_t;\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif\r
+\r
+CL_INLINE void CL_API\r
+cl_thread_suspend(\r
+ IN const uint32_t pause_ms )\r
+{\r
+ Sleep( pause_ms );\r
+}\r
+\r
+\r
+CL_INLINE void CL_API\r
+cl_thread_stall(\r
+ IN const uint32_t pause_us )\r
+{\r
+ uint64_t end_time;\r
+\r
+ end_time = cl_get_time_stamp() + pause_us;\r
+\r
+ /* Spin. */\r
+ while( cl_get_time_stamp() < end_time )\r
+ ;\r
+}\r
+\r
+\r
+CL_INLINE boolean_t CL_API\r
+cl_is_blockable( void )\r
+{\r
+ return TRUE;\r
+}\r
+\r
+\r
+#ifdef __cplusplus\r
+} // extern "C"\r
+#endif\r
+\r
+\r
+#endif // _CL_THREAD_OSD_H_\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+\r
+\r
+#ifndef _CL_TIMER_OSD_H_\r
+#define _CL_TIMER_OSD_H_\r
+\r
+\r
+#include "cl_types.h"\r
+\r
+\r
+/* Timer object definition. */\r
+typedef struct _cl_timer\r
+{\r
+ HANDLE h_timer;\r
+ cl_pfn_timer_callback_t pfn_callback;\r
+ const void *context;\r
+ uint64_t timeout_time;\r
+ DWORD thread_id;\r
+\r
+} cl_timer_t;\r
+\r
+\r
+#endif // _CL_TIMER_OSD_H_
\ No newline at end of file
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+\r
+\r
+#ifndef _CL_TYPES_OSD_H_\r
+#define _CL_TYPES_OSD_H_\r
+\r
+\r
+#if !defined( WINVER )\r
+ // Enable Windows 2000 features.\r
+ #define _WIN32_WINNT 0x0500\r
+ #define WINVER 0x0500\r
+#else // !defined( WINVER )\r
+ #if(WINVER < 0x0500)\r
+ // Force a compile error.\r
+ #error The component library requires Windows 2000 features. \\r
+ WINVER and _WIN32_WINNT must be set to 0x0500 or greater.\r
+ #elif !defined(_WIN32_WINNT)\r
+ #define _WIN32_WINNT WINVER\r
+ #endif\r
+#endif // !defined( WINVER )\r
+\r
+#if _WIN32_WINNT != WINVER && _WIN32_WINNT != 0x0500 && WINVER != 0x501\r
+ #error _WIN32_WINNT does not match WINVER.\r
+#endif // _WIN32_WINNT != WINVER\r
+\r
+#if !defined( _WINDOWS_ )\r
+ // Include the windows header file.\r
+ #include <windows.h>\r
+#endif // !defined( _WINDOWS_ )\r
+\r
+#if defined( _DEBUG ) || DBG\r
+ #define _DEBUG_\r
+#else\r
+ #undef _DEBUG_\r
+#endif\r
+\r
+#ifdef __GNUC__\r
+\r
+#include <stdint.h>\r
+typedef intptr_t intn_t;\r
+typedef uintptr_t uintn_t; \r
+typedef volatile uint32_t atomic32_t;\r
+\r
+#else /* __GNUC__ */\r
+\r
+typedef __int8 int8_t;\r
+typedef unsigned __int8 uint8_t;\r
+typedef __int16 int16_t;\r
+typedef unsigned __int16 uint16_t;\r
+typedef __int32 int32_t;\r
+typedef unsigned __int32 uint32_t;\r
+typedef __int64 int64_t;\r
+typedef unsigned __int64 uint64_t;\r
+typedef unsigned char uchar_t;\r
+typedef _W64 __int3264 intn_t;\r
+typedef _W64 unsigned __int3264 uintn_t;\r
+typedef volatile __int32 atomic32_t;\r
+\r
+#endif /* __GNUC__ */\r
+\r
+/* boolean_t must be intergral sized to avoid a bunch of warnings. */\r
+typedef int boolean_t;\r
+\r
+\r
+#ifndef CL_ASSERT\r
+#ifdef _DEBUG_\r
+#define CL_ASSERT( exp ) (void)(!(exp)?OutputDebugString("Assertion Failed:" #exp "\n"),DebugBreak(),FALSE:TRUE)\r
+#else\r
+#define CL_ASSERT( exp )\r
+#endif /* _DEBUG_ */\r
+#endif /* CL_ASSERT */\r
+\r
+\r
+#define UNUSED_PARAM UNREFERENCED_PARAMETER\r
+#if defined(EVENT_TRACING)\r
+#define UNUSED_PARAM_WOWPP(a)\r
+#else\r
+#define UNUSED_PARAM_WOWPP(a)UNREFERENCED_PARAMETER(a)\r
+#endif\r
+\r
+#if !defined(EXPORT_CL_SYMBOLS)\r
+#define CL_EXPORT DECLSPEC_IMPORT\r
+#else\r
+#define CL_EXPORT __declspec(dllexport)\r
+#endif\r
+\r
+#if !defined( __cplusplus )\r
+#define inline __inline\r
+#endif\r
+\r
+#define CL_INLINE CL_EXPORT inline\r
+\r
+#define CL_API __stdcall\r
+\r
+#define cl_panic abort\r
+\r
+#ifndef offsetof\r
+#define offsetof FIELD_OFFSET\r
+#endif\r
+\r
+#define PARENT_STRUCT( P, T, M ) CONTAINING_RECORD( (void*)P, T, M )\r
+\r
+#ifdef __GNUC__\r
+#define CL_CONST64( x ) x##LLU\r
+#else\r
+#define CL_CONST64( x ) x##ui64\r
+#endif\r
+\r
+\r
+#if !defined( __cplusplus )\r
+#define inline __inline\r
+#endif\r
+\r
+\r
+#endif // _CL_TYPES_OSD_H_\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+\r
+\r
+\r
+#ifndef _CL_WAITOBJ_OSD_H_\r
+#define _CL_WAITOBJ_OSD_H_\r
+\r
+\r
+#include <complib/cl_types.h>\r
+#include <complib/cl_event.h>\r
+\r
+typedef cl_event_t cl_waitobj_handle_t;\r
+\r
+#ifdef __cplusplus\r
+extern "C"\r
+{\r
+#endif /* __cplusplus */\r
+\r
+\r
+CL_INLINE cl_status_t CL_API\r
+cl_waitobj_create(\r
+ IN const boolean_t manual_reset, \r
+ OUT cl_waitobj_handle_t* const ph_wait_obj )\r
+{\r
+ cl_event_construct( ph_wait_obj );\r
+ return cl_event_init( ph_wait_obj, manual_reset );\r
+}\r
+\r
+\r
+CL_INLINE cl_status_t CL_API\r
+cl_waitobj_destroy(\r
+ IN cl_waitobj_handle_t h_wait_obj )\r
+{\r
+ /*\r
+ * Note that we can take the address of the function parameter *only*\r
+ * because the wait object (and cl_event_t) is just a HANDLE, so\r
+ * copying it works.\r
+ */\r
+ cl_event_destroy( &h_wait_obj );\r
+ return CL_SUCCESS;\r
+}\r
+\r
+\r
+CL_INLINE cl_status_t CL_API\r
+cl_waitobj_signal(\r
+ IN cl_waitobj_handle_t h_wait_obj )\r
+{\r
+ /*\r
+ * Note that we can take the address of the function parameter *only*\r
+ * because the wait object (and cl_event_t) is just a HANDLE, so\r
+ * copying it works.\r
+ */\r
+ return cl_event_signal( &h_wait_obj );\r
+}\r
+\r
+\r
+CL_INLINE cl_status_t CL_API\r
+cl_waitobj_reset(\r
+ IN cl_waitobj_handle_t h_wait_obj )\r
+{\r
+ /*\r
+ * Note that we can take the address of the function parameter *only*\r
+ * because the wait object (and cl_event_t) is just a HANDLE, so\r
+ * copying it works.\r
+ */\r
+ return cl_event_reset( &h_wait_obj );\r
+}\r
+\r
+\r
+CL_INLINE cl_status_t CL_API\r
+cl_waitobj_wait_on(\r
+ IN cl_waitobj_handle_t h_wait_obj,\r
+ IN const uint32_t wait_us,\r
+ IN const boolean_t interruptible )\r
+{\r
+ /*\r
+ * Note that we can take the address of the function parameter *only*\r
+ * because the wait object (and cl_event_t) is just a HANDLE, so\r
+ * copying it works.\r
+ */\r
+ return cl_event_wait_on( &h_wait_obj, wait_us, interruptible );\r
+}\r
+\r
+\r
+#ifdef __cplusplus\r
+} /* extern "C" */\r
+#endif /* __cplusplus */\r
+\r
+\r
+#endif /* _CL_WAITOBJ_OSD_H_ */\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. \r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+#ifndef __IB_UAL_UVP_H__\r
+#define __IB_UAL_UVP_H__\r
+\r
+#include <complib/cl_types.h>\r
+#include <iba/ib_types.h>\r
+#include <iba/ib_ci.h>\r
+\r
+/****h* UAL_UVP_Interface/user-mode Verbs\r
+* NAME\r
+* User-mode Verbs -- User-mode Verbs implements the HCA specific\r
+* user-mode functions to plug in to the Usermode Access Layer\r
+* Architecture (UAL)\r
+*\r
+* COPYRIGHT\r
+* Copyright© 2001 Intel Corporation - All Rights Reserved.\r
+* DESCRIPTION\r
+* The user-mode Verbs Interface defines the mechanism for a HCA vendor\r
+* to plug into the User-mode Access Layer (UAL) architecture.\r
+* Access Layer API is what is exposed to the user-mode applications.\r
+* The interface described here is not Verbs API. In this interface model,\r
+* UAL provides a generic mechanism to exchange vendor specific info\r
+* in the implementation of verbs within the UAL architecture. UAL provides\r
+* the support for callback processing. For instance, AL provides a\r
+* QP error callback when a qp incurs error. Such asynchronous events are\r
+* handled with the support of UAL and not by the vendor interface described\r
+* here.\r
+*\r
+* For verbs related AL APIs, UAL packages the parameters in an IOCTL\r
+* and sends it to the kernel AL. In the UAL design, this is broken down\r
+* into 3 steps.\r
+*\r
+* a. Pre-ioctl step\r
+* A vendor specified pre-ioctl function is called with relevant input\r
+* parameters including a private buffer template (ci_umv_buf_t)\r
+* for the vendor to communicate with the corresponding HCA driver.\r
+* For calls that does not go to the HCA driver (for e.g. ib_open_ca())\r
+* no private buffer will be passed.\r
+* b. Sending IOCTL to kernel AL\r
+* Following step (a), UAL prepares an IOCTL with the relevant parameters\r
+* including the vendor's private buffer. UAL/user-mode proxy does not\r
+* interpret the contents of the private buffer.\r
+* UAL sends the IOCTL to the user-mode proxy in kernel. The proxy\r
+* interfaces with kernel AL to act on behalf the user. AL passes the\r
+* parameters to the Verbs Provider Driver and the results are returned\r
+* back to UAL.\r
+* c. Post-ioctl step.\r
+* Following the return from IOCTL in step (b), UAL calls a\r
+* vendor-specified post-ioctl function with relevant parameters.\r
+* UAL will call the post-ioctl function whether or not step (b)\r
+* succeeded. The ioctl itself could have successfully returned but\r
+* a vendor-specific status in ci_umv_buf_t may indicate a failure.\r
+* UAL also passes the ioctl status to the vendor library so that\r
+* the appropriate action can be taken in the post call.\r
+*\r
+* Use of ci_umv_buf_t and pre/post return values\r
+*\r
+* 1. ci_umv_buf is provided by UAL as a unique buffer template for\r
+* a given verbs call. Vendor could keep any info relevant to\r
+* the specific verbs call in this buffer. This buffer is sufficient\r
+* for uniquely identifying which call it is intended for. For instance,\r
+* the umv buffer set up by vendor in a uvp_pre_create_qp() could later\r
+* tell the uvp_post_create_qp_t() which QP it is intended for.\r
+*\r
+* 2. The success of pre/post-ioctl step to UAL means IB_SUCCESS.\r
+* Any value other than IB_SUCCESS is treated as failure.\r
+*\r
+* 3. The Vendor could exchange a status in ci_umv_buf_t. However, this\r
+* interface does not enumerate the status in ci_umv_buf_t.\r
+* However, the vendor could check the status in ci_umv_buf_t\r
+* returned from the pre-ioctl step and act accordingly.\r
+*\r
+* AUTHOR\r
+* Intel Corporation\r
+* CREATION DATE\r
+* XX.XX.XX\r
+* NOTES\r
+* 1. For user mode verbs that require a kernel transition, handles passed\r
+* to kernel are validated in the user-mode proxy running in kernel.\r
+* Those Verbs that are entirely done in user mode that would affect\r
+* speed path do not perform consistency checks. So invalid pointers\r
+* would lead to application crash with core dumps.\r
+*\r
+*******\r
+*\r
+*/\r
+\r
+/******/\r
+\r
+/******/\r
+\r
+/*\r
+*\r
+* Vendor-specific handles\r
+*\r
+*/\r
+\r
+/****f* user-mode Verbs/unsupported functions\r
+* NAME\r
+* 1. Register physical memory region with HCA (ci_register_pmr)\r
+* 2. Modify physical memory region with HCA (ci_modify_pmr)\r
+* 3. Create Special QP (ci_create_spl_qp)\r
+*\r
+* For all these functions, the vendor does NOT provide support\r
+* and UAL will return IB_UNSUPPORTED to the caller of Access Layer.\r
+*\r
+* SYNOPSIS\r
+*/\r
+\r
+/********/\r
+\r
+/****f* user-mode Verbs/uvp_pre_open_ca_t\r
+* NAME\r
+* uvp_pre_open_ca_t -- Pre-ioctl operation for user-mode ib_open_ca()\r
+*\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(AL_API *uvp_pre_open_ca_t) (\r
+ IN const ib_net64_t ca_guid,\r
+ IN OUT ci_umv_buf_t *p_umv_buf,\r
+ OUT ib_ca_handle_t *ph_uvp_ca);\r
+\r
+/*\r
+* DESCRIPTION\r
+* uvp_pre_open_ca_t() is implemented by vendor. It is the pre-ioctl routine\r
+* for the AL call ib_open_ca() in user-mode.\r
+*\r
+*\r
+* PARAMETERS\r
+* ca_guid\r
+* [in] The HCA adapter's EUI64 identifier. Clients would use other\r
+* enumeration API's to locate all available adapters and their\r
+* guids in a system, e.g. GetCaGuids(), maintained by the IB\r
+* Access Layer.\r
+*\r
+* p_umv_buf\r
+* [in out] On input, UAL provides this buffer template.\r
+* On return from this function, p_umv_buf contains any vendor-specific\r
+* record to be exchanged with the vendor's HCA driver.\r
+\r
+* ph_uvp_ca\r
+* [out] (OPTIONAL) Vendor's Handle to the newly opened instance of the CA.\r
+*\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The pre-ioctl function succeeded.\r
+* IB_INSUFFICIENT_RESOURCES\r
+* Insufficient resources to satisfy request.\r
+* IB_INVALID_PARAMETER\r
+* Invalid GUID.\r
+*\r
+* PORTABILITY\r
+* User Mode\r
+*\r
+* SEE ALSO\r
+* uvp_post_open_ca_t, uvp_pre_query_ca, uvp_post_query_ca_t, uvp_pre_modify_ca,\r
+* uvp_post_modify_ca_t, uvp_pre_close_ca_t, uvp_post_close_ca_t\r
+*\r
+*********/\r
+\r
+/********/\r
+\r
+/****f* user-mode Verbs/uvp_post_open_ca_t\r
+* NAME\r
+* uvp_post_open_ca_t -- Post-ioctl operation for user-mode ib_open_ca()\r
+*\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(AL_API *uvp_post_open_ca_t) (\r
+ IN const ib_net64_t ca_guid,\r
+ IN ib_api_status_t ioctl_status,\r
+ IN OUT ib_ca_handle_t *ph_uvp_ca,\r
+ IN ci_umv_buf_t *p_umv_buf );\r
+/*\r
+* DESCRIPTION\r
+* uvp_post_open_ca_t() is implemented by vendor. It is the post-ioctl routine\r
+* for the AL call ib_open_ca() in user-mode.\r
+*\r
+* PARAMETERS\r
+* ca_guid\r
+* [in] The HCA adapter's EUI64 identifier.\r
+* ioctl_status\r
+* [in] The ioctl status of the AL API.\r
+* ph_uvp_ca\r
+* [in out] Pointer to vendor's handle to the newly opened instance of\r
+* the CA. If it specified in pre function than it must be the same value here.\r
+* p_umv_buf\r
+* [in] This contains any vendor-specific private information\r
+* exchanged with the vendor's Verbs Provider Driver (uvp_pre_open_ca).\r
+* Vendor is expected to check vendor-specific status in\r
+* umv_buf as appropriate.\r
+*\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The HCA is return handle is valid.\r
+* IB_INSUFFICIENT_RESOURCES\r
+* Insufficient resources to satisfy request.\r
+*\r
+* PORTABILITY\r
+* User Mode\r
+*\r
+* SEE ALSO\r
+* uvp_pre_open_ca_t, uvp_pre_query_ca, uvp_post_query_ca_t, uvp_pre_modify_ca,\r
+* uvp_post_modify_ca_t, uvp_pre_close_ca_t, uvp_post_close_ca_t\r
+*\r
+*********/\r
+\r
+/********/\r
+\r
+/****f* user-mode Verbs/uvp_pre_query_ca\r
+* NAME\r
+* uvp_pre_query_ca -- Pre-ioctl operation for user-mode ib_query_ca()\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef ib_api_status_t\r
+(AL_API *uvp_pre_query_ca) (\r
+ IN ib_ca_handle_t h_uvp_ca,\r
+ IN ib_ca_attr_t *p_ca_attr,\r
+ IN size_t byte_count,\r
+ IN ci_umv_buf_t *p_umv_buf );\r
+/*\r
+* DESCRIPTION\r
+* uvp_pre_query_ca() is implemented by vendor. It is the pre-ioctl routine\r
+* for the AL call ib_query_ca() in user-mode.\r
+*\r
+* PARAMETERS\r
+* h_uvp_ca\r
+* [in] Vendor's user-mode library handle to the open instance of the CA\r
+* p_ca_attr\r
+* [in] Pointer to the user's CA attribute buffer.\r
+* byte_count\r
+* [in] User-supplied size of the CA attribute buffer.\r
+* p_umv_buf\r
+* [in out] On input, UAL provides this buffer template.\r
+* On return from this function, p_umv_buf contains any vendor-specific\r
+* record to be exchanged with the vendor's HCA driver.\r
+*\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The pre-ioctl function succeeded.\r
+* IB_INVALID_CA_HANDLE\r
+* CA handle is invalid\r
+* IB_INSUFFICIENT_RESOURCES\r
+* Insufficient resources to satisfy request.\r
+*\r
+* PORTABILITY\r
+* User Mode\r
+*\r
+* SEE ALSO\r
+* uvp_pre_open_ca_t, uvp_post_open_ca_t, uvp_post_query_ca_t, uvp_pre_modify_ca,\r
+* uvp_post_modify_ca_t, uvp_pre_close_ca_t, uvp_post_close_ca_t\r
+*\r
+*********/\r
+\r
+/********/\r
+\r
+/****f* user-mode Verbs/uvp_post_query_ca_t\r
+* NAME\r
+* uvp_post_query_ca_t -- Post-ioctl operation for user-mode ib_query_ca()\r
+*\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef void\r
+(AL_API *uvp_post_query_ca_t) (\r
+ IN ib_ca_handle_t h_uvp_ca,\r
+ IN ib_api_status_t ioctl_status,\r
+ IN ib_ca_attr_t *p_ca_attr,\r
+ IN size_t byte_count,\r
+ IN ci_umv_buf_t *p_umv_buf );\r
+/*\r
+* DESCRIPTION\r
+* uvp_post_query_ca_t() is implemented by vendor. It is the post-ioctl routine\r
+* for the AL call ib_query_ca() in user-mode. UAL provides the results\r
+* of querying the CA attributes to the vendor's post-ioctl routine.\r
+*\r
+* PARAMETERS\r
+* h_uvp_ca\r
+* [in] Vendor's user-mode library handle to the open instance of the CA\r
+* ioctl_status\r
+* [in] The ioctl status of the AL API.\r
+* p_ca_attr\r
+* [in] CA attribute of this Host Channel adapter (as returned by\r
+* from ioctl to kernel AL).\r
+* byte_count\r
+* [in] Number of bytes in ca_attr buffer.\r
+* p_umv_buf\r
+* [in ] This contains any vendor-specific private information\r
+* exchanged with the vendor's Verbs Provider Driver (uvp_pre_query_ca).\r
+* Vendor is expected to check vendor-specific status in\r
+* umv_buf as appropriate.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* PORTABILITY\r
+* User Mode\r
+*\r
+* SEE ALSO\r
+* uvp_pre_open_ca_t, uvp_post_open_ca_t, uvp_pre_query_ca, uvp_pre_modify_ca,\r
+* uvp_post_modify_ca_t, uvp_pre_close_ca_t, uvp_post_close_ca_t\r
+*\r
+*********/\r
+\r
+/********/\r
+\r
+/****f* user-mode Verbs/uvp_pre_modify_ca\r
+* NAME\r
+* uvp_pre_modify_ca -- Pre-ioctl operation for user-mode ib_modify_ca()\r
+*\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(AL_API *uvp_pre_modify_ca) (\r
+ IN ib_ca_handle_t h_uvp_ca,\r
+ IN uint8_t port_num,\r
+ IN ib_ca_mod_t ca_mod,\r
+ IN const ib_port_attr_mod_t* const p_port_attr_mod );\r
+\r
+/*\r
+* DESCRIPTION\r
+* uvp_pre_modify_ca() is implemented by vendor. It is the pre-ioctl routine\r
+* for the AL call ib_modify_ca() in user-mode.\r
+*\r
+* PARAMETERS\r
+* h_uvp_ca\r
+* [in] Vendor's user-mode library handle to the open instance of the CA\r
+* port_num\r
+* [in] An index to the port that is being modified. The port_num matches\r
+* the index of the port as returned through the ib_query_ca call.\r
+* ca_mod\r
+* [in] A mask of the attributes and counters to modify.\r
+* p_port_attr_mod\r
+* [in] A list of the specific port attribute information to modify. For\r
+* the access layer to modify an attribute, its corresponding bit must be\r
+* set in the ca_mod parameter.\r
+*\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The pre-ioctl function succeeded.\r
+* IB_INVALID_CA_HANDLE\r
+* CA handle is invalid.\r
+* IB_INVALID_PARAMETER\r
+* One or more parameters is invalid.\r
+*\r
+* PORTABILITY\r
+* User Mode\r
+*\r
+* SEE ALSO\r
+* uvp_pre_open_ca_t, uvp_post_open_ca_t, uvp_pre_query_ca, uvp_post_query_ca_t,\r
+* uvp_post_modify_ca_t, uvp_pre_close_ca_t, uvp_post_close_ca_t\r
+*\r
+*********/\r
+\r
+/********/\r
+\r
+/****f* user-mode Verbs/uvp_post_modify_ca_t\r
+* NAME\r
+* uvp_post_modify_ca_t -- Post-ioctl operation for user-mode ib_modify_ca()\r
+*\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef void\r
+(AL_API *uvp_post_modify_ca_t) (\r
+ IN ib_ca_handle_t h_uvp_ca,\r
+ IN ib_api_status_t ioctl_status );\r
+\r
+/*\r
+* DESCRIPTION\r
+* uvp_post_modify_ca_t() is implemented by vendor. It is the post-ioctl routine\r
+* for the AL call ib_modify_ca() in user-mode.\r
+*\r
+* PARAMETERS\r
+* h_uvp_ca\r
+* [in] Vendor's user-mode library handle to the open instance of the CA\r
+* ioctl_status\r
+* [in] The ioctl status of the AL API.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* PORTABILITY\r
+* User Mode\r
+*\r
+* SEE ALSO\r
+* uvp_pre_open_ca_t, uvp_post_open_ca_t, uvp_pre_query_ca, uvp_post_query_ca_t,\r
+* uvp_pre_modify_ca, uvp_pre_close_ca_t, uvp_post_close_ca_t\r
+*\r
+*********/\r
+\r
+/********/\r
+\r
+/****f* user-mode Verbs/uvp_pre_close_ca_t\r
+* NAME\r
+* uvp_pre_close_ca_t -- Pre-ioctl operation for user-mode ib_close_ca().\r
+*\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(AL_API *uvp_pre_close_ca_t) (\r
+ IN ib_ca_handle_t h_uvp_ca );\r
+\r
+/*\r
+* DESCRIPTION\r
+* uvp_pre_close_ca_t() is implemented by vendor. It is the pre-ioctl routine\r
+* for the AL call ib_close_ca() in user-mode.\r
+*\r
+* PARAMETERS\r
+* h_uvp_ca\r
+* [in] Vendor's user-mode library handle to the open instance of the CA\r
+*\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* Successfully completed the pre-ioctl.\r
+*\r
+* PORTABILITY\r
+* User Mode\r
+*\r
+* SEE ALSO\r
+* uvp_pre_open_ca_t, uvp_post_open_ca_t, uvp_pre_query_ca, uvp_post_query_ca_t,\r
+* uvp_pre_modify_ca, uvp_post_modify_ca_t, uvp_post_close_ca_t\r
+*\r
+*********/\r
+\r
+/********/\r
+\r
+/****f* user-mode Verbs/uvp_post_close_ca_t\r
+* NAME\r
+* uvp_post_close_ca_t -- Post-ioctl operation for user-mode ib_close_ca().\r
+*\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(AL_API *uvp_post_close_ca_t) (\r
+ IN ib_ca_handle_t h_uvp_ca,\r
+ IN ib_api_status_t ioctl_status );\r
+\r
+/*\r
+* DESCRIPTION\r
+* uvp_post_close_ca_t() is implemented by vendor. It is the post-ioctl routine\r
+* for the AL call ib_close_ca().\r
+* UAL calls this function in the context of the asynchronous callback\r
+* from AL notifying the successful destruction of CA.\r
+*\r
+* PARAMETERS\r
+* h_uvp_ca\r
+* [in] Vendor's user-mode library handle to the open instance of the CA\r
+*\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The post-ioctl for ib_close_ca() successfully completed.\r
+*\r
+* PORTABILITY\r
+* User Mode\r
+*\r
+* SEE ALSO\r
+* uvp_pre_open_ca_t, uvp_post_open_ca_t, uvp_pre_query_ca, uvp_post_query_ca_t,\r
+* uvp_pre_modify_ca, uvp_post_modify_ca_t, uvp_pre_close_ca_t\r
+*\r
+*********/\r
+\r
+/********/\r
+\r
+/****f* user-mode Verbs/uvp_pre_ci_call\r
+* NAME\r
+* uvp_pre_ci_call -- Pre-ioctl function to ib_ci_call\r
+*\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(AL_API *uvp_pre_ci_call) (\r
+ IN const ib_ca_handle_t h_uvp_ca,\r
+ IN const void* __ptr64 * const handle_array OPTIONAL,\r
+ IN uint32_t num_handles,\r
+ IN ib_ci_op_t* const p_ci_op,\r
+ IN OUT ci_umv_buf_t *p_umv_buf);\r
+/*\r
+* DESCRIPTION\r
+* uvp_pre_ci_call() is implemented by vendor. It is the pre-ioctl\r
+* routine for ib_ci_call().\r
+*\r
+* PARAMETERS\r
+* h_uvp_ca\r
+* [in] Vendor's user-mode library handle to the CA\r
+* handle_array\r
+* [in] An array of uvp handles. For valid types, refer to ib_ci.h or\r
+* ib_al.h. This is an optional parameter.\r
+* num_handles\r
+* [in] The number of handles in the array.\r
+* p_ci_op\r
+* [in] The operation that is requested by the client. For more info,\r
+* refer ib_types.h\r
+* p_umv_buf\r
+* [in out] On input, UAL provides this buffer template.\r
+* On return from this function, p_umv_buf contains\r
+* any vendor-specific record to be exchanged with the vendor's\r
+* HCA driver.\r
+*\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The pre-ioctl is successful.\r
+* IB_INSUFFICIENT_RESOURCES\r
+* Insufficient resources in Vendor library to complete the call\r
+*\r
+* PORTABILITY\r
+* User Mode\r
+*\r
+* SEE ALSO\r
+* uvp_post_ci_call\r
+*\r
+********/\r
+\r
+/********/\r
+\r
+/****f* user-mode Verbs/uvp_post_ci_call\r
+* NAME\r
+* uvp_post_ci_call -- Post-ioctl function to ib_ci_call\r
+*\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef void\r
+(AL_API *uvp_post_ci_call) (\r
+ IN const ib_ca_handle_t h_uvp_ca,\r
+ IN ib_api_status_t ioctl_status,\r
+ IN const void* __ptr64 * const handle_array OPTIONAL,\r
+ IN uint32_t num_handles,\r
+ IN ib_ci_op_t* const p_ci_op,\r
+ IN OUT ci_umv_buf_t *p_umv_buf);\r
+/*\r
+* DESCRIPTION\r
+* uvp_post_ci_call() is implemented by vendor. It is the pre-ioctl\r
+* routine for ib_ci_call().\r
+*\r
+* PARAMETERS\r
+* h_uvp_ca\r
+* [in] Vendor's user-mode library handle to the CA\r
+* ioctl_status\r
+* [in] The ioctl status of the AL API.\r
+* handle_array\r
+* [in] An array of uvp handles. For valid types, refer to ib_ci.h or\r
+* ib_al.h. This is an optional parameter.\r
+* num_handles\r
+* [in] The number of handles in the array.\r
+* p_ci_op\r
+* [in] The operation that is requested by the client. For more info,\r
+* refer ib_types.h\r
+* p_umv_buf\r
+* [in out] On input, UAL provides this buffer template.\r
+* On return from this function, p_umv_buf contains\r
+* any vendor-specific record to be exchanged with the vendor's\r
+* HCA driver.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* PORTABILITY\r
+* User Mode\r
+*\r
+* SEE ALSO\r
+* uvp_pre_ci_call\r
+*\r
+********/\r
+\r
+\r
+/********/\r
+\r
+/****f* user-mode Verbs/uvp_pre_allocate_pd\r
+* NAME\r
+* uvp_pre_allocate_pd -- Pre-ioctl function to allocate PD\r
+*\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(AL_API *uvp_pre_allocate_pd) (\r
+ IN ib_ca_handle_t h_uvp_ca,\r
+ IN OUT ci_umv_buf_t *p_umv_buf,\r
+ OUT ib_pd_handle_t *ph_uvp_pd);\r
+\r
+/*\r
+* DESCRIPTION\r
+* uvp_pre_allocate_pd() is implemented by vendor. It is the pre-ioctl routine\r
+* for the AL call ib_alloc_pd() in user-mode.\r
+*\r
+* PARAMETERS\r
+* h_uvp_ca\r
+* [in] Vendor's user-mode library handle to the open instance of the CA\r
+* p_umv_buf\r
+* [in out] On input, UAL provides this buffer template.\r
+* On return from this function, p_umv_buf contains\r
+* any vendor-specific record to be exchanged with the vendor's\r
+* HCA driver.\r
+* ph_uvp_pd\r
+* [out] (OPTIONAL) Vendor's Handle to the newly created protection domain.\r
+*\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The pre-ioctl call is successful.\r
+* IB_INVALID_CA_HANDLE\r
+* CA handle is invalid.\r
+* IB_INSUFFICIENT_RESOURCES\r
+* Insufficient resources in Vendor library to complete the call\r
+*\r
+* PORTABILITY\r
+* User Mode\r
+*\r
+* SEE ALSO\r
+* uvp_post_allocate_pd_t, uvp_pre_deallocate_pd, uvp_post_deallocate_pd_t\r
+*\r
+*******/\r
+\r
+/********/\r
+\r
+/****f* user-mode Verbs/uvp_post_allocate_pd_t\r
+* NAME\r
+* uvp_post_allocate_pd_t -- Post-ioctl function to allocate PD\r
+*\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef void\r
+(AL_API *uvp_post_allocate_pd_t) (\r
+ IN ib_ca_handle_t h_uvp_ca,\r
+ IN ib_api_status_t ioctl_status,\r
+ IN OUT ib_pd_handle_t *ph_uvp_pd,\r
+ IN ci_umv_buf_t *p_umv_buf );\r
+\r
+/*\r
+* DESCRIPTION\r
+* uvp_post_allocate_pd_t() is implemented by vendor. It is the post-ioctl\r
+* routine for the AL call ib_alloc_pd().\r
+*\r
+* PARAMETERS\r
+* h_uvp_ca\r
+* [in] Vendor's user-mode library CA handle.\r
+* ioctl_status\r
+* [in] The ioctl status of the AL API.\r
+* ph_uvp_pd\r
+* [in out] The vendor library handle to the newly created protection domain.\r
+* If it specified in pre function than it must be the same value here.\r
+* p_umv_buf\r
+* [in] This contains any vendor-specific private information\r
+* exchanged with the vendor's Verbs Provider Driver (uvp_pre_allocate_pd).\r
+* Vendor is expected to check vendor-specific status in\r
+* umv_buf as appropriate.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* PORTABILITY\r
+* User Mode\r
+*\r
+* SEE ALSO\r
+* uvp_pre_allocate_pd, uvp_pre_deallocate_pd, uvp_post_deallocate_pd_t\r
+*\r
+*******/\r
+\r
+/********/\r
+\r
+/****f* user-mode Verbs/uvp_pre_deallocate_pd\r
+* NAME\r
+* uvp_pre_deallocate_pd -- Pre-ioctl function to deallocate PD\r
+*\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(AL_API *uvp_pre_deallocate_pd) (\r
+ IN const ib_pd_handle_t h_uvp_pd );\r
+\r
+/*\r
+* DESCRIPTION\r
+* uvp_pre_deallocate_pd() is implemented by vendor. It is the pre-ioctl\r
+* routine for the AL call ib_deallocate_pd().\r
+*\r
+* PARAMETERS\r
+* h_uvp_pd\r
+* [in] Vendor's user-mode library PD handle.\r
+*\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The pre-ioctl call is successful.\r
+*\r
+* PORTABILITY\r
+* User Mode\r
+*\r
+* SEE ALSO\r
+* uvp_pre_allocate_pd, uvp_post_allocate_pd_t, uvp_post_deallocate_pd_t\r
+*\r
+*******/\r
+\r
+/********/\r
+\r
+/****f* user-mode Verbs/uvp_post_deallocate_pd_t\r
+* NAME\r
+* uvp_post_deallocate_pd_t -- Post-ioctl function to deallocate PD\r
+*\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef void\r
+(AL_API *uvp_post_deallocate_pd_t) (\r
+ IN const ib_pd_handle_t h_uvp_pd,\r
+ IN ib_api_status_t ioctl_status );\r
+\r
+/*\r
+* DESCRIPTION\r
+* uvp_post_deallocate_pd_t() is implemented by the vendor. It is the\r
+* post-ioctl routine for the AL call ib_dealloc_pd().\r
+*\r
+* When all the resouces associated with a PD are destroyed,\r
+* UAL invokes this post-ioctl routine to deallocate PD. Since the\r
+* completion of the resource deallocation (e.g QP/CQ) is asynchronous,\r
+* this function is called from a UAL asynchronous callback\r
+* processing thread.\r
+*\r
+* PARAMETERS\r
+* h_uvp_pd\r
+* [in] Vendor's user-mode library PD handle.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* PORTABILITY\r
+* User Mode\r
+*\r
+* SEE ALSO\r
+* uvp_pre_allocate_pd, uvp_post_allocate_pd_t, uvp_pre_deallocate_pd\r
+*\r
+*******/\r
+\r
+/********/\r
+\r
+/****f* user-mode Verbs/uvp_pre_create_av\r
+* NAME\r
+* uvp_pre_create_av -- Pre-ioctl function to create AV\r
+*\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(AL_API *uvp_pre_create_av) (\r
+ IN const ib_pd_handle_t h_uvp_pd,\r
+ IN const ib_av_attr_t *p_addr_vector,\r
+ IN OUT ci_umv_buf_t *p_umv_buf,\r
+ OUT ib_av_handle_t *ph_uvp_av);\r
+/*\r
+* DESCRIPTION\r
+* uvp_pre_create_av() is implemented by vendor. It is the pre-ioctl\r
+* routine for ib_create_av().\r
+*\r
+* PARAMETERS\r
+* h_uvp_pd\r
+* [in] Vendor's user-mode library handle to the Protection domain\r
+* to which this AV is associated.\r
+* p_addr_vector\r
+* [in] Parameters to create the address vector.\r
+* p_umv_buf\r
+* [in out] On input, UAL provides this buffer template.\r
+* On return from this function, p_umv_buf contains\r
+* any vendor-specific record to be exchanged with the vendor's\r
+* HCA driver.\r
+* ph_uvp_av\r
+* [out] (OPTIONAL) Vendor's Handle to the newly created address vector.\r
+*\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The pre-ioctl is successful.\r
+* IB_INVALID_SETTING\r
+* Values in the vector is not valid\r
+* IB_INVALID_PD_HANDLE\r
+* The PD handle is invalid.\r
+* IB_INSUFFICIENT_RESOURCES\r
+* Insufficient resources in Vendor library to complete the call\r
+*\r
+* PORTABILITY\r
+* User Mode\r
+*\r
+* SEE ALSO\r
+* uvp_post_create_av_t, uvp_pre_query_av, uvp_post_query_av_t, uvp_pre_modify_av,\r
+* uvp_post_modify_av_t, uvp_pre_destroy_av, uvp_post_destroy_av_t\r
+*\r
+********/\r
+\r
+/********/\r
+\r
+/****f* user-mode Verbs/uvp_post_create_av_t\r
+* NAME\r
+* uvp_post_create_av_t -- Post-ioctl function to create AV\r
+*\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef void\r
+(AL_API *uvp_post_create_av_t) (\r
+ IN const ib_pd_handle_t h_uvp_pd,\r
+ IN ib_api_status_t ioctl_status,\r
+ IN OUT ib_av_handle_t *ph_uvp_av,\r
+ IN ci_umv_buf_t *p_umv_buf );\r
+/*\r
+* DESCRIPTION\r
+* uvp_post_create_av_t() is implemented by vendor. It is the post-ioctl routine\r
+* for ib_create_av().\r
+*\r
+* PARAMETERS\r
+* h_uvp_pd\r
+* [in] Vendor's user-mode library handle to the Protection domain\r
+* to which this AV is associated\r
+* ioctl_status\r
+* [in] The ioctl status of the AL API.\r
+* ph_uvp_av\r
+* [in out] Vendor's address vector handle.\r
+* If it specified in pre function than it must be the same value here.\r
+* p_umv_buf\r
+* [in] On input, it contains any vendor-specific private information\r
+* exchanged with the vendor's Verbs Provider Driver (uvp_pre_create_av).\r
+* Vendor is expected to check vendor-specific status in\r
+* umv_buf as appropriate.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* PORTABILITY\r
+* User Mode\r
+*\r
+* SEE ALSO\r
+* uvp_pre_create_av, uvp_pre_query_av, uvp_post_query_av_t, uvp_pre_modify_av,\r
+* uvp_post_modify_av_t, uvp_pre_destroy_av, uvp_post_destroy_av_t\r
+*\r
+********/\r
+\r
+/********/\r
+\r
+/****f* user-mode Verbs/uvp_pre_query_av\r
+* NAME\r
+* uvp_pre_query_av -- Pre-ioctl operation for ib_query_ca()\r
+*\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(AL_API *uvp_pre_query_av) (\r
+ IN const ib_av_handle_t h_uvp_av,\r
+ IN OUT ci_umv_buf_t *p_umv_buf );\r
+\r
+/*\r
+* DESCRIPTION\r
+* uvp_pre_query_av() is implemented by vendor. It is the pre-ioctl routine\r
+* for the AL call ib_query_av() in user-mode.\r
+*\r
+* PARAMETERS\r
+* h_uvp_av\r
+* [in] Vendor's handle to the address vector in user-mode library\r
+* p_umv_buf\r
+* [in out] On input, UAL provides this buffer template.\r
+* On return from this function, p_umv_buf contains\r
+* any vendor-specific record to be exchanged with the vendor's\r
+* HCA driver.\r
+*\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The pre-ioctl function succeeded.\r
+* IB_INVALID_AV_HANDLE\r
+* AV handle was invalid\r
+* IB_INSUFFICIENT_RESOURCES\r
+* Insufficient resources in Vendor library to complete the call.\r
+*\r
+* PORTABILITY\r
+* User Mode\r
+*\r
+* SEE ALSO\r
+* uvp_pre_create_av, uvp_post_create_av_t, uvp_post_query_av_t, uvp_pre_modify_av,\r
+* uvp_post_modify_av_t, uvp_pre_destroy_av, uvp_post_destroy_av_t\r
+*\r
+*********/\r
+\r
+/********/\r
+/****f* user-mode Verbs/uvp_post_query_av_t\r
+* NAME\r
+*\r
+* Vendor-specific post-ioctl operation for user-mode ib_query_ca()\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef void\r
+(AL_API *uvp_post_query_av_t) (\r
+ IN const ib_av_handle_t h_uvp_av,\r
+ IN ib_api_status_t ioctl_status,\r
+ IN OUT ib_av_attr_t *p_addr_vector,\r
+ IN OUT ib_pd_handle_t *ph_pd,\r
+ IN ci_umv_buf_t *p_umv_buf );\r
+\r
+/*\r
+* DESCRIPTION\r
+* uvp_post_query_av_t() is implemented by vendor. It is the post-ioctl routine\r
+* for the AL call ib_query_av() in user-mode.\r
+* UAL provides the results of the query to the vendor library in this\r
+* post-ioctl routine.\r
+*\r
+* PARAMETERS\r
+* h_uvp_av\r
+* [in] Vendor's handle to the address vector in user-mode library\r
+* ioctl_status\r
+* [in] The ioctl status of the AL API.\r
+* p_addr_vector\r
+* [in out] AV attribute (as returned by the ioctl).\r
+* ph_pd\r
+* [out] The vendor library PD handle associated with this AV.\r
+* p_umv_buf\r
+* [in]\r
+* On input, it contains any vendor-specific private information\r
+* exchanged with the vendor's Verbs Provider Driver (uvp_pre_query_av).\r
+* Vendor is expected to check vendor-specific status in\r
+* umv_buf as appropriate.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* PORTABILITY\r
+* User Mode\r
+*\r
+* SEE ALSO\r
+* uvp_pre_create_av, uvp_post_create_av_t, uvp_pre_query_av, uvp_pre_modify_av,\r
+* uvp_post_modify_av_t, uvp_pre_destroy_av, uvp_post_destroy_av_t\r
+*\r
+*********/\r
+\r
+/********/\r
+\r
+/****f* user-mode Verbs/uvp_pre_modify_av\r
+* NAME\r
+* uvp_pre_modify_av -- Pre-ioctl function to modify AV\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef ib_api_status_t\r
+(AL_API *uvp_pre_modify_av) (\r
+ IN const ib_av_handle_t h_uvp_av,\r
+ IN const ib_av_attr_t *p_addr_vector,\r
+ IN OUT ci_umv_buf_t *p_umv_buf );\r
+/*\r
+* DESCRIPTION\r
+* uvp_pre_modify_av() is implemented by vendor. It is the pre-ioctl routine\r
+* for ib_modify_av().\r
+*\r
+* PARAMETERS\r
+* h_uvp_av\r
+* [in] Vendor's AV handle in user-mode library.\r
+* p_addr_vector\r
+* [in] Parameters to modify the address vector handle\r
+* p_umv_buf\r
+* [in out] On input, UAL provides this buffer template.\r
+* On return from this function, p_umv_buf contains\r
+* any vendor-specific record to be exchanged with the vendor's\r
+* HCA driver.\r
+*\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The pre-ioctl is successful.\r
+* IB_INVALID_SETTING\r
+* Values in the vector is not valid.\r
+* IB_INVALID_AV_HANDLE\r
+* The AV handle is invalid.\r
+* IB_INSUFFICIENT_RESOURCES\r
+* Insufficient resources in Vendor library to complete the call.\r
+*\r
+* PORTABILITY\r
+* User Mode\r
+*\r
+* SEE ALSO\r
+* uvp_pre_create_av, uvp_post_create_av_t, uvp_pre_query_av, uvp_post_query_av_t,\r
+* uvp_post_modify_av_t, uvp_pre_destroy_av, uvp_post_destroy_av_t\r
+*\r
+********/\r
+\r
+/********/\r
+\r
+/****f* user-mode Verbs/uvp_post_modify_av_t\r
+* NAME\r
+* uvp_post_modify_av_t -- Post-ioctl function to modify AV\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef void\r
+(AL_API *uvp_post_modify_av_t) (\r
+ IN const ib_av_handle_t h_uvp_av,\r
+ IN ib_api_status_t ioctl_status,\r
+ IN ci_umv_buf_t *p_umv_buf );\r
+\r
+/*\r
+* DESCRIPTION\r
+* uvp_post_modify_av_t() is implemented by vendor to modify the attributes\r
+* of AV. It is the post-ioctl routine for ib_modify_av().\r
+*\r
+* PARAMETERS\r
+* h_uvp_av\r
+* [in] Vendor's av handle in user-mode library.\r
+* ioctl_status\r
+* [in] The ioctl status of the AL API.\r
+* p_umv_buf\r
+* [in out] On input, it contains any vendor-specific private information\r
+* exchanged with the vendor's Verbs Provider Driver (uvp_pre_modify_av).\r
+* Vendor is expected to check vendor-specific status in\r
+* umv_buf as appropriate.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* PORTABILITY\r
+* User Mode\r
+*\r
+* SEE ALSO\r
+* uvp_pre_create_av, uvp_post_create_av_t, uvp_pre_query_av, uvp_post_query_av_t,\r
+* uvp_pre_modify_av, uvp_pre_destroy_av, uvp_post_destroy_av_t\r
+*\r
+********/\r
+\r
+/********/\r
+\r
+/****f* user-mode Verbs/uvp_pre_destroy_av\r
+* NAME\r
+* uvp_pre_destroy_av -- Pre-ioctl function to destroy AV\r
+*\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(AL_API *uvp_pre_destroy_av) (\r
+ IN const ib_av_handle_t h_uvp_av );\r
+\r
+/*\r
+* DESCRIPTION\r
+* uvp_pre_destroy_av() is implemented by vendor to destroy the AV.\r
+* It is the pre-ioctl routine for ib_destroy_av().\r
+*\r
+* PARAMETERS\r
+* h_uvp_av\r
+* [in] Vendor's AV handle in user-mode library.\r
+*\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The pre-ioctl is successful.\r
+*\r
+* PORTABILITY\r
+* User Mode\r
+*\r
+* SEE ALSO\r
+* uvp_pre_create_av, uvp_post_create_av_t, uvp_pre_query_av, uvp_post_query_av_t,\r
+* uvp_pre_modify_av, uvp_post_modify_av_t, uvp_post_destroy_av_t\r
+*\r
+********/\r
+\r
+/********/\r
+\r
+/****f* user-mode Verbs/uvp_post_destroy_av_t\r
+* NAME\r
+* uvp_post_destroy_av_t -- Post-ioctl function to destroy AV\r
+*\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef void\r
+(AL_API *uvp_post_destroy_av_t) (\r
+ IN const ib_av_handle_t h_uvp_av,\r
+ IN ib_api_status_t ioctl_status );\r
+\r
+/*\r
+* DESCRIPTION\r
+* uvp_post_destroy_av_t() is implemented by vendor. It is the post-ioctl\r
+* routine for ib_destroy_av().\r
+*\r
+* PARAMETERS\r
+* h_uvp_av\r
+* [in] Vendor's AV handle in user-mode library.\r
+* p_umv_buf\r
+* [in out]\r
+* On input, it contains any vendor-specific private information\r
+* exchanged with the vendor's Verbs Provider Driver (uvp_pre_destroy_av).\r
+* Vendor is expected to check vendor-specific status in\r
+* umv_buf as appropriate.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* PORTABILITY\r
+* User Mode\r
+*\r
+* SEE ALSO\r
+* uvp_pre_create_av, uvp_post_create_av_t, uvp_pre_query_av, uvp_post_query_av_t,\r
+* uvp_pre_modify_av, uvp_post_modify_av_t, uvp_pre_destroy_av\r
+*\r
+********/\r
+\r
+/********/\r
+\r
+/****f* user-mode Verbs/uvp_pre_create_srq\r
+* NAME\r
+* uvp_pre_create_srq -- Pre-ioctl function to Create a Shared Queue Pair.\r
+*\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(AL_API *uvp_pre_create_srq) (\r
+ IN const ib_pd_handle_t h_uvp_pd,\r
+ IN const ib_srq_attr_t* const p_srq_attr,\r
+ IN OUT ci_umv_buf_t *p_umv_buf,\r
+ OUT ib_srq_handle_t *ph_uvp_srq);\r
+\r
+/*\r
+* DESCRIPTION\r
+* uvp_pre_create_srq() is implemented by vendor. It is the pre-ioctl routine\r
+* for ib_create_srq().\r
+*\r
+* PARAMETERS\r
+* h_uvp_pd\r
+* [in] Vendor's Protection domain handle in user-mode library.\r
+* p_srq_attr\r
+* [in] Initial attributes with which the srq must be created.\r
+* p_umv_buf\r
+* [in out] On input, UAL provides this buffer template.\r
+* On return from this function, p_umv_buf contains\r
+* any vendor-specific record to be exchanged with the vendor's\r
+* HCA driver.\r
+* ph_uvp_srq\r
+* [out] (OPTIONAL) Vendor's Handle to the newly created SRQ.\r
+*\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The pre-ioctl call is successful.\r
+* IB_INVALID_PD_HANDLE\r
+* The PD handle is invalid.\r
+* IB_UNSUPPORTED\r
+* The specified queue pair type was not supported by the channel adapter.\r
+* IB_INVALID_MAX_WRS\r
+* The requested maximum send or receive work request depth could not be\r
+* supported.\r
+* IB_INVALID_MAX_SGE\r
+* The requested maximum number of scatter-gather entries for the send or\r
+* receive queue could not be supported.\r
+* IB_INSUFFICIENT_RESOURCES\r
+* Insufficient resources in Vendor library to complete the call.\r
+* IB_INVALID_PARAMETER\r
+* At least one parameter is invalid.\r
+*\r
+* PORTABILITY\r
+* User Mode\r
+*\r
+* SEE ALSO\r
+* uvp_post_create_srq_t, uvp_pre_query_srq, uvp_post_query_srq_t, uvp_pre_modify_srq,\r
+* uvp_post_modify_srq_t, uvp_pre_destroy_srq, uvp_post_destroy_srq_t\r
+*\r
+********/\r
+\r
+/********/\r
+\r
+/****f* user-mode Verbs/uvp_post_create_srq_t\r
+* NAME\r
+* uvp_post_create_srq_t -- Post-ioctl function to Create a Queue Pair.\r
+*\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef void\r
+(AL_API *uvp_post_create_srq_t) (\r
+ IN const ib_pd_handle_t h_uvp_pd,\r
+ IN ib_api_status_t ioctl_status,\r
+ IN OUT ib_srq_handle_t *ph_uvp_srq,\r
+ IN ci_umv_buf_t *p_umv_buf );\r
+\r
+/*\r
+* DESCRIPTION\r
+* uvp_post_create_srq_t() is implemented by vendor. It is the post-ioctl routine\r
+* for ib_create_srq().\r
+*\r
+* PARAMETERS\r
+* h_uvp_pd\r
+* [in] Vendor's Protection domain handle in user-mode library.\r
+* ioctl_status\r
+* [in] The ioctl status of the AL API.\r
+* ph_uvp_srq\r
+* [in out] Vendor's srq handle for the newly created srq.\r
+* If it specified in pre function than it must be the same value here.\r
+* p_umv_buf\r
+* [in out] On input, it contains any vendor-specific private information\r
+* exchanged with the vendor's Verbs Provider Driver (uvp_pre_create_srq).\r
+* Vendor is expected to check vendor-specific status in\r
+* umv_buf as appropriate.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* PORTABILITY\r
+* User Mode\r
+*\r
+* SEE ALSO\r
+* uvp_pre_create_srq, uvp_pre_query_srq, uvp_post_query_srq_t, uvp_pre_modify_srq,\r
+* uvp_post_modify_srq_t, uvp_pre_destroy_srq, uvp_post_destroy_srq_t\r
+*\r
+********/\r
+\r
+/********/\r
+\r
+/****f* user-mode Verbs/uvp_pre_modify_srq\r
+* NAME\r
+* uvp_pre_modify_srq -- Pre-ioctl function to Modify attributes of the\r
+* specified srq.\r
+*\r
+* SYNOPSIS\r
+*\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(AL_API *uvp_pre_modify_srq) (\r
+ IN const ib_srq_handle_t h_uvp_srq,\r
+ IN const ib_srq_attr_t * const p_srq_attr,\r
+ IN const ib_srq_attr_mask_t srq_attr_mask,\r
+ IN OUT ci_umv_buf_t *p_umv_buf );\r
+\r
+/*\r
+* DESCRIPTION\r
+* uvp_pre_modify_srq() is implemented by vendor to modify the attributes of a\r
+* srq. It is the pre-ioctl routine for ib_modify_srq().\r
+*\r
+* PARAMETERS\r
+* h_uvp_srq\r
+* [in] Vendor's srq Handle to the queue pair (in user-mode library)\r
+* whose state is to be modified.\r
+* p_srq_attr\r
+* [in] Specifies what attributes need to be modified in the srq.\r
+* srq_attr_mask\r
+* [in] Specifies which fields of ib_srq_attr_t are valid.\r
+* p_umv_buf\r
+* [in out] On input, UAL provides this buffer template.\r
+* On return from this function, p_umv_buf contains\r
+* any vendor-specific record to be exchanged with the vendor's\r
+* HCA driver.\r
+*\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The pre-ioctl call is successful.\r
+* IB_INSUFFICIENT_RESOURCES\r
+* Insufficient resources to complete the requested operation.\r
+* IB_INVALID_SRQ_HANDLE\r
+* Invalid srq handle.\r
+* IB_UNSUPPORTED\r
+* Requested operation is not supported, for e.g. Atomic operations.\r
+*\r
+* PORTABILITY\r
+* User mode\r
+*\r
+* SEE ALSO\r
+* uvp_pre_create_srq, uvp_post_create_srq_t, uvp_pre_query_srq, uvp_post_query_srq_t,\r
+* uvp_post_modify_srq_t, uvp_pre_destroy_srq, uvp_post_destroy_srq_t\r
+*\r
+********/\r
+\r
+/********/\r
+\r
+/****f* user-mode Verbs/uvp_post_modify_srq_t\r
+* NAME\r
+* uvp_post_modify_srq_t -- Post-ioctl function to Modify attributes of\r
+* the specified srq.\r
+*\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef void\r
+(AL_API *uvp_post_modify_srq_t) (\r
+ IN const ib_srq_handle_t h_uvp_srq,\r
+ IN ib_api_status_t ioctl_status,\r
+ IN ci_umv_buf_t *p_umv_buf );\r
+\r
+/*\r
+* DESCRIPTION\r
+* uvp_post_modify_srq_t() is implemented by vendor to modify the srq attributes.\r
+* It is the post-ioctl routine for ib_modify_srq().\r
+*\r
+* PARAMETERS\r
+* h_uvp_srq\r
+* [in] Vendor's srq Handle to the queue pair (in user-mode library)\r
+* whose state is modified.\r
+* ioctl_status\r
+* [in] The ioctl status of the AL API.\r
+* p_umv_buf\r
+* [in out] On input, it contains any vendor-specific private information\r
+* exchanged with the vendor's Verbs Provider Driver (uvp_pre_modify_srq).\r
+* Vendor is expected to check vendor-specific status in\r
+* umv_buf as appropriate.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* PORTABILITY\r
+* User mode\r
+*\r
+* SEE ALSO\r
+* uvp_pre_create_srq, uvp_post_create_srq_t, uvp_pre_query_srq, uvp_post_query_srq_t,\r
+* uvp_pre_modify_srq, uvp_pre_destroy_srq, uvp_post_destroy_srq_t\r
+*\r
+********/\r
+\r
+/********/\r
+\r
+/****f* user-mode Verbs/uvp_pre_query_srq\r
+* NAME\r
+* uvp_pre_query_srq -- Pre-ioctl function to Query the attributes of the srq\r
+*\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(AL_API *uvp_pre_query_srq) (\r
+ IN ib_srq_handle_t h_uvp_srq,\r
+ IN OUT ci_umv_buf_t *p_umv_buf );\r
+\r
+/*\r
+* DESCRIPTION\r
+* uvp_pre_query_srq() is implemented by vendor. It is the pre-ioctl routine\r
+* for the AL call ib_query_srq().\r
+*\r
+* PARAMETERS\r
+* h_uvp_srq\r
+* [in] Vendor's handle to the srq (in user-mode library).\r
+* p_umv_buf\r
+* [in out] On input, UAL provides this buffer template.\r
+* On return from this function, p_umv_buf contains\r
+* any vendor-specific record to be exchanged with the vendor's\r
+* HCA driver.\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The pre-ioctl function succeeded.\r
+* IB_INVALID_SRQ_HANDLE\r
+* srq handle is invalid\r
+* IB_INSUFFICIENT_RESOURCES\r
+* Insufficient resources in Vendor library to complete the call.\r
+*\r
+* PORTABILITY\r
+* User Mode\r
+*\r
+* SEE ALSO\r
+* uvp_pre_create_srq, uvp_post_create_srq_t, uvp_post_query_srq_t, uvp_pre_modify_srq,\r
+* uvp_post_modify_srq_t, uvp_pre_destroy_srq, uvp_post_destroy_srq_t\r
+*\r
+*********/\r
+\r
+/********/\r
+\r
+/****f* user-mode Verbs/uvp_post_query_srq_t\r
+* NAME\r
+* uvp_post_query_srq_t -- Post-ioctl operation for user-mode ib_query_srq()\r
+*\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef void\r
+(AL_API *uvp_post_query_srq_t) (\r
+ IN ib_srq_handle_t h_uvp_srq,\r
+ IN ib_api_status_t ioctl_status,\r
+ IN ib_srq_attr_t *p_query_attr,\r
+ IN ci_umv_buf_t *p_umv_buf );\r
+\r
+/*\r
+* DESCRIPTION\r
+* uvp_post_query_srq_t() is implemented by vendor. It is the post-ioctl routine\r
+* for ib_query_srq().\r
+* UAL provides the results of the query to the vendor library in this\r
+* post-ioctl routine.\r
+*\r
+* PARAMETERS\r
+* h_uvp_srq\r
+* [in] Vendor's handle to the srq (in user-mode library).\r
+* ioctl_status\r
+* [in] The ioctl status of the AL API.\r
+* p_query_attr\r
+* [in] srq attribute as returned by the ioctl.\r
+* p_umv_buf\r
+* [in out] On input, it contains any vendor-specific private information\r
+* exchanged with the vendor's Verbs Provider Driver (uvp_pre_query_srq).\r
+* Vendor is expected to check vendor-specific status in\r
+* umv_buf as appropriate.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* PORTABILITY\r
+* User Mode\r
+*\r
+* SEE ALSO\r
+* uvp_pre_create_srq, uvp_post_create_srq_t, uvp_pre_query_srq, uvp_pre_modify_srq,\r
+* uvp_post_modify_srq_t, uvp_pre_destroy_srq, uvp_post_destroy_srq_t\r
+*\r
+*********/\r
+\r
+/********/\r
+\r
+/****f* user-mode Verbs/uvp_pre_destroy_srq\r
+* NAME\r
+* uvp_pre_destroy_srq -- Pre-ioctl function to Destroy a Queue Pair.\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(AL_API *uvp_pre_destroy_srq) (\r
+ IN const ib_srq_handle_t h_uvp_srq );\r
+\r
+/*\r
+* DESCRIPTION\r
+* uvp_pre_destroy_srq() is the pre-ioctl routine implemented by vendor\r
+* to destroy srq.\r
+* UAL invokes this pre-ioctl routine to destroy srq.\r
+* The vendor is expected to perform any preliminary steps in preparation\r
+* for destroying the srq and perform any book-keeping.\r
+*\r
+* PARAMETERS\r
+* h_uvp_srq\r
+* [in] Vendor's Handle to the srq (in user-mode library)\r
+* that needs to be destroyed.\r
+* p_umv_buf\r
+* [in out] On input, UAL provides this buffer template.\r
+* On return from this function, p_umv_buf contains\r
+* any vendor-specific record to be exchanged with the vendor's\r
+* HCA driver.\r
+*\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The pre-ioctl call is successful.\r
+*\r
+* PORTABILITY\r
+* User mode.\r
+*\r
+* SEE ALSO\r
+* uvp_pre_create_srq, uvp_post_create_srq_t, uvp_pre_query_srq, uvp_post_query_srq_t,\r
+* uvp_pre_modify_srq, uvp_post_modify_srq_t, uvp_post_destroy_srq_t\r
+*\r
+********/\r
+\r
+/********/\r
+\r
+\r
+/****f* user-mode Verbs/uvp_post_destroy_srq_t\r
+* NAME\r
+* uvp_post_destroy_srq_t -- Post-ioctl function to Destroy a Queue Pair.\r
+*\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef void\r
+(AL_API *uvp_post_destroy_srq_t) (\r
+ IN const ib_srq_handle_t h_uvp_srq,\r
+ IN ib_api_status_t ioctl_status );\r
+\r
+/*\r
+* DESCRIPTION\r
+* uvp_post_destroy_srq_t() is implemented by vendor. It is the post-ioctl\r
+* routine for ib_destroy_srq().\r
+* UAL invokes this post-ioctl routine to destroy srq when it receives\r
+* asynchronous notification from the user-mode proxy in kernel.\r
+*\r
+* PARAMETERS\r
+* h_uvp_srq\r
+* [in] Vendor's Handle to the srq (in user-mode library)\r
+* that needs to be destroyed.\r
+*\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The post-ioctl call is successful.\r
+*\r
+* PORTABILITY\r
+* User mode.\r
+*\r
+* SEE ALSO\r
+* uvp_pre_create_srq, uvp_post_create_srq_t, uvp_pre_query_srq, uvp_post_query_srq_t,\r
+* uvp_pre_modify_srq, uvp_post_modify_srq_t, uvp_pre_destroy_srq\r
+*\r
+********/\r
+\r
+/********/\r
+\r
+/****f* user-mode Verbs/uvp_pre_create_qp\r
+* NAME\r
+* uvp_pre_create_qp -- Pre-ioctl function to Create a Queue Pair.\r
+*\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(AL_API *uvp_pre_create_qp) (\r
+ IN const ib_pd_handle_t h_uvp_pd,\r
+ IN const ib_qp_create_t *p_create_attr,\r
+ IN OUT ci_umv_buf_t *p_umv_buf,\r
+ OUT ib_qp_handle_t *ph_uvp_qp);\r
+\r
+/*\r
+* DESCRIPTION\r
+* uvp_pre_create_qp() is implemented by vendor. It is the pre-ioctl routine\r
+* for ib_create_qp().\r
+*\r
+* PARAMETERS\r
+* h_uvp_pd\r
+* [in] Vendor's Protection domain handle in user-mode library.\r
+* p_create_attr\r
+* [in] Initial attributes with which the qp must be created.\r
+* p_umv_buf\r
+* [in out] On input, UAL provides this buffer template.\r
+* On return from this function, p_umv_buf contains\r
+* any vendor-specific record to be exchanged with the vendor's\r
+* HCA driver.\r
+* ph_uvp_qp\r
+* [in out] (OPTIONAL) Vendor's Handle to the newly created QP.\r
+*\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The pre-ioctl call is successful.\r
+* IB_INVALID_PD_HANDLE\r
+* The PD handle is invalid.\r
+* IB_INVALID_CQ_HANDLE\r
+* The send or receive completion queue to associate with the queue pair\r
+* is invalid.\r
+* IB_UNSUPPORTED\r
+* The specified queue pair type was not supported by the channel adapter.\r
+* IB_INVALID_MAX_WRS\r
+* The requested maximum send or receive work request depth could not be\r
+* supported.\r
+* IB_INVALID_MAX_SGE\r
+* The requested maximum number of scatter-gather entries for the send or\r
+* receive queue could not be supported.\r
+* IB_INSUFFICIENT_RESOURCES\r
+* Insufficient resources in Vendor library to complete the call.\r
+* IB_INVALID_PARAMETER\r
+* At least one parameter is invalid.\r
+*\r
+* PORTABILITY\r
+* User Mode\r
+*\r
+* SEE ALSO\r
+* uvp_post_create_qp_t, uvp_pre_query_qp, uvp_post_query_qp_t, uvp_pre_modify_qp,\r
+* uvp_post_modify_qp_t, uvp_pre_destroy_qp, uvp_post_destroy_qp_t\r
+*\r
+********/\r
+\r
+/********/\r
+\r
+/****f* user-mode Verbs/uvp_post_create_qp_t\r
+* NAME\r
+* uvp_post_create_qp_t -- Post-ioctl function to Create a Queue Pair.\r
+*\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(AL_API *uvp_post_create_qp_t) (\r
+ IN const ib_pd_handle_t h_uvp_pd,\r
+ IN ib_api_status_t ioctl_status,\r
+ IN OUT ib_qp_handle_t *ph_uvp_qp,\r
+ IN ci_umv_buf_t *p_umv_buf );\r
+\r
+/*\r
+* DESCRIPTION\r
+* uvp_post_create_qp_t() is implemented by vendor. It is the post-ioctl routine\r
+* for ib_create_qp().\r
+*\r
+* PARAMETERS\r
+* h_uvp_pd\r
+* [in] Vendor's Protection domain handle in user-mode library.\r
+* ioctl_status\r
+* [in] The ioctl status of the AL API.\r
+* ph_uvp_qp\r
+* [in out] Vendor's QP handle for the newly created QP.\r
+* If it specified in pre function than it must be the same value here.\r
+* p_umv_buf\r
+* [in out] On input, it contains any vendor-specific private information\r
+* exchanged with the vendor's Verbs Provider Driver (uvp_pre_create_qp).\r
+* Vendor is expected to check vendor-specific status in\r
+* umv_buf as appropriate.\r
+*\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The pre-ioctl call is successful.\r
+* IB_INSUFFICIENT_RESOURCES\r
+* Insufficient resources to satisfy request.\r
+*\r
+* PORTABILITY\r
+* User Mode\r
+*\r
+* SEE ALSO\r
+* uvp_pre_create_qp, uvp_pre_query_qp, uvp_post_query_qp_t, uvp_pre_modify_qp,\r
+* uvp_post_modify_qp_t, uvp_pre_destroy_qp, uvp_post_destroy_qp_t\r
+*\r
+********/\r
+\r
+/********/\r
+\r
+/****f* user-mode Verbs/uvp_pre_modify_qp\r
+* NAME\r
+* uvp_pre_modify_qp -- Pre-ioctl function to Modify attributes of the\r
+* specified QP.\r
+*\r
+* SYNOPSIS\r
+*\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(AL_API *uvp_pre_modify_qp) (\r
+ IN const ib_qp_handle_t h_uvp_qp,\r
+ IN const ib_qp_mod_t *p_modify_attr,\r
+ IN OUT ci_umv_buf_t *p_umv_buf );\r
+\r
+/*\r
+* DESCRIPTION\r
+* uvp_pre_modify_qp() is implemented by vendor to modify the attributes of a\r
+* QP. It is the pre-ioctl routine for ib_modify_qp().\r
+*\r
+* PARAMETERS\r
+* h_uvp_qp\r
+* [in] Vendor's qp Handle to the queue pair (in user-mode library)\r
+* whose state is to be modified.\r
+* p_modify_attr\r
+* [in] Specifies what attributes need to be modified in the qp.\r
+* p_umv_buf\r
+* [in out] On input, UAL provides this buffer template.\r
+* On return from this function, p_umv_buf contains\r
+* any vendor-specific record to be exchanged with the vendor's\r
+* HCA driver.\r
+*\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The pre-ioctl call is successful.\r
+* IB_INSUFFICIENT_RESOURCES\r
+* Insufficient resources to complete the requested operation.\r
+* IB_INVALID_QP_HANDLE\r
+* Invalid QP handle.\r
+* IB_UNSUPPORTED\r
+* Requested operation is not supported, for e.g. Atomic operations.\r
+* IB_QP_INVALID_STATE\r
+* Invalid state transition request. Current QP state not in allowable\r
+* state.\r
+* IB_INVALID_PKEY\r
+* Pkey specified in modify request not valid entry in P_KEY table. Or\r
+* index is out of range.\r
+* IB_INVALID_PMIG_STATE\r
+* Invalid path migration state specified in the request.\r
+*\r
+* PORTABILITY\r
+* User mode\r
+*\r
+* SEE ALSO\r
+* uvp_pre_create_qp, uvp_post_create_qp_t, uvp_pre_query_qp, uvp_post_query_qp_t,\r
+* uvp_post_modify_qp_t, uvp_pre_destroy_qp, uvp_post_destroy_qp_t\r
+*\r
+********/\r
+\r
+/********/\r
+\r
+/****f* user-mode Verbs/uvp_post_modify_qp_t\r
+* NAME\r
+* uvp_post_modify_qp_t -- Post-ioctl function to Modify attributes of\r
+* the specified QP.\r
+*\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef void\r
+(AL_API *uvp_post_modify_qp_t) (\r
+ IN const ib_qp_handle_t h_uvp_qp,\r
+ IN ib_api_status_t ioctl_status,\r
+ IN ci_umv_buf_t *p_umv_buf );\r
+\r
+/*\r
+* DESCRIPTION\r
+* uvp_post_modify_qp_t() is implemented by vendor to modify the qp attributes.\r
+* It is the post-ioctl routine for ib_modify_qp().\r
+*\r
+* PARAMETERS\r
+* h_uvp_qp\r
+* [in] Vendor's qp Handle to the queue pair (in user-mode library)\r
+* whose state is modified.\r
+* ioctl_status\r
+* [in] The ioctl status of the AL API.\r
+* p_umv_buf\r
+* [in out] On input, it contains any vendor-specific private information\r
+* exchanged with the vendor's Verbs Provider Driver (uvp_pre_modify_qp).\r
+* Vendor is expected to check vendor-specific status in\r
+* umv_buf as appropriate.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* PORTABILITY\r
+* User mode\r
+*\r
+* SEE ALSO\r
+* uvp_pre_create_qp, uvp_post_create_qp_t, uvp_pre_query_qp, uvp_post_query_qp_t,\r
+* uvp_pre_modify_qp, uvp_pre_destroy_qp, uvp_post_destroy_qp_t\r
+*\r
+********/\r
+\r
+/********/\r
+\r
+/****f* user-mode Verbs/uvp_pre_query_qp\r
+* NAME\r
+* uvp_pre_query_qp -- Pre-ioctl function to Query the attributes of the QP\r
+*\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(AL_API *uvp_pre_query_qp) (\r
+ IN ib_qp_handle_t h_uvp_qp,\r
+ IN OUT ci_umv_buf_t *p_umv_buf );\r
+\r
+/*\r
+* DESCRIPTION\r
+* uvp_pre_query_qp() is implemented by vendor. It is the pre-ioctl routine\r
+* for the AL call ib_query_qp().\r
+*\r
+* PARAMETERS\r
+* h_uvp_qp\r
+* [in] Vendor's handle to the QP (in user-mode library).\r
+* p_umv_buf\r
+* [in out] On input, UAL provides this buffer template.\r
+* On return from this function, p_umv_buf contains\r
+* any vendor-specific record to be exchanged with the vendor's\r
+* HCA driver.\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The pre-ioctl function succeeded.\r
+* IB_INVALID_QP_HANDLE\r
+* QP handle is invalid\r
+* IB_INSUFFICIENT_RESOURCES\r
+* Insufficient resources in Vendor library to complete the call.\r
+*\r
+* PORTABILITY\r
+* User Mode\r
+*\r
+* SEE ALSO\r
+* uvp_pre_create_qp, uvp_post_create_qp_t, uvp_post_query_qp_t, uvp_pre_modify_qp,\r
+* uvp_post_modify_qp_t, uvp_pre_destroy_qp, uvp_post_destroy_qp_t\r
+*\r
+*********/\r
+\r
+/********/\r
+\r
+/****f* user-mode Verbs/uvp_post_query_qp_t\r
+* NAME\r
+* uvp_post_query_qp_t -- Post-ioctl operation for user-mode ib_query_qp()\r
+*\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef void\r
+(AL_API *uvp_post_query_qp_t) (\r
+ IN ib_qp_handle_t h_uvp_qp,\r
+ IN ib_api_status_t ioctl_status,\r
+ IN ib_qp_attr_t *p_query_attr,\r
+ IN ci_umv_buf_t *p_umv_buf );\r
+\r
+/*\r
+* DESCRIPTION\r
+* uvp_post_query_qp_t() is implemented by vendor. It is the post-ioctl routine\r
+* for ib_query_qp().\r
+* UAL provides the results of the query to the vendor library in this\r
+* post-ioctl routine.\r
+*\r
+* PARAMETERS\r
+* h_uvp_qp\r
+* [in] Vendor's handle to the QP (in user-mode library).\r
+* ioctl_status\r
+* [in] The ioctl status of the AL API.\r
+* p_query_attr\r
+* [in] QP attribute as returned by the ioctl.\r
+* p_umv_buf\r
+* [in out] On input, it contains any vendor-specific private information\r
+* exchanged with the vendor's Verbs Provider Driver (uvp_pre_query_qp).\r
+* Vendor is expected to check vendor-specific status in\r
+* umv_buf as appropriate.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* PORTABILITY\r
+* User Mode\r
+*\r
+* SEE ALSO\r
+* uvp_pre_create_qp, uvp_post_create_qp_t, uvp_pre_query_qp, uvp_pre_modify_qp,\r
+* uvp_post_modify_qp_t, uvp_pre_destroy_qp, uvp_post_destroy_qp_t\r
+*\r
+*********/\r
+\r
+/********/\r
+\r
+/****f* user-mode Verbs/uvp_pre_destroy_qp\r
+* NAME\r
+* uvp_pre_destroy_qp -- Pre-ioctl function to Destroy a Queue Pair.\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(AL_API *uvp_pre_destroy_qp) (\r
+ IN const ib_qp_handle_t h_uvp_qp );\r
+\r
+/*\r
+* DESCRIPTION\r
+* uvp_pre_destroy_qp() is the pre-ioctl routine implemented by vendor\r
+* to destroy QP.\r
+* UAL invokes this pre-ioctl routine to destroy QP.\r
+* The vendor is expected to perform any preliminary steps in preparation\r
+* for destroying the QP and perform any book-keeping.\r
+*\r
+* PARAMETERS\r
+* h_uvp_qp\r
+* [in] Vendor's Handle to the qp (in user-mode library)\r
+* that needs to be destroyed.\r
+* p_umv_buf\r
+* [in out] On input, UAL provides this buffer template.\r
+* On return from this function, p_umv_buf contains\r
+* any vendor-specific record to be exchanged with the vendor's\r
+* HCA driver.\r
+*\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The pre-ioctl call is successful.\r
+*\r
+* PORTABILITY\r
+* User mode.\r
+*\r
+* SEE ALSO\r
+* uvp_pre_create_qp, uvp_post_create_qp_t, uvp_pre_query_qp, uvp_post_query_qp_t,\r
+* uvp_pre_modify_qp, uvp_post_modify_qp_t, uvp_post_destroy_qp_t\r
+*\r
+********/\r
+\r
+/********/\r
+\r
+\r
+/****f* user-mode Verbs/uvp_post_destroy_qp_t\r
+* NAME\r
+* uvp_post_destroy_qp_t -- Post-ioctl function to Destroy a Queue Pair.\r
+*\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef void\r
+(AL_API *uvp_post_destroy_qp_t) (\r
+ IN const ib_qp_handle_t h_uvp_qp,\r
+ IN ib_api_status_t ioctl_status );\r
+\r
+/*\r
+* DESCRIPTION\r
+* uvp_post_destroy_qp_t() is implemented by vendor. It is the post-ioctl\r
+* routine for ib_destroy_qp().\r
+* UAL invokes this post-ioctl routine to destroy QP when it receives\r
+* asynchronous notification from the user-mode proxy in kernel.\r
+*\r
+* PARAMETERS\r
+* h_uvp_qp\r
+* [in] Vendor's Handle to the qp (in user-mode library)\r
+* that needs to be destroyed.\r
+*\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The post-ioctl call is successful.\r
+*\r
+* PORTABILITY\r
+* User mode.\r
+*\r
+* SEE ALSO\r
+* uvp_pre_create_qp, uvp_post_create_qp_t, uvp_pre_query_qp, uvp_post_query_qp_t,\r
+* uvp_pre_modify_qp, uvp_post_modify_qp_t, uvp_pre_destroy_qp\r
+*\r
+********/\r
+\r
+/****f* user-mode Verbs/uvp_nd_get_qp_state_t\r
+* NAME\r
+* uvp_nd_get_qp_state_t -- Get QP state.\r
+*\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef uint32_t\r
+(AL_API *uvp_nd_get_qp_state_t) (\r
+ IN const ib_qp_handle_t h_uvp_qp\r
+ );\r
+\r
+/*\r
+* DESCRIPTION\r
+* uvp_nd_get_qp_state_t() is implemented by vendor. \r
+* There is no post uvp_nd_get_qp_state_t function.\r
+*\r
+* PARAMETERS\r
+* h_uvp_qp\r
+* [in] Vendor's Handle to the qp (in user-mode library)\r
+* that needs to be destroyed.\r
+*\r
+* RETURN VALUE\r
+*\r
+* PORTABILITY\r
+* User mode.\r
+*\r
+* SEE ALSO\r
+*\r
+********/\r
+\r
+/****f* user-mode Verbs/uvp_nd_modify_qp_t\r
+* NAME\r
+* uvp_nd_modify_qp_t -- Get QP state location and size.\r
+*\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef void\r
+(AL_API *uvp_nd_modify_qp_t) (\r
+ IN const ib_qp_handle_t h_uvp_qp,\r
+ OUT void** pp_outbuf,\r
+ OUT DWORD* p_size\r
+ );\r
+\r
+/*\r
+* DESCRIPTION\r
+* uvp_nd_modify_qp_t() is implemented by vendor. \r
+* UAL invokes this pre-ioctl routine to enable KAL to change QP state\r
+* It is used after quick QP modify operation.\r
+* There is no post uvp_ndi_modify_qp_t function.\r
+*\r
+* PARAMETERS\r
+* h_uvp_qp\r
+* [in] Vendor's Handle to the qp (in user-mode library)\r
+* that needs to be destroyed.\r
+* pp_outbuf\r
+* [out] pointer to QP state internal variable;\r
+* p_size\r
+* [out] pointer to the size of QP state internal variable;\r
+*\r
+* RETURN VALUE\r
+*\r
+* PORTABILITY\r
+* User mode.\r
+*\r
+* SEE ALSO\r
+*\r
+********/\r
+\r
+/********/\r
+\r
+/****f* user-mode Verbs/uvp_pre_create_cq\r
+* NAME\r
+* uvp_pre_create_cq -- Pre-ioctl function to Create a completion queue (CQ)\r
+*\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(AL_API *uvp_pre_create_cq) (\r
+ IN const ib_ca_handle_t h_uvp_ca,\r
+ IN OUT uint32_t* const p_size,\r
+ IN OUT ci_umv_buf_t *p_umv_buf,\r
+ OUT ib_cq_handle_t *ph_uvp_cq);\r
+/*\r
+* DESCRIPTION\r
+* uvp_pre_create_cq() is implemented by vendor. It is the pre-ioctl routine\r
+* for ib_create_cq().\r
+*\r
+* PARAMETERS\r
+* h_uvp_pd\r
+* [in] Vendor's handle to an existing protection domain (in user-mode\r
+* library)\r
+* p_size\r
+* [in out] Points to a variable containing the number of CQ entries\r
+* requested by the consumer.\r
+* On return, points to the size of the CQ that was created\r
+* by the provider.\r
+* p_umv_buf\r
+* [in out] On input, UAL provides this buffer template.\r
+* On return from this function, p_umv_buf contains\r
+* any vendor-specific record to be exchanged with the vendor's\r
+* HCA driver.\r
+* ph_uvp_cq\r
+* [in out] Vendor's Handle to the newly created CQ.\r
+*\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The operation was successful.\r
+* IB_INVALID_PD_HANDLE\r
+* The h_uvp_pd passed is invalid.\r
+* IB_INSUFFICIENT_RESOURCES\r
+* Insufficient resources to complete request.\r
+* IB_INVALID_CQ_SIZE\r
+* Requested CQ Size is not supported.\r
+*\r
+* PORTABILITY\r
+* User mode.\r
+*\r
+* SEE ALSO\r
+* uvp_post_create_cq_t, uvp_pre_resize_cq, uvp_post_resize_cq_t,\r
+* uvp_pre_query_cq, uvp_post_query_cq_t, uvp_pre_destroy_cq,\r
+* uvp_post_destroy_cq_t\r
+*\r
+********/\r
+\r
+/********/\r
+\r
+/****f* user-mode Verbs/uvp_post_create_cq_t\r
+* NAME\r
+* uvp_post_create_cq_t -- Post-ioctl function to Create a completion queue (CQ)\r
+*\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef void\r
+(AL_API *uvp_post_create_cq_t) (\r
+ IN const ib_ca_handle_t h_uvp_ca,\r
+ IN ib_api_status_t ioctl_status,\r
+ IN const uint32_t size,\r
+ IN OUT ib_cq_handle_t *ph_uvp_cq,\r
+ IN ci_umv_buf_t *p_umv_buf );\r
+\r
+/*\r
+* DESCRIPTION\r
+* uvp_post_create_cq_t() is implemented by vendor to create CQ.\r
+* It is the post-ioctl routine for ib_create_cq().\r
+*\r
+* PARAMETERS\r
+* h_uvp_pd\r
+* [in] Vendor's handle to an existing protection domain (in user-mode\r
+* library)\r
+* ioctl_status\r
+* [in] The ioctl status of the AL API.\r
+* size\r
+* [in] size of the CQ that was created by the provider.\r
+* If VPD created the CQ in kernel, this is the value as set by\r
+* VPD. If UVP creates the CQ in user-mode, then uvp already knows\r
+* the size of the CQ in the pre-ioctl.\r
+* ph_uvp_cq\r
+* [in out] Vendor's Handle to the newly created CQ.\r
+* If it specified in pre function than it must be the same value here.\r
+* p_umv_buf\r
+* [in out] On input, it contains any vendor-specific private information\r
+* exchanged with the vendor's Verbs Provider Driver (uvp_pre_create_cq).\r
+* Vendor is expected to check vendor-specific status in\r
+* umv_buf as appropriate.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* PORTABILITY\r
+* User mode.\r
+*\r
+* SEE ALSO\r
+* uvp_pre_create_cq, uvp_pre_resize_cq, uvp_post_resize_cq_t,\r
+* uvp_pre_query_cq, uvp_post_query_cq_t, uvp_pre_destroy_cq,\r
+* uvp_post_destroy_cq_t\r
+*\r
+********/\r
+\r
+/********/\r
+\r
+/****f* user-mode Verbs/uvp_pre_resize_cq\r
+* NAME\r
+* uvp_pre_resize_cq -- Pre-ioctl function to resize a CQ.\r
+*\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(AL_API *uvp_pre_resize_cq) (\r
+ IN const ib_cq_handle_t h_uvp_cq,\r
+ IN OUT uint32_t* const p_size,\r
+ IN OUT ci_umv_buf_t *p_umv_buf );\r
+\r
+/*\r
+* DESCRIPTION\r
+* uvp_pre_resize_cq() is implemented by vendor to resize the CQ.\r
+* It is the pre-ioctl routine for ib_resize_cq().\r
+*\r
+* PARAMETERS\r
+* h_uvp_cq\r
+* [in] Vendor's Handle to the already created CQ (in user-mode library).\r
+* p_size\r
+* [in out] On input, points to a variable containing the number\r
+* of CQ entries requested by the consumer.\r
+* On completion points to the size of the CQ that was resized by\r
+* the provider.\r
+* p_umv_buf\r
+* [in out] On input, UAL provides this buffer template.\r
+* On return from this function, p_umv_buf contains\r
+* any vendor-specific record to be exchanged with the vendor's\r
+* HCA driver.\r
+\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The operation was successful.\r
+* IB_INVALID_CQ_HANDLE\r
+* The CQ handle is invalid.\r
+* IB_INSUFFICIENT_RESOURCES\r
+* Insufficient resources to complete request.\r
+* IB_INVALID_CQ_SIZE\r
+* Requested CQ Size is not supported.\r
+* IB_OVERFLOW\r
+* The CQ has more entries than the resize request. The CQ is not\r
+* modified, and old entries still exist.\r
+*\r
+* PORTABILITY\r
+* User mode.\r
+*\r
+* SEE ALSO\r
+* uvp_pre_create_cq, uvp_post_create_cq_t, uvp_post_resize_cq_t,\r
+* uvp_pre_query_cq, uvp_post_query_cq_t, uvp_pre_destroy_cq,\r
+* uvp_post_destroy_cq_t\r
+*\r
+********/\r
+\r
+/********/\r
+\r
+/****f* user-mode Verbs/uvp_post_resize_cq_t\r
+* NAME\r
+* uvp_post_resize_cq_t -- Post-ioctl function to resize a CQ.\r
+*\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef void\r
+(AL_API *uvp_post_resize_cq_t) (\r
+ IN const ib_cq_handle_t h_uvp_cq,\r
+ IN ib_api_status_t ioctl_status,\r
+ IN const uint32_t size,\r
+ IN ci_umv_buf_t *p_umv_buf );\r
+\r
+/*\r
+* DESCRIPTION\r
+* uvp_post_resize_cq_t() is implemented by vendor to resize the CQ.\r
+* It is the post-ioctl routine for ib_resize_cq().\r
+*\r
+* PARAMETERS\r
+* h_uvp_cq\r
+* [in] Vendor's Handle to the already created CQ (in user-mode library).\r
+* ioctl_status\r
+* [in] The ioctl status of the AL API.\r
+* size\r
+* [in] size of the CQ that was created by the provider.\r
+* If VPD resized the CQ in kernel, this is the value as set by\r
+* VPD. If UVP resizes the CQ in user-mode, then uvp already knows\r
+* the size of the CQ in the pre-ioctl.\r
+* p_umv_buf\r
+* [in out] On input, it contains any vendor-specific private information\r
+* exchanged with the vendor's Verbs Provider Driver (uvp_pre_resize_cq).\r
+* Vendor is expected to check vendor-specific status in\r
+* umv_buf as appropriate.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* PORTABILITY\r
+* User mode.\r
+*\r
+* SEE ALSO\r
+* uvp_pre_create_cq, uvp_post_create_cq_t, uvp_pre_resize_cq,\r
+* uvp_pre_query_cq, uvp_post_query_cq_t, uvp_pre_destroy_cq,\r
+* uvp_post_destroy_cq_t\r
+*\r
+********/\r
+\r
+/********/\r
+\r
+/****f* user-mode Verbs/uvp_pre_query_cq\r
+* NAME\r
+* uvp_pre_query_cq -- Pre-ioctl to Query the number of entries\r
+* configured for the CQ.\r
+*\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(AL_API *uvp_pre_query_cq) (\r
+ IN const ib_cq_handle_t h_uvp_cq,\r
+ IN OUT uint32_t* const p_size,\r
+ IN OUT ci_umv_buf_t *p_umv_buf );\r
+\r
+/*\r
+* DESCRIPTION\r
+* uvp_pre_query_cq() is implemented by vendor. It is the pre-ioctl routine\r
+* for ib_query_cq().\r
+* Can we always go to the kernel to query even if it is created\r
+* in vendor library in user-mode?\r
+*\r
+* PARAMETERS\r
+* h_uvp_cq\r
+* [in] Vendor's Handle to the already created CQ (in user-mode library).\r
+*\r
+* p_size\r
+* [out] Size of the CQ if processing ends in user-mode.\r
+*\r
+* p_umv_buf\r
+* [in out] On input, UAL provides this buffer template.\r
+* On return from this function, p_umv_buf contains\r
+* any vendor-specific record to be exchanged with the vendor's\r
+* HCA driver.\r
+*\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The operation was successful.\r
+* IB_INVALID_CQ_HANDLE\r
+* The CQ handle is invalid.\r
+* IB_INSUFFICIENT_RESOURCES\r
+* Insufficient resources in Vendor library to complete the call.\r
+* IB_VERBS_PROCESSING_DONE\r
+* The UVP fully processed the request. The post_query_cq handler\r
+* will not be invoked.\r
+*\r
+* PORTABILITY\r
+* User mode.\r
+* SEE ALSO\r
+* uvp_pre_create_cq, uvp_post_create_cq_t, uvp_pre_resize_cq,\r
+* uvp_post_resize_cq_t, uvp_post_query_cq_t, uvp_pre_destroy_cq,\r
+* uvp_post_destroy_cq_t\r
+*\r
+********/\r
+\r
+/********/\r
+\r
+/****f* user-mode Verbs/uvp_post_query_cq_t\r
+* NAME\r
+* uvp_post_query_cq_t -- Post-ioctl to Query the number of entries\r
+* configured for the CQ.\r
+*\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef void\r
+(AL_API *uvp_post_query_cq_t) (\r
+ IN const ib_cq_handle_t h_uvp_cq,\r
+ IN ib_api_status_t ioctl_status,\r
+ IN const uint32_t size,\r
+ IN ci_umv_buf_t *p_umv_buf );\r
+\r
+/*\r
+* DESCRIPTION\r
+* uvp_post_query_cq_t() is implemented by vendor to query CQ.\r
+* It is the post-ioctl routine for ib_query_cq().\r
+*\r
+* PARAMETERS\r
+* h_uvp_cq\r
+* [in] Vendor's Handle to the already created CQ (in user-mode library).\r
+* ioctl_status\r
+* [in] The ioctl status of the AL API.\r
+* size\r
+* [in] The size of the CQ retuned by the IOCTL.\r
+* p_umv_buf\r
+* [in out] On input, it contains any vendor-specific private information\r
+* exchanged with the vendor's Verbs Provider Driver (uvp_pre_query_cq).\r
+* Vendor is expected to check vendor-specific status in\r
+* umv_buf as appropriate.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* PORTABILITY\r
+* User mode.\r
+*\r
+* SEE ALSO\r
+* uvp_pre_create_cq, uvp_post_create_cq_t, uvp_pre_resize_cq,\r
+* uvp_post_resize_cq_t, uvp_pre_query_cq, uvp_pre_destroy_cq,\r
+* uvp_post_destroy_cq_t\r
+*\r
+********/\r
+\r
+/********/\r
+\r
+/****f* user-mode Verbs/uvp_pre_destroy_cq\r
+* NAME\r
+* uvp_pre_destroy_cq -- Pre-ioctl function to Destroy a CQ.\r
+*\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(AL_API *uvp_pre_destroy_cq) (\r
+ IN const ib_cq_handle_t h_uvp_cq );\r
+\r
+/*\r
+* DESCRIPTION\r
+* uvp_pre_destroy_cq() is implemented by vendor to destroy CQ.\r
+* It is the pre-ioctl routine for ib_destroy_cq().\r
+*\r
+* PARAMETERS\r
+* h_uvp_cq\r
+* [in] Vendor's Handle to the cq (in user-mode library)\r
+* that needs to be destroyed.\r
+*\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The pre-ioctl call is successful.\r
+*\r
+* PORTABILITY\r
+* User mode.\r
+*\r
+* SEE ALSO\r
+* uvp_pre_create_cq, uvp_post_create_cq_t, uvp_pre_resize_cq,\r
+* uvp_post_resize_cq_t, uvp_pre_query_cq, uvp_post_query_cq_t,\r
+* uvp_post_destroy_cq_t\r
+*\r
+********/\r
+\r
+/********/\r
+\r
+/****f* user-mode Verbs/uvp_post_destroy_cq_t\r
+* NAME\r
+* uvp_post_destroy_cq_t -- Post-ioctl function to Destroy a CQ.\r
+*\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef void\r
+(AL_API *uvp_post_destroy_cq_t) (\r
+ IN const ib_cq_handle_t h_uvp_cq,\r
+ IN ib_api_status_t ioctl_status );\r
+\r
+/*\r
+* DESCRIPTION\r
+* uvp_post_destroy_cq_t() is implemented by vendor to destroy CQ.\r
+* It is the post-ioctl routine for ib_destroy_cq().\r
+* UAL invokes this post-ioctl routine to destroy CQ when it receives\r
+* asynchronous notification from the user-mode proxy.\r
+*\r
+* PARAMETERS\r
+* h_uvp_cq\r
+* [in] Vendor's Handle to the cq (in user-mode library)\r
+* that needs to be destroyed.\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* PORTABILITY\r
+* User mode.\r
+*\r
+* SEE ALSO\r
+* uvp_pre_create_cq, uvp_post_create_cq_t, uvp_pre_resize_cq,\r
+* uvp_post_resize_cq_t, uvp_pre_query_cq, uvp_post_query_cq_t,\r
+* uvp_pre_destroy_cq\r
+*\r
+********/\r
+\r
+/********/\r
+\r
+/****f* user-mode Verbs/uvp_pre_create_mw\r
+* NAME\r
+* uvp_pre_create_mw -- Pre-ioctl function to create a memory window\r
+*\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(AL_API *uvp_pre_create_mw) (\r
+ IN const ib_pd_handle_t h_uvp_pd,\r
+ IN OUT ci_umv_buf_t *p_umv_buf,\r
+ OUT ib_mw_handle_t *ph_uvp_mw);\r
+/*\r
+* DESCRIPTION\r
+* uvp_pre_create_mw() is implemented by vendor. It is the pre-ioctl routine\r
+* for ib_create_mw().\r
+*\r
+* PARAMETERS\r
+* h_uvp_pd\r
+* [in] Vendor's Protection domain handle (in user-mode library)\r
+* to use for this memory window\r
+* p_umv_buf\r
+* [in out] On input, UAL provides this buffer template.\r
+* On return from this function, p_umv_buf contains\r
+* any vendor-specific record to be exchanged with the vendor's\r
+* HCA driver.\r
+* ph_uvp_mw\r
+* [out] (OPTIONAL) Vendor's Handle to the newly created memory window.\r
+*\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The memory window allocation completed successfully.\r
+* IB_INSUFFICIENT_RESOURCES\r
+* Not enough resources to complete the request.\r
+* IB_INVALID_PD_HANDLE\r
+* pd_handle supplied is invalid.\r
+*\r
+* PORTABILITY\r
+* User mode\r
+*\r
+* SEE ALSO\r
+* uvp_post_create_mw_t, uvp_pre_query_mw, uvp_post_query_mw_t,\r
+* uvp_bind_mw, uvp_pre_destroy_mw, uvp_post_destroy_mw_t\r
+*\r
+********/\r
+\r
+\r
+/********/\r
+\r
+\r
+/****f* user-mode Verbs/uvp_post_create_mw_t\r
+* NAME\r
+* uvp_post_create_mw_t -- Post-ioctl function to create a memory window\r
+*\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef void\r
+(AL_API *uvp_post_create_mw_t) (\r
+ IN const ib_pd_handle_t h_uvp_pd,\r
+ IN ib_api_status_t ioctl_status,\r
+ IN net32_t rkey,\r
+ IN OUT ib_mw_handle_t *ph_uvp_mw,\r
+ IN ci_umv_buf_t *p_umv_buf );\r
+/*\r
+* DESCRIPTION\r
+* uvp_post_create_mw_t() is implemented by vendor. It is the post-ioctl routine\r
+* for ib_create_mw().\r
+*\r
+* PARAMETERS\r
+* h_uvp_pd\r
+* [in] Vendor's Protection domain handle (in user-mode library)\r
+* to use for this memory window\r
+* ioctl_status\r
+* [in] The ioctl status of the AL API.\r
+* p_rkey\r
+* [in] Remote access key that can be exchanged with a remote node to\r
+* perform RDMA transactions on this memory window.\r
+* ph_uvp_mw\r
+* [in out] Vendor's Handle to the newly created memory window.\r
+* If it specified in pre function than it must be the same value here.\r
+* p_umv_buf\r
+* [in out] On input, it contains any vendor-specific private information\r
+* exchanged with the vendor's Verbs Provider Driver (uvp_pre_create_mw).\r
+* Vendor is expected to check vendor-specific status in\r
+* umv_buf as appropriate.\r
+*\r
+* RETURN VALUE\r
+* This function does not return an error.\r
+*\r
+* PORTABILITY\r
+* User mode\r
+*\r
+* SEE ALSO\r
+* uvp_pre_create_mw, uvp_pre_query_mw, uvp_post_query_mw_t,\r
+* uvp_bind_mw, uvp_pre_destroy_mw, uvp_post_destroy_mw_t\r
+*\r
+********/\r
+\r
+/********/\r
+\r
+/****f* user-mode Verbs/uvp_pre_query_mw\r
+* NAME\r
+* uvp_pre_query_mw -- Pre-ioctl to Query a memory window\r
+*\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(AL_API *uvp_pre_query_mw) (\r
+ IN const ib_mw_handle_t h_uvp_mw,\r
+ IN OUT ci_umv_buf_t *p_umv_buf );\r
+\r
+/*\r
+* DESCRIPTION\r
+* uvp_pre_query_mw is implemented by vendor. It is the pre-ioctl routine\r
+* for ib_query_mw().\r
+*\r
+* PARAMETERS\r
+* h_uvp_mw\r
+* [in] Vendor's Memory window handle (in user-mode library)\r
+* whose attributes are being retrieved.\r
+* p_umv_buf\r
+* [in out] On input, UAL provides this buffer template.\r
+* On return from this function, p_umv_buf contains\r
+* any vendor-specific record to be exchanged with the vendor's\r
+* HCA driver.\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The pre-ioctl call completed successfully.\r
+* IB_INVALID_MW_HANDLE\r
+* mw_handle supplied is an invalid handle.\r
+* IB_INSUFFICIENT_RESOURCES\r
+* Not enough resources to complete the request.\r
+*\r
+* PORTABILITY\r
+* User mode\r
+*\r
+* SEE ALSO\r
+* uvp_pre_create_mw, uvp_post_create_mw_t, uvp_post_query_mw_t,\r
+* uvp_bind_mw, uvp_pre_destroy_mw, uvp_post_destroy_mw_t\r
+*\r
+********/\r
+\r
+/********/\r
+\r
+/****f* user-mode Verbs/uvp_post_query_mw_t\r
+* NAME\r
+* uvp_post_query_mw_t -- Post-ioctl to Query a memory window\r
+*\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef void\r
+(AL_API *uvp_post_query_mw_t) (\r
+ IN const ib_mw_handle_t h_uvp_mw,\r
+ IN ib_api_status_t ioctl_status,\r
+ IN net32_t rkey,\r
+ OUT ib_pd_handle_t *ph_pd,\r
+ IN ci_umv_buf_t *p_umv_buf );\r
+/*\r
+* DESCRIPTION\r
+* uvp_post_query_mw_t is implemented by vendor. It is the post-ioctl routine\r
+* for ib_query_mw().\r
+*\r
+* PARAMETERS\r
+* h_uvp_mw\r
+* [in] Vendor's Memory window handle (in user-mode library)\r
+* whose attributes are being retrieved.\r
+* ioctl_status\r
+* [in] The ioctl status of the AL API.\r
+* rkey\r
+* [in] Current R_KEY associated with this mw_handle\r
+* ph_pd\r
+* [in] Protection domain handle associated with this mw_handle\r
+* p_umv_buf\r
+* [in out] On input, it contains any vendor-specific private information\r
+* exchanged with the vendor's Verbs Provider Driver (uvp_pre_query_mw).\r
+* Vendor is expected to check vendor-specific status in\r
+* umv_buf as appropriate.\r
+*\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The query operation completed successfully.\r
+*\r
+* PORTABILITY\r
+* User mode\r
+*\r
+* SEE ALSO\r
+* uvp_pre_create_mw, uvp_post_create_mw_t, uvp_pre_query_mw,\r
+* uvp_bind_mw, uvp_pre_destroy_mw, uvp_post_destroy_mw_t\r
+*\r
+********/\r
+\r
+/********/\r
+\r
+/****f* user-mode Verbs/uvp_bind_mw\r
+* NAME\r
+* uvp_bind_mw -- Bind a memory window to a memory region.\r
+*\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(AL_API *uvp_bind_mw) (\r
+ IN const ib_mw_handle_t h_uvp_mw,\r
+ IN const ib_qp_handle_t h_uvp_qp,\r
+ IN ib_bind_wr_t *p_mw_bind,\r
+ OUT net32_t* const p_rkey );\r
+/*\r
+* DESCRIPTION\r
+* This routine posts a request to bind a memory window to a registered\r
+* memory region. If the queue pair was created with selectable signaling,\r
+* once the operation is completed successfully then a completion queue entry\r
+* is generated indicating the bind operation has completed. The IB_POST_FENCE\r
+* option could be specified to cause the requestor to wait until outstanding\r
+* RDMA operations can be completed.\r
+*\r
+* PARAMETERS\r
+* h_uvp_mw\r
+* [in] Vendor's Handle (in user-mode library) to memory window\r
+* that needs to be bound to a memory region.\r
+* h_uvp_qp\r
+* [in] Vendor's QP Handle (in user-mode library) to which\r
+* this bind request is to be posted.\r
+* p_mw_bind\r
+* [in] Input parameters for this bind request, consisting of virtual\r
+* addr range of bind request etc. On successful completion, the new R_KEY\r
+* is returned.\r
+* p_rkey\r
+* [out] Current R_KEY associated with this mw_handle\r
+*\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The memory bind operation was posted successfully.\r
+* IB_INSUFFICIENT_RESOURCES\r
+* Insufficient resources to complete the request.\r
+* No more WQE's to post this request\r
+* No more free WQE's to post this request\r
+* IB_INVALID_MW_HANDLE\r
+* memw_handle supplied is an invalid memory window handle.\r
+* IB_INVALID_PERMISSION\r
+* Invalid access rights specified in request\r
+* IB_INVALID_SERVICE_TYPE\r
+* Invalid service type for this qp_handle.\r
+* IB_INVALID_PARAMETER\r
+* Address or length parameter specified is invalid.\r
+* IB_INVALID_RKEY\r
+* R_KEY specified is invalid for the memory region being bound.\r
+*\r
+* PORTABILITY\r
+* User mode.\r
+*\r
+* SEE ALSO\r
+* uvp_pre_create_mw, uvp_post_create_mw_t, uvp_pre_query_mw,\r
+* uvp_post_query_mw_t, uvp_pre_destroy_mw, uvp_post_destroy_mw_t\r
+*\r
+********/\r
+\r
+/********/\r
+\r
+/****f* user-mode Verbs/uvp_pre_destroy_mw\r
+* NAME\r
+* uvp_pre_destroy_mw -- Pre-ioctl function to destroy a memory window\r
+*\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(AL_API *uvp_pre_destroy_mw) (\r
+ IN const ib_mw_handle_t h_uvp_mw );\r
+\r
+/*\r
+* DESCRIPTION\r
+* uvp_pre_destroy_mw() is implemented by vendor. It is the pre-ioctl routine\r
+* for ib_destroy_mw().\r
+*\r
+*\r
+* PARAMETERS\r
+* h_uvp_mw\r
+* [in] Vendor's handle (in user-mode library) to the memory window\r
+*\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* Pre-ioctl succeeded.\r
+*\r
+* PORTABILITY\r
+* User mode\r
+\r
+* SEE ALSO\r
+* uvp_pre_create_mw, uvp_post_create_mw_t, uvp_pre_query_mw,\r
+* uvp_post_query_mw_t, uvp_bind_mw, uvp_post_destroy_mw_t\r
+*\r
+********/\r
+\r
+/********/\r
+\r
+/****f* user-mode Verbs/uvp_post_destroy_mw_t\r
+* NAME\r
+* uvp_post_destroy_mw_t -- Post-ioctl function to destroy a memory window\r
+*\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef void\r
+(AL_API *uvp_post_destroy_mw_t) (\r
+ IN const ib_mw_handle_t h_uvp_mw,\r
+ IN ib_api_status_t ioctl_status );\r
+/*\r
+* DESCRIPTION\r
+* uvp_post_destroy_mw_t() is implemented by vendor. It is the post-ioctl\r
+* routine to destroy a memory window.\r
+*\r
+*\r
+* PARAMETERS\r
+* h_uvp_mw\r
+* [in] Vendor's handle to the memory window\r
+*\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* Destroy operation successful.\r
+*\r
+* PORTABILITY\r
+* User mode\r
+*\r
+* SEE ALSO\r
+* uvp_pre_create_mw, uvp_post_create_mw_t, uvp_pre_query_mw,\r
+* uvp_post_query_mw_t, uvp_bind_mw, uvp_pre_destroy_mw\r
+*\r
+********/\r
+\r
+/********/\r
+\r
+/****f* user-mode Verbs/uvp_post_send\r
+* NAME\r
+* uvp_post_send -- Post a work request to the send side of a queue pair.\r
+*\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(AL_API *uvp_post_send) (\r
+ IN const void* __ptr64 h_qp,\r
+ IN ib_send_wr_t* const p_send_wr,\r
+ OUT ib_send_wr_t** pp_send_failure );\r
+/*\r
+* DESCRIPTION\r
+* This routine posts a work request to the send side of the queue pair.\r
+* The different types of work request that can be posted are explained in\r
+* the ib_wr_t structure. For exact details on ordering rules please consult\r
+* the Volume 1, of the InfiniBand Specifications. If there is more\r
+* outstanding requests posted that what the queue is configured for, an\r
+* immediate error is returned.\r
+*\r
+* PARAMETERS\r
+* h_qp\r
+* [in] Type-cast as appropriate for user/kernel mode, this is\r
+* the Queue pair handle to which the receive work request is being\r
+* posted.\r
+* p_send_wr\r
+* [in] List of work requests that needs to be send.\r
+* pp_send_failure\r
+* [out] The work requests that failed.\r
+*\r
+* RETURN VALUE\r
+* Any unsuccessful status indicates the status of the first failed request.\r
+*\r
+* IB_SUCCESS\r
+* All the work requests are completed successfully\r
+* IB_INVALID_QP_HANDLE\r
+* The qp_handle supplied is invalid.\r
+* IB_INSUFFICIENT_RESOURCES\r
+* Insufficient resources to complete the request.\r
+* There are no more work elements in the channel interface to\r
+* process this request, and the total outstanding work request has\r
+* been exceeded.\r
+* IB_INVALID_WR_TYPE\r
+* The work request type was not valid.\r
+* IB_INVALID_QP_STATE\r
+* The queue pair is either in Reset, Init, RTR or Error state.\r
+* IB_INVALID_MAX_SGE\r
+* The work request has too many scatter gather elements than what the\r
+* QP is configured.\r
+* IB_UNSUPPORTED\r
+* Atomics or Reliable datagram request is not supported by this HCA.\r
+* IB_INVALID_ADDR_HANDLE\r
+* Address handle supplied in the work request is invalid.\r
+* IB_INVALID_PARAMETER\r
+* The size of the inline data is too much.\r
+*\r
+* PORTABILITY\r
+* Kernel & User mode.\r
+*\r
+* NOTES\r
+* Please refer to Table 81 and Table 82 for allowed operation types\r
+* on different types of queue pairs, and the different modifiers\r
+* acceptable for the work request for different QP service types.\r
+*\r
+* SEE ALSO\r
+* uvp_post_recv, uvp_poll_cq\r
+*\r
+********/\r
+\r
+/********/\r
+\r
+/****f* user-mode Verbs/uvp_post_recv\r
+* NAME\r
+* uvp_post_recv -- Post a work request to the receive queue of a queue pair.\r
+*\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(AL_API *uvp_post_recv) (\r
+ IN const void* __ptr64 h_qp,\r
+ IN ib_recv_wr_t* const p_recv_wr,\r
+ OUT ib_recv_wr_t** pp_recv_failure );\r
+\r
+/*\r
+* DESCRIPTION\r
+* This routine allows to queue a work request to the receive side of a\r
+* queue pair. The work_req holds necessary data to satisfy an incoming\r
+* receive message. If an attempt is made to queue more work requests than\r
+* what is available, an error is returned.\r
+*\r
+* PARAMETERS\r
+* h_qp\r
+* [in] Type-cast as appropriate for user/kernel mode, this is\r
+* the Queue pair handle to which the receive work request is being\r
+* posted.\r
+* p_recv_wr\r
+* [in] List of recv work requests that needs to be posted.\r
+* pp_recv_failure\r
+* [out] The work requests that failed.\r
+\r
+* RETURN VALUE\r
+* Any unsuccessful status indicates the status of the first failed request.\r
+*\r
+* IB_SUCCESS\r
+* The work request was successfully queued to the receive side of the QP.\r
+* IB_INVALID_QP_HANDLE\r
+* qp_handle supplied is not valid.\r
+* IB_INSUFFICIENT_RESOURCES\r
+* The qp has exceeded its receive queue depth than what is has been\r
+* configured.\r
+* IB_INVALID_WR_TYPE\r
+* Invalid work request type found in the request.\r
+* IB_INVALID_QP_STATE\r
+* QP was in reset or init state.\r
+* (TBD: there may be an errata that allows posting in init state)\r
+*\r
+* PORTABILITY\r
+* Kernel & User mode.\r
+*\r
+* SEE ALSO\r
+* uvp_post_send, uvp_poll_cq\r
+*\r
+********/\r
+\r
+/********/\r
+\r
+/****f* user-mode Verbs/uvp_post_srq_recv\r
+* NAME\r
+* uvp_post_srq_recv -- Post a work request to the shared receive queue of a queue pair.\r
+*\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(AL_API *uvp_post_srq_recv) (\r
+ IN const void* __ptr64 h_srq,\r
+ IN ib_recv_wr_t* const p_recv_wr,\r
+ OUT ib_recv_wr_t** pp_recv_failure );\r
+\r
+/*\r
+* DESCRIPTION\r
+* This routine allows to queue a work request to the receive side of a shared\r
+* queue pair. The work_req holds necessary data to satisfy an incoming\r
+* receive message. If an attempt is made to queue more work requests than\r
+* what is available, an error is returned.\r
+*\r
+* PARAMETERS\r
+* h_srq\r
+* [in] Type-cast as appropriate for user/kernel mode, this is\r
+* the shared Queue pair handle to which the receive work request is being\r
+* posted.\r
+* p_recv_wr\r
+* [in] List of recv work requests that needs to be posted.\r
+* pp_recv_failure\r
+* [out] The work requests that failed.\r
+\r
+* RETURN VALUE\r
+* Any unsuccessful status indicates the status of the first failed request.\r
+*\r
+* IB_SUCCESS\r
+* The work request was successfully queued to the receive side of the QP.\r
+* IB_INVALID_SRQ_HANDLE\r
+* srq_handle supplied is not valid.\r
+* IB_INSUFFICIENT_RESOURCES\r
+* The qp has exceeded its receive queue depth than what is has been\r
+* configured.\r
+* IB_INVALID_WR_TYPE\r
+* Invalid work request type found in the request.\r
+*\r
+* PORTABILITY\r
+* Kernel & User mode.\r
+*\r
+* SEE ALSO\r
+*\r
+********/\r
+\r
+/********/\r
+\r
+/****f* user-mode Verbs/uvp_peek_cq\r
+* NAME\r
+* uvp_peek_cq\r
+*\r
+* DESCRIPTION\r
+* Returns the number of entries currently on the completion queue.\r
+*\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(AL_API *uvp_peek_cq) (\r
+ IN const void* __ptr64 h_cq,\r
+ OUT uint32_t* const p_n_cqes );\r
+\r
+/*\r
+* PARAMETERS\r
+* h_cq\r
+* [in] Type-cast as appropriate for user/kernel mode, this is the\r
+* CQ handle for the completion queue being peeked.\r
+*\r
+* p_n_cqes\r
+* [out] Upon successful completion of this call, contains the number\r
+* of completion queue entries currently on the completion queue.\r
+*\r
+* RETURN VALUES\r
+* IB_SUCCESS\r
+* The peek operation completed successfully.\r
+*\r
+* IB_INVALID_CQ_HANDLE\r
+* The completion queue handle was invalid.\r
+*\r
+* IB_INVALID_PARAMETER\r
+* A reference to the completion queue entry count was not provided.\r
+*\r
+* PORTABILITY\r
+* Kernel and User mode\r
+*\r
+* SEE ALSO\r
+* uvp_pre_create_cq, uvp_post_create_cq_t, uvp_poll_cq, uvp_rearm_cq,\r
+* uvp_rearm_n_cq\r
+*****/\r
+\r
+/********/\r
+\r
+/****f* user-mode Verbs/uvp_poll_cq\r
+* NAME\r
+* uvp_poll_cq -- Retrieve a work completion record from a completion queue\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(AL_API *uvp_poll_cq) (\r
+ IN const void* __ptr64 h_cq,\r
+ IN OUT ib_wc_t** const pp_free_wclist,\r
+ OUT ib_wc_t** const pp_done_wclist );\r
+\r
+/*\r
+* DESCRIPTION\r
+* This routine retrieves a work completion entry from the specified\r
+* completion queue. The contents of the data returned in a work completion\r
+* is specified in ib_wc_t.\r
+*\r
+* PARAMETERS\r
+* h_cq\r
+* [in] Type-cast as appropriate for user/kernel mode, this is\r
+* the CQ handle for the completion queue being polled.\r
+* pp_free_wclist\r
+* [in out] A list of work request structures provided by the consumer\r
+* for the channel interface to return completed Completion Queue\r
+* entries. If not all the entries are consumed, this list holds the\r
+* list of un-utilized completion entries provided back to the consumer.\r
+* pp_done_wclist\r
+* [out] A list of work completions retrieved from the completion queue\r
+* and successfully processed.\r
+*\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* Poll completed successfully. If on completion the wc_free list is\r
+* empty, then there are potentially more entries and the consumer must\r
+* be ready to retrieve entries further.\r
+* IB_INVALID_CQ_HANDLE\r
+* The cq_handle supplied is not valid.\r
+* IB_NOT_FOUND\r
+* There are no more entries found in the specified CQ.\r
+*\r
+* PORTABILITY\r
+* Kernel & User mode.\r
+*\r
+* SEE ALSO\r
+* uvp_pre_create_cq, uvp_post_create_cq_t, uvp_rearm_cq,\r
+* uvp_rearm_n_cq, uvp_post_send, uvp_post_recv\r
+*\r
+********/\r
+\r
+/********/\r
+\r
+/****f* user-mode Verbs/uvp_rearm_cq\r
+* NAME\r
+* uvp_rearm_cq -- Invoke the Completion handler, on next entry added.\r
+*\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(AL_API *uvp_rearm_cq) (\r
+ IN const void* __ptr64 h_cq,\r
+ IN const boolean_t solicited );\r
+\r
+/*\r
+* DESCRIPTION\r
+* This routine instructs the channel interface to invoke the completion\r
+* handler when the next completion queue entry is added to this CQ.\r
+* Please refer to Volume 1, of the InfiniBand specification for a complete\r
+* description.\r
+*\r
+* PARAMETERS\r
+* h_cq\r
+* [in] Type-cast as appropriate for user/kernel mode, this is the\r
+* CQ handle for the completion queue being armed.\r
+* solicited\r
+* [in] A boolean flag indicating whether the request is to generate a\r
+* notification on the next entry or on the next solicited entry\r
+* being added to the completion queue.\r
+*\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The notification request was registered successfully.\r
+* IB_INVALID_CQ_HANDLE\r
+* cq_handle supplied is not a valid handle.\r
+*\r
+* PORTABILITY\r
+* Kernel and User mode\r
+*\r
+* SEE ALSO\r
+* uvp_pre_create_cq, uvp_post_create_cq_t, uvp_peek_cq, uvp_poll_cq,\r
+* uvp_rearm_n_cq\r
+*\r
+********/\r
+\r
+/********/\r
+\r
+/****f* user-mode Verbs/uvp_rearm_n_cq\r
+* NAME\r
+* uvp_rearm_n_cq -- Invoke the Completion handler, when next\r
+* N completions have been added to this CQ.\r
+*\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(AL_API *uvp_rearm_n_cq) (\r
+ IN const void* __ptr64 h_cq,\r
+ IN const uint32_t n_cqes );\r
+\r
+/*\r
+* DESCRIPTION\r
+* This routine instructs the channel interface to invoke the completion\r
+* handler when the next N completions are added to this CQ.\r
+*\r
+* PARAMETERS\r
+* h_cq\r
+* [in] Type-cast as appropriate for user/kernel mode, this is the\r
+* CQ handle for the completion queue being armed.\r
+* n_cqes\r
+* [in] The number of completion queue entries to be added to the\r
+* completion queue before notifying the client. This value must\r
+* greater than or equal to one and less than or equal to the size\r
+* of the completion queue.\r
+*\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The notification request was registered successfully.\r
+* IB_INVALID_CQ_HANDLE\r
+* cq_handle supplied is not a valid handle.\r
+* IB_INVALID_PARAMETER\r
+* The requested number of completion queue entries was invalid.\r
+*\r
+* PORTABILITY\r
+* Kernel and User mode\r
+*\r
+* SEE ALSO\r
+* uvp_pre_create_cq, uvp_post_create_cq_t, uvp_peek_cq, uvp_poll_cq,\r
+* uvp_rearm_cq\r
+*\r
+********/\r
+\r
+/********/\r
+\r
+/****f* user-mode Verbs/uvp_pre_attach_mcast\r
+* NAME\r
+* uvp_pre_attach_mcast -- Pre-ioctl function to Attach a queue pair\r
+* to a multicast group\r
+*\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(AL_API *uvp_pre_attach_mcast) (\r
+ IN const ib_qp_handle_t h_uvp_qp,\r
+ IN const ib_gid_t *p_mcast_gid,\r
+ IN const uint16_t mcast_lid,\r
+ IN OUT ci_umv_buf_t *p_umv_buf,\r
+ OUT ib_mcast_handle_t *ph_mcast);\r
+\r
+/*\r
+* DESCRIPTION\r
+* uvp_pre_attach_mcast() is the pre-ioctl routine implemented by vendor\r
+* to attach a queue pair to a multicast group.\r
+*\r
+* PARAMETERS\r
+* h_uvp_qp\r
+* [in] Vendor's Queue pair handle (in user-mode library)\r
+* which needs to be added to the multicast group on the adapter.\r
+* mcast_lid\r
+* [in] The multicast group LID value.\r
+* p_mcast_gid\r
+* [in] IPv6 address associated with this multicast group.\r
+* p_umv_buf\r
+* [in out] On input, UAL provides this buffer template.\r
+* On return from this function, p_umv_buf contains\r
+* any vendor-specific record to be exchanged with the vendor's\r
+* HCA driver.\r
+* ph_mcast\r
+* [out] (OPTIONAL) Vendor's Handle to the newly created Multicast handle\r
+* holding the association of this queue pair to the multicast group.\r
+*\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The queue pair handle was successfully added to the multicast\r
+* group.\r
+* IB_INVALID_QP_HANDLE\r
+* qp_handle supplied is invalid.\r
+* IB_INVALID_SERVICE_TYPE\r
+* Queue pair handle supplied is not of unreliable datagram type.\r
+* IB_INVALID_GID\r
+* The supplied addr is not a valid multicast ipv6 address.\r
+* IB_INSUFFICIENT_RESOURCES\r
+* Insufficient resources to complete the request.\r
+*\r
+* PORTABILITY\r
+* User mode.\r
+*\r
+* SEE ALSO\r
+* uvp_pre_create_qp, uvp_post_create_qp_t, uvp_post_attach_mcast_t,\r
+* uvp_pre_detach_mcast, uvp_post_detach_mcast_t\r
+*\r
+********/\r
+\r
+/********/\r
+\r
+/****f* user-mode Verbs/uvp_post_attach_mcast_t\r
+* NAME\r
+* uvp_post_attach_mcast_t -- Post-ioctl function to Attach a queue pair\r
+* to a multicast group\r
+*\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef void\r
+(AL_API *uvp_post_attach_mcast) (\r
+ IN const ib_qp_handle_t h_uvp_qp,\r
+ IN ib_api_status_t ioctl_status,\r
+ IN OUT ib_mcast_handle_t *ph_mcast,\r
+ IN ci_umv_buf_t *p_umv_buf );\r
+\r
+/*\r
+* DESCRIPTION\r
+* uvp_post_attach_mcast_t() is the post-ioctl routine implemented by vendor\r
+* to attach a queue pair to a multicast group.\r
+*\r
+* PARAMETERS\r
+* h_uvp_qp\r
+* [in] Vendor's Queue pair handle (in user-mode library)\r
+* which needs to be added to\r
+* the multicast group on the adapter.\r
+* ioctl_status\r
+* [in] The ioctl status of the AL API.\r
+* ph_mcast\r
+* [in out] Vendor's Multicast handle,\r
+* holding the association of this queue pair to the multicast group.\r
+* If it specified in pre function than it must be the same value here.\r
+* p_umv_buf\r
+* [in out] On input, it contains any vendor-specific private information\r
+* exchanged with the vendor's Verbs Provider Driver (uvp_pre_attach_mcast)\r
+* Vendor is expected to check vendor-specific status in\r
+* umv_buf as appropriate.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* PORTABILITY\r
+* Kernel & User mode.\r
+*\r
+* SEE ALSO\r
+* uvp_pre_create_qp, uvp_post_create_qp_t, uvp_pre_attach_mcast,\r
+* uvp_pre_detach_mcast, uvp_post_detach_mcast_t\r
+*\r
+********/\r
+\r
+/********/\r
+\r
+/****f* user-mode Verbs/uvp_pre_detach_mcast\r
+* NAME\r
+* uvp_pre_detach_mcast -- Pre-ioctl function to detach a queue pair\r
+* to a multicast group\r
+*\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef ib_api_status_t\r
+(AL_API *uvp_pre_detach_mcast) (\r
+ IN ib_mcast_handle_t h_uvp_mcast );\r
+\r
+/*\r
+* DESCRIPTION\r
+* uvp_pre_attach_mcast() is the pre-ioctl routine implemented by vendor\r
+* to attach a queue pair to a multicast group.\r
+* Upon return from the pre-ioctl function, UAL packages up the UMV buffer\r
+* in an IOCTL and passes it on to the user-mode proxy. UAL passes the\r
+* info to the user-mode proxy stating that it no longer wishes to receive\r
+* callback for mcast join for the caller. Note that UAL takes care of\r
+* handling callbcak.\r
+*\r
+* PARAMETERS\r
+* h_uvp_mcast\r
+* [in] Vendor's Multicast handle (in user-mode library)\r
+* holding the association of this queue pair to the multicast group.\r
+*\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The queue pair handle was successfully added to the multicast\r
+* group.\r
+*\r
+* PORTABILITY\r
+* Kernel & User mode.\r
+*\r
+* SEE ALSO\r
+* uvp_pre_create_qp, uvp_post_create_qp_t, uvp_pre_attach_mcast,\r
+* uvp_post_attach_mcast_t, uvp_post_detach_mcast_t\r
+*\r
+********/\r
+\r
+/********/\r
+\r
+/****f* user-mode Verbs/uvp_post_detach_mcast_t\r
+* NAME\r
+* uvp_post_detach_mcast_t -- Post-ioctl function to detach a queue pair\r
+* from a multicast group\r
+*\r
+* SYNOPSIS\r
+*/\r
+\r
+typedef void\r
+(AL_API *uvp_post_detach_mcast) (\r
+ IN ib_mcast_handle_t h_uvp_mcast,\r
+ IN ib_api_status_t ioctl_status );\r
+\r
+/*\r
+* DESCRIPTION\r
+* uvp_post_detach_mcast_t() is the post-ioctl routine implemented by vendor\r
+* to attach a queue pair to a multicast group.\r
+*\r
+* PARAMETERS\r
+* h_uvp_mcast\r
+* [out] Vendor's Multicast handle holding the association of this\r
+* queue pair to the multicast group.\r
+* ioctl_status\r
+* [in] The ioctl status of the AL API.\r
+*\r
+* RETURN VALUE\r
+* This function does not return a value.\r
+*\r
+* PORTABILITY\r
+* Kernel & User mode.\r
+*\r
+* SEE ALSO\r
+* uvp_pre_create_qp, uvp_post_create_qp_t, uvp_pre_attach_mcast,\r
+* uvp_post_attach_mcast_t, uvp_pre_detach_mcast\r
+*\r
+********/\r
+\r
+/********/\r
+\r
+/********/\r
+\r
+/****s* user-mode Verbs/uvp_interface_t\r
+* NAME\r
+* uvp_interface_t -- Interface holding supported Vendor APIs\r
+*\r
+* PURPOSE\r
+* The following structure is supplied by a Vendor library\r
+* providing verbs functionality.\r
+*\r
+* SOURCE\r
+*/\r
+typedef struct _uvp_interface\r
+{\r
+ ib_net64_t guid;\r
+ /*\r
+ * Version of the header file this interface export can handle\r
+ */\r
+ uint32_t version;\r
+\r
+ /* Version 2.00 APIs */\r
+\r
+ /*\r
+ * HCA Access Verbs\r
+ */\r
+ uvp_pre_open_ca_t pre_open_ca;\r
+ uvp_post_open_ca_t post_open_ca;\r
+\r
+ uvp_pre_query_ca pre_query_ca;\r
+ uvp_post_query_ca_t post_query_ca;\r
+\r
+ uvp_pre_modify_ca pre_modify_ca;\r
+ uvp_post_modify_ca_t post_modify_ca;\r
+\r
+ uvp_pre_close_ca_t pre_close_ca;\r
+ uvp_post_close_ca_t post_close_ca;\r
+\r
+ uvp_pre_ci_call pre_ci_call;\r
+ uvp_post_ci_call post_ci_call;\r
+\r
+\r
+ /*\r
+ * Protection Domain\r
+ */\r
+ uvp_pre_allocate_pd pre_allocate_pd;\r
+ uvp_post_allocate_pd_t post_allocate_pd;\r
+ uvp_pre_deallocate_pd pre_deallocate_pd;\r
+ uvp_post_deallocate_pd_t post_deallocate_pd;\r
+\r
+ /*\r
+ * Address Vector Management Verbs\r
+ */\r
+\r
+ uvp_pre_create_av pre_create_av;\r
+ uvp_post_create_av_t post_create_av;\r
+\r
+ uvp_pre_query_av pre_query_av;\r
+ uvp_post_query_av_t post_query_av;\r
+\r
+ uvp_pre_modify_av pre_modify_av;\r
+ uvp_post_modify_av_t post_modify_av;\r
+ uvp_pre_destroy_av pre_destroy_av;\r
+ uvp_post_destroy_av_t post_destroy_av;\r
+\r
+ /*\r
+ * SRQ Management Verbs\r
+ */\r
+ uvp_pre_create_srq pre_create_srq;\r
+ uvp_post_create_srq_t post_create_srq;\r
+\r
+ uvp_pre_modify_srq pre_modify_srq;\r
+ uvp_post_modify_srq_t post_modify_srq;\r
+\r
+ uvp_pre_query_srq pre_query_srq;\r
+ uvp_post_query_srq_t post_query_srq;\r
+\r
+ uvp_pre_destroy_srq pre_destroy_srq;\r
+ uvp_post_destroy_srq_t post_destroy_srq;\r
+\r
+\r
+ /*\r
+ * QP Management Verbs\r
+ */\r
+ uvp_pre_create_qp pre_create_qp;\r
+ uvp_post_create_qp_t post_create_qp;\r
+\r
+ /* No support for create_spl_qp, UAL will return error */\r
+\r
+ uvp_pre_modify_qp pre_modify_qp;\r
+ uvp_post_modify_qp_t post_modify_qp;\r
+\r
+ uvp_pre_query_qp pre_query_qp;\r
+ uvp_post_query_qp_t post_query_qp;\r
+\r
+ uvp_pre_destroy_qp pre_destroy_qp;\r
+ uvp_post_destroy_qp_t post_destroy_qp;\r
+\r
+ /*\r
+ * Completion Queue Management Verbs\r
+ */\r
+ uvp_pre_create_cq pre_create_cq;\r
+ uvp_post_create_cq_t post_create_cq;\r
+\r
+ uvp_pre_query_cq pre_query_cq;\r
+ uvp_post_query_cq_t post_query_cq;\r
+\r
+ uvp_pre_resize_cq pre_resize_cq;\r
+ uvp_post_resize_cq_t post_resize_cq;\r
+\r
+ uvp_pre_destroy_cq pre_destroy_cq;\r
+ uvp_post_destroy_cq_t post_destroy_cq;\r
+\r
+ /*\r
+ * Memory Window Verbs\r
+ */\r
+ uvp_pre_create_mw pre_create_mw;\r
+ uvp_post_create_mw_t post_create_mw;\r
+ uvp_pre_query_mw pre_query_mw;\r
+ uvp_post_query_mw_t post_query_mw;\r
+ uvp_pre_destroy_mw pre_destroy_mw;\r
+ uvp_post_destroy_mw_t post_destroy_mw;\r
+\r
+ /* No pre/post functions for bind */\r
+ uvp_bind_mw bind_mw;\r
+\r
+ /*\r
+ * Work Request Processing Verbs\r
+ * Should the types be same as Verbs?\r
+ */\r
+ uvp_post_send post_send;\r
+ uvp_post_recv post_recv;\r
+ uvp_post_srq_recv post_srq_recv;\r
+\r
+ /*\r
+ * Completion Processing and\r
+ * Completion Notification Request Verbs.\r
+ * Should the types be same as Verbs?\r
+ */\r
+ uvp_peek_cq peek_cq;\r
+ uvp_poll_cq poll_cq;\r
+ uvp_rearm_cq rearm_cq;\r
+ uvp_rearm_n_cq rearm_n_cq;\r
+\r
+ /*\r
+ * Multicast Support Verbs\r
+ */\r
+ uvp_pre_attach_mcast pre_attach_mcast;\r
+ uvp_post_attach_mcast post_attach_mcast;\r
+ uvp_pre_detach_mcast pre_detach_mcast;\r
+ uvp_post_detach_mcast post_detach_mcast;\r
+\r
+ /*\r
+ * ND Support Verbs\r
+ */\r
+ uvp_nd_modify_qp_t nd_modify_qp;\r
+ uvp_nd_get_qp_state_t nd_get_qp_state;\r
+ \r
+} uvp_interface_t;\r
+\r
+/********/\r
+\r
+/****f* user-mode Verbs/uvp_get_interface\r
+* NAME\r
+* uvp_get_interface -- Get the Vendor's supported Verbs calls\r
+*\r
+* SYNOPSIS\r
+*/\r
+typedef ib_api_status_t\r
+(AL_API *uvp_get_interface_t)(\r
+ IN OUT uvp_interface_t* const p_uvp );\r
+/*\r
+* DESCRIPTION\r
+* This routine is called by UAL to get the functions supported by\r
+* a vendor's library. Upon discovering a new CA, UAL will look for\r
+* the appropriate vendor library, load the library and query using\r
+* this function to get the supported interfaces.\r
+*\r
+* If the vendor does not support an interface function, it should be\r
+* set to NULL in the interface structure returned.\r
+*\r
+* PARAMETERS\r
+* p_uvp\r
+* [in out] Pointer to the uvp_interface_t structure that has the function\r
+* vector to support verbs functionality.\r
+*\r
+* RETURN VALUE\r
+* IB_SUCCESS\r
+* The registration is successful.\r
+* IB_INSUFFICIENT_MEMORY\r
+* Insufficient memory to satisfy request\r
+*\r
+* PORTABILITY\r
+* User mode\r
+*\r
+* SEE ALSO\r
+* uvp_interface_t\r
+*\r
+********/\r
+\r
+/********/\r
+\r
+#endif // __IB_UAL_UVP_H__\r
--- /dev/null
+/*\r
+ * Copyright (c) 2005 SilverStorm Technologies. All rights reserved.\r
+ *\r
+ * This software is available to you under the OpenIB.org BSD license\r
+ * below:\r
+ *\r
+ * Redistribution and use in source and binary forms, with or\r
+ * without modification, are permitted provided that the following\r
+ * conditions are met:\r
+ *\r
+ * - Redistributions of source code must retain the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer.\r
+ *\r
+ * - Redistributions in binary form must reproduce the above\r
+ * copyright notice, this list of conditions and the following\r
+ * disclaimer in the documentation and/or other materials\r
+ * provided with the distribution.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+ * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+ * SOFTWARE.\r
+ *\r
+ * $Id$\r
+ */\r
+\r
+#ifndef _IBSP_REGPATH_H_\r
+#define _IBSP_REGPATH_H_\r
+\r
+/* these definitions are common for installSP and WSD projects */\r
+#define IBSP_PM_REGISTRY_PATH \\r
+ TEXT("SYSTEM\\CurrentControlSet\\Services\\IBWSD\\")\r
+#define IBSP_PM_EVENTLOG_PATH \\r
+ TEXT("SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\IBWSD")\r
+#define IBSP_PM_SUBKEY_NAME TEXT("IBWSD")\r
+#define IBSP_PM_SUBKEY_PERF TEXT("Performance")\r
+#define IBSP_PM_INI_FILE "ibsp_perfcounters.ini"\r
+#define IBSP_PM_SYM_H_FILE "ibsp_perfini.h"\r
+\r
+\r
+enum IBSP_PM_COUNTERS\r
+{\r
+ BYTES_SEND = 0,\r
+ BYTES_RECV,\r
+ BYTES_WRITE,\r
+ BYTES_READ,\r
+ BYTES_TOTAL,\r
+ COMP_SEND,\r
+ COMP_RECV,\r
+ COMP_TOTAL,\r
+ INTR_TOTAL,\r
+ IBSP_PM_NUM_COUNTERS\r
+\r
+};\r
+\r
+\r
+/* counter symbol names */\r
+#define IBSP_PM_OBJ 0\r
+#define IBSP_PM_COUNTER( X ) ((X + 1) * 2)\r
+\r
+#endif /* _IBSP_REGPATH_H_ */\r