├── mic-psm-card-devel.srclist.in ├── .gitignore ├── mic ├── etc │ └── sysconfig │ │ └── mic │ │ └── conf.d │ │ └── psm.conf └── opt │ └── intel │ └── mic │ └── psm │ └── psm.filelist.in ├── mic-psm-devel.srclist.in ├── ipath-psm-devel.srclist.in ├── ipath-psm.srclist.in ├── mic-psm.srclist.in ├── mic-psm-card.srclist.in ├── README.md ├── psm.supp ├── libuuid ├── COPYING ├── clear.c ├── psm_uuid.h ├── Makefile ├── copy.c ├── isnull.c ├── unpack.c ├── compare.c ├── pack.c ├── uuidP.h ├── parse.c ├── unparse.c ├── uuid.h └── uuid_time.c ├── doc └── Makefile ├── ptl_self ├── ptl_fwd.h └── Makefile ├── ptl_ips ├── ptl_fwd.h ├── Makefile ├── ips_stats.h ├── ips_subcontext.h ├── ips_proto_am.h ├── ips_recvq.c ├── ips_epstate.h ├── ips_subcontext.c ├── ips_proto_internal.h ├── ips_spio.h ├── ips_crc32.c ├── ips_tid.h ├── ips_recvq.h ├── ips_writehdrq.c ├── ips_tid.c ├── ipserror.h ├── ips_tidflow.h └── ips_path_rec.h ├── ptl_am ├── Makefile ├── kcopyrw.h ├── scifrw.h ├── knemrw.h ├── ptl_fwd.h ├── kcopyrwu.c ├── am_reqrep.c ├── scifrwu.c └── knemrwu.c ├── psm_noship.h ├── ipath ├── ipath_dwordcpy-x86_64-fast.S ├── ipath_dwordcpy-i386.S ├── ipath_i2cflash.c ├── ipath_dwordcpy-generic.c ├── ipath_dwordcpy-ppc64.c ├── ipath_dwordcpy-x86_64.c ├── ipath_syslog.c └── Makefile ├── psm_error.h ├── psm_am_internal.h ├── psm_mpool.h ├── include ├── linux-i386 │ ├── bit_ops.h │ └── sysdep.h ├── linux-ppc │ ├── sysdep.h │ └── bit_ops.h ├── ipath_intf.h ├── ipath_debug.h └── ipath_udebug.h ├── psm_lock.h ├── psmd └── Makefile ├── psm_context.h ├── psm_stats.h ├── intel-mic-psm-card.spec.in ├── mpspawn └── mpspawn_stats.h ├── psm_timer.h └── psm_help.h /mic-psm-card-devel.srclist.in: -------------------------------------------------------------------------------- 1 | %LIBPREFIX%/libinfinipath.so 2 | %LIBPREFIX%/libpsm_infinipath.so 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | infinipath-psm.spec 2 | infinipath-psm-*.tar.gz 3 | *.o 4 | *.d 5 | *.so* 6 | _revision.c 7 | -------------------------------------------------------------------------------- /mic/etc/sysconfig/mic/conf.d/psm.conf: -------------------------------------------------------------------------------- 1 | # PSM download files 2 | Overlay Filelist /opt/intel/mic/psm /opt/intel/mic/psm/psm.filelist on 3 | -------------------------------------------------------------------------------- /mic-psm-devel.srclist.in: -------------------------------------------------------------------------------- 1 | /usr/include/psm.h 2 | /usr/include/psm_mq.h 3 | %LIBPREFIX%/libinfinipath.so 4 | %LIBPREFIX%/libpsm_infinipath.so 5 | -------------------------------------------------------------------------------- /ipath-psm-devel.srclist.in: -------------------------------------------------------------------------------- 1 | /usr/include/psm.h 2 | /usr/include/psm_mq.h 3 | %LIBPREFIX%/libinfinipath.so 4 | %LIBPREFIX%/libpsm_infinipath.so 5 | -------------------------------------------------------------------------------- /ipath-psm.srclist.in: -------------------------------------------------------------------------------- 1 | %LIBPREFIX%/libinfinipath.so.4 2 | %LIBPREFIX%/libinfinipath.so.4.0 3 | %LIBPREFIX%/libpsm_infinipath.so.1 4 | %LIBPREFIX%/libpsm_infinipath.so.1.15 5 | -------------------------------------------------------------------------------- /mic-psm.srclist.in: -------------------------------------------------------------------------------- 1 | %SBINPREFIX%/psmd 2 | %LIBPREFIX%/libinfinipath.so.4 3 | %LIBPREFIX%/libinfinipath.so.4.0 4 | %LIBPREFIX%/libpsm_infinipath.so.1 5 | %LIBPREFIX%/libpsm_infinipath.so.1.15 6 | -------------------------------------------------------------------------------- /mic-psm-card.srclist.in: -------------------------------------------------------------------------------- 1 | /etc/sysconfig/mic/conf.d/psm.conf 2 | %PREFIX%/psm.filelist 3 | %LIBPREFIX%/libinfinipath.so.%IPATHMAJOR% 4 | %LIBPREFIX%/libinfinipath.so.%IPATHMAJOR%.%IPATHMINOR% 5 | %LIBPREFIX%/libpsm_infinipath.so.%PSMMAJOR% 6 | %LIBPREFIX%/libpsm_infinipath.so.%PSMMAJOR%.%PSMMINOR% 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | DISCONTINUATION OF PROJECT. 2 | 3 | This project will no longer be maintained by Intel. 4 | 5 | Intel has ceased development and contributions including, but not limited to, maintenance, bug fixes, new releases, or updates, to this project. 6 | 7 | Intel no longer accepts patches to this project. 8 | 9 | If you have an ongoing need to use this project, are interested in independently developing it, or would like to maintain patches for the open source software community, please create your own fork of this project. 10 | -------------------------------------------------------------------------------- /mic/opt/intel/mic/psm/psm.filelist.in: -------------------------------------------------------------------------------- 1 | dir /lib64 755 0 0 2 | file /lib64/libinfinipath.so.%IPATHMAJOR%.%IPATHMINOR% lib64/libinfinipath.so.%IPATHMAJOR%.%IPATHMINOR% 755 0 0 3 | slink /lib64/libinfinipath.so.%IPATHMAJOR% libinfinipath.so.%IPATHMAJOR%.%IPATHMINOR% 777 0 0 4 | slink /lib64/libinfinipath.so libinfinipath.so.%IPATHMAJOR%.%IPATHMINOR% 777 0 0 5 | file /lib64/libpsm_infinipath.so.%PSMMAJOR%.%PSMMINOR% lib64/libpsm_infinipath.so.%PSMMAJOR%.%PSMMINOR% 755 0 0 6 | slink /lib64/libpsm_infinipath.so.%PSMMAJOR% libpsm_infinipath.so.%PSMMAJOR%.%PSMMINOR% 777 0 0 7 | slink /lib64/libpsm_infinipath.so libpsm_infinipath.so.%PSMMAJOR%.%PSMMINOR% 777 0 0 8 | -------------------------------------------------------------------------------- /psm.supp: -------------------------------------------------------------------------------- 1 | 2 | # userinit 3 | { 4 | syscall_ipath_userinit 5 | Memcheck:Param 6 | write(buf) 7 | fun:__write_nocancel 8 | fun:ipath_userinit 9 | } 10 | 11 | # syscall poll type 12 | { 13 | syscall_poll_type 14 | Memcheck:Param 15 | write(buf) 16 | obj:/lib64/libc*.so 17 | fun:ipath_poll_type 18 | } 19 | 20 | # Tids allocation. 21 | { 22 | syscall_tid_free 23 | Memcheck:Param 24 | write(buf) 25 | obj:/lib64/libc*.so 26 | fun:ips_tid_release 27 | } 28 | 29 | # Tids de-allocation. 30 | { 31 | syscall_tid_alloc 32 | Memcheck:Param 33 | write(buf) 34 | obj:/lib64/libc*so 35 | fun:ips_tid_acquire 36 | } 37 | 38 | # really in QLogic MPI 39 | { 40 | mpspawn_socket 41 | Memcheck:Param 42 | socketcall.sendto(msg) 43 | fun:send 44 | fun:psc_skt_sendN 45 | } 46 | 47 | # gethostbyname on sles 48 | { 49 | gethostbyname 50 | Memcheck:Param 51 | socketcall.sendto(msg) 52 | fun:send 53 | fun:get_mapping 54 | fun:__nscd_get_map_ref 55 | fun:nscd_gethst_r 56 | fun:__nscd_gethostbyname_r 57 | fun:gethostbyname_r@@GLIBC_2.2.5 58 | } 59 | -------------------------------------------------------------------------------- /libuuid/COPYING: -------------------------------------------------------------------------------- 1 | Redistribution and use in source and binary forms, with or without 2 | modification, are permitted provided that the following conditions 3 | are met: 4 | 1. Redistributions of source code must retain the above copyright 5 | notice, and the entire permission notice in its entirety, 6 | including the disclaimer of warranties. 7 | 2. Redistributions in binary form must reproduce the above copyright 8 | notice, this list of conditions and the following disclaimer in the 9 | documentation and/or other materials provided with the distribution. 10 | 3. The name of the author may not be used to endorse or promote 11 | products derived from this software without specific prior 12 | written permission. 13 | 14 | THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED 15 | WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 16 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF 17 | WHICH ARE HEREBY DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE 18 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 19 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 20 | OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 21 | BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 22 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 24 | USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH 25 | DAMAGE. 26 | -------------------------------------------------------------------------------- /doc/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2006-2012. QLogic Corporation. All rights reserved. 2 | # Copyright (c) 2003-2006, PathScale, Inc. All rights reserved. 3 | # 4 | # This software is available to you under a choice of one of two 5 | # licenses. You may choose to be licensed under the terms of the GNU 6 | # General Public License (GPL) Version 2, available from the file 7 | # COPYING in the main directory of this source tree, or the 8 | # OpenIB.org BSD license below: 9 | # 10 | # Redistribution and use in source and binary forms, with or 11 | # without modification, are permitted provided that the following 12 | # conditions are met: 13 | # 14 | # - Redistributions of source code must retain the above 15 | # copyright notice, this list of conditions and the following 16 | # disclaimer. 17 | # 18 | # - Redistributions in binary form must reproduce the above 19 | # copyright notice, this list of conditions and the following 20 | # disclaimer in the documentation and/or other materials 21 | # provided with the distribution. 22 | # 23 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 24 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 25 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 26 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 27 | # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 28 | # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 29 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 30 | # SOFTWARE. 31 | # 32 | 33 | ifeq (,$(build_dir)) 34 | $(error build_dir must be set) 35 | endif 36 | 37 | top_srcdir := .. 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /ptl_self/ptl_fwd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2012. QLogic Corporation. All rights reserved. 3 | * Copyright (c) 2003-2006, PathScale, Inc. All rights reserved. 4 | * 5 | * This software is available to you under a choice of one of two 6 | * licenses. You may choose to be licensed under the terms of the GNU 7 | * General Public License (GPL) Version 2, available from the file 8 | * COPYING in the main directory of this source tree, or the 9 | * OpenIB.org BSD license below: 10 | * 11 | * Redistribution and use in source and binary forms, with or 12 | * without modification, are permitted provided that the following 13 | * conditions are met: 14 | * 15 | * - Redistributions of source code must retain the above 16 | * copyright notice, this list of conditions and the following 17 | * disclaimer. 18 | * 19 | * - Redistributions in binary form must reproduce the above 20 | * copyright notice, this list of conditions and the following 21 | * disclaimer in the documentation and/or other materials 22 | * provided with the distribution. 23 | * 24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 25 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 26 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 27 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 28 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 29 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 30 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | * SOFTWARE. 32 | */ 33 | 34 | #ifndef _PTL_FWD_SELF_H 35 | #define _PTL_FWD_SELF_H 36 | 37 | /* Symbol in am ptl */ 38 | struct ptl_ctl_init psmi_ptl_self; 39 | 40 | #endif 41 | 42 | -------------------------------------------------------------------------------- /ptl_self/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2006-2010. QLogic Corporation. All rights reserved. 2 | # Copyright (c) 2003-2006, PathScale, Inc. All rights reserved. 3 | # 4 | # This software is available to you under a choice of one of two 5 | # licenses. You may choose to be licensed under the terms of the GNU 6 | # General Public License (GPL) Version 2, available from the file 7 | # COPYING in the main directory of this source tree, or the 8 | # OpenIB.org BSD license below: 9 | # 10 | # Redistribution and use in source and binary forms, with or 11 | # without modification, are permitted provided that the following 12 | # conditions are met: 13 | # 14 | # - Redistributions of source code must retain the above 15 | # copyright notice, this list of conditions and the following 16 | # disclaimer. 17 | # 18 | # - Redistributions in binary form must reproduce the above 19 | # copyright notice, this list of conditions and the following 20 | # disclaimer in the documentation and/or other materials 21 | # provided with the distribution. 22 | # 23 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 24 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 25 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 26 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 27 | # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 28 | # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 29 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 30 | # SOFTWARE. 31 | # 32 | 33 | include $(top_srcdir)/buildflags.mak 34 | INCLUDES += -I$(top_srcdir) 35 | 36 | ${TARGLIB}-objs := ptl.o 37 | 38 | all: ${${TARGLIB}-objs} 39 | 40 | %.o: %.c 41 | $(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ 42 | 43 | clean: 44 | rm -f *.o 45 | 46 | -------------------------------------------------------------------------------- /ptl_ips/ptl_fwd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2012. QLogic Corporation. All rights reserved. 3 | * Copyright (c) 2003-2006, PathScale, Inc. All rights reserved. 4 | * 5 | * This software is available to you under a choice of one of two 6 | * licenses. You may choose to be licensed under the terms of the GNU 7 | * General Public License (GPL) Version 2, available from the file 8 | * COPYING in the main directory of this source tree, or the 9 | * OpenIB.org BSD license below: 10 | * 11 | * Redistribution and use in source and binary forms, with or 12 | * without modification, are permitted provided that the following 13 | * conditions are met: 14 | * 15 | * - Redistributions of source code must retain the above 16 | * copyright notice, this list of conditions and the following 17 | * disclaimer. 18 | * 19 | * - Redistributions in binary form must reproduce the above 20 | * copyright notice, this list of conditions and the following 21 | * disclaimer in the documentation and/or other materials 22 | * provided with the distribution. 23 | * 24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 25 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 26 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 27 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 28 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 29 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 30 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | * SOFTWARE. 32 | */ 33 | 34 | #ifndef _PTL_FWD_IPS_H 35 | #define _PTL_FWD_IPS_H 36 | #include "ptl.h" 37 | 38 | typedef struct ptl_epaddr ips_epaddr_t; 39 | 40 | /* Symbol in ips ptl */ 41 | struct ptl_ctl_init psmi_ptl_ips; 42 | #endif /* _PTL_FWD_IPS_H */ 43 | -------------------------------------------------------------------------------- /libuuid/clear.c: -------------------------------------------------------------------------------- 1 | /* 2 | * clear.c -- Clear a UUID 3 | * 4 | * Copyright (C) 1996, 1997 Theodore Ts'o. 5 | * 6 | * %Begin-Header% 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, and the entire permission notice in its entirety, 12 | * including the disclaimer of warranties. 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 3. The name of the author may not be used to endorse or promote 17 | * products derived from this software without specific prior 18 | * written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED 21 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 22 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF 23 | * WHICH ARE HEREBY DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE 24 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 26 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 27 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 28 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 30 | * USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH 31 | * DAMAGE. 32 | * %End-Header% 33 | */ 34 | 35 | #include "string.h" 36 | 37 | #include "uuidP.h" 38 | 39 | UUID_STATIC 40 | void uuid_clear(uuid_t uu) 41 | { 42 | memset(uu, 0, 16); 43 | } 44 | 45 | -------------------------------------------------------------------------------- /libuuid/psm_uuid.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2012. QLogic Corporation. All rights reserved. 3 | * Copyright (c) 2003-2006, PathScale, Inc. All rights reserved. 4 | * 5 | * This software is available to you under a choice of one of two 6 | * licenses. You may choose to be licensed under the terms of the GNU 7 | * General Public License (GPL) Version 2, available from the file 8 | * COPYING in the main directory of this source tree, or the 9 | * OpenIB.org BSD license below: 10 | * 11 | * Redistribution and use in source and binary forms, with or 12 | * without modification, are permitted provided that the following 13 | * conditions are met: 14 | * 15 | * - Redistributions of source code must retain the above 16 | * copyright notice, this list of conditions and the following 17 | * disclaimer. 18 | * 19 | * - Redistributions in binary form must reproduce the above 20 | * copyright notice, this list of conditions and the following 21 | * disclaimer in the documentation and/or other materials 22 | * provided with the distribution. 23 | * 24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 25 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 26 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 27 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 28 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 29 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 30 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | * SOFTWARE. 32 | */ 33 | 34 | #ifndef _PSM_UUID_H 35 | #define _PSM_UUID_H 36 | int psmi_uuid_parse(const char *in, psm_uuid_t uu); 37 | void psmi_uuid_unparse(const psm_uuid_t uuid, char *out); 38 | int psmi_uuid_compare(const psm_uuid_t uuA, const psm_uuid_t uuB); 39 | #endif 40 | -------------------------------------------------------------------------------- /libuuid/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2006-2010. QLogic Corporation. All rights reserved. 2 | # Copyright (c) 2003-2006, PathScale, Inc. All rights reserved. 3 | # 4 | # This software is available to you under a choice of one of two 5 | # licenses. You may choose to be licensed under the terms of the GNU 6 | # General Public License (GPL) Version 2, available from the file 7 | # COPYING in the main directory of this source tree, or the 8 | # OpenIB.org BSD license below: 9 | # 10 | # Redistribution and use in source and binary forms, with or 11 | # without modification, are permitted provided that the following 12 | # conditions are met: 13 | # 14 | # - Redistributions of source code must retain the above 15 | # copyright notice, this list of conditions and the following 16 | # disclaimer. 17 | # 18 | # - Redistributions in binary form must reproduce the above 19 | # copyright notice, this list of conditions and the following 20 | # disclaimer in the documentation and/or other materials 21 | # provided with the distribution. 22 | # 23 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 24 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 25 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 26 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 27 | # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 28 | # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 29 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 30 | # SOFTWARE. 31 | # 32 | 33 | include $(top_srcdir)/buildflags.mak 34 | CFLAGS += -DPSM_UUID=1 -Wno-unused-function 35 | INCLUDES += -I$(top_srcdir) -I$(top_srcidr)/libuuid 36 | 37 | ${TARGLIB}-objs := psm_uuid.o 38 | 39 | all: ${${TARGLIB}-objs} 40 | 41 | %.o: %.c 42 | $(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ 43 | 44 | clean: 45 | rm -f *.o 46 | -------------------------------------------------------------------------------- /ptl_am/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2006-2010. QLogic Corporation. All rights reserved. 2 | # Copyright (c) 2003-2006, PathScale, Inc. All rights reserved. 3 | # 4 | # This software is available to you under a choice of one of two 5 | # licenses. You may choose to be licensed under the terms of the GNU 6 | # General Public License (GPL) Version 2, available from the file 7 | # COPYING in the main directory of this source tree, or the 8 | # OpenIB.org BSD license below: 9 | # 10 | # Redistribution and use in source and binary forms, with or 11 | # without modification, are permitted provided that the following 12 | # conditions are met: 13 | # 14 | # - Redistributions of source code must retain the above 15 | # copyright notice, this list of conditions and the following 16 | # disclaimer. 17 | # 18 | # - Redistributions in binary form must reproduce the above 19 | # copyright notice, this list of conditions and the following 20 | # disclaimer in the documentation and/or other materials 21 | # provided with the distribution. 22 | # 23 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 24 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 25 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 26 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 27 | # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 28 | # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 29 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 30 | # SOFTWARE. 31 | # 32 | 33 | include $(top_srcdir)/buildflags.mak 34 | INCLUDES += -I$(top_srcdir) 35 | 36 | ${TARGLIB}-objs := am_reqrep.o am_reqrep_shmem.o ptl.o kcopyrwu.o knemrwu.o scifrwu.o 37 | 38 | all: ${${TARGLIB}-objs} 39 | 40 | %.o: %.c 41 | $(CC) $(CFLAGS) $(INCLUDES) $(if $(PSM_HAVE_SCIF:0=),$(SCIF_INCLUDE_FLAGS)) -c $< -o $@ 42 | 43 | clean: 44 | rm -f *.o 45 | 46 | -------------------------------------------------------------------------------- /libuuid/copy.c: -------------------------------------------------------------------------------- 1 | /* 2 | * copy.c --- copy UUIDs 3 | * 4 | * Copyright (C) 1996, 1997 Theodore Ts'o. 5 | * 6 | * %Begin-Header% 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, and the entire permission notice in its entirety, 12 | * including the disclaimer of warranties. 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 3. The name of the author may not be used to endorse or promote 17 | * products derived from this software without specific prior 18 | * written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED 21 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 22 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF 23 | * WHICH ARE HEREBY DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE 24 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 26 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 27 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 28 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 30 | * USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH 31 | * DAMAGE. 32 | * %End-Header% 33 | */ 34 | 35 | #include "uuidP.h" 36 | 37 | UUID_STATIC 38 | void uuid_copy(uuid_t dst, const uuid_t src) 39 | { 40 | unsigned char *cp1; 41 | const unsigned char *cp2; 42 | int i; 43 | 44 | for (i=0, cp1 = dst, cp2 = src; i < 16; i++) 45 | *cp1++ = *cp2++; 46 | } 47 | -------------------------------------------------------------------------------- /libuuid/isnull.c: -------------------------------------------------------------------------------- 1 | /* 2 | * isnull.c --- Check whether or not the UUID is null 3 | * 4 | * Copyright (C) 1996, 1997 Theodore Ts'o. 5 | * 6 | * %Begin-Header% 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, and the entire permission notice in its entirety, 12 | * including the disclaimer of warranties. 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 3. The name of the author may not be used to endorse or promote 17 | * products derived from this software without specific prior 18 | * written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED 21 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 22 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF 23 | * WHICH ARE HEREBY DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE 24 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 26 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 27 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 28 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 30 | * USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH 31 | * DAMAGE. 32 | * %End-Header% 33 | */ 34 | 35 | #include "uuidP.h" 36 | 37 | /* Returns 1 if the uuid is the NULL uuid */ 38 | UUID_STATIC 39 | int uuid_is_null(const uuid_t uu) 40 | { 41 | const unsigned char *cp; 42 | int i; 43 | 44 | for (i=0, cp = uu; i < 16; i++) 45 | if (*cp++) 46 | return 0; 47 | return 1; 48 | } 49 | 50 | -------------------------------------------------------------------------------- /ptl_am/kcopyrw.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2012. QLogic Corporation. All rights reserved. 3 | * Copyright (c) 2003-2006, PathScale, Inc. All rights reserved. 4 | * 5 | * This software is available to you under a choice of one of two 6 | * licenses. You may choose to be licensed under the terms of the GNU 7 | * General Public License (GPL) Version 2, available from the file 8 | * COPYING in the main directory of this source tree, or the 9 | * OpenIB.org BSD license below: 10 | * 11 | * Redistribution and use in source and binary forms, with or 12 | * without modification, are permitted provided that the following 13 | * conditions are met: 14 | * 15 | * - Redistributions of source code must retain the above 16 | * copyright notice, this list of conditions and the following 17 | * disclaimer. 18 | * 19 | * - Redistributions in binary form must reproduce the above 20 | * copyright notice, this list of conditions and the following 21 | * disclaimer in the documentation and/or other materials 22 | * provided with the distribution. 23 | * 24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 25 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 26 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 27 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 28 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 29 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 30 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | * SOFTWARE. 32 | */ 33 | 34 | #include 35 | #include 36 | 37 | /* 38 | * read from remote process pid 39 | */ 40 | int64_t kcopy_get(int fd, pid_t pid, const void *src, void *dst, int64_t n); 41 | 42 | /* 43 | * write to remote process pid 44 | */ 45 | int64_t kcopy_put(int fd, const void *src, pid_t pid, void *dst, int64_t n); 46 | 47 | /* 48 | * return the ABI version or -1 on error 49 | */ 50 | int kcopy_abi(int fd); 51 | -------------------------------------------------------------------------------- /ptl_am/scifrw.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013. Intel Corporation. All rights reserved. 3 | * Copyright (c) 2010. QLogic Corporation. All rights reserved. 4 | * 5 | * This software is available to you under a choice of one of two 6 | * licenses. You may choose to be licensed under the terms of the GNU 7 | * General Public License (GPL) Version 2, available from the file 8 | * COPYING in the main directory of this source tree, or the 9 | * OpenIB.org BSD license below: 10 | * 11 | * Redistribution and use in source and binary forms, with or 12 | * without modification, are permitted provided that the following 13 | * conditions are met: 14 | * 15 | * - Redistributions of source code must retain the above 16 | * copyright notice, this list of conditions and the following 17 | * disclaimer. 18 | * 19 | * - Redistributions in binary form must reproduce the above 20 | * copyright notice, this list of conditions and the following 21 | * disclaimer in the documentation and/or other materials 22 | * provided with the distribution. 23 | * 24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 25 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 26 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 27 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 28 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 29 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 30 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | * SOFTWARE. 32 | */ 33 | 34 | #include 35 | #include 36 | 37 | #if defined(PSM_HAVE_SCIF) 38 | #include 39 | 40 | /* 41 | * register a memory region for put/get 42 | */ 43 | int scif_register_region(scif_epd_t epd, void* addr, size_t len, off_t* offset); 44 | 45 | /* 46 | * unregister a memory region that was previously registered 47 | */ 48 | int scif_unregister_region(scif_epd_t epd, off_t reg, size_t len); 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /psm_noship.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2010. QLogic Corporation. All rights reserved. 3 | * Copyright (c) 2003-2006, PathScale, Inc. All rights reserved. 4 | * 5 | * This software is available to you under a choice of one of two 6 | * licenses. You may choose to be licensed under the terms of the GNU 7 | * General Public License (GPL) Version 2, available from the file 8 | * COPYING in the main directory of this source tree, or the 9 | * OpenIB.org BSD license below: 10 | * 11 | * Redistribution and use in source and binary forms, with or 12 | * without modification, are permitted provided that the following 13 | * conditions are met: 14 | * 15 | * - Redistributions of source code must retain the above 16 | * copyright notice, this list of conditions and the following 17 | * disclaimer. 18 | * 19 | * - Redistributions in binary form must reproduce the above 20 | * copyright notice, this list of conditions and the following 21 | * disclaimer in the documentation and/or other materials 22 | * provided with the distribution. 23 | * 24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 25 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 26 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 27 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 28 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 29 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 30 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | * SOFTWARE. 32 | */ 33 | 34 | #ifndef _PSM_NOSHIP_H_ 35 | #define _PSM_NOSHIP_H_ 36 | 37 | #include "psm.h" 38 | 39 | typedef struct psm_epinfo { 40 | psm_ep_t ep; 41 | psm_epid_t epid; 42 | psm_uuid_t uuid; 43 | char uuid_str[64]; 44 | } psm_epinfo_t; 45 | 46 | typedef struct psm_epconn { 47 | psm_epaddr_t addr; 48 | psm_ep_t ep; 49 | psm_mq_t mq; 50 | } psm_epconn_t; 51 | 52 | psm_error_t 53 | psm_ep_query (int *num_of_epinfo, psm_epinfo_t *array_of_epinfo); 54 | 55 | psm_error_t 56 | psm_ep_epid_lookup (psm_epid_t epid, psm_epconn_t *epconn); 57 | #endif 58 | -------------------------------------------------------------------------------- /ipath/ipath_dwordcpy-x86_64-fast.S: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2010. QLogic Corporation. All rights reserved. 3 | * Copyright (c) 2003-2006, PathScale, Inc. All rights reserved. 4 | * 5 | * This software is available to you under a choice of one of two 6 | * licenses. You may choose to be licensed under the terms of the GNU 7 | * General Public License (GPL) Version 2, available from the file 8 | * COPYING in the main directory of this source tree, or the 9 | * OpenIB.org BSD license below: 10 | * 11 | * Redistribution and use in source and binary forms, with or 12 | * without modification, are permitted provided that the following 13 | * conditions are met: 14 | * 15 | * - Redistributions of source code must retain the above 16 | * copyright notice, this list of conditions and the following 17 | * disclaimer. 18 | * 19 | * - Redistributions in binary form must reproduce the above 20 | * copyright notice, this list of conditions and the following 21 | * disclaimer in the documentation and/or other materials 22 | * provided with the distribution. 23 | * 24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 25 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 26 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 27 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 28 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 29 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 30 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | * SOFTWARE. 32 | */ 33 | 34 | .globl ipath_dwordcpy 35 | .file "ipath_dwordcpy-x86_64-fast.S" 36 | .text 37 | .p2align 4,,15 38 | // standard C calling convention, rdi is dest, rsi is source, rdx is count 39 | // does not return any value 40 | ipath_dwordcpy: 41 | .type ipath_dwordcpy, @function 42 | movl %edx,%ecx 43 | shrl $1,%ecx 44 | andl $1,%edx 45 | cld 46 | rep 47 | movsq 48 | movl %edx,%ecx 49 | rep 50 | movsd 51 | ret 52 | 53 | #if defined(__linux__) && defined(__ELF__) 54 | .section .note.GNU-stack,"",%progbits 55 | #endif 56 | -------------------------------------------------------------------------------- /ptl_am/knemrw.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010. QLogic Corporation. All rights reserved. 3 | * 4 | * This software is available to you under a choice of one of two 5 | * licenses. You may choose to be licensed under the terms of the GNU 6 | * General Public License (GPL) Version 2, available from the file 7 | * COPYING in the main directory of this source tree, or the 8 | * OpenIB.org BSD license below: 9 | * 10 | * Redistribution and use in source and binary forms, with or 11 | * without modification, are permitted provided that the following 12 | * conditions are met: 13 | * 14 | * - Redistributions of source code must retain the above 15 | * copyright notice, this list of conditions and the following 16 | * disclaimer. 17 | * 18 | * - Redistributions in binary form must reproduce the above 19 | * copyright notice, this list of conditions and the following 20 | * disclaimer in the documentation and/or other materials 21 | * provided with the distribution. 22 | * 23 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 24 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 25 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 26 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 27 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 28 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 29 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 30 | * SOFTWARE. 31 | */ 32 | 33 | #include 34 | #include 35 | 36 | #if defined(PSM_USE_KNEM) 37 | #include "knem_io.h" 38 | #endif 39 | 40 | /* 41 | * Open handle to knem device. 42 | */ 43 | int knem_open_device(); 44 | 45 | /* 46 | * read from remote process given a cookie 47 | */ 48 | int64_t knem_get(int fd, int64_t cookie, const void *src, int64_t n); 49 | 50 | /* 51 | * write to remote process pid given a cookie 52 | */ 53 | int64_t knem_put(int fd, const void *src, int64_t n, int64_t cookie); 54 | 55 | /* 56 | * register a memory region for put/get 57 | */ 58 | int64_t knem_register_region(void *buffer, size_t len, int write); 59 | -------------------------------------------------------------------------------- /ptl_ips/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2006-2010. QLogic Corporation. All rights reserved. 2 | # Copyright (c) 2003-2006, PathScale, Inc. All rights reserved. 3 | # 4 | # This software is available to you under a choice of one of two 5 | # licenses. You may choose to be licensed under the terms of the GNU 6 | # General Public License (GPL) Version 2, available from the file 7 | # COPYING in the main directory of this source tree, or the 8 | # OpenIB.org BSD license below: 9 | # 10 | # Redistribution and use in source and binary forms, with or 11 | # without modification, are permitted provided that the following 12 | # conditions are met: 13 | # 14 | # - Redistributions of source code must retain the above 15 | # copyright notice, this list of conditions and the following 16 | # disclaimer. 17 | # 18 | # - Redistributions in binary form must reproduce the above 19 | # copyright notice, this list of conditions and the following 20 | # disclaimer in the documentation and/or other materials 21 | # provided with the distribution. 22 | # 23 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 24 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 25 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 26 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 27 | # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 28 | # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 29 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 30 | # SOFTWARE. 31 | # 32 | 33 | include $(top_srcdir)/buildflags.mak 34 | INCLUDES += -I$(top_srcdir) -I$(top_srcidr)/ptl_ips 35 | 36 | ${TARGLIB}-objs := ptl.o ptl_rcvthread.o ips_proto.o ipserror.o ips_recvq.o \ 37 | ips_recvhdrq.o ips_spio.o ips_proto_recv.o ips_proto_connect.o \ 38 | ips_proto_dump.o ips_proto_mq.o ips_subcontext.o \ 39 | ips_writehdrq.o ips_proto_expected.o ips_tid.o 40 | 41 | # enable mov,0 -> xor optimization for ips 42 | ifeq (${CCARCH},pathcc) 43 | ifeq (,${PSM_DEBUG}) 44 | CFLAGS += -CG:use_xortozero=1 45 | endif 46 | endif 47 | 48 | all: ${${TARGLIB}-objs} 49 | 50 | %.o: %.c 51 | $(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ 52 | 53 | clean: 54 | rm -f *.o 55 | 56 | -------------------------------------------------------------------------------- /ipath/ipath_dwordcpy-i386.S: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2010. QLogic Corporation. All rights reserved. 3 | * Copyright (c) 2003-2006, PathScale, Inc. All rights reserved. 4 | * 5 | * This software is available to you under a choice of one of two 6 | * licenses. You may choose to be licensed under the terms of the GNU 7 | * General Public License (GPL) Version 2, available from the file 8 | * COPYING in the main directory of this source tree, or the 9 | * OpenIB.org BSD license below: 10 | * 11 | * Redistribution and use in source and binary forms, with or 12 | * without modification, are permitted provided that the following 13 | * conditions are met: 14 | * 15 | * - Redistributions of source code must retain the above 16 | * copyright notice, this list of conditions and the following 17 | * disclaimer. 18 | * 19 | * - Redistributions in binary form must reproduce the above 20 | * copyright notice, this list of conditions and the following 21 | * disclaimer in the documentation and/or other materials 22 | * provided with the distribution. 23 | * 24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 25 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 26 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 27 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 28 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 29 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 30 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | * SOFTWARE. 32 | */ 33 | 34 | .globl ipath_dwordcpy 35 | .file "ipath_dword32cpy.S" 36 | .text 37 | .p2align 4,,15 38 | ipath_dwordcpy: 39 | // standard C calling convention, args on stack 40 | // does not return any value 41 | .type ipath_dwordcpy, @function 42 | // save caller-saved regs 43 | mov %edi,%eax 44 | mov %esi,%edx 45 | 46 | // setup regs 47 | mov 0xc(%esp,1),%ecx 48 | mov 0x4(%esp,1),%edi 49 | mov 0x8(%esp,1),%esi 50 | // and do it 51 | cld 52 | rep 53 | movsd 54 | 55 | // restore 56 | mov %eax,%edi 57 | mov %edx,%esi 58 | ret 59 | 60 | #if defined(__linux__) && defined(__ELF__) 61 | .section .note.GNU-stack,"",%progbits 62 | #endif 63 | -------------------------------------------------------------------------------- /psm_error.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2012. QLogic Corporation. All rights reserved. 3 | * Copyright (c) 2003-2006, PathScale, Inc. All rights reserved. 4 | * 5 | * This software is available to you under a choice of one of two 6 | * licenses. You may choose to be licensed under the terms of the GNU 7 | * General Public License (GPL) Version 2, available from the file 8 | * COPYING in the main directory of this source tree, or the 9 | * OpenIB.org BSD license below: 10 | * 11 | * Redistribution and use in source and binary forms, with or 12 | * without modification, are permitted provided that the following 13 | * conditions are met: 14 | * 15 | * - Redistributions of source code must retain the above 16 | * copyright notice, this list of conditions and the following 17 | * disclaimer. 18 | * 19 | * - Redistributions in binary form must reproduce the above 20 | * copyright notice, this list of conditions and the following 21 | * disclaimer in the documentation and/or other materials 22 | * provided with the distribution. 23 | * 24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 25 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 26 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 27 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 28 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 29 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 30 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | * SOFTWARE. 32 | */ 33 | 34 | #ifndef _PSMI_IN_USER_H 35 | #error psm_error.h not meant to be included directly, include psm_user.h instead 36 | #endif 37 | 38 | #ifndef _PSMI_ERROR_H 39 | #define _PSMI_ERROR_H 40 | 41 | #define PSMI_EP_NONE (NULL) 42 | #define PSMI_EP_NORETURN ((psm_ep_t) -2) 43 | #define PSMI_EP_LOGEVENT ((psm_ep_t) -3) 44 | 45 | psm_ep_errhandler_t psmi_errhandler_global; 46 | 47 | psm_error_t psmi_handle_error(psm_ep_t ep, psm_error_t error, 48 | const char *buf, ...) 49 | __attribute__((format(printf, 3, 4))); 50 | 51 | psm_error_t psmi_error_cmp(psm_error_t errA, psm_error_t errB); 52 | int psmi_error_syslog_level(psm_error_t error); 53 | 54 | #endif /* _PSMI_ERROR_H */ 55 | -------------------------------------------------------------------------------- /ptl_ips/ips_stats.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2012. QLogic Corporation. All rights reserved. 3 | * Copyright (c) 2003-2006, PathScale, Inc. All rights reserved. 4 | * 5 | * This software is available to you under a choice of one of two 6 | * licenses. You may choose to be licensed under the terms of the GNU 7 | * General Public License (GPL) Version 2, available from the file 8 | * COPYING in the main directory of this source tree, or the 9 | * OpenIB.org BSD license below: 10 | * 11 | * Redistribution and use in source and binary forms, with or 12 | * without modification, are permitted provided that the following 13 | * conditions are met: 14 | * 15 | * - Redistributions of source code must retain the above 16 | * copyright notice, this list of conditions and the following 17 | * disclaimer. 18 | * 19 | * - Redistributions in binary form must reproduce the above 20 | * copyright notice, this list of conditions and the following 21 | * disclaimer in the documentation and/or other materials 22 | * provided with the distribution. 23 | * 24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 25 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 26 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 27 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 28 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 29 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 30 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | * SOFTWARE. 32 | */ 33 | 34 | #ifndef _IPS_STATS_H 35 | #define _IPS_STATS_H 36 | 37 | struct psm_epaddr; /* for non-PSM clients */ 38 | 39 | /* Old stats */ 40 | typedef 41 | struct { 42 | uint64_t err_chk_send; 43 | uint64_t err_chk_recv; 44 | uint64_t send_failed; 45 | uint64_t recv_dropped; 46 | union { 47 | uint64_t recv_copied; /* obsolete */ 48 | uint64_t nak_sent; 49 | }; 50 | uint64_t nak_recv; 51 | uint64_t total_send_eager; 52 | uint64_t total_send_exp; 53 | uint64_t acks_sent; 54 | uint64_t retransmits; 55 | uint64_t recv_matched; 56 | uint64_t recv_unmatched; 57 | uint64_t scb_alloc_yields; 58 | } ips_sess_stat; 59 | 60 | int ips_get_stat(struct psm_epaddr *epaddr, ips_sess_stat *stats); 61 | 62 | #endif /* _IPS_STATS_H */ 63 | -------------------------------------------------------------------------------- /libuuid/unpack.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Internal routine for unpacking UUID 3 | * 4 | * Copyright (C) 1996, 1997 Theodore Ts'o. 5 | * 6 | * %Begin-Header% 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, and the entire permission notice in its entirety, 12 | * including the disclaimer of warranties. 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 3. The name of the author may not be used to endorse or promote 17 | * products derived from this software without specific prior 18 | * written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED 21 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 22 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF 23 | * WHICH ARE HEREBY DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE 24 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 26 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 27 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 28 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 30 | * USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH 31 | * DAMAGE. 32 | * %End-Header% 33 | */ 34 | 35 | #include 36 | #include "uuidP.h" 37 | 38 | UUID_STATIC 39 | void uuid_unpack(const uuid_t in, struct uuid *uu) 40 | { 41 | const uint8_t *ptr = in; 42 | uint32_t tmp; 43 | 44 | tmp = *ptr++; 45 | tmp = (tmp << 8) | *ptr++; 46 | tmp = (tmp << 8) | *ptr++; 47 | tmp = (tmp << 8) | *ptr++; 48 | uu->time_low = tmp; 49 | 50 | tmp = *ptr++; 51 | tmp = (tmp << 8) | *ptr++; 52 | uu->time_mid = tmp; 53 | 54 | tmp = *ptr++; 55 | tmp = (tmp << 8) | *ptr++; 56 | uu->time_hi_and_version = tmp; 57 | 58 | tmp = *ptr++; 59 | tmp = (tmp << 8) | *ptr++; 60 | uu->clock_seq = tmp; 61 | 62 | memcpy(uu->node, ptr, 6); 63 | } 64 | 65 | -------------------------------------------------------------------------------- /libuuid/compare.c: -------------------------------------------------------------------------------- 1 | /* 2 | * compare.c --- compare whether or not two UUID's are the same 3 | * 4 | * Returns 0 if the two UUID's are different, and 1 if they are the same. 5 | * 6 | * Copyright (C) 1996, 1997 Theodore Ts'o. 7 | * 8 | * %Begin-Header% 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, and the entire permission notice in its entirety, 14 | * including the disclaimer of warranties. 15 | * 2. Redistributions in binary form must reproduce the above copyright 16 | * notice, this list of conditions and the following disclaimer in the 17 | * documentation and/or other materials provided with the distribution. 18 | * 3. The name of the author may not be used to endorse or promote 19 | * products derived from this software without specific prior 20 | * written permission. 21 | * 22 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED 23 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF 25 | * WHICH ARE HEREBY DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE 26 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 27 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 28 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 29 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 30 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 32 | * USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH 33 | * DAMAGE. 34 | * %End-Header% 35 | */ 36 | 37 | #include "uuidP.h" 38 | #include 39 | 40 | #define UUCMP(u1,u2) if (u1 != u2) return((u1 < u2) ? -1 : 1); 41 | 42 | UUID_STATIC 43 | int uuid_compare(const uuid_t uu1, const uuid_t uu2) 44 | { 45 | struct uuid uuid1, uuid2; 46 | 47 | uuid_unpack(uu1, &uuid1); 48 | uuid_unpack(uu2, &uuid2); 49 | 50 | UUCMP(uuid1.time_low, uuid2.time_low); 51 | UUCMP(uuid1.time_mid, uuid2.time_mid); 52 | UUCMP(uuid1.time_hi_and_version, uuid2.time_hi_and_version); 53 | UUCMP(uuid1.clock_seq, uuid2.clock_seq); 54 | return memcmp(uuid1.node, uuid2.node, 6); 55 | } 56 | 57 | -------------------------------------------------------------------------------- /ptl_am/ptl_fwd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013. Intel Corporation. All rights reserved. 3 | * Copyright (c) 2006-2012. QLogic Corporation. All rights reserved. 4 | * Copyright (c) 2003-2006, PathScale, Inc. All rights reserved. 5 | * 6 | * This software is available to you under a choice of one of two 7 | * licenses. You may choose to be licensed under the terms of the GNU 8 | * General Public License (GPL) Version 2, available from the file 9 | * COPYING in the main directory of this source tree, or the 10 | * OpenIB.org BSD license below: 11 | * 12 | * Redistribution and use in source and binary forms, with or 13 | * without modification, are permitted provided that the following 14 | * conditions are met: 15 | * 16 | * - Redistributions of source code must retain the above 17 | * copyright notice, this list of conditions and the following 18 | * disclaimer. 19 | * 20 | * - Redistributions in binary form must reproduce the above 21 | * copyright notice, this list of conditions and the following 22 | * disclaimer in the documentation and/or other materials 23 | * provided with the distribution. 24 | * 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | * SOFTWARE. 33 | */ 34 | 35 | #ifndef _PTL_FWD_AMSH_H 36 | #define _PTL_FWD_AMSH_H 37 | 38 | #define PTL_AMSH_MAX_LOCAL_PROCS 256 39 | 40 | /* SCIF manual says it is optimized for up to 8 nodes, so choose 16 for 41 | future expansion. */ 42 | #ifdef PSM_HAVE_SCIF 43 | #define PTL_AMSH_MAX_LOCAL_NODES 8 44 | #else 45 | /* Compiling without SCIF: assume one node */ 46 | #define PTL_AMSH_MAX_LOCAL_NODES 1 47 | #endif 48 | 49 | /* Symbol in am ptl */ 50 | struct ptl_ctl_init psmi_ptl_amsh; 51 | 52 | /* Special non-ptl function exposed to pre-attach to shm segment */ 53 | psm_error_t psmi_shm_attach(psm_ep_t ep, int *shmidx_o); 54 | psm_error_t psmi_shm_detach(psm_ep_t ep); 55 | 56 | extern int psmi_shm_mq_rv_thresh; 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /ptl_ips/ips_subcontext.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2012. QLogic Corporation. All rights reserved. 3 | * Copyright (c) 2003-2006, PathScale, Inc. All rights reserved. 4 | * 5 | * This software is available to you under a choice of one of two 6 | * licenses. You may choose to be licensed under the terms of the GNU 7 | * General Public License (GPL) Version 2, available from the file 8 | * COPYING in the main directory of this source tree, or the 9 | * OpenIB.org BSD license below: 10 | * 11 | * Redistribution and use in source and binary forms, with or 12 | * without modification, are permitted provided that the following 13 | * conditions are met: 14 | * 15 | * - Redistributions of source code must retain the above 16 | * copyright notice, this list of conditions and the following 17 | * disclaimer. 18 | * 19 | * - Redistributions in binary form must reproduce the above 20 | * copyright notice, this list of conditions and the following 21 | * disclaimer in the documentation and/or other materials 22 | * provided with the distribution. 23 | * 24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 25 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 26 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 27 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 28 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 29 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 30 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | * SOFTWARE. 32 | */ 33 | 34 | #ifndef __IPS_SUBCONTEXT_H 35 | #define __IPS_SUBCONTEXT_H 36 | 37 | #include "psm_user.h" 38 | #include "ips_recvhdrq.h" 39 | #include "ips_writehdrq.h" 40 | 41 | /* This data structure is allocated in ureg page of each subcontext process */ 42 | 43 | struct ips_subcontext_ureg { 44 | pthread_spinlock_t context_lock; /* only used in master ureg */ 45 | struct ips_recvhdrq_state recvq_state; /* only used in master ureg */ 46 | struct ips_writehdrq_state writeq_state; /* used in all ureg pages */ 47 | }; 48 | 49 | psm_error_t 50 | ips_subcontext_ureg_get(ptl_t *ptl, const psmi_context_t *context, 51 | struct ips_subcontext_ureg **uregp, 52 | uint32_t subcontext_cnt); 53 | 54 | psm_error_t 55 | ips_subcontext_ureg_initialize(ptl_t *ptl, uint32_t subcontext, 56 | struct ips_subcontext_ureg *uregp); 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /ipath/ipath_i2cflash.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2012. QLogic Corporation. All rights reserved. 3 | * Copyright (c) 2003-2006, PathScale, Inc. All rights reserved. 4 | * 5 | * This software is available to you under a choice of one of two 6 | * licenses. You may choose to be licensed under the terms of the GNU 7 | * General Public License (GPL) Version 2, available from the file 8 | * COPYING in the main directory of this source tree, or the 9 | * OpenIB.org BSD license below: 10 | * 11 | * Redistribution and use in source and binary forms, with or 12 | * without modification, are permitted provided that the following 13 | * conditions are met: 14 | * 15 | * - Redistributions of source code must retain the above 16 | * copyright notice, this list of conditions and the following 17 | * disclaimer. 18 | * 19 | * - Redistributions in binary form must reproduce the above 20 | * copyright notice, this list of conditions and the following 21 | * disclaimer in the documentation and/or other materials 22 | * provided with the distribution. 23 | * 24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 25 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 26 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 27 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 28 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 29 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 30 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | * SOFTWARE. 32 | */ 33 | 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | 43 | #include "ipath_user.h" 44 | 45 | uint8_t 46 | ipath_flash_csum(struct ipath_flash *ifp, int adjust) 47 | { 48 | uint8_t *ip = (uint8_t*)ifp; 49 | uint8_t csum = 0, len; 50 | 51 | /* 52 | * Limit length checksummed to max length of actual data. 53 | * Checksum of erased eeprom will still be bad, but we avoid 54 | * reading past the end of the buffer we were passed. 55 | */ 56 | len = ifp->if_length; 57 | if (len > sizeof(struct ipath_flash)) 58 | len = sizeof(struct ipath_flash); 59 | while (len--) 60 | csum += *ip++; 61 | csum -= ifp->if_csum; 62 | csum = ~csum; 63 | if(adjust) 64 | ifp->if_csum = csum; 65 | return csum; 66 | } 67 | 68 | -------------------------------------------------------------------------------- /libuuid/pack.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Internal routine for packing UUID's 3 | * 4 | * Copyright (C) 1996, 1997 Theodore Ts'o. 5 | * 6 | * %Begin-Header% 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, and the entire permission notice in its entirety, 12 | * including the disclaimer of warranties. 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 3. The name of the author may not be used to endorse or promote 17 | * products derived from this software without specific prior 18 | * written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED 21 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 22 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF 23 | * WHICH ARE HEREBY DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE 24 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 26 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 27 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 28 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 30 | * USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH 31 | * DAMAGE. 32 | * %End-Header% 33 | */ 34 | 35 | #include 36 | #include "uuidP.h" 37 | 38 | UUID_STATIC 39 | void uuid_pack(const struct uuid *uu, uuid_t ptr) 40 | { 41 | uint32_t tmp; 42 | unsigned char *out = ptr; 43 | 44 | tmp = uu->time_low; 45 | out[3] = (unsigned char) tmp; 46 | tmp >>= 8; 47 | out[2] = (unsigned char) tmp; 48 | tmp >>= 8; 49 | out[1] = (unsigned char) tmp; 50 | tmp >>= 8; 51 | out[0] = (unsigned char) tmp; 52 | 53 | tmp = uu->time_mid; 54 | out[5] = (unsigned char) tmp; 55 | tmp >>= 8; 56 | out[4] = (unsigned char) tmp; 57 | 58 | tmp = uu->time_hi_and_version; 59 | out[7] = (unsigned char) tmp; 60 | tmp >>= 8; 61 | out[6] = (unsigned char) tmp; 62 | 63 | tmp = uu->clock_seq; 64 | out[9] = (unsigned char) tmp; 65 | tmp >>= 8; 66 | out[8] = (unsigned char) tmp; 67 | 68 | memcpy(out+10, uu->node, 6); 69 | } 70 | 71 | -------------------------------------------------------------------------------- /libuuid/uuidP.h: -------------------------------------------------------------------------------- 1 | /* 2 | * uuid.h -- private header file for uuids 3 | * 4 | * Copyright (C) 1996, 1997 Theodore Ts'o. 5 | * 6 | * %Begin-Header% 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, and the entire permission notice in its entirety, 12 | * including the disclaimer of warranties. 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 3. The name of the author may not be used to endorse or promote 17 | * products derived from this software without specific prior 18 | * written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED 21 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 22 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF 23 | * WHICH ARE HEREBY DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE 24 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 26 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 27 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 28 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 30 | * USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH 31 | * DAMAGE. 32 | * %End-Header% 33 | */ 34 | 35 | #ifndef _UUID_UUIDP_H 36 | #define _UUID_UUIDP_H 37 | 38 | #ifndef UUID_STATIC 39 | # ifdef PSM_UUID 40 | # define UUID_STATIC static 41 | # else 42 | # define UUID_STATIC 43 | # endif 44 | #endif 45 | 46 | #ifdef HAVE_INTTYPES_H 47 | #include 48 | #else 49 | #include 50 | #endif 51 | #include 52 | 53 | #include "uuid.h" 54 | 55 | /* 56 | * Offset between 15-Oct-1582 and 1-Jan-70 57 | */ 58 | #define TIME_OFFSET_HIGH 0x01B21DD2 59 | #define TIME_OFFSET_LOW 0x13814000 60 | 61 | struct uuid { 62 | uint32_t time_low; 63 | uint16_t time_mid; 64 | uint16_t time_hi_and_version; 65 | uint16_t clock_seq; 66 | uint8_t node[6]; 67 | }; 68 | 69 | /* 70 | * prototypes 71 | */ 72 | UUID_STATIC 73 | void uuid_pack(const struct uuid *uu, uuid_t ptr); 74 | UUID_STATIC 75 | void uuid_unpack(const uuid_t in, struct uuid *uu); 76 | 77 | #endif /* _UUID_UUIDP_H */ 78 | -------------------------------------------------------------------------------- /psm_am_internal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2012. QLogic Corporation. All rights reserved. 3 | * Copyright (c) 2003-2006, PathScale, Inc. All rights reserved. 4 | * 5 | * This software is available to you under a choice of one of two 6 | * licenses. You may choose to be licensed under the terms of the GNU 7 | * General Public License (GPL) Version 2, available from the file 8 | * COPYING in the main directory of this source tree, or the 9 | * OpenIB.org BSD license below: 10 | * 11 | * Redistribution and use in source and binary forms, with or 12 | * without modification, are permitted provided that the following 13 | * conditions are met: 14 | * 15 | * - Redistributions of source code must retain the above 16 | * copyright notice, this list of conditions and the following 17 | * disclaimer. 18 | * 19 | * - Redistributions in binary form must reproduce the above 20 | * copyright notice, this list of conditions and the following 21 | * disclaimer in the documentation and/or other materials 22 | * provided with the distribution. 23 | * 24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 25 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 26 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 27 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 28 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 29 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 30 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | * SOFTWARE. 32 | */ 33 | 34 | #ifndef _PSM_AM_INTERNAL_H 35 | #define _PSM_AM_INTERNAL_H 36 | 37 | #define PSMI_AM_MAX_ARGS 8 38 | #define PSMI_AM_NUM_HANDLERS 256 /* must be power of 2 */ 39 | 40 | #define PSMI_AM_ARGS_DEFAULT psm_am_token_t token, psm_epaddr_t epaddr, \ 41 | psm_amarg_t *args, int nargs, \ 42 | void *src, uint32_t len 43 | 44 | struct psmi_am_token { 45 | psm_epaddr_t epaddr_from; 46 | uint32_t flags; 47 | /* Can handler reply? i.e. Not OPCODE_AM_REQUEST_NOREPLY request */ 48 | uint32_t can_reply; 49 | 50 | /* PTLs may add other stuff here */ 51 | }; 52 | 53 | PSMI_ALWAYS_INLINE( 54 | psm_am_handler_fn_t 55 | psm_am_get_handler_function(psm_ep_t ep, psm_handler_t handler_idx)) 56 | { 57 | int hidx = handler_idx & (PSMI_AM_NUM_HANDLERS-1); 58 | psm_am_handler_fn_t fn = (psm_am_handler_fn_t) ep->am_htable[hidx]; 59 | psmi_assert_always(fn != NULL); 60 | return fn; 61 | } 62 | 63 | /* PSM internal initialization */ 64 | psm_error_t psmi_am_init_internal(psm_ep_t ep); 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /libuuid/parse.c: -------------------------------------------------------------------------------- 1 | /* 2 | * parse.c --- UUID parsing 3 | * 4 | * Copyright (C) 1996, 1997 Theodore Ts'o. 5 | * 6 | * %Begin-Header% 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, and the entire permission notice in its entirety, 12 | * including the disclaimer of warranties. 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 3. The name of the author may not be used to endorse or promote 17 | * products derived from this software without specific prior 18 | * written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED 21 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 22 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF 23 | * WHICH ARE HEREBY DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE 24 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 26 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 27 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 28 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 30 | * USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH 31 | * DAMAGE. 32 | * %End-Header% 33 | */ 34 | 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | #include "uuidP.h" 41 | 42 | UUID_STATIC 43 | int uuid_parse(const char *in, uuid_t uu) 44 | { 45 | struct uuid uuid; 46 | int i; 47 | const char *cp; 48 | char buf[3]; 49 | 50 | if (strlen(in) != 36) 51 | return -1; 52 | for (i=0, cp = in; i <= 36; i++,cp++) { 53 | if ((i == 8) || (i == 13) || (i == 18) || 54 | (i == 23)) { 55 | if (*cp == '-') 56 | continue; 57 | else 58 | return -1; 59 | } 60 | if (i== 36) 61 | if (*cp == 0) 62 | continue; 63 | if (!isxdigit(*cp)) 64 | return -1; 65 | } 66 | uuid.time_low = strtoul(in, NULL, 16); 67 | uuid.time_mid = strtoul(in+9, NULL, 16); 68 | uuid.time_hi_and_version = strtoul(in+14, NULL, 16); 69 | uuid.clock_seq = strtoul(in+19, NULL, 16); 70 | cp = in+24; 71 | buf[2] = 0; 72 | for (i=0; i < 6; i++) { 73 | buf[0] = *cp++; 74 | buf[1] = *cp++; 75 | uuid.node[i] = strtoul(buf, NULL, 16); 76 | } 77 | 78 | uuid_pack(&uuid, uu); 79 | return 0; 80 | } 81 | -------------------------------------------------------------------------------- /libuuid/unparse.c: -------------------------------------------------------------------------------- 1 | /* 2 | * unparse.c -- convert a UUID to string 3 | * 4 | * Copyright (C) 1996, 1997 Theodore Ts'o. 5 | * 6 | * %Begin-Header% 7 | * Redistribution and use in source and binary forms, with or without 8 | * modification, are permitted provided that the following conditions 9 | * are met: 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, and the entire permission notice in its entirety, 12 | * including the disclaimer of warranties. 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 3. The name of the author may not be used to endorse or promote 17 | * products derived from this software without specific prior 18 | * written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED 21 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 22 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF 23 | * WHICH ARE HEREBY DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE 24 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 26 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 27 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 28 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 30 | * USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH 31 | * DAMAGE. 32 | * %End-Header% 33 | */ 34 | 35 | #include 36 | 37 | #include "uuidP.h" 38 | 39 | static const char *fmt_lower = 40 | "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x"; 41 | 42 | static const char *fmt_upper = 43 | "%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X"; 44 | 45 | #ifdef UUID_UNPARSE_DEFAULT_UPPER 46 | #define FMT_DEFAULT fmt_upper 47 | #else 48 | #define FMT_DEFAULT fmt_lower 49 | #endif 50 | 51 | static void uuid_unparse_x(const uuid_t uu, char *out, const char *fmt) 52 | { 53 | struct uuid uuid; 54 | 55 | uuid_unpack(uu, &uuid); 56 | sprintf(out, fmt, 57 | uuid.time_low, uuid.time_mid, uuid.time_hi_and_version, 58 | uuid.clock_seq >> 8, uuid.clock_seq & 0xFF, 59 | uuid.node[0], uuid.node[1], uuid.node[2], 60 | uuid.node[3], uuid.node[4], uuid.node[5]); 61 | } 62 | 63 | UUID_STATIC 64 | void uuid_unparse_lower(const uuid_t uu, char *out) 65 | { 66 | uuid_unparse_x(uu, out, fmt_lower); 67 | } 68 | 69 | UUID_STATIC 70 | void uuid_unparse_upper(const uuid_t uu, char *out) 71 | { 72 | uuid_unparse_x(uu, out, fmt_upper); 73 | } 74 | 75 | UUID_STATIC 76 | void uuid_unparse(const uuid_t uu, char *out) 77 | { 78 | uuid_unparse_x(uu, out, FMT_DEFAULT); 79 | } 80 | -------------------------------------------------------------------------------- /psm_mpool.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2012. QLogic Corporation. All rights reserved. 3 | * Copyright (c) 2003-2006, PathScale, Inc. All rights reserved. 4 | * 5 | * This software is available to you under a choice of one of two 6 | * licenses. You may choose to be licensed under the terms of the GNU 7 | * General Public License (GPL) Version 2, available from the file 8 | * COPYING in the main directory of this source tree, or the 9 | * OpenIB.org BSD license below: 10 | * 11 | * Redistribution and use in source and binary forms, with or 12 | * without modification, are permitted provided that the following 13 | * conditions are met: 14 | * 15 | * - Redistributions of source code must retain the above 16 | * copyright notice, this list of conditions and the following 17 | * disclaimer. 18 | * 19 | * - Redistributions in binary form must reproduce the above 20 | * copyright notice, this list of conditions and the following 21 | * disclaimer in the documentation and/or other materials 22 | * provided with the distribution. 23 | * 24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 25 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 26 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 27 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 28 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 29 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 30 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | * SOFTWARE. 32 | */ 33 | 34 | #ifndef _PSMI_IN_USER_H 35 | #error psm_mpool.h not meant to be included directly, include psm_user.h instead 36 | #endif 37 | 38 | #ifndef PSM_MPOOL_H 39 | #define PSM_MPOOL_H 40 | 41 | /* mpool flags */ 42 | #define PSMI_MPOOL_ALIGN_CACHE 0x1 43 | #define PSMI_MPOOL_ALIGN_PAGE 0x2 44 | #define PSMI_MPOOL_NOGENERATION 0x4 45 | 46 | /* Backwards compatibility */ 47 | #define PSMI_MPOOL_ALIGN PSMI_MPOOL_ALIGN_CACHE 48 | 49 | typedef void (*non_empty_callback_fn_t)(void *context); 50 | typedef struct mpool *mpool_t; 51 | 52 | mpool_t psmi_mpool_create(size_t obj_size, uint32_t num_obj_per_chunk, 53 | uint32_t num_obj_max_total, int flags, 54 | psmi_memtype_t statstype, 55 | non_empty_callback_fn_t cb, void *context); 56 | 57 | void psmi_mpool_destroy(mpool_t mp); 58 | void psmi_mpool_get_obj_info(mpool_t mp, uint32_t *num_obj_per_chunk, 59 | uint32_t *num_obj_max_total); 60 | 61 | void * psmi_mpool_get(mpool_t mp); 62 | void psmi_mpool_put(void *obj); 63 | 64 | int psmi_mpool_get_obj_index(void *obj); 65 | uint32_t psmi_mpool_get_obj_gen_count(void *obj); 66 | int psmi_mpool_get_obj_index_gen_count(void *obj, 67 | uint32_t *index, 68 | uint32_t *gen_count); 69 | 70 | void * psmi_mpool_find_obj_by_index(mpool_t mp, int index); 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /ptl_ips/ips_proto_am.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013. Intel Corporation. All rights reserved. 3 | * Copyright (c) 2006-2012. QLogic Corporation. All rights reserved. 4 | * Copyright (c) 2003-2006, PathScale, Inc. All rights reserved. 5 | * 6 | * This software is available to you under a choice of one of two 7 | * licenses. You may choose to be licensed under the terms of the GNU 8 | * General Public License (GPL) Version 2, available from the file 9 | * COPYING in the main directory of this source tree, or the 10 | * OpenIB.org BSD license below: 11 | * 12 | * Redistribution and use in source and binary forms, with or 13 | * without modification, are permitted provided that the following 14 | * conditions are met: 15 | * 16 | * - Redistributions of source code must retain the above 17 | * copyright notice, this list of conditions and the following 18 | * disclaimer. 19 | * 20 | * - Redistributions in binary form must reproduce the above 21 | * copyright notice, this list of conditions and the following 22 | * disclaimer in the documentation and/or other materials 23 | * provided with the distribution. 24 | * 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | * SOFTWARE. 33 | */ 34 | 35 | #ifndef _IPS_PROTO_AM_H 36 | #define _IPS_PROTO_AM_H 37 | 38 | #include "psm_user.h" 39 | #include "ips_scb.h" 40 | 41 | #define PSM_AM_HDR_QWORDS 2 /* Needs to be at least 2 */ 42 | 43 | struct ips_proto_am { 44 | struct ips_proto *proto; /* back pointer */ 45 | struct ips_scbctrl *scbc_request; 46 | struct ips_scbctrl scbc_reply; 47 | 48 | uint64_t amreply_nobufs; 49 | }; 50 | 51 | psm_error_t 52 | ips_am_short_reply(psm_am_token_t tok, 53 | psm_handler_t handler, psm_amarg_t *args, int nargs, 54 | void *src, size_t len, int flags, 55 | psm_am_completion_fn_t completion_fn, 56 | void *completion_ctxt); 57 | 58 | psm_error_t 59 | ips_am_short_request(psm_epaddr_t epaddr, 60 | psm_handler_t handler, psm_amarg_t *args, int nargs, 61 | void *src, size_t len, int flags, 62 | psm_am_completion_fn_t completion_fn, 63 | void *completion_ctxt); 64 | 65 | psm_error_t ips_proto_am_init(struct ips_proto *proto, int num_of_send_bufs, 66 | int num_of_send_desc, uint32_t imm_size, 67 | struct ips_proto_am *proto_am); 68 | 69 | psm_error_t ips_proto_am_fini(struct ips_proto_am *proto_am); 70 | 71 | #endif /* _IPS_PROTO_AM_H */ 72 | -------------------------------------------------------------------------------- /include/linux-i386/bit_ops.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2012. QLogic Corporation. All rights reserved. 3 | * Copyright (c) 2003-2006, PathScale, Inc. All rights reserved. 4 | * 5 | * This software is available to you under a choice of one of two 6 | * licenses. You may choose to be licensed under the terms of the GNU 7 | * General Public License (GPL) Version 2, available from the file 8 | * COPYING in the main directory of this source tree, or the 9 | * OpenIB.org BSD license below: 10 | * 11 | * Redistribution and use in source and binary forms, with or 12 | * without modification, are permitted provided that the following 13 | * conditions are met: 14 | * 15 | * - Redistributions of source code must retain the above 16 | * copyright notice, this list of conditions and the following 17 | * disclaimer. 18 | * 19 | * - Redistributions in binary form must reproduce the above 20 | * copyright notice, this list of conditions and the following 21 | * disclaimer in the documentation and/or other materials 22 | * provided with the distribution. 23 | * 24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 25 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 26 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 27 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 28 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 29 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 30 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | * SOFTWARE. 32 | */ 33 | 34 | #ifndef _IPATH_i386_BIT_OPS_H 35 | #define _IPATH_i386_BIT_OPS_H 36 | 37 | static __inline__ void ips_clear_bit(int nr, volatile unsigned long *addr) 38 | { 39 | asm volatile(LOCK_PREFIX "btrl %1,%0" : "=m" (*addr) : "dIr"(nr)); 40 | } 41 | 42 | static __inline__ void ips_change_bit(int nr, volatile unsigned long *addr) 43 | { 44 | asm volatile(LOCK_PREFIX "btcl %1,%0" : "=m" (*addr) : "dIr"(nr)); 45 | } 46 | 47 | static __inline__ int ips_test_and_set_bit(int nr, volatile unsigned long *addr) 48 | { 49 | int oldbit; 50 | 51 | asm volatile(LOCK_PREFIX "btsl %2,%1\n\tsbbl %0,%0" : "=r" (oldbit), 52 | "=m" (*addr) : "dIr" (nr) : "memory"); 53 | return oldbit; 54 | } 55 | 56 | static __inline__ void ips___clear_bit(int nr, volatile unsigned long *addr) 57 | { 58 | asm volatile("btrl %1,%0" : "=m" (*addr) : "dIr"(nr)); 59 | } 60 | 61 | static __inline__ void ips___change_bit(int nr, volatile unsigned long *addr) 62 | { 63 | asm volatile("btcl %1,%0" : "=m" (*addr) : "dIr"(nr)); 64 | } 65 | 66 | static __inline__ int ips___test_and_set_bit(int nr, 67 | volatile unsigned long *addr) 68 | { 69 | int oldbit; 70 | 71 | asm volatile("btsl %2,%1\n\tsbbl %0,%0" : "=r" (oldbit), 72 | "=m" (*addr) : "dIr" (nr) : "memory"); 73 | return oldbit; 74 | } 75 | 76 | #endif /* _IPATH_i386_BIT_OPS_H */ 77 | -------------------------------------------------------------------------------- /ptl_ips/ips_recvq.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2012. QLogic Corporation. All rights reserved. 3 | * Copyright (c) 2003-2006, PathScale, Inc. All rights reserved. 4 | * 5 | * This software is available to you under a choice of one of two 6 | * licenses. You may choose to be licensed under the terms of the GNU 7 | * General Public License (GPL) Version 2, available from the file 8 | * COPYING in the main directory of this source tree, or the 9 | * OpenIB.org BSD license below: 10 | * 11 | * Redistribution and use in source and binary forms, with or 12 | * without modification, are permitted provided that the following 13 | * conditions are met: 14 | * 15 | * - Redistributions of source code must retain the above 16 | * copyright notice, this list of conditions and the following 17 | * disclaimer. 18 | * 19 | * - Redistributions in binary form must reproduce the above 20 | * copyright notice, this list of conditions and the following 21 | * disclaimer in the documentation and/or other materials 22 | * provided with the distribution. 23 | * 24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 25 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 26 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 27 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 28 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 29 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 30 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | * SOFTWARE. 32 | */ 33 | 34 | #include "ips_recvq.h" 35 | 36 | /* We return a table of pointer indexes. 37 | * 38 | * From the point of view of the returned pointer, index -1 always points to 39 | * the address to call psmi_free on (since we force page-alignment). 40 | */ 41 | void ** 42 | ips_recvq_egrbuf_table_alloc(psm_ep_t ep, void *baseptr, 43 | uint32_t chunksize, 44 | uint32_t bufnum, uint32_t bufsize) 45 | { 46 | unsigned i; 47 | uint32_t bufperchunk = chunksize / bufsize; 48 | void *ptr_alloc; 49 | uintptr_t *buft; 50 | uintptr_t base = (uintptr_t) baseptr; 51 | 52 | ptr_alloc = psmi_malloc(ep, UNDEFINED, 53 | PSMI_PAGESIZE + sizeof(uintptr_t)*(bufnum+1)); 54 | if (ptr_alloc == NULL) 55 | return NULL; 56 | /* First pointer is to the actual allocated address, so we can free it but 57 | * buft[1] is first on the page boundary 58 | */ 59 | buft = (uintptr_t *) PSMI_ALIGNUP(ptr_alloc+1, PSMI_PAGESIZE); 60 | buft[-1] = (uintptr_t) ptr_alloc; 61 | for (i=0; i 35 | 36 | #if defined(__x86_64__) 37 | #define ipath_dwordcpy ipath_dwordcpy_safe 38 | #endif 39 | 40 | void ipath_dwordcpy(uint32_t *dest, const uint32_t *src, uint32_t ndwords) 41 | { 42 | uint_fast32_t ndw = ndwords; 43 | uint64_t *src64[4]; 44 | uint64_t *dst64[4]; 45 | src64[0] = (uint64_t *)src; 46 | dst64[0] = (uint64_t *)dest; 47 | 48 | while ( ndw >= 8 ) { 49 | *dst64[0] = *src64[0]; 50 | src64[1] = src64[0]+1; 51 | src64[2] = src64[0]+2; 52 | src64[3] = src64[0]+3; 53 | ndw -= 8; 54 | dst64[1] = dst64[0]+1; 55 | dst64[2] = dst64[0]+2; 56 | dst64[3] = dst64[0]+3; 57 | *dst64[1] = *src64[1]; 58 | *dst64[2] = *src64[2]; 59 | *dst64[3] = *src64[3]; 60 | src64[0] += 4; 61 | dst64[0] += 4; 62 | } 63 | if ( ndw ) { 64 | src = (uint32_t *)src64[0]; 65 | dest = (uint32_t *)dst64[0]; 66 | 67 | switch ( ndw ) { 68 | case 7: *dest++ = *src++; 69 | case 6: *dest++ = *src++; 70 | case 5: *dest++ = *src++; 71 | case 4: *dest++ = *src++; 72 | case 3: *dest++ = *src++; 73 | case 2: *dest++ = *src++; 74 | case 1: *dest++ = *src++; 75 | } 76 | 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /ipath/ipath_dwordcpy-ppc64.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2012. QLogic Corporation. All rights reserved. 3 | * Copyright (c) 2003-2006, PathScale, Inc. All rights reserved. 4 | * 5 | * This software is available to you under a choice of one of two 6 | * licenses. You may choose to be licensed under the terms of the GNU 7 | * General Public License (GPL) Version 2, available from the file 8 | * COPYING in the main directory of this source tree, or the 9 | * OpenIB.org BSD license below: 10 | * 11 | * Redistribution and use in source and binary forms, with or 12 | * without modification, are permitted provided that the following 13 | * conditions are met: 14 | * 15 | * - Redistributions of source code must retain the above 16 | * copyright notice, this list of conditions and the following 17 | * disclaimer. 18 | * 19 | * - Redistributions in binary form must reproduce the above 20 | * copyright notice, this list of conditions and the following 21 | * disclaimer in the documentation and/or other materials 22 | * provided with the distribution. 23 | * 24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 25 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 26 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 27 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 28 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 29 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 30 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | * SOFTWARE. 32 | */ 33 | 34 | #include 35 | 36 | #if defined(__x86_64__) 37 | #define ipath_dwordcpy ipath_dwordcpy_safe 38 | #endif 39 | 40 | void ipath_dwordcpy(uint32_t *dest, const uint32_t *src, uint32_t ndwords) 41 | { 42 | uint_fast32_t ndw = ndwords; 43 | uint64_t *src64[4]; 44 | uint64_t *dst64[4]; 45 | src64[0] = (uint64_t *)src; 46 | dst64[0] = (uint64_t *)dest; 47 | 48 | while ( ndw >= 8 ) { 49 | *dst64[0] = *src64[0]; 50 | src64[1] = src64[0]+1; 51 | src64[2] = src64[0]+2; 52 | src64[3] = src64[0]+3; 53 | ndw -= 8; 54 | dst64[1] = dst64[0]+1; 55 | dst64[2] = dst64[0]+2; 56 | dst64[3] = dst64[0]+3; 57 | *dst64[1] = *src64[1]; 58 | *dst64[2] = *src64[2]; 59 | *dst64[3] = *src64[3]; 60 | src64[0] += 4; 61 | dst64[0] += 4; 62 | } 63 | if ( ndw ) { 64 | src = (uint32_t *)src64[0]; 65 | dest = (uint32_t *)dst64[0]; 66 | 67 | switch ( ndw ) { 68 | case 7: *dest++ = *src++; 69 | case 6: *dest++ = *src++; 70 | case 5: *dest++ = *src++; 71 | case 4: *dest++ = *src++; 72 | case 3: *dest++ = *src++; 73 | case 2: *dest++ = *src++; 74 | case 1: *dest++ = *src++; 75 | } 76 | 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /ipath/ipath_dwordcpy-x86_64.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2012. QLogic Corporation. All rights reserved. 3 | * Copyright (c) 2003-2006, PathScale, Inc. All rights reserved. 4 | * 5 | * This software is available to you under a choice of one of two 6 | * licenses. You may choose to be licensed under the terms of the GNU 7 | * General Public License (GPL) Version 2, available from the file 8 | * COPYING in the main directory of this source tree, or the 9 | * OpenIB.org BSD license below: 10 | * 11 | * Redistribution and use in source and binary forms, with or 12 | * without modification, are permitted provided that the following 13 | * conditions are met: 14 | * 15 | * - Redistributions of source code must retain the above 16 | * copyright notice, this list of conditions and the following 17 | * disclaimer. 18 | * 19 | * - Redistributions in binary form must reproduce the above 20 | * copyright notice, this list of conditions and the following 21 | * disclaimer in the documentation and/or other materials 22 | * provided with the distribution. 23 | * 24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 25 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 26 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 27 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 28 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 29 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 30 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | * SOFTWARE. 32 | */ 33 | 34 | #include 35 | 36 | #if defined(__x86_64__) 37 | #define ipath_dwordcpy ipath_dwordcpy_safe 38 | #endif 39 | 40 | void ipath_dwordcpy(uint32_t *dest, const uint32_t *src, uint32_t ndwords) 41 | { 42 | uint_fast32_t ndw = ndwords; 43 | uint64_t *src64[4]; 44 | uint64_t *dst64[4]; 45 | src64[0] = (uint64_t *)src; 46 | dst64[0] = (uint64_t *)dest; 47 | 48 | while ( ndw >= 8 ) { 49 | *dst64[0] = *src64[0]; 50 | src64[1] = src64[0]+1; 51 | src64[2] = src64[0]+2; 52 | src64[3] = src64[0]+3; 53 | ndw -= 8; 54 | dst64[1] = dst64[0]+1; 55 | dst64[2] = dst64[0]+2; 56 | dst64[3] = dst64[0]+3; 57 | *dst64[1] = *src64[1]; 58 | *dst64[2] = *src64[2]; 59 | *dst64[3] = *src64[3]; 60 | src64[0] += 4; 61 | dst64[0] += 4; 62 | } 63 | if ( ndw ) { 64 | src = (uint32_t *)src64[0]; 65 | dest = (uint32_t *)dst64[0]; 66 | 67 | switch ( ndw ) { 68 | case 7: *dest++ = *src++; 69 | case 6: *dest++ = *src++; 70 | case 5: *dest++ = *src++; 71 | case 4: *dest++ = *src++; 72 | case 3: *dest++ = *src++; 73 | case 2: *dest++ = *src++; 74 | case 1: *dest++ = *src++; 75 | } 76 | 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /ipath/ipath_syslog.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013. Intel Corporation. All rights reserved. 3 | * Copyright (c) 2006-2012. QLogic Corporation. All rights reserved. 4 | * Copyright (c) 2003-2006, PathScale, Inc. All rights reserved. 5 | * 6 | * This software is available to you under a choice of one of two 7 | * licenses. You may choose to be licensed under the terms of the GNU 8 | * General Public License (GPL) Version 2, available from the file 9 | * COPYING in the main directory of this source tree, or the 10 | * OpenIB.org BSD license below: 11 | * 12 | * Redistribution and use in source and binary forms, with or 13 | * without modification, are permitted provided that the following 14 | * conditions are met: 15 | * 16 | * - Redistributions of source code must retain the above 17 | * copyright notice, this list of conditions and the following 18 | * disclaimer. 19 | * 20 | * - Redistributions in binary form must reproduce the above 21 | * copyright notice, this list of conditions and the following 22 | * disclaimer in the documentation and/or other materials 23 | * provided with the distribution. 24 | * 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | * SOFTWARE. 33 | */ 34 | 35 | #define __USE_GNU 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | 42 | #include "ipath_user.h" 43 | 44 | #define SYSLOG_MAXLEN 512 45 | 46 | extern char *__ipath_mylabel; 47 | 48 | void 49 | ipath_vsyslog(const char *prefix, int to_console, int level, 50 | const char *format, va_list ap) 51 | { 52 | char logprefix[SYSLOG_MAXLEN]; 53 | 54 | if (to_console) { 55 | char hostname[80]; 56 | va_list ap_cons; 57 | va_copy(ap_cons, ap); 58 | size_t len = strlen(format); 59 | gethostname(hostname, sizeof hostname); 60 | hostname[sizeof hostname - 1] = '\0'; 61 | 62 | if (__ipath_mylabel) 63 | fprintf(stderr, "%s", __ipath_mylabel); 64 | else 65 | fprintf(stderr, "%s: ", hostname); 66 | 67 | vfprintf(stderr, format, ap_cons); 68 | if (format[len] != '\n') 69 | fprintf(stderr, "\n"); 70 | fflush(stderr); 71 | va_end(ap_cons); 72 | } 73 | 74 | (void)snprintf(logprefix, sizeof(logprefix), 75 | "(ipath/%s)[%d]: %s", prefix ? prefix : "ipath", (int) getpid(), 76 | format); 77 | 78 | vsyslog(level | LOG_USER, logprefix, ap); 79 | 80 | return; 81 | } 82 | 83 | void 84 | ipath_syslog(const char *prefix, int to_console, int level, 85 | const char *format, ...) 86 | { 87 | va_list ap; 88 | va_start(ap, format); 89 | ipath_vsyslog(prefix, to_console, level, format, ap); 90 | va_end(ap); 91 | } 92 | 93 | -------------------------------------------------------------------------------- /ptl_ips/ips_epstate.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2012. QLogic Corporation. All rights reserved. 3 | * Copyright (c) 2003-2006, PathScale, Inc. All rights reserved. 4 | * 5 | * This software is available to you under a choice of one of two 6 | * licenses. You may choose to be licensed under the terms of the GNU 7 | * General Public License (GPL) Version 2, available from the file 8 | * COPYING in the main directory of this source tree, or the 9 | * OpenIB.org BSD license below: 10 | * 11 | * Redistribution and use in source and binary forms, with or 12 | * without modification, are permitted provided that the following 13 | * conditions are met: 14 | * 15 | * - Redistributions of source code must retain the above 16 | * copyright notice, this list of conditions and the following 17 | * disclaimer. 18 | * 19 | * - Redistributions in binary form must reproduce the above 20 | * copyright notice, this list of conditions and the following 21 | * disclaimer in the documentation and/or other materials 22 | * provided with the distribution. 23 | * 24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 25 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 26 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 27 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 28 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 29 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 30 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | * SOFTWARE. 32 | */ 33 | 34 | #ifndef _IPS_EPSTATE_H 35 | #define _IPS_EPSTATE_H 36 | 37 | #include "psm_user.h" 38 | 39 | typedef uint32_t ips_epstate_idx; 40 | #define IPS_EPSTATE_COMMIDX_MAX (1<<20) 41 | #define IPS_EPSTATE_COMMIDX_MASK 0xF0000 42 | #define IPS_EPSTATE_COMMIDX_SHIFT 14 43 | #define IPS_EPSTATE_COMMIDX_PACK(ipscommidx) \ 44 | ((ipscommidx & IPS_EPSTATE_COMMIDX_MASK) \ 45 | >> IPS_EPSTATE_COMMIDX_SHIFT) 46 | 47 | struct ptl_epaddr; 48 | 49 | struct ips_epstate_entry { 50 | uint64_t epid; 51 | struct ptl_epaddr *ipsaddr; 52 | }; 53 | 54 | struct ips_epstate { 55 | const psmi_context_t *context; 56 | ips_epstate_idx eps_base_idx; 57 | int eps_tabsize; 58 | int eps_tabsizeused; 59 | int eps_tab_nextidx; 60 | 61 | struct ips_epstate_entry *eps_tab; 62 | }; 63 | 64 | psm_error_t ips_epstate_init(struct ips_epstate *eps, const psmi_context_t *contextj); 65 | psm_error_t ips_epstate_fini(struct ips_epstate *eps); 66 | 67 | psm_error_t ips_epstate_add(struct ips_epstate *eps, 68 | struct ptl_epaddr *ipsaddr, 69 | ips_epstate_idx *commidx); 70 | psm_error_t ips_epstate_del(struct ips_epstate *eps, ips_epstate_idx commidx); 71 | 72 | PSMI_INLINE( 73 | struct ips_epstate_entry * 74 | ips_epstate_lookup(const struct ips_epstate *eps, ips_epstate_idx idx)) 75 | { 76 | idx = (idx + eps->eps_base_idx) & (IPS_EPSTATE_COMMIDX_MAX-1); 77 | if (idx < eps->eps_tabsize) 78 | return &eps->eps_tab[idx]; 79 | else 80 | return NULL; 81 | } 82 | 83 | #endif /* _IPS_EPSTATE_H */ 84 | -------------------------------------------------------------------------------- /ptl_ips/ips_subcontext.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2012. QLogic Corporation. All rights reserved. 3 | * Copyright (c) 2003-2006, PathScale, Inc. All rights reserved. 4 | * 5 | * This software is available to you under a choice of one of two 6 | * licenses. You may choose to be licensed under the terms of the GNU 7 | * General Public License (GPL) Version 2, available from the file 8 | * COPYING in the main directory of this source tree, or the 9 | * OpenIB.org BSD license below: 10 | * 11 | * Redistribution and use in source and binary forms, with or 12 | * without modification, are permitted provided that the following 13 | * conditions are met: 14 | * 15 | * - Redistributions of source code must retain the above 16 | * copyright notice, this list of conditions and the following 17 | * disclaimer. 18 | * 19 | * - Redistributions in binary form must reproduce the above 20 | * copyright notice, this list of conditions and the following 21 | * disclaimer in the documentation and/or other materials 22 | * provided with the distribution. 23 | * 24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 25 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 26 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 27 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 28 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 29 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 30 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | * SOFTWARE. 32 | */ 33 | 34 | #include "ips_subcontext.h" 35 | #include "ptl_ips.h" 36 | 37 | psm_error_t 38 | ips_subcontext_ureg_get(ptl_t *ptl, const psmi_context_t *context, 39 | struct ips_subcontext_ureg **uregp, 40 | uint32_t subcontext_cnt) 41 | { 42 | psm_error_t err = PSM_OK; 43 | const struct ipath_base_info *base_info = &context->base_info; 44 | uint64_t *all_subcontext_uregbase = (uint64_t *) (uintptr_t) 45 | base_info->spi_subctxt_uregbase; 46 | unsigned pagesize = getpagesize(); 47 | int i; 48 | psmi_assert_always(all_subcontext_uregbase != NULL); 49 | for (i = 0; i < INFINIPATH_MAX_SUBCONTEXT; i++) { 50 | struct ips_subcontext_ureg *subcontext_ureg = 51 | (struct ips_subcontext_ureg *) &all_subcontext_uregbase[_IPATH_UregMax*8]; 52 | *uregp++ = (i < subcontext_cnt) ? subcontext_ureg : NULL; 53 | all_subcontext_uregbase += pagesize / sizeof(uint64_t); 54 | } 55 | return err; 56 | } 57 | 58 | psm_error_t 59 | ips_subcontext_ureg_initialize(ptl_t *ptl, uint32_t subcontext, 60 | struct ips_subcontext_ureg *uregp) 61 | { 62 | psm_error_t err = PSM_OK; 63 | memset(uregp, 0, sizeof(*uregp)); 64 | if (subcontext == 0) { 65 | if (pthread_spin_init(&uregp->context_lock, 66 | PTHREAD_PROCESS_SHARED) != 0) { 67 | err = psmi_handle_error(ptl->ep, PSM_EP_DEVICE_FAILURE, 68 | "Couldn't initialize process-shared spin lock"); 69 | } 70 | } 71 | return err; 72 | } 73 | -------------------------------------------------------------------------------- /ptl_ips/ips_proto_internal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2012. QLogic Corporation. All rights reserved. 3 | * Copyright (c) 2003-2006, PathScale, Inc. All rights reserved. 4 | * 5 | * This software is available to you under a choice of one of two 6 | * licenses. You may choose to be licensed under the terms of the GNU 7 | * General Public License (GPL) Version 2, available from the file 8 | * COPYING in the main directory of this source tree, or the 9 | * OpenIB.org BSD license below: 10 | * 11 | * Redistribution and use in source and binary forms, with or 12 | * without modification, are permitted provided that the following 13 | * conditions are met: 14 | * 15 | * - Redistributions of source code must retain the above 16 | * copyright notice, this list of conditions and the following 17 | * disclaimer. 18 | * 19 | * - Redistributions in binary form must reproduce the above 20 | * copyright notice, this list of conditions and the following 21 | * disclaimer in the documentation and/or other materials 22 | * provided with the distribution. 23 | * 24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 25 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 26 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 27 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 28 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 29 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 30 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | * SOFTWARE. 32 | */ 33 | 34 | #ifndef _IPS_PROTO_INTERNAL_H 35 | #define _IPS_PROTO_INTERNAL_H 36 | 37 | #include "ips_proto_header.h" 38 | #include "ips_expected_proto.h" 39 | #include "ips_proto_help.h" 40 | 41 | /* 42 | * Connect protocol. 43 | * 44 | * On receive, handled by upcalling into the connect interface. 45 | * On send, handled by ips_proto by having connect compose the message. 46 | */ 47 | psm_error_t ips_proto_process_connect(struct ips_proto *proto, psm_epid_t epid, 48 | uint8_t opcode, 49 | struct ips_message_header *p_hdr, 50 | void *payload, uint32_t paylen); 51 | int ips_proto_build_connect_message(struct ips_proto *proto, 52 | struct ips_proto_ctrl_message *msg, 53 | ips_epaddr_t *ptladdr, uint8_t opcode, 54 | void *payload); 55 | 56 | psm_error_t ips_proto_timer_ack_callback(struct psmi_timer *, uint64_t); 57 | psm_error_t ips_proto_timer_send_callback(struct psmi_timer *, uint64_t); 58 | psm_error_t ips_proto_timer_ctrlq_callback(struct psmi_timer *, uint64_t); 59 | psm_error_t ips_proto_timer_pendq_callback(struct psmi_timer *, uint64_t); 60 | psm_error_t ips_cca_adjust_rate(ips_path_rec_t *path_rec, int cct_increment); 61 | psm_error_t ips_cca_timer_callback(struct psmi_timer *current_timer, uint64_t current); 62 | void 63 | ips_proto_rv_scbavail_callback(struct ips_scbctrl *scbc, void *context); 64 | 65 | psm_error_t ips_proto_recv_init(struct ips_proto *proto); 66 | psm_error_t ips_proto_recv_fini(struct ips_proto *proto); 67 | 68 | #define IPS_PROTO_MQ_CTS_MSGSIZE 64 69 | 70 | #endif /* _IPS_PROTO_INTERNAL_H */ 71 | -------------------------------------------------------------------------------- /ptl_ips/ips_spio.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2012. QLogic Corporation. All rights reserved. 3 | * Copyright (c) 2003-2006, PathScale, Inc. All rights reserved. 4 | * 5 | * This software is available to you under a choice of one of two 6 | * licenses. You may choose to be licensed under the terms of the GNU 7 | * General Public License (GPL) Version 2, available from the file 8 | * COPYING in the main directory of this source tree, or the 9 | * OpenIB.org BSD license below: 10 | * 11 | * Redistribution and use in source and binary forms, with or 12 | * without modification, are permitted provided that the following 13 | * conditions are met: 14 | * 15 | * - Redistributions of source code must retain the above 16 | * copyright notice, this list of conditions and the following 17 | * disclaimer. 18 | * 19 | * - Redistributions in binary form must reproduce the above 20 | * copyright notice, this list of conditions and the following 21 | * disclaimer in the documentation and/or other materials 22 | * provided with the distribution. 23 | * 24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 25 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 26 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 27 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 28 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 29 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 30 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | * SOFTWARE. 32 | */ 33 | 34 | #ifndef IPS_SPIO_H 35 | #define IPS_SPIO_H 36 | 37 | #include "psm_user.h" 38 | 39 | struct ips_spio; 40 | struct ptl; 41 | 42 | psm_error_t ips_spio_init(const psmi_context_t *context, 43 | const struct ptl *ptl, 44 | struct ips_spio *ctrl); 45 | psm_error_t ips_spio_transfer_frame(struct ips_spio *ctrl,struct ips_flow *flow, 46 | void *header, void *payload, int length, 47 | uint32_t isCtrlMsg, 48 | uint32_t cksum_valid, uint32_t cksum); 49 | psm_error_t ips_spio_fini(struct ips_spio *ctrl); 50 | 51 | struct ips_spio 52 | { 53 | const struct ptl *ptl; 54 | const psmi_context_t *context; 55 | uint32_t runtime_flags; 56 | int unit_id; 57 | uint16_t portnum; 58 | pthread_spinlock_t spio_lock; 59 | 60 | /* pio copy routine */ 61 | void (*spio_copy_fn)(volatile uint32_t *, 62 | const struct ipath_pio_params *pioparm, void *, void *); 63 | 64 | volatile __le64 *spio_avail_addr __attribute__((aligned(64))); 65 | volatile uint32_t *spio_buffer_base; 66 | volatile unsigned long *spio_sendbuf_status; 67 | 68 | uint32_t spio_buffer_spacing; 69 | uint32_t spio_first_buffer; 70 | uint32_t spio_last_buffer; 71 | uint32_t spio_current_buffer; 72 | uint32_t spio_num_of_buffer; 73 | 74 | uint64_t spio_avail_shadow[8] __attribute__((aligned(64))); 75 | 76 | uint32_t spio_consecutive_failures; 77 | uint64_t spio_num_stall; 78 | uint64_t spio_num_stall_total; 79 | uint64_t spio_next_stall_warning; 80 | uint64_t spio_last_stall_cyc; 81 | uint64_t spio_init_cyc; 82 | 83 | }; 84 | 85 | #endif /* IPS_SPIO_H */ 86 | -------------------------------------------------------------------------------- /psm_lock.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2012. QLogic Corporation. All rights reserved. 3 | * Copyright (c) 2003-2006, PathScale, Inc. All rights reserved. 4 | * 5 | * This software is available to you under a choice of one of two 6 | * licenses. You may choose to be licensed under the terms of the GNU 7 | * General Public License (GPL) Version 2, available from the file 8 | * COPYING in the main directory of this source tree, or the 9 | * OpenIB.org BSD license below: 10 | * 11 | * Redistribution and use in source and binary forms, with or 12 | * without modification, are permitted provided that the following 13 | * conditions are met: 14 | * 15 | * - Redistributions of source code must retain the above 16 | * copyright notice, this list of conditions and the following 17 | * disclaimer. 18 | * 19 | * - Redistributions in binary form must reproduce the above 20 | * copyright notice, this list of conditions and the following 21 | * disclaimer in the documentation and/or other materials 22 | * provided with the distribution. 23 | * 24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 25 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 26 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 27 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 28 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 29 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 30 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | * SOFTWARE. 32 | */ 33 | 34 | #ifndef _PSMI_IN_USER_H 35 | #error psm_lock.h not meant to be included directly, include psm_user.h instead 36 | #endif 37 | 38 | #ifndef _PSMI_LOCK_H 39 | #define _PSMI_LOCK_H 40 | 41 | #ifndef PSMI_USE_PTHREAD_SPINLOCKS 42 | #if defined(__powerpc__) 43 | #define PSMI_USE_PTHREAD_SPINLOCKS 1 44 | #else 45 | #define PSMI_USE_PTHREAD_SPINLOCKS 0 46 | #endif 47 | #endif 48 | 49 | #if PSMI_USE_PTHREAD_SPINLOCKS 50 | typedef pthread_spinlock_t psmi_spinlock_t; 51 | 52 | #define psmi_spin_init(lock) pthread_spin_init(lock,0) 53 | #define psmi_spin_lock(lock) pthread_spin_lock(lock) 54 | #define psmi_spin_trylock(lock) pthread_spin_trylock(lock) 55 | #define psmi_spin_unlock(lock) pthread_spin_unlock(lock) 56 | #else 57 | typedef ips_atomic_t psmi_spinlock_t; 58 | #define PSMI_SPIN_LOCKED 1 59 | #define PSMI_SPIN_UNLOCKED 0 60 | 61 | PSMI_ALWAYS_INLINE( 62 | int 63 | psmi_spin_init(psmi_spinlock_t *lock)) { 64 | ips_atomic_set(lock, PSMI_SPIN_UNLOCKED); 65 | return 0; 66 | } 67 | 68 | PSMI_ALWAYS_INLINE( 69 | int 70 | psmi_spin_trylock(psmi_spinlock_t *lock)) { 71 | if (ips_atomic_cmpxchg(lock,PSMI_SPIN_UNLOCKED,PSMI_SPIN_LOCKED) 72 | == PSMI_SPIN_UNLOCKED) 73 | return 0; 74 | else 75 | return EBUSY; 76 | } 77 | 78 | PSMI_ALWAYS_INLINE( 79 | int 80 | psmi_spin_lock(psmi_spinlock_t *lock)) { 81 | while (psmi_spin_trylock(lock) == EBUSY) 82 | {} 83 | return 0; 84 | } 85 | 86 | PSMI_ALWAYS_INLINE( 87 | int 88 | psmi_spin_unlock(psmi_spinlock_t *lock)) { 89 | atomic_set(lock, PSMI_SPIN_UNLOCKED); 90 | return 0; 91 | } 92 | #endif /* PSMI_USE_PTHREAD_SPINLOCKS */ 93 | 94 | #endif /* _PSMI_LOCK_H */ 95 | -------------------------------------------------------------------------------- /include/linux-ppc/sysdep.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2012. QLogic Corporation. All rights reserved. 3 | * Copyright (c) 2003-2006, PathScale, Inc. All rights reserved. 4 | * 5 | * This software is available to you under a choice of one of two 6 | * licenses. You may choose to be licensed under the terms of the GNU 7 | * General Public License (GPL) Version 2, available from the file 8 | * COPYING in the main directory of this source tree, or the 9 | * OpenIB.org BSD license below: 10 | * 11 | * Redistribution and use in source and binary forms, with or 12 | * without modification, are permitted provided that the following 13 | * conditions are met: 14 | * 15 | * - Redistributions of source code must retain the above 16 | * copyright notice, this list of conditions and the following 17 | * disclaimer. 18 | * 19 | * - Redistributions in binary form must reproduce the above 20 | * copyright notice, this list of conditions and the following 21 | * disclaimer in the documentation and/or other materials 22 | * provided with the distribution. 23 | * 24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 25 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 26 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 27 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 28 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 29 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 30 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | * SOFTWARE. 32 | */ 33 | 34 | #ifndef _IPATH_ppc64_SYSDEP_H 35 | #define _IPATH_ppc64_SYSDEP_H 36 | 37 | static __inline__ uint64_t get_cycles(void) 38 | { 39 | uint64_t v; 40 | 41 | #if __WORDSIZE == 64 42 | asm volatile("mftb %0" : "=r" (v) : ); 43 | #else 44 | uint32_t vu0, vu1, vl; 45 | do { 46 | asm volatile("mftbu %0" : "=r" (vu0) : ); 47 | asm volatile("mftb %0" : "=r" (vl) : ); 48 | asm volatile("mftbu %0" : "=r" (vu1) : ); 49 | } while ( vu0 != vu1 ); 50 | 51 | v = vu1; 52 | v <<= 32; 53 | v |= vl; 54 | #endif 55 | 56 | return v; 57 | } 58 | 59 | static __inline__ void ips_mb() 60 | { 61 | asm volatile ("sync" : : : "memory"); 62 | } 63 | 64 | static __inline__ void ips_rmb() 65 | { 66 | asm volatile ("lwsync" : : : "memory"); 67 | } 68 | 69 | static __inline__ void ips_wmb() 70 | { 71 | asm volatile ("eieio" : : : "memory"); 72 | } 73 | 74 | static __inline__ void ips_sync_writes() 75 | { 76 | asm volatile("lwsync" : : : "memory"); 77 | } 78 | 79 | static __inline__ void ips_sync_reads() 80 | { 81 | asm volatile("isync" : : : "memory"); 82 | } 83 | 84 | static __inline__ uint32_t ips_cmpxchg(volatile uint32_t *p, uint32_t old, 85 | uint32_t new) 86 | { 87 | uint32_t prev; 88 | 89 | __asm__ __volatile__ ("\n\ 90 | 1: lwarx %0,0,%2 \n\ 91 | cmpw 0,%0,%3 \n\ 92 | bne 2f \n\ 93 | stwcx. %4,0,%2 \n\ 94 | bne- 1b\n\ 95 | sync\n\ 96 | 2:" 97 | : "=&r" (prev), "=m" (*p) 98 | : "r" (p), "r" (old), "r" (new), "m" (*p) 99 | : "cc", "memory"); 100 | 101 | return prev; 102 | } 103 | 104 | #endif /* _IPATH_ppc64_SYSDEP_H */ 105 | -------------------------------------------------------------------------------- /ptl_am/kcopyrwu.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013. Intel Corporation. All rights reserved. 3 | * Copyright (c) 2006-2012. QLogic Corporation. All rights reserved. 4 | * Copyright (c) 2003-2006, PathScale, Inc. All rights reserved. 5 | * 6 | * This software is available to you under a choice of one of two 7 | * licenses. You may choose to be licensed under the terms of the GNU 8 | * General Public License (GPL) Version 2, available from the file 9 | * COPYING in the main directory of this source tree, or the 10 | * OpenIB.org BSD license below: 11 | * 12 | * Redistribution and use in source and binary forms, with or 13 | * without modification, are permitted provided that the following 14 | * conditions are met: 15 | * 16 | * - Redistributions of source code must retain the above 17 | * copyright notice, this list of conditions and the following 18 | * disclaimer. 19 | * 20 | * - Redistributions in binary form must reproduce the above 21 | * copyright notice, this list of conditions and the following 22 | * disclaimer in the documentation and/or other materials 23 | * provided with the distribution. 24 | * 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | * SOFTWARE. 33 | */ 34 | 35 | #include 36 | #include 37 | 38 | #include "kcopyrw.h" 39 | 40 | #define KCOPY_GET_SYSCALL 1 41 | #define KCOPY_PUT_SYSCALL 2 42 | #define KCOPY_ABI_SYSCALL 3 43 | 44 | struct kcopy_syscall { 45 | uint32_t tag; 46 | pid_t pid; 47 | uint64_t n; 48 | uint64_t src; 49 | uint64_t dst; 50 | }; 51 | 52 | int64_t kcopy_get(int fd, pid_t pid, const void *src, void *dst, int64_t n) { 53 | struct kcopy_syscall e = { 54 | .tag = KCOPY_GET_SYSCALL, 55 | .pid = pid, 56 | .n = n, 57 | .src = (uint64_t) (uintptr_t) src, 58 | .dst = (uint64_t) (uintptr_t) dst 59 | }; 60 | int64_t ret; 61 | 62 | ret = write(fd, &e, sizeof(e)); 63 | if (ret == sizeof(e)) 64 | ret = n; 65 | else if (ret > 0 && ret != sizeof(e)) 66 | ret = 0; 67 | 68 | return ret; 69 | } 70 | 71 | int64_t kcopy_put(int fd, const void *src, pid_t pid, void *dst, int64_t n) { 72 | struct kcopy_syscall e = { 73 | .tag = KCOPY_PUT_SYSCALL, 74 | .pid = pid, 75 | .n = n, 76 | .src = (uint64_t) (uintptr_t) src, 77 | .dst = (uint64_t) (uintptr_t) dst 78 | }; 79 | int64_t ret; 80 | 81 | ret = write(fd, &e, sizeof(e)); 82 | if (ret == sizeof(e)) 83 | ret = n; 84 | else if (ret > 0 && ret != sizeof(e)) 85 | ret = 0; 86 | 87 | return ret; 88 | } 89 | 90 | int kcopy_abi(int fd) { 91 | int32_t abi; 92 | struct kcopy_syscall e = { 93 | .tag = KCOPY_ABI_SYSCALL, 94 | .dst = (uint64_t) (uintptr_t) &abi 95 | }; 96 | int ret; 97 | 98 | ret = write(fd, &e, sizeof(e)); 99 | if (ret == sizeof(e)) 100 | ret = abi; 101 | else if (ret > 0 && ret != sizeof(e)) 102 | ret = 0; 103 | 104 | return ret; 105 | } 106 | -------------------------------------------------------------------------------- /psmd/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # 3 | # This file is provided under a dual BSD/GPLv2 license. When using or 4 | # redistributing this file, you may do so under either license. 5 | # 6 | # GPL LICENSE SUMMARY 7 | # 8 | # Copyright(c) 2012, 2017. Intel Corporation. 9 | # Copyright(c) 2005, 2006. QLogic Corporation. 10 | # 11 | # This program is free software; you can redistribute it and/or modify 12 | # it under the terms of version 2 of the GNU General Public License as 13 | # published by the Free Software Foundation. 14 | # 15 | # This program is distributed in the hope that it will be useful, but 16 | # WITHOUT ANY WARRANTY; without even the implied warranty of 17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 | # General Public License for more details. 19 | # 20 | # Contact Information: 21 | # Intel Corporation, www.intel.com 22 | # 23 | # BSD LICENSE 24 | # 25 | # Copyright(c) 2012, 2017. Intel Corporation. 26 | # Copyright(c) 2005, 2006. QLogic Corporation. 27 | # 28 | # Redistribution and use in source and binary forms, with or without 29 | # modification, are permitted provided that the following conditions 30 | # are met: 31 | # 32 | # * Redistributions of source code must retain the above copyright 33 | # notice, this list of conditions and the following disclaimer. 34 | # * Redistributions in binary form must reproduce the above copyright 35 | # notice, this list of conditions and the following disclaimer in 36 | # the documentation and/or other materials provided with the 37 | # distribution. 38 | # * Neither the name of Intel Corporation nor the names of its 39 | # contributors may be used to endorse or promote products derived 40 | # from this software without specific prior written permission. 41 | # 42 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 43 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 44 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 45 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 46 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 47 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 48 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 49 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 50 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 51 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 52 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 53 | # 54 | # 55 | 56 | include $(top_srcdir)/buildflags.mak 57 | CFLAGS += -Wall -Werror -D_IPATH_DEBUGGING=0 58 | LDFLAGS += $(SCIF_LINK_FLAGS) 59 | INCLUDES += -I$(top_srcdir)/include -I$(top_srcdir)/include/linux-x86_64 $(SCIF_INCLUDE_FLAGS) 60 | TARGETS = psmd 61 | 62 | all: ${TARGETS} 63 | 64 | ${TARGETS}-objs := psmd.o ipath_service.o ipath_sysfs.o 65 | 66 | ${TARGETS}: ${$(TARGETS)-objs} 67 | $(CC) -o $@ $(CFLAGS) $^ $(LDFLAGS) 68 | 69 | psmd.o: psmd.c 70 | $(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ 71 | 72 | ipath_service.o: $(top_srcdir)/ipath/ipath_service.c 73 | $(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ 74 | 75 | ipath_sysfs.o: $(top_srcdir)/ipath/ipath_sysfs.c 76 | $(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ 77 | 78 | install: 79 | install -D psmd ${DESTDIR}${INSTALL_SBIN_TARG}/psmd 80 | clean: 81 | rm -f *.o $(TARGETS) 82 | 83 | -------------------------------------------------------------------------------- /ptl_ips/ips_crc32.c: -------------------------------------------------------------------------------- 1 | /* The code in this file was derived from crc32.c in zlib 1.2.3, and 2 | modified from its original form to suit our requirements. The zlib 3 | license and crc32.c copyright and credits are preserved below. */ 4 | 5 | /* zlib.h -- interface of the 'zlib' general purpose compression library 6 | version 1.2.3, July 18th, 2005 7 | 8 | Copyright (C) 1995-2005 Jean-loup Gailly and Mark Adler 9 | 10 | This software is provided 'as-is', without any express or implied 11 | warranty. In no event will the authors be held liable for any damages 12 | arising from the use of this software. 13 | 14 | Permission is granted to anyone to use this software for any purpose, 15 | including commercial applications, and to alter it and redistribute it 16 | freely, subject to the following restrictions: 17 | 18 | 1. The origin of this software must not be misrepresented; you must not 19 | claim that you wrote the original software. If you use this software 20 | in a product, an acknowledgment in the product documentation would be 21 | appreciated but is not required. 22 | 2. Altered source versions must be plainly marked as such, and must not be 23 | misrepresented as being the original software. 24 | 3. This notice may not be removed or altered from any source distribution. 25 | 26 | Jean-loup Gailly Mark Adler 27 | jloup@gzip.org madler@alumni.caltech.edu 28 | 29 | The data format used by the zlib library is described by RFCs (Request for 30 | Comments) 1950 to 1952 in the files http://www.ietf.org/rfc/rfc1950.txt 31 | (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format). 32 | */ 33 | 34 | /* crc32.c -- compute the CRC-32 of a data stream 35 | * Copyright (C) 1995-2005 Mark Adler 36 | * For conditions of distribution and use, see copyright notice in zlib.h 37 | * 38 | * Thanks to Rodney Brown for his contribution of faster 39 | * CRC methods: exclusive-oring 32 bits of data at a time, and pre-computing 40 | * tables for updating the shift register in one step with three exclusive-ors 41 | * instead of four steps with four exclusive-ors. This results in about a 42 | * factor of two increase in speed on a Power PC G4 (PPC7455) using gcc -O3. 43 | */ 44 | 45 | #include "ips_proto.h" 46 | #include "ips_proto_internal.h" 47 | 48 | /* Table of CRCs of all 8-bit messages. */ 49 | static uint32_t crc_table[256]; 50 | 51 | /* Flag: has the table been computed? Initially false. */ 52 | static int crc_table_computed = 0; 53 | 54 | /* Make the table for a fast CRC. */ 55 | static void make_crc_table(void) 56 | { 57 | uint32_t c; 58 | int n, k; 59 | 60 | for (n = 0; n < 256; n++) { 61 | c = (uint32_t) n; 62 | for (k = 0; k < 8; k++) { 63 | if (c & 1) 64 | c = 0xedb88320 ^ (c >> 1); 65 | else 66 | c = c >> 1; 67 | } 68 | crc_table[n] = c; 69 | } 70 | crc_table_computed = 1; 71 | } 72 | 73 | /* Update a running CRC with the bytes buf[0..len-1]--the CRC 74 | * should be initialized to all 1's, and the transmitted value 75 | * is the 1's complement of the final running CRC (see the 76 | * crc() routine below)). 77 | */ 78 | 79 | uint32_t ips_crc_calculate(uint32_t len, uint8_t *data, uint32_t crc) 80 | { 81 | uint32_t c = crc; 82 | uint32_t n; 83 | 84 | if (!crc_table_computed) { 85 | make_crc_table(); 86 | } 87 | for (n = 0; n < len; n++) { 88 | c = crc_table[(c ^ data[n]) & 0xff] ^ (c >> 8); 89 | } 90 | return c; 91 | } 92 | -------------------------------------------------------------------------------- /ptl_ips/ips_tid.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2012. QLogic Corporation. All rights reserved. 3 | * Copyright (c) 2003-2006, PathScale, Inc. All rights reserved. 4 | * 5 | * This software is available to you under a choice of one of two 6 | * licenses. You may choose to be licensed under the terms of the GNU 7 | * General Public License (GPL) Version 2, available from the file 8 | * COPYING in the main directory of this source tree, or the 9 | * OpenIB.org BSD license below: 10 | * 11 | * Redistribution and use in source and binary forms, with or 12 | * without modification, are permitted provided that the following 13 | * conditions are met: 14 | * 15 | * - Redistributions of source code must retain the above 16 | * copyright notice, this list of conditions and the following 17 | * disclaimer. 18 | * 19 | * - Redistributions in binary form must reproduce the above 20 | * copyright notice, this list of conditions and the following 21 | * disclaimer in the documentation and/or other materials 22 | * provided with the distribution. 23 | * 24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 25 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 26 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 27 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 28 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 29 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 30 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | * SOFTWARE. 32 | */ 33 | 34 | /* included header files */ 35 | 36 | #ifndef _IPS_TID_H 37 | #define _IPS_TID_H 38 | 39 | #include "psm_user.h" 40 | 41 | #define IPS_TID_MAX_TIDS 512 42 | #define IPS_TID_ALIGNMENT 4 43 | 44 | typedef uint64_t ips_tidmap_t[IPS_TID_MAX_TIDS/64]; 45 | 46 | struct ips_tid { 47 | const psmi_context_t *context; 48 | 49 | uint32_t tid_num_max; 50 | uint32_t tid_num_avail; 51 | uint32_t tid_pagesz; 52 | 53 | uint64_t tid_num_total; 54 | }; 55 | 56 | psm_error_t ips_tid_init(struct ips_tid *tidc, const psmi_context_t *context); 57 | psm_error_t ips_tid_fini(struct ips_tid *tidc); 58 | 59 | /* Acquiring tids. 60 | * Buffer base has to be aligned on ips_tid_page_size() boundary 61 | * Buffer base+length has to be aligned on IPS_TID_ALIGNMENT boundary 62 | */ 63 | psm_error_t 64 | ips_tid_acquire(struct ips_tid *tidc, 65 | const void *buf, /* input buffer, aligned to page_size */ 66 | int ntids, /* input number of tids */ 67 | ips_tidmap_t tidmap, /* output tidmap */ 68 | uint16_t *tid_array); /* output tidarray, */ 69 | 70 | psm_error_t 71 | ips_tid_release(struct ips_tid *tidc, 72 | ips_tidmap_t tidmap, /* input tidmap */ 73 | int ntids); /* intput number of tids to release */ 74 | PSMI_INLINE( 75 | psm_error_t 76 | ips_tid_num_available(struct ips_tid *tidc)) 77 | { 78 | return tidc->tid_num_avail; 79 | } 80 | 81 | PSMI_INLINE( 82 | int 83 | ips_tid_num_required(struct ips_tid *tidc, void *bufi, uint32_t length)) 84 | { 85 | uintptr_t buf = (uintptr_t) bufi; 86 | const uint32_t page_size = tidc->tid_pagesz; 87 | 88 | return (PSMI_ALIGNUP(buf + length, page_size) - 89 | PSMI_ALIGNDOWN(buf, page_size)) / page_size; 90 | } 91 | 92 | PSMI_INLINE( 93 | uint32_t 94 | ips_tid_page_size(struct ips_tid *tidc)) 95 | { 96 | return tidc->tid_pagesz; 97 | } 98 | 99 | #endif /* _IPS_TID_H */ 100 | -------------------------------------------------------------------------------- /ptl_ips/ips_recvq.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2012. QLogic Corporation. All rights reserved. 3 | * Copyright (c) 2003-2006, PathScale, Inc. All rights reserved. 4 | * 5 | * This software is available to you under a choice of one of two 6 | * licenses. You may choose to be licensed under the terms of the GNU 7 | * General Public License (GPL) Version 2, available from the file 8 | * COPYING in the main directory of this source tree, or the 9 | * OpenIB.org BSD license below: 10 | * 11 | * Redistribution and use in source and binary forms, with or 12 | * without modification, are permitted provided that the following 13 | * conditions are met: 14 | * 15 | * - Redistributions of source code must retain the above 16 | * copyright notice, this list of conditions and the following 17 | * disclaimer. 18 | * 19 | * - Redistributions in binary form must reproduce the above 20 | * copyright notice, this list of conditions and the following 21 | * disclaimer in the documentation and/or other materials 22 | * provided with the distribution. 23 | * 24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 25 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 26 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 27 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 28 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 29 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 30 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | * SOFTWARE. 32 | */ 33 | 34 | #ifndef _IPS_RECVQ_H 35 | #define _IPS_RECVQ_H 36 | 37 | #include "psm_user.h" 38 | 39 | struct ips_recvq_params { 40 | volatile __le32 *tail_register; /* location of tail */ 41 | volatile __le32 *head_register; /* location of head */ 42 | uint32_t *base_addr; /* base address of q */ 43 | uint32_t elemsz; /* size of q elements (in words) */ 44 | uint32_t elemcnt; /* num of q elements (in words) */ 45 | }; 46 | 47 | /* 48 | * Tables to map eager indexes into their buffer addresses 49 | * 50 | * If function returns NULL, no memory has been allocated and the error handler 51 | * has been executed on 'ep' and hence assume status PSM_NO_MEMORY. 52 | */ 53 | void **ips_recvq_egrbuf_table_alloc(psm_ep_t ep, 54 | void *base, uint32_t chunksize, 55 | uint32_t bufnum, uint32_t bufsize); 56 | void ips_recvq_egrbuf_table_free(void **buftable); 57 | 58 | /* 59 | * Accessor inlines for reading and writing to hdrq/egrq registers 60 | */ 61 | PSMI_ALWAYS_INLINE( 62 | void *ips_recvq_egr_index_2_ptr(void **egrq_buftable, int index)) 63 | { 64 | return egrq_buftable[index]; 65 | } 66 | 67 | PSMI_INLINE( 68 | void ips_recvq_head_update(const struct ips_recvq_params *recvq, uint32_t newhead)) 69 | { 70 | *recvq->head_register = __cpu_to_le32(newhead); 71 | return; 72 | } 73 | 74 | PSMI_INLINE( 75 | uint32_t ips_recvq_head_get(const struct ips_recvq_params *recvq)) 76 | { 77 | uint32_t res = __le32_to_cpu(*recvq->head_register); 78 | ips_rmb(); 79 | return res; 80 | } 81 | 82 | PSMI_INLINE( 83 | void ips_recvq_tail_update(const struct ips_recvq_params *recvq, uint32_t newtail)) 84 | { 85 | *recvq->tail_register = __cpu_to_le32(newtail); 86 | return; 87 | } 88 | 89 | PSMI_INLINE( 90 | uint32_t ips_recvq_tail_get(const struct ips_recvq_params *recvq)) 91 | { 92 | uint32_t res = __le32_to_cpu(*recvq->tail_register); 93 | ips_rmb(); 94 | return res; 95 | } 96 | 97 | #endif /* _IPS_RECVQ_H */ 98 | -------------------------------------------------------------------------------- /include/ipath_intf.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013. Intel Corporation. All rights reserved. 3 | * Copyright (c) 2006-2012. QLogic Corporation. All rights reserved. 4 | * Copyright (c) 2003-2006, PathScale, Inc. All rights reserved. 5 | * 6 | * This software is available to you under a choice of one of two 7 | * licenses. You may choose to be licensed under the terms of the GNU 8 | * General Public License (GPL) Version 2, available from the file 9 | * COPYING in the main directory of this source tree, or the 10 | * OpenIB.org BSD license below: 11 | * 12 | * Redistribution and use in source and binary forms, with or 13 | * without modification, are permitted provided that the following 14 | * conditions are met: 15 | * 16 | * - Redistributions of source code must retain the above 17 | * copyright notice, this list of conditions and the following 18 | * disclaimer. 19 | * 20 | * - Redistributions in binary form must reproduce the above 21 | * copyright notice, this list of conditions and the following 22 | * disclaimer in the documentation and/or other materials 23 | * provided with the distribution. 24 | * 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | * SOFTWARE. 33 | */ 34 | 35 | #ifndef _IPATH_INTF_H 36 | #define _IPATH_INTF_H 37 | 38 | #include 39 | #include 40 | #include 41 | 42 | #ifdef __inline__ 43 | #undef __inline__ 44 | #endif 45 | #define __inline__ inline __attribute__((always_inline,unused)) 46 | #ifdef __unused__ 47 | #undef __unused__ 48 | #endif 49 | #define __unused__ __attribute__((unused)) 50 | 51 | #include "sysdep.h" 52 | #include "bit_ops.h" 53 | 54 | /* these aren't implemented for user mode, which is OK until we multi-thread */ 55 | typedef struct _atomic { 56 | uint32_t counter; 57 | } atomic_t; /* no atomic_t type in user-land */ 58 | #define atomic_set(a,v) ((a)->counter = (v)) 59 | #define atomic_inc_return(a) (++(a)->counter) 60 | 61 | #if defined(__PATHCC__) && __PATHCC__ < 3 62 | #define likely(x) (x) 63 | #define unlikely(x) (x) 64 | #define if_pt(cond) if (cond) 65 | #define if_pf(cond) if (cond) 66 | #define _Pragma_unlikely _Pragma("mips_frequency_hint never") 67 | #define _Pragma_likely _Pragma("mips_frequency_hint frequent") 68 | #elif defined(__GNUC__) || (defined(__PATHCC__) && __PATHCC__ >= 3) 69 | #define likely(x) __builtin_expect(!!(x), 1L) 70 | #define unlikely(x) __builtin_expect(!!(x), 0L) 71 | #define if_pt(cond) if (likely(cond)) 72 | #define if_pf(cond) if (unlikely(cond)) 73 | #define _Pragma_unlikely 74 | #define _Pragma_likely 75 | #else 76 | #error "Unsupported compiler" 77 | #endif 78 | 79 | #define yield() sched_yield() 80 | 81 | /* 82 | * __fastpath is used to group routines in the fastpath, to reduce cache 83 | * misses and conflicts 84 | */ 85 | #define __fastpath __attribute__((section(".text.fastpath"))) 86 | 87 | /* 88 | * Move from using __fastpath to split __recvpath and __sendpath 89 | */ 90 | //#define __sendpath __attribute__((section(".text.sendpath"))) 91 | //#define __recvpath __attribute__((section(".text.recvpath"))) 92 | #define __sendpath __fastpath 93 | #define __recvpath __fastpath 94 | 95 | #endif /* _IPATH_INTF_H */ 96 | -------------------------------------------------------------------------------- /psm_context.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2012. QLogic Corporation. All rights reserved. 3 | * Copyright (c) 2003-2006, PathScale, Inc. All rights reserved. 4 | * 5 | * This software is available to you under a choice of one of two 6 | * licenses. You may choose to be licensed under the terms of the GNU 7 | * General Public License (GPL) Version 2, available from the file 8 | * COPYING in the main directory of this source tree, or the 9 | * OpenIB.org BSD license below: 10 | * 11 | * Redistribution and use in source and binary forms, with or 12 | * without modification, are permitted provided that the following 13 | * conditions are met: 14 | * 15 | * - Redistributions of source code must retain the above 16 | * copyright notice, this list of conditions and the following 17 | * disclaimer. 18 | * 19 | * - Redistributions in binary form must reproduce the above 20 | * copyright notice, this list of conditions and the following 21 | * disclaimer in the documentation and/or other materials 22 | * provided with the distribution. 23 | * 24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 25 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 26 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 27 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 28 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 29 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 30 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | * SOFTWARE. 32 | */ 33 | 34 | #ifndef _PSMI_IN_USER_H 35 | #error psm_context.h not meant to be included directly, include psm_user.h instead 36 | #endif 37 | 38 | #ifndef _PSM_CONTEXT_H 39 | #define _PSM_CONTEXT_H 40 | 41 | typedef 42 | struct psmi_context { 43 | int fd; /* driver fd */ 44 | struct _ipath_ctrl *ctrl; /* driver opaque ipath_proto */ 45 | psm_ep_t ep; /* psm ep handle */ 46 | psm_epid_t epid; /* psm integral ep id */ 47 | struct ipath_user_info user_info; 48 | struct ipath_base_info base_info; 49 | uint32_t runtime_flags; 50 | uint32_t rcvthread_flags; 51 | volatile uint64_t *spi_status; 52 | psm_error_t spi_status_lasterr; 53 | } 54 | psmi_context_t; 55 | 56 | psm_error_t 57 | psmi_context_open(const psm_ep_t ep, long unit_id, long port, 58 | psm_uuid_t const job_key, 59 | int64_t timeout_ns, psmi_context_t *context); 60 | 61 | psm_error_t 62 | psmi_context_close(psmi_context_t *context); 63 | 64 | /* Check status of context */ 65 | psm_error_t psmi_context_check_status(const psmi_context_t *context); 66 | 67 | psm_error_t psmi_context_interrupt_set(psmi_context_t *context, int enable); 68 | int psmi_context_interrupt_isenabled(psmi_context_t *context); 69 | 70 | int psmi_sharedcontext_params(int *nranks, int *rankid); 71 | /* Runtime flags describe what features are enabled in hw/sw and which 72 | * corresponding PSM features are being used. 73 | * 74 | * Hi 16 bits are PSM options 75 | * Lo 16 bits are IPATH_RUNTIME options copied from (ipath_common.h) 76 | */ 77 | #define PSMI_RUNTIME_RCVTHREAD 0x80000000 78 | #define PSMI_RUNTIME_INTR_ENABLED 0x40000000 79 | #define PSMI_RUNTIME_LOCKHDRQ PSMI_RUNTIME_RCVTHREAD /* alias */ 80 | /* Update _PSMI_RUNTIME_LAST to be the lowest runtime flag */ 81 | #define _PSMI_RUNTIME_LAST PSMI_RUNTIME_INTR_ENABLED 82 | 83 | /* 84 | * The receive thread can be initialized with optional behaviour. 85 | * 86 | * Note: Currently there is no optional behaviour. 87 | */ 88 | #define PSMI_RCVTHREAD_FLAG_ENABLED 0x1 89 | 90 | 91 | #endif /* PSM_CONTEXT_H */ 92 | -------------------------------------------------------------------------------- /ptl_am/am_reqrep.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013. Intel Corporation. All rights reserved. 3 | * Copyright (c) 2006-2012. QLogic Corporation. All rights reserved. 4 | * Copyright (c) 2003-2006, PathScale, Inc. All rights reserved. 5 | * 6 | * This software is available to you under a choice of one of two 7 | * licenses. You may choose to be licensed under the terms of the GNU 8 | * General Public License (GPL) Version 2, available from the file 9 | * COPYING in the main directory of this source tree, or the 10 | * OpenIB.org BSD license below: 11 | * 12 | * Redistribution and use in source and binary forms, with or 13 | * without modification, are permitted provided that the following 14 | * conditions are met: 15 | * 16 | * - Redistributions of source code must retain the above 17 | * copyright notice, this list of conditions and the following 18 | * disclaimer. 19 | * 20 | * - Redistributions in binary form must reproduce the above 21 | * copyright notice, this list of conditions and the following 22 | * disclaimer in the documentation and/or other materials 23 | * provided with the distribution. 24 | * 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | * SOFTWARE. 33 | */ 34 | 35 | #include "psm_user.h" 36 | #include "psm_am.h" 37 | #include "psm_mq_internal.h" 38 | #include "psm_am_internal.h" 39 | 40 | psm_error_t 41 | psmi_amsh_am_short_request(psm_epaddr_t epaddr, 42 | psm_handler_t handler, psm_amarg_t *args, int nargs, 43 | void *src, size_t len, int flags, 44 | psm_am_completion_fn_t completion_fn, 45 | void *completion_ctxt) 46 | { 47 | psm_amarg_t req_args[NSHORT_ARGS] = {}; 48 | 49 | /* All sends are synchronous. Ignore PSM_AM_FLAG_ASYNC. 50 | * TODO: Treat PSM_AM_FLAG_NOREPLY as "advisory". This was mainly 51 | * used to optimize the IPS path though we could put a stricter interpretation 52 | * on it to disallow any replies. 53 | */ 54 | 55 | /* For now less than NSHORT_ARGS-1. We use the first arg to carry the handler 56 | * index. 57 | */ 58 | psmi_assert(nargs < (NSHORT_ARGS - 1)); 59 | req_args[0].u32w0 = (uint32_t) handler; 60 | psmi_mq_mtucpy((void*) &req_args[1], (const void*) args, 61 | (nargs * sizeof(psm_amarg_t))); 62 | psmi_amsh_short_request(epaddr->ptl, epaddr, am_handler_hidx, 63 | req_args, nargs + 1, 64 | src, len, 0); 65 | 66 | if (completion_fn) 67 | completion_fn(completion_ctxt); 68 | 69 | return PSM_OK; 70 | } 71 | 72 | psm_error_t 73 | psmi_amsh_am_short_reply(psm_am_token_t tok, 74 | psm_handler_t handler, psm_amarg_t *args, int nargs, 75 | void *src, size_t len, int flags, 76 | psm_am_completion_fn_t completion_fn, 77 | void *completion_ctxt) 78 | { 79 | psm_amarg_t rep_args[NSHORT_ARGS] = {}; 80 | 81 | /* For now less than NSHORT_ARGS-1. We use the first arg to carry the handler 82 | * index. 83 | */ 84 | psmi_assert(nargs < (NSHORT_ARGS - 1)); 85 | rep_args[0].u32w0 = (uint32_t) handler; 86 | psmi_mq_mtucpy((void*) &rep_args[1], (const void*) args, 87 | (nargs * sizeof(psm_amarg_t))); 88 | 89 | psmi_amsh_short_reply((amsh_am_token_t*) tok, am_handler_hidx, rep_args, nargs+1, src, len, 0); 90 | 91 | if (completion_fn) 92 | completion_fn(completion_ctxt); 93 | 94 | return PSM_OK; 95 | } 96 | 97 | -------------------------------------------------------------------------------- /ptl_ips/ips_writehdrq.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2012. QLogic Corporation. All rights reserved. 3 | * Copyright (c) 2003-2006, PathScale, Inc. All rights reserved. 4 | * 5 | * This software is available to you under a choice of one of two 6 | * licenses. You may choose to be licensed under the terms of the GNU 7 | * General Public License (GPL) Version 2, available from the file 8 | * COPYING in the main directory of this source tree, or the 9 | * OpenIB.org BSD license below: 10 | * 11 | * Redistribution and use in source and binary forms, with or 12 | * without modification, are permitted provided that the following 13 | * conditions are met: 14 | * 15 | * - Redistributions of source code must retain the above 16 | * copyright notice, this list of conditions and the following 17 | * disclaimer. 18 | * 19 | * - Redistributions in binary form must reproduce the above 20 | * copyright notice, this list of conditions and the following 21 | * disclaimer in the documentation and/or other materials 22 | * provided with the distribution. 23 | * 24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 25 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 26 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 27 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 28 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 29 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 30 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | * SOFTWARE. 32 | */ 33 | 34 | #include "ips_writehdrq.h" 35 | 36 | psm_error_t 37 | ips_writehdrq_init(const psmi_context_t *context, 38 | const struct ips_recvq_params *hdrq_params, 39 | const struct ips_recvq_params *egrq_params, 40 | struct ips_writehdrq *writeq, 41 | struct ips_writehdrq_state *state, 42 | uint32_t runtime_flags) 43 | { 44 | const struct ipath_base_info *base_info = &context->base_info; 45 | memset(writeq, 0, sizeof(*writeq)); 46 | writeq->context = context; 47 | writeq->state = state; 48 | writeq->hdrq = *hdrq_params; /* deep copy */ 49 | writeq->hdrq_elemlast = ((writeq->hdrq.elemcnt - 1) * writeq->hdrq.elemsz); 50 | writeq->egrq = *egrq_params; /* deep copy */ 51 | writeq->egrq_buftable = 52 | ips_recvq_egrbuf_table_alloc(context->ep, writeq->egrq.base_addr, 53 | base_info->spi_rcv_egrchunksize, 54 | writeq->egrq.elemcnt, 55 | writeq->egrq.elemsz); 56 | writeq->runtime_flags = runtime_flags; 57 | writeq->hdrq_rhf_off = base_info->spi_rhf_offset; 58 | if (writeq->runtime_flags & IPATH_RUNTIME_NODMA_RTAIL) { 59 | writeq->state->hdrq_rhf_seq = 1; 60 | /* 61 | * We don't allow readers to see the RHF until the writer can 62 | * atomically write an updated RHF. 63 | */ 64 | writeq->hdrq_hdr_copysz = (writeq->hdrq.elemsz - 2) * sizeof(uint32_t); 65 | /* 66 | * Ensure 8-byte alignment of the RHF by looking at RHF of the second 67 | * header, which is required for atomic RHF updates. 68 | */ 69 | psmi_assert_always( 70 | !((uintptr_t)(writeq->hdrq.base_addr + 71 | writeq->hdrq.elemsz + writeq->hdrq_rhf_off) & 0x7)); 72 | } 73 | else { 74 | writeq->hdrq_hdr_copysz = writeq->hdrq.elemsz * sizeof(uint32_t); 75 | writeq->state->hdrq_rhf_seq = 0; /* _seq is ignored */ 76 | } 77 | writeq->state->enabled = 1; 78 | return PSM_OK; 79 | } 80 | 81 | psm_error_t 82 | ips_writehdrq_fini(struct ips_writehdrq *writeq) 83 | { 84 | ips_recvq_egrbuf_table_free(writeq->egrq_buftable); 85 | return PSM_OK; 86 | } 87 | -------------------------------------------------------------------------------- /include/ipath_debug.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2012. QLogic Corporation. All rights reserved. 3 | * Copyright (c) 2003-2006, PathScale, Inc. All rights reserved. 4 | * 5 | * This software is available to you under a choice of one of two 6 | * licenses. You may choose to be licensed under the terms of the GNU 7 | * General Public License (GPL) Version 2, available from the file 8 | * COPYING in the main directory of this source tree, or the 9 | * OpenIB.org BSD license below: 10 | * 11 | * Redistribution and use in source and binary forms, with or 12 | * without modification, are permitted provided that the following 13 | * conditions are met: 14 | * 15 | * - Redistributions of source code must retain the above 16 | * copyright notice, this list of conditions and the following 17 | * disclaimer. 18 | * 19 | * - Redistributions in binary form must reproduce the above 20 | * copyright notice, this list of conditions and the following 21 | * disclaimer in the documentation and/or other materials 22 | * provided with the distribution. 23 | * 24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 25 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 26 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 27 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 28 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 29 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 30 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | * SOFTWARE. 32 | */ 33 | 34 | #ifndef _IPATH_DEBUG_H 35 | #define _IPATH_DEBUG_H 36 | 37 | #ifndef _IPATH_DEBUGGING /* debugging enabled or not */ 38 | #define _IPATH_DEBUGGING 1 39 | #endif 40 | 41 | #if _IPATH_DEBUGGING 42 | 43 | /* 44 | * Mask values for debugging. The scheme allows us to compile out any 45 | * of the debug tracing stuff, and if compiled in, to enable or disable 46 | * dynamically. This can be set at modprobe time also: 47 | * modprobe infinipath.ko infinipath_debug=7 48 | */ 49 | 50 | #define __IPATH_INFO 0x1 /* generic low verbosity stuff */ 51 | #define __IPATH_DBG 0x2 /* generic debug */ 52 | #define __IPATH_TRSAMPLE 0x8 /* generate trace buffer sample entries */ 53 | /* leave some low verbosity spots open */ 54 | #define __IPATH_VERBDBG 0x40 /* very verbose debug */ 55 | #define __IPATH_PKTDBG 0x80 /* print packet data */ 56 | /* print process startup (init)/exit messages and important env vars */ 57 | #define __IPATH_PROCDBG 0x100 58 | /* print mmap/nopage stuff, not using VDBG any more */ 59 | #define __IPATH_MMDBG 0x200 60 | /* low-level environment variables */ 61 | #define __IPATH_ENVDBG 0x400 62 | #define __IPATH_EPKTDBG 0x800 /* print error packet data */ 63 | #define __IPATH_CCADBG 0x1000 /* print CCA related events */ 64 | #else /* _IPATH_DEBUGGING */ 65 | 66 | /* 67 | * define all of these even with debugging off, for the few places that do 68 | * if(infinipath_debug & _IPATH_xyzzy), but in a way that will make the 69 | * compiler eliminate the code 70 | */ 71 | 72 | #define __IPATH_INFO 0x0 /* generic low verbosity stuff */ 73 | #define __IPATH_DBG 0x0 /* generic debug */ 74 | #define __IPATH_TRSAMPLE 0x0 /* generate trace buffer sample entries */ 75 | #define __IPATH_VERBDBG 0x0 /* very verbose debug */ 76 | #define __IPATH_PKTDBG 0x0 /* print packet data */ 77 | #define __IPATH_PROCDBG 0x0 /* print process startup (init)/exit messages */ 78 | /* print mmap/nopage stuff, not using VDBG any more */ 79 | #define __IPATH_MMDBG 0x0 80 | #define __IPATH_CCADBG 0x0 /* print CCA related events */ 81 | 82 | #endif /* _IPATH_DEBUGGING */ 83 | 84 | #define __IPATH_VERBOSEDBG __IPATH_VERBDBG 85 | 86 | #endif /* _IPATH_DEBUG_H */ 87 | -------------------------------------------------------------------------------- /ptl_am/scifrwu.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013. Intel Corporation. All rights reserved. 3 | * Copyright (c) 2010. QLogic Corporation. All rights reserved. 4 | * 5 | * This software is available to you under a choice of one of two 6 | * licenses. You may choose to be licensed under the terms of the GNU 7 | * General Public License (GPL) Version 2, available from the file 8 | * COPYING in the main directory of this source tree, or the 9 | * OpenIB.org BSD license below: 10 | * 11 | * Redistribution and use in source and binary forms, with or 12 | * without modification, are permitted provided that the following 13 | * conditions are met: 14 | * 15 | * - Redistributions of source code must retain the above 16 | * copyright notice, this list of conditions and the following 17 | * disclaimer. 18 | * 19 | * - Redistributions in binary form must reproduce the above 20 | * copyright notice, this list of conditions and the following 21 | * disclaimer in the documentation and/or other materials 22 | * provided with the distribution. 23 | * 24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 25 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 26 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 27 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 28 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 29 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 30 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | * SOFTWARE. 32 | */ 33 | 34 | #include 35 | #include 36 | #include 37 | #include 38 | 39 | #include "psm_user.h" 40 | #include "psm_mq_internal.h" 41 | #include "psm_am_internal.h" 42 | #include "scifrw.h" 43 | 44 | #if defined(PSM_HAVE_SCIF) 45 | int scif_register_region(scif_epd_t epd, void* addr, size_t len, off_t* offset) 46 | { 47 | /* SCIF requires registrations on page granularity. The address must be 48 | rounded down to a page boundary, and the length must be rounded up. */ 49 | off_t addr_offset = (off_t)addr & 0xFFF; 50 | uintptr_t reg_addr = (uintptr_t)addr & ~0xFFF; 51 | size_t reg_len = len + addr_offset; 52 | 53 | if(reg_len & 0xFFF) { 54 | reg_len += 0x1000 - (reg_len & 0xFFF); 55 | } 56 | 57 | off_t reg = scif_register(epd, (void*)reg_addr, reg_len, 0, 58 | SCIF_PROT_READ|SCIF_PROT_WRITE, 0); 59 | 60 | if(reg == SCIF_REGISTER_FAILED) { 61 | _IPATH_INFO("SCIF: Registering memory %p (%p) length %ld (%ld) epd %d failed: (%d) %s\n", 62 | addr, (void*)reg_addr, len, reg_len, epd, 63 | errno, strerror(errno)); 64 | 65 | *offset = SCIF_REGISTER_FAILED; 66 | return PSM_INTERNAL_ERR; 67 | } 68 | 69 | /* Although the registration is rounded out to whole pages, return the 70 | exact SCIF-space registration offset for the specified address. */ 71 | *offset = reg + addr_offset; 72 | return PSM_OK; 73 | } 74 | 75 | int scif_unregister_region(scif_epd_t epd, off_t reg, size_t len) 76 | { 77 | /* SCIF requires registrations on page granularity. The address must be 78 | rounded down to a page boundary, and the length must be rounded up. */ 79 | off_t reg_addr = reg & ~0xFFF; 80 | size_t reg_len = len + ((size_t)reg & 0xFFF); 81 | 82 | if(reg_len & 0xFFF) { 83 | reg_len += 0x1000 - (reg_len & 0xFFF); 84 | } 85 | 86 | if(scif_unregister(epd, reg_addr, reg_len)) { 87 | _IPATH_INFO("SCIF: Unregistering offset %lx (%lx) length %ld (%ld) epd %d failed: (%d) %s\n", 88 | reg, reg_addr, len, reg_len, epd, 89 | errno, strerror(errno)); 90 | return PSM_INTERNAL_ERR; 91 | } 92 | 93 | return PSM_OK; 94 | } 95 | 96 | #endif /* defined(PSM_USE_SCIF) */ 97 | 98 | -------------------------------------------------------------------------------- /libuuid/uuid.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Public include file for the UUID library 4 | * 5 | * Copyright (C) 1996, 1997, 1998 Theodore Ts'o. 6 | * 7 | * %Begin-Header% 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions 10 | * are met: 11 | * 1. Redistributions of source code must retain the above copyright 12 | * notice, and the entire permission notice in its entirety, 13 | * including the disclaimer of warranties. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 3. The name of the author may not be used to endorse or promote 18 | * products derived from this software without specific prior 19 | * written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED 22 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF 24 | * WHICH ARE HEREBY DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE 25 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 27 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 28 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 29 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 31 | * USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH 32 | * DAMAGE. 33 | * %End-Header% 34 | */ 35 | 36 | #ifndef _UUID_UUID_H 37 | #define _UUID_UUID_H 38 | 39 | #include 40 | #include 41 | #include 42 | 43 | typedef unsigned char uuid_t[16]; 44 | 45 | /* UUID Variant definitions */ 46 | #define UUID_VARIANT_NCS 0 47 | #define UUID_VARIANT_DCE 1 48 | #define UUID_VARIANT_MICROSOFT 2 49 | #define UUID_VARIANT_OTHER 3 50 | 51 | /* UUID Type definitions */ 52 | #define UUID_TYPE_DCE_TIME 1 53 | #define UUID_TYPE_DCE_RANDOM 4 54 | 55 | /* Allow UUID constants to be defined */ 56 | #ifdef __GNUC__ 57 | #define UUID_DEFINE(name,u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15) \ 58 | static const uuid_t name __attribute__ ((unused)) = {u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15} 59 | #else 60 | #define UUID_DEFINE(name,u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15) \ 61 | static const uuid_t name = {u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,u10,u11,u12,u13,u14,u15} 62 | #endif 63 | 64 | #ifdef PSM_UUID 65 | #define UUID_STATIC static 66 | #else 67 | #define UUID_STATIC 68 | #endif 69 | 70 | #ifdef __cplusplus 71 | extern "C" { 72 | #endif 73 | 74 | /* gen_uuid.c */ 75 | UUID_STATIC void uuid_generate(uuid_t out); 76 | UUID_STATIC void uuid_generate_random(uuid_t out); 77 | UUID_STATIC void uuid_generate_time(uuid_t out); 78 | 79 | /* clear.c */ 80 | UUID_STATIC void uuid_clear(uuid_t uu); 81 | 82 | /* compare.c */ 83 | UUID_STATIC int uuid_compare(const uuid_t uu1, const uuid_t uu2); 84 | 85 | /* copy.c */ 86 | UUID_STATIC void uuid_copy(uuid_t dst, const uuid_t src); 87 | 88 | /* isnull.c */ 89 | UUID_STATIC int uuid_is_null(const uuid_t uu); 90 | 91 | /* parse.c */ 92 | UUID_STATIC int uuid_parse(const char *in, uuid_t uu); 93 | 94 | /* unparse.c */ 95 | UUID_STATIC void uuid_unparse(const uuid_t uu, char *out); 96 | UUID_STATIC void uuid_unparse_lower(const uuid_t uu, char *out); 97 | UUID_STATIC void uuid_unparse_upper(const uuid_t uu, char *out); 98 | 99 | /* uuid_time.c */ 100 | UUID_STATIC time_t uuid_time(const uuid_t uu, struct timeval *ret_tv); 101 | UUID_STATIC int uuid_type(const uuid_t uu); 102 | UUID_STATIC int uuid_variant(const uuid_t uu); 103 | 104 | #ifdef __cplusplus 105 | } 106 | #endif 107 | 108 | #endif /* _UUID_UUID_H */ 109 | -------------------------------------------------------------------------------- /psm_stats.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013. Intel Corporation. All rights reserved. 3 | * Copyright (c) 2006-2012. QLogic Corporation. All rights reserved. 4 | * Copyright (c) 2003-2006, PathScale, Inc. All rights reserved. 5 | * 6 | * This software is available to you under a choice of one of two 7 | * licenses. You may choose to be licensed under the terms of the GNU 8 | * General Public License (GPL) Version 2, available from the file 9 | * COPYING in the main directory of this source tree, or the 10 | * OpenIB.org BSD license below: 11 | * 12 | * Redistribution and use in source and binary forms, with or 13 | * without modification, are permitted provided that the following 14 | * conditions are met: 15 | * 16 | * - Redistributions of source code must retain the above 17 | * copyright notice, this list of conditions and the following 18 | * disclaimer. 19 | * 20 | * - Redistributions in binary form must reproduce the above 21 | * copyright notice, this list of conditions and the following 22 | * disclaimer in the documentation and/or other materials 23 | * provided with the distribution. 24 | * 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | * SOFTWARE. 33 | */ 34 | 35 | #ifndef _PSMI_IN_USER_H 36 | #error psm_stats.h not meant to be included directly, include psm_user.h instead 37 | #endif 38 | 39 | #ifndef _PSM_STATS_H 40 | #define _PSM_STATS_H 41 | 42 | #include "mpspawn_stats.h" 43 | 44 | #define PSMI_STATSTYPE_MQ 0x00001 45 | #define PSMI_STATSTYPE_RCVTHREAD 0x00100 /* num_wakups, ratio, etc. */ 46 | #define PSMI_STATSTYPE_IPSPROTO 0x00200 /* acks,naks,err_chks */ 47 | #define PSMI_STATSTYPE_TIDS 0x00400 48 | #define PSMI_STATSTYPE_MEMORY 0x01000 49 | #define PSMI_STATSTYPE_IPATH (PSMI_STATSTYPE_RCVTHREAD| \ 50 | PSMI_STATSTYPE_IPSPROTO | \ 51 | PSMI_STATSTYPE_MEMORY | \ 52 | PSMI_STATSTYPE_TIDS) 53 | #define PSMI_STATSTYPE_P2P 0x00800 /* ep-to-ep details */ 54 | #define PSMI_STATSTYPE_DEVCOUNTERS 0x10000 55 | #define PSMI_STATSTYPE_DEVSTATS 0x20000 56 | #define PSMI_STATSTYPE_ALL 0xfffff 57 | #define _PSMI_STATSTYPE_DEVMASK 0xf0000 58 | 59 | /* Used to determine how many stats in static array decl. */ 60 | #define PSMI_STATS_HOWMANY(entries) \ 61 | (sizeof(entries)/sizeof(entries[0])) 62 | 63 | #define PSMI_STATS_NO_HEADING NULL 64 | 65 | #define PSMI_STATS_DECL(_desc,_flags,_getfn,_val) \ 66 | { .desc = _desc, \ 67 | .flags = _flags, \ 68 | .getfn = _getfn, \ 69 | .u.val = _val, \ 70 | } 71 | 72 | #define PSMI_STATS_DECLU64(_desc,_val) \ 73 | PSMI_STATS_DECL(_desc, \ 74 | MPSPAWN_STATS_REDUCTION_ALL | MPSPAWN_STATS_SKIP_IF_ZERO, \ 75 | NULL, \ 76 | _val) 77 | 78 | struct psmi_stats_entry { 79 | const char *desc; 80 | uint16_t flags; 81 | uint64_t (*getfn)(void *context); /* optional fn ptr to get value */ 82 | union { 83 | uint64_t *val; /* where value is stored if getfn is NULL */ 84 | uint64_t off; /* of offset if that makes more sense */ 85 | } u; 86 | }; 87 | 88 | /* 89 | * Copy the array of entries and keep track of the context 90 | */ 91 | psm_error_t 92 | psmi_stats_register_type(const char *heading, 93 | uint32_t statstype, 94 | const struct psmi_stats_entry *entries, 95 | int num_entries, 96 | void *context); 97 | 98 | psm_error_t 99 | psmi_stats_deregister_all(void); 100 | 101 | #endif /* PSM_STATS_H */ 102 | -------------------------------------------------------------------------------- /ptl_ips/ips_tid.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2012. QLogic Corporation. All rights reserved. 3 | * Copyright (c) 2003-2006, PathScale, Inc. All rights reserved. 4 | * 5 | * This software is available to you under a choice of one of two 6 | * licenses. You may choose to be licensed under the terms of the GNU 7 | * General Public License (GPL) Version 2, available from the file 8 | * COPYING in the main directory of this source tree, or the 9 | * OpenIB.org BSD license below: 10 | * 11 | * Redistribution and use in source and binary forms, with or 12 | * without modification, are permitted provided that the following 13 | * conditions are met: 14 | * 15 | * - Redistributions of source code must retain the above 16 | * copyright notice, this list of conditions and the following 17 | * disclaimer. 18 | * 19 | * - Redistributions in binary form must reproduce the above 20 | * copyright notice, this list of conditions and the following 21 | * disclaimer in the documentation and/or other materials 22 | * provided with the distribution. 23 | * 24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 25 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 26 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 27 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 28 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 29 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 30 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | * SOFTWARE. 32 | */ 33 | 34 | #include "ips_tid.h" 35 | 36 | psm_error_t ips_ptl_handle_check_unit_status(psm_ep_t ep, int ips_rc); 37 | 38 | psm_error_t 39 | ips_tid_init(struct ips_tid *tidc, const psmi_context_t *context) 40 | { 41 | const struct ipath_base_info *base_info = &context->base_info; 42 | struct psmi_stats_entry entries[] = { 43 | PSMI_STATS_DECL("tid update count", MPSPAWN_STATS_REDUCTION_ALL, 44 | NULL, &tidc->tid_num_total), 45 | }; 46 | 47 | tidc->context = context; 48 | tidc->tid_num_max = base_info->spi_tidcnt; 49 | tidc->tid_num_avail = base_info->spi_tidcnt; 50 | tidc->tid_pagesz = base_info->spi_tid_maxsize; 51 | 52 | tidc->tid_num_total = 0; 53 | 54 | return psmi_stats_register_type(PSMI_STATS_NO_HEADING, 55 | PSMI_STATSTYPE_TIDS, 56 | entries, 57 | PSMI_STATS_HOWMANY(entries), 58 | tidc); 59 | } 60 | 61 | psm_error_t 62 | ips_tid_fini(struct ips_tid *tidc) 63 | { 64 | return PSM_OK; 65 | } 66 | 67 | psm_error_t 68 | ips_tid_acquire(struct ips_tid *tidc, const void *buf, 69 | int ntids, ips_tidmap_t tid_map, 70 | uint16_t *tid_array) 71 | { 72 | psm_error_t err = PSM_OK; 73 | int rc; 74 | 75 | psmi_assert((uintptr_t)buf % tidc->tid_pagesz == 0); 76 | psmi_assert(ntids <= tidc->tid_num_avail); 77 | 78 | rc = ipath_update_tid(tidc->context->ctrl, ntids, 79 | (uint64_t)(uintptr_t) tid_array, 80 | (uint64_t)(uintptr_t) buf, 81 | (uint64_t)(uintptr_t) tid_map); 82 | 83 | if (rc != 0) { 84 | /* We're still going to fail but check unit status */ 85 | err = psmi_err_only(psmi_context_check_status(tidc->context)); 86 | if (err == PSM_OK) /* okay, but something else is still wrong */ 87 | err = psmi_handle_error(tidc->context->ep, PSM_EP_DEVICE_FAILURE, 88 | "Failed to update %d tids", 89 | ntids); 90 | goto fail; 91 | } 92 | 93 | tidc->tid_num_total += ntids; 94 | tidc->tid_num_avail -= ntids; 95 | 96 | fail: 97 | return err; 98 | } 99 | 100 | psm_error_t 101 | ips_tid_release(struct ips_tid *tidc, ips_tidmap_t tidmap, int ntids) 102 | { 103 | psm_error_t err = PSM_OK; 104 | 105 | if (ipath_free_tid(tidc->context->ctrl, ntids, 106 | (uint64_t) (uintptr_t) tidmap)) { 107 | err = PSM_EP_DEVICE_FAILURE; 108 | goto fail; 109 | } 110 | 111 | tidc->tid_num_avail += ntids; 112 | 113 | fail: 114 | return err; 115 | } 116 | 117 | -------------------------------------------------------------------------------- /ipath/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2012. Intel Corporation. All rights reserved. 2 | # Copyright (c) 2006-2010. QLogic Corporation. All rights reserved. 3 | # Copyright (c) 2003-2006, PathScale, Inc. All rights reserved. 4 | # 5 | # This software is available to you under a choice of one of two 6 | # licenses. You may choose to be licensed under the terms of the GNU 7 | # General Public License (GPL) Version 2, available from the file 8 | # COPYING in the main directory of this source tree, or the 9 | # OpenIB.org BSD license below: 10 | # 11 | # Redistribution and use in source and binary forms, with or 12 | # without modification, are permitted provided that the following 13 | # conditions are met: 14 | # 15 | # - Redistributions of source code must retain the above 16 | # copyright notice, this list of conditions and the following 17 | # disclaimer. 18 | # 19 | # - Redistributions in binary form must reproduce the above 20 | # copyright notice, this list of conditions and the following 21 | # disclaimer in the documentation and/or other materials 22 | # provided with the distribution. 23 | # 24 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 25 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 26 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 27 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 28 | # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 29 | # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 30 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | # SOFTWARE. 32 | # 33 | 34 | TARGLIB := libinfinipath 35 | MAJOR := $(IPATH_LIB_MAJOR) 36 | MINOR := $(IPATH_LIB_MINOR) 37 | 38 | include $(top_srcdir)/buildflags.mak 39 | BASECFLAGS += -D_GNU_SOURCE 40 | INCLUDES += -I$(top_srcdir)/ptl_ips 41 | 42 | ifeq (${arch},x86_64) 43 | PLATFORM_OBJ=ipath_dwordcpy-x86_64-fast.o 44 | else 45 | PLATFORM_OBJ= 46 | endif 47 | 48 | ${TARGLIB}-objs := ipath_debug.o ipath_time.o ipath_proto.o \ 49 | ipath_utils.o ipath_service.o ipath_protomic.o \ 50 | ipath_dwordcpy-$(arch).o ipath_i2cflash.o ipath_sysfs.o ipath_syslog.o \ 51 | ipath_write_pio-$(arch).o $(PLATFORM_OBJ) 52 | 53 | all .DEFAULT: ${TARGLIB}.so 54 | 55 | install: all 56 | install -D ${TARGLIB}.so.${MAJOR}.${MINOR} \ 57 | ${DESTDIR}${INSTALL_LIB_TARG}/${TARGLIB}.so.${MAJOR}.${MINOR} 58 | (cd ${DESTDIR}${INSTALL_LIB_TARG} ; \ 59 | ln -sf ${TARGLIB}.so.${MAJOR}.${MINOR} ${TARGLIB}.so.${MAJOR} ; \ 60 | ln -sf ${TARGLIB}.so.${MAJOR} ${TARGLIB}.so) 61 | 62 | ${TARGLIB}.so: ${TARGLIB}.so.${MAJOR} 63 | ln -fs ${TARGLIB}.so.${MAJOR}.${MINOR} $@ 64 | 65 | ${TARGLIB}.so.${MAJOR}: ${TARGLIB}.so.${MAJOR}.${MINOR} 66 | ln -fs ${TARGLIB}.so.${MAJOR}.${MINOR} $@ 67 | 68 | # when we build the shared library, generate a revision and date 69 | # string in it, for easier id'ing when people may have copied the 70 | # file around. Generate it such that the ident command can find it 71 | # and strings -a | grep InfiniPath does a reasonable job as well. 72 | ${TARGLIB}.so.${MAJOR}.${MINOR}: ${${TARGLIB}-objs} 73 | date +'static __attribute__ ((unused)) char __psc_infinipath_revision[] ="$$""Date: %F %R ${rpm_extra_description}InfiniPath $$";' > _revision.c 74 | $(CC) -c $(BASECFLAGS) $(INCLUDES) _revision.c -o _revision.o 75 | $(CC) -o $@ -Wl,-soname=${TARGLIB}.so.${MAJOR} -shared \ 76 | -Wl,--unique='*fastpath*' \ 77 | ${${TARGLIB}-objs} _revision.o $(LDFLAGS) $(if $(MIC:0=),$(SCIF_LINK_FLAGS)) 78 | 79 | %.o: %.c 80 | $(CC) $(CFLAGS) $(INCLUDES) $(if $(MIC:0=),$(SCIF_INCLUDE_FLAGS)) -c $< -o $@ 81 | 82 | %.o: %.S 83 | $(CC) $(ASFLAGS) -c $< -o $@ 84 | 85 | ipath_debug.o: WERROR := 86 | # This is temporarily necessary in order to get backtrace to work. Bug 3536 87 | ipath_debug.o: ipath_debug.c 88 | $(CC) $(BASECFLAGS) $(INCLUDES) -c $< -o $@ 89 | 90 | ipath_write_pio-ppc.o: ipath_write_pio-ppc.c 91 | $(CC) $(CFLAGS) -maltivec $(INCLUDES) -c $< -o $@ 92 | 93 | ipath_write_pio-ppc64.o: ipath_write_pio-ppc64.c 94 | $(CC) $(CFLAGS) -maltivec $(INCLUDES) -c $< -o $@ 95 | 96 | clean: 97 | rm -f _revision.c 98 | rm -f *.o ${TARGLIB}.* 99 | -------------------------------------------------------------------------------- /ptl_ips/ipserror.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2012. QLogic Corporation. All rights reserved. 3 | * Copyright (c) 2003-2006, PathScale, Inc. All rights reserved. 4 | * 5 | * This software is available to you under a choice of one of two 6 | * licenses. You may choose to be licensed under the terms of the GNU 7 | * General Public License (GPL) Version 2, available from the file 8 | * COPYING in the main directory of this source tree, or the 9 | * OpenIB.org BSD license below: 10 | * 11 | * Redistribution and use in source and binary forms, with or 12 | * without modification, are permitted provided that the following 13 | * conditions are met: 14 | * 15 | * - Redistributions of source code must retain the above 16 | * copyright notice, this list of conditions and the following 17 | * disclaimer. 18 | * 19 | * - Redistributions in binary form must reproduce the above 20 | * copyright notice, this list of conditions and the following 21 | * disclaimer in the documentation and/or other materials 22 | * provided with the distribution. 23 | * 24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 25 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 26 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 27 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 28 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 29 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 30 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | * SOFTWARE. 32 | */ 33 | 34 | /* 35 | * interface to InfiniPath Interconnect Protocol Stack 36 | * 37 | * This file contains the function prototypes of the interconnect protocol 38 | * stack. It should be included in all the clients of the stack, such as MPI. 39 | */ 40 | 41 | #ifndef ipserror_h 42 | #define ipserror_h 43 | 44 | #ifdef __cplusplus 45 | extern "C" { 46 | #endif 47 | 48 | /* Return codes */ 49 | #define IPS_RC_OK 0 50 | #define IPS_RC_ERROR (-1) 51 | #define IPS_RC_PENDING (-2) 52 | #define IPS_RC_EXIST (-3) 53 | #define IPS_RC_MAX_ENTRIES_EXCEEDED (-4) 54 | #define IPS_RC_NOT_ENOUGH_BUFFERS (-100) 55 | #define IPS_RC_NO_FREE_MEM (-101) 56 | #define IPS_RC_NAME_LOOKUP_FAILED (-102) 57 | #define IPS_RC_PARAM_ERROR (-103) 58 | #define IPS_RC_UNKNOWN_DEVICE (-104) 59 | #define IPS_RC_DEVICE_INIT_FAILED (-105) 60 | #define IPS_RC_DATA_TRUNCATED (-106) 61 | #define IPS_RC_INVALID_RANK (-107) 62 | #define IPS_RC_INVALID_OPCODE (-108) 63 | #define IPS_RC_PEER_NOT_READY (-109) 64 | #define IPS_RC_PEER_CLOSED (-110) 65 | #define IPS_RC_DEST_EQUAL_LOCAL_RANK (-111) 66 | #define IPS_RC_DEVICE_ERROR (-112) 67 | #define IPS_RC_NETWORK_DOWN (-113) 68 | #define IPS_RC_NOT_ENOUGH_FREE_TIDS (-114) 69 | #define IPS_RC_NO_RESOURCE_AVAILABLE (-115) 70 | #define IPS_RC_HW_UPDATE_FAILED (-116) 71 | #define IPS_RC_PARTITION_ERROR (-117) 72 | #define IPS_RC_RUN_ERROR (-118) 73 | #define IPS_RC_ALREADY_OPEN (-119) 74 | #define IPS_RC_WAS_CLOSED (-120) 75 | #define IPS_RC_DEST_EQUAL_LOCAL_LID (-121) 76 | #define IPS_RC_BUFFER_ALIGMENT_ERROR (-122) 77 | #define IPS_RC_LENGTH_ALIGMENT_ERROR (-123) 78 | #define IPS_RC_INVALID_DATA_LENGTH (-124) 79 | #define IPS_RC_BUSY (-125) 80 | #define IPS_RC_INIT_TIMEOUT_EXPIRED (-126) 81 | #define IPS_RC_NO_PORTS_AVAILABLE (-127) 82 | #define IPS_RC_TRANSFER_INCOMPLETE (-128) 83 | #define IPS_RC_SYSERR (-129) // errno has meaning, if no further errors since this error 84 | #define IPS_RC_STARTUP_ERR (-130) 85 | 86 | /* Performance Counters Error Codes */ 87 | #define IPS_RCPERF_INIT_FAILED (-200) 88 | #define IPS_RCPERF_EVENT_SETUP_FAILED (-201) 89 | #define IPS_RCPERF_REG_DEFAULT_SET (-202) 90 | #define IPS_RCPERF_UNSUPPORTED_CPU (-203) 91 | #define IPS_RCPERF_REG_GET_FAILED (-204) 92 | #define IPS_RCPERF_SET_EVENT_STR_FAILED (-205) 93 | #define IPS_RCPERF_INVALID_REGISTER (-206) 94 | 95 | char *ips_err_str(int); 96 | 97 | #ifdef __cplusplus 98 | } /* extern "C" */ 99 | #endif 100 | #endif 101 | -------------------------------------------------------------------------------- /intel-mic-psm-card.spec.in: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2012. Intel Corporation. All rights reserved. 2 | # 3 | # This software is available to you under a choice of one of two 4 | # licenses. You may choose to be licensed under the terms of the GNU 5 | # General Public License (GPL) Version 2, available from the file 6 | # COPYING in the main directory of this source tree, or the 7 | # OpenIB.org BSD license below: 8 | # 9 | # Redistribution and use in source and binary forms, with or 10 | # without modification, are permitted provided that the following 11 | # conditions are met: 12 | # 13 | # - Redistributions of source code must retain the above 14 | # copyright notice, this list of conditions and the following 15 | # disclaimer. 16 | # 17 | # - Redistributions in binary form must reproduce the above 18 | # copyright notice, this list of conditions and the following 19 | # disclaimer in the documentation and/or other materials 20 | # provided with the distribution. 21 | # 22 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 24 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 25 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 26 | # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 27 | # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 28 | # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 29 | # SOFTWARE. 30 | # 31 | 32 | %define debug_package ${nil} 33 | %{!?install_prefix:%define install_prefix /usr} 34 | 35 | Summary: Intel PSM Libraries for Intel Xeon Phi 36 | Name: intel-mic-psm-card 37 | Version: @VERSION@ 38 | Release: @RELEASE@ 39 | License: GPL 40 | Group: System Environment/Damon 41 | URL: http://www.intel.com/ 42 | Source0: %{name}-%{version}-%{release}.tar.gz 43 | Prefix: /usr 44 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root 45 | Requires(post): /sbin/ldconfig 46 | Requires(postun): /sbin/ldconfig 47 | @REQUIRES@ 48 | 49 | %package devel 50 | Summary: Development files for Intel Xeon Phi 51 | Group: System Environment/Development 52 | Requires: %{name} = %{version}-%{release} 53 | Requires(post): /sbin/ldconfig 54 | Requires(postun): /sbin/ldconfig 55 | 56 | %description 57 | The PSM Messaging API, or PSM API, is Intel's low-level 58 | user-level communications interface for the True Scale 59 | family of products. PSM users are enabled with mechanisms 60 | necessary to implement higher level communications 61 | interfaces in parallel environments. 62 | 63 | %description devel 64 | Development files for libpsm_infinipath library 65 | 66 | %prep 67 | %setup -q -n %{name}-%{version}-%{release} 68 | 69 | %build 70 | %{__make} 71 | 72 | %install 73 | rm -rf $RPM_BUILD_ROOT 74 | mkdir -p $RPM_BUILD_ROOT 75 | %{make_install} 76 | %if %(test "%{install_prefix}" = "/usr" && echo 0 || echo 1) 77 | cp -a mic/* $RPM_BUILD_ROOT 78 | find $RPM_BUILD_ROOT/ -name "*.in" -exec rm -f {} \; 79 | %endif 80 | 81 | %clean 82 | rm -rf $RPM_BUILD_ROOT 83 | 84 | %post -p /sbin/ldconfig 85 | %postun -p /sbin/ldconfig 86 | %post devel -p /sbin/ldconfig 87 | %postun devel -p /sbin/ldconfig 88 | 89 | %files 90 | %defattr(-,root,root,-) 91 | %{install_prefix}/lib64/libpsm_infinipath.so.* 92 | %{install_prefix}/lib64/libinfinipath.so.* 93 | %if %(test "%{install_prefix}" = "/usr" && echo 0 || echo 1) 94 | %{install_prefix}/psm.filelist 95 | %{_sysconfdir}/sysconfig/mic/conf.d/psm.conf 96 | %endif 97 | 98 | %files devel 99 | %defattr(-,root,root,-) 100 | %{install_prefix}/lib64/libpsm_infinipath.so 101 | %{install_prefix}/lib64/libinfinipath.so 102 | 103 | %changelog 104 | * Thu Apr 11 2013 Mitko Haralanov 105 | - Remove any unwanted files before packaging 106 | * Wed Nov 28 2012 Mitko Haralanov 107 | - Add Xeon Phi devel package 108 | * Thu Nov 9 2012 Mitko Haralanov 109 | - Add TMI to package 110 | * Mon Nov 5 2012 Mitko Haralanov 111 | - Initial build. 112 | 113 | -------------------------------------------------------------------------------- /include/linux-i386/sysdep.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2012. QLogic Corporation. All rights reserved. 3 | * Copyright (c) 2003-2006, PathScale, Inc. All rights reserved. 4 | * 5 | * This software is available to you under a choice of one of two 6 | * licenses. You may choose to be licensed under the terms of the GNU 7 | * General Public License (GPL) Version 2, available from the file 8 | * COPYING in the main directory of this source tree, or the 9 | * OpenIB.org BSD license below: 10 | * 11 | * Redistribution and use in source and binary forms, with or 12 | * without modification, are permitted provided that the following 13 | * conditions are met: 14 | * 15 | * - Redistributions of source code must retain the above 16 | * copyright notice, this list of conditions and the following 17 | * disclaimer. 18 | * 19 | * - Redistributions in binary form must reproduce the above 20 | * copyright notice, this list of conditions and the following 21 | * disclaimer in the documentation and/or other materials 22 | * provided with the distribution. 23 | * 24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 25 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 26 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 27 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 28 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 29 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 30 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | * SOFTWARE. 32 | */ 33 | 34 | #ifndef _IPATH_i386_SYSDEP_H 35 | #define _IPATH_i386_SYSDEP_H 36 | 37 | static __inline__ uint64_t get_cycles(void) 38 | { 39 | uint64_t v; 40 | uint32_t a,d; 41 | 42 | asm volatile("rdtsc" : "=a" (a), "=d" (d)); 43 | v = ((uint64_t)a) | (((uint64_t)d)<<32); 44 | 45 | return v; 46 | } 47 | 48 | #ifndef LOCK_PREFIX 49 | #define LOCK_PREFIX "lock " 50 | #endif 51 | 52 | static __inline__ void ips_mb() 53 | { 54 | #ifdef __MIC__ 55 | asm volatile("lock; addl $0,0(%%rsp)" ::: "memory"); 56 | #else 57 | asm volatile("mfence" : : : "memory"); 58 | #endif 59 | } 60 | 61 | /* gcc-3.4 has a bug with this function body at -O0 */ 62 | static 63 | #if defined(__GNUC__) && !defined(__PATHCC__) && __GNUC__==3 && __GNUC_MINOR__==4 64 | #else 65 | __inline__ 66 | #endif 67 | void ips_rmb() 68 | { 69 | #ifdef __MIC__ 70 | asm volatile("lock; addl $0,0(%%rsp)" ::: "memory"); 71 | #else 72 | asm volatile("" : : : "memory"); 73 | #endif 74 | } 75 | 76 | static __inline__ void ips_wmb() 77 | { 78 | #ifdef __MIC__ 79 | asm volatile("lock; addl $0,0(%%rsp)" ::: "memory"); 80 | #else 81 | asm volatile("sfence" : : : "memory"); 82 | #endif 83 | } 84 | 85 | static __inline__ void ips_sync_writes() 86 | { 87 | #ifdef __MIC__ 88 | asm volatile("lock; addl $0,0(%%rsp)" ::: "memory"); 89 | #else 90 | asm volatile("sfence" : : : "memory"); 91 | #endif 92 | } 93 | 94 | static __inline__ void ips_sync_reads() 95 | { 96 | #ifdef __MIC__ 97 | asm volatile("lock; addl $0,0(%%rsp)" ::: "memory"); 98 | #else 99 | asm volatile("lfence" : : : "memory"); 100 | #endif 101 | } 102 | 103 | static __inline__ uint32_t ips_cmpxchg(volatile uint32_t *ptr, 104 | uint32_t old, uint32_t new) 105 | { 106 | uint32_t prev; 107 | struct xchg_dummy { uint32_t a[100]; }; 108 | 109 | asm volatile(LOCK_PREFIX "cmpxchgl %1,%2" 110 | : "=a"(prev) 111 | : "q"(new), "m"(*(struct xchg_dummy *)ptr), "0"(old) 112 | : "memory"); 113 | 114 | return prev; 115 | } 116 | 117 | typedef struct { volatile int32_t counter; } ips_atomic_t; 118 | 119 | #define ips_atomic_set(v,i) (((v)->counter) = (i)) 120 | #define ips_atomic_cmpxchg(p,oval,nval) \ 121 | ips_cmpxchg((volatile uint32_t *) &((p)->counter),oval,nval) 122 | 123 | #if 0 124 | static __inline__ int32_t 125 | ips_cmpxchg(volatile int32_t *p, int32_t old_value, int32_t new_value) 126 | { 127 | asm volatile ("lock cmpxchg %2, %0" : 128 | "+m" (*p), "+a" (old_value) : 129 | "r" (new_value) : 130 | "memory"); 131 | return old_value; 132 | } 133 | #endif 134 | 135 | #endif /* _IPATH_i386_SYSDEP_H */ 136 | -------------------------------------------------------------------------------- /ptl_ips/ips_tidflow.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013. Intel Corporation. All rights reserved. 3 | * Copyright (c) 2006-2012. QLogic Corporation. All rights reserved. 4 | * Copyright (c) 2003-2006, PathScale, Inc. All rights reserved. 5 | * 6 | * This software is available to you under a choice of one of two 7 | * licenses. You may choose to be licensed under the terms of the GNU 8 | * General Public License (GPL) Version 2, available from the file 9 | * COPYING in the main directory of this source tree, or the 10 | * OpenIB.org BSD license below: 11 | * 12 | * Redistribution and use in source and binary forms, with or 13 | * without modification, are permitted provided that the following 14 | * conditions are met: 15 | * 16 | * - Redistributions of source code must retain the above 17 | * copyright notice, this list of conditions and the following 18 | * disclaimer. 19 | * 20 | * - Redistributions in binary form must reproduce the above 21 | * copyright notice, this list of conditions and the following 22 | * disclaimer in the documentation and/or other materials 23 | * provided with the distribution. 24 | * 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | * SOFTWARE. 33 | */ 34 | 35 | #ifndef _IPS_TIDFLOW_H 36 | #define _IPS_TIDFLOW_H 37 | 38 | #include "psm_user.h" 39 | 40 | #define IPS_TF_MAX_GENERATION 256 41 | #define IPS_TF_INVALID (~0U) 42 | #define IPS_TF_INVALID_GENERATION 0 43 | 44 | #define IPS_TF_PSN_PACK(flow,gen,seq) \ 45 | ( ((((uint64_t)flow)&0x1f)<<19) | \ 46 | ((((uint64_t)gen)&INFINIPATH_TF_GENVAL_MASK)<>19) & 0x1f; \ 51 | (gen) = ((tfval)>>INFINIPATH_TF_GENVAL_SHIFT) & INFINIPATH_TF_GENVAL_MASK; \ 52 | (seq) = ((tfval)>>INFINIPATH_TF_SEQNUM_SHIFT) & INFINIPATH_TF_SEQNUM_MASK; \ 53 | } while (0) 54 | 55 | #define IPS_TF_INC_SEQ(tfval) \ 56 | tfval = (tfval & ~INFINIPATH_TF_SEQNUM_MASK) | ((ipath_tidflow_get_seqnum(tfval) + 1) & INFINIPATH_TF_SEQNUM_MASK) 57 | 58 | struct ips_tfctrl; 59 | 60 | typedef void (*ips_tf_avail_cb_fn_t)(struct ips_tfctrl *, 61 | void *context); 62 | typedef enum { 63 | TF_STATE_INVALID = 0, 64 | TF_STATE_ALLOCATED = 1, 65 | TF_STATE_DEALLOCATED = 2 66 | } tf_state_t; 67 | 68 | struct ips_tf { 69 | 70 | SLIST_ENTRY(ips_tf) next; 71 | 72 | tf_state_t state; 73 | 74 | uint32_t tf_idx; 75 | 76 | uint32_t next_gen:8; 77 | uint32_t pad:24; 78 | }; 79 | 80 | struct ips_tfctrl { 81 | const psmi_context_t *context; 82 | 83 | uint32_t tf_start_idx; 84 | uint32_t tf_end_idx; 85 | 86 | uint32_t tf_num_max; 87 | uint32_t tf_num_avail; 88 | 89 | uint32_t tf_num_total; 90 | 91 | ips_tf_avail_cb_fn_t tf_avail_cb; 92 | void *tf_avail_context; 93 | 94 | SLIST_HEAD(tf_free, ips_tf) tf_avail; 95 | 96 | struct ips_tf tf[INFINIPATH_TF_NFLOWS]; 97 | }; 98 | 99 | PSMI_ALWAYS_INLINE( 100 | int 101 | ips_tf_available(struct ips_tfctrl *tfctrl)) 102 | { 103 | return tfctrl->tf_num_avail; 104 | } 105 | 106 | psm_error_t ips_tf_init(const psmi_context_t *context, 107 | struct ips_tfctrl *tfctrl, 108 | int start_flowidx, 109 | int end_flowidx, 110 | ips_tf_avail_cb_fn_t cb, 111 | void *cb_context); 112 | psm_error_t ips_tf_fini(struct ips_tfctrl *tfctrl); 113 | 114 | /* Allocate a tidflow */ 115 | psm_error_t ips_tf_allocate(struct ips_tfctrl *tfctrl, 116 | uint32_t *tf_idx, 117 | uint32_t *tf_gen); 118 | 119 | /* Deallocate a tidflow */ 120 | psm_error_t ips_tf_deallocate(struct ips_tfctrl *tfctrl, uint32_t tf_idx); 121 | 122 | /* Allocate a generation for a flow */ 123 | psm_error_t ips_tfgen_allocate(struct ips_tfctrl *tfctrl, 124 | uint32_t tf_idx, 125 | uint32_t *tfgen); 126 | 127 | #endif 128 | -------------------------------------------------------------------------------- /include/linux-ppc/bit_ops.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2012. QLogic Corporation. All rights reserved. 3 | * Copyright (c) 2003-2006, PathScale, Inc. All rights reserved. 4 | * 5 | * This software is available to you under a choice of one of two 6 | * licenses. You may choose to be licensed under the terms of the GNU 7 | * General Public License (GPL) Version 2, available from the file 8 | * COPYING in the main directory of this source tree, or the 9 | * OpenIB.org BSD license below: 10 | * 11 | * Redistribution and use in source and binary forms, with or 12 | * without modification, are permitted provided that the following 13 | * conditions are met: 14 | * 15 | * - Redistributions of source code must retain the above 16 | * copyright notice, this list of conditions and the following 17 | * disclaimer. 18 | * 19 | * - Redistributions in binary form must reproduce the above 20 | * copyright notice, this list of conditions and the following 21 | * disclaimer in the documentation and/or other materials 22 | * provided with the distribution. 23 | * 24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 25 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 26 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 27 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 28 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 29 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 30 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | * SOFTWARE. 32 | */ 33 | 34 | #ifndef _IPATH_ppc64_BIT_OPS_H 35 | #define _IPATH_ppc64_BIT_OPS_H 36 | 37 | #if defined(__powerpc64__) 38 | # define _NRMASK 63 39 | # define _NRSHIFT 6 40 | # define _NRSWIZZ 0 41 | # define _LLARX "ldarx " 42 | # define _STLCX "stdcx. " 43 | #else 44 | # define _NRMASK 31 45 | # define _NRSHIFT 5 46 | # define _NRSWIZZ 1 47 | # define _LLARX "lwarx " 48 | # define _STLCX "stwcx. " 49 | #endif 50 | 51 | static __inline__ unsigned long ips___nrmask(int nr) 52 | { 53 | return 1UL << (nr & _NRMASK); 54 | } 55 | 56 | static __inline__ int ips___nroffset(int nr) 57 | { 58 | return (nr >> _NRSHIFT) ^ _NRSWIZZ; 59 | } 60 | 61 | static __inline__ void ips_clear_bit(int nr, volatile unsigned long *addr) 62 | { 63 | unsigned long old; 64 | unsigned long mask = ips___nrmask(nr); 65 | volatile unsigned long *p = addr + ips___nroffset(nr); 66 | 67 | __asm__ __volatile__( 68 | "1:" _LLARX "%0,0,%3 \n" 69 | "andc %0,%0,%2 \n" 70 | _STLCX "%0,0,%3 \n" 71 | "bne- 1b" 72 | : "=&r" (old), "=m" (*p) 73 | : "r" (mask), "r" (p), "m" (*p) 74 | : "cc"); 75 | } 76 | 77 | static __inline__ void ips_change_bit(int nr, volatile unsigned long *addr) 78 | { 79 | unsigned long old; 80 | unsigned long mask = ips___nrmask(nr); 81 | volatile unsigned long *p = addr + ips___nroffset(nr); 82 | 83 | __asm__ __volatile__( 84 | "1:" _LLARX "%0,0,%3 \n" 85 | "xor %0,%0,%2 \n" 86 | _STLCX "%0,0,%3 \n" 87 | "bne- 1b" 88 | : "=&r" (old), "=m" (*p) 89 | : "r" (mask), "r" (p), "m" (*p) 90 | : "cc"); 91 | } 92 | 93 | static __inline__ int ips_test_and_set_bit(int nr, volatile unsigned long *addr) 94 | { 95 | unsigned long old, t; 96 | unsigned long mask = ips___nrmask(nr); 97 | volatile unsigned long *p = addr + ips___nroffset(nr); 98 | 99 | __asm__ __volatile__( 100 | "eieio \n" 101 | "1:" _LLARX "%0,0,%3 \n" 102 | "or %1,%0,%2 \n" 103 | _STLCX "%1,0,%3 \n" 104 | "bne- 1b \n" 105 | "sync" 106 | : "=&r" (old), "=&r" (t) 107 | : "r" (mask), "r" (p) 108 | : "cc", "memory"); 109 | 110 | return (old & mask) != 0; 111 | } 112 | 113 | static __inline__ void ips___clear_bit(int nr, volatile unsigned long *addr) 114 | { 115 | unsigned long mask = ips___nrmask(nr); 116 | volatile unsigned long *p = addr + ips___nroffset(nr); 117 | 118 | *p &= ~mask; 119 | } 120 | 121 | static __inline__ void ips___change_bit(int nr, volatile unsigned long *addr) 122 | { 123 | unsigned long mask = ips___nrmask(nr); 124 | volatile unsigned long *p = addr + ips___nroffset(nr); 125 | 126 | *p ^= mask; 127 | } 128 | 129 | static __inline__ int ips___test_and_set_bit(int nr, volatile unsigned long *addr) 130 | { 131 | unsigned long mask = ips___nrmask(nr); 132 | volatile unsigned long *p = addr + ips___nroffset(nr); 133 | unsigned long old = *p; 134 | 135 | *p = old | mask; 136 | return (old & mask) != 0; 137 | } 138 | 139 | #undef _NRMASK 140 | #undef _NRSHIFT 141 | #undef _NRSWIZZ 142 | #undef _LLARX 143 | #undef _STLCX 144 | 145 | #endif /* _IPATH_ppc64_BIT_OPS_H */ 146 | -------------------------------------------------------------------------------- /mpspawn/mpspawn_stats.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013. Intel Corporation. All rights reserved. 3 | * Copyright (c) 2006-2012. QLogic Corporation. All rights reserved. 4 | * Copyright (c) 2003-2006, PathScale, Inc. All rights reserved. 5 | * 6 | * This software is available to you under a choice of one of two 7 | * licenses. You may choose to be licensed under the terms of the GNU 8 | * General Public License (GPL) Version 2, available from the file 9 | * COPYING in the main directory of this source tree, or the 10 | * OpenIB.org BSD license below: 11 | * 12 | * Redistribution and use in source and binary forms, with or 13 | * without modification, are permitted provided that the following 14 | * conditions are met: 15 | * 16 | * - Redistributions of source code must retain the above 17 | * copyright notice, this list of conditions and the following 18 | * disclaimer. 19 | * 20 | * - Redistributions in binary form must reproduce the above 21 | * copyright notice, this list of conditions and the following 22 | * disclaimer in the documentation and/or other materials 23 | * provided with the distribution. 24 | * 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32 | * SOFTWARE. 33 | */ 34 | 35 | #ifndef _MPSPAWN_STATS_H 36 | #define _MPSPAWN_STATS_H 37 | 38 | #include 39 | 40 | #define MPSPAWN_STATS_VERSION 1 41 | 42 | typedef enum 43 | { 44 | MPSPAWN_STATS_TYPE_DOUBLE = 0x1, 45 | #define MPSPAWN_STATS_TYPE_DOUBLE 0x1 46 | MPSPAWN_STATS_TYPE_HEADER = 0x2, 47 | #define MPSPAWN_STATS_TYPE_HEADER 0x2 48 | MPSPAWN_STATS_REDUCTION_MAX = 0x1000, 49 | #define MPSPAWN_STATS_REDUCTION_MAX 0x1000 50 | MPSPAWN_STATS_REDUCTION_MIN = 0x2000, 51 | #define MPSPAWN_STATS_REDUCTION_MIN 0x2000 52 | MPSPAWN_STATS_REDUCTION_MEDIAN = 0x4000, 53 | #define MPSPAWN_STATS_REDUCTION_MEDIAN 0x4000 54 | MPSPAWN_STATS_SKIP_IF_ZERO = 0x8000 55 | #define MPSPAWN_STATS_SKIP_IF_ZERO 0x8000 56 | } 57 | mpspawn_stats_flags; 58 | 59 | #define MPSPAWN_STATS_REDUCTION_ALL (MPSPAWN_STATS_REDUCTION_MAX | \ 60 | MPSPAWN_STATS_REDUCTION_MIN | MPSPAWN_STATS_REDUCTION_MEDIAN) 61 | 62 | #define MPSPAWN_STATS_DOUBLE_TO_U64(arg) (*((uint64_t *) &(arg))) 63 | #define MPSPAWN_NAN_U64 ((uint64_t) ~0ULL) 64 | #define MPSPAWN_ISNAN_U64(x) (((uint64_t)(x)) == MPSPAWN_NAN_U64) 65 | 66 | #define MPSPAWN_NAN ((uint64_t) ~0ULL) //NAN) 67 | #define MPSPAWN_ISNAN(x) (isnan(x)) 68 | 69 | struct mpspawn_stats_add_args; /* client->mpspawn stats registration */ 70 | struct mpspawn_stats_req_args; /* mpspawn->client fn callback stats request */ 71 | struct mpspawn_stats_init_args; /* mpspawn->client "downcall" to register */ 72 | 73 | /* Clients implement this function to fill in mpspawn request for stats */ 74 | typedef void (*mpspawn_stats_req_fn) (struct mpspawn_stats_req_args *); 75 | /* mpspawn implements this function to allow clients to register new stats */ 76 | typedef void (*mpspawn_stats_add_fn) (struct mpspawn_stats_add_args *); 77 | /* mpspawn implements this function to map rank indexes into epaddr structs */ 78 | struct psm_epaddr; 79 | typedef struct psm_epaddr * (*mpspawn_map_epaddr_fn) (int rank); 80 | 81 | typedef struct mpspawn_stats_req_args { 82 | int version; 83 | int num; 84 | uint64_t *stats; 85 | uint16_t *flags; 86 | void *context; 87 | } 88 | mpspawn_stats_req_args_t; 89 | 90 | typedef 91 | struct mpspawn_stats_add_args { 92 | int version; 93 | int num; 94 | char *header; 95 | char **desc; 96 | uint16_t *flags; 97 | mpspawn_stats_req_fn req_fn; 98 | void *context; 99 | } mpspawn_stats_add_args_t; 100 | 101 | typedef 102 | struct mpspawn_stats_init_args { 103 | int version; 104 | psm_mq_t mq; /* initialized mq endpoint */ 105 | int num_epaddr; /* number of endpoints in job */ 106 | mpspawn_stats_add_fn add_fn; /* function for client to add stats */ 107 | mpspawn_map_epaddr_fn epaddr_map_fn; 108 | const char *stats_types; /* stats type string mpirun -M */ 109 | } 110 | mpspawn_stats_init_args_t; 111 | 112 | /* Function in psm exposed to register stats */ 113 | void *psmi_stats_register(struct mpspawn_stats_init_args *args); 114 | 115 | #endif 116 | -------------------------------------------------------------------------------- /include/ipath_udebug.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2012. QLogic Corporation. All rights reserved. 3 | * Copyright (c) 2003-2006, PathScale, Inc. All rights reserved. 4 | * 5 | * This software is available to you under a choice of one of two 6 | * licenses. You may choose to be licensed under the terms of the GNU 7 | * General Public License (GPL) Version 2, available from the file 8 | * COPYING in the main directory of this source tree, or the 9 | * OpenIB.org BSD license below: 10 | * 11 | * Redistribution and use in source and binary forms, with or 12 | * without modification, are permitted provided that the following 13 | * conditions are met: 14 | * 15 | * - Redistributions of source code must retain the above 16 | * copyright notice, this list of conditions and the following 17 | * disclaimer. 18 | * 19 | * - Redistributions in binary form must reproduce the above 20 | * copyright notice, this list of conditions and the following 21 | * disclaimer in the documentation and/or other materials 22 | * provided with the distribution. 23 | * 24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 25 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 26 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 27 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 28 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 29 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 30 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | * SOFTWARE. 32 | */ 33 | 34 | #ifndef _IPATH_UDEBUG_H 35 | #define _IPATH_UDEBUG_H 36 | 37 | #include 38 | #include "ipath_debug.h" 39 | 40 | extern unsigned infinipath_debug; 41 | const char *ipath_get_unit_name(int unit); 42 | extern char *__progname; 43 | 44 | #if _IPATH_DEBUGGING 45 | 46 | extern char *__ipath_mylabel; 47 | void ipath_set_mylabel(char *); 48 | char *ipath_get_mylabel(); 49 | extern FILE *__ipath_dbgout; 50 | 51 | #define _IPATH_UNIT_ERROR(unit,fmt,...) \ 52 | do { \ 53 | _Pragma_unlikely \ 54 | printf("%s%s: " fmt, __ipath_mylabel, __progname, \ 55 | ##__VA_ARGS__); \ 56 | } while(0) 57 | 58 | #define _IPATH_ERROR(fmt,...) \ 59 | do { \ 60 | _Pragma_unlikely \ 61 | printf("%s%s: " fmt, __ipath_mylabel, __progname, \ 62 | ##__VA_ARGS__); \ 63 | } while(0) 64 | 65 | #define _IPATH_INFO(fmt,...) \ 66 | do { \ 67 | _Pragma_unlikely \ 68 | if(unlikely(infinipath_debug&__IPATH_INFO)) \ 69 | printf("%s%s: " fmt, __ipath_mylabel, __func__, \ 70 | ##__VA_ARGS__); \ 71 | } while(0) 72 | 73 | #define __IPATH_PKTDBG_ON unlikely(infinipath_debug & __IPATH_PKTDBG) 74 | 75 | #define __IPATH_DBG_WHICH(which,fmt,...) \ 76 | do { \ 77 | _Pragma_unlikely \ 78 | if(unlikely(infinipath_debug&(which))) \ 79 | fprintf(__ipath_dbgout, "%s%s: " fmt, __ipath_mylabel, __func__, \ 80 | ##__VA_ARGS__); \ 81 | } while(0) 82 | 83 | #define __IPATH_DBG_WHICH_NOFUNC(which,fmt,...) \ 84 | do { \ 85 | _Pragma_unlikely \ 86 | if(unlikely(infinipath_debug&(which))) \ 87 | fprintf(__ipath_dbgout, "%s" fmt, __ipath_mylabel, \ 88 | ##__VA_ARGS__); \ 89 | } while(0) 90 | 91 | #define _IPATH_DBG(fmt,...) __IPATH_DBG_WHICH(__IPATH_DBG,fmt,##__VA_ARGS__) 92 | #define _IPATH_VDBG(fmt,...) __IPATH_DBG_WHICH(__IPATH_VERBDBG,fmt,##__VA_ARGS__) 93 | #define _IPATH_PDBG(fmt,...) __IPATH_DBG_WHICH(__IPATH_PKTDBG,fmt,##__VA_ARGS__) 94 | #define _IPATH_EPDBG(fmt,...) __IPATH_DBG_WHICH(__IPATH_EPKTDBG,fmt,##__VA_ARGS__) 95 | #define _IPATH_PRDBG(fmt,...) __IPATH_DBG_WHICH(__IPATH_PROCDBG,fmt,##__VA_ARGS__) 96 | #define _IPATH_ENVDBG(lev,fmt,...) \ 97 | __IPATH_DBG_WHICH_NOFUNC( \ 98 | (lev==0) ? __IPATH_INFO : \ 99 | (lev>1?__IPATH_ENVDBG:(__IPATH_PROCDBG|__IPATH_ENVDBG)),\ 100 | "env " fmt,##__VA_ARGS__) 101 | #define _IPATH_MMDBG(fmt,...) __IPATH_DBG_WHICH(__IPATH_MMDBG,fmt,##__VA_ARGS__) 102 | #define _IPATH_CCADBG(fmt,...) __IPATH_DBG_WHICH(__IPATH_CCADBG,fmt,##__VA_ARGS__) 103 | 104 | #else /* ! _IPATH_DEBUGGING */ 105 | 106 | #define _IPATH_UNIT_ERROR(unit,fmt,...) \ 107 | do { \ 108 | printf ("%s" fmt, "", ##__VA_ARGS__); \ 109 | } while(0) 110 | 111 | #define _IPATH_ERROR(fmt,...) \ 112 | do { \ 113 | printf ("%s" fmt, "", ##__VA_ARGS__); \ 114 | } while(0) 115 | 116 | #define _IPATH_INFO(fmt,...) 117 | 118 | #define __IPATH_PKTDBG_ON 0 119 | 120 | #define _IPATH_DBG(fmt,...) 121 | #define _IPATH_PDBG(fmt,...) 122 | #define _IPATH_EPDBG(fmt,...) 123 | #define _IPATH_PRDBG(fmt,...) 124 | #define _IPATH_VDBG(fmt,...) 125 | #define _IPATH_MMDBG(fmt,...) 126 | #define _IPATH_CCADBG(fmt,...) 127 | 128 | #endif /* _IPATH_DEBUGGING */ 129 | 130 | #endif /* _IPATH_DEBUG_H */ 131 | -------------------------------------------------------------------------------- /libuuid/uuid_time.c: -------------------------------------------------------------------------------- 1 | /* 2 | * uuid_time.c --- Interpret the time field from a uuid. This program 3 | * violates the UUID abstraction barrier by reaching into the guts 4 | * of a UUID and interpreting it. 5 | * 6 | * Copyright (C) 1998, 1999 Theodore Ts'o. 7 | * 8 | * %Begin-Header% 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, and the entire permission notice in its entirety, 14 | * including the disclaimer of warranties. 15 | * 2. Redistributions in binary form must reproduce the above copyright 16 | * notice, this list of conditions and the following disclaimer in the 17 | * documentation and/or other materials provided with the distribution. 18 | * 3. The name of the author may not be used to endorse or promote 19 | * products derived from this software without specific prior 20 | * written permission. 21 | * 22 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED 23 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF 25 | * WHICH ARE HEREBY DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE 26 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 27 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 28 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 29 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 30 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 32 | * USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH 33 | * DAMAGE. 34 | * %End-Header% 35 | */ 36 | 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | 44 | #include "uuidP.h" 45 | 46 | time_t uuid_time(const uuid_t uu, struct timeval *ret_tv) 47 | { 48 | struct uuid uuid; 49 | uint32_t high; 50 | struct timeval tv; 51 | unsigned long long clock_reg; 52 | 53 | uuid_unpack(uu, &uuid); 54 | 55 | high = uuid.time_mid | ((uuid.time_hi_and_version & 0xFFF) << 16); 56 | clock_reg = uuid.time_low | ((unsigned long long) high << 32); 57 | 58 | clock_reg -= (((unsigned long long) 0x01B21DD2) << 32) + 0x13814000; 59 | tv.tv_sec = clock_reg / 10000000; 60 | tv.tv_usec = (clock_reg % 10000000) / 10; 61 | 62 | if (ret_tv) 63 | *ret_tv = tv; 64 | 65 | return tv.tv_sec; 66 | } 67 | 68 | int uuid_type(const uuid_t uu) 69 | { 70 | struct uuid uuid; 71 | 72 | uuid_unpack(uu, &uuid); 73 | return ((uuid.time_hi_and_version >> 12) & 0xF); 74 | } 75 | 76 | int uuid_variant(const uuid_t uu) 77 | { 78 | struct uuid uuid; 79 | int var; 80 | 81 | uuid_unpack(uu, &uuid); 82 | var = uuid.clock_seq; 83 | 84 | if ((var & 0x8000) == 0) 85 | return UUID_VARIANT_NCS; 86 | if ((var & 0x4000) == 0) 87 | return UUID_VARIANT_DCE; 88 | if ((var & 0x2000) == 0) 89 | return UUID_VARIANT_MICROSOFT; 90 | return UUID_VARIANT_OTHER; 91 | } 92 | 93 | #ifdef DEBUG 94 | static const char *variant_string(int variant) 95 | { 96 | switch (variant) { 97 | case UUID_VARIANT_NCS: 98 | return "NCS"; 99 | case UUID_VARIANT_DCE: 100 | return "DCE"; 101 | case UUID_VARIANT_MICROSOFT: 102 | return "Microsoft"; 103 | default: 104 | return "Other"; 105 | } 106 | } 107 | 108 | 109 | int 110 | main(int argc, char **argv) 111 | { 112 | uuid_t buf; 113 | time_t time_reg; 114 | struct timeval tv; 115 | int type, variant; 116 | 117 | if (argc != 2) { 118 | fprintf(stderr, "Usage: %s uuid\n", argv[0]); 119 | exit(1); 120 | } 121 | if (uuid_parse(argv[1], buf)) { 122 | fprintf(stderr, "Invalid UUID: %s\n", argv[1]); 123 | exit(1); 124 | } 125 | variant = uuid_variant(buf); 126 | type = uuid_type(buf); 127 | time_reg = uuid_time(buf, &tv); 128 | 129 | printf("UUID variant is %d (%s)\n", variant, variant_string(variant)); 130 | if (variant != UUID_VARIANT_DCE) { 131 | printf("Warning: This program only knows how to interpret " 132 | "DCE UUIDs.\n\tThe rest of the output is likely " 133 | "to be incorrect!!\n"); 134 | } 135 | printf("UUID type is %d", type); 136 | switch (type) { 137 | case 1: 138 | printf(" (time based)\n"); 139 | break; 140 | case 2: 141 | printf(" (DCE)\n"); 142 | break; 143 | case 3: 144 | printf(" (name-based)\n"); 145 | break; 146 | case 4: 147 | printf(" (random)\n"); 148 | break; 149 | default: 150 | printf("\n"); 151 | } 152 | if (type != 1) { 153 | printf("Warning: not a time-based UUID, so UUID time " 154 | "decoding will likely not work!\n"); 155 | } 156 | printf("UUID time is: (%ld, %ld): %s\n", tv.tv_sec, tv.tv_usec, 157 | ctime(&time_reg)); 158 | 159 | return 0; 160 | } 161 | #endif 162 | -------------------------------------------------------------------------------- /psm_timer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2012. QLogic Corporation. All rights reserved. 3 | * Copyright (c) 2003-2006, PathScale, Inc. All rights reserved. 4 | * 5 | * This software is available to you under a choice of one of two 6 | * licenses. You may choose to be licensed under the terms of the GNU 7 | * General Public License (GPL) Version 2, available from the file 8 | * COPYING in the main directory of this source tree, or the 9 | * OpenIB.org BSD license below: 10 | * 11 | * Redistribution and use in source and binary forms, with or 12 | * without modification, are permitted provided that the following 13 | * conditions are met: 14 | * 15 | * - Redistributions of source code must retain the above 16 | * copyright notice, this list of conditions and the following 17 | * disclaimer. 18 | * 19 | * - Redistributions in binary form must reproduce the above 20 | * copyright notice, this list of conditions and the following 21 | * disclaimer in the documentation and/or other materials 22 | * provided with the distribution. 23 | * 24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 25 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 26 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 27 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 28 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 29 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 30 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | * SOFTWARE. 32 | */ 33 | 34 | #ifndef _PSMI_IN_USER_H 35 | #error psm_timer.h not meant to be included directly, include psm_user.h instead 36 | #endif 37 | 38 | #ifndef _PSMI_TIMER_H 39 | #define _PSMI_TIMER_H 40 | 41 | #include "psm_user.h" 42 | 43 | /* Keep timer stats */ 44 | #define PSMI_TIMER_STATS 0 45 | 46 | typedef struct psmi_timer psmi_timer; 47 | typedef psm_error_t (*psmi_timer_expire_callback_t)(struct psmi_timer *, uint64_t); 48 | 49 | struct psmi_timer { 50 | TAILQ_ENTRY(psmi_timer) timer; /* opaque */ 51 | uint64_t t_timeout; /* opaque */ 52 | uint8_t flags; /* opaque */ 53 | 54 | psmi_timer_expire_callback_t expire_callback; /* user -- callback fn */ 55 | void *context; /* user -- callback param */ 56 | }; 57 | 58 | struct psmi_timer_ctrl { 59 | uint64_t t_cyc_next_expire; 60 | TAILQ_HEAD(timerq, psmi_timer) timerq; 61 | 62 | #if PSMI_TIMER_STATS 63 | uint64_t num_insertions; 64 | uint64_t num_traversals; 65 | #endif 66 | }; 67 | 68 | /* 69 | * Some events need to be unconditionally enqueued at the beginning of the 70 | * timerq -- they are not timers meant to expire but merely operations that 71 | * need to be delayed. For delayed operations, there are 5 levels of 72 | * priority. 73 | */ 74 | #define PSMI_TIMER_PRIO_0 0ULL 75 | #define PSMI_TIMER_PRIO_1 1ULL 76 | #define PSMI_TIMER_PRIO_2 2ULL 77 | #define PSMI_TIMER_PRIO_3 3ULL 78 | #define PSMI_TIMER_PRIO_4 4ULL 79 | #define PSMI_TIMER_PRIO_LAST PSMI_TIMER_PRIO_4 80 | 81 | #define PSMI_TIMER_INFINITE 0xFFFFFFFFFFFFFFFFULL 82 | #define PSMI_TIMER_FLAG_PENDING 0x01 83 | 84 | /* 85 | * Timer control initialization and finalization 86 | */ 87 | psm_error_t psmi_timer_init(struct psmi_timer_ctrl *ctrl); 88 | psm_error_t psmi_timer_fini(struct psmi_timer_ctrl *ctrl); 89 | 90 | /* 91 | * Timer entry initialization (a timer must be initialized before it can be 92 | * added to the timer request queue). 93 | */ 94 | 95 | void psmi_timer_entry_init(struct psmi_timer *t_init, 96 | psmi_timer_expire_callback_t expire_fn, 97 | void *context); 98 | 99 | /* 100 | * Timer requests, conditional (macro) or unconditional 101 | */ 102 | #define psmi_timer_request(ctrl, t_insert, t_cyc) \ 103 | if (!((t_insert)->flags & PSMI_TIMER_FLAG_PENDING)) \ 104 | psmi_timer_request_always((ctrl), (t_insert), (t_cyc)) 105 | 106 | void psmi_timer_request_always(struct psmi_timer_ctrl *ctrl, 107 | struct psmi_timer *t_insert, 108 | uint64_t t_cyc_expire); 109 | 110 | /* 111 | * Timer cancelations, conditional (macro) only (cancel_inner is internal) 112 | */ 113 | #define psmi_timer_cancel(ctrl, t_remove) \ 114 | if ((t_remove)->flags & PSMI_TIMER_FLAG_PENDING) \ 115 | psmi_timer_cancel_inner(ctrl, t_remove) 116 | void psmi_timer_cancel_inner(struct psmi_timer_ctrl *ctrl, 117 | struct psmi_timer *t_remove); 118 | 119 | /* 120 | * Timer processing, conditional or unconditional. 121 | */ 122 | #define psmi_timer_process_if_expired(ctrl, t_cyc_expire) \ 123 | (((ctrl)->t_cyc_next_expire <= (t_cyc_expire)) ? \ 124 | psmi_timer_process_expired(ctrl, t_cyc_expire) : \ 125 | PSM_OK_NO_PROGRESS) 126 | 127 | #define psmi_timer_is_expired(ctrl, t_cyc_expire) \ 128 | ((ctrl)->t_cyc_next_expire <= (t_cyc_expire)) 129 | 130 | psm_error_t psmi_timer_process_expired(struct psmi_timer_ctrl *ctrl, 131 | uint64_t t_cyc_expire); 132 | 133 | #endif /* _PSMI_TIMER_H */ 134 | -------------------------------------------------------------------------------- /ptl_am/knemrwu.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010. QLogic Corporation. All rights reserved. 3 | * 4 | * This software is available to you under a choice of one of two 5 | * licenses. You may choose to be licensed under the terms of the GNU 6 | * General Public License (GPL) Version 2, available from the file 7 | * COPYING in the main directory of this source tree, or the 8 | * OpenIB.org BSD license below: 9 | * 10 | * Redistribution and use in source and binary forms, with or 11 | * without modification, are permitted provided that the following 12 | * conditions are met: 13 | * 14 | * - Redistributions of source code must retain the above 15 | * copyright notice, this list of conditions and the following 16 | * disclaimer. 17 | * 18 | * - Redistributions in binary form must reproduce the above 19 | * copyright notice, this list of conditions and the following 20 | * disclaimer in the documentation and/or other materials 21 | * provided with the distribution. 22 | * 23 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 24 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 25 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 26 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 27 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 28 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 29 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 30 | * SOFTWARE. 31 | */ 32 | 33 | #include 34 | #include 35 | #include 36 | #include 37 | 38 | #include "psm_user.h" 39 | #include "psm_mq_internal.h" 40 | #include "psm_am_internal.h" 41 | #include "knemrw.h" 42 | 43 | int knem_open_device() 44 | { 45 | /* Process wide knem handle */ 46 | static int fd = -1; 47 | 48 | #if defined(PSM_USE_KNEM) 49 | if (fd >= 0) 50 | return fd; 51 | 52 | fd = open(KNEM_DEVICE_FILENAME, O_RDWR); 53 | #endif 54 | return fd; 55 | } 56 | 57 | int64_t knem_get(int fd, int64_t cookie, const void *src, int64_t n) 58 | { 59 | 60 | #if defined(PSM_USE_KNEM) 61 | struct knem_cmd_inline_copy c; 62 | struct knem_cmd_param_iovec iov; 63 | int err; 64 | 65 | iov.base = (uint64_t) (uintptr_t) src; 66 | iov.len = n; 67 | 68 | c.local_iovec_array = (uintptr_t) &iov; 69 | c.local_iovec_nr = 1; 70 | c.remote_cookie = cookie; 71 | c.remote_offset = 0; 72 | c.write = 0; /* Do a Read/Get from remote memory region */ 73 | c.flags = 0; 74 | err = ioctl(fd, KNEM_CMD_INLINE_COPY, &c); 75 | 76 | if (c.current_status != KNEM_STATUS_SUCCESS) { 77 | _IPATH_INFO("KNEM: Get request of size 0x%"PRIx64" failed with error %d.\n", 78 | n, c.current_status); 79 | err = c.current_status; 80 | } 81 | 82 | return err; 83 | #else 84 | psmi_handle_error(PSMI_EP_NORETURN, PSM_INTERNAL_ERR, 85 | "Attempt to use KNEM kassist (get), support for which has " 86 | "not been compiled in."); 87 | 88 | return PSM_INTERNAL_ERR; 89 | #endif 90 | } 91 | 92 | int64_t knem_put(int fd, const void *src, int64_t n, int64_t cookie) 93 | { 94 | 95 | #if defined(PSM_USE_KNEM) 96 | struct knem_cmd_inline_copy c; 97 | struct knem_cmd_param_iovec iov; 98 | int err; 99 | 100 | iov.base = (uint64_t) (uintptr_t) src; 101 | iov.len = n; 102 | 103 | c.local_iovec_array = (uintptr_t) &iov; 104 | c.local_iovec_nr = 1; 105 | c.remote_cookie = cookie; 106 | c.remote_offset = 0; 107 | c.write = 1; /* Do a Write/Put to remote memory region */ 108 | c.flags = 0; 109 | err = ioctl(fd, KNEM_CMD_INLINE_COPY, &c); 110 | 111 | if (c.current_status != KNEM_STATUS_SUCCESS) { 112 | _IPATH_INFO("KNEM: Put request of size 0x%"PRIx64" failed with error %d.\n", 113 | n, c.current_status); 114 | err = c.current_status; 115 | } 116 | 117 | return err; 118 | #else 119 | 120 | psmi_handle_error(PSMI_EP_NORETURN, PSM_INTERNAL_ERR, 121 | "Attempt to use KNEM kassist (put), support for which has " 122 | "not been compiled in."); 123 | 124 | return PSM_INTERNAL_ERR; 125 | #endif 126 | 127 | } 128 | 129 | int64_t knem_register_region(void *buffer, size_t len, int write) 130 | { 131 | 132 | #if defined(PSM_USE_KNEM) 133 | struct knem_cmd_create_region create; 134 | struct knem_cmd_param_iovec iov; 135 | 136 | iov.base = (uint64_t) (uintptr_t) buffer; 137 | iov.len = len; 138 | create.iovec_array = (uintptr_t) &iov; 139 | create.iovec_nr = 1; 140 | create.flags = KNEM_FLAG_SINGLEUSE; /* Automatically destroy after put */ 141 | create.protection = write ? PROT_WRITE : PROT_READ; 142 | 143 | /* AV: Handle failure in memory registration */ 144 | ioctl(psmi_kassist_fd, KNEM_CMD_CREATE_REGION, &create); 145 | return create.cookie; /* Cookie for registered memory region */ 146 | #else 147 | 148 | psmi_handle_error(PSMI_EP_NORETURN, PSM_INTERNAL_ERR, 149 | "Attempt to use KNEM kassist (reg), support for which has " 150 | "not been compiled in."); 151 | return 0; 152 | #endif 153 | 154 | } 155 | -------------------------------------------------------------------------------- /psm_help.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006-2012. QLogic Corporation. All rights reserved. 3 | * Copyright (c) 2003-2006, PathScale, Inc. All rights reserved. 4 | * 5 | * This software is available to you under a choice of one of two 6 | * licenses. You may choose to be licensed under the terms of the GNU 7 | * General Public License (GPL) Version 2, available from the file 8 | * COPYING in the main directory of this source tree, or the 9 | * OpenIB.org BSD license below: 10 | * 11 | * Redistribution and use in source and binary forms, with or 12 | * without modification, are permitted provided that the following 13 | * conditions are met: 14 | * 15 | * - Redistributions of source code must retain the above 16 | * copyright notice, this list of conditions and the following 17 | * disclaimer. 18 | * 19 | * - Redistributions in binary form must reproduce the above 20 | * copyright notice, this list of conditions and the following 21 | * disclaimer in the documentation and/or other materials 22 | * provided with the distribution. 23 | * 24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 25 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 26 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 27 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 28 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 29 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 30 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | * SOFTWARE. 32 | */ 33 | 34 | #ifndef _PSMI_HELP_H 35 | #define _PSMI_HELP_H 36 | 37 | /* XXX pathcc and gcc only */ 38 | #define PSMI_INLINE(FN) \ 39 | static inline FN 40 | 41 | #define PSMI_ALWAYS_INLINE(FN) \ 42 | static __inline__ FN __attribute__((always_inline)); \ 43 | static __inline__ FN 44 | 45 | #define PSMI_NEVER_INLINE(FN) \ 46 | static FN __attribute__((noinline)); \ 47 | static FN 48 | 49 | #define _PPragma(x) _Pragma(x) 50 | 51 | #define STRINGIFY(s) _STRINGIFY(s) 52 | #define _STRINGIFY(s) #s 53 | #define PSMI_CURLOC __FILE__ ":" STRINGIFY(__LINE__) 54 | #define psmi_assert_always_loc(x,curloc) do { \ 55 | if_pf (!(x)) { \ 56 | psmi_handle_error(PSMI_EP_NORETURN, PSM_INTERNAL_ERR, \ 57 | "Assertion failure at %s: %s", curloc, \ 58 | STRINGIFY(x)); \ 59 | } } while (0) 60 | 61 | #define psmi_assert_always(x) psmi_assert_always_loc(x,PSMI_CURLOC) 62 | 63 | #ifdef PSM_DEBUG 64 | # define psmi_assert(x) psmi_assert_always(x) 65 | # define PSMI_ASSERT_INITIALIZED() psmi_assert_always(psmi_isinitialized()) 66 | #else 67 | # define psmi_assert(x) 68 | # define PSMI_ASSERT_INITIALIZED() 69 | #endif 70 | 71 | #define _PSMI_API_NAME(FN) __ ## FN 72 | #define _PSMI_API_STR(FN) _STRINGIFY(__ ## FN) 73 | #define PSMI_API_DECL(FN) \ 74 | typeof(_PSMI_API_NAME(FN)) FN __attribute__((weak, alias(_PSMI_API_STR(FN)))); 75 | 76 | #define PSMI_ERR_UNLESS_INITIALIZED(ep) do { \ 77 | if (!psmi_isinitialized()) \ 78 | return psmi_handle_error(ep, PSM_INIT_NOT_INIT, \ 79 | "PSM has not been initialized"); \ 80 | } while (0) 81 | 82 | 83 | #define PSMI_CHECKMEM(err,mem) do { \ 84 | if ((mem) == NULL) { \ 85 | (err) = PSM_NO_MEMORY; \ 86 | goto fail; \ 87 | } \ 88 | } while (0) 89 | 90 | #define PSMI_CACHEALIGN __attribute__((aligned(64))) 91 | 92 | /* Easy way to ignore the OK_NO_PROGRESS case */ 93 | PSMI_ALWAYS_INLINE( 94 | psm_error_t 95 | psmi_err_only(psm_error_t err)) 96 | { 97 | if (err > PSM_OK_NO_PROGRESS) 98 | return err; 99 | else 100 | return PSM_OK; 101 | } 102 | 103 | #ifdef min 104 | #undef min 105 | #endif 106 | #define min(a,b) ((a) < (b) ? (a) : (b)) 107 | 108 | #ifdef max 109 | #undef max 110 | #endif 111 | #define max(a,b) ((a) > (b) ? (a) : (b)) 112 | 113 | #define SEC_ULL 1000000000ULL 114 | #define MSEC_ULL 1000000ULL 115 | #define USEC_ULL 1000ULL 116 | #define NSEC_ULL 1ULL 117 | 118 | #define PSMI_TRUE 1 119 | #define PSMI_FALSE 0 120 | 121 | #define PSMI_CYCLES_TO_SECSF(cycles) \ 122 | ((double) cycles_to_nanosecs(cycles) / 1.0e9) 123 | 124 | #define PSMI_PAGESIZE psmi_getpagesize() 125 | #define PSMI_POWEROFTWO(P) (((P)&((P)-1)) == 0) 126 | #define PSMI_ALIGNDOWN(p,P) (((uintptr_t)(p))&~((uintptr_t)((P)-1))) 127 | #define PSMI_ALIGNUP(p,P) (PSMI_ALIGNDOWN((uintptr_t)(p)+((uintptr_t)((P)-1)),(P))) 128 | 129 | #define PSMI_MAKE_DRIVER_VERSION(major,minor) ((major)<<16 | ((minor) & 0xffff)) 130 | 131 | #define PSMI_STRICT_SIZE_DECL(member,sz) static const size_t __psm_ss_ ## member = sz 132 | #define PSMI_STRICT_SIZE_VERIFY(member,sz) do { \ 133 | if (__psm_ss_ ## member != (sz)) { \ 134 | char errmsg[64]; \ 135 | snprintf(errmsg,32, "Internal error: %s " \ 136 | "size doesn't match expected %d bytes", \ 137 | STRINGIFY(member), (int) __psm_ss_ ## member); \ 138 | exit(-1); \ 139 | } \ 140 | } while (0) 141 | 142 | 143 | #endif /* _PSMI_HELP_H */ 144 | -------------------------------------------------------------------------------- /ptl_ips/ips_path_rec.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013. Intel Corporation. All rights reserved. 3 | * 2009,2010. QLogic Corporation. All rights reserved. 4 | * 5 | * This software is available to you under a choice of one of two 6 | * licenses. You may choose to be licensed under the terms of the GNU 7 | * General Public License (GPL) Version 2, available from the file 8 | * COPYING in the main directory of this source tree, or the 9 | * OpenIB.org BSD license below: 10 | * 11 | * Redistribution and use in source and binary forms, with or 12 | * without modification, are permitted provided that the following 13 | * conditions are met: 14 | * 15 | * - Redistributions of source code must retain the above 16 | * copyright notice, this list of conditions and the following 17 | * disclaimer. 18 | * 19 | * - Redistributions in binary form must reproduce the above 20 | * copyright notice, this list of conditions and the following 21 | * disclaimer in the documentation and/or other materials 22 | * provided with the distribution. 23 | * 24 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 25 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 26 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 27 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 28 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 29 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 30 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 | * SOFTWARE. 32 | */ 33 | 34 | #ifndef _IPS_PATH_REC_H_ 35 | #define _IPS_PATH_REC_H_ 36 | 37 | #include 38 | 39 | /* Default size of path record hash table */ 40 | #define DF_PATH_REC_HASH_SIZE 2047 41 | 42 | /* Default size of CCT table. Must be multiple of 64 */ 43 | #define DF_CCT_TABLE_SIZE 128 44 | 45 | /* CCT max IPD delay. QLE73XX is limited to 32us */ 46 | #define DF_CCT_MAX_IPD_DELAY_US 21 47 | 48 | /* CCA divisor shift */ 49 | #define CCA_DIVISOR_SHIFT 14 50 | 51 | /* CCA ipd mask */ 52 | #define CCA_IPD_MASK 0x3FFF 53 | 54 | /* A lot of these are IBTA specific defines that are available in other header 55 | * files. To minimize dependencies with PSM build process they are listed 56 | * here. Most of this is used to implement IBTA compliance features with PSM 57 | * like path record querye etc. 58 | */ 59 | 60 | enum ibta_mtu { 61 | IBTA_MTU_256 = 1, 62 | IBTA_MTU_512 = 2, 63 | IBTA_MTU_1024 = 3, 64 | IBTA_MTU_2048 = 4, 65 | IBTA_MTU_4096 = 5 66 | }; 67 | 68 | typedef enum { 69 | IBTA_RATE_PORT_CURRENT = 0, 70 | IBTA_RATE_2_5_GBPS = 2, 71 | IBTA_RATE_5_GBPS = 5, 72 | IBTA_RATE_10_GBPS = 3, 73 | IBTA_RATE_20_GBPS = 6, 74 | IBTA_RATE_30_GBPS = 4, 75 | IBTA_RATE_40_GBPS = 7, 76 | IBTA_RATE_60_GBPS = 8, 77 | IBTA_RATE_80_GBPS = 9, 78 | IBTA_RATE_120_GBPS = 10 79 | } ibta_rate; 80 | 81 | static inline int ibta_mtu_enum_to_int(enum ibta_mtu mtu) 82 | { 83 | switch (mtu) { 84 | case IBTA_MTU_256: return 256; 85 | case IBTA_MTU_512: return 512; 86 | case IBTA_MTU_1024: return 1024; 87 | case IBTA_MTU_2048: return 2048; 88 | case IBTA_MTU_4096: return 4096; 89 | default: return -1; 90 | } 91 | } 92 | 93 | /* This is same as ob_path_rec from ib_types.h. Listed here to be self 94 | * contained to minimize dependencies during build etc. 95 | */ 96 | typedef struct _ibta_path_rec { 97 | uint64_t service_id; /* net order */ 98 | uint8_t dgid[16]; 99 | uint8_t sgid[16]; 100 | uint16_t dlid; /* net order */ 101 | uint16_t slid; /* net order */ 102 | uint32_t hop_flow_raw; /* net order */ 103 | uint8_t tclass; 104 | uint8_t num_path; 105 | uint16_t pkey; /* net order */ 106 | uint16_t qos_class_sl; /* net order */ 107 | uint8_t mtu; /* IBTA encoded */ 108 | uint8_t rate; /* IBTA encoded */ 109 | uint8_t pkt_life; /* IBTA encoded */ 110 | uint8_t preference; 111 | uint8_t resv2[6]; 112 | } ibta_path_rec_t; 113 | 114 | /* 115 | * PSM IPS path record components for endpoint. 116 | */ 117 | struct ips_proto; 118 | typedef struct ips_path_rec { 119 | uint16_t epr_slid; /* For Torus/non zero LMC fabrics this can be diff */ 120 | uint16_t epr_dlid; 121 | uint16_t epr_mtu; 122 | uint16_t epr_pkey; 123 | uint8_t epr_sl; 124 | uint8_t epr_static_rate; 125 | uint16_t epr_static_ipd; /* Static rate IPD from path record */ 126 | 127 | /* IBTA CCA parameters per path */ 128 | struct ips_proto *proto; 129 | uint16_t epr_ccti; 130 | uint16_t epr_ccti_min; 131 | psmi_timer epr_timer_cca; /* Congestion timer for epr_ccti increment. */ 132 | uint16_t epr_active_ipd; /* The current active IPD. max(static,cct) */ 133 | uint8_t epr_cca_divisor; /* CCA divisor [14:15] in CCT entry */ 134 | uint8_t epr_pad; 135 | 136 | /* TODO: The endpoint timeout should also adjust based on epr_ird */ 137 | uint32_t epr_timeout_ack_factor; 138 | uint64_t epr_timeout_ack; 139 | uint64_t epr_timeout_ack_max; 140 | } ips_path_rec_t; 141 | 142 | typedef struct _ips_opp_path_rec { 143 | ibta_path_rec_t opp_response; 144 | ips_path_rec_t ips; 145 | } ips_opp_path_rec_t; 146 | 147 | psm_error_t ips_opp_init(struct ips_proto *proto); 148 | 149 | #endif 150 | --------------------------------------------------------------------------------