diff --git a/CMakeLists.txt b/CMakeLists.txt index 7e9e13262..a6fc092d7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -93,8 +93,6 @@ endif() # Setup the basic C compiler RDMA_BuildType() include_directories(${BUILD_INCLUDE}) -# FIXME: Eliminate HAVE_CONFIG_H, we always have it. -add_definitions(-DHAVE_CONFIG_H) # Require GNU99 mode RDMA_EnableCStd() diff --git a/COPYING b/COPYING deleted file mode 100644 index ac58180e9..000000000 --- a/COPYING +++ /dev/null @@ -1,6 +0,0 @@ -Unless otherwise stated this software is available to you under a choice of -one of two licenses. You may choose to be licensed under the terms of the the -OpenIB.org BSD license (see COPYING.BSD) or the GNU General Public License -(GPL) Version 2 (see COPYING.GPL2), both included in this package. - -Refer to individual files for information on the copyright holders. diff --git a/COPYING.BSD b/COPYING.BSD deleted file mode 100644 index 59b3a397a..000000000 --- a/COPYING.BSD +++ /dev/null @@ -1,26 +0,0 @@ - OpenIB.org BSD license - -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. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. diff --git a/COPYING.BSD_FB b/COPYING.BSD_FB new file mode 100644 index 000000000..44237612f --- /dev/null +++ b/COPYING.BSD_FB @@ -0,0 +1,22 @@ + OpenIB.org BSD license (FreeBSD Variant) + +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. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/COPYING.BSD_MIT b/COPYING.BSD_MIT new file mode 100644 index 000000000..a1432b613 --- /dev/null +++ b/COPYING.BSD_MIT @@ -0,0 +1,20 @@ + OpenIB.org BSD license (MIT variant) + +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. + diff --git a/COPYING.md b/COPYING.md new file mode 100644 index 000000000..d3a3919dc --- /dev/null +++ b/COPYING.md @@ -0,0 +1,75 @@ +# Default Dual License + +Unless otherwise stated this software is available to you under a choice of +one of two licenses. You may choose to be licensed under the terms of the the +OpenIB.org BSD (MIT variant) license (see COPYING.BSD_MIT) or the GNU General +Public License (GPL) Version 2 (see COPYING.GPL2), both included in this +package. + +Files marked 'See COPYING file' are licensed under the above Dual License. + +# Other Options + +Individual source files may use a license different from the above Defaul Dual +License. If a license is declared in the file then it supersedes the Default +License. + +If a directory contains a COPYING file then the License from that file becomes +the Default License for files in that directory and below. + +# Copyright Holders + +Refer to individual files for information on the copyright holders. + +# License Catalog (Informative, Non Binding) + +## Utilities + +Utility source code that may be linked into any binary are available under +several licenses: + + - MIT license (see ccan/LICENSE.BSD-MIT) + - Creative Commons CC0 1.0 Universal License (see ccan/LICENSE.CC0) + +## Providers + +The following providers use a different license than the Default Dual +License. Refer to files in each directory for details. + +cxbg4 +: A combination of the + - Default Dual License + - cxgb4/src/queue.h: BSD 3 clause license. + +hfi1verbs +: Dual License: GPLv2 or Intel 3 clause BSD license + +ipathverbs +: Dual License: GPLv2 or PathScale BSD Patent license + +ocrdma +: Dual License: GPLv2 or OpenIB.org BSD (FreeBSD variant), See COPYING.BSD_FB + +rxe +: A combination of the + - Default Dual License + - GPLv2 or PathScale BSD Patent license + +## Libraries + +All library compilable source code (.c and .h files) are available under the +Default Dual License. + +Unmarked ancillary files may be available under a Dual License: GPLv2 or +OpenIB.org BSD (FreeBSD variant). + +## Tools (iwpmd, srp_deamon, ibacm) + +All compilable source code (.c and .h files) are available under the Default +Dual License. + +Unmarked ancillary files may be available under a Dual License: GPLv2 or +OpenIB.org BSD (FreeBSD variant). + +srp_daemon/srp_daemon/srp_daemon.sh: Any one of the GPLv2, a 2 clause BSD +license or the CPLv1. diff --git a/buildlib/config.h.in b/buildlib/config.h.in index 0a87457e6..99103b779 100644 --- a/buildlib/config.h.in +++ b/buildlib/config.h.in @@ -1,12 +1,6 @@ #ifndef CONFIG_H_IN #define CONFIG_H_IN -// FIXME: Remove this, ibverbs is included so we don't need to detect -#define HAVE_IBV_DOFORK_RANGE 1 -#define HAVE_IBV_DONTFORK_RANGE 1 -#define HAVE_IBV_REGISTER_DRIVER 1 -#define HAVE_IBV_READ_SYSFS_FILE 1 - #define HAVE_STATEMENT_EXPR 1 #define HAVE_BUILTIN_TYPES_COMPATIBLE_P 1 #define HAVE_TYPEOF 1 @@ -15,16 +9,9 @@ // FIXME: Remove this, we provide the netlink kernel headers ibacm needs #define HAVE_NETLINK 1 -// FIXME: Remove this, The cmake version hard-requires symbol version support -#define HAVE_SYMVER_SUPPORT 1 - // FIXME: Remove this, The cmake version hard-requires new style CLOEXEC support #define STREAM_CLOEXEC "e" -// FIXME: Remove this, cmake always provides a valgrind/memcheck.h -#define HAVE_VALGRIND_MEMCHECK_H 1 -#define INCLUDE_VALGRIND 1 - #define IBV_CONFIG_DIR "@CONFIG_DIR@" #define RS_CONF_DIR "@CMAKE_INSTALL_FULL_SYSCONFDIR@/rdma/rsocket" #define IWPM_CONFIG_FILE "@CMAKE_INSTALL_FULL_SYSCONFDIR@/iwpmd.conf" diff --git a/ccan/CMakeLists.txt b/ccan/CMakeLists.txt index 505e0269d..b5de515eb 100644 --- a/ccan/CMakeLists.txt +++ b/ccan/CMakeLists.txt @@ -9,6 +9,7 @@ publish_internal_headers(ccan ) set(C_FILES + list.c str.c ) add_library(ccan STATIC ${C_FILES}) diff --git a/ccan/BSD-MIT b/ccan/LICENSE.BSD-MIT similarity index 100% rename from ccan/BSD-MIT rename to ccan/LICENSE.BSD-MIT diff --git a/ccan/CC0 b/ccan/LICENSE.CCO similarity index 100% rename from ccan/CC0 rename to ccan/LICENSE.CCO diff --git a/ccan/build_assert.h b/ccan/build_assert.h index b9ecd8402..0ecd7ff36 100644 --- a/ccan/build_assert.h +++ b/ccan/build_assert.h @@ -1,4 +1,4 @@ -/* CC0 (Public domain) - see LICENSE file for details */ +/* CC0 (Public domain) - see LICENSE.CC0 file for details */ #ifndef CCAN_BUILD_ASSERT_H #define CCAN_BUILD_ASSERT_H diff --git a/ccan/check_type.h b/ccan/check_type.h index 77501a955..7d7ff3769 100644 --- a/ccan/check_type.h +++ b/ccan/check_type.h @@ -1,4 +1,4 @@ -/* CC0 (Public domain) - see LICENSE file for details */ +/* CC0 (Public domain) - see LICENSE.CC0 file for details */ #ifndef CCAN_CHECK_TYPE_H #define CCAN_CHECK_TYPE_H #include "config.h" diff --git a/ccan/container_of.h b/ccan/container_of.h index c91b909f6..9180f37f0 100644 --- a/ccan/container_of.h +++ b/ccan/container_of.h @@ -1,4 +1,4 @@ -/* CC0 (Public domain) - see LICENSE file for details */ +/* CC0 (Public domain) - see LICENSE.CC0 file for details */ #ifndef CCAN_CONTAINER_OF_H #define CCAN_CONTAINER_OF_H #include diff --git a/ccan/list.c b/ccan/list.c new file mode 100644 index 000000000..0a163ef77 --- /dev/null +++ b/ccan/list.c @@ -0,0 +1,43 @@ +/* Licensed under BSD-MIT - see LICENSE.BSD-MIT file for details */ +#include +#include +#include "list.h" + +static void *corrupt(const char *abortstr, + const struct list_node *head, + const struct list_node *node, + unsigned int count) +{ + if (abortstr) { + fprintf(stderr, + "%s: prev corrupt in node %p (%u) of %p\n", + abortstr, node, count, head); + abort(); + } + return NULL; +} + +struct list_node *list_check_node(const struct list_node *node, + const char *abortstr) +{ + const struct list_node *p, *n; + int count = 0; + + for (p = node, n = node->next; n != node; p = n, n = n->next) { + count++; + if (n->prev != p) + return corrupt(abortstr, node, n, count); + } + /* Check prev on head node. */ + if (node->prev != p) + return corrupt(abortstr, node, node, 0); + + return (struct list_node *)node; +} + +struct list_head *list_check(const struct list_head *h, const char *abortstr) +{ + if (!list_check_node(&h->n, abortstr)) + return NULL; + return (struct list_head *)h; +} diff --git a/ccan/list.h b/ccan/list.h index 5bc93ffff..f7954a619 100644 --- a/ccan/list.h +++ b/ccan/list.h @@ -1,4 +1,4 @@ -/* Licensed under BSD-MIT - see LICENSE file for details */ +/* Licensed under BSD-MIT - see LICENSE.BSD-MIT file for details */ #ifndef CCAN_LIST_H #define CCAN_LIST_H //#define CCAN_LIST_DEBUG 1 diff --git a/ccan/minmax.h b/ccan/minmax.h index 5642f6523..ab6c55472 100644 --- a/ccan/minmax.h +++ b/ccan/minmax.h @@ -1,4 +1,4 @@ -/* CC0 (Public domain) - see LICENSE file for details */ +/* CC0 (Public domain) - see LICENSE.CC0 file for details */ #ifndef CCAN_MINMAX_H #define CCAN_MINMAX_H diff --git a/ccan/str.c b/ccan/str.c index e1daadbfd..3da90f4d0 100644 --- a/ccan/str.c +++ b/ccan/str.c @@ -1,4 +1,4 @@ -/* CC0 (Public domain) - see LICENSE file for details */ +/* CC0 (Public domain) - see LICENSE.CC0 file for details */ #include size_t strcount(const char *haystack, const char *needle) diff --git a/ccan/str.h b/ccan/str.h index 4e268b3ae..68c8a518b 100644 --- a/ccan/str.h +++ b/ccan/str.h @@ -1,4 +1,4 @@ -/* CC0 (Public domain) - see LICENSE file for details */ +/* CC0 (Public domain) - see LICENSE.CC0 file for details */ #ifndef CCAN_STR_H #define CCAN_STR_H #include "config.h" diff --git a/ccan/str_debug.h b/ccan/str_debug.h index 92c10c41c..7a3343816 100644 --- a/ccan/str_debug.h +++ b/ccan/str_debug.h @@ -1,4 +1,4 @@ -/* CC0 (Public domain) - see LICENSE file for details */ +/* CC0 (Public domain) - see LICENSE.CC0 file for details */ #ifndef CCAN_STR_DEBUG_H #define CCAN_STR_DEBUG_H diff --git a/ibacm/linux/osd.h b/ibacm/linux/osd.h index 2c4db81b9..c1e7d996c 100644 --- a/ibacm/linux/osd.h +++ b/ibacm/linux/osd.h @@ -46,6 +46,7 @@ #include #include #include +#include #include @@ -55,13 +56,6 @@ #define LIB_DESTRUCTOR __attribute__((destructor)) #define CDECL_FUNC -#if __BYTE_ORDER == __LITTLE_ENDIAN -#define htonll(x) bswap_64(x) -#else -#define htonll(x) (x) -#endif -#define ntohll(x) htonll(x) - #if DEFINE_ATOMICS typedef struct { pthread_mutex_t mut; int val; } atomic_t; static inline int atomic_inc(atomic_t *atomic) diff --git a/ibacm/prov/acmp/src/acmp.c b/ibacm/prov/acmp/src/acmp.c index 75231bfef..ed68bd706 100644 --- a/ibacm/prov/acmp/src/acmp.c +++ b/ibacm/prov/acmp/src/acmp.c @@ -28,9 +28,7 @@ * SOFTWARE. */ -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include diff --git a/ibacm/src/acm.c b/ibacm/src/acm.c index 41429e1db..146fbff61 100644 --- a/ibacm/src/acm.c +++ b/ibacm/src/acm.c @@ -28,9 +28,7 @@ * SOFTWARE. */ -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include diff --git a/ibacm/src/acme.c b/ibacm/src/acme.c index 4b5fe684c..e96d36ff9 100644 --- a/ibacm/src/acme.c +++ b/ibacm/src/acme.c @@ -28,9 +28,7 @@ * SOFTWARE. */ -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include diff --git a/ibacm/src/libacm.c b/ibacm/src/libacm.c index 3ad1db1d3..def5b2cf5 100644 --- a/ibacm/src/libacm.c +++ b/ibacm/src/libacm.c @@ -28,9 +28,7 @@ * SOFTWARE. */ -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include "libacm.h" diff --git a/libcxgb3/COPYING b/libcxgb3/COPYING deleted file mode 100644 index fee65943c..000000000 --- a/libcxgb3/COPYING +++ /dev/null @@ -1,29 +0,0 @@ -Copyright (c) 2006-2016. Chelsio Communications. All rights reserved. - -This software is available to you under a choice of one of two -licenses. You may choose to be licensed under the terms of the GNU -General Public License (GPL) Version 2, available from the file -COPYING in the main directory of this source tree, or 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. diff --git a/libcxgb3/src/cq.c b/libcxgb3/src/cq.c index a6393d7b4..1510d1e78 100644 --- a/libcxgb3/src/cq.c +++ b/libcxgb3/src/cq.c @@ -29,9 +29,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include diff --git a/libcxgb3/src/cxio_wr.h b/libcxgb3/src/cxio_wr.h index ece06bd05..e24c7fed7 100644 --- a/libcxgb3/src/cxio_wr.h +++ b/libcxgb3/src/cxio_wr.h @@ -50,13 +50,9 @@ #define Q_COUNT(rptr,wptr) ((wptr)-(rptr)) #define Q_PTR2IDX(ptr,size_log2) (ptr & ((1UL< -#endif /* HAVE_CONFIG_H */ +#include #include #include diff --git a/libcxgb3/src/qp.c b/libcxgb3/src/qp.c index 7dd3c7e34..30dd898f6 100644 --- a/libcxgb3/src/qp.c +++ b/libcxgb3/src/qp.c @@ -29,9 +29,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include diff --git a/libcxgb3/src/verbs.c b/libcxgb3/src/verbs.c index a2b737f2a..0cb78d753 100644 --- a/libcxgb3/src/verbs.c +++ b/libcxgb3/src/verbs.c @@ -29,9 +29,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include diff --git a/libcxgb4/src/cq.c b/libcxgb4/src/cq.c index a33d48488..1ed7dfdb8 100644 --- a/libcxgb4/src/cq.c +++ b/libcxgb4/src/cq.c @@ -29,9 +29,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include diff --git a/libcxgb4/src/dev.c b/libcxgb4/src/dev.c index 8c3ecddc6..316fc0569 100644 --- a/libcxgb4/src/dev.c +++ b/libcxgb4/src/dev.c @@ -29,9 +29,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include diff --git a/libcxgb4/src/qp.c b/libcxgb4/src/qp.c index 5444137c4..3c6d02109 100644 --- a/libcxgb4/src/qp.c +++ b/libcxgb4/src/qp.c @@ -29,9 +29,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include diff --git a/libcxgb4/src/t4.h b/libcxgb4/src/t4.h index e8c5cf66c..e519cc408 100644 --- a/libcxgb4/src/t4.h +++ b/libcxgb4/src/t4.h @@ -62,13 +62,10 @@ #define unlikely #define ROUND_UP(x, n) (((x) + (n) - 1u) & ~((n) - 1u)) #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) -#if __BYTE_ORDER == __LITTLE_ENDIAN -# define cpu_to_pci32(val) ((val)) -#elif __BYTE_ORDER == __BIG_ENDIAN -# define cpu_to_pci32(val) (__bswap_32((val))) -#else -# error __BYTE_ORDER not defined -#endif + +/* Generally speaking, PCI systems auto-byteswap on PCI accesses, so this is + probably wrong */ +#define cpu_to_pci32(val) htole32(val) #define writel(v, a) do { *((volatile u32 *)(a)) = cpu_to_pci32(v); } while (0) diff --git a/libcxgb4/src/verbs.c b/libcxgb4/src/verbs.c index aed547dc8..70d250f30 100644 --- a/libcxgb4/src/verbs.c +++ b/libcxgb4/src/verbs.c @@ -29,9 +29,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include diff --git a/libhfi1verbs/COPYING b/libhfi1verbs/COPYING deleted file mode 100644 index 3ecd547e9..000000000 --- a/libhfi1verbs/COPYING +++ /dev/null @@ -1,55 +0,0 @@ - -This file is provided under a dual BSD/GPLv2 license. When using or -redistributing this file, you may do so under either license. - -GPL LICENSE SUMMARY - -Copyright(c) 2015 Intel Corporation. - -This program is free software; you can redistribute it and/or modify -it under the terms of version 2 of the GNU General Public License as -published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -Contact Information: -Intel Corporation -www.intel.com - -BSD LICENSE - -Copyright(c) 2015 Intel Corporation. - -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. - * Neither the name of Intel Corporation nor the names of its - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -Copyright (c) 2013. Intel Corporation. All rights reserved. -Copyright (c) 2007. QLogic Corp. All rights reserved. -Copyright (c) 2005. PathScale, Inc. All rights reserved. - diff --git a/libhfi1verbs/src/hfiverbs.c b/libhfi1verbs/src/hfiverbs.c index ced438d1a..e28afc7fc 100644 --- a/libhfi1verbs/src/hfiverbs.c +++ b/libhfi1verbs/src/hfiverbs.c @@ -55,9 +55,7 @@ */ -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include @@ -219,25 +217,7 @@ static struct ibv_device *hfi1_driver_init(const char *uverbs_sys_path, return &dev->ibv_dev; } -#ifdef HAVE_IBV_REGISTER_DRIVER static __attribute__((constructor)) void hfi1_register_driver(void) { ibv_register_driver("hfi1verbs", hfi1_driver_init); } -#else -/* - * Export the old libsysfs sysfs_class_device-based driver entry point - * if libibverbs does not export an ibv_register_driver() function. - */ -struct ibv_device *openib_driver_init(struct sysfs_class_device *sysdev) -{ - int abi_ver = 0; - char value[8]; - - if (ibv_read_sysfs_file(sysdev->path, "abi_version", - value, sizeof value) > 0) - abi_ver = strtol(value, NULL, 10); - - return hfi1_driver_init(sysdev->path, abi_ver); -} -#endif /* HAVE_IBV_REGISTER_DRIVER */ diff --git a/libhfi1verbs/src/verbs.c b/libhfi1verbs/src/verbs.c index e245ad9e5..06ddbb712 100644 --- a/libhfi1verbs/src/verbs.c +++ b/libhfi1verbs/src/verbs.c @@ -55,9 +55,7 @@ */ -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include @@ -137,24 +135,15 @@ struct ibv_mr *hfi1_reg_mr(struct ibv_pd *pd, void *addr, { struct ibv_mr *mr; struct ibv_reg_mr cmd; + struct ibv_reg_mr_resp resp; int ret; mr = malloc(sizeof *mr); if (!mr) return NULL; -#ifdef IBV_CMD_REG_MR_HAS_RESP_PARAMS - { - struct ibv_reg_mr_resp resp; - - ret = ibv_cmd_reg_mr(pd, addr, length, (uintptr_t) addr, - access, mr, &cmd, sizeof cmd, - &resp, sizeof resp); - } -#else - ret = ibv_cmd_reg_mr(pd, addr, length, (uintptr_t)addr, - access, mr, &cmd, sizeof cmd); -#endif + ret = ibv_cmd_reg_mr(pd, addr, length, (uintptr_t)addr, access, mr, + &cmd, sizeof cmd, &resp, sizeof resp); if (ret) { free(mr); diff --git a/libi40iw/COPYING b/libi40iw/COPYING deleted file mode 100644 index b275c841f..000000000 --- a/libi40iw/COPYING +++ /dev/null @@ -1,372 +0,0 @@ -This software is available to you under a choice of one of two -licenses. You may choose to be licensed under the terms of the -OpenIB.org BSD license or the GNU General Public License (GPL) -Version 2, both included below. - -====================================================================== - - OpenIB.org BSD license - - 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. - -====================================================================== - - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. diff --git a/libi40iw/src/i40iw_umain.c b/libi40iw/src/i40iw_umain.c index ef694a025..1756e65ee 100644 --- a/libi40iw/src/i40iw_umain.c +++ b/libi40iw/src/i40iw_umain.c @@ -32,9 +32,7 @@ * *******************************************************************************/ -#if HAVE_CONFIG_H #include -#endif #include #include diff --git a/libi40iw/src/i40iw_umain.h b/libi40iw/src/i40iw_umain.h index 39b54ba29..13d3da89e 100644 --- a/libi40iw/src/i40iw_umain.h +++ b/libi40iw/src/i40iw_umain.h @@ -195,28 +195,14 @@ int i40iw_uattach_mcast(struct ibv_qp *, const union ibv_gid *, uint16_t); int i40iw_udetach_mcast(struct ibv_qp *, const union ibv_gid *, uint16_t); void i40iw_async_event(struct ibv_async_event *event); -#if __BYTE_ORDER == __LITTLE_ENDIAN static inline uint32_t cpu_to_le32(uint32_t x) { - return x; + return htole32(x); } static inline uint32_t le32_to_cpu(uint32_t x) { - return x; + return le32toh(x); } -#else -static inline uint32_t cpu_to_le32(uint32_t x) -{ - return ((x & 0xFF000000) >> 24) | ((x & 0x00FF0000) >> 8) | - ((x & 0x0000FF00) << 8) | ((x & 0x000000FF) << 24); -} - -static inline uint32_t le32_to_cpu(uint32_t x) -{ - return ((x & 0xFF000000) >> 24) | ((x & 0x00FF0000) >> 8) | - ((x & 0x0000FF00) << 8) | ((x & 0x000000FF) << 24); -} -#endif #endif /* i40iw_umain_H */ diff --git a/libi40iw/src/i40iw_uverbs.c b/libi40iw/src/i40iw_uverbs.c index 8369e10f6..a117b534f 100644 --- a/libi40iw/src/i40iw_uverbs.c +++ b/libi40iw/src/i40iw_uverbs.c @@ -32,9 +32,7 @@ * *******************************************************************************/ -#if HAVE_CONFIG_H #include -#endif #include #include @@ -156,9 +154,7 @@ struct ibv_mr *i40iw_ureg_mr(struct ibv_pd *pd, void *addr, size_t length, int a { struct ibv_mr *mr; struct i40iw_ureg_mr cmd; -#ifdef IBV_CMD_REG_MR_HAS_RESP_PARAMS struct ibv_reg_mr_resp resp; -#endif mr = malloc(sizeof(*mr)); if (!mr) @@ -166,14 +162,9 @@ struct ibv_mr *i40iw_ureg_mr(struct ibv_pd *pd, void *addr, size_t length, int a cmd.reg_type = I40IW_UMEMREG_TYPE_MEM; -#ifdef IBV_CMD_REG_MR_HAS_RESP_PARAMS if (ibv_cmd_reg_mr(pd, addr, length, (uintptr_t)addr, access, mr, &cmd.ibv_cmd, sizeof(cmd), &resp, sizeof(resp))) { -#else - if (ibv_cmd_reg_mr(pd, addr, length, (uintptr_t)addr, - access, mr, &cmd.ibv_cmd, sizeof(cmd))) { -#endif fprintf(stderr, PFX "%s: Failed to register memory\n", __func__); free(mr); return NULL; @@ -228,9 +219,7 @@ struct ibv_cq *i40iw_ucreate_cq(struct ibv_context *context, int cqe, struct i40iw_ureg_mr reg_mr_cmd; -#ifdef IBV_CMD_REG_MR_HAS_RESP_PARAMS struct ibv_reg_mr_resp reg_mr_resp; -#endif if (cqe > I40IW_MAX_CQ_SIZE) return NULL; @@ -270,18 +259,10 @@ struct ibv_cq *i40iw_ucreate_cq(struct ibv_context *context, int cqe, reg_mr_cmd.cq_pages = cq_pages; -#ifdef IBV_CMD_REG_MR_HAS_RESP_PARAMS ret = ibv_cmd_reg_mr(&iwvctx->iwupd->ibv_pd, (void *)info.cq_base, totalsize, (uintptr_t)info.cq_base, IBV_ACCESS_LOCAL_WRITE, &iwucq->mr, ®_mr_cmd.ibv_cmd, sizeof(reg_mr_cmd), ®_mr_resp, sizeof(reg_mr_resp)); -#else - ret = ibv_cmd_reg_mr(&iwvctx->iwupd->ibv_pd, (void *)info.sq, totalsize, - (uintptr_t)info.cq_base, IBV_ACCESS_LOCAL_WRITE, - &iwucq->mr, ®_mr_cmd.ibv_cmd, - sizeof(reg_mr_cmd)); -#endif - if (ret) { fprintf(stderr, PFX "%s: failed to pin memory for CQ\n", __func__); goto err; @@ -511,10 +492,7 @@ static int i40iw_vmapped_qp(struct i40iw_uqp *iwuqp, struct ibv_pd *pd, int ret; struct i40iw_ureg_mr reg_mr_cmd; u32 sq_pages, rq_pages; - -#ifdef IBV_CMD_REG_MR_HAS_RESP_PARAMS struct ibv_reg_mr_resp reg_mr_resp; -#endif memset(®_mr_cmd, 0, sizeof(reg_mr_cmd)); if ((sqdepth % I40IWQP_SW_WQSIZE_1024)) @@ -542,15 +520,9 @@ static int i40iw_vmapped_qp(struct i40iw_uqp *iwuqp, struct ibv_pd *pd, reg_mr_cmd.sq_pages = sq_pages; reg_mr_cmd.rq_pages = rq_pages; -#ifdef IBV_CMD_REG_MR_HAS_RESP_PARAMS ret = ibv_cmd_reg_mr(pd, (void *)info->sq, totalqpsize, (uintptr_t)info->sq, IBV_ACCESS_LOCAL_WRITE, &iwuqp->mr, ®_mr_cmd.ibv_cmd, sizeof(reg_mr_cmd), ®_mr_resp, sizeof(reg_mr_resp)); -#else - ret = ibv_cmd_reg_mr(pd, (void *)info->sq, totalqpsize, (uintptr_t)info->sq, - IBV_ACCESS_LOCAL_WRITE, &iwuqp->mr, ®_mr_cmd.ibv_cmd, - sizeof(reg_mr_cmd)); -#endif if (ret) { fprintf(stderr, PFX "%s: failed to pin memory for SQ\n", __func__); free(info->sq); diff --git a/libibcm/src/cm.c b/libibcm/src/cm.c index f5318f01f..f775923aa 100644 --- a/libibcm/src/cm.c +++ b/libibcm/src/cm.c @@ -33,9 +33,7 @@ * $Id$ */ #define _GNU_SOURCE -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include @@ -51,16 +49,7 @@ #include #include -#ifdef INCLUDE_VALGRIND -# include -# ifndef VALGRIND_MAKE_MEM_DEFINED -# warning "Valgrind requested, but VALGRIND_MAKE_MEM_DEFINED undefined" -# endif -#endif - -#ifndef VALGRIND_MAKE_MEM_DEFINED -# define VALGRIND_MAKE_MEM_DEFINED(addr,len) -#endif +#include #define PFX "libibcm: " diff --git a/libibumad/src/sysfs.c b/libibumad/src/sysfs.c index 5d9460851..011e411f0 100644 --- a/libibumad/src/sysfs.c +++ b/libibumad/src/sysfs.c @@ -30,9 +30,7 @@ * SOFTWARE. * */ -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include @@ -43,15 +41,9 @@ #include #include #include -#include #include #include - -#if __BYTE_ORDER == __LITTLE_ENDIAN -#define htonll(x) bswap_64(x) -#else -#define htonll(x) (x) -#endif +#include static int ret_code(void) { diff --git a/libibumad/src/umad.c b/libibumad/src/umad.c index a7879d385..0c969f1eb 100644 --- a/libibumad/src/umad.c +++ b/libibumad/src/umad.c @@ -32,9 +32,7 @@ * */ -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include @@ -54,19 +52,7 @@ #define IB_OPENIB_OUI (0x001405) -#ifdef HAVE_VALGRIND_MEMCHECK_H - -# include - -# ifndef VALGRIND_MAKE_MEM_DEFINED -# warning "Valgrind support requested, but VALGRIND_MAKE_MEM_DEFINED not available" -# endif - -#endif /* HAVE_VALGRIND_MEMCHECK_H */ - -#ifndef VALGRIND_MAKE_MEM_DEFINED -# define VALGRIND_MAKE_MEM_DEFINED(addr,len) -#endif +#include typedef struct ib_user_mad_reg_req { uint32_t id; diff --git a/libibumad/tests/umad_reg2_compat.c b/libibumad/tests/umad_reg2_compat.c index 9c239ee4b..264882ccc 100644 --- a/libibumad/tests/umad_reg2_compat.c +++ b/libibumad/tests/umad_reg2_compat.c @@ -31,9 +31,7 @@ * */ -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include diff --git a/libibumad/tests/umad_register2.c b/libibumad/tests/umad_register2.c index ed7e816bb..7a9b655ae 100644 --- a/libibumad/tests/umad_register2.c +++ b/libibumad/tests/umad_register2.c @@ -31,9 +31,7 @@ * */ -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include diff --git a/libibverbs/examples/asyncwatch.c b/libibverbs/examples/asyncwatch.c index c78994d24..7af13bf93 100644 --- a/libibverbs/examples/asyncwatch.c +++ b/libibverbs/examples/asyncwatch.c @@ -30,9 +30,7 @@ * SOFTWARE. */ #define _GNU_SOURCE -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include diff --git a/libibverbs/examples/device_list.c b/libibverbs/examples/device_list.c index 70c3af51b..13f40ad63 100644 --- a/libibverbs/examples/device_list.c +++ b/libibverbs/examples/device_list.c @@ -30,9 +30,7 @@ * SOFTWARE. */ -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include diff --git a/libibverbs/examples/devinfo.c b/libibverbs/examples/devinfo.c index e814bacdf..5fd1affa4 100644 --- a/libibverbs/examples/devinfo.c +++ b/libibverbs/examples/devinfo.c @@ -31,9 +31,7 @@ * SOFTWARE. */ -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include diff --git a/libibverbs/examples/rc_pingpong.c b/libibverbs/examples/rc_pingpong.c index 5aa3417c6..c92e551c0 100644 --- a/libibverbs/examples/rc_pingpong.c +++ b/libibverbs/examples/rc_pingpong.c @@ -30,9 +30,7 @@ * SOFTWARE. */ #define _GNU_SOURCE -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include diff --git a/libibverbs/examples/srq_pingpong.c b/libibverbs/examples/srq_pingpong.c index f17972580..863ff10dd 100644 --- a/libibverbs/examples/srq_pingpong.c +++ b/libibverbs/examples/srq_pingpong.c @@ -30,9 +30,7 @@ * SOFTWARE. */ #define _GNU_SOURCE -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include diff --git a/libibverbs/examples/uc_pingpong.c b/libibverbs/examples/uc_pingpong.c index 7d982d36a..2b105b947 100644 --- a/libibverbs/examples/uc_pingpong.c +++ b/libibverbs/examples/uc_pingpong.c @@ -30,9 +30,7 @@ * SOFTWARE. */ #define _GNU_SOURCE -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include diff --git a/libibverbs/examples/ud_pingpong.c b/libibverbs/examples/ud_pingpong.c index deefb9b81..d0cd73cc0 100644 --- a/libibverbs/examples/ud_pingpong.c +++ b/libibverbs/examples/ud_pingpong.c @@ -30,9 +30,7 @@ * SOFTWARE. */ #define _GNU_SOURCE -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include diff --git a/libibverbs/examples/xsrq_pingpong.c b/libibverbs/examples/xsrq_pingpong.c index 903548ed6..c22893e0e 100644 --- a/libibverbs/examples/xsrq_pingpong.c +++ b/libibverbs/examples/xsrq_pingpong.c @@ -31,9 +31,7 @@ * SOFTWARE. */ #define _GNU_SOURCE -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include diff --git a/libibverbs/include/infiniband/arch.h b/libibverbs/include/infiniband/arch.h index e35ecf05b..bf0feec08 100644 --- a/libibverbs/include/infiniband/arch.h +++ b/libibverbs/include/infiniband/arch.h @@ -37,15 +37,12 @@ #include #include -#if __BYTE_ORDER == __LITTLE_ENDIAN -static inline uint64_t htonll(uint64_t x) { return bswap_64(x); } -static inline uint64_t ntohll(uint64_t x) { return bswap_64(x); } -#elif __BYTE_ORDER == __BIG_ENDIAN -static inline uint64_t htonll(uint64_t x) { return x; } -static inline uint64_t ntohll(uint64_t x) { return x; } -#else -#error __BYTE_ORDER is neither __LITTLE_ENDIAN nor __BIG_ENDIAN -#endif +#undef htonll +#undef ntohll +static inline uint64_t htonll(uint64_t x) { return htobe64(x); } +static inline uint64_t ntohll(uint64_t x) { return be64toh(x); } +#define htonll htonll +#define ntohll ntohll /* * Architecture-specific defines. Currently, an architecture is diff --git a/libibverbs/src/cmd.c b/libibverbs/src/cmd.c index 11f65095b..06a017b0c 100644 --- a/libibverbs/src/cmd.c +++ b/libibverbs/src/cmd.c @@ -32,9 +32,7 @@ * SOFTWARE. */ -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include diff --git a/libibverbs/src/compat-1_0.c b/libibverbs/src/compat-1_0.c index 6b1961d19..b286fd73e 100644 --- a/libibverbs/src/compat-1_0.c +++ b/libibverbs/src/compat-1_0.c @@ -30,9 +30,7 @@ * SOFTWARE. */ -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include diff --git a/libibverbs/src/device.c b/libibverbs/src/device.c index cfdf7cfd3..b4864e3e3 100644 --- a/libibverbs/src/device.c +++ b/libibverbs/src/device.c @@ -31,9 +31,7 @@ * SOFTWARE. */ #define _GNU_SOURCE -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include diff --git a/libibverbs/src/ibverbs.h b/libibverbs/src/ibverbs.h index 062a49091..a01dff2b4 100644 --- a/libibverbs/src/ibverbs.h +++ b/libibverbs/src/ibverbs.h @@ -38,19 +38,7 @@ #include -#ifdef HAVE_VALGRIND_MEMCHECK_H - -# include - -# ifndef VALGRIND_MAKE_MEM_DEFINED -# warning "Valgrind support requested, but VALGRIND_MAKE_MEM_DEFINED not available" -# endif - -#endif /* HAVE_VALGRIND_MEMCHECK_H */ - -#ifndef VALGRIND_MAKE_MEM_DEFINED -# define VALGRIND_MAKE_MEM_DEFINED(addr, len) 0 -#endif +#include #define HIDDEN __attribute__((visibility ("hidden"))) @@ -59,16 +47,9 @@ #define DEFAULT_ABI "IBVERBS_1.1" -#ifdef HAVE_SYMVER_SUPPORT -# define symver(name, api, ver) \ - asm(".symver " #name "," #api "@" #ver) -# define default_symver(name, api) \ +#define symver(name, api, ver) asm(".symver " #name "," #api "@" #ver) +#define default_symver(name, api) \ asm(".symver " #name "," #api "@@" DEFAULT_ABI) -#else -# define symver(name, api, ver) -# define default_symver(name, api) \ - extern __typeof(name) api __attribute__((alias(#name))) -#endif /* HAVE_SYMVER_SUPPORT */ #define PFX "libibverbs: " diff --git a/libibverbs/src/init.c b/libibverbs/src/init.c index 7ae0fc87d..779756938 100644 --- a/libibverbs/src/init.c +++ b/libibverbs/src/init.c @@ -31,9 +31,7 @@ * SOFTWARE. */ #define _GNU_SOURCE -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include diff --git a/libibverbs/src/marshall.c b/libibverbs/src/marshall.c index 577b4b1ec..a33048404 100644 --- a/libibverbs/src/marshall.c +++ b/libibverbs/src/marshall.c @@ -30,9 +30,7 @@ * SOFTWARE. */ -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include diff --git a/libibverbs/src/memory.c b/libibverbs/src/memory.c index 89509c6e3..5c8255d47 100644 --- a/libibverbs/src/memory.c +++ b/libibverbs/src/memory.c @@ -31,9 +31,7 @@ * SOFTWARE. */ -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include @@ -48,17 +46,6 @@ #include "ibverbs.h" -/* - * Most distro's headers don't have these yet. - */ -#ifndef MADV_DONTFORK -#define MADV_DONTFORK 10 -#endif - -#ifndef MADV_DOFORK -#define MADV_DOFORK 11 -#endif - struct ibv_mem_node { enum { IBV_RED, diff --git a/libibverbs/src/sysfs.c b/libibverbs/src/sysfs.c index 2e68da4bc..d463241ad 100644 --- a/libibverbs/src/sysfs.c +++ b/libibverbs/src/sysfs.c @@ -30,9 +30,7 @@ * SOFTWARE. */ #define _GNU_SOURCE -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include diff --git a/libibverbs/src/verbs.c b/libibverbs/src/verbs.c index debb6f687..b470ba043 100644 --- a/libibverbs/src/verbs.c +++ b/libibverbs/src/verbs.c @@ -32,9 +32,7 @@ */ #define _GNU_SOURCE -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include diff --git a/libipathverbs/src/ipathverbs.c b/libipathverbs/src/ipathverbs.c index 2ae1689a1..4b945f6c5 100644 --- a/libipathverbs/src/ipathverbs.c +++ b/libipathverbs/src/ipathverbs.c @@ -35,9 +35,7 @@ * product whatsoever. */ -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include @@ -218,25 +216,7 @@ static struct ibv_device *ipath_driver_init(const char *uverbs_sys_path, return &dev->ibv_dev; } -#ifdef HAVE_IBV_REGISTER_DRIVER static __attribute__((constructor)) void ipath_register_driver(void) { ibv_register_driver("ipathverbs", ipath_driver_init); } -#else -/* - * Export the old libsysfs sysfs_class_device-based driver entry point - * if libibverbs does not export an ibv_register_driver() function. - */ -struct ibv_device *openib_driver_init(struct sysfs_class_device *sysdev) -{ - int abi_ver = 0; - char value[8]; - - if (ibv_read_sysfs_file(sysdev->path, "abi_version", - value, sizeof value) > 0) - abi_ver = strtol(value, NULL, 10); - - return ipath_driver_init(sysdev->path, abi_ver); -} -#endif /* HAVE_IBV_REGISTER_DRIVER */ diff --git a/libipathverbs/src/verbs.c b/libipathverbs/src/verbs.c index 578a38af3..35b2162a8 100644 --- a/libipathverbs/src/verbs.c +++ b/libipathverbs/src/verbs.c @@ -35,9 +35,7 @@ * product whatsoever. */ -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include @@ -117,25 +115,15 @@ struct ibv_mr *ipath_reg_mr(struct ibv_pd *pd, void *addr, { struct ibv_mr *mr; struct ibv_reg_mr cmd; + struct ibv_reg_mr_resp resp; int ret; mr = malloc(sizeof *mr); if (!mr) return NULL; -#ifdef IBV_CMD_REG_MR_HAS_RESP_PARAMS - { - struct ibv_reg_mr_resp resp; - - ret = ibv_cmd_reg_mr(pd, addr, length, (uintptr_t) addr, - access, mr, &cmd, sizeof cmd, - &resp, sizeof resp); - } -#else - ret = ibv_cmd_reg_mr(pd, addr, length, (uintptr_t)addr, - access, mr, &cmd, sizeof cmd); -#endif - + ret = ibv_cmd_reg_mr(pd, addr, length, (uintptr_t)addr, access, mr, + &cmd, sizeof cmd, &resp, sizeof resp); if (ret) { free(mr); return NULL; diff --git a/libmlx4/src/buf.c b/libmlx4/src/buf.c index c06b3fded..9b41e7f62 100644 --- a/libmlx4/src/buf.c +++ b/libmlx4/src/buf.c @@ -30,9 +30,7 @@ * SOFTWARE. */ -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include diff --git a/libmlx4/src/cq.c b/libmlx4/src/cq.c index 2edbec8e3..23cc3ed69 100644 --- a/libmlx4/src/cq.c +++ b/libmlx4/src/cq.c @@ -32,9 +32,7 @@ * SOFTWARE. */ -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include diff --git a/libmlx4/src/dbrec.c b/libmlx4/src/dbrec.c index 21ff93664..26d696fb9 100644 --- a/libmlx4/src/dbrec.c +++ b/libmlx4/src/dbrec.c @@ -30,9 +30,7 @@ * SOFTWARE. */ #define _GNU_SOURCE -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include diff --git a/libmlx4/src/mlx4.c b/libmlx4/src/mlx4.c index 1757ca325..326ead413 100644 --- a/libmlx4/src/mlx4.c +++ b/libmlx4/src/mlx4.c @@ -30,9 +30,7 @@ * SOFTWARE. */ -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include diff --git a/libmlx4/src/mlx4.h b/libmlx4/src/mlx4.h index feea3386f..1855cfbcb 100644 --- a/libmlx4/src/mlx4.h +++ b/libmlx4/src/mlx4.h @@ -47,47 +47,7 @@ #define uninitialized_var(x) x = x #endif -#ifdef HAVE_VALGRIND_MEMCHECK_H - -# include - -# if !defined(VALGRIND_MAKE_MEM_DEFINED) || !defined(VALGRIND_MAKE_MEM_UNDEFINED) -# warning "Valgrind support requested, but VALGRIND_MAKE_MEM_(UN)DEFINED not available" -# endif - -#endif /* HAVE_VALGRIND_MEMCHECK_H */ - -#ifndef VALGRIND_MAKE_MEM_DEFINED -# define VALGRIND_MAKE_MEM_DEFINED(addr,len) -#endif - -#ifndef VALGRIND_MAKE_MEM_UNDEFINED -# define VALGRIND_MAKE_MEM_UNDEFINED(addr,len) -#endif - -#ifndef rmb -# define rmb() mb() -#endif - -#ifndef wmb -# define wmb() mb() -#endif - -#ifndef wc_wmb - -#if defined(__i386__) -#define wc_wmb() asm volatile("lock; addl $0,0(%%esp) " ::: "memory") -#elif defined(__x86_64__) -#define wc_wmb() asm volatile("sfence" ::: "memory") -#elif defined(__ia64__) -#define wc_wmb() asm volatile("fwb" ::: "memory") -#elif defined(__s390x__) -#define wc_wmb { asm volatile("" : : : "memory") } -#else -#define wc_wmb() wmb() -#endif - -#endif +#include #define HIDDEN __attribute__((visibility ("hidden"))) diff --git a/libmlx4/src/qp.c b/libmlx4/src/qp.c index 1b730bfea..4b5acd711 100644 --- a/libmlx4/src/qp.c +++ b/libmlx4/src/qp.c @@ -32,9 +32,7 @@ * SOFTWARE. */ -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include diff --git a/libmlx4/src/srq.c b/libmlx4/src/srq.c index 28bc2d41c..c0e028671 100644 --- a/libmlx4/src/srq.c +++ b/libmlx4/src/srq.c @@ -30,9 +30,7 @@ * SOFTWARE. */ -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include diff --git a/libmlx4/src/verbs.c b/libmlx4/src/verbs.c index 5cc82cf38..50a443406 100644 --- a/libmlx4/src/verbs.c +++ b/libmlx4/src/verbs.c @@ -30,9 +30,7 @@ * SOFTWARE. */ -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include diff --git a/libmlx5/COPYING b/libmlx5/COPYING deleted file mode 100644 index add3d1990..000000000 --- a/libmlx5/COPYING +++ /dev/null @@ -1,378 +0,0 @@ -This software is available to you under a choice of one of two -licenses. You may choose to be licensed under the terms of the the -OpenIB.org BSD license or the GNU General Public License (GPL) Version -2, both included below. - -Copyright (c) 2007 Cisco, Inc. All rights reserved. - -================================================================== - - OpenIB.org BSD license - -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. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -================================================================== - - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/libmlx5/src/buf.c b/libmlx5/src/buf.c index 1a681c6a3..853450ae9 100644 --- a/libmlx5/src/buf.c +++ b/libmlx5/src/buf.c @@ -30,9 +30,7 @@ * SOFTWARE. */ -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include @@ -44,25 +42,6 @@ #include "mlx5.h" #include "bitmap.h" -#if !(defined(HAVE_IBV_DONTFORK_RANGE) && defined(HAVE_IBV_DOFORK_RANGE)) - -/* - * If libibverbs isn't exporting these functions, then there's no - * point in doing it here, because the rest of libibverbs isn't going - * to be fork-safe anyway. - */ -static int ibv_dontfork_range(void *base, size_t size) -{ - return 0; -} - -static int ibv_dofork_range(void *base, size_t size) -{ - return 0; -} - -#endif /* HAVE_IBV_DONTFORK_RANGE && HAVE_IBV_DOFORK_RANGE */ - static int mlx5_bitmap_init(struct mlx5_bitmap *bitmap, uint32_t num, uint32_t mask) { diff --git a/libmlx5/src/cq.c b/libmlx5/src/cq.c index 5ad076c40..2a53c8977 100644 --- a/libmlx5/src/cq.c +++ b/libmlx5/src/cq.c @@ -30,10 +30,7 @@ * SOFTWARE. */ - -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include diff --git a/libmlx5/src/dbrec.c b/libmlx5/src/dbrec.c index dbc0e650b..3af81124e 100644 --- a/libmlx5/src/dbrec.c +++ b/libmlx5/src/dbrec.c @@ -30,9 +30,7 @@ * SOFTWARE. */ #define _GNU_SOURCE -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include diff --git a/libmlx5/src/mlx5.c b/libmlx5/src/mlx5.c index 058b52fcd..f24e5043d 100644 --- a/libmlx5/src/mlx5.c +++ b/libmlx5/src/mlx5.c @@ -30,9 +30,7 @@ * SOFTWARE. */ #define _GNU_SOURCE -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include @@ -44,10 +42,6 @@ #include #include -#ifndef HAVE_IBV_REGISTER_DRIVER -#include -#endif - #include "mlx5.h" #include "mlx5-abi.h" diff --git a/libmlx5/src/mlx5.h b/libmlx5/src/mlx5.h index 6c4e83002..c209a7964 100644 --- a/libmlx5/src/mlx5.h +++ b/libmlx5/src/mlx5.h @@ -52,45 +52,7 @@ #define uninitialized_var(x) x = x #endif -#ifdef HAVE_VALGRIND_MEMCHECK_H - -# include - -# if !defined(VALGRIND_MAKE_MEM_DEFINED) || !defined(VALGRIND_MAKE_MEM_UNDEFINED) -# warning "Valgrind support requested, but VALGRIND_MAKE_MEM_(UN)DEFINED not available" -# endif - -#endif /* HAVE_VALGRIND_MEMCHECK_H */ - -#ifndef VALGRIND_MAKE_MEM_DEFINED -# define VALGRIND_MAKE_MEM_DEFINED(addr, len) -#endif - -#ifndef VALGRIND_MAKE_MEM_UNDEFINED -# define VALGRIND_MAKE_MEM_UNDEFINED(addr, len) -#endif - -#ifndef rmb -# define rmb() mb() -#endif - -#ifndef wmb -# define wmb() mb() -#endif - -#ifndef wc_wmb - -#if defined(__i386__) -#define wc_wmb() asm volatile("lock; addl $0, 0(%%esp) " ::: "memory") -#elif defined(__x86_64__) -#define wc_wmb() asm volatile("sfence" ::: "memory") -#elif defined(__ia64__) -#define wc_wmb() asm volatile("fwb" ::: "memory") -#else -#define wc_wmb() wmb() -#endif - -#endif +#include #define HIDDEN __attribute__((visibility("hidden"))) diff --git a/libmlx5/src/qp.c b/libmlx5/src/qp.c index 9363fddc3..04abe1588 100644 --- a/libmlx5/src/qp.c +++ b/libmlx5/src/qp.c @@ -30,10 +30,7 @@ * SOFTWARE. */ - -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include diff --git a/libmlx5/src/srq.c b/libmlx5/src/srq.c index 24979bfb6..a06afa3a5 100644 --- a/libmlx5/src/srq.c +++ b/libmlx5/src/srq.c @@ -30,9 +30,7 @@ * SOFTWARE. */ -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include diff --git a/libmlx5/src/verbs.c b/libmlx5/src/verbs.c index 4be602be8..ef85a6363 100644 --- a/libmlx5/src/verbs.c +++ b/libmlx5/src/verbs.c @@ -30,9 +30,7 @@ * SOFTWARE. */ -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include @@ -173,25 +171,15 @@ struct ibv_mr *mlx5_reg_mr(struct ibv_pd *pd, void *addr, size_t length, struct ibv_reg_mr cmd; int ret; enum ibv_access_flags access = (enum ibv_access_flags)acc; + struct ibv_reg_mr_resp resp; mr = calloc(1, sizeof(*mr)); if (!mr) return NULL; -#ifdef IBV_CMD_REG_MR_HAS_RESP_PARAMS - { - struct ibv_reg_mr_resp resp; - - ret = ibv_cmd_reg_mr(pd, addr, length, (uintptr_t) addr, - access, &(mr->ibv_mr), - &cmd, sizeof(cmd), - &resp, sizeof resp); - } -#else - ret = ibv_cmd_reg_mr(pd, addr, length, (uintptr_t) addr, access, - &(mr->ibv_mr), - &cmd, sizeof cmd); -#endif + ret = ibv_cmd_reg_mr(pd, addr, length, (uintptr_t)addr, access, + &(mr->ibv_mr), &cmd, sizeof(cmd), &resp, + sizeof resp); if (ret) { mlx5_free_buf(&(mr->buf)); free(mr); @@ -995,9 +983,7 @@ static const char *qptype2key(enum ibv_qp_type type) case IBV_QPT_RC: return "HUGE_RC"; case IBV_QPT_UC: return "HUGE_UC"; case IBV_QPT_UD: return "HUGE_UD"; -#ifdef _NOT_EXISTS_IN_OFED_2_0 case IBV_QPT_RAW_PACKET: return "HUGE_RAW_ETH"; -#endif default: return "HUGE_NA"; } } diff --git a/libmthca/COPYING b/libmthca/COPYING deleted file mode 100644 index ee1a79ffa..000000000 --- a/libmthca/COPYING +++ /dev/null @@ -1,378 +0,0 @@ -This software is available to you under a choice of one of two -licenses. You may choose to be licensed under the terms of the the -OpenIB.org BSD license or the GNU General Public License (GPL) Version -2, both included below. - -Copyright (c) 2004 Topspin Communications. All rights reserved. - -================================================================== - - OpenIB.org BSD license - -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. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -================================================================== - - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/libmthca/src/ah.c b/libmthca/src/ah.c index d7494d57f..e83d66527 100644 --- a/libmthca/src/ah.c +++ b/libmthca/src/ah.c @@ -30,9 +30,7 @@ * SOFTWARE. */ -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include diff --git a/libmthca/src/buf.c b/libmthca/src/buf.c index 074a5f8dc..c03ee1f9a 100644 --- a/libmthca/src/buf.c +++ b/libmthca/src/buf.c @@ -30,9 +30,7 @@ * SOFTWARE. */ -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include @@ -40,25 +38,6 @@ #include "mthca.h" -#if !(defined(HAVE_IBV_DONTFORK_RANGE) && defined(HAVE_IBV_DOFORK_RANGE)) - -/* - * If libibverbs isn't exporting these functions, then there's no - * point in doing it here, because the rest of libibverbs isn't going - * to be fork-safe anyway. - */ -static int ibv_dontfork_range(void *base, size_t size) -{ - return 0; -} - -static int ibv_dofork_range(void *base, size_t size) -{ - return 0; -} - -#endif /* HAVE_IBV_DONTFORK_RANGE && HAVE_IBV_DOFORK_RANGE */ - int mthca_alloc_buf(struct mthca_buf *buf, size_t size, int page_size) { int ret; diff --git a/libmthca/src/cq.c b/libmthca/src/cq.c index 8b4a6a862..d71d430c6 100644 --- a/libmthca/src/cq.c +++ b/libmthca/src/cq.c @@ -32,9 +32,7 @@ * SOFTWARE. */ -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include diff --git a/libmthca/src/memfree.c b/libmthca/src/memfree.c index 87de4c0f5..77a80e24b 100644 --- a/libmthca/src/memfree.c +++ b/libmthca/src/memfree.c @@ -30,9 +30,7 @@ * SOFTWARE. */ #define _GNU_SOURCE -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include diff --git a/libmthca/src/mthca.c b/libmthca/src/mthca.c index e33bf7ff8..d5660ceef 100644 --- a/libmthca/src/mthca.c +++ b/libmthca/src/mthca.c @@ -31,9 +31,7 @@ * SOFTWARE. */ -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include @@ -43,16 +41,6 @@ #include #include -#ifndef HAVE_IBV_REGISTER_DRIVER -#include -#endif - -#ifndef HAVE_IBV_READ_SYSFS_FILE -#include -#include -#include -#endif - #include "mthca.h" #include "mthca-abi.h" @@ -226,36 +214,6 @@ static struct ibv_device_ops mthca_dev_ops = { .free_context = mthca_free_context }; -/* - * Keep a private implementation of HAVE_IBV_READ_SYSFS_FILE to handle - * old versions of libibverbs that didn't implement it. This can be - * removed when libibverbs 1.0.3 or newer is available "everywhere." - */ -#ifndef HAVE_IBV_READ_SYSFS_FILE -static int ibv_read_sysfs_file(const char *dir, const char *file, - char *buf, size_t size) -{ - char path[256]; - int fd; - int len; - - snprintf(path, sizeof path, "%s/%s", dir, file); - - fd = open(path, O_RDONLY); - if (fd < 0) - return -1; - - len = read(fd, buf, size); - - close(fd); - - if (len > 0 && buf[len - 1] == '\n') - buf[--len] = '\0'; - - return len; -} -#endif /* HAVE_IBV_READ_SYSFS_FILE */ - static struct ibv_device *mthca_driver_init(const char *uverbs_sys_path, int abi_version) { @@ -302,25 +260,7 @@ static struct ibv_device *mthca_driver_init(const char *uverbs_sys_path, return &dev->ibv_dev; } -#ifdef HAVE_IBV_REGISTER_DRIVER static __attribute__((constructor)) void mthca_register_driver(void) { ibv_register_driver("mthca", mthca_driver_init); } -#else -/* - * Export the old libsysfs sysfs_class_device-based driver entry point - * if libibverbs does not export an ibv_register_driver() function. - */ -struct ibv_device *openib_driver_init(struct sysfs_class_device *sysdev) -{ - int abi_ver = 0; - char value[8]; - - if (ibv_read_sysfs_file(sysdev->path, "abi_version", - value, sizeof value) > 0) - abi_ver = strtol(value, NULL, 10); - - return mthca_driver_init(sysdev->path, abi_ver); -} -#endif /* HAVE_IBV_REGISTER_DRIVER */ diff --git a/libmthca/src/mthca.h b/libmthca/src/mthca.h index bd1e7a2b1..da53010ce 100644 --- a/libmthca/src/mthca.h +++ b/libmthca/src/mthca.h @@ -39,31 +39,7 @@ #include #include -#ifdef HAVE_VALGRIND_MEMCHECK_H - -# include - -# if !defined(VALGRIND_MAKE_MEM_DEFINED) || !defined(VALGRIND_MAKE_MEM_UNDEFINED) -# warning "Valgrind support requested, but VALGRIND_MAKE_MEM_(UN)DEFINED not available" -# endif - -#endif /* HAVE_VALGRIND_MEMCHECK_H */ - -#ifndef VALGRIND_MAKE_MEM_DEFINED -# define VALGRIND_MAKE_MEM_DEFINED(addr,len) -#endif - -#ifndef VALGRIND_MAKE_MEM_UNDEFINED -# define VALGRIND_MAKE_MEM_UNDEFINED(addr,len) -#endif - -#ifndef rmb -# define rmb() mb() -#endif - -#ifndef wmb -# define wmb() mb() -#endif +#include #define HIDDEN __attribute__((visibility ("hidden"))) diff --git a/libmthca/src/qp.c b/libmthca/src/qp.c index 84dd206d9..715ca65e9 100644 --- a/libmthca/src/qp.c +++ b/libmthca/src/qp.c @@ -31,9 +31,7 @@ * SOFTWARE. */ -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include diff --git a/libmthca/src/srq.c b/libmthca/src/srq.c index 97a0c743f..ff6f53273 100644 --- a/libmthca/src/srq.c +++ b/libmthca/src/srq.c @@ -30,9 +30,7 @@ * SOFTWARE. */ -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include diff --git a/libmthca/src/verbs.c b/libmthca/src/verbs.c index b6782c986..60dd44002 100644 --- a/libmthca/src/verbs.c +++ b/libmthca/src/verbs.c @@ -31,9 +31,7 @@ * SOFTWARE. */ -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include @@ -122,6 +120,7 @@ static struct ibv_mr *__mthca_reg_mr(struct ibv_pd *pd, void *addr, { struct ibv_mr *mr; struct mthca_reg_mr cmd; + struct ibv_reg_mr_resp resp; int ret; /* @@ -137,17 +136,8 @@ static struct ibv_mr *__mthca_reg_mr(struct ibv_pd *pd, void *addr, if (!mr) return NULL; -#ifdef IBV_CMD_REG_MR_HAS_RESP_PARAMS - { - struct ibv_reg_mr_resp resp; - - ret = ibv_cmd_reg_mr(pd, addr, length, hca_va, access, mr, - &cmd.ibv_cmd, sizeof cmd, &resp, sizeof resp); - } -#else - ret = ibv_cmd_reg_mr(pd, addr, length, hca_va, access, mr, - &cmd.ibv_cmd, sizeof cmd); -#endif + ret = ibv_cmd_reg_mr(pd, addr, length, hca_va, access, mr, &cmd.ibv_cmd, + sizeof cmd, &resp, sizeof resp); if (ret) { free(mr); return NULL; @@ -286,6 +276,7 @@ int mthca_resize_cq(struct ibv_cq *ibcq, int cqe) struct mthca_resize_cq cmd; struct ibv_mr *mr; struct mthca_buf buf; + struct ibv_resize_cq_resp resp; int old_cqe; int ret; @@ -319,15 +310,8 @@ int mthca_resize_cq(struct ibv_cq *ibcq, int cqe) old_cqe = ibcq->cqe; cmd.lkey = mr->lkey; -#ifdef IBV_CMD_RESIZE_CQ_HAS_RESP_PARAMS - { - struct ibv_resize_cq_resp resp; - ret = ibv_cmd_resize_cq(ibcq, cqe - 1, &cmd.ibv_cmd, sizeof cmd, - &resp, sizeof resp); - } -#else - ret = ibv_cmd_resize_cq(ibcq, cqe - 1, &cmd.ibv_cmd, sizeof cmd); -#endif + ret = ibv_cmd_resize_cq(ibcq, cqe - 1, &cmd.ibv_cmd, sizeof cmd, &resp, + sizeof resp); if (ret) { mthca_dereg_mr(mr); mthca_free_buf(&buf); diff --git a/libnes/COPYING b/libnes/COPYING deleted file mode 100644 index a14e0796c..000000000 --- a/libnes/COPYING +++ /dev/null @@ -1,29 +0,0 @@ -Copyright (c) 2006 - 2010 Intel Corporation. All rights reserved. - -This software is available to you under a choice of one of two -licenses. You may choose to be licensed under the terms of the GNU -General Public License (GPL) Version 2, available from the file -gpl-2.0.txt in the main directory of this source tree, or 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. diff --git a/libnes/gpl-2.0.txt b/libnes/gpl-2.0.txt deleted file mode 100644 index d511905c1..000000000 --- a/libnes/gpl-2.0.txt +++ /dev/null @@ -1,339 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. diff --git a/libnes/src/nes_umain.c b/libnes/src/nes_umain.c index 16ce3f13c..b4e0bc136 100644 --- a/libnes/src/nes_umain.c +++ b/libnes/src/nes_umain.c @@ -31,9 +31,7 @@ * SOFTWARE. */ -#if HAVE_CONFIG_H #include -#endif /* HAVE_CONFIG_H */ #include #include diff --git a/libnes/src/nes_umain.h b/libnes/src/nes_umain.h index c53acd7e9..91299823e 100644 --- a/libnes/src/nes_umain.h +++ b/libnes/src/nes_umain.h @@ -393,26 +393,13 @@ int nes_uattach_mcast(struct ibv_qp *, const union ibv_gid *, uint16_t); int nes_udetach_mcast(struct ibv_qp *, const union ibv_gid *, uint16_t); void nes_async_event(struct ibv_async_event *event); -#if __BYTE_ORDER == __LITTLE_ENDIAN static inline uint32_t cpu_to_le32(uint32_t x) { - return x; + return htole32(x); } static inline uint32_t le32_to_cpu(uint32_t x) { - return x; + return le32toh(x); } -#else -static inline uint32_t cpu_to_le32(uint32_t x) -{ - return (((x&0xFF000000)>>24) | ((x&0x00FF0000)>>8) | - ((x&0x0000FF00)<<8) | ((x&0x000000FF)<<24)); -} -static inline uint32_t le32_to_cpu(uint32_t x) -{ - return (((x&0xFF000000)>>24) | ((x&0x00FF0000)>>8) | - ((x&0x0000FF00)<<8) | ((x&0x000000FF)<<24)); -} -#endif #endif /* nes_umain_H */ diff --git a/libnes/src/nes_uverbs.c b/libnes/src/nes_uverbs.c index 983d87a80..aa9c2b9e2 100644 --- a/libnes/src/nes_uverbs.c +++ b/libnes/src/nes_uverbs.c @@ -30,9 +30,7 @@ * SOFTWARE. */ -#if HAVE_CONFIG_H #include -#endif /* HAVE_CONFIG_H */ #include #include @@ -174,23 +172,16 @@ struct ibv_mr *nes_ureg_mr(struct ibv_pd *pd, void *addr, { struct ibv_mr *mr; struct nes_ureg_mr cmd; -#ifdef IBV_CMD_REG_MR_HAS_RESP_PARAMS struct ibv_reg_mr_resp resp; -#endif mr = malloc(sizeof *mr); if (!mr) return NULL; cmd.reg_type = NES_UMEMREG_TYPE_MEM; -#ifdef IBV_CMD_REG_MR_HAS_RESP_PARAMS if (ibv_cmd_reg_mr(pd, addr, length, (uintptr_t) addr, access, mr, &cmd.ibv_cmd, sizeof cmd, &resp, sizeof resp)) { -#else - if (ibv_cmd_reg_mr(pd, addr, length, (uintptr_t) addr, - access, mr, &cmd.ibv_cmd, sizeof cmd)) { -#endif free(mr); return NULL; @@ -215,90 +206,6 @@ int nes_udereg_mr(struct ibv_mr *mr) return 0; } -#if HAVE_DECL_IBV_QPT_RAW_ETH -static -int nes_ima_ureplace_cq(struct ibv_cq *cq, - int mcrqf, - struct nes_uqp *nesuqp) -{ - struct nes_ucq *nesucq = to_nes_ucq(cq); - int ret; - struct nes_ucreate_cq cmd; - struct nes_ucreate_cq_resp resp; - int comp_vector = nesucq->comp_vector; - struct nes_ureg_mr reg_mr_cmd; -#ifdef IBV_CMD_REG_MR_HAS_RESP_PARAMS - struct ibv_reg_mr_resp reg_mr_resp; -#endif - struct nes_uvcontext *nesvctx = to_nes_uctx(cq->context); - - ret = ibv_cmd_destroy_cq(cq); - nes_debug(NES_DBG_UD, "%s(%d) mcrqf=%d ret=%d\n", - __func__, - __LINE__, - mcrqf, - ret); - if (ret) - return ret; - - ret = ibv_cmd_dereg_mr(&nesucq->mr); - if (ret) { - fprintf(stderr, PFX "%s: Failed to deregister" - " CQ Memory Region.\n", __func__); - return ret; - } - - reg_mr_cmd.reg_type = NES_UMEMREG_TYPE_CQ; - -#ifdef IBV_CMD_REG_MR_HAS_RESP_PARAMS - ret = ibv_cmd_reg_mr(&nesvctx->nesupd->ibv_pd, (void *)nesucq->cqes, - (nesucq->size*sizeof(struct nes_hw_cqe)), - (uintptr_t)nesucq->cqes, - IBV_ACCESS_LOCAL_WRITE, &nesucq->mr, - ®_mr_cmd.ibv_cmd, sizeof reg_mr_cmd, - ®_mr_resp, sizeof reg_mr_resp); -#else - ret = ibv_cmd_reg_mr(&nesvctx->nesupd->ibv_pd, (void *)nesucq->cqes, - (nesucq->size*sizeof(struct nes_hw_cqe)), - (uintptr_t)nesucq->cqes, - IBV_ACCESS_LOCAL_WRITE, &nesucq->mr, - ®_mr_cmd.ibv_cmd, sizeof reg_mr_cmd); -#endif - if (ret) { - free((struct nes_hw_cqe *)nesucq->cqes); - goto err; - } - - - /* Create the CQ */ - memset(&cmd, 0, sizeof(cmd)); - cmd.user_cq_buffer = (__u64)((uintptr_t)nesucq->cqes); - cmd.mcrqf = mcrqf | 0x20000000; /* IMA specific sq number */ - - nes_debug(NES_DBG_UD, "%s(%d) mcrqf=%d\n", - __func__, __LINE__, - mcrqf); - ret = ibv_cmd_create_cq(cq->context, - nesucq->size-1, - cq->channel, - comp_vector, - &nesucq->ibv_cq, &cmd.ibv_cmd, sizeof cmd, - &resp.ibv_resp, sizeof resp); - if (ret) - goto err; - - nesucq->cq_id = (uint16_t)resp.cq_id; - nesucq->udqp = nesuqp; - nes_debug(NES_DBG_UD, "%s(%d) cqid=%d mcrqf=%d\n", - __func__, __LINE__, - nesucq->cq_id, mcrqf); - - return 0; - err: - return ret; -} -#endif - /** * nes_ucreate_cq */ @@ -307,9 +214,7 @@ struct ibv_cq *nes_ucreate_cq(struct ibv_context *context, int cqe, { struct nes_ucq *nesucq; struct nes_ureg_mr reg_mr_cmd; -#ifdef IBV_CMD_REG_MR_HAS_RESP_PARAMS struct ibv_reg_mr_resp reg_mr_resp; -#endif struct nes_ucreate_cq cmd; struct nes_ucreate_cq_resp resp; int ret; @@ -338,18 +243,11 @@ struct ibv_cq *nes_ucreate_cq(struct ibv_context *context, int cqe, /* Register the memory for the CQ */ reg_mr_cmd.reg_type = NES_UMEMREG_TYPE_CQ; -#ifdef IBV_CMD_REG_MR_HAS_RESP_PARAMS ret = ibv_cmd_reg_mr(&nesvctx->nesupd->ibv_pd, (void *)nesucq->cqes, (nesucq->size*sizeof(struct nes_hw_cqe)), (uintptr_t)nesucq->cqes, IBV_ACCESS_LOCAL_WRITE, &nesucq->mr, ®_mr_cmd.ibv_cmd, sizeof reg_mr_cmd, ®_mr_resp, sizeof reg_mr_resp); -#else - ret = ibv_cmd_reg_mr(&nesvctx->nesupd->ibv_pd, (void *)nesucq->cqes, - (nesucq->size*sizeof(struct nes_hw_cqe)), - (uintptr_t)nesucq->cqes, IBV_ACCESS_LOCAL_WRITE, &nesucq->mr, - ®_mr_cmd.ibv_cmd, sizeof reg_mr_cmd); -#endif if (ret) { /* fprintf(stderr, "ibv_cmd_reg_mr failed (ret = %d).\n", ret); */ free((struct nes_hw_cqe *)nesucq->cqes); @@ -1041,9 +939,7 @@ static int nes_vmapped_qp(struct nes_uqp *nesuqp, struct ibv_pd *pd, struct ibv_ { struct nes_ucreate_qp cmd; struct nes_ureg_mr reg_mr_cmd; -#ifdef IBV_CMD_REG_MR_HAS_RESP_PARAMS struct ibv_reg_mr_resp reg_mr_resp; -#endif int totalqpsize; int ret; @@ -1062,17 +958,10 @@ static int nes_vmapped_qp(struct nes_uqp *nesuqp, struct ibv_pd *pd, struct ibv_ //fprintf(stderr, PFX "qp_rq_vbase = %p qp_sq_vbase=%p reg_mr = %p\n", // nesuqp->rq_vbase, nesuqp->sq_vbase, &nesuqp->mr); -#ifdef IBV_CMD_REG_MR_HAS_RESP_PARAMS ret = ibv_cmd_reg_mr(pd, (void *)nesuqp->sq_vbase,totalqpsize, (uintptr_t) nesuqp->sq_vbase, IBV_ACCESS_LOCAL_WRITE, &nesuqp->mr, ®_mr_cmd.ibv_cmd, sizeof reg_mr_cmd, ®_mr_resp, sizeof reg_mr_resp); -#else - ret = ibv_cmd_reg_mr(pd, (void *)nesuqp->sq_vbase,totalqpsize, - (uintptr_t) nesuqp->sq_vbase, IBV_ACCESS_LOCAL_WRITE, - &nesuqp->mr, ®_mr_cmd.ibv_cmd, sizeof reg_mr_cmd); -#endif - if (ret) { // fprintf(stderr, PFX "%s ibv_cmd_reg_mr failed (ret = %d).\n", __FUNCTION__, ret); free((void *) nesuqp->sq_vbase); @@ -1140,15 +1029,6 @@ struct ibv_qp *nes_ucreate_qp(struct ibv_pd *pd, struct ibv_qp_init_attr *attr) /* fprintf(stderr, PFX "%s\n", __FUNCTION__); */ -#if HAVE_DECL_IBV_QPT_RAW_ETH - if (attr->qp_type == IBV_QPT_RAW_ETH) { - attr->cap.max_send_sge = NES_UD_MAX_SG_LIST_SZ; - attr->cap.max_recv_sge = NES_UD_MAX_SG_LIST_SZ; - nes_debug(NES_DBG_UD, "%s(%d) patching max_sge for UD\n", - __func__, __LINE__); - } -#endif - /* Sanity check QP size before proceeding */ sqdepth = nes_qp_get_qdepth(attr->cap.max_send_wr, attr->cap.max_send_sge); if (!sqdepth) { @@ -1205,58 +1085,6 @@ struct ibv_qp *nes_ucreate_qp(struct ibv_pd *pd, struct ibv_qp_init_attr *attr) nesuqp->ibv_qp.qp_num = resp.qp_id; nesuqp->rdma0_msg = 1; -#if HAVE_DECL_IBV_QPT_RAW_ETH - if (attr->qp_type == IBV_QPT_RAW_ETH) { - int i = 0; - - nesuqp->nes_ud_sksq_fd = open("/dev/infiniband/nes_ud_sksq", - O_RDWR); - if (nesuqp->nes_ud_sksq_fd <= 0) - return 0; - nesuqp->sksq_shared_ctxt = mmap(NULL, 4096, - PROT_WRITE | PROT_READ, - MAP_SHARED, - nesuqp->nes_ud_sksq_fd, 0); - if (nesuqp->sksq_shared_ctxt == 0) - return 0; - - /* no LSMM for UD */ - nesuqp->sq_head = 0; - nesuqp->sq_tail = 0; - nes_debug(NES_DBG_UD, "%s(%d) qpid=0x%x\n", - __func__, __LINE__, nesuqp->qp_id); - - /* reallocate CQs after QP is created */ - if (nes_ima_ureplace_cq(attr->recv_cq, - resp.qp_id & 0xffff, - nesuqp) != 0) - return NULL; - - if (nes_ima_ureplace_cq(attr->send_cq, - resp.qp_id >> 16, - nesuqp) != 0) - return NULL; - - /* allocate N+1, last one would be used for NULL */ - nesuqp->pend_rx_wr = malloc(NES_UD_RX_BATCH_SZ * - sizeof *nesuqp->pend_rx_wr); - if (!nesuqp) - exit(0); - - for (i = 0; i < NES_UD_RX_BATCH_SZ; i++) { - nesuqp->pend_rx_wr[i].sg_list = - malloc(NES_UD_MAX_SG_LIST_SZ * - sizeof *nesuqp->pend_rx_wr[i].sg_list); - nesuqp->pend_rx_wr[i].next = - (i < NES_UD_RX_BATCH_SZ-1) ? - &nesuqp->pend_rx_wr[i+1] : 0; - } - /* prepare the wr_id tables */ - memset(&nesuqp->send_wr_id[0], 0, sizeof(uint64_t) * 512); - memset(&nesuqp->recv_wr_id[0], 0, sizeof(uint64_t) * 512); - } -#endif - return &nesuqp->ibv_qp; } @@ -1348,27 +1176,6 @@ int nes_udestroy_qp(struct ibv_qp *qp) pthread_spin_destroy(&nesuqp->lock); -#if HAVE_DECL_IBV_QPT_RAW_ETH - if (qp->qp_type == IBV_QPT_RAW_ETH) { - int i = 0; - - if (nesuqp->pend_rx_wr) { - for (i = 0; i < NES_UD_RX_BATCH_SZ; i++) - if (nesuqp->pend_rx_wr[i].sg_list) { - free(nesuqp->pend_rx_wr[i].sg_list); - nesuqp->pend_rx_wr[i].sg_list = 0; - } - } - free(nesuqp->pend_rx_wr); - nesuqp->pend_rx_wr = 0; - if (nesuqp->sksq_shared_ctxt) - munmap(nesuqp->sksq_shared_ctxt, 4096); - - nesuqp->sksq_shared_ctxt = 0; - close(nesuqp->nes_ud_sksq_fd); - } -#endif - /* Clean any pending completions from the cq(s) */ if (nesuqp->send_cq) nes_clean_cq(nesuqp, nesuqp->send_cq); @@ -1380,85 +1187,6 @@ int nes_udestroy_qp(struct ibv_qp *qp) return 0; } -#if HAVE_DECL_IBV_QPT_RAW_ETH -static inline -int nes_ima_upost_send(struct ibv_qp *ib_qp, struct ibv_send_wr *ib_wr, - struct ibv_send_wr **bad_wr) -{ - struct nes_uqp *nesuqp = to_nes_uqp(ib_qp); - int new_req_cnt = 0; - uint32_t outstanding_wqes; - uint32_t qsize = nesuqp->sq_size; - int ret = 0; - struct ibv_send_wr *tmp_wr = ib_wr; - struct nes_ud_send_wr *nes_ud_wr = 0; - int bc = 0; - int sq_head; - int wr_id_head; - - while (tmp_wr) { - new_req_cnt++; - tmp_wr = tmp_wr->next; - } - if (nesuqp->sq_head >= nesuqp->sq_tail) - outstanding_wqes = nesuqp->sq_head - nesuqp->sq_tail; - else - outstanding_wqes = nesuqp->sq_head + qsize - nesuqp->sq_tail; - - if (unlikely(outstanding_wqes >= (qsize - new_req_cnt))) - return -EINVAL; - - /* we know that there is sufficient space in the send queue */ - /* so we can store wr_id in the wr_id queue */ - sq_head = nesuqp->sq_head; - - if (sq_head + new_req_cnt >= qsize) - nesuqp->sq_head = sq_head + new_req_cnt - qsize; - else - nesuqp->sq_head = sq_head + new_req_cnt; - - nes_ud_wr = (struct nes_ud_send_wr *)nesuqp->sksq_shared_ctxt; - bc = 0; - - /* set up the qp id in the shared page message */ - nes_ud_wr->qpn = nesuqp->qp_id; - - while (ib_wr) { - nes_ud_wr->sg_list[bc].addr = ib_wr->sg_list[0].addr; - nes_ud_wr->sg_list[bc].length = ib_wr->sg_list[0].length; - nes_ud_wr->sg_list[bc].lkey = ib_wr->sg_list[0].lkey; - nes_ud_wr->flags = ib_wr->send_flags; - nes_ud_wr->flags = nes_ud_wr->flags | (ib_wr->imm_data << 16); - /* store the wr_id in the internal queue */ - /* the queue is in sync with the queue in kernel */ - /* the wr_id will be read in poll_cq */ - wr_id_head = bc + sq_head; - if (wr_id_head > (qsize - 1)) - wr_id_head = wr_id_head - qsize; - - nesuqp->send_wr_id[wr_id_head] = ib_wr->wr_id; - if (++bc >= 64) { - nes_ud_wr->wr_cnt = bc; - ret = write(nesuqp->nes_ud_sksq_fd, 0, 0); - if (ret != 0) - goto out; - nes_ud_wr = - (struct nes_ud_send_wr *)nesuqp->sksq_shared_ctxt; - bc = 0; - } - ib_wr = ib_wr->next; - } - if (bc > 0) { - nes_ud_wr->wr_cnt = bc; - ret = write(nesuqp->nes_ud_sksq_fd, 0, 0); - if (ret != 0) - goto out; - } -out: - return ret; -} -#endif - /** * nes_upost_send */ @@ -1478,11 +1206,6 @@ int nes_upost_send(struct ibv_qp *ib_qp, struct ibv_send_wr *ib_wr, uint32_t total_payload_length = 0; int sge_index; -#if HAVE_DECL_IBV_QPT_RAW_ETH - if (ib_qp->qp_type == IBV_QPT_RAW_ETH) - return nes_ima_upost_send(ib_qp, ib_wr, bad_wr); -#endif - pthread_spin_lock(&nesuqp->lock); head = nesuqp->sq_head; @@ -1654,83 +1377,6 @@ int nes_upost_send(struct ibv_qp *ib_qp, struct ibv_send_wr *ib_wr, return err; } -#if HAVE_DECL_IBV_QPT_RAW_ETH -static inline -int nes_ima_upost_recv(struct ibv_qp *ib_qp, struct ibv_recv_wr *ib_wr, - struct ibv_recv_wr **bad_wr) -{ - struct nes_uqp *nesuqp = to_nes_uqp(ib_qp); - int new_req_cnt = 0; - uint32_t outstanding_wqes; - uint32_t qsize = nesuqp->rq_size; - struct ibv_send_wr *tmp_wr = (struct ibv_send_wr *)ib_wr; - int ret = 0; - struct nes_ud_recv_wr *nes_ud_wr; - int rq_head; - int bc; - int wr_id_head; - - nes_ud_wr = (struct nes_ud_recv_wr *) - (((char *)nesuqp->sksq_shared_ctxt) + 2048); - while (tmp_wr) { - new_req_cnt++; - tmp_wr = tmp_wr->next; - } - - if (nesuqp->rq_head >= nesuqp->rq_tail) - outstanding_wqes = nesuqp->rq_head - nesuqp->rq_tail; - else - outstanding_wqes = nesuqp->rq_head + qsize - nesuqp->rq_tail; - - if (unlikely(outstanding_wqes >= (qsize - new_req_cnt))) - return -EINVAL; - - /* now we know thay the rq has sufficient - place so we can start wr_id storing */ - rq_head = nesuqp->rq_head; - - if (rq_head + new_req_cnt >= qsize) - nesuqp->rq_head = rq_head + new_req_cnt - qsize; - else - nesuqp->rq_head = rq_head + new_req_cnt; - - /* set the queue number in the shared page */ - nes_ud_wr->qpn = nesuqp->qp_id; - bc = 0; - while (ib_wr) { - if (ib_wr->num_sge > NES_UD_MAX_SG_LIST_SZ) - return -EINVAL; - - nes_ud_wr->sg_list[nesuqp->pending_rcvs].addr = - ib_wr->sg_list[0].addr; - nes_ud_wr->sg_list[nesuqp->pending_rcvs].length = - ib_wr->sg_list[0].length; - nes_ud_wr->sg_list[nesuqp->pending_rcvs].lkey = - ib_wr->sg_list[0].lkey; - - /* store the wr_id */ - wr_id_head = bc + rq_head; - if (wr_id_head > (qsize - 1)) - wr_id_head = wr_id_head - qsize; - - nesuqp->recv_wr_id[wr_id_head] = ib_wr->wr_id; - bc++; - - ++nesuqp->pending_rcvs; - if (nesuqp->pending_rcvs >= NES_UD_RX_BATCH_SZ) { - nes_ud_wr->wr_cnt = nesuqp->pending_rcvs; - ret = read(nesuqp->nes_ud_sksq_fd, 0, 0); - if (ret != 0) - goto out; - nesuqp->pending_rcvs = 0; - } - ib_wr = ib_wr->next; - } -out: - return ret; -} -#endif - /** * nes_upost_recv */ @@ -1750,11 +1396,6 @@ int nes_upost_recv(struct ibv_qp *ib_qp, struct ibv_recv_wr *ib_wr, uint32_t total_payload_length; int sge_index; -#if HAVE_DECL_IBV_QPT_RAW_ETH - if (ib_qp->qp_type == IBV_QPT_RAW_ETH) - return nes_ima_upost_recv(ib_qp, ib_wr, bad_wr); -#endif - if (unlikely(ib_wr->num_sge > 4)) { *bad_wr = ib_wr; return -EINVAL; diff --git a/libocrdma/COPYING b/libocrdma/COPYING deleted file mode 100644 index 170733734..000000000 --- a/libocrdma/COPYING +++ /dev/null @@ -1,317 +0,0 @@ -This software is available to you under a choice of one of two -licenses. You may choose to be licensed under the terms of the the -OpenIB.org BSD license or the GNU General Public License (GPL) Version -2, both included below. - -Copyright (c) 2016 Broadcom Ltd. All rights reserved. - -======================================================================= - BSD license - -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. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND -CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, -INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -======================================================================== - - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS diff --git a/libocrdma/src/ocrdma_main.c b/libocrdma/src/ocrdma_main.c index 064ecb318..f3830d9fc 100644 --- a/libocrdma/src/ocrdma_main.c +++ b/libocrdma/src/ocrdma_main.c @@ -32,9 +32,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#if HAVE_CONFIG_H #include -#endif /* HAVE_CONFIG_H */ #include #include diff --git a/libocrdma/src/ocrdma_verbs.c b/libocrdma/src/ocrdma_verbs.c index 628e4bf18..163bf23f8 100644 --- a/libocrdma/src/ocrdma_verbs.c +++ b/libocrdma/src/ocrdma_verbs.c @@ -32,9 +32,7 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#if HAVE_CONFIG_H #include -#endif /* HAVE_CONFIG_H */ #include #include @@ -48,6 +46,7 @@ #include #include #include +#include #include "ocrdma_main.h" #include "ocrdma_abi.h" @@ -56,48 +55,23 @@ static void ocrdma_ring_cq_db(struct ocrdma_cq *cq, uint32_t armed, int solicited, uint32_t num_cqe); -static inline uint32_t ocrdma_swap_endianness(uint32_t val) -{ - return ((val & 0xFF000000) >> 24) | ((val & 0xFF) << 24) | - ((val & 0xFF00) << 8) | ((val & 0xFF0000) >> 8); -} - static inline uint32_t ocrdma_cpu_to_le(uint32_t val) { -#if __BYTE_ORDER == __BIG_ENDIAN - return ocrdma_swap_endianness(val); -#else - return val; -#endif + return htole32(val); } static inline uint32_t ocrdma_le_to_cpu(uint32_t val) { -#if __BYTE_ORDER == __BIG_ENDIAN - return ocrdma_swap_endianness(val); -#else - return val; -#endif -} - -static inline uint32_t ocrdma_cpu_to_be(uint32_t val) -{ -#if __BYTE_ORDER == __LITTLE_ENDIAN - return ocrdma_swap_endianness(val); -#else - return val; -#endif + return le32toh(val); } static inline void ocrdma_swap_cpu_to_le(void *dst, uint32_t len) { -#if __BYTE_ORDER == __BIG_ENDIAN int i = 0; uint32_t *src_ptr = dst; uint32_t *dst_ptr = dst; for (; i < (len / 4); i++) - *dst_ptr++ = ocrdma_swap_endianness(*src_ptr++); -#endif + *dst_ptr++ = le32toh(*src_ptr++); } /* diff --git a/librdmacm/examples/common.h b/librdmacm/examples/common.h index f7511f039..ac2d160b0 100644 --- a/librdmacm/examples/common.h +++ b/librdmacm/examples/common.h @@ -34,20 +34,15 @@ #include #include -#include +#include #include #include #include #include -#if __BYTE_ORDER == __BIG_ENDIAN -static inline uint64_t cpu_to_be64(uint64_t x) { return x; } -static inline uint32_t cpu_to_be32(uint32_t x) { return x; } -#else -static inline uint64_t cpu_to_be64(uint64_t x) { return bswap_64(x); } -static inline uint32_t cpu_to_be32(uint32_t x) { return bswap_32(x); } -#endif +static inline uint64_t cpu_to_be64(uint64_t x) { return htobe64(x); } +static inline uint32_t cpu_to_be32(uint32_t x) { return htobe32(x); } extern int use_rs; diff --git a/librdmacm/src/acm.c b/librdmacm/src/acm.c index 823381aac..ad6706b25 100644 --- a/librdmacm/src/acm.c +++ b/librdmacm/src/acm.c @@ -30,9 +30,7 @@ * SOFTWARE. */ -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include diff --git a/librdmacm/src/addrinfo.c b/librdmacm/src/addrinfo.c index 046b8be11..2f4e674e1 100644 --- a/librdmacm/src/addrinfo.c +++ b/librdmacm/src/addrinfo.c @@ -32,9 +32,7 @@ * $Id: cm.c 3453 2005-09-15 21:43:21Z sean.hefty $ */ -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include diff --git a/librdmacm/src/cma.c b/librdmacm/src/cma.c index a89e663bc..77f6fea38 100644 --- a/librdmacm/src/cma.c +++ b/librdmacm/src/cma.c @@ -30,9 +30,7 @@ * SOFTWARE. */ -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include diff --git a/librdmacm/src/cma.h b/librdmacm/src/cma.h index ce428deba..c2f603d6f 100644 --- a/librdmacm/src/cma.h +++ b/librdmacm/src/cma.h @@ -34,9 +34,7 @@ #if !defined(CMA_H) #define CMA_H -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include @@ -46,30 +44,14 @@ #include #include +#include #include -#ifdef INCLUDE_VALGRIND -# include -# ifndef VALGRIND_MAKE_MEM_DEFINED -# warning "Valgrind requested, but VALGRIND_MAKE_MEM_DEFINED undefined" -# endif -#endif - -#ifndef VALGRIND_MAKE_MEM_DEFINED -# define VALGRIND_MAKE_MEM_DEFINED(addr,len) -#endif +#include #define PFX "librdmacm: " -#if __BYTE_ORDER == __LITTLE_ENDIAN -static inline uint64_t htonll(uint64_t x) { return bswap_64(x); } -static inline uint64_t ntohll(uint64_t x) { return bswap_64(x); } -#else -static inline uint64_t htonll(uint64_t x) { return x; } -static inline uint64_t ntohll(uint64_t x) { return x; } -#endif - /* * Fast synchronization for low contention locking. */ diff --git a/librdmacm/src/indexer.c b/librdmacm/src/indexer.c index be2e69c89..00be7d04c 100644 --- a/librdmacm/src/indexer.c +++ b/librdmacm/src/indexer.c @@ -31,9 +31,7 @@ * */ -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include diff --git a/librdmacm/src/indexer.h b/librdmacm/src/indexer.h index 0c5f38826..2d1e46eca 100644 --- a/librdmacm/src/indexer.h +++ b/librdmacm/src/indexer.h @@ -34,9 +34,7 @@ #if !defined(INDEXER_H) #define INDEXER_H -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include diff --git a/librdmacm/src/preload.c b/librdmacm/src/preload.c index 2a90f79b2..cf258bf8e 100644 --- a/librdmacm/src/preload.c +++ b/librdmacm/src/preload.c @@ -31,9 +31,7 @@ * */ #define _GNU_SOURCE -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include diff --git a/librdmacm/src/rsocket.c b/librdmacm/src/rsocket.c index 488d44fb3..7e7a38ee8 100644 --- a/librdmacm/src/rsocket.c +++ b/librdmacm/src/rsocket.c @@ -31,9 +31,7 @@ * */ #define _GNU_SOURCE -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include diff --git a/librxe/src/rxe.c b/librxe/src/rxe.c index 7164f6627..8f8cc9105 100644 --- a/librxe/src/rxe.c +++ b/librxe/src/rxe.c @@ -37,9 +37,7 @@ * product whatsoever. */ -#if HAVE_CONFIG_H -# include -#endif /* HAVE_CONFIG_H */ +#include #include #include @@ -129,6 +127,7 @@ static struct ibv_mr *rxe_reg_mr(struct ibv_pd *pd, void *addr, size_t length, { struct ibv_mr *mr; struct ibv_reg_mr cmd; + struct ibv_reg_mr_resp resp; int ret; mr = malloc(sizeof *mr); @@ -136,19 +135,8 @@ static struct ibv_mr *rxe_reg_mr(struct ibv_pd *pd, void *addr, size_t length, return NULL; } -#ifdef IBV_CMD_REG_MR_HAS_RESP_PARAMS - { - struct ibv_reg_mr_resp resp; - - ret = ibv_cmd_reg_mr(pd, addr, length, (uintptr_t) addr, - access, mr, &cmd, sizeof cmd, - &resp, sizeof resp); - } -#else - ret = ibv_cmd_reg_mr(pd, addr, length, (uintptr_t) addr, - access, mr, &cmd, sizeof cmd); -#endif - + ret = ibv_cmd_reg_mr(pd, addr, length, (uintptr_t)addr, access, mr, + &cmd, sizeof cmd, &resp, sizeof resp); if (ret) { free(mr); return NULL; @@ -937,22 +925,8 @@ static struct ibv_device *rxe_driver_init(const char *uverbs_sys_path, return &dev->ibv_dev; } -#ifdef HAVE_IBV_REGISTER_DRIVER static __attribute__ ((constructor)) void rxe_register_driver(void) { ibv_register_driver("rxe", rxe_driver_init); } -#else -struct ibv_device *openib_driver_init(struct sysfs_class_device *sysdev) -{ - int abi_ver = 0; - char value[8]; - - if (ibv_read_sysfs_file(sysdev->path, "abi_version", - value, sizeof value) > 0) - abi_ver = strtol(value, NULL, 10); - - return rxe_driver_init(sysdev->path, abi_ver); -} -#endif /* HAVE_IBV_REGISTER_DRIVER */ diff --git a/srp_daemon/srp_daemon/srp_daemon.h b/srp_daemon/srp_daemon/srp_daemon.h index 6d1575519..5d42d51e6 100644 --- a/srp_daemon/srp_daemon/srp_daemon.h +++ b/srp_daemon/srp_daemon/srp_daemon.h @@ -42,26 +42,11 @@ #include #include #include +#include #include "config.h" #include "srp_ib_types.h" -#if __BYTE_ORDER == __LITTLE_ENDIAN -#ifndef htonll -#define htonll(x) bswap_64(x) -#endif -#ifndef ntohll -#define ntohll(x) bswap_64(x) -#endif -#elif __BYTE_ORDER == __BIG_ENDIAN -#ifndef htonll -#define htonll(x) (x) -#endif -#ifndef ntohll -#define ntohll(x) (x) -#endif -#endif - #ifdef __cplusplus template struct vki_static_assert { int m_bitfield:(2*b-1); }; #define STATIC_ASSERT(expr) \ @@ -408,12 +393,7 @@ typedef struct { char filler[MAD_BLOCK_SIZE]; } srp_ib_user_mad_t; -#if defined(HAVE_VALGRIND_DRD_H) && defined(ENABLE_VALGRIND) #include -#endif -#ifndef ANNOTATE_BENIGN_RACE_SIZED -#define ANNOTATE_BENIGN_RACE_SIZED(a, b, c) do { } while(0) -#endif #define pr_human(arg...) \ do { \